Merge branch 'develop' into vue3

This commit is contained in:
syuilo
2020-07-31 21:27:20 +09:00
19 changed files with 335 additions and 51 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">
@@ -407,18 +407,18 @@ export default defineComponent({
...this.appearNote,
};
const choices = [...this.appearNote.poll.choices];
choices[choice] = {
...choices[choice],
votes: choices[choice].votes + 1,
...(body.userId === this.$store.state.i.id ? {
isVoted: true
} : {})
};
n.poll = {
...this.appearNote.poll,
choices: {
...this.appearNote.poll.choices,
[choice]: {
...this.appearNote.poll.choices[choice],
votes: this.appearNote.poll.choices[choice].votes + 1,
...(body.userId === this.$store.state.i.id ? {
isVoted: true
} : {})
}
}
choices: choices
};
this.updateAppearNote(n);

View File

@@ -51,11 +51,8 @@ export default defineComponent({
};
},
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

@@ -18,8 +18,10 @@
</transition>
</div>
<div class="sub">
<button v-if="widgetsEditMode" class="_button edit active" @click="widgetsEditMode = false"><fa :icon="faGripVertical"/></button>
<button v-else class="_button edit" @click="widgetsEditMode = true"><fa :icon="faGripVertical"/></button>
<template v-if="$store.getters.isSignedIn">
<button v-if="widgetsEditMode" class="_button edit active" @click="widgetsEditMode = false"><fa :icon="faGripVertical"/></button>
<button v-else class="_button edit" @click="widgetsEditMode = true"><fa :icon="faGripVertical"/></button>
</template>
<div class="search">
<fa :icon="faSearch"/>
<input type="search" :placeholder="$t('search')" v-model="searchQuery" v-autocomplete="{ model: 'searchQuery' }" :disabled="searchWait" @keypress="searchKeypress"/>
@@ -141,7 +143,7 @@ export default defineComponent({
};
},
widgets(): any[] {
widgets(): any {
if (this.$store.getters.isSignedIn) {
const widgets = this.$store.state.deviceUser.widgets;
return {
@@ -150,18 +152,24 @@ export default defineComponent({
mobile: widgets.filter(x => x.place === 'mobile'),
};
} else {
return {
left: [],
right: [{
const right = [{
name: 'calendar',
id: 'b', place: 'right', data: {}
}, {
name: 'trends',
id: 'c', place: 'right', data: {}
}];
if (this.$route.name !== 'index') {
right.unshift({
name: 'welcome',
id: 'a', place: 'right', data: {}
}, {
name: 'calendar',
id: 'b', place: 'right', data: {}
}, {
name: 'trends',
id: 'c', place: 'right', data: {}
}],
});
}
return {
left: [],
right,
mobile: [],
};
}

View File

@@ -149,7 +149,7 @@ export class UserProfile {
@Index()
@Column('boolean', {
default: false,
default: false, select: false,
})
public enableWordMute: boolean;

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({