Просмотр исходного кода

Merge pull request #1285 from sharelatex/pr-history-compare-labels-fixes

History compare labels fixes

GitOrigin-RevId: 176750c4017e5511a22f1792e37ab8918a142ec3
Paulo Jorge Reis 7 лет назад
Родитель
Сommit
4563ce864c

+ 1 - 1
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")

+ 10 - 2
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
           })
       }
 

+ 2 - 0
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',

+ 0 - 1
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 {