setActions on mode change or user change
Signed-off-by: James Ketrenos <james_git@ketrenos.com>
This commit is contained in:
parent
4cdc8f0ba7
commit
0d1aa9223b
@ -725,6 +725,7 @@
|
|||||||
}
|
}
|
||||||
console.log("Mode changed to " + mode);
|
console.log("Mode changed to " + mode);
|
||||||
this.path = "";
|
this.path = "";
|
||||||
|
this.setActions();
|
||||||
this.resetPhotos();
|
this.resetPhotos();
|
||||||
this._loadAlbums();
|
this._loadAlbums();
|
||||||
this._loadPhotos();
|
this._loadPhotos();
|
||||||
@ -1591,6 +1592,23 @@
|
|||||||
}, 100);
|
}, 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) {
|
userChanged: function(user) {
|
||||||
if (!this.firstRequest) {
|
if (!this.firstRequest) {
|
||||||
this.mode = "loading";
|
this.mode = "loading";
|
||||||
@ -1610,20 +1628,7 @@
|
|||||||
if (user.authenticated && user.mailVerified) {
|
if (user.authenticated && user.mailVerified) {
|
||||||
this.loginStatus = null;
|
this.loginStatus = null;
|
||||||
this.mode = "memories";
|
this.mode = "memories";
|
||||||
if (user.maintainer) {
|
this.setActions();
|
||||||
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 = [];
|
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user