merge: Respect CWs in note previews (resolves #690) (!639)

View MR for information: https://activitypub.software/TransFem-org/Sharkey/-/merge_requests/639

Closes #690

Approved-by: dakkar <dakkar@thenautilus.net>
Approved-by: Marie <github@yuugi.dev>
This commit is contained in:
dakkar 2024-10-02 14:43:07 +00:00
commit 7bc0d4efff
2 changed files with 13 additions and 13 deletions

View File

@ -22,14 +22,14 @@ export const getNoteSummary = (note: Packed<'Note'>): string => {
// 本文
if (note.cw != null) {
summary += note.cw;
} else {
summary += note.text ? note.text : '';
summary += `CW: ${note.cw}`;
} else if (note.text) {
summary += note.text;
}
// ファイルが添付されているとき
if ((note.files ?? []).length !== 0) {
summary += ` (📎${note.files!.length})`;
if (note.files && note.files.length !== 0) {
summary += ` (📎${note.files.length})`;
}
// 投票が添付されているとき
@ -39,7 +39,7 @@ export const getNoteSummary = (note: Packed<'Note'>): string => {
// 返信のとき
if (note.replyId) {
if (note.reply) {
if (note.reply && !note.cw) {
summary += `\n\nRE: ${getNoteSummary(note.reply)}`;
} else {
summary += '\n\nRE: ...';
@ -48,7 +48,7 @@ export const getNoteSummary = (note: Packed<'Note'>): string => {
// Renoteのとき
if (note.renoteId) {
if (note.renote) {
if (note.renote && !note.cw) {
summary += `\n\nRN: ${getNoteSummary(note.renote)}`;
} else {
summary += '\n\nRN: ...';

View File

@ -27,13 +27,13 @@ export const getNoteSummary = (note?: Misskey.entities.Note | null): string => {
// 本文
if (note.cw != null) {
summary += note.cw;
} else {
summary += note.text ? note.text : '';
summary += `CW: ${note.cw}`;
} else if (note.text) {
summary += note.text;
}
// ファイルが添付されているとき
if ((note.files || []).length !== 0) {
if (note.files && note.files.length !== 0) {
summary += ` (${i18n.tsx.withNFiles({ n: note.files.length })})`;
}
@ -44,7 +44,7 @@ export const getNoteSummary = (note?: Misskey.entities.Note | null): string => {
// 返信のとき
if (note.replyId) {
if (note.reply) {
if (note.reply && !note.cw) {
summary += `\n\nRE: ${getNoteSummary(note.reply)}`;
} else {
summary += '\n\nRE: ...';
@ -53,7 +53,7 @@ export const getNoteSummary = (note?: Misskey.entities.Note | null): string => {
// Renoteのとき
if (note.renoteId) {
if (note.renote) {
if (note.renote && !note.cw) {
summary += `\n\nRN: ${getNoteSummary(note.renote)}`;
} else {
summary += '\n\nRN: ...';