fix duplicate mandatory CWs in following feed
This commit is contained in:
parent
f3d7229c55
commit
84ffc6361b
2 changed files with 14 additions and 11 deletions
|
|
@ -20,7 +20,7 @@ Selectable entry on the "Following" feed, displaying a user with their most rece
|
|||
</MkA>
|
||||
</header>
|
||||
<div>
|
||||
<Mfm :class="$style.text" :text="getNoteSummary(note)" :isBlock="true" :plain="true" :nowrap="false" :isNote="true" nyaize="respect" :author="note.user"/>
|
||||
<Mfm :class="$style.text" :text="getNoteSummary(note, false)" :isBlock="true" :plain="true" :nowrap="false" :isNote="true" nyaize="respect" :author="note.user"/>
|
||||
</div>
|
||||
</div>
|
||||
</SkMutedNote>
|
||||
|
|
|
|||
|
|
@ -9,9 +9,10 @@ import { i18n } from '@/i18n.js';
|
|||
|
||||
/**
|
||||
* 投稿を表す文字列を取得します。
|
||||
* @param {*} note (packされた)投稿
|
||||
* @param note (packされた)投稿
|
||||
* @param withMandatoryCw if true (default), include the note/user/instance mandatory CW
|
||||
*/
|
||||
export const getNoteSummary = (note?: Misskey.entities.Note | null): string => {
|
||||
export const getNoteSummary = (note: Misskey.entities.Note | null | undefined, withMandatoryCw = true): string => {
|
||||
if (note == null) {
|
||||
return '';
|
||||
}
|
||||
|
|
@ -28,14 +29,16 @@ export const getNoteSummary = (note?: Misskey.entities.Note | null): string => {
|
|||
|
||||
// Append mandatory CW, if applicable
|
||||
let cw = note.cw;
|
||||
if (note.mandatoryCW) {
|
||||
cw = appendContentWarning(cw, note.mandatoryCW);
|
||||
}
|
||||
if (note.user.mandatoryCW) {
|
||||
cw = appendContentWarning(cw, note.user.mandatoryCW);
|
||||
}
|
||||
if (note.user.instance?.mandatoryCW) {
|
||||
cw = appendContentWarning(cw, note.user.instance.mandatoryCW);
|
||||
if (withMandatoryCw) {
|
||||
if (note.mandatoryCW) {
|
||||
cw = appendContentWarning(cw, note.mandatoryCW);
|
||||
}
|
||||
if (note.user.mandatoryCW) {
|
||||
cw = appendContentWarning(cw, note.user.mandatoryCW);
|
||||
}
|
||||
if (note.user.instance?.mandatoryCW) {
|
||||
cw = appendContentWarning(cw, note.user.instance.mandatoryCW);
|
||||
}
|
||||
}
|
||||
|
||||
// 本文
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue