mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-05 17:23:09 +02:00
upd: change the way likes get handled
This commit is contained in:
parent
5af274ef0a
commit
a3fd51d6e0
8 changed files with 94 additions and 37 deletions
|
@ -284,6 +284,7 @@ import * as ep___notes_polls_vote from './endpoints/notes/polls/vote.js';
|
||||||
import * as ep___notes_reactions from './endpoints/notes/reactions.js';
|
import * as ep___notes_reactions from './endpoints/notes/reactions.js';
|
||||||
import * as ep___notes_reactions_create from './endpoints/notes/reactions/create.js';
|
import * as ep___notes_reactions_create from './endpoints/notes/reactions/create.js';
|
||||||
import * as ep___notes_reactions_delete from './endpoints/notes/reactions/delete.js';
|
import * as ep___notes_reactions_delete from './endpoints/notes/reactions/delete.js';
|
||||||
|
import * as ep___notes_like from './endpoints/notes/like.js';
|
||||||
import * as ep___notes_renotes from './endpoints/notes/renotes.js';
|
import * as ep___notes_renotes from './endpoints/notes/renotes.js';
|
||||||
import * as ep___notes_replies from './endpoints/notes/replies.js';
|
import * as ep___notes_replies from './endpoints/notes/replies.js';
|
||||||
import * as ep___notes_edit from './endpoints/notes/edit.js';
|
import * as ep___notes_edit from './endpoints/notes/edit.js';
|
||||||
|
@ -653,6 +654,7 @@ const $notes_polls_vote: Provider = { provide: 'ep:notes/polls/vote', useClass:
|
||||||
const $notes_reactions: Provider = { provide: 'ep:notes/reactions', useClass: ep___notes_reactions.default };
|
const $notes_reactions: Provider = { provide: 'ep:notes/reactions', useClass: ep___notes_reactions.default };
|
||||||
const $notes_reactions_create: Provider = { provide: 'ep:notes/reactions/create', useClass: ep___notes_reactions_create.default };
|
const $notes_reactions_create: Provider = { provide: 'ep:notes/reactions/create', useClass: ep___notes_reactions_create.default };
|
||||||
const $notes_reactions_delete: Provider = { provide: 'ep:notes/reactions/delete', useClass: ep___notes_reactions_delete.default };
|
const $notes_reactions_delete: Provider = { provide: 'ep:notes/reactions/delete', useClass: ep___notes_reactions_delete.default };
|
||||||
|
const $notes_like: Provider = { provide: 'ep:notes/like', useClass: ep___notes_like.default };
|
||||||
const $notes_renotes: Provider = { provide: 'ep:notes/renotes', useClass: ep___notes_renotes.default };
|
const $notes_renotes: Provider = { provide: 'ep:notes/renotes', useClass: ep___notes_renotes.default };
|
||||||
const $notes_replies: Provider = { provide: 'ep:notes/replies', useClass: ep___notes_replies.default };
|
const $notes_replies: Provider = { provide: 'ep:notes/replies', useClass: ep___notes_replies.default };
|
||||||
const $notes_searchByTag: Provider = { provide: 'ep:notes/search-by-tag', useClass: ep___notes_searchByTag.default };
|
const $notes_searchByTag: Provider = { provide: 'ep:notes/search-by-tag', useClass: ep___notes_searchByTag.default };
|
||||||
|
@ -1026,6 +1028,7 @@ const $sponsors: Provider = { provide: 'ep:sponsors', useClass: ep___sponsors.de
|
||||||
$notes_reactions,
|
$notes_reactions,
|
||||||
$notes_reactions_create,
|
$notes_reactions_create,
|
||||||
$notes_reactions_delete,
|
$notes_reactions_delete,
|
||||||
|
$notes_like,
|
||||||
$notes_renotes,
|
$notes_renotes,
|
||||||
$notes_replies,
|
$notes_replies,
|
||||||
$notes_searchByTag,
|
$notes_searchByTag,
|
||||||
|
@ -1393,6 +1396,7 @@ const $sponsors: Provider = { provide: 'ep:sponsors', useClass: ep___sponsors.de
|
||||||
$notes_reactions,
|
$notes_reactions,
|
||||||
$notes_reactions_create,
|
$notes_reactions_create,
|
||||||
$notes_reactions_delete,
|
$notes_reactions_delete,
|
||||||
|
$notes_like,
|
||||||
$notes_renotes,
|
$notes_renotes,
|
||||||
$notes_replies,
|
$notes_replies,
|
||||||
$notes_searchByTag,
|
$notes_searchByTag,
|
||||||
|
|
|
@ -284,6 +284,7 @@ import * as ep___notes_polls_vote from './endpoints/notes/polls/vote.js';
|
||||||
import * as ep___notes_reactions from './endpoints/notes/reactions.js';
|
import * as ep___notes_reactions from './endpoints/notes/reactions.js';
|
||||||
import * as ep___notes_reactions_create from './endpoints/notes/reactions/create.js';
|
import * as ep___notes_reactions_create from './endpoints/notes/reactions/create.js';
|
||||||
import * as ep___notes_reactions_delete from './endpoints/notes/reactions/delete.js';
|
import * as ep___notes_reactions_delete from './endpoints/notes/reactions/delete.js';
|
||||||
|
import * as ep___notes_like from './endpoints/notes/like.js';
|
||||||
import * as ep___notes_renotes from './endpoints/notes/renotes.js';
|
import * as ep___notes_renotes from './endpoints/notes/renotes.js';
|
||||||
import * as ep___notes_replies from './endpoints/notes/replies.js';
|
import * as ep___notes_replies from './endpoints/notes/replies.js';
|
||||||
import * as ep___notes_searchByTag from './endpoints/notes/search-by-tag.js';
|
import * as ep___notes_searchByTag from './endpoints/notes/search-by-tag.js';
|
||||||
|
@ -651,6 +652,7 @@ const eps = [
|
||||||
['notes/reactions', ep___notes_reactions],
|
['notes/reactions', ep___notes_reactions],
|
||||||
['notes/reactions/create', ep___notes_reactions_create],
|
['notes/reactions/create', ep___notes_reactions_create],
|
||||||
['notes/reactions/delete', ep___notes_reactions_delete],
|
['notes/reactions/delete', ep___notes_reactions_delete],
|
||||||
|
['notes/like', ep___notes_like],
|
||||||
['notes/renotes', ep___notes_renotes],
|
['notes/renotes', ep___notes_renotes],
|
||||||
['notes/replies', ep___notes_replies],
|
['notes/replies', ep___notes_replies],
|
||||||
['notes/search-by-tag', ep___notes_searchByTag],
|
['notes/search-by-tag', ep___notes_searchByTag],
|
||||||
|
|
66
packages/backend/src/server/api/endpoints/notes/like.ts
Normal file
66
packages/backend/src/server/api/endpoints/notes/like.ts
Normal file
|
@ -0,0 +1,66 @@
|
||||||
|
import { Injectable } from '@nestjs/common';
|
||||||
|
import { Endpoint } from '@/server/api/endpoint-base.js';
|
||||||
|
import { GetterService } from '@/server/api/GetterService.js';
|
||||||
|
import { ReactionService } from '@/core/ReactionService.js';
|
||||||
|
import { MetaService } from '@/core/MetaService.js';
|
||||||
|
import { ApiError } from '../../error.js';
|
||||||
|
|
||||||
|
export const meta = {
|
||||||
|
tags: ['notes'],
|
||||||
|
|
||||||
|
requireCredential: true,
|
||||||
|
|
||||||
|
prohibitMoved: true,
|
||||||
|
|
||||||
|
kind: 'write:reactions',
|
||||||
|
|
||||||
|
errors: {
|
||||||
|
noSuchNote: {
|
||||||
|
message: 'No such note.',
|
||||||
|
code: 'NO_SUCH_NOTE',
|
||||||
|
id: '033d0620-5bfe-4027-965d-980b0c85a3ea',
|
||||||
|
},
|
||||||
|
|
||||||
|
youHaveBeenBlocked: {
|
||||||
|
message: 'You cannot like this note because you have been blocked by this user.',
|
||||||
|
code: 'YOU_HAVE_BEEN_BLOCKED',
|
||||||
|
id: '20ef5475-9f38-4e4c-bd33-de6d979498ec',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
} as const;
|
||||||
|
|
||||||
|
export const paramDef = {
|
||||||
|
type: 'object',
|
||||||
|
properties: {
|
||||||
|
noteId: { type: 'string', format: 'misskey:id' },
|
||||||
|
override: { type: 'string', nullable: true },
|
||||||
|
},
|
||||||
|
required: ['noteId'],
|
||||||
|
} as const;
|
||||||
|
|
||||||
|
@Injectable()
|
||||||
|
export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-disable-line import/no-default-export
|
||||||
|
constructor(
|
||||||
|
private getterService: GetterService,
|
||||||
|
private reactionService: ReactionService,
|
||||||
|
private metaService: MetaService,
|
||||||
|
) {
|
||||||
|
super(meta, paramDef, async (ps, me) => {
|
||||||
|
const instance = await this.metaService.fetch();
|
||||||
|
const like = ps.override ?? instance.defaultLike;
|
||||||
|
const note = await this.getterService.getNote(ps.noteId).catch(err => {
|
||||||
|
if (err.id === '9725d0ce-ba28-4dde-95a7-2cbb2c15de24') throw new ApiError(meta.errors.noSuchNote);
|
||||||
|
throw err;
|
||||||
|
});
|
||||||
|
await this.reactionService.create(me, note, like).catch(async err => {
|
||||||
|
if (err.id === '51c42bb4-931a-456b-bff7-e5a8a70dd298') {
|
||||||
|
await this.reactionService.delete(me, note);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (err.id === 'e70412a4-7197-4726-8e74-f3e0deb92aa7') throw new ApiError(meta.errors.youHaveBeenBlocked);
|
||||||
|
throw err;
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -12,7 +12,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
:class="[$style.root, { [$style.showActionsOnlyHover]: defaultStore.state.showNoteActionsOnlyHover }]"
|
:class="[$style.root, { [$style.showActionsOnlyHover]: defaultStore.state.showNoteActionsOnlyHover }]"
|
||||||
:tabindex="!isDeleted ? '-1' : undefined"
|
:tabindex="!isDeleted ? '-1' : undefined"
|
||||||
>
|
>
|
||||||
<MkNoteSub v-if="appearNote.reply && !renoteCollapsed" :meta="props.meta" :note="appearNote.reply" :class="$style.replyTo"/>
|
<MkNoteSub v-if="appearNote.reply && !renoteCollapsed" :note="appearNote.reply" :class="$style.replyTo"/>
|
||||||
<div v-if="pinned" :class="$style.tip"><i class="ph-push-pin ph-bold ph-lg"></i> {{ i18n.ts.pinnedNote }}</div>
|
<div v-if="pinned" :class="$style.tip"><i class="ph-push-pin ph-bold ph-lg"></i> {{ i18n.ts.pinnedNote }}</div>
|
||||||
<!--<div v-if="appearNote._prId_" class="tip"><i class="ph-megaphone ph-bold ph-lg"></i> {{ i18n.ts.promotion }}<button class="_textButton hide" @click="readPromo()">{{ i18n.ts.hideThisNote }} <i class="ph-x ph-bold ph-lg"></i></button></div>-->
|
<!--<div v-if="appearNote._prId_" class="tip"><i class="ph-megaphone ph-bold ph-lg"></i> {{ i18n.ts.promotion }}<button class="_textButton hide" @click="readPromo()">{{ i18n.ts.hideThisNote }} <i class="ph-x ph-bold ph-lg"></i></button></div>-->
|
||||||
<!--<div v-if="appearNote._featuredId_" class="tip"><i class="ph-lightning ph-bold ph-lg"></i> {{ i18n.ts.featured }}</div>-->
|
<!--<div v-if="appearNote._featuredId_" class="tip"><i class="ph-lightning ph-bold ph-lg"></i> {{ i18n.ts.featured }}</div>-->
|
||||||
|
@ -207,7 +207,6 @@ const props = withDefaults(defineProps<{
|
||||||
note: Misskey.entities.Note;
|
note: Misskey.entities.Note;
|
||||||
pinned?: boolean;
|
pinned?: boolean;
|
||||||
mock?: boolean;
|
mock?: boolean;
|
||||||
meta: Misskey.entities.LiteInstanceMetadata;
|
|
||||||
}>(), {
|
}>(), {
|
||||||
mock: false,
|
mock: false,
|
||||||
});
|
});
|
||||||
|
@ -280,7 +279,7 @@ const translating = ref(false);
|
||||||
const showTicker = (defaultStore.state.instanceTicker === 'always') || (defaultStore.state.instanceTicker === 'remote' && appearNote.user.instance);
|
const showTicker = (defaultStore.state.instanceTicker === 'always') || (defaultStore.state.instanceTicker === 'remote' && appearNote.user.instance);
|
||||||
const canRenote = computed(() => ['public', 'home'].includes(appearNote.visibility) || (appearNote.visibility === 'followers' && appearNote.userId === $i.id));
|
const canRenote = computed(() => ['public', 'home'].includes(appearNote.visibility) || (appearNote.visibility === 'followers' && appearNote.userId === $i.id));
|
||||||
let renoteCollapsed = $ref(defaultStore.state.collapseRenotes && isRenote && (($i && ($i.id === note.userId || $i.id === appearNote.userId)) || (appearNote.myReaction != null)));
|
let renoteCollapsed = $ref(defaultStore.state.collapseRenotes && isRenote && (($i && ($i.id === note.userId || $i.id === appearNote.userId)) || (appearNote.myReaction != null)));
|
||||||
const defaultLike = computed(() => defaultStore.state.like !== '❤️' ? defaultStore.state.like : props.meta.defaultLike);
|
const defaultLike = computed(() => defaultStore.state.like !== '❤️' ? defaultStore.state.like : null);
|
||||||
|
|
||||||
const keymap = {
|
const keymap = {
|
||||||
'r': () => reply(true),
|
'r': () => reply(true),
|
||||||
|
@ -512,9 +511,9 @@ function like(): void {
|
||||||
if (props.mock) {
|
if (props.mock) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
os.api('notes/reactions/create', {
|
os.api('notes/like', {
|
||||||
noteId: appearNote.id,
|
noteId: appearNote.id,
|
||||||
reaction: defaultLike.value,
|
override: defaultLike.value,
|
||||||
});
|
});
|
||||||
const el = likeButton.value as HTMLElement | null | undefined;
|
const el = likeButton.value as HTMLElement | null | undefined;
|
||||||
if (el) {
|
if (el) {
|
||||||
|
@ -533,9 +532,9 @@ function react(viaKeyboard = false): void {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
os.api('notes/reactions/create', {
|
os.api('notes/like', {
|
||||||
noteId: appearNote.id,
|
noteId: appearNote.id,
|
||||||
reaction: defaultLike.value,
|
override: defaultLike.value,
|
||||||
});
|
});
|
||||||
const el = reactButton.value as HTMLElement | null | undefined;
|
const el = reactButton.value as HTMLElement | null | undefined;
|
||||||
if (el) {
|
if (el) {
|
||||||
|
|
|
@ -15,9 +15,9 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
<div v-if="!conversationLoaded" style="padding: 16px">
|
<div v-if="!conversationLoaded" style="padding: 16px">
|
||||||
<MkButton style="margin: 0 auto;" primary rounded @click="loadConversation">{{ i18n.ts.loadConversation }}</MkButton>
|
<MkButton style="margin: 0 auto;" primary rounded @click="loadConversation">{{ i18n.ts.loadConversation }}</MkButton>
|
||||||
</div>
|
</div>
|
||||||
<MkNoteSub v-for="note in conversation" :key="note.id" :meta="meta" :class="$style.replyToMore" :note="note" :expandAllCws="props.expandAllCws"/>
|
<MkNoteSub v-for="note in conversation" :key="note.id" :class="$style.replyToMore" :note="note" :expandAllCws="props.expandAllCws"/>
|
||||||
</div>
|
</div>
|
||||||
<MkNoteSub v-if="appearNote.reply" :meta="meta" :note="appearNote.reply" :class="$style.replyTo" :expandAllCws="props.expandAllCws"/>
|
<MkNoteSub v-if="appearNote.reply" :note="appearNote.reply" :class="$style.replyTo" :expandAllCws="props.expandAllCws"/>
|
||||||
<div v-if="isRenote" :class="$style.renote">
|
<div v-if="isRenote" :class="$style.renote">
|
||||||
<MkAvatar :class="$style.renoteAvatar" :user="note.user" link preview/>
|
<MkAvatar :class="$style.renoteAvatar" :user="note.user" link preview/>
|
||||||
<i class="ph-rocket-launch ph-bold ph-lg" style="margin-right: 4px;"></i>
|
<i class="ph-rocket-launch ph-bold ph-lg" style="margin-right: 4px;"></i>
|
||||||
|
@ -171,7 +171,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
<div v-if="!repliesLoaded" style="padding: 16px">
|
<div v-if="!repliesLoaded" style="padding: 16px">
|
||||||
<MkButton style="margin: 0 auto;" primary rounded @click="loadReplies">{{ i18n.ts.loadReplies }}</MkButton>
|
<MkButton style="margin: 0 auto;" primary rounded @click="loadReplies">{{ i18n.ts.loadReplies }}</MkButton>
|
||||||
</div>
|
</div>
|
||||||
<MkNoteSub v-for="note in replies" :key="note.id" :meta="meta" :note="note" :class="$style.reply" :detail="true" :expandAllCws="props.expandAllCws"/>
|
<MkNoteSub v-for="note in replies" :key="note.id" :note="note" :class="$style.reply" :detail="true" :expandAllCws="props.expandAllCws"/>
|
||||||
</div>
|
</div>
|
||||||
<div v-else-if="tab === 'renotes'" :class="$style.tab_renotes">
|
<div v-else-if="tab === 'renotes'" :class="$style.tab_renotes">
|
||||||
<MkPagination :pagination="renotesPagination" :disableAutoLoad="true">
|
<MkPagination :pagination="renotesPagination" :disableAutoLoad="true">
|
||||||
|
@ -188,7 +188,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
<div v-if="!quotesLoaded" style="padding: 16px">
|
<div v-if="!quotesLoaded" style="padding: 16px">
|
||||||
<MkButton style="margin: 0 auto;" primary rounded @click="loadQuotes">{{ i18n.ts.loadReplies }}</MkButton>
|
<MkButton style="margin: 0 auto;" primary rounded @click="loadQuotes">{{ i18n.ts.loadReplies }}</MkButton>
|
||||||
</div>
|
</div>
|
||||||
<MkNoteSub v-for="note in quotes" :key="note.id" :meta="meta" :note="note" :class="$style.reply" :detail="true" :expandAllCws="props.expandAllCws"/>
|
<MkNoteSub v-for="note in quotes" :key="note.id" :note="note" :class="$style.reply" :detail="true" :expandAllCws="props.expandAllCws"/>
|
||||||
</div>
|
</div>
|
||||||
<div v-else-if="tab === 'reactions'" :class="$style.tab_reactions">
|
<div v-else-if="tab === 'reactions'" :class="$style.tab_reactions">
|
||||||
<div :class="$style.reactionTabs">
|
<div :class="$style.reactionTabs">
|
||||||
|
@ -263,12 +263,6 @@ const props = defineProps<{
|
||||||
expandAllCws?: boolean;
|
expandAllCws?: boolean;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
let meta = $ref<Misskey.entities.LiteInstanceMetadata>() as Misskey.entities.LiteInstanceMetadata;
|
|
||||||
|
|
||||||
os.api('meta', { detail: false }).then(res => {
|
|
||||||
meta = res as unknown as Misskey.entities.LiteInstanceMetadata;
|
|
||||||
});
|
|
||||||
|
|
||||||
const inChannel = inject('inChannel', null);
|
const inChannel = inject('inChannel', null);
|
||||||
|
|
||||||
let note = $ref(deepClone(props.note));
|
let note = $ref(deepClone(props.note));
|
||||||
|
@ -323,7 +317,7 @@ const conversation = ref<Misskey.entities.Note[]>([]);
|
||||||
const replies = ref<Misskey.entities.Note[]>([]);
|
const replies = ref<Misskey.entities.Note[]>([]);
|
||||||
const quotes = ref<Misskey.entities.Note[]>([]);
|
const quotes = ref<Misskey.entities.Note[]>([]);
|
||||||
const canRenote = computed(() => ['public', 'home'].includes(appearNote.visibility) || appearNote.userId === $i.id);
|
const canRenote = computed(() => ['public', 'home'].includes(appearNote.visibility) || appearNote.userId === $i.id);
|
||||||
const defaultLike = computed(() => defaultStore.state.like !== '❤️' ? defaultStore.state.like : meta.defaultLike);
|
const defaultLike = computed(() => defaultStore.state.like !== '❤️' ? defaultStore.state.like : null);
|
||||||
|
|
||||||
watch(() => props.expandAllCws, (expandAllCws) => {
|
watch(() => props.expandAllCws, (expandAllCws) => {
|
||||||
if (expandAllCws !== showContent.value) showContent.value = expandAllCws;
|
if (expandAllCws !== showContent.value) showContent.value = expandAllCws;
|
||||||
|
@ -557,9 +551,9 @@ function react(viaKeyboard = false): void {
|
||||||
pleaseLogin();
|
pleaseLogin();
|
||||||
showMovedDialog();
|
showMovedDialog();
|
||||||
if (appearNote.reactionAcceptance === 'likeOnly') {
|
if (appearNote.reactionAcceptance === 'likeOnly') {
|
||||||
os.api('notes/reactions/create', {
|
os.api('notes/like', {
|
||||||
noteId: appearNote.id,
|
noteId: appearNote.id,
|
||||||
reaction: defaultLike.value,
|
override: defaultLike.value,
|
||||||
});
|
});
|
||||||
const el = reactButton.value as HTMLElement | null | undefined;
|
const el = reactButton.value as HTMLElement | null | undefined;
|
||||||
if (el) {
|
if (el) {
|
||||||
|
@ -587,9 +581,9 @@ function react(viaKeyboard = false): void {
|
||||||
function like(): void {
|
function like(): void {
|
||||||
pleaseLogin();
|
pleaseLogin();
|
||||||
showMovedDialog();
|
showMovedDialog();
|
||||||
os.api('notes/reactions/create', {
|
os.api('notes/like', {
|
||||||
noteId: appearNote.id,
|
noteId: appearNote.id,
|
||||||
reaction: defaultLike.value,
|
override: defaultLike.value,
|
||||||
});
|
});
|
||||||
const el = likeButton.value as HTMLElement | null | undefined;
|
const el = likeButton.value as HTMLElement | null | undefined;
|
||||||
if (el) {
|
if (el) {
|
||||||
|
|
|
@ -110,7 +110,6 @@ const canRenote = computed(() => ['public', 'home'].includes(props.note.visibili
|
||||||
|
|
||||||
const props = withDefaults(defineProps<{
|
const props = withDefaults(defineProps<{
|
||||||
note: Misskey.entities.Note;
|
note: Misskey.entities.Note;
|
||||||
meta: Misskey.entities.LiteInstanceMetadata;
|
|
||||||
detail?: boolean;
|
detail?: boolean;
|
||||||
expandAllCws?: boolean;
|
expandAllCws?: boolean;
|
||||||
|
|
||||||
|
@ -134,7 +133,7 @@ const menuButton = shallowRef<HTMLElement>();
|
||||||
const likeButton = shallowRef<HTMLElement>();
|
const likeButton = shallowRef<HTMLElement>();
|
||||||
|
|
||||||
let appearNote = $computed(() => isRenote ? props.note.renote as Misskey.entities.Note : props.note);
|
let appearNote = $computed(() => isRenote ? props.note.renote as Misskey.entities.Note : props.note);
|
||||||
const defaultLike = computed(() => defaultStore.state.like !== '❤️' ? defaultStore.state.like : props.meta.defaultLike);
|
const defaultLike = computed(() => defaultStore.state.like !== '❤️' ? defaultStore.state.like : null);
|
||||||
|
|
||||||
const isRenote = (
|
const isRenote = (
|
||||||
props.note.renote != null &&
|
props.note.renote != null &&
|
||||||
|
@ -188,9 +187,9 @@ function react(viaKeyboard = false): void {
|
||||||
pleaseLogin();
|
pleaseLogin();
|
||||||
showMovedDialog();
|
showMovedDialog();
|
||||||
if (props.note.reactionAcceptance === 'likeOnly') {
|
if (props.note.reactionAcceptance === 'likeOnly') {
|
||||||
os.api('notes/reactions/create', {
|
os.api('notes/like', {
|
||||||
noteId: props.note.id,
|
noteId: props.note.id,
|
||||||
reaction: defaultLike.value,
|
override: defaultLike.value,
|
||||||
});
|
});
|
||||||
const el = reactButton.value as HTMLElement | null | undefined;
|
const el = reactButton.value as HTMLElement | null | undefined;
|
||||||
if (el) {
|
if (el) {
|
||||||
|
@ -218,9 +217,9 @@ function react(viaKeyboard = false): void {
|
||||||
function like(): void {
|
function like(): void {
|
||||||
pleaseLogin();
|
pleaseLogin();
|
||||||
showMovedDialog();
|
showMovedDialog();
|
||||||
os.api('notes/reactions/create', {
|
os.api('notes/like', {
|
||||||
noteId: props.note.id,
|
noteId: props.note.id,
|
||||||
reaction: defaultLike.value,
|
override: defaultLike.value,
|
||||||
});
|
});
|
||||||
const el = reactButton.value as HTMLElement | null | undefined;
|
const el = reactButton.value as HTMLElement | null | undefined;
|
||||||
if (el) {
|
if (el) {
|
||||||
|
|
|
@ -24,7 +24,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
:ad="true"
|
:ad="true"
|
||||||
:class="$style.notes"
|
:class="$style.notes"
|
||||||
>
|
>
|
||||||
<MkNote :key="note._featuredId_ || note._prId_ || note.id" :meta="meta" :class="$style.note" :note="note"/>
|
<MkNote :key="note._featuredId_ || note._prId_ || note.id" :class="$style.note" :note="note"/>
|
||||||
</MkDateSeparatedList>
|
</MkDateSeparatedList>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
@ -33,13 +33,11 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { shallowRef } from 'vue';
|
import { shallowRef } from 'vue';
|
||||||
import * as Misskey from 'misskey-js';
|
|
||||||
import MkNote from '@/components/MkNote.vue';
|
import MkNote from '@/components/MkNote.vue';
|
||||||
import MkDateSeparatedList from '@/components/MkDateSeparatedList.vue';
|
import MkDateSeparatedList from '@/components/MkDateSeparatedList.vue';
|
||||||
import MkPagination, { Paging } from '@/components/MkPagination.vue';
|
import MkPagination, { Paging } from '@/components/MkPagination.vue';
|
||||||
import { i18n } from '@/i18n.js';
|
import { i18n } from '@/i18n.js';
|
||||||
import { infoImageUrl } from '@/instance.js';
|
import { infoImageUrl } from '@/instance.js';
|
||||||
import * as os from '@/os.js';
|
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
pagination: Paging;
|
pagination: Paging;
|
||||||
|
@ -47,12 +45,6 @@ const props = defineProps<{
|
||||||
disableAutoLoad?: boolean;
|
disableAutoLoad?: boolean;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
let meta = $ref<Misskey.entities.LiteInstanceMetadata>() as Misskey.entities.LiteInstanceMetadata;
|
|
||||||
|
|
||||||
os.api('meta', { detail: false }).then(res => {
|
|
||||||
meta = res as unknown as Misskey.entities.LiteInstanceMetadata;
|
|
||||||
});
|
|
||||||
|
|
||||||
const pagingComponent = shallowRef<InstanceType<typeof MkPagination>>();
|
const pagingComponent = shallowRef<InstanceType<typeof MkPagination>>();
|
||||||
|
|
||||||
defineExpose({
|
defineExpose({
|
||||||
|
|
|
@ -544,6 +544,7 @@ export type Endpoints = {
|
||||||
'notes/reactions': { req: { noteId: Note['id']; type?: string | null; limit?: number; }; res: NoteReaction[]; };
|
'notes/reactions': { req: { noteId: Note['id']; type?: string | null; limit?: number; }; res: NoteReaction[]; };
|
||||||
'notes/reactions/create': { req: { noteId: Note['id']; reaction: string; }; res: null; };
|
'notes/reactions/create': { req: { noteId: Note['id']; reaction: string; }; res: null; };
|
||||||
'notes/reactions/delete': { req: { noteId: Note['id']; }; res: null; };
|
'notes/reactions/delete': { req: { noteId: Note['id']; }; res: null; };
|
||||||
|
'notes/like': { req: { noteId: Note['id']; override: string | null; }; res: null; };
|
||||||
'notes/renotes': { req: { limit?: number; sinceId?: Note['id']; untilId?: Note['id']; noteId: Note['id']; }; res: Note[]; };
|
'notes/renotes': { req: { limit?: number; sinceId?: Note['id']; untilId?: Note['id']; noteId: Note['id']; }; res: Note[]; };
|
||||||
'notes/replies': { req: { limit?: number; sinceId?: Note['id']; untilId?: Note['id']; noteId: Note['id']; }; res: Note[]; };
|
'notes/replies': { req: { limit?: number; sinceId?: Note['id']; untilId?: Note['id']; noteId: Note['id']; }; res: Note[]; };
|
||||||
'notes/search-by-tag': { req: TODO; res: TODO; };
|
'notes/search-by-tag': { req: TODO; res: TODO; };
|
||||||
|
|
Loading…
Reference in a new issue