get-note-summary

This commit is contained in:
tamaina 2021-11-12 10:44:15 +09:00
parent 95b2ae270a
commit 873eeafe2e
2 changed files with 5 additions and 5 deletions

View File

@ -199,7 +199,7 @@ export default defineComponent({
}; };
return { return {
getNoteSummary: (text: string) => getNoteSummary(text, i18n.locale), getNoteSummary: (text: string) => getNoteSummary(text, i18n),
followRequestDone, followRequestDone,
groupInviteDone, groupInviteDone,
notePage, notePage,

View File

@ -1,11 +1,11 @@
import * as misskey from 'misskey-js'; import * as misskey from 'misskey-js';
import { i18n } from '@/i18n'; import { I18n } from '@/scripts/i18n';
/** /**
* 稿 * 稿
* @param {*} note (packされた)稿 * @param {*} note (packされた)稿
*/ */
export const getNoteSummary = (note: misskey.entities.Note): string => { export const getNoteSummary = (note: misskey.entities.Note, i18n: I18n<any>): string => {
if (note.deletedAt) { if (note.deletedAt) {
return `(${i18n.locale.deletedNote})`; return `(${i18n.locale.deletedNote})`;
} }
@ -36,7 +36,7 @@ export const getNoteSummary = (note: misskey.entities.Note): string => {
// 返信のとき // 返信のとき
if (note.replyId) { if (note.replyId) {
if (note.reply) { if (note.reply) {
summary += `\n\nRE: ${getNoteSummary(note.reply)}`; summary += `\n\nRE: ${getNoteSummary(note.reply, i18n)}`;
} else { } else {
summary += '\n\nRE: ...'; summary += '\n\nRE: ...';
} }
@ -45,7 +45,7 @@ export const getNoteSummary = (note: misskey.entities.Note): string => {
// Renoteのとき // Renoteのとき
if (note.renoteId) { if (note.renoteId) {
if (note.renote) { if (note.renote) {
summary += `\n\nRN: ${getNoteSummary(note.renote)}`; summary += `\n\nRN: ${getNoteSummary(note.renote, i18n)}`;
} else { } else {
summary += '\n\nRN: ...'; summary += '\n\nRN: ...';
} }