0
0
Fork 1
Spiegel von https://github.com/paviliondev/discourse-custom-wizard.git synchronisiert 2024-09-19 23:31:11 +02:00

update profile update action fields

Dieser Commit ist enthalten in:
Angus McLeod 2020-04-10 18:51:01 +10:00
Ursprung 3c8dc540c8
Commit ae87e383d2
4 geänderte Dateien mit 18 neuen und 4 gelöschten Zeilen

Datei anzeigen

@ -82,9 +82,18 @@ export default Component.extend({
const controller = getOwner(this).lookup('controller:admin-wizard');
let content = controller[`${activeType}s`];
// you can't select the current field in the field context
if (activeType === 'wizardField' && this.options.context === 'field') {
const currentField = controller.currentField;
content = content.filter(field => field.id !== currentField.id);
content = content.filter(field => field.id !== controller.currentField.id);
}
// updating usernames or emails via actions is not supported
if (activeType === 'userField' &&
this.options.context === 'action' &&
this.inputType === 'association' &&
this.selectorType === 'key') {
content = content.filter(userField => ['username','email'].indexOf(userField.id) === -1);
}
return content;

Datei anzeigen

@ -32,6 +32,7 @@ function camelCase(string) {
const userProperties = [
'name',
'username',
'email',
'avatar',
'date_of_birth',

Datei anzeigen

@ -274,8 +274,12 @@ class CustomWizard::Action
end
end
def profile_excluded_fields
['username', 'email'].freeze
end
def allowed_profile_fields
CustomWizard::Mapper.user_fields +
CustomWizard::Mapper.user_fields.select { |f| profile_excluded_fields.exclude?(f) } +
profile_url_fields +
['avatar']
end

Datei anzeigen

@ -1,7 +1,7 @@
class CustomWizard::Mapper
attr_accessor :inputs, :data, :user
USER_FIELDS = ['name', 'email', 'date_of_birth', 'title', 'locale', 'trust_level']
USER_FIELDS = ['name', 'username', 'email', 'date_of_birth', 'title', 'locale', 'trust_level']
PROFILE_FIELDS = ['location', 'website', 'bio_raw']
def self.user_fields