自分のノートにリアクションを押せるように (#6506)

* resolve #6468

* リモートから来たセルフリアクションの対応
This commit is contained in:
Xeltica 2020-07-30 20:28:35 +09:00 committed by GitHub
parent c123c602f6
commit 9417b30d12
5 changed files with 3 additions and 20 deletions

View File

@ -71,10 +71,10 @@
<button v-else class="button _button">
<fa :icon="faBan"/>
</button>
<button v-if="!isMyNote && appearNote.myReaction == null" class="button _button" @click="react()" ref="reactButton">
<button v-if="appearNote.myReaction == null" class="button _button" @click="react()" ref="reactButton">
<fa :icon="faPlus"/>
</button>
<button v-if="!isMyNote && appearNote.myReaction != null" class="button _button reacted" @click="undoReact(appearNote)" ref="reactButton">
<button v-if="appearNote.myReaction != null" class="button _button reacted" @click="undoReact(appearNote)" ref="reactButton">
<fa :icon="faMinus"/>
</button>
<button class="button _button" @click="menu()" ref="menuButton">

View File

@ -51,11 +51,8 @@ export default Vue.extend({
};
},
computed: {
isMe(): boolean {
return this.$store.getters.isSignedIn && this.$store.state.i.id === this.note.userId;
},
canToggle(): boolean {
return !this.reaction.match(/@\w/) && !this.isMe && this.$store.getters.isSignedIn;
return !this.reaction.match(/@\w/) && this.$store.getters.isSignedIn;
},
},
watch: {

View File

@ -9,8 +9,6 @@ export default async (actor: IRemoteUser, activity: ILike) => {
const note = await fetchNote(targetUri);
if (!note) return `skip: target note not found ${targetUri}`;
if (actor.id === note.userId) return `skip: cannot react to my note`;
await extractEmojis(activity.tag || [], actor.host).catch(() => null);
await create(actor, note, activity._misskey_reaction || activity.content || activity.name);

View File

@ -40,12 +40,6 @@ export const meta = {
id: '033d0620-5bfe-4027-965d-980b0c85a3ea'
},
isMyNote: {
message: 'You can not react to your own notes.',
code: 'IS_MY_NOTE',
id: '7eeb9714-b047-43b5-b559-7b1b72810f53'
},
alreadyReacted: {
message: 'You are already reacting to that note.',
code: 'ALREADY_REACTED',
@ -60,7 +54,6 @@ export default define(meta, async (ps, user) => {
throw e;
});
await createReaction(user, note, ps.reaction).catch(e => {
if (e.id === '2d8e7297-1873-4c00-8404-792c68d7bef0') throw new ApiError(meta.errors.isMyNote);
if (e.id === '51c42bb4-931a-456b-bff7-e5a8a70dd298') throw new ApiError(meta.errors.alreadyReacted);
throw e;
});

View File

@ -15,11 +15,6 @@ import { createNotification } from '../../create-notification';
import deleteReaction from './delete';
export default async (user: User, note: Note, reaction?: string) => {
// Myself
if (note.userId === user.id) {
throw new IdentifiableError('2d8e7297-1873-4c00-8404-792c68d7bef0', 'cannot react to my note');
}
reaction = await toDbReaction(reaction, user.host);
const exist = await NoteReactions.findOne({