Skip to content

A platform for community discussion. Free, open, simple.

DEV: `addTopicsSectionLink` -> `addCommunitySectionLink` plugin api (#17740)

Alan Guo Xiang Tanad6b5825bf35
diff --git a/app/assets/javascripts/discourse/app/lib/plugin-api.js b/app/assets/javascripts/discourse/app/lib/plugin-api.js
index e0897897020..d39b777acec 100644
--- a/app/assets/javascripts/discourse/app/lib/plugin-api.js
+++ b/app/assets/javascripts/discourse/app/lib/plugin-api.js
@@ -1627,12 +1627,12 @@ class PluginApi {
/**
* EXPERIMENTAL. Do not use.
- * Support for adding a link under Sidebar topics section by returning a class which extends from the BaseSectionLink
+ * Support for adding a navigation link to Sidebar Community section by returning a class which extends from the BaseSectionLink
* class interface. See `lib/sidebar/community-section/base-section-link.js` for documentation on the BaseSectionLink class
* interface.
*
* ```
- * api.addTopicsSectionLink((baseSectionLink) => {
+ * api.addCommunitySectionLink((baseSectionLink) => {
* return class CustomSectionLink extends baseSectionLink {
* get name() {
* return "bookmarked";
@@ -1660,7 +1660,7 @@ class PluginApi {
* or
*
* ```
- * api.addTopicsSectionLink({
+ * api.addCommunitySectionLink({
* name: "unread",
* route: "discovery.unread",
* title: I18n.t("some.unread.title"),
@@ -1668,17 +1668,17 @@ class PluginApi {
* })
* ```
*
- * @callback addTopicsSectionLinkCallback
+ * @callback addCommunitySectionLinkCallback
* @param {BaseSectionLink} baseSectionLink - Factory class to inherit from.
* @returns {BaseSectionLink} - A class that extends BaseSectionLink.
*
- * @param {(addTopicsSectionLinkCallback|Object)} arg - A callback function or an Object.
+ * @param {(addCommunitySectionLinkCallback|Object)} arg - A callback function or an Object.
* @param {string} arg.name - The name of the link. Needs to be dasherized and lowercase.
* @param {string} arg.route - The Ember route of the link.
* @param {string} arg.title - The title attribute for the link.
* @param {string} arg.text - The text to display for the link.
*/
- addTopicsSectionLink(arg) {
+ addCommunitySectionLink(arg) {
addSectionLink(arg);
}
diff --git a/app/assets/javascripts/discourse/tests/acceptance/sidebar-community-section-test.js b/app/assets/javascripts/discourse/tests/acceptance/sidebar-community-section-test.js
index 390f73c97bf..283c7a92010 100644
--- a/app/assets/javascripts/discourse/tests/acceptance/sidebar-community-section-test.js
+++ b/app/assets/javascripts/discourse/tests/acceptance/sidebar-community-section-test.js
@@ -758,7 +758,7 @@ acceptance("Sidebar - Community Section", function (needs) {
test("adding section link via plugin API with Object", async function (assert) {
withPluginApi("1.2.0", (api) => {
- api.addTopicsSectionLink({
+ api.addCommunitySectionLink({
name: "unread",
route: "discovery.unread",
text: "unread topics",
@@ -791,7 +791,7 @@ acceptance("Sidebar - Community Section", function (needs) {
test("adding section link via plugin API with callback function", async function (assert) {
withPluginApi("1.2.0", (api) => {
- api.addTopicsSectionLink((baseSectionLink) => {
+ api.addCommunitySectionLink((baseSectionLink) => {
return class CustomSectionLink extends baseSectionLink {
get name() {
return "user-summary";