Christophe Matthieu (OpenERP) has proposed merging
lp:~openerp-dev/openobject-addons/trunk-follow-subtype-fix-chm into
lp:openobject-addons.
Requested reviews:
OpenERP Core Team (openerp)
For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-follow-subtype-fix-chm/+merge/130314
--
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-follow-subtype-fix-chm/+merge/130314
Your team OpenERP R&D Team is subscribed to branch
lp:~openerp-dev/openobject-addons/trunk-follow-subtype-fix-chm.
=== modified file 'mail/mail_thread.py'
--- mail/mail_thread.py 2012-10-18 09:34:53 +0000
+++ mail/mail_thread.py 2012-10-18 10:35:27 +0000
@@ -722,8 +722,13 @@
def message_subscribe_users(self, cr, uid, ids, user_ids=None, subtype_ids=None, context=None):
""" Wrapper on message_subscribe, using users. If user_ids is not
provided, subscribe uid instead. """
+<<<<<<< TREE
if user_ids is None:
user_ids = [uid]
+=======
+ if not user_ids:
+ user_ids = [uid]
+>>>>>>> MERGE-SOURCE
partner_ids = [user.partner_id.id for user in self.pool.get('res.users').browse(cr, uid, user_ids, context=context)]
return self.message_subscribe(cr, uid, ids, partner_ids, subtype_ids=subtype_ids, context=context)
=== modified file 'mail/static/src/js/mail_followers.js'
--- mail/static/src/js/mail_followers.js 2012-10-18 09:34:53 +0000
+++ mail/static/src/js/mail_followers.js 2012-10-18 10:35:27 +0000
@@ -37,8 +37,11 @@
// use actual_mode property on view to know if the view is in create mode anymore
this.view.on("change:actual_mode", this, this._check_visibility);
this._check_visibility();
- this.reinit();
this.bind_events();
+<<<<<<< TREE
+=======
+ this.read_value().pipe(this.proxy('render_value'));
+>>>>>>> MERGE-SOURCE
},
_check_visibility: function() {
@@ -47,11 +50,11 @@
reinit: function() {
this.message_is_follower == undefined;
- this.display_buttons();
},
bind_events: function() {
var self = this;
+<<<<<<< TREE
// event: click on '(Un)Follow' button, that toggles the follow for uid
this.$('.oe_follower').on('click', function (event) {
if($(this).hasClass('oe_notfollow'))
@@ -63,6 +66,21 @@
this.$el.on('click', 'ul.oe_subtypes input', self.do_update_subscription);
// event: click on 'invite' button, that opens the invite wizard
this.$('.oe_invite').on('click', function (event) {
+=======
+ this.$('button.oe_follower')
+ .on('click', function () {
+ if($(this).hasClass('oe_notfollow')){
+ self.do_follow();
+ }
+ else{
+ self.do_unfollow();
+ }
+ });
+
+ this.$el.on('click', 'ul.oe_subtypes input', self.do_update_subscription );
+
+ this.$el.on('click', 'button.oe_invite', function(event) {
+>>>>>>> MERGE-SOURCE
action = {
type: 'ir.actions.act_window',
res_model: 'mail.wizard.invite',
@@ -101,8 +119,24 @@
return this.fetch_followers(this.get("value"));
},
+<<<<<<< TREE
+=======
+ set_is_follower: function(value_) {
+ this.message_is_follower=false;
+ for(var i in value_){
+ if(value_[i]['user_ids'][0]==this.session.uid){
+ this.message_is_follower=true;
+ break;
+ }
+ }
+ this.display_buttons();
+ return this.message_is_follower;
+ },
+
+>>>>>>> MERGE-SOURCE
fetch_followers: function (value_) {
this.value = value_ || {};
+<<<<<<< TREE
return this.ds_follow.call('read', [this.value, ['name', 'user_ids']])
.pipe(this.proxy('display_followers'), this.proxy('fetch_generic'))
.pipe(this.proxy('display_buttons'))
@@ -119,6 +153,13 @@
var pid = results['partner_id'][0];
self.message_is_follower = (_.indexOf(self.get('value'), pid) != -1);
}).pipe(self.proxy('display_generic'));
+=======
+ this.message_is_follower = (this.getParent().fields.message_is_follower && this.getParent().fields.message_is_follower.get_value());
+ if(value_)
+ return this.ds_follow.call('read', [this.value, ['name', 'user_ids']])
+ .done(this.proxy('set_is_follower'), this.proxy('display_followers'), this.proxy('display_subtypes'))
+ .fail(this.proxy('display_generic'));
+>>>>>>> MERGE-SOURCE
},
/* Display generic info about follower, for people not having access to res_partner */
@@ -152,12 +193,15 @@
if (truncated.length < records.length) {
$('<li>And ' + (records.length - truncated.length) + ' more.</li>').appendTo(node_user_list);
}
+<<<<<<< TREE
},
/** Computes whether the current user is in the followers */
set_is_follower: function (records) {
var user_ids = _.pluck(_.pluck(records, 'user_ids'), 0);
return _.indexOf(user_ids, this.session.uid) != -1;
+=======
+>>>>>>> MERGE-SOURCE
},
display_buttons: function () {
@@ -195,6 +239,27 @@
});
},
+<<<<<<< TREE
+=======
+ /** Display subtypes: {'name': default, followed} */
+ display_subtypes: function (visible) {
+ var self = this;
+ var recthread_subtypes = self.$('.oe_recthread_subtypes');
+ subtype_list_ul = self.$('ul.oe_subtypes');
+
+ if(subtype_list_ul.is(":empty")) {
+ var context = new session.web.CompoundContext(this.build_context(), {});
+ this.ds_model.call('get_message_subtypes',[[self.view.datarecord.id], context]).pipe(this.proxy('set_subtypes'));
+ }
+
+ if(this.message_is_follower){
+ recthread_subtypes.show();
+ }else {
+ recthread_subtypes.hide();
+ }
+ },
+
+>>>>>>> MERGE-SOURCE
do_follow: function () {
_(this.$('.oe_msg_subtype_check')).each(function (record) {
$(record).attr('checked', 'checked');
@@ -203,11 +268,20 @@
},
do_unfollow: function () {
+<<<<<<< TREE
_(this.$('.oe_msg_subtype_check')).each(function (record) {
+=======
+ var self = this;
+
+ _(this.$('.oe_msg_subtype_check')).each(function(record){
+>>>>>>> MERGE-SOURCE
$(record).attr('checked',false);
});
var context = new session.web.CompoundContext(this.build_context(), {});
- return this.ds_model.call('message_unsubscribe_users', [[this.view.datarecord.id], [this.session.uid], context]).pipe(this.proxy('read_value'));
+ return this.ds_model.call('message_unsubscribe_users', [[this.view.datarecord.id], [this.session.uid], context])
+ .pipe(function(){
+ self.read_value().pipe(self.proxy('render_value'))
+ });
},
do_update_subscription: function (event) {
@@ -220,9 +294,21 @@
}
});
+<<<<<<< TREE
var context = new session.web.CompoundContext(this.build_context(), {});
return this.ds_model.call('message_subscribe_users', [[this.view.datarecord.id], [this.session.uid], this.message_is_follower ? checklist:undefined, context])
.pipe(this.proxy('read_value'));
+=======
+ if(!checklist.length)
+ return this.do_unfollow();
+ else{
+ var context = new session.web.CompoundContext(this.build_context(), {});
+ return this.ds_model.call('message_subscribe_users', [[this.view.datarecord.id], [this.session.uid], undefined, context])
+ .pipe(function(){
+ self.read_value().pipe(self.proxy('render_value'))
+ });
+ }
+>>>>>>> MERGE-SOURCE
},
});
};
_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help : https://help.launchpad.net/ListHelp