Skip to content

Commit

Permalink
deal with unknown user in featured users properly
Browse files Browse the repository at this point in the history
  • Loading branch information
gordonwoodhull committed Nov 5, 2014
1 parent fd4cab1 commit 83c5e8f
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions htdocs/editor_tab.js
Expand Up @@ -368,17 +368,22 @@ var editor = function () {
};
}

function alls_name(subtree) {
return subtree.id.replace("/alls/","");
}

function populate_friends(alls_root) {
var friend_subtrees = alls_root.children.filter(function(subtree) {
return my_friends_[subtree.id.replace("/alls/","")]>0;
return my_friends_[alls_name(subtree)]>0;
});
return create_notebook_root(friend_subtrees, 'friends', 'People I Starred');
}

function populate_featured(alls_root) {
var featured_subtrees = alls_root.children.filter(function(subtree) {
return featured_.indexOf(subtree.id.replace("/alls/",""))>=0;
return featured_.indexOf(alls_name(subtree))>=0;
});
featured_ = featured_subtrees.map(alls_name); // remove any we didn't find in All Notebooks
if(!featured_subtrees.length)
return null;
return create_notebook_root(featured_subtrees, 'featured', 'RCloud Sample Notebooks');
Expand Down Expand Up @@ -431,6 +436,8 @@ var editor = function () {
rcloud.config.get_alluser_option('featured_users')
.then(function(featured) {
featured_ = featured || [];
if(_.isString(featured_))
featured_ = [featured_];
})])
.then(function() {
var alls_root = populate_all_notebooks(user_notebook_set);
Expand Down

0 comments on commit 83c5e8f

Please sign in to comment.