Fix member list profile badges
This commit is contained in:
parent
3022646579
commit
50ae555c21
|
@ -468,7 +468,7 @@ export class ReactAutoPatcher {
|
||||||
}
|
}
|
||||||
|
|
||||||
static async patchNameTag() {
|
static async patchNameTag() {
|
||||||
const { selector } = Reflection.resolve('nameTag', 'username', 'discriminator', 'discriminatorWithMobileIndicator');
|
const { selector } = Reflection.resolve('nameTag', 'username', 'discriminator', 'bot');
|
||||||
this.NameTag = await ReactComponents.getComponent('NameTag', {selector});
|
this.NameTag = await ReactComponents.getComponent('NameTag', {selector});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -89,26 +89,24 @@ export default class extends Module {
|
||||||
|
|
||||||
const NameTag = await ReactComponents.getComponent('NameTag');
|
const NameTag = await ReactComponents.getComponent('NameTag');
|
||||||
|
|
||||||
this.PatchedNameTag = class extends NameTag.component {
|
this.PatchedNameTag = function (props) {
|
||||||
render() {
|
const retVal = NameTag.component.apply(this, arguments);
|
||||||
const retVal = NameTag.component.prototype.render.apply(this, arguments);
|
try {
|
||||||
try {
|
if (!retVal.props || !retVal.props.children) return retVal;
|
||||||
if (!retVal.props || !retVal.props.children) return retVal;
|
|
||||||
|
|
||||||
const user = ReactHelpers.findProp(this, 'user');
|
const user = ReactHelpers.findProp(props, 'user');
|
||||||
if (!user) return retVal;
|
if (!user) return retVal;
|
||||||
const contributor = contributors.find(c => c.id === user.id);
|
const contributor = contributors.find(c => c.id === user.id);
|
||||||
if (!contributor) return retVal;
|
if (!contributor) return retVal;
|
||||||
|
|
||||||
retVal.props.children.splice(1, 0, VueInjector.createReactElement(BdBadge, {
|
retVal.props.children.splice(1, 0, VueInjector.createReactElement(BdBadge, {
|
||||||
contributor,
|
contributor,
|
||||||
type: 'nametag'
|
type: 'nametag'
|
||||||
}));
|
}));
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
Logger.err('ProfileBadges', ['Error thrown while rendering a NameTag', err]);
|
Logger.err('ProfileBadges', ['Error thrown while rendering a NameTag', err]);
|
||||||
}
|
|
||||||
return retVal;
|
|
||||||
}
|
}
|
||||||
|
return retVal;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Rerender all channel members
|
// Rerender all channel members
|
||||||
|
|
Loading…
Reference in New Issue