特定の名前が含まれるグループ名を非表示にするグループ設定

承知いたしました。これらの関数を自分で作成する必要があることは理解していますが、これはJinja2のように便利な組み込み機能があるわけではありません。

では、これらのHandlebars関数はプラグインのどこで作成すればよいのでしょうか?こちらで多くの例を見つけました: Repository search results · GitHub

しかし、このフォルダ構造には明確なパターンが見られません。discourse-group-custom-fields/assets/javascripts/discourse/app/helpers/contains.js に独自の関数を作成しましたが、discourse-group-custom-fields/assets/javascripts/discourse/connectors/group-edit/field-container.hbs で使用しようとすると、Uncaught Error: Attempted to resolve "contains", which was expected to be a component, but nothing was found. というエラーが発生します。明らかに、これはDiscourseが探しているパスではないか、あるいは何か間違っているのでしょう。

import RawHandlebars from "discourse-common/lib/raw-handlebars";
import { htmlSafe } from "@ember/template";
import { rawConnectorsFor } from "discourse/lib/plugin-connectors";

//RawHandlebars.registerHelper("contains", function (args) {
//  const connectors = rawConnectorsFor(args.hash.name);
//  if (connectors.length) {
//    const output = connectors.map((c) => c.template({ context: this }));
//    return htmlSafe(output.join(""));
//  }
//});


Handlebars.registerHelper('contains', function(needle, haystack, options) {
     needle = Handlebars.escapeExpression(needle);
     haystack = Handlebars.escapeExpression(haystack);
     return (haystack.indexOf(needle) > -1) ? options.fn(this) : options.inverse(this);
});

以下のトピックでは、イニシャライザディレクトリにes6拡張子で配置することが考えられると示唆されています。

そこで、contains.js をそのディレクトリに移動し、拡張子を .e6 にしましたが、同じエラーが発生しました。何か助言やドキュメントがあれば幸いです :slight_smile: