From 4e8facf3ccbe3b52d12f8747fec1a09d13d6d04e Mon Sep 17 00:00:00 2001 From: Alasdair Smith Date: Tue, 28 May 2019 12:04:35 +0100 Subject: [PATCH] Merge pull request #1776 from overleaf/pr-history-ui-filenames-overflow History filenames overflow + full history for admins GitOrigin-RevId: b52d79e0aa1cb600eacb475d21b603f42c8cf18c --- .../Features/Project/ProjectController.coffee | 1 + .../public/src/ide/history/HistoryV2Manager.js | 3 +++ .../public/stylesheets/app/editor/history-v2.less | 4 ++-- .../src/ide/history/HistoryV2ManagerTests.js | 15 +++++++++++++++ 4 files changed, 21 insertions(+), 2 deletions(-) diff --git a/services/web/app/coffee/Features/Project/ProjectController.coffee b/services/web/app/coffee/Features/Project/ProjectController.coffee index a6792878d5..a55f7e7698 100644 --- a/services/web/app/coffee/Features/Project/ProjectController.coffee +++ b/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 diff --git a/services/web/public/src/ide/history/HistoryV2Manager.js b/services/web/public/src/ide/history/HistoryV2Manager.js index f5fb882cc3..deda393992 100644 --- a/services/web/public/src/ide/history/HistoryV2Manager.js +++ b/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() } } diff --git a/services/web/public/stylesheets/app/editor/history-v2.less b/services/web/public/stylesheets/app/editor/history-v2.less index 866abbc432..b86e47af49 100644 --- a/services/web/public/stylesheets/app/editor/history-v2.less +++ b/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 & { diff --git a/services/web/test/unit_frontend/src/ide/history/HistoryV2ManagerTests.js b/services/web/test/unit_frontend/src/ide/history/HistoryV2ManagerTests.js index 1ba33255aa..45bf53aee0 100644 --- a/services/web/test/unit_frontend/src/ide/history/HistoryV2ManagerTests.js +++ b/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 = [