Make notification initials consistent with everything else (#3006)
Make notification initials consistent with Avatar component
This commit is contained in:
parent
9ffe7c5836
commit
a21d63e450
1 changed files with 16 additions and 1 deletions
|
@ -1771,6 +1771,21 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
getInitials(name) {
|
||||||
|
if (!name) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
const cleaned = name.replace(/[^A-Za-z\s]+/g, '').replace(/\s+/g, ' ');
|
||||||
|
const parts = cleaned.split(' ');
|
||||||
|
const initials = parts.map(part => part.trim()[0]);
|
||||||
|
if (!initials.length) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return initials.slice(0, 2).join('');
|
||||||
|
},
|
||||||
|
|
||||||
isPrivate() {
|
isPrivate() {
|
||||||
return this.get('type') === 'private';
|
return this.get('type') === 'private';
|
||||||
},
|
},
|
||||||
|
@ -1802,7 +1817,7 @@
|
||||||
} else if (this.isPrivate()) {
|
} else if (this.isPrivate()) {
|
||||||
return {
|
return {
|
||||||
color,
|
color,
|
||||||
content: title ? title.trim()[0] : '#',
|
content: this.getInitials(title) || '#',
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
return { url: 'images/group_default.png', color };
|
return { url: 'images/group_default.png', color };
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue