From c522c86525b17486c114711a97550264dddcce80 Mon Sep 17 00:00:00 2001 From: Evgeny Fadeev Date: Mon, 8 Oct 2012 01:36:23 -0400 Subject: added sent mailbox, message counts in threads, fixed some bugs and added test cases --- askbot/media/js/group_messaging.js | 8 +- askbot/templates/group_messaging/senders_list.html | 7 +- askbot/templates/group_messaging/threads_list.html | 9 +- group_messaging/models.py | 95 +++++++-- group_messaging/tests.py | 221 ++++++++++++--------- group_messaging/views.py | 23 ++- 6 files changed, 253 insertions(+), 110 deletions(-) diff --git a/askbot/media/js/group_messaging.js b/askbot/media/js/group_messaging.js index 08d9056e..63980569 100644 --- a/askbot/media/js/group_messaging.js +++ b/askbot/media/js/group_messaging.js @@ -265,15 +265,19 @@ NewThreadComposer.prototype.onAfterShow = function() { NewThreadComposer.prototype.onSendErrorInternal = function(data) { var missingUsers = data['missing_users'] + var errors = []; if (missingUsers) { var errorTpl = ngettext( 'user {{str}} does not exist', 'users {{str}} do not exist', missingUsers.length ) - error = errorTpl.replace('{{str}}', joinAsPhrase(missingUsers)); - this._toInputError.html(error); + errors.push(errorTpl.replace('{{str}}', joinAsPhrase(missingUsers))); } + if (data['self_message']) { + errors.push(gettext('cannot send message to yourself')); + } + this._toInputError.html(errors.join(', ')); }; NewThreadComposer.prototype.getInputData = function() { diff --git a/askbot/templates/group_messaging/senders_list.html b/askbot/templates/group_messaging/senders_list.html index 4bee2626..31432dc4 100644 --- a/askbot/templates/group_messaging/senders_list.html +++ b/askbot/templates/group_messaging/senders_list.html @@ -1,9 +1,12 @@ {% if senders %}