2020-05-22 12:20:05 -04:00
|
|
|
import { withPluginApi } from "discourse/lib/plugin-api";
|
|
|
|
import I18n from "I18n";
|
|
|
|
|
|
|
|
export default {
|
|
|
|
name: "setup-subscriptions",
|
|
|
|
initialize(container) {
|
2020-09-16 10:53:50 -04:00
|
|
|
withPluginApi("0.8.11", (api) => {
|
2024-01-16 11:51:44 -05:00
|
|
|
const siteSettings = container.lookup("service:site-settings");
|
2020-05-22 12:20:05 -04:00
|
|
|
const isNavLinkEnabled =
|
|
|
|
siteSettings.discourse_subscriptions_extra_nav_subscribe;
|
|
|
|
if (isNavLinkEnabled) {
|
|
|
|
api.addNavigationBarItem({
|
|
|
|
name: "subscribe",
|
|
|
|
displayName: I18n.t("discourse_subscriptions.navigation.subscribe"),
|
2020-09-16 10:53:50 -04:00
|
|
|
href: "/s",
|
2020-05-22 12:20:05 -04:00
|
|
|
});
|
|
|
|
}
|
2022-08-10 08:05:54 -04:00
|
|
|
|
|
|
|
const user = api.getCurrentUser();
|
|
|
|
if (user) {
|
|
|
|
api.addQuickAccessProfileItem({
|
|
|
|
icon: "far-credit-card",
|
|
|
|
href: `/u/${user.username}/billing/subscriptions`,
|
|
|
|
content: "Billing",
|
|
|
|
});
|
|
|
|
}
|
2020-05-22 12:20:05 -04:00
|
|
|
});
|
2020-09-16 10:53:50 -04:00
|
|
|
},
|
2020-05-22 12:20:05 -04:00
|
|
|
};
|