aboutsummaryrefslogtreecommitdiff
path: root/src/web/js/actions
diff options
context:
space:
mode:
authorFrançois Schmidts <francois.schmidts@gmail.com>2016-01-28 22:47:36 +0100
committerFrançois Schmidts <francois.schmidts@gmail.com>2016-01-28 22:47:36 +0100
commit8e942f6f5695c4788328b4959527b30ff31e771d (patch)
tree1d6caa3d4b1d102ed804215d21bad8a04f9a00ff /src/web/js/actions
parentslight redo of middle panel (diff)
downloadnewspipe-8e942f6f5695c4788328b4959527b30ff31e771d.tar.gz
newspipe-8e942f6f5695c4788328b4959527b30ff31e771d.tar.bz2
newspipe-8e942f6f5695c4788328b4959527b30ff31e771d.zip
redoing menu, sorting in place and not in python
Diffstat (limited to 'src/web/js/actions')
-rw-r--r--src/web/js/actions/MenuActions.js2
-rw-r--r--src/web/js/actions/MiddlePanelActions.js17
2 files changed, 8 insertions, 11 deletions
diff --git a/src/web/js/actions/MenuActions.js b/src/web/js/actions/MenuActions.js
index 4266c207..4b17d084 100644
--- a/src/web/js/actions/MenuActions.js
+++ b/src/web/js/actions/MenuActions.js
@@ -9,8 +9,8 @@ var MenuActions = {
jquery.getJSON('/menu', function(payload) {
JarrDispatcher.dispatch({
type: ActionTypes.RELOAD_MENU,
+ feeds: payload.feeds,
categories: payload.categories,
- feed_in_error: payload.feed_in_error,
all_unread_count: payload.all_unread_count,
});
});
diff --git a/src/web/js/actions/MiddlePanelActions.js b/src/web/js/actions/MiddlePanelActions.js
index e1ced2a2..ec76d2bc 100644
--- a/src/web/js/actions/MiddlePanelActions.js
+++ b/src/web/js/actions/MiddlePanelActions.js
@@ -21,14 +21,16 @@ var shouldFetch = function(filters) {
// }
// return false;
}
+var key_whitelist = ['filter_id', 'filter_type',
+ 'query', 'search_title', 'search_content'];
var reloadIfNecessaryAndDispatch = function(dispath_payload) {
if(shouldFetch(dispath_payload)) {
var filters = MiddlePanelStore.getRequestFilter();
- for (var key in filters) {
- if(dispath_payload[key] != null) {
+ key_whitelist.map(function(key) {
+ if(key in dispath_payload) {
filters[key] = dispath_payload[key];
}
- }
+ });
jquery.getJSON('/middle_panel', filters,
function(payload) {
dispath_payload.articles = payload.articles;
@@ -43,13 +45,8 @@ var reloadIfNecessaryAndDispatch = function(dispath_payload) {
var MiddlePanelActions = {
reload: function() {
- var filters = MiddlePanelStore.getRequestFilter();
- jquery.getJSON('/middle_panel', filters, function(payload) {
- _last_fetched_with = filters;
- JarrDispatcher.dispatch({
- type: ActionTypes.RELOAD_MIDDLE_PANEL,
- articles: payload.articles,
- });
+ reloadIfNecessaryAndDispatch({
+ type: ActionTypes.RELOAD_MIDDLE_PANEL,
});
},
search: function(search) {
bgstack15