Commit 293ca2c7 authored by JC Brand's avatar JC Brand

Let the OTR code for adding a button mirror the spoiler way

parent 7bf157d9
...@@ -62,7 +62,7 @@ ...@@ -62,7 +62,7 @@
// relevant objects or classes. // relevant objects or classes.
// //
// New functions which don't exist yet can also be added. // New functions which don't exist yet can also be added.
ChatBox: { ChatBox: {
initialize () { initialize () {
this.__super__.initialize.apply(this, arguments); this.__super__.initialize.apply(this, arguments);
...@@ -118,7 +118,7 @@ ...@@ -118,7 +118,7 @@
} }
return key; return key;
}, },
getSession (callback) { getSession (callback) {
const { _converse } = this.__super__, const { _converse } = this.__super__,
{ __ } = _converse; { __ } = _converse;
...@@ -403,7 +403,7 @@ ...@@ -403,7 +403,7 @@
_.partial(utils.slideToggleElement, menu) _.partial(utils.slideToggleElement, menu)
); );
}, },
getOTRTooltip () { getOTRTooltip () {
const { _converse } = this.__super__, const { _converse } = this.__super__,
{ __ } = _converse, { __ } = _converse,
...@@ -419,13 +419,10 @@ ...@@ -419,13 +419,10 @@
} }
}, },
renderToolbar (toolbar, options) { addOTRToolbarButton (options) {
const { _converse } = this.__super__, const { _converse } = this.__super__,
{ __ } = _converse; { __ } = _converse,
if (!_converse.show_toolbar) { data = this.model.toJSON();
return;
}
const data = this.model.toJSON();
options = _.extend(options || {}, { options = _.extend(options || {}, {
FINISHED, FINISHED,
UNENCRYPTED, UNENCRYPTED,
...@@ -443,13 +440,17 @@ ...@@ -443,13 +440,17 @@
otr_tooltip: this.getOTRTooltip(), otr_tooltip: this.getOTRTooltip(),
otr_translated_status: OTR_TRANSLATED_MAPPING[data.otr_status], otr_translated_status: OTR_TRANSLATED_MAPPING[data.otr_status],
}); });
this.__super__.renderToolbar.apply(this, arguments);
this.el.querySelector('.chat-toolbar').insertAdjacentHTML( this.el.querySelector('.chat-toolbar').insertAdjacentHTML(
'beforeend', 'beforeend',
tpl_toolbar_otr( tpl_toolbar_otr(
_.extend(this.model.toJSON(), options || {}) _.extend(this.model.toJSON(), options || {})
)); ));
return this; },
renderToolbar (toolbar, options) {
const result = this.__super__.renderToolbar.apply(this, arguments);
this.addOTRToolbarButton(options);
return result;
} }
} }
}, },
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment