FEATURE: added ability for user to selected watched categories in wizard
Dieser Commit ist enthalten in:
Ursprung
b196acf151
Commit
f4a9cf86f2
7 geänderte Dateien mit 68 neuen und 22 gelöschten Zeilen
|
@ -12,6 +12,7 @@ export default Component.extend(UndoChanges, {
|
|||
visible: computed('currentActionId', function() { return this.action.id === this.currentActionId }),
|
||||
createTopic: equal('action.type', 'create_topic'),
|
||||
updateProfile: equal('action.type', 'update_profile'),
|
||||
watchCategories: equal('action.type', 'watch_categories'),
|
||||
sendMessage: equal('action.type', 'send_message'),
|
||||
openComposer: equal('action.type', 'open_composer'),
|
||||
sendToApi: equal('action.type', 'send_to_api'),
|
||||
|
|
|
@ -141,6 +141,10 @@ const action = {
|
|||
profile_updates: null,
|
||||
custom_fields: null
|
||||
},
|
||||
watch_categories: {
|
||||
category: null,
|
||||
mute_remainder: null
|
||||
},
|
||||
add_to_group: {
|
||||
group: null
|
||||
},
|
||||
|
@ -158,6 +162,7 @@ const action = {
|
|||
'recipient',
|
||||
'profile_updates',
|
||||
'group',
|
||||
'mute_remainder',
|
||||
'url'
|
||||
],
|
||||
advanced: [
|
||||
|
|
|
@ -283,6 +283,29 @@
|
|||
</div>
|
||||
{{/if}}
|
||||
|
||||
{{#if watchCategories}}
|
||||
<div class="setting">
|
||||
<div class="setting-label">
|
||||
<label>{{i18n "admin.wizard.action.watch_categories.mute_remainder"}}</label>
|
||||
</div>
|
||||
|
||||
<div class="setting-value">
|
||||
{{wizard-mapper
|
||||
inputs=action.mute_remainder
|
||||
property='mute_remainder'
|
||||
onUpdate=(action 'mappedFieldUpdated')
|
||||
options=(hash
|
||||
context='action'
|
||||
wizardFieldSelection=true
|
||||
userFieldSelection='key,value'
|
||||
groupSelection='key,value'
|
||||
categorySelection='key,value'
|
||||
userSelection='key,value'
|
||||
)}}
|
||||
</div>
|
||||
</div>
|
||||
{{/if}}
|
||||
|
||||
{{#if showAdvanced}}
|
||||
{{wizard-advanced-toggle showAdvanced=action.showAdvanced}}
|
||||
|
||||
|
|
|
@ -208,6 +208,9 @@ en:
|
|||
label: "Update Profile"
|
||||
setting: "Fields"
|
||||
key: "field"
|
||||
watch_categories:
|
||||
label: "Watch Categories"
|
||||
mute_remainder: "Mute Remainder"
|
||||
post_builder:
|
||||
checkbox: "Post Builder"
|
||||
label: "Builder"
|
||||
|
|
|
@ -122,6 +122,7 @@ class CustomWizard::AdminWizardController < CustomWizard::AdminController
|
|||
custom_fields: mapped_params,
|
||||
required: mapped_params,
|
||||
recipient: mapped_params,
|
||||
mute_remainder: mapped_params,
|
||||
profile_updates: mapped_params,
|
||||
group: mapped_params,
|
||||
url: mapped_params
|
||||
|
|
|
@ -133,6 +133,18 @@ class CustomWizard::Action
|
|||
end
|
||||
end
|
||||
|
||||
def watch_categories
|
||||
key, watched_categories = data.first
|
||||
mute_remainder = data.values[1]
|
||||
Category.all.each do |category|
|
||||
if watched_categories.include?(category.id.to_s)
|
||||
CategoryUser.set_notification_level_for_category(user, CategoryUser.notification_levels[:watching], category.id)
|
||||
elsif mute_remainder
|
||||
CategoryUser.set_notification_level_for_category(user, CategoryUser.notification_levels[:muted], category.id)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def send_to_api
|
||||
api_body = nil
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@ class CustomWizard::Mapper
|
|||
|
||||
USER_FIELDS = ['name', 'username', 'email', 'date_of_birth', 'title', 'locale', 'trust_level']
|
||||
PROFILE_FIELDS = ['location', 'website', 'bio_raw']
|
||||
CATEGORY_NOTIFICATION_LEVELS = ['regular','watching', 'tracking', 'watching_first_post','muted']
|
||||
|
||||
def self.user_fields
|
||||
USER_FIELDS + PROFILE_FIELDS
|
||||
|
|
Laden …
In neuem Issue referenzieren