From 4563ce864c3569cf0816b05d1f95ffbe892162df Mon Sep 17 00:00:00 2001 From: Paulo Jorge Reis Date: Tue, 18 Dec 2018 11:09:56 +0000 Subject: [PATCH] Merge pull request #1285 from sharelatex/pr-history-compare-labels-fixes History compare labels fixes GitOrigin-RevId: 176750c4017e5511a22f1792e37ab8918a142ec3 --- .../views/project/editor/history/entriesListV2.pug | 2 +- .../web/public/src/ide/history/HistoryV2Manager.js | 12 ++++++++++-- .../history/controllers/HistoryCompareController.js | 2 ++ .../public/stylesheets/app/editor/history-v2.less | 1 - 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/services/web/app/views/project/editor/history/entriesListV2.pug b/services/web/app/views/project/editor/history/entriesListV2.pug index bc97ee5b35..69c5b3edaf 100644 --- a/services/web/app/views/project/editor/history/entriesListV2.pug +++ b/services/web/app/views/project/editor/history/entriesListV2.pug @@ -111,7 +111,7 @@ aside.change-list.change-list-compare( div.user(ng-repeat="update_user in ::update.meta.users") .color-square(ng-if="::update_user != null", ng-style="::{'background-color': 'hsl({{ update_user.hue }}, 70%, 50%)'}") .color-square(ng-if="::update_user == null", ng-style="::{'background-color': 'hsl(100, 70%, 50%)'}") - .name(ng-if="::update_user && update_user.id != user.id" ng-bind="displayName(update_user)") + .name(ng-if="::update_user && update_user.id != user.id" ng-bind="getDisplayNameForUser(update_user)") .name(ng-if="::update_user && update_user.id == user.id") You .name(ng-if="::update_user == null") #{translate("anonymous")} div.user(ng-if="::update.meta.users.length == 0") diff --git a/services/web/public/src/ide/history/HistoryV2Manager.js b/services/web/public/src/ide/history/HistoryV2Manager.js index 3037e34490..e78ad8c038 100644 --- a/services/web/public/src/ide/history/HistoryV2Manager.js +++ b/services/web/public/src/ide/history/HistoryV2Manager.js @@ -482,10 +482,15 @@ define([ .all(requests) .then(response => { const updatesData = response.updates.data + let lastUpdateToV = null + + if (updatesData.updates.length > 0) { + lastUpdateToV = updatesData.updates[0].toV + } if (response.labels != null) { this.$scope.history.labels = this._loadLabels( response.labels.data, - updatesData.updates[0].toV + lastUpdateToV ) } this._loadUpdates(updatesData.updates) @@ -493,7 +498,8 @@ define([ updatesData.nextBeforeTimestamp if ( updatesData.nextBeforeTimestamp == null || - this.$scope.history.freeHistoryLimitHit + this.$scope.history.freeHistoryLimitHit || + this.$scope.history.updates.length === 0 ) { this.$scope.history.atEnd = true } @@ -504,6 +510,8 @@ define([ .catch(error => { const { status, statusText } = error this.$scope.history.error = { status, statusText } + this.$scope.history.atEnd = true + this.$scope.history.loadingFileTree = false }) } diff --git a/services/web/public/src/ide/history/controllers/HistoryCompareController.js b/services/web/public/src/ide/history/controllers/HistoryCompareController.js index 59dae6dfc3..477ae4149b 100644 --- a/services/web/public/src/ide/history/controllers/HistoryCompareController.js +++ b/services/web/public/src/ide/history/controllers/HistoryCompareController.js @@ -70,6 +70,8 @@ define(['base', 'ide/history/util/displayNameForUser'], function( $scope.getDisplayNameById = id => displayNameForUser($scope.getUserById(id)) + $scope.getDisplayNameForUser = user => displayNameForUser(user) + $scope.deleteLabel = labelDetails => $modal.open({ templateUrl: 'historyV2DeleteLabelModalTemplate', diff --git a/services/web/public/stylesheets/app/editor/history-v2.less b/services/web/public/stylesheets/app/editor/history-v2.less index 99f3a0fed7..c2c504fc6e 100644 --- a/services/web/public/stylesheets/app/editor/history-v2.less +++ b/services/web/public/stylesheets/app/editor/history-v2.less @@ -283,7 +283,6 @@ .history-file-entity-link-selected { background-color: @file-tree-item-selected-bg; font-weight: bold; - padding-right: 32px; color: #FFF; .fake-full-width-bg(@file-tree-item-selected-bg); &:hover {