From d6069092b2261dbd339c4676fdad07b658bc9ccf Mon Sep 17 00:00:00 2001 From: Chris Hunt Date: Sat, 15 Jun 2013 00:05:55 -0700 Subject: [PATCH] DRY up preference loading in Discourse.User#save --- app/assets/javascripts/discourse/models/user.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/app/assets/javascripts/discourse/models/user.js b/app/assets/javascripts/discourse/models/user.js index de049ad8153..d45808b5111 100644 --- a/app/assets/javascripts/discourse/models/user.js +++ b/app/assets/javascripts/discourse/models/user.js @@ -161,9 +161,12 @@ Discourse.User = Discourse.Model.extend({ type: 'PUT' }).then(function(data) { user.set('bio_excerpt',data.user.bio_excerpt); - Discourse.User.current().set('enable_quoting', user.get('enable_quoting')); - Discourse.User.current().set('external_links_in_new_tab', user.get('external_links_in_new_tab')); - Discourse.User.current().set('dynamic_favicon', user.get('dynamic_favicon')); + + _.each([ + 'enable_quoting', 'external_links_in_new_tab', 'dynamic_favicon' + ], function(preference) { + Discourse.User.current().set(preference, user.get(preference)); + }); }); },