mirror of
https://github.com/discourse/discourse.git
synced 2024-11-25 18:13:38 +08:00
DEV: Make context available to ExtraNavItems
This context is available to other NavItems so this makes things more consistent.
This commit is contained in:
parent
5c59247c3a
commit
337fdccfeb
|
@ -198,8 +198,14 @@ NavItem.reopenClass({
|
|||
i => i !== null && !(category && i.get("name").indexOf("categor") === 0)
|
||||
);
|
||||
|
||||
const context = {
|
||||
category: args.category,
|
||||
tagId: args.tagId,
|
||||
noSubcategories: args.noSubcategories
|
||||
};
|
||||
|
||||
const extraItems = NavItem.extraNavItemDescriptors
|
||||
.map(descriptor => ExtraNavItem.create(descriptor))
|
||||
.map(descriptor => ExtraNavItem.create(_.merge({}, context, descriptor)))
|
||||
.filter(item => {
|
||||
if (!item.customFilter) return true;
|
||||
return item.customFilter(category, args);
|
||||
|
|
Loading…
Reference in New Issue
Block a user