get-note-summary
This commit is contained in:
parent
95b2ae270a
commit
873eeafe2e
|
@ -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,
|
||||||
|
|
|
@ -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: ...';
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue