Skip to content

Commit

Permalink
DEV: Remove decoration for legacy hamburger menu (#118)
Browse files Browse the repository at this point in the history
The `legacy` option has been removed from the `navigation_menu` site setting, so we can remove all the logic that's related to the `legacy` option from this plugin.

Internal topic: t/113137.
  • Loading branch information
OsamaSayegh committed Dec 11, 2023
1 parent f6d1697 commit 93fa26f
Showing 1 changed file with 16 additions and 37 deletions.
53 changes: 16 additions & 37 deletions assets/javascripts/discourse/initializers/cakeday.js
Expand Up @@ -68,44 +68,23 @@ function initializeCakeday(api) {
}

if (cakedayEnabled || birthdayEnabled) {
if (
siteSettings.navigation_menu !== "legacy" &&
api.addCommunitySectionLink
) {
if (cakedayEnabled) {
api.addCommunitySectionLink({
name: "anniversaries",
route: "cakeday.anniversaries.today",
title: I18n.t("anniversaries.title"),
text: I18n.t("anniversaries.title"),
icon: "birthday-cake",
});
}

if (birthdayEnabled) {
api.addCommunitySectionLink({
name: "birthdays",
route: "cakeday.birthdays.today",
title: I18n.t("birthdays.title"),
text: I18n.t("birthdays.title"),
icon: "birthday-cake",
});
}
} else {
api.decorateWidget("hamburger-menu:generalLinks", () => {
let route;

if (cakedayEnabled) {
route = "cakeday.anniversaries.today";
} else if (birthdayEnabled) {
route = "cakeday.birthdays.today";
}
if (cakedayEnabled) {
api.addCommunitySectionLink({
name: "anniversaries",
route: "cakeday.anniversaries.today",
title: I18n.t("anniversaries.title"),
text: I18n.t("anniversaries.title"),
icon: "birthday-cake",
});
}

return {
route,
label: "cakeday.title",
className: "cakeday-link",
};
if (birthdayEnabled) {
api.addCommunitySectionLink({
name: "birthdays",
route: "cakeday.birthdays.today",
title: I18n.t("birthdays.title"),
text: I18n.t("birthdays.title"),
icon: "birthday-cake",
});
}
}
Expand Down

0 comments on commit 93fa26f

Please sign in to comment.