Undo reaction with clicking minus (#3773)

* Undo reaction with clicking minus

* fix isMyNote
This commit is contained in:
MeiMei 2018-12-28 01:01:58 +09:00 committed by syuilo
parent 6c1893f869
commit 1029bff5ff
6 changed files with 26 additions and 4 deletions

View File

@ -752,11 +752,13 @@ desktop/views/components/note-detail.vue:
location: "位置情報" location: "位置情報"
renote: "Renote" renote: "Renote"
add-reaction: "リアクション" add-reaction: "リアクション"
undo-reaction: "リアクション解除"
desktop/views/components/note.vue: desktop/views/components/note.vue:
reply: "返信" reply: "返信"
renote: "Renote" renote: "Renote"
add-reaction: "リアクション" add-reaction: "リアクション"
undo-reaction: "リアクション解除"
detail: "詳細" detail: "詳細"
private: "この投稿は非公開です" private: "この投稿は非公開です"
deleted: "この投稿は削除されました" deleted: "この投稿は削除されました"

View File

@ -142,6 +142,14 @@ export default (opts: Opts = {}) => ({
}); });
}, },
undoReact(note) {
const oldReaction = note.myReaction;
if (!oldReaction) return;
this.$root.api('notes/reactions/delete', {
noteId: note.id
});
},
favorite() { favorite() {
this.$root.api('notes/favorites/create', { this.$root.api('notes/favorites/create', {
noteId: this.appearNote.id noteId: this.appearNote.id

View File

@ -76,9 +76,12 @@
<button v-else class="inhibitedButton"> <button v-else class="inhibitedButton">
<fa icon="ban"/> <fa icon="ban"/>
</button> </button>
<button class="reactionButton" :class="{ reacted: appearNote.myReaction != null }" v-if="!isMyNote" @click="react()" ref="reactButton" :title="$t('add-reaction')"> <button v-if="!isMyNote && appearNote.myReaction == null" class="reactionButton" @click="react()" ref="reactButton" :title="$t('add-reaction')">
<fa icon="plus"/> <fa icon="plus"/>
</button> </button>
<button v-if="!isMyNote && appearNote.myReaction != null" class="reactionButton reacted" @click="undoReact(appearNote)" ref="reactButton" :title="$t('undo-reaction')">
<fa icon="minus"/>
</button>
<button @click="menu()" ref="menuButton"> <button @click="menu()" ref="menuButton">
<fa icon="ellipsis-h"/> <fa icon="ellipsis-h"/>
</button> </button>

View File

@ -53,9 +53,12 @@
<button v-else class="inhibitedButton"> <button v-else class="inhibitedButton">
<fa icon="ban"/> <fa icon="ban"/>
</button> </button>
<button class="reactionButton" :class="{ reacted: appearNote.myReaction != null }" v-if="!isMyNote" @click="react()" ref="reactButton" :title="$t('add-reaction')"> <button v-if="!isMyNote && appearNote.myReaction == null" class="reactionButton" @click="react()" ref="reactButton" :title="$t('add-reaction')">
<fa icon="plus"/> <fa icon="plus"/>
</button> </button>
<button v-if="!isMyNote && appearNote.myReaction != null" class="reactionButton reacted" @click="undoReact(appearNote)" ref="reactButton" :title="$t('undo-reaction')">
<fa icon="minus"/>
</button>
<button @click="menu()" ref="menuButton"> <button @click="menu()" ref="menuButton">
<fa icon="ellipsis-h"/> <fa icon="ellipsis-h"/>
</button> </button>

View File

@ -72,9 +72,12 @@
<button v-else> <button v-else>
<fa icon="ban"/> <fa icon="ban"/>
</button> </button>
<button :class="{ reacted: appearNote.myReaction != null }" @click="react()" v-if="!isMyNote" ref="reactButton" :title="$t('title')"> <button v-if="!isMyNote && appearNote.myReaction == null" class="reactionButton" @click="react()" ref="reactButton">
<fa icon="plus"/> <fa icon="plus"/>
</button> </button>
<button v-if="!isMyNote && appearNote.myReaction != null" class="reactionButton reacted" @click="undoReact(appearNote)" ref="reactButton">
<fa icon="minus"/>
</button>
<button @click="menu()" ref="menuButton"> <button @click="menu()" ref="menuButton">
<fa icon="ellipsis-h"/> <fa icon="ellipsis-h"/>
</button> </button>

View File

@ -49,9 +49,12 @@
<button v-else> <button v-else>
<fa icon="ban"/> <fa icon="ban"/>
</button> </button>
<button :class="{ reacted: appearNote.myReaction != null }" @click="react()" v-if="!isMyNote" ref="reactButton"> <button v-if="!isMyNote && appearNote.myReaction == null" class="reactionButton" @click="react()" ref="reactButton">
<fa icon="plus"/> <fa icon="plus"/>
</button> </button>
<button v-if="!isMyNote && appearNote.myReaction != null" class="reactionButton reacted" @click="undoReact(appearNote)" ref="reactButton">
<fa icon="minus"/>
</button>
<button class="menu" @click="menu()" ref="menuButton"> <button class="menu" @click="menu()" ref="menuButton">
<fa icon="ellipsis-h"/> <fa icon="ellipsis-h"/>
</button> </button>