MANY changes around message listing / viewing

* If messageList is used, alwasy require items to contain areaTag
* Standardize messageList a bit - still WIP, needs cleaned up
* Lof of changes around area/conf tracking in relation to messages and message listings
* Work for message searching
* Clean up of various code, much to do...
This commit is contained in:
Bryan Ashby 2018-01-31 22:45:03 -07:00
parent cc2ee9c586
commit 837326e15a
9 changed files with 329 additions and 146 deletions

View file

@ -2,22 +2,25 @@
'use strict';
const messageArea = require('../core/message_area.js');
const { get } = require('lodash');
exports.MessageAreaConfTempSwitcher = Sup => class extends Sup {
tempMessageConfAndAreaSwitch(messageAreaTag) {
messageAreaTag = messageAreaTag || this.messageAreaTag;
tempMessageConfAndAreaSwitch(messageAreaTag, recordPrevious = true) {
messageAreaTag = messageAreaTag || get(this, 'config.messageAreaTag', this.messageAreaTag);
if(!messageAreaTag) {
return; // nothing to do!
}
this.prevMessageConfAndArea = {
confTag : this.client.user.properties.message_conf_tag,
areaTag : this.client.user.properties.message_area_tag,
};
if(recordPrevious) {
this.prevMessageConfAndArea = {
confTag : this.client.user.properties.message_conf_tag,
areaTag : this.client.user.properties.message_area_tag,
};
}
if(!messageArea.tempChangeMessageConfAndArea(this.client, this.messageAreaTag)) {
if(!messageArea.tempChangeMessageConfAndArea(this.client, messageAreaTag)) {
this.client.log.warn( { messageAreaTag : messageArea }, 'Failed to perform temporary message area/conf switch');
}
}