Fix badges not being rendered when jumping to a message

This commit is contained in:
Samuel Elliott 2018-05-05 11:39:56 +01:00
parent 5aa921ae4b
commit 64e855ab2d
No known key found for this signature in database
GPG Key ID: 8420C7CDE43DC4D6
2 changed files with 3 additions and 1 deletions

View File

@ -305,8 +305,9 @@ export class ReactAutoPatcher {
static async patchMessage() {
this.Message = await ReactComponents.getComponent('Message', { selector: '.message' });
this.unpatchMessageRender = MonkeyPatch('BD:ReactComponents', this.Message.component.prototype).after('render', (component, args, retVal) => {
const { message } = component.props;
const { message, jumpSequenceId } = component.props;
const { id, colorString, bot, author, attachments, embeds } = message;
if (jumpSequenceId) retVal = retVal.props.children;
retVal.props['data-message-id'] = id;
retVal.props['data-colourstring'] = colorString;
if (author && author.id) retVal.props['data-user-id'] = author.id;

View File

@ -38,6 +38,7 @@ export default class extends Module {
this.unpatchMessageRender = MonkeyPatch('ProfileBadges', Message.component.prototype).after('render', (component, args, retVal) => {
if (!retVal.props || !retVal.props.children) return;
if (ReactHelpers.findProp(component, 'jumpSequenceId')) retVal = retVal.props.children;
const message = ReactHelpers.findProp(component, 'message');
if (!message || !message.author) return;