mirror of
https://ghfast.top/https://github.com/discourse/discourse-ai.git
synced 2026-07-16 11:36:23 +08:00
This update fixes an issue where the AI user preferences tab was not appearing unless `SiteSetting.ai_helper_enabled` was `true`. This is because we previously checked for it's presence when user preferences only had a single setting related to Helper. However, since then, we've also added search discoveries setting there too. As such, we don't want it to depend on Helper. We also sneak in this update a modernization of converting the preferences template from `.hbs` to `.gjs`.
40 lines
1.3 KiB
Text
40 lines
1.3 KiB
Text
import { get } from "@ember/helper";
|
|
import RouteTemplate from "ember-route-template";
|
|
import { eq } from "truth-helpers";
|
|
import PreferenceCheckbox from "discourse/components/preference-checkbox";
|
|
import SaveControls from "discourse/components/save-controls";
|
|
import { i18n } from "discourse-i18n";
|
|
|
|
export default RouteTemplate(
|
|
<template>
|
|
<div class="ai-user-preferences">
|
|
<legend class="control-label">{{i18n "discourse_ai.title"}}</legend>
|
|
|
|
{{#each @controller.booleanSettings as |setting|}}
|
|
{{#if setting.isIncluded}}
|
|
<div class="control-group ai-setting">
|
|
<PreferenceCheckbox
|
|
@labelKey={{setting.label}}
|
|
@checked={{get @controller.model.user_option setting.key}}
|
|
data-setting-name={{setting.settingName}}
|
|
class="pref-{{setting.settingName}}"
|
|
/>
|
|
</div>
|
|
{{/if}}
|
|
{{/each}}
|
|
|
|
{{#if (eq @controller.userSettingAttributes.length 0)}}
|
|
{{i18n "discourse_ai.user_preferences.empty"}}
|
|
{{/if}}
|
|
|
|
{{#unless (eq @controller.userSettingAttributes.length 0)}}
|
|
<SaveControls
|
|
@id="user_ai_preference_save"
|
|
@model={{@controller.model}}
|
|
@action={{@controller.save}}
|
|
@saved={{@controller.saved}}
|
|
/>
|
|
{{/unless}}
|
|
</div>
|
|
</template>
|
|
);
|