summaryrefslogtreecommitdiff
path: root/src/client
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2018-10-13 00:54:30 +0900
committersyuilo <syuilotan@yahoo.co.jp>2018-10-13 00:54:30 +0900
commit719fac6480f8bd39498f2e92c83cac0fa26fb282 (patch)
treee671e7b5e59777563f6799736a6d4a8fe45695e1 /src/client
parent10.10.1 (diff)
downloadsharkey-719fac6480f8bd39498f2e92c83cac0fa26fb282.tar.gz
sharkey-719fac6480f8bd39498f2e92c83cac0fa26fb282.tar.bz2
sharkey-719fac6480f8bd39498f2e92c83cac0fa26fb282.zip
お気に入りを解除できるように
Diffstat (limited to 'src/client')
-rw-r--r--src/client/app/common/views/components/note-menu.vue30
1 files changed, 25 insertions, 5 deletions
diff --git a/src/client/app/common/views/components/note-menu.vue b/src/client/app/common/views/components/note-menu.vue
index 6030e4fd30..21713e56a0 100644
--- a/src/client/app/common/views/components/note-menu.vue
+++ b/src/client/app/common/views/components/note-menu.vue
@@ -22,11 +22,21 @@ export default Vue.extend({
icon: '%fa:link%',
text: '%i18n:@copy-link%',
action: this.copyLink
- }, null, {
- icon: '%fa:star%',
- text: '%i18n:@favorite%',
- action: this.favorite
- }];
+ }, null];
+
+ if (this.note.isFavorited) {
+ items.push({
+ icon: '%fa:star%',
+ text: '%i18n:@unfavorite%',
+ action: this.unfavorite
+ });
+ } else {
+ items.push({
+ icon: '%fa:star%',
+ text: '%i18n:@favorite%',
+ action: this.favorite
+ });
+ }
if (this.note.userId == this.$store.state.i.id) {
if ((this.$store.state.i.pinnedNoteIds || []).includes(this.note.id)) {
@@ -45,6 +55,7 @@ export default Vue.extend({
}
if (this.note.userId == this.$store.state.i.id || this.$store.state.i.isAdmin) {
+ items.push(null);
items.push({
icon: '%fa:trash-alt R%',
text: '%i18n:@delete%',
@@ -110,6 +121,15 @@ export default Vue.extend({
});
},
+ unfavorite() {
+ (this as any).api('notes/favorites/delete', {
+ noteId: this.note.id
+ }).then(() => {
+ (this as any).os.new(Ok);
+ this.destroyDom();
+ });
+ },
+
closed() {
this.$nextTick(() => {
this.destroyDom();