From 05a65b0ff9039aefc06cf99adf464d2ff0759797 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerg=C5=91=20Jedlicska?= Date: Tue, 19 Nov 2024 10:26:26 +0100 Subject: [PATCH] fix(commits): add streamId to legacyCommitsQuery --- packages/server/modules/core/repositories/commits.ts | 1 + packages/server/modules/core/tests/commits.spec.js | 12 +++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/packages/server/modules/core/repositories/commits.ts b/packages/server/modules/core/repositories/commits.ts index 3d73c7d2ca..a9fd2b73aa 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 0399e5aebf..ed55ccd3a8 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 () => {