タップ不可能なリアクションを押してもパーティクルが出るバグを修正 (#6472)

* resolve #6453

* リアクションビューワーのトグル可能判定にログインしているかどうかも反映
This commit is contained in:
Xeltica 2020-06-21 22:34:28 +09:00 committed by GitHub
parent 8dbdab4a47
commit aa652aac8a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 7 deletions

View file

@ -9,9 +9,9 @@
@mouseleave="onMouseleave" @mouseleave="onMouseleave"
@touchend="onMouseleave" @touchend="onMouseleave"
ref="reaction" ref="reaction"
v-particle v-particle="canToggle"
> >
<x-reaction-icon :reaction="reaction" :customEmojis="note.emojis" ref="icon"/> <x-reaction-icon :reaction="reaction" :custom-emojis="note.emojis" ref="icon"/>
<span>{{ count }}</span> <span>{{ count }}</span>
</button> </button>
</template> </template>
@ -55,21 +55,20 @@ export default Vue.extend({
return this.$store.getters.isSignedIn && this.$store.state.i.id === this.note.userId; return this.$store.getters.isSignedIn && this.$store.state.i.id === this.note.userId;
}, },
canToggle(): boolean { canToggle(): boolean {
return !this.reaction.match(/@\w/); return !this.reaction.match(/@\w/) && !this.isMe && this.$store.getters.isSignedIn;
}, },
}, },
mounted() {
if (!this.isInitial) this.anime();
},
watch: { watch: {
count(newCount, oldCount) { count(newCount, oldCount) {
if (oldCount < newCount) this.anime(); if (oldCount < newCount) this.anime();
if (this.details != null) this.openDetails(); if (this.details != null) this.openDetails();
}, },
}, },
mounted() {
if (!this.isInitial) this.anime();
},
methods: { methods: {
toggleReaction() { toggleReaction() {
if (this.isMe) return;
if (!this.canToggle) return; if (!this.canToggle) return;
const oldReaction = this.note.myReaction; const oldReaction = this.note.myReaction;

View file

@ -2,6 +2,8 @@ import Particle from '../components/particle.vue';
export default { export default {
bind(el, binding, vn) { bind(el, binding, vn) {
// 明示的に false であればバインドしない
if (binding.value === false) return;
el.addEventListener('click', () => { el.addEventListener('click', () => {
const rect = el.getBoundingClientRect(); const rect = el.getBoundingClientRect();