diff --git a/blocks/timeline/amd/build/view_dates.min.js b/blocks/timeline/amd/build/view_dates.min.js
index a0c93b6fe5f..1fbe30bbcfd 100644
--- a/blocks/timeline/amd/build/view_dates.min.js
+++ b/blocks/timeline/amd/build/view_dates.min.js
@@ -1,2 +1,2 @@
-define ("block_timeline/view_dates",["jquery","core/str","block_timeline/event_list","core/pubsub","core/paged_content_events"],function(a,b,c,d,e){var f={EVENT_LIST_CONTAINER:"[data-region=\"event-list-container\"]"},g=[5,10,25],h=function(a){var b=parseInt(a.data("limit"),10),c=!1,d=g.map(function(a){if(b==a){c=!0}return{value:a,active:b==a}});if(!c){d[0].active=!0}return d},i=function(b,c){var f=c+e.SET_ITEMS_PER_PAGE_LIMIT;d.subscribe(f,function(c){a(b).data("limit",c)})},j=function(d){var e=d.find(f.EVENT_LIST_CONTAINER),g=a(e).attr("id")+"user_block_timeline"+Math.random();i(d,g);var j=h(d),k={persistentLimitKey:"block_timeline_user_limit_preference",eventNamespace:g};b.get_string("ariaeventlistpaginationnavdates","block_timeline").then(function(a){c.init(e,j,{},a,k);return a}).catch(function(){c.init(e,j,{},"",k)})};return{init:function init(b){b=a(b);if(b.hasClass("active")){j(b);b.data("seen",!0)}},reset:function reset(a){a.removeAttr("data-seen");if(a.hasClass("active")){j(a);a.data("seen",!0)}},shown:function shown(a){if(!a.data("seen")){j(a);a.data("seen",!0)}}}});
+define ("block_timeline/view_dates",["jquery","core/str","block_timeline/event_list","core/pubsub","core/paged_content_events"],function(a,b,c,d,e){var f={EVENT_LIST_CONTAINER:"[data-region=\"event-list-container\"]"},g=[5,10,25],h=function(a){var b=parseInt(a.data("limit"),10),c=!1,d=g.map(function(a){if(b==a){c=!0}return{value:a,active:b==a}});if(!c){d[0].active=!0}return d},i=function(b,c){var f=c+e.SET_ITEMS_PER_PAGE_LIMIT;d.subscribe(f,function(c){a(b).data("limit",c)})},j=function(d){var e=d.find(f.EVENT_LIST_CONTAINER),g=a(e).attr("id")+"user_block_timeline"+Math.random();i(d,g);var j=h(d),k={persistentLimitKey:"block_timeline_user_limit_preference",eventNamespace:g};b.get_string("ariaeventlistpaginationnavdates","block_timeline").then(function(a){c.init(e,j,{},a,k);return a}).catch(function(){c.init(e,j,{},"",k)})};return{init:function init(b){b=a(b);if(b.hasClass("active")){j(b);b.attr("data-seen",!0)}},reset:function reset(a){a.removeAttr("data-seen");if(a.hasClass("active")){j(a);a.attr("data-seen",!0)}},shown:function shown(a){if(!a.attr("data-seen")){j(a);a.attr("data-seen",!0)}}}});
//# sourceMappingURL=view_dates.min.js.map
diff --git a/blocks/timeline/amd/build/view_dates.min.js.map b/blocks/timeline/amd/build/view_dates.min.js.map
index 41af10d382b..f9058d2082b 100644
--- a/blocks/timeline/amd/build/view_dates.min.js.map
+++ b/blocks/timeline/amd/build/view_dates.min.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../src/view_dates.js"],"names":["define","$","Str","EventList","PubSub","PagedContentEvents","SELECTORS","EVENT_LIST_CONTAINER","DEFAULT_PAGE_LIMIT","getPagingLimits","root","limitPref","parseInt","data","isDefaultSet","limits","map","value","active","registerEventListeners","namespace","event","SET_ITEMS_PER_PAGE_LIMIT","subscribe","limit","load","eventListContainer","find","attr","Math","random","config","persistentLimitKey","eventNamespace","get_string","then","string","init","catch","hasClass","reset","removeAttr","shown"],"mappings":"AAsBAA,OAAM,6BACN,CACI,QADJ,CAEI,UAFJ,CAGI,2BAHJ,CAII,aAJJ,CAKI,2BALJ,CADM,CAQN,SACIC,CADJ,CAEIC,CAFJ,CAGIC,CAHJ,CAIIC,CAJJ,CAKIC,CALJ,CAME,IAEMC,CAAAA,CAAS,CAAG,CACZC,oBAAoB,CAAE,wCADV,CAFlB,CAMMC,CAAkB,CAAG,CAAC,CAAD,CAAI,EAAJ,CAAQ,EAAR,CAN3B,CAcMC,CAAe,CAAG,SAASC,CAAT,CAAe,IAC7BC,CAAAA,CAAS,CAAGC,QAAQ,CAACF,CAAI,CAACG,IAAL,CAAU,OAAV,CAAD,CA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AAmCX,CAAnC,CAA2C,EAA3C,CAA+CqB,CAA/C,CAAuDL,CAAvD,EACA,MAAOK,CAAAA,CACV,CAJL,EAKKE,KALL,CAKW,UAAW,CAEdnC,CAAS,CAACkC,IAAV,CAAeX,CAAf,CAAmCX,CAAnC,CAA2C,EAA3C,CAA+C,EAA/C,CAAmDgB,CAAnD,CACH,CARL,CASH,CAxEH,CAkHE,MAAO,CACHM,IAAI,CAnCG,QAAPA,CAAAA,IAAO,CAAS3B,CAAT,CAAe,CACtBA,CAAI,CAAGT,CAAC,CAACS,CAAD,CAAR,CACA,GAAIA,CAAI,CAAC6B,QAAL,CAAc,QAAd,CAAJ,CAA6B,CACzBd,CAAI,CAACf,CAAD,CAAJ,CACAA,CAAI,CAACG,IAAL,CAAU,MAAV,IACH,CACJ,CA4BM,CAEH2B,KAAK,CAtBG,QAARA,CAAAA,KAAQ,CAAS9B,CAAT,CAAe,CACvBA,CAAI,CAAC+B,UAAL,CAAgB,WAAhB,EACA,GAAI/B,CAAI,CAAC6B,QAAL,CAAc,QAAd,CAAJ,CAA6B,CACzBd,CAAI,CAACf,CAAD,CAAJ,CACAA,CAAI,CAACG,IAAL,CAAU,MAAV,IACH,CACJ,CAcM,CAGH6B,KAAK,CAVG,QAARA,CAAAA,KAAQ,CAAShC,CAAT,CAAe,CACvB,GAAI,CAACA,CAAI,CAACG,IAAL,CAAU,MAAV,CAAL,CAAwB,CACpBY,CAAI,CAACf,CAAD,CAAJ,CACAA,CAAI,CAACG,IAAL,CAAU,MAAV,IACH,CACJ,CAEM,CAKV,CArIK,CAAN","sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see .\n\n/**\n * Manage the timeline dates view for the timeline block.\n *\n * @copyright 2018 Ryan Wyllie \n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\ndefine(\n[\n 'jquery',\n 'core/str',\n 'block_timeline/event_list',\n 'core/pubsub',\n 'core/paged_content_events'\n],\nfunction(\n $,\n Str,\n EventList,\n PubSub,\n PagedContentEvents\n) {\n\n var SELECTORS = {\n EVENT_LIST_CONTAINER: '[data-region=\"event-list-container\"]',\n };\n\n var DEFAULT_PAGE_LIMIT = [5, 10, 25];\n\n /**\n * Generate a paged content array of limits taking into account user preferences\n *\n * @param {object} root The root element for the timeline dates view.\n * @return {array} Array of limit objects\n */\n var getPagingLimits = function(root) {\n var limitPref = parseInt(root.data('limit'), 10);\n var isDefaultSet = false;\n var limits = DEFAULT_PAGE_LIMIT.map(function(value) {\n if (limitPref == value) {\n isDefaultSet = true;\n }\n\n return {\n value: value,\n active: limitPref == value\n };\n });\n\n if (!isDefaultSet) {\n limits[0].active = true;\n }\n\n return limits;\n };\n\n /**\n * Setup the listeners for the timeline block\n *\n * @param {string} root view dates container\n * @param {string} namespace The namespace for the paged content\n */\n var registerEventListeners = function(root, namespace) {\n var event = namespace + PagedContentEvents.SET_ITEMS_PER_PAGE_LIMIT;\n PubSub.subscribe(event, function(limit) {\n $(root).data('limit', limit);\n });\n };\n\n /**\n * Initialise the event list and being loading the events.\n *\n * @param {object} root The root element for the timeline dates view.\n */\n var load = function(root) {\n var eventListContainer = root.find(SELECTORS.EVENT_LIST_CONTAINER);\n var namespace = $(eventListContainer).attr('id') + \"user_block_timeline\" + Math.random();\n registerEventListeners(root, namespace);\n\n var limits = getPagingLimits(root);\n var config = {\n persistentLimitKey: \"block_timeline_user_limit_preference\",\n eventNamespace: namespace\n };\n Str.get_string('ariaeventlistpaginationnavdates', 'block_timeline')\n .then(function(string) {\n EventList.init(eventListContainer, limits, {}, string, config);\n return string;\n })\n .catch(function() {\n // Ignore if we can't load the string. Still init the event list.\n EventList.init(eventListContainer, limits, {}, \"\", config);\n });\n };\n\n /**\n * Initialise the timeline dates view. Begin loading the events\n * if this view is active.\n *\n * @param {object} root The root element for the timeline courses view.\n */\n var init = function(root) {\n root = $(root);\n if (root.hasClass('active')) {\n load(root);\n root.data('seen', true);\n }\n };\n\n /**\n * Reset the view back to it's initial state. If this view is active then\n * beging loading the events.\n *\n * @param {object} root The root element for the timeline courses view.\n */\n var reset = function(root) {\n root.removeAttr('data-seen');\n if (root.hasClass('active')) {\n load(root);\n root.data('seen', true);\n }\n };\n\n /**\n * Load the events if this is the first time the view is displayed.\n *\n * @param {object} root The root element for the timeline courses view.\n */\n var shown = function(root) {\n if (!root.data('seen')) {\n load(root);\n root.data('seen', true);\n }\n };\n\n return {\n init: init,\n reset: reset,\n shown: shown\n };\n});\n"],"file":"view_dates.min.js"}
\ No newline at end of file
+{"version":3,"sources":["../src/view_dates.js"],"names":["define","$","Str","EventList","PubSub","PagedContentEvents","SELECTORS","EVENT_LIST_CONTAINER","DEFAULT_PAGE_LIMIT","getPagingLimits","root","limitPref","parseInt","data","isDefaultSet","limits","map","value","active","registerEventListeners","namespace","event","SET_ITEMS_PER_PAGE_LIMIT","subscribe","limit","load","eventListContainer","find","attr","Math","random","config","persistentLimitKey","eventNamespace","get_string","then","string","init","catch","hasClass","reset","removeAttr","shown"],"mappings":"AAsBAA,OAAM,6BACN,CACI,QADJ,CAEI,UAFJ,CAGI,2BAHJ,CAII,aAJJ,CAKI,2BALJ,CADM,CAQN,SACIC,CADJ,CAEIC,CAFJ,CAGIC,CAHJ,CAIIC,CAJJ,CAKIC,CALJ,CAME,IAEMC,CAAAA,CAAS,CAAG,CACZC,oBAAoB,CAAE,wCADV,CAFlB,CAMMC,CAAkB,CAAG,CAAC,CAAD,CAAI,EAAJ,CAAQ,EAAR,CAN3B,CAcMC,CAAe,CAAG,SAASC,CAAT,CAAe,IAC7BC,CAAAA,CAA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SAASC,CAAT,CAAiB,CACnBjC,CAAS,CAACkC,IAAV,CAAeX,CAAf,CAAmCX,CAAnC,CAA2C,EAA3C,CAA+CqB,CAA/C,CAAuDL,CAAvD,EACA,MAAOK,CAAAA,CACV,CAJL,EAKKE,KALL,CAKW,UAAW,CAEdnC,CAAS,CAACkC,IAAV,CAAeX,CAAf,CAAmCX,CAAnC,CAA2C,EAA3C,CAA+C,EAA/C,CAAmDgB,CAAnD,CACH,CARL,CASH,CAxEH,CAkHE,MAAO,CACHM,IAAI,CAnCG,QAAPA,CAAAA,IAAO,CAAS3B,CAAT,CAAe,CACtBA,CAAI,CAAGT,CAAC,CAACS,CAAD,CAAR,CACA,GAAIA,CAAI,CAAC6B,QAAL,CAAc,QAAd,CAAJ,CAA6B,CACzBd,CAAI,CAACf,CAAD,CAAJ,CACAA,CAAI,CAACkB,IAAL,CAAU,WAAV,IACH,CACJ,CA4BM,CAEHY,KAAK,CAtBG,QAARA,CAAAA,KAAQ,CAAS9B,CAAT,CAAe,CACvBA,CAAI,CAAC+B,UAAL,CAAgB,WAAhB,EACA,GAAI/B,CAAI,CAAC6B,QAAL,CAAc,QAAd,CAAJ,CAA6B,CACzBd,CAAI,CAACf,CAAD,CAAJ,CACAA,CAAI,CAACkB,IAAL,CAAU,WAAV,IACH,CACJ,CAcM,CAGHc,KAAK,CAVG,QAARA,CAAAA,KAAQ,CAAShC,CAAT,CAAe,CACvB,GAAI,CAACA,CAAI,CAACkB,IAAL,CAAU,WAAV,CAAL,CAA6B,CACzBH,CAAI,CAACf,CAAD,CAAJ,CACAA,CAAI,CAACkB,IAAL,CAAU,WAAV,IACH,CACJ,CAEM,CAKV,CArIK,CAAN","sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see .\n\n/**\n * Manage the timeline dates view for the timeline block.\n *\n * @copyright 2018 Ryan Wyllie \n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\ndefine(\n[\n 'jquery',\n 'core/str',\n 'block_timeline/event_list',\n 'core/pubsub',\n 'core/paged_content_events'\n],\nfunction(\n $,\n Str,\n EventList,\n PubSub,\n PagedContentEvents\n) {\n\n var SELECTORS = {\n EVENT_LIST_CONTAINER: '[data-region=\"event-list-container\"]',\n };\n\n var DEFAULT_PAGE_LIMIT = [5, 10, 25];\n\n /**\n * Generate a paged content array of limits taking into account user preferences\n *\n * @param {object} root The root element for the timeline dates view.\n * @return {array} Array of limit objects\n */\n var getPagingLimits = function(root) {\n var limitPref = parseInt(root.data('limit'), 10);\n var isDefaultSet = false;\n var limits = DEFAULT_PAGE_LIMIT.map(function(value) {\n if (limitPref == value) {\n isDefaultSet = true;\n }\n\n return {\n value: value,\n active: limitPref == value\n };\n });\n\n if (!isDefaultSet) {\n limits[0].active = true;\n }\n\n return limits;\n };\n\n /**\n * Setup the listeners for the timeline block\n *\n * @param {string} root view dates container\n * @param {string} namespace The namespace for the paged content\n */\n var registerEventListeners = function(root, namespace) {\n var event = namespace + PagedContentEvents.SET_ITEMS_PER_PAGE_LIMIT;\n PubSub.subscribe(event, function(limit) {\n $(root).data('limit', limit);\n });\n };\n\n /**\n * Initialise the event list and being loading the events.\n *\n * @param {object} root The root element for the timeline dates view.\n */\n var load = function(root) {\n var eventListContainer = root.find(SELECTORS.EVENT_LIST_CONTAINER);\n var namespace = $(eventListContainer).attr('id') + \"user_block_timeline\" + Math.random();\n registerEventListeners(root, namespace);\n\n var limits = getPagingLimits(root);\n var config = {\n persistentLimitKey: \"block_timeline_user_limit_preference\",\n eventNamespace: namespace\n };\n Str.get_string('ariaeventlistpaginationnavdates', 'block_timeline')\n .then(function(string) {\n EventList.init(eventListContainer, limits, {}, string, config);\n return string;\n })\n .catch(function() {\n // Ignore if we can't load the string. Still init the event list.\n EventList.init(eventListContainer, limits, {}, \"\", config);\n });\n };\n\n /**\n * Initialise the timeline dates view. Begin loading the events\n * if this view is active.\n *\n * @param {object} root The root element for the timeline courses view.\n */\n var init = function(root) {\n root = $(root);\n if (root.hasClass('active')) {\n load(root);\n root.attr('data-seen', true);\n }\n };\n\n /**\n * Reset the view back to it's initial state. If this view is active then\n * beging loading the events.\n *\n * @param {object} root The root element for the timeline courses view.\n */\n var reset = function(root) {\n root.removeAttr('data-seen');\n if (root.hasClass('active')) {\n load(root);\n root.attr('data-seen', true);\n }\n };\n\n /**\n * Load the events if this is the first time the view is displayed.\n *\n * @param {object} root The root element for the timeline courses view.\n */\n var shown = function(root) {\n if (!root.attr('data-seen')) {\n load(root);\n root.attr('data-seen', true);\n }\n };\n\n return {\n init: init,\n reset: reset,\n shown: shown\n };\n});\n"],"file":"view_dates.min.js"}
\ No newline at end of file
diff --git a/blocks/timeline/amd/src/view_dates.js b/blocks/timeline/amd/src/view_dates.js
index a46bd0f18ec..03c4ccdff1a 100644
--- a/blocks/timeline/amd/src/view_dates.js
+++ b/blocks/timeline/amd/src/view_dates.js
@@ -118,7 +118,7 @@ function(
root = $(root);
if (root.hasClass('active')) {
load(root);
- root.data('seen', true);
+ root.attr('data-seen', true);
}
};
@@ -132,7 +132,7 @@ function(
root.removeAttr('data-seen');
if (root.hasClass('active')) {
load(root);
- root.data('seen', true);
+ root.attr('data-seen', true);
}
};
@@ -142,9 +142,9 @@ function(
* @param {object} root The root element for the timeline courses view.
*/
var shown = function(root) {
- if (!root.data('seen')) {
+ if (!root.attr('data-seen')) {
load(root);
- root.data('seen', true);
+ root.attr('data-seen', true);
}
};
diff --git a/blocks/timeline/tests/behat/block_timeline_courses.feature b/blocks/timeline/tests/behat/block_timeline_courses.feature
index 1a21635f437..6e6f71379f9 100644
--- a/blocks/timeline/tests/behat/block_timeline_courses.feature
+++ b/blocks/timeline/tests/behat/block_timeline_courses.feature
@@ -111,3 +111,23 @@ Feature: The timeline block allows users to see upcoming courses
And I should not see "Course 4" in the "Timeline" "block"
And I should not see "Test choice 2 closes" in the "Timeline" "block"
And I should not see "Test feedback 4 closes" in the "Timeline" "block"
+
+ Scenario: Current filtering always applies in courses view
+ Given I log in as "student1"
+ And I click on "Sort timeline items" "button" in the "Timeline" "block"
+ And I click on "Sort by courses" "link" in the "Timeline" "block"
+ And I click on "Filter timeline items" "button" in the "Timeline" "block"
+ And I click on "Overdue" "link" in the "Timeline" "block"
+ And I reload the page
+ And I should see "Test assign 1 is due" in the "Timeline" "block"
+ And I should not see "Test feedback 2 closes" in the "Timeline" "block"
+ And I click on "Sort timeline items" "button" in the "Timeline" "block"
+ And I click on "Sort by dates" "link" in the "Timeline" "block"
+ And I click on "Filter timeline items" "button" in the "Timeline" "block"
+ # Confirm that when we switch back to courses view, the "All" filer continues to be applied (and not "overdue").
+ When I click on "All" "link" in the "Timeline" "block"
+ And I click on "Sort timeline items" "button" in the "Timeline" "block"
+ And I click on "Sort by courses" "link" in the "Timeline" "block"
+ And I click on "More courses" "button" in the "Timeline" "block"
+ Then I should see "Test assign 1 is due" in the "Timeline" "block"
+ And I should see "Test feedback 2 closes" in the "Timeline" "block"
diff --git a/blocks/timeline/tests/behat/block_timeline_dates.feature b/blocks/timeline/tests/behat/block_timeline_dates.feature
index 479aa84bbf0..cb0e8f1796e 100644
--- a/blocks/timeline/tests/behat/block_timeline_dates.feature
+++ b/blocks/timeline/tests/behat/block_timeline_dates.feature
@@ -119,3 +119,23 @@ Feature: The timeline block allows users to see upcoming activities
And I should not see "Test choice 1 closes" in the "Timeline" "block"
And I should not see "Test choice 3 closes" in the "Timeline" "block"
And I should not see "Test feedback 3 closes" in the "Timeline" "block"
+
+ Scenario: Current filtering always applies in date view
+ Given I log in as "student1"
+ And I click on "Filter timeline items" "button" in the "Timeline" "block"
+ And I click on "Overdue" "link" in the "Timeline" "block"
+ And I reload the page
+ # Expand to 25 results, to ensure we see the earliest and latest timeline items.
+ And I click on "Show 5 activities per page" "button" in the "Timeline" "block"
+ And I click on "25" "link"
+ And I should see "Test assign 1 is due" in the "Timeline" "block"
+ And I should not see "Test feedback 2 closes" in the "Timeline" "block"
+ And I click on "Sort timeline items" "button" in the "Timeline" "block"
+ And I click on "Sort by courses" "link" in the "Timeline" "block"
+ And I click on "Filter timeline items" "button" in the "Timeline" "block"
+ # Confirm that when we switch back to date view, the "All" filer continues to be applied (and not "overdue")
+ When I click on "All" "link" in the "Timeline" "block"
+ And I click on "Sort timeline items" "button" in the "Timeline" "block"
+ And I click on "Sort by dates" "link" in the "Timeline" "block"
+ Then I should see "Test assign 1 is due" in the "Timeline" "block"
+ And I should see "Test feedback 2 closes" in the "Timeline" "block"