mirror of
https://gh.wpcy.net/https://github.com/discourse/discourse.git
synced 2026-05-26 09:28:35 +08:00
We want to allow configuring fields that are both optional and editable to not show up in the signup form. - Fields that are optional but not editable need to be on the signup form, or they can never be filled in. - Fields that are not optional need to be on the signup form, or you can never sign up.
21 lines
498 B
JavaScript
Vendored
21 lines
498 B
JavaScript
Vendored
import { service } from "@ember/service";
|
|
import DiscourseRoute from "discourse/routes/discourse";
|
|
import { i18n } from "discourse-i18n";
|
|
|
|
const DEFAULT_VALUES = {
|
|
field_type: "text",
|
|
requirement: "optional",
|
|
show_on_signup: true,
|
|
};
|
|
|
|
export default class AdminUserFieldsNewRoute extends DiscourseRoute {
|
|
@service store;
|
|
|
|
async model() {
|
|
return this.store.createRecord("user-field", { ...DEFAULT_VALUES });
|
|
}
|
|
|
|
titleToken() {
|
|
return i18n("admin.user_fields.new_header");
|
|
}
|
|
}
|