From 49a174df57354cc045855bb41d6818b83afd162e Mon Sep 17 00:00:00 2001 From: Christophe Matthieu Date: Wed, 10 Oct 2012 20:16:11 +0200 Subject: [PATCH] [IMP] chatter, follower: html/js for css imp bzr revid: chm@openerp.com-20121010181611-rl167r9h0ejz8zdu --- addons/mail/mail_message.py | 1 - addons/mail/static/src/js/mail.js | 52 +++++++++------- addons/mail/static/src/js/mail_followers.js | 45 +++++--------- addons/mail/static/src/xml/mail.xml | 4 +- addons/mail/static/src/xml/mail_followers.xml | 6 +- addons/mail/tests/test_mail.py | 61 ------------------- .../mail/wizard/mail_compose_message_view.xml | 5 +- 7 files changed, 52 insertions(+), 122 deletions(-) diff --git a/addons/mail/mail_message.py b/addons/mail/mail_message.py index b5f9bc76e76..9631918050a 100644 --- a/addons/mail/mail_message.py +++ b/addons/mail/mail_message.py @@ -292,7 +292,6 @@ class mail_message(osv.Model): well formed threads. :param domain: optional domain for searching ids - :param level: level of threads to display, 0 being flat :param limit: number of messages to fetch :param parent_id: if parent_id reached, stop searching for further parents diff --git a/addons/mail/static/src/js/mail.js b/addons/mail/static/src/js/mail.js index d2f2358af5f..15a81be4c54 100644 --- a/addons/mail/static/src/js/mail.js +++ b/addons/mail/static/src/js/mail.js @@ -403,8 +403,7 @@ openerp.mail = function(session) { * Thread Message Expandable Widget * ------------------------------------------------------------ * - * This widget handles the display the expandable message in a thread. The - * [thread_level] parameter sets the thread level number: + * This widget handles the display the expandable message in a thread. * - thread * - - visible message * - - expandable @@ -468,7 +467,7 @@ openerp.mail = function(session) { * - record.timerelative: relative time givein by timeago lib * - record.avatar: image url * - record.attachment_ids[].url: url of each attachmentThe - * [thread_level] parameter sets the thread level number: + * thread view : * - root thread * - - sub message (parent_id = root message) * - - - sub thread @@ -769,11 +768,13 @@ openerp.mail = function(session) { * ------------------------------------------------------------ * * This widget handles the display of a thread of messages. The - * [thread_level] parameter sets the thread level number: - * - root message + * thread view: + * - root thread * - - sub message (parent_id = root message) - * - - - sub sub message (parent id = sub message) + * - - - sub thread + * - - - - sub sub message (parent id = sub thread) * - - sub message (parent_id = root message) + * - - - sub thread */ mail.Thread = session.web.Widget.extend({ template: 'mail.thread', @@ -787,7 +788,6 @@ openerp.mail = function(session) { * @param {Object} [options] * @param {Object} [message] read about mail.ThreadMessage object * @param {Object} [thread] - * @param {Number} [thread_level=0] number of thread levels * @param {Boolean} [use_composer] use the advanced composer, or * the default basic textarea if not set * @param {Number} [expandable_number=5] number message show @@ -810,7 +810,7 @@ openerp.mail = function(session) { // options this.options={ 'thread' : { - 'thread_level': options.options.thread.thread_level || 0, + 'thread_level': (options.options.thread.thread_level+1) || 0, 'show_header_compose': (options.options.thread.show_header_compose != undefined ? options.options.thread.show_header_compose: false), 'use_composer': options.options.thread.use_composer || false, 'expandable_number': options.options.thread.expandable_number || 5, @@ -890,7 +890,7 @@ openerp.mail = function(session) { if(this.options.thread.show_header_compose){ this.ComposeMessage.$el.show(); - this.ComposeMessage.set_free_attachments(); + //this.ComposeMessage.set_free_attachments(); } var button_fetch = $(' @@ -233,7 +233,7 @@
- + diff --git a/addons/mail/static/src/xml/mail_followers.xml b/addons/mail/static/src/xml/mail_followers.xml index a6df1f0fe8c..f78c91c6305 100644 --- a/addons/mail/static/src/xml/mail_followers.xml +++ b/addons/mail/static/src/xml/mail_followers.xml @@ -13,9 +13,9 @@ Unfollow Following -
-
    -
    +
    +
    +
      diff --git a/addons/mail/tests/test_mail.py b/addons/mail/tests/test_mail.py index 1f17be89604..a94c4fc2c8a 100644 --- a/addons/mail/tests/test_mail.py +++ b/addons/mail/tests/test_mail.py @@ -529,67 +529,6 @@ class test_mail(TestMailMockups): self.assertEqual(message2.subject, _subject, 'mail.message subject incorrect') self.assertEqual(message2.body, group_bird.description, 'mail.message body incorrect') - # FP Note: to be reviewed to be more generic, not depending on the algorythm of - # message_read - #def test_30_message_read(self): - # """ Tests designed for message_read. """ - # # TDE NOTE: this test is not finished, as the message_read method is not fully specified. - # # It will be updated as soon as we have fixed specs ! - # cr, uid = self.cr, self.uid - # group_pigs = self.mail_group.browse(cr, uid, self.group_pigs_id) - - # def _compare_structures(struct1, struct2, n=0): - # # print '%scompare structure' % ('\t' * n) - # # self.assertEqual(len(struct1), len(struct2), 'message_read structure number of childs incorrect') - - # for x in range(len(struct1)): - # if struct1[x].get('type') == 'expandable': - # continue - # # print '%s' % ('\t' * n), struct1[x]['id'], struct1[x]['child_nbr'], struct2[x]['id'], struct2[x].get('child_nbr', 'XX'), struct1[x].get('subject') or '' - # self.assertEqual(struct1[x]['id'], struct2[x]['id'], 'message_read failure %s' % struct1[x].get('subject')) - # _compare_structures(struct1[x]['child_ids'], struct2[x]['child_ids'], n + 1) - # # print '%send compare' % ('\t' * n) - - # # ---------------------------------------- - # # CASE2: message_read test - # # ---------------------------------------- - - # # 1. Add a few messages to pigs group - # msgid1 = group_pigs.message_post(body='1', subject='1', parent_id=False) - # msgid2 = group_pigs.message_post(body='2', subject='1-1', parent_id=msgid1) - # msgid3 = group_pigs.message_post(body='3', subject='1-2', parent_id=msgid1) - # msgid4 = group_pigs.message_post(body='4', subject='2', parent_id=False) - # msgid5 = group_pigs.message_post(body='5', subject='1-1-1', parent_id=msgid2) - # msgid6 = group_pigs.message_post(body='6', subject='2-1', parent_id=msgid4) - - # # Test: read all messages flat - # tree_test = [{'id': msgid6, 'child_ids': []}, {'id': msgid5, 'child_ids': []}, - # {'id': msgid4, 'child_ids': []}, {'id': msgid3, 'child_ids': []}, - # {'id': msgid2, 'child_ids': []}, {'id': msgid1, 'child_ids': []}] - # tree = self.mail_message.message_read(cr, uid, ids=False, domain=[('model', '=', 'mail.group'), ('res_id', '=', self.group_pigs_id)], level=0, limit=15) - # _compare_structures(tree, tree_test) - # # Test: read with 1 level of thread - # tree_test = [{'id': msgid4, 'child_ids': [{'id': msgid6, 'child_ids': []}, ]}, - # {'id': msgid1, 'child_ids': [ - # {'id': msgid5, 'child_ids': []}, {'id': msgid3, 'child_ids': []}, - # {'id': msgid2, 'child_ids': []}, - # ]}, - # ] - # tree = self.mail_message.message_read(cr, uid, ids=False, domain=[('model', '=', 'mail.group'), ('res_id', '=', self.group_pigs_id)], level=1, limit=15) - # _compare_structures(tree, tree_test) - # # Test: read with 2 levels of thread - # tree_test = [{'id': msgid4, 'child_ids': [{'id': msgid6, 'child_ids': []}, ]}, - # {'id': msgid1, 'child_ids': [ - # {'id': msgid3, 'child_ids': []}, - # {'id': msgid2, 'child_ids': [{'id': msgid5, 'child_ids': []}, ]}, - # ]}, - # ] - # tree = self.mail_message.message_read(cr, uid, ids=False, domain=[('model', '=', 'mail.group'), ('res_id', '=', self.group_pigs_id)], level=2, limit=15) - # _compare_structures(tree, tree_test) - - # # 2. Test expandables - # # TDE FIXME: add those tests when expandables are specified and implemented - def test_40_needaction(self): """ Tests for mail.message needaction. """ cr, uid = self.cr, self.uid diff --git a/addons/mail/wizard/mail_compose_message_view.xml b/addons/mail/wizard/mail_compose_message_view.xml index 89e9d454445..7329992f8ed 100644 --- a/addons/mail/wizard/mail_compose_message_view.xml +++ b/addons/mail/wizard/mail_compose_message_view.xml @@ -20,10 +20,7 @@ - - +