DEV: Remove unused code (#34322)

This commit is contained in:
Jarek Radosz
2025-08-14 16:21:46 +02:00
committed by GitHub
parent 93f0f5ce54
commit 41acf4eace
6 changed files with 6 additions and 17 deletions
@@ -268,7 +268,6 @@ export default class DEditor extends Component {
this.textManipulation.autocomplete(
hashtagAutocompleteOptions(
this.site.hashtag_configurations["topic-composer"],
this.siteSettings,
{
afterComplete: () => {
schedule(
@@ -19,5 +19,5 @@ export function categoryHashtagTriggerRule(textarea, opts) {
id: "discourse.category-hashtags.categoryHashtagTriggerRule",
}
);
return hashtagTriggerRule(textarea, opts);
return hashtagTriggerRule(opts);
}
@@ -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;
@@ -64,10 +64,6 @@ export default class DMenu extends Component {
}
}
get menuId() {
return `d-menu-${this.menuInstance.id}`;
}
get options() {
return this.menuInstance?.options ?? {};
}
@@ -519,7 +519,6 @@ export default class ChatComposer extends Component {
textarea,
hashtagAutocompleteOptions(
this.site.hashtag_configurations["chat-composer"],
this.siteSettings,
{
fixedTextareaPosition: true,
treatAsTextarea: true,
@@ -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;