diff --git a/packages/server/modules/core/repositories/commits.ts b/packages/server/modules/core/repositories/commits.ts index 3d73c7d2c..a9fd2b73a 100644 --- a/packages/server/modules/core/repositories/commits.ts +++ b/packages/server/modules/core/repositories/commits.ts @@ -667,6 +667,7 @@ export const legacyGetPaginatedStreamCommitsPageFactory = { authorName: 'users.name' }, { authorId: 'users.id' }, { authorAvatar: 'users.avatar' }, + { streamId: 'stream_commits.streamId' }, knex.raw(`?? as "author"`, ['users.id']) ]) .select() diff --git a/packages/server/modules/core/tests/commits.spec.js b/packages/server/modules/core/tests/commits.spec.js index 0399e5aeb..ed55ccd3a 100644 --- a/packages/server/modules/core/tests/commits.spec.js +++ b/packages/server/modules/core/tests/commits.spec.js @@ -554,7 +554,15 @@ describe('Commits @core-commits', () => { const idCommit = await getCommit(commitId3, { streamId: stream.id }) - for (const commit of [userCommit, serverCommit, branchCommit, idCommit]) { + expect(userCommit).to.have.property('sourceApplication') + expect(userCommit.sourceApplication).to.be.a('string') + + expect(userCommit).to.have.property('totalChildrenCount') + expect(userCommit.totalChildrenCount).to.be.a('number') + + expect(userCommit).to.have.property('parents') + + for (const commit of [serverCommit, branchCommit, idCommit]) { expect(commit).to.have.property('sourceApplication') expect(commit.sourceApplication).to.be.a('string') @@ -562,10 +570,12 @@ describe('Commits @core-commits', () => { expect(commit.totalChildrenCount).to.be.a('number') expect(commit).to.have.property('parents') + expect(commit.streamId).to.equal(stream.id) } expect(idCommit.parents).to.be.a('array') expect(idCommit.parents.length).to.equal(2) + expect(idCommit.streamId).to.equal(stream.id) }) it('Should have an array of parents', async () => {