Move logic for selectively loading labels.

Only load labels if the user has write permission
This commit is contained in:
Shane Kilkelly 2017-06-14 13:26:02 +01:00
parent 3b066758bb
commit 5e37b1dac1
3 changed files with 10 additions and 8 deletions

View file

@ -37,7 +37,6 @@ div.full-size(
keybindings="settings.mode",
font-size="settings.fontSize",
auto-complete="settings.autoComplete",
enable-auto-complete-features="!anonymous"
spell-check="!anonymous",
spell-check-language="project.spellCheckLanguage"
highlights="onlineUserCursorHighlights[editor.open_doc_id]"

View file

@ -130,9 +130,6 @@ define [
ide.binaryFilesManager = new BinaryFilesManager(ide, $scope)
ide.labelsManager = new LabelsManager(ide, $scope, labels)
$timeout () ->
ide.labelsManager.loadProjectLabelsFromServer()
inited = false
$scope.$on "project:joined", () ->
return if inited
@ -143,6 +140,13 @@ define [
We don't want to delete your data on ShareLaTeX, so this project still contains your history and collaborators.
If the project has been renamed please look in your project list for a new project under the new name.
""")
$timeout(
() ->
if $scope.permissions.write
ide.labelsManager.loadProjectLabelsFromServer()
_labelsInitialLoadDone = true
, 200
)
DARK_THEMES = [
"ambiance", "chaos", "clouds_midnight", "cobalt", "idle_fingers",

View file

@ -44,7 +44,6 @@ define [
keybindings: "="
fontSize: "="
autoComplete: "="
enableAutoCompleteFeatures: "="
sharejsDoc: "="
spellCheck: "="
spellCheckLanguage: "="
@ -95,9 +94,9 @@ define [
highlightsManager = new HighlightsManager(scope, editor, element)
cursorPositionManager = new CursorPositionManager(scope, editor, element, localStorage)
trackChangesManager = new TrackChangesManager(scope, editor, element)
if scope.enableAutoCompleteFeatures
labelsManager = new LabelsManager(scope, editor, element, labels)
autoCompleteManager = new AutoCompleteManager(scope, editor, element, labelsManager)
labelsManager = new LabelsManager(scope, editor, element, labels)
autoCompleteManager = new AutoCompleteManager(scope, editor, element, labelsManager)
# Prevert Ctrl|Cmd-S from triggering save dialog
editor.commands.addCommand