mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-12 13:13:45 +01:00
Merge pull request #19740 from overleaf/jpa-linked-file-metadata
[misc] persist linkedFileData in full project history as file metadata GitOrigin-RevId: f3e8ba947ea34b6796e210a076a248c57188d148
This commit is contained in:
@@ -119,6 +119,7 @@ const ProjectHistoryRedisManager = {
|
||||
ts: new Date(),
|
||||
},
|
||||
version: projectUpdate.version,
|
||||
metadata: projectUpdate.metadata,
|
||||
projectHistoryId,
|
||||
}
|
||||
if (ranges) {
|
||||
|
||||
+47
@@ -170,6 +170,53 @@ describe('ProjectHistoryRedisManager', function () {
|
||||
.should.equal(true)
|
||||
})
|
||||
|
||||
it('should queue an update with file metadata', async function () {
|
||||
const metadata = {
|
||||
importedAt: '2024-07-30T09:14:45.928Z',
|
||||
provider: 'references-provider',
|
||||
}
|
||||
const projectId = 'project-id'
|
||||
const fileId = 'file-id'
|
||||
const url = `http://filestore/project/${projectId}/file/${fileId}`
|
||||
await this.ProjectHistoryRedisManager.promises.queueAddEntity(
|
||||
projectId,
|
||||
this.projectHistoryId,
|
||||
'file',
|
||||
fileId,
|
||||
this.user_id,
|
||||
{
|
||||
pathname: 'foo.png',
|
||||
url,
|
||||
version: 42,
|
||||
metadata,
|
||||
},
|
||||
this.source
|
||||
)
|
||||
|
||||
const update = {
|
||||
pathname: 'foo.png',
|
||||
docLines: undefined,
|
||||
url,
|
||||
meta: {
|
||||
user_id: this.user_id,
|
||||
ts: new Date(),
|
||||
source: this.source,
|
||||
},
|
||||
version: 42,
|
||||
metadata,
|
||||
projectHistoryId: this.projectHistoryId,
|
||||
file: fileId,
|
||||
}
|
||||
|
||||
expect(
|
||||
this.ProjectHistoryRedisManager.promises.queueOps.args[0][1]
|
||||
).to.equal(JSON.stringify(update))
|
||||
this.ProjectHistoryRedisManager.promises.queueOps.should.have.been.calledWithExactly(
|
||||
projectId,
|
||||
JSON.stringify(update)
|
||||
)
|
||||
})
|
||||
|
||||
it('should forward history compatible ranges if history ranges support is enabled', async function () {
|
||||
this.rawUpdate.historyRangesSupport = true
|
||||
this.docLines = 'the quick fox jumps over the lazy dog'
|
||||
|
||||
Reference in New Issue
Block a user