From 0d1aa9223bf120d4b0114218c3b8690f871f3ac3 Mon Sep 17 00:00:00 2001 From: James Ketrenos Date: Tue, 16 Oct 2018 16:58:47 -0700 Subject: [PATCH] setActions on mode change or user change Signed-off-by: James Ketrenos --- frontend/src/ketr-photos/ketr-photos.html | 33 +++++++++++++---------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/frontend/src/ketr-photos/ketr-photos.html b/frontend/src/ketr-photos/ketr-photos.html index 655626f..695484e 100755 --- a/frontend/src/ketr-photos/ketr-photos.html +++ b/frontend/src/ketr-photos/ketr-photos.html @@ -725,6 +725,7 @@ } console.log("Mode changed to " + mode); this.path = ""; + this.setActions(); this.resetPhotos(); this._loadAlbums(); this._loadPhotos(); @@ -1591,6 +1592,23 @@ }, 100); }, + setActions: function() { + if (this.user && this.user.maintainer) { + let actions = [ "delete" ]; + if (this.mode == "duplicates") { + actions.unshift("text-format"); + } else if (this.mode == "trash") { + actions.unshift("undo"); + } else { + actions.unshift("image:rotate-right"); + actions.unshift("image:rotate-left"); + } + this.actions = actions; + } else { + this.actions = []; + } + }, + userChanged: function(user) { if (!this.firstRequest) { this.mode = "loading"; @@ -1610,20 +1628,7 @@ if (user.authenticated && user.mailVerified) { this.loginStatus = null; this.mode = "memories"; - if (user.maintainer) { - let actions = [ "delete" ]; - if (this.mode == "duplicates") { - actions.unshift("text-format"); - } else if (this.mode == "trash") { - actions.unshift("undo"); - } else { - actions.unshift("image:rotate-right"); - actions.unshift("image:rotate-left"); - } - this.actions = actions; - } else { - this.actions = []; - } + this.setActions(); return; }