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

Merge pull request #1776 from overleaf/pr-history-ui-filenames-overflow

History filenames overflow + full history for admins

GitOrigin-RevId: b52d79e0aa1cb600eacb475d21b603f42c8cf18c
Alasdair Smith 7 лет назад
Родитель
Сommit
4e8facf3cc

+ 1 - 0
services/web/app/coffee/Features/Project/ProjectController.coffee

@@ -369,6 +369,7 @@ module.exports = ProjectController =
 						features: user.features
 						refProviders: user.refProviders
 						betaProgram: user.betaProgram
+						isAdmin: user.isAdmin
 					}
 					userSettings: {
 						mode  : user.ace.mode

+ 3 - 0
services/web/public/src/ide/history/HistoryV2Manager.js

@@ -161,6 +161,9 @@ define([
           hasVersioning => {
             if (hasVersioning != null) {
               this.$scope.history.userHasFullFeature = hasVersioning
+              if (this.$scope.user.isAdmin) {
+                this.$scope.history.userHasFullFeature = true
+              }
               _deregisterFeatureWatcher()
             }
           }

+ 2 - 2
services/web/public/stylesheets/app/editor/history-v2.less

@@ -246,7 +246,7 @@
 		margin-bottom: 3px;
 	}
 		.history-entry-change {
-
+			word-break: break-all;
 		}
 			.history-entry-change-action {
 				margin-right: 0.5em;
@@ -255,7 +255,7 @@
 			.history-entry-change-doc {
 				color: @history-highlight-color;
 				font-weight: bold;
-				word-break: break-all;
+
 				.history-entry-selected &,
 				.history-entry-hover-selected &,
 				.history-version-with-label-selected & {

+ 15 - 0
services/web/test/unit_frontend/src/ide/history/HistoryV2ManagerTests.js

@@ -146,6 +146,9 @@ define(['ide/history/HistoryV2Manager'], HistoryV2Manager =>
             versioning: true
           }
         }
+        this.$scope.user = {
+          isAdmin: false
+        }
         this.ide = {
           $q: $q,
           $http: $http
@@ -199,6 +202,18 @@ define(['ide/history/HistoryV2Manager'], HistoryV2Manager =>
       expect(this.$scope.history.userHasFullFeature).to.equal(false)
     })
 
+    it('should setup history with full access to the feature for admin users even if the project does not have versioning', function() {
+      this.$scope.project.features.versioning = false
+      this.$scope.user.isAdmin = true
+      this.historyManager = new HistoryV2Manager(
+        this.ide,
+        this.$scope,
+        this.localStorage
+      )
+      this.$scope.$digest()
+      expect(this.$scope.history.userHasFullFeature).to.equal(true)
+    })
+
     describe('autoSelectFile', function() {
       beforeEach(function() {
         this.mockedFilesList = [