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

This commit is contained in:
Alan Guo Xiang Tan 2022-08-01 15:19:52 +08:00 committed by GitHub
parent af912b4b0e
commit ad6b5825bf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 8 deletions

View File

@ -1627,12 +1627,12 @@ class PluginApi {
/** /**
* EXPERIMENTAL. Do not use. * 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 * class interface. See `lib/sidebar/community-section/base-section-link.js` for documentation on the BaseSectionLink class
* interface. * interface.
* *
* ``` * ```
* api.addTopicsSectionLink((baseSectionLink) => { * api.addCommunitySectionLink((baseSectionLink) => {
* return class CustomSectionLink extends baseSectionLink { * return class CustomSectionLink extends baseSectionLink {
* get name() { * get name() {
* return "bookmarked"; * return "bookmarked";
@ -1660,7 +1660,7 @@ class PluginApi {
* or * or
* *
* ``` * ```
* api.addTopicsSectionLink({ * api.addCommunitySectionLink({
* name: "unread", * name: "unread",
* route: "discovery.unread", * route: "discovery.unread",
* title: I18n.t("some.unread.title"), * title: I18n.t("some.unread.title"),
@ -1668,17 +1668,17 @@ class PluginApi {
* }) * })
* ``` * ```
* *
* @callback addTopicsSectionLinkCallback * @callback addCommunitySectionLinkCallback
* @param {BaseSectionLink} baseSectionLink - Factory class to inherit from. * @param {BaseSectionLink} baseSectionLink - Factory class to inherit from.
* @returns {BaseSectionLink} - A class that extends BaseSectionLink. * @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.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.route - The Ember route of the link.
* @param {string} arg.title - The title attribute for the link. * @param {string} arg.title - The title attribute for the link.
* @param {string} arg.text - The text to display for the link. * @param {string} arg.text - The text to display for the link.
*/ */
addTopicsSectionLink(arg) { addCommunitySectionLink(arg) {
addSectionLink(arg); addSectionLink(arg);
} }

View File

@ -758,7 +758,7 @@ acceptance("Sidebar - Community Section", function (needs) {
test("adding section link via plugin API with Object", async function (assert) { test("adding section link via plugin API with Object", async function (assert) {
withPluginApi("1.2.0", (api) => { withPluginApi("1.2.0", (api) => {
api.addTopicsSectionLink({ api.addCommunitySectionLink({
name: "unread", name: "unread",
route: "discovery.unread", route: "discovery.unread",
text: "unread topics", 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) { test("adding section link via plugin API with callback function", async function (assert) {
withPluginApi("1.2.0", (api) => { withPluginApi("1.2.0", (api) => {
api.addTopicsSectionLink((baseSectionLink) => { api.addCommunitySectionLink((baseSectionLink) => {
return class CustomSectionLink extends baseSectionLink { return class CustomSectionLink extends baseSectionLink {
get name() { get name() {
return "user-summary"; return "user-summary";