This commit is contained in:
Mirco Wittrien 2023-11-04 11:36:41 +01:00
parent 15f0e769c2
commit 2eb189049a
2 changed files with 8 additions and 5 deletions

View File

@ -392,8 +392,9 @@ module.exports = (_ => {
let username = BDFDB.ReactUtils.findChild(e.instance.props.username, {filter: n => n && n.props && n.props.decorations});
if (!username) return;
const author = e.instance.props.userOverride || e.instance.props.message.author;
if (!BDFDB.ArrayUtils.is(username.props.decorations[1])) username.props.decorations[1] = [username.props.decorations[1]].filter(n => n);
this.injectBadges(username.props.decorations[1], author, (BDFDB.LibraryStores.ChannelStore.getChannel(e.instance.props.message.channel_id) || {}).guild_id, "chat");
let index = e.instance.props.cozy ? 0 : 1;
if (!BDFDB.ArrayUtils.is(username.props.decorations[index])) username.props.decorations[index] = [username.props.decorations[index]].filter(n => n);
this.injectBadges(username.props.decorations[index], author, (BDFDB.LibraryStores.ChannelStore.getChannel(e.instance.props.message.channel_id) || {}).guild_id, "chat");
}
processNameContainer (e) {

View File

@ -273,11 +273,13 @@ module.exports = (_ => {
processMessageHeader (e) {
if (!e.instance.props.message || !this.settings.tagPlaces.chat) return;
let [children, index] = BDFDB.ReactUtils.findParent(e.instance.props.username, {filter: n => n && n.props && typeof n.props.renderPopout == "function"});
if (index == -1) return;
const author = e.instance.props.userOverride || e.instance.props.message.author;
let userType = this.getUserType(author, e.instance.props.message.channel_id);
if (userType) this.injectStaffTag(children, author, userType, e.instance.props.compact ? index : (index + 2), {
if (!userType) return;
let username = BDFDB.ReactUtils.findChild(e.instance.props.username, {filter: n => n && n.props && n.props.decorations});
if (!username) return;
if (!BDFDB.ArrayUtils.is(username.props.decorations[0])) username.props.decorations[0] = [username.props.decorations[0]].filter(n => n);
this.injectStaffTag(username.props.decorations[0], author, userType, 0, {
channelId: e.instance.props.message.channel_id,
tagClass: e.instance.props.compact ? BDFDB.disCN.messagebottagcompact : BDFDB.disCN.messagebottagcozy,
useRem: true