From 4cf10ba85c750463171fe40123afe21c2d1576ca Mon Sep 17 00:00:00 2001 From: Bryan Ashby Date: Wed, 19 Aug 2015 16:05:35 -0600 Subject: [PATCH] * Minor changes & cleanup --- core/mci_view_factory.js | 2 ++ core/message_area.js | 19 +++++++++++++++++++ core/user.js | 2 +- mods/art/msg_area_list.ans | Bin 209 -> 192 bytes mods/msg_area.js | 5 +---- 5 files changed, 23 insertions(+), 5 deletions(-) diff --git a/core/mci_view_factory.js b/core/mci_view_factory.js index 928212e6..5794ce94 100644 --- a/core/mci_view_factory.js +++ b/core/mci_view_factory.js @@ -49,6 +49,8 @@ MCIViewFactory.prototype.getPredefinedViewLabel = function(code) { UT : this.client.user.properties.theme_id, MS : moment(this.client.user.properties.account_created).format(this.client.currentTheme.helpers.getDateFormat()), + MA : this.client.user.properties.message_area_name, + SH : this.client.term.termHeight.toString(), SW : this.client.term.termWidth.toString(), diff --git a/core/message_area.js b/core/message_area.js index 361cfd1b..077c87ad 100644 --- a/core/message_area.js +++ b/core/message_area.js @@ -73,6 +73,25 @@ function changeCurrentArea(client, areaId, cb) { client.user.persistProperty('message_area_id', areaId, function persisted(err) { callback(err); }); + }, + function cacheAreaName(callback) { + msgDb.get( + 'SELECT area_name ' + + 'FROM message_area ' + + 'WHERE area_id=? ' + + 'LIMIT 1;', + [ areaId ], + function got(err, row) { + // note: failures here are non-fatal + if(err) { + callback(null); + } else { + client.user.persistProperty('message_area_name', row.area_name, function persisted(err) { + callback(null); + }); + } + } + ); } ], function complete(err) { diff --git a/core/user.js b/core/user.js index 1b38b6b0..3e5e7b5c 100644 --- a/core/user.js +++ b/core/user.js @@ -326,7 +326,7 @@ User.prototype.persistProperty = function(propName, propValue, cb) { } } ); -} +}; User.prototype.persistProperties = function(properties, cb) { var self = this; diff --git a/mods/art/msg_area_list.ans b/mods/art/msg_area_list.ans index 0f48bc4daa1d54462c313f0ac53df2368247dd6f..ae43220f2ff5ab5e6c4489bc983d4cc2efb0e738 100644 GIT binary patch delta 35 qcmcb}cz|(&riia2FBdPDf`Wo{w4t@JVXkVJui-?$SVsGaYg7T7i3tY) delta 52 zcmX@Wc#&~}rfP_f5ib`nmx6+VbhM$hv0<)in6II9v4461u6#!1u B4MYF{ diff --git a/mods/msg_area.js b/mods/msg_area.js index 34f7d56f..043866da 100644 --- a/mods/msg_area.js +++ b/mods/msg_area.js @@ -23,10 +23,7 @@ function MessageAreaModule(options) { this.menuMethods = { changeArea : function(formData, extraArgs) { - // :TODO: really, we just need to go to a menu with a list of areas to select from and call a @systemMethod:setMessageArea() call with fallback to here - self.client.user.persistProperty('message_area_id', 2, function persisted(err) { - - }); // :TODO: just for testing + // :TODO: clean this code up } }; }