Skip to content
Snippets Groups Projects

History, Reply to messages and RAI

Merged Emmanuel Vodor requested to merge beta into master
1 file
+ 2
39
Compare changes
  • Side-by-side
  • Inline
@@ -13,31 +13,12 @@ converse.plugins.add('converse-rai', {
this.listenTo(this, 'change:hidden', this.onHiddenChange);
},
/**
* Subscribe to RAI if connected to the room, but it's hidden.
* @private
* @method _converse.ChatRoom#onConnectionStatusChanged
*/
async onConnectionStatusChanged() {
console.log('ChatRoom#onConnectionStatusChanged');
const { api } = this.__super__._converse;
if (this.session.get('connection_status') === converse.ROOMSTATUS.ENTERED) {
if (this.get('hidden') && api.settings.get('muc_subscribe_to_rai') && this.getOwnAffiliation() !== 'none') {
await this.leave();
// this.enableRAI();
} else {
await this.__super__.onConnectionStatusChanged.apply(this, arguments);
}
}
},
/**
* Handler that gets called when the 'hidden' flag is toggled.
* @private
* @method _converse.ChatRoom#onHiddenChange
*/
async onHiddenChange() {
console.log('ChatRoomView#onHiddenChange');
const conn_status = this.session.get('connection_status');
const { api } = this.__super__._converse;
@@ -46,29 +27,11 @@ converse.plugins.add('converse-rai', {
if (conn_status !== converse.ROOMSTATUS.DISCONNECTED) {
this.sendMarkerForLastMessage('received', true);
await this.leave();
await this.close();
}
// this.enableRAI();
}
} else if (conn_status === converse.ROOMSTATUS.DISCONNECTED) {
this.rejoin();
}
},
/**
* Ensures that the user is subscribed to XEP-0437 Room Activity Indicators
* if `muc_subscribe_to_rai` is set to `true`.
* Only affiliated users can subscribe to RAI, but this method doesn't
* check whether the current user is affiliated because it's intended to be
* called after the MUC has been left and we don't have that information
* anymore.
* @private
* @method _converse.ChatRoom#enableRAI
*/
enableRAI() {
console.log('ChatRoom#enableRAI');
const { api } = this.__super__._converse;
if (api.settings.get('muc_subscribe_to_rai')) {
api.rooms.subscribe(this.get('jid'));
await this.rejoin();
}
},
},
Loading