Skip to content

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

DEV: Remove unused code (#34322)

Jarek Radosz41acf4eacedd
diff --git a/app/assets/javascripts/discourse/app/components/d-editor.gjs b/app/assets/javascripts/discourse/app/components/d-editor.gjs
index 0d726921235..e948e143778 100644
--- a/app/assets/javascripts/discourse/app/components/d-editor.gjs
+++ b/app/assets/javascripts/discourse/app/components/d-editor.gjs
@@ -268,7 +268,6 @@ export default class DEditor extends Component {
this.textManipulation.autocomplete(
hashtagAutocompleteOptions(
this.site.hashtag_configurations["topic-composer"],
- this.siteSettings,
{
afterComplete: () => {
schedule(
diff --git a/app/assets/javascripts/discourse/app/lib/category-hashtags.js b/app/assets/javascripts/discourse/app/lib/category-hashtags.js
index 950e0e53b47..a3431750e8c 100644
--- a/app/assets/javascripts/discourse/app/lib/category-hashtags.js
+++ b/app/assets/javascripts/discourse/app/lib/category-hashtags.js
@@ -19,5 +19,5 @@ export function categoryHashtagTriggerRule(textarea, opts) {
id: "discourse.category-hashtags.categoryHashtagTriggerRule",
}
);
- return hashtagTriggerRule(textarea, opts);
+ return hashtagTriggerRule(opts);
}
diff --git a/app/assets/javascripts/discourse/app/lib/hashtag-autocomplete.js b/app/assets/javascripts/discourse/app/lib/hashtag-autocomplete.js
index 3f8dfdd755b..9cda4923533 100644
--- a/app/assets/javascripts/discourse/app/lib/hashtag-autocomplete.js
+++ b/app/assets/javascripts/discourse/app/lib/hashtag-autocomplete.js
@@ -20,7 +20,6 @@ import { CANCELLED_STATUS } from "discourse/modifiers/d-autocomplete";
* Site.hashtag_configurations.
* @param {$Element} $textarea - jQuery element to use for the autocompletion
* plugin to attach to, this is what will watch for the # matcher when the user is typing.
- * @param {Hash} siteSettings - The clientside site settings.
* @param {Function} autocompleteOptions - Options to pass to the jQuery plugin. Must at least include:
*
* - afterComplete - Called with the selected autocomplete option once it is selected.
@@ -33,25 +32,22 @@ import { CANCELLED_STATUS } from "discourse/modifiers/d-autocomplete";
export function setupHashtagAutocomplete(
contextualHashtagConfiguration,
$textarea,
- siteSettings,
autocompleteOptions = {}
) {
$textarea.autocomplete(
hashtagAutocompleteOptions(
contextualHashtagConfiguration,
- siteSettings,
autocompleteOptions
)
);
}
-export async function hashtagTriggerRule(textarea, { inCodeBlock }) {
+export async function hashtagTriggerRule({ inCodeBlock }) {
return !(await inCodeBlock());
}
export function hashtagAutocompleteOptions(
contextualHashtagConfiguration,
- siteSettings,
autocompleteOptions
) {
return {
@@ -64,10 +60,9 @@ export function hashtagAutocompleteOptions(
if (term.match(/\s/)) {
return null;
}
- return _searchGeneric(term, siteSettings, contextualHashtagConfiguration);
+ return _searchGeneric(term, contextualHashtagConfiguration);
},
- triggerRule: async (textarea, opts) =>
- await hashtagTriggerRule(textarea, opts),
+ triggerRule: async (_, opts) => await hashtagTriggerRule(opts),
...autocompleteOptions,
};
}
@@ -85,7 +80,7 @@ function _updateSearchCache(term, results) {
// Note that the search term is _not_ required here, and we follow special
// logic similar to @mentions when there is no search term, to show some
// useful default categories, tags, etc.
-function _searchGeneric(term, siteSettings, contextualHashtagConfiguration) {
+function _searchGeneric(term, contextualHashtagConfiguration) {
if (currentSearch) {
currentSearch.abort();
currentSearch = null;
diff --git a/app/assets/javascripts/float-kit/addon/components/d-menu.gjs b/app/assets/javascripts/float-kit/addon/components/d-menu.gjs
index ba5560c0608..da20b453fc9 100644
--- a/app/assets/javascripts/float-kit/addon/components/d-menu.gjs
+++ b/app/assets/javascripts/float-kit/addon/components/d-menu.gjs
@@ -64,10 +64,6 @@ export default class DMenu extends Component {
}
}
- get menuId() {
- return `d-menu-${this.menuInstance.id}`;
- }
-
get options() {
return this.menuInstance?.options ?? {};
}
diff --git a/plugins/chat/assets/javascripts/discourse/components/chat-composer.gjs b/plugins/chat/assets/javascripts/discourse/components/chat-composer.gjs
index 990b88d7860..a86c4cd89e7 100644
--- a/plugins/chat/assets/javascripts/discourse/components/chat-composer.gjs
+++ b/plugins/chat/assets/javascripts/discourse/components/chat-composer.gjs
@@ -519,7 +519,6 @@ export default class ChatComposer extends Component {
textarea,
hashtagAutocompleteOptions(
this.site.hashtag_configurations["chat-composer"],
- this.siteSettings,
{
fixedTextareaPosition: true,
treatAsTextarea: true,
diff --git a/plugins/discourse-ai/assets/javascripts/discourse/components/ai-bot-conversations.gjs b/plugins/discourse-ai/assets/javascripts/discourse/components/ai-bot-conversations.gjs
index 905cef33ec8..520f3a622ef 100644
--- a/plugins/discourse-ai/assets/javascripts/discourse/components/ai-bot-conversations.gjs
+++ b/plugins/discourse-ai/assets/javascripts/discourse/components/ai-bot-conversations.gjs
@@ -223,7 +223,7 @@ export default class AiBotConversations extends Component {
// You can change this to "chat-composer" if that's more appropriate
const hashtagConfig = this.site.hashtag_configurations["topic-composer"];
- setupHashtagAutocomplete(hashtagConfig, $textarea, this.siteSettings, {
+ setupHashtagAutocomplete(hashtagConfig, $textarea, {
treatAsTextarea: true,
afterComplete: (text) => {
this.textarea.value = text;