Fix member list badges
This commit is contained in:
parent
cc1be34263
commit
4be9c8b29a
|
@ -468,7 +468,7 @@ export class ReactAutoPatcher {
|
||||||
}
|
}
|
||||||
|
|
||||||
static async patchNameTag() {
|
static async patchNameTag() {
|
||||||
const { selector } = Reflection.resolve('nameTag', 'username', 'discriminator', 'ownerIcon');
|
const { selector } = Reflection.resolve('nameTag', 'username', 'discriminator', 'discriminatorWithMobileIndicator');
|
||||||
this.NameTag = await ReactComponents.getComponent('NameTag', {selector});
|
this.NameTag = await ReactComponents.getComponent('NameTag', {selector});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -71,7 +71,8 @@ export default class extends Module {
|
||||||
const c = contributors.find(c => c.id === user.id);
|
const c = contributors.find(c => c.id === user.id);
|
||||||
if (!c) return;
|
if (!c) return;
|
||||||
|
|
||||||
const nameTag = retVal.props.children.props.children[1].props.children[0];
|
const flex = retVal.props.children.props.children[1].props.children[0];
|
||||||
|
const nameTag = flex.props.children[0];
|
||||||
nameTag.type = this.PatchedNameTag || nameTag.type;
|
nameTag.type = this.PatchedNameTag || nameTag.type;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -91,14 +92,14 @@ export default class extends Module {
|
||||||
|
|
||||||
this.PatchedNameTag = class extends NameTag.component {
|
this.PatchedNameTag = class extends NameTag.component {
|
||||||
render() {
|
render() {
|
||||||
const retVal = NameTag.component.prototype.render.call(this, arguments);
|
const retVal = NameTag.component.prototype.render.apply(this, arguments);
|
||||||
try {
|
try {
|
||||||
if (!retVal.props || !retVal.props.children) return;
|
if (!retVal.props || !retVal.props.children) return retVal;
|
||||||
|
|
||||||
const user = ReactHelpers.findProp(this, 'user');
|
const user = ReactHelpers.findProp(this, 'user');
|
||||||
if (!user) return;
|
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;
|
if (!contributor) return retVal;
|
||||||
|
|
||||||
retVal.props.children.splice(1, 0, VueInjector.createReactElement(BdBadge, {
|
retVal.props.children.splice(1, 0, VueInjector.createReactElement(BdBadge, {
|
||||||
contributor,
|
contributor,
|
||||||
|
|
Loading…
Reference in New Issue