Accessible label in MKNote should be a computed value. Also Fixes renoted note labels

This commit is contained in:
TalonTheDragon 2023-05-21 21:57:29 +02:00
parent fd9d23f3cb
commit c240e37be9
1 changed files with 18 additions and 12 deletions

View File

@ -461,21 +461,27 @@ function readPromo() {
isDeleted.value = true; isDeleted.value = true;
} }
let accessibleLabel: string = getAccessibleLabel(); const accessibleLabel = computed(() => {
let label = `${props.note.user.username}; `;
function getAccessibleLabel(): string { if (props.note.renote) {
let label = `${note.user.name ? note.user.name : note.user.username}: `; label += `boosted ${props.note.renote.user.username}; `;
if (note.cw && note.isHidden) { if (props.note.renote.cw) {
label += `Content Warning: ${note.cw}`; label += `content warning: ${props.note.renote.cw}; `;
} else {
label += `${props.note.renote.text}; `;
}
} else { } else {
label += `${note.text}`; if (props.note.cw) {
label += `content warning: ${props.note.cw}; `;
} else {
label += `${props.note.text}; `;
}
} }
const date = new Date(props.note.createdAt);
label += `${date.toDateString()}`;
label += `${note.createdAt.toLocaleUpperCase()}`;
return label; return label;
} })
defineExpose({ defineExpose({
focus, focus,
blur, blur,