fix(play preset): Set failback for notes without text or user.name in Timeline preset (#10718)

This commit is contained in:
futchitwo 2023-04-26 14:10:04 +09:00 committed by GitHub
parent a986203b38
commit 52a1d96218
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -305,6 +305,11 @@ const PRESET_TIMELINE = `/// @ 0.13.1
// UI // UI
let noteEls = [] let noteEls = []
each (let note, notes) { each (let note, notes) {
// id
let userName = if Core:type(note.user.name) == "str" note.user.name else note.user.username
//
let noteText = if Core:type(note.text) == "str" note.text else "(リノートもしくはメディア・投票のみのノート)"
let el = Ui:C:container({ let el = Ui:C:container({
bgColor: "#444" bgColor: "#444"
fgColor: "#fff" fgColor: "#fff"
@ -312,11 +317,11 @@ const PRESET_TIMELINE = `/// @ 0.13.1
rounded: true rounded: true
children: [ children: [
Ui:C:mfm({ Ui:C:mfm({
text: note.user.name text: userName
bold: true bold: true
}) })
Ui:C:mfm({ Ui:C:mfm({
text: note.text text: noteText
}) })
] ]
}) })