Merge pull request #264 from JsSucks/emotemodule

Emotemodule
This commit is contained in:
Alexei Stukov 2018-11-26 07:31:53 +02:00 committed by GitHub
commit 08ae8dceb5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 1 deletions

View File

@ -78,6 +78,12 @@ export default class BuiltinModule {
Patch(`BD:${this.moduleName}`, module)[when](fnName, cb.bind(this));
}
childPatch(module, fnName, child, cb, when = 'after') {
this.patch(module, fnName, (component, args, retVal) => {
this.patch(retVal[child[0]], child[1], cb, when);
});
}
/**
* Logger wraps
*/

View File

@ -227,7 +227,7 @@ export default new class EmoteModule extends BuiltinModule {
*/
async patchMessageContent() {
const MessageContent = await ReactComponents.getComponent('MessageContent', { selector: Reflection.resolve('container', 'containerCozy', 'containerCompact', 'edited').selector }, m => m.defaultProps && m.defaultProps.hasOwnProperty('disableButtons'));
this.patch(MessageContent.component.prototype, 'render', this.afterRenderMessageContent);
this.childPatch(MessageContent.component.prototype, 'render', ['props', 'children'], this.afterRenderMessageContent);
MessageContent.forceUpdateAll();
}