summaryrefslogtreecommitdiff
path: root/web-ui
diff options
context:
space:
mode:
Diffstat (limited to 'web-ui')
-rw-r--r--web-ui/app/js/dispatchers/left_pane_dispatcher.js8
-rw-r--r--web-ui/app/js/mail_list/ui/mail_list.js3
-rw-r--r--web-ui/app/js/tags/data/tags.js2
-rw-r--r--web-ui/app/js/tags/ui/tag_list.js3
-rw-r--r--web-ui/test/spec/dispatchers/left_pane_dispatcher.spec.js4
-rw-r--r--web-ui/test/spec/mail_list/ui/mail_list.spec.js15
6 files changed, 25 insertions, 10 deletions
diff --git a/web-ui/app/js/dispatchers/left_pane_dispatcher.js b/web-ui/app/js/dispatchers/left_pane_dispatcher.js
index 0ceb3790..21898dca 100644
--- a/web-ui/app/js/dispatchers/left_pane_dispatcher.js
+++ b/web-ui/app/js/dispatchers/left_pane_dispatcher.js
@@ -29,8 +29,8 @@ define(
function leftPaneDispatcher() {
var initialized = false;
- this.refreshTagList = function () {
- this.trigger(document, events.tags.want, { caller: this.$node });
+ this.refreshTagList = function (ev, data) {
+ this.trigger(document, events.tags.want, { caller: this.$node, skipMailListRefresh: data.skipMailListRefresh });
};
this.loadTags = function (ev, data) {
@@ -39,7 +39,7 @@ define(
this.selectTag = function (ev, data) {
var tag = (data && data.tag) || urlParams.getTag();
- this.trigger(document, events.ui.tag.select, { tag: tag });
+ this.trigger(document, events.ui.tag.select, { tag: tag, skipMailListRefresh: data.skipMailListRefresh });
};
this.pushUrlState = function (ev, data) {
@@ -60,7 +60,7 @@ define(
this.on(document, events.dispatchers.tags.refreshTagList, this.refreshTagList);
this.on(document, events.ui.tags.loaded, this.selectTag);
this.on(document, events.ui.tag.selected, this.pushUrlState);
- this.trigger(document, events.tags.want, { caller: this.$node } );
+ this.trigger(document, events.tags.want, { caller: this.$node });
});
}
}
diff --git a/web-ui/app/js/mail_list/ui/mail_list.js b/web-ui/app/js/mail_list/ui/mail_list.js
index 1f915a57..7b518320 100644
--- a/web-ui/app/js/mail_list/ui/mail_list.js
+++ b/web-ui/app/js/mail_list/ui/mail_list.js
@@ -100,6 +100,9 @@ define(
};
this.refreshMailList = function (ev, data) {
+ if (ev) { // triggered by the event, so we need to refresh the tag list
+ this.trigger(document, events.dispatchers.tags.refreshTagList, { skipMailListRefresh: true });
+ }
resetMailList();
renderMails(data.mails);
};
diff --git a/web-ui/app/js/tags/data/tags.js b/web-ui/app/js/tags/data/tags.js
index 97dd12a6..4a1e6af0 100644
--- a/web-ui/app/js/tags/data/tags.js
+++ b/web-ui/app/js/tags/data/tags.js
@@ -40,7 +40,7 @@ define(['flight/lib/component', 'page/events', 'mixins/with_feature_toggle'], fu
function sendTagsBackTo(on, params) {
return function(data) {
data.push(DataTags.all);
- on.trigger(params.caller, events.tags.received, {tags: data});
+ on.trigger(params.caller, events.tags.received, {tags: data, skipMailListRefresh: params.skipMailListRefresh});
};
}
diff --git a/web-ui/app/js/tags/ui/tag_list.js b/web-ui/app/js/tags/ui/tag_list.js
index b5b4d555..850a5fab 100644
--- a/web-ui/app/js/tags/ui/tag_list.js
+++ b/web-ui/app/js/tags/ui/tag_list.js
@@ -92,10 +92,9 @@ define(
}.bind(this));
};
-
this.loadTagList = function(ev, data) {
this.renderTagList(_.sortBy(data.tags, tagOrder));
- this.trigger(document, events.ui.tags.loaded, { tag: this.attr.currentTag });
+ this.trigger(document, events.ui.tags.loaded, { tag: this.attr.currentTag, skipMailListRefresh: data.skipMailListRefresh});
};
this.saveTag = function(ev, data) {
diff --git a/web-ui/test/spec/dispatchers/left_pane_dispatcher.spec.js b/web-ui/test/spec/dispatchers/left_pane_dispatcher.spec.js
index 86b54a48..935bb917 100644
--- a/web-ui/test/spec/dispatchers/left_pane_dispatcher.spec.js
+++ b/web-ui/test/spec/dispatchers/left_pane_dispatcher.spec.js
@@ -47,7 +47,7 @@ describeComponent('dispatchers/left_pane_dispatcher', function () {
it('asks for more tags when refreshTagList is fired', function () {
var tagWantEvent = spyOnEvent(document, Pixelated.events.tags.want);
- $(document).trigger(Pixelated.events.dispatchers.tags.refreshTagList);
+ $(document).trigger(Pixelated.events.dispatchers.tags.refreshTagList, {});
expect(tagWantEvent).toHaveBeenTriggeredOn(document);
});
@@ -63,7 +63,7 @@ describeComponent('dispatchers/left_pane_dispatcher', function () {
it('on tags loaded selects the inbox tag if no data is provided', function () {
var selectTagEvent = spyOnEvent(document, Pixelated.events.ui.tag.select);
- $(document).trigger(Pixelated.events.ui.tags.loaded);
+ $(document).trigger(Pixelated.events.ui.tags.loaded, {});
expect(selectTagEvent).toHaveBeenTriggeredOnAndWith(document, { tag: 'inbox' });
});
diff --git a/web-ui/test/spec/mail_list/ui/mail_list.spec.js b/web-ui/test/spec/mail_list/ui/mail_list.spec.js
index 11993ba1..9c01c6af 100644
--- a/web-ui/test/spec/mail_list/ui/mail_list.spec.js
+++ b/web-ui/test/spec/mail_list/ui/mail_list.spec.js
@@ -166,11 +166,14 @@ describeComponent('mail_list/ui/mail_list', function () {
});
- it('should render all mails sent in ui:mails:show event', function () {
+ it('should render all mails sent in ui:mails:show event but shouldnt refresh the tags', function () {
+ var refreshTagListEvent = spyOnEvent(document, Pixelated.events.dispatchers.tags.refreshTagList);
+
this.component.$node.trigger(Pixelated.events.mails.available, { mails: mailList });
matchMail(mailList[0], this.component.$node);
matchMail(mailList[1], this.component.$node);
+ expect(refreshTagListEvent).not.toHaveBeenTriggeredOn(document);
});
it('should select the current email when mails are available', function () {
@@ -259,6 +262,16 @@ describeComponent('mail_list/ui/mail_list', function () {
});
});
+ describe('refreshing the mail list', function () {
+ it('also refreshes the tag list but skips the next mail list refresh', function () {
+ var tagListRefreshEvent = spyOnEvent(document, Pixelated.events.dispatchers.tags.refreshTagList);
+
+ $(document).trigger(Pixelated.events.mails.availableForRefresh, { mails: []});
+
+ expect(tagListRefreshEvent).toHaveBeenTriggeredOnAndWith(document, { skipMailListRefresh: true});
+ });
+ });
+
function createMail(subject, from, ident, date) {
var mail = Pixelated.testData().parsedMail.simpleTextPlain;