diff options
author | Duda Dornelles <ddornell@thoughtworks.com> | 2014-10-16 17:08:55 +0200 |
---|---|---|
committer | Duda Dornelles <ddornell@thoughtworks.com> | 2014-10-16 17:09:06 +0200 |
commit | a8f3d31bd41def7a334b5a2f4f260ec77ce76d2c (patch) | |
tree | fbabfffc7d1433add643822ad3b4faf637d3d337 | |
parent | 5a0425986800bf03de8c49dc00f45d86d3b365ee (diff) |
Making sure only the tags are shown in the mail when you update the mail
tags. Also, disabling the tags feature toggles
-rw-r--r-- | web-ui/app/js/mixins/with_mail_tagging.js | 22 | ||||
-rw-r--r-- | web-ui/app/js/services/mail_service.js | 7 | ||||
-rw-r--r-- | web-ui/test/spec/services/mail_service.spec.js | 3 |
3 files changed, 12 insertions, 20 deletions
diff --git a/web-ui/app/js/mixins/with_mail_tagging.js b/web-ui/app/js/mixins/with_mail_tagging.js index 482cd0aa..c3647443 100644 --- a/web-ui/app/js/mixins/with_mail_tagging.js +++ b/web-ui/app/js/mixins/with_mail_tagging.js @@ -27,10 +27,6 @@ define( }; this.attachTagCompletion = function(mail) { - if(!features.isEnabled('tags')) { - return; - } - this.tagFilter = function (parsedResult) { var filtered = _.filter(parsedResult, function (tag) {return ! _.contains(mail.tags, tag.name); }); return _.map(filtered, function(tag) { return {value: Handlebars.Utils.escapeExpression(tag.name)}; }); @@ -56,16 +52,14 @@ define( }); }; - this.createNewTag = function() { - if(features.isEnabled('createNewTag')) { - var tagsCopy = this.attr.mail.tags.slice(); - tagsCopy.push(this.select('newTagInput').val()); - this.tagCompleter.clear(); - this.tagCompleter.clearPrefetchCache(); - this.tagCompleter.clearRemoteCache(); - this.updateTags(this.attr.mail, _.uniq(tagsCopy)); - this.trigger(document, events.dispatchers.tags.refreshTagList); - } + this.createNewTag = function () { + var tagsCopy = this.attr.mail.tags.slice(); + tagsCopy.push(this.select('newTagInput').val()); + this.tagCompleter.clear(); + this.tagCompleter.clearPrefetchCache(); + this.tagCompleter.clearRemoteCache(); + this.updateTags(this.attr.mail, _.uniq(tagsCopy)); + this.trigger(document, events.dispatchers.tags.refreshTagList, { skipMailListRefresh: true }); }; this.after('displayMail', function () { diff --git a/web-ui/app/js/services/mail_service.js b/web-ui/app/js/services/mail_service.js index b773bd8b..af957a7b 100644 --- a/web-ui/app/js/services/mail_service.js +++ b/web-ui/app/js/services/mail_service.js @@ -58,7 +58,7 @@ define( data: JSON.stringify({newtags: data.tags}) }).done(function (data) { that.refreshResults(); - $(document).trigger(events.mail.tags.updated, { ident: ident, tags: data }); + $(document).trigger(events.mail.tags.updated, { ident: ident, tags: data.tags }); }) .fail(function (resp) { var msg = i18n('Could not update mail tags'); @@ -263,10 +263,7 @@ define( this.after('initialize', function () { that = this; - if (features.isEnabled('tags')) { - this.on(events.mail.tags.update, this.updateTags); - } - + this.on(events.mail.tags.update, this.updateTags); this.on(events.mail.draftReply.want, this.wantDraftReplyForMail); this.on(events.mail.want, this.fetchSingle); this.on(events.mail.read, this.readMail); diff --git a/web-ui/test/spec/services/mail_service.spec.js b/web-ui/test/spec/services/mail_service.spec.js index 85680cb6..3ce223cc 100644 --- a/web-ui/test/spec/services/mail_service.spec.js +++ b/web-ui/test/spec/services/mail_service.spec.js @@ -81,7 +81,8 @@ describeComponent('services/mail_service', function () { it('updates the tags of the desired message', function () { spyOn(this.component, 'refreshResults'); - var spyAjax = spyOn($, 'ajax').andReturn({done: function(f) { f(); return {fail: function() {}};}}); + var updateTagsReturnValue = { tags: ['website'], mailbox: 'inbox'} + var spyAjax = spyOn($, 'ajax').andReturn({done: function(f) { f(updateTagsReturnValue); return {fail: function() {}};}}); var spyEvent = spyOnEvent(document, Pixelated.events.mail.tags.updated); var component = jasmine.createSpyObj('component',['successUpdateTags']); |