Label updates with an origin when migrating history (#5689)

* Label updates with an origin when migrating history

GitOrigin-RevId: 78b2b521a08610a178ea84f78f8f9644d798d509
This commit is contained in:
Eric Mc Sween 2021-11-08 10:04:06 -05:00 committed by Copybot
parent f97f753b1e
commit 37018af773
2 changed files with 14 additions and 3 deletions

View file

@ -87,11 +87,18 @@ async function deleteProjectHistory(projectId) {
} }
} }
async function resyncProject(projectId, force = false) { async function resyncProject(projectId, options = {}) {
try { try {
const body = {}
if (options.force) {
body.force = options.force
}
if (options.origin) {
body.origin = options.origin
}
await request.post({ await request.post({
url: `${settings.apis.project_history.url}/project/${projectId}/resync`, url: `${settings.apis.project_history.url}/project/${projectId}/resync`,
qs: { force }, // TODO: only send if true? json: body,
}) })
} catch (err) { } catch (err) {
throw OError.tag(err, 'failed to resync project history', { projectId }) throw OError.tag(err, 'failed to resync project history', { projectId })

View file

@ -177,13 +177,17 @@ script(type="text/ng-template", id="historyEntryTpl")
ng-style="$ctrl.getUserCSSStyle(update_user);" ng-style="$ctrl.getUserCSSStyle(update_user);"
) #{translate("anonymous")} ) #{translate("anonymous")}
li.history-entry-metadata-user( li.history-entry-metadata-user(
ng-if="::$ctrl.entry.meta.origin" ng-if="::$ctrl.entry.meta.origin && $ctrl.entry.meta.users.length == 0"
ng-switch on="::$ctrl.entry.meta.origin.kind" ng-switch on="::$ctrl.entry.meta.origin.kind"
) )
span.name( span.name(
ng-switch-when="history-resync" ng-switch-when="history-resync"
ng-style="$ctrl.getUserCSSStyle()" ng-style="$ctrl.getUserCSSStyle()"
) #{translate("overleaf_history_system")} ) #{translate("overleaf_history_system")}
span.name(
ng-switch-when="history-migration"
ng-style="$ctrl.getUserCSSStyle()"
) #{translate("overleaf_history_system")}
span.name( span.name(
ng-switch-default ng-switch-default
ng-style="$ctrl.getUserCSSStyle()" ng-style="$ctrl.getUserCSSStyle()"