Commits vergleichen
4 Commits
main
...
add-taggin
Autor | SHA1 | Datum | |
---|---|---|---|
|
eeb99d1507 | ||
|
adfffb4d08 | ||
|
c29c3b084e | ||
|
a518955423 |
3 geänderte Dateien mit 33 neuen und 26 gelöschten Zeilen
|
@ -107,6 +107,7 @@ const action = {
|
||||||
post: null,
|
post: null,
|
||||||
post_builder: null,
|
post_builder: null,
|
||||||
post_template: null,
|
post_template: null,
|
||||||
|
tags: null,
|
||||||
skip_redirect: null,
|
skip_redirect: null,
|
||||||
custom_fields: null,
|
custom_fields: null,
|
||||||
required: null,
|
required: null,
|
||||||
|
|
|
@ -84,6 +84,28 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="setting full field-mapper-setting">
|
||||||
|
<div class="setting-label">
|
||||||
|
<label>{{i18n "admin.wizard.action.create_topic.tags"}}</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="setting-value">
|
||||||
|
{{wizard-mapper
|
||||||
|
inputs=this.action.tags
|
||||||
|
property="tags"
|
||||||
|
onUpdate=(action "mappedFieldUpdated")
|
||||||
|
options=(hash
|
||||||
|
tagSelection="output"
|
||||||
|
outputDefaultSelection="tag"
|
||||||
|
listSelection="output"
|
||||||
|
wizardFieldSelection=true
|
||||||
|
userFieldSelection="key,value"
|
||||||
|
context="action"
|
||||||
|
)
|
||||||
|
}}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
{{#if this.action.post_builder}}
|
{{#if this.action.post_builder}}
|
||||||
<div class="setting full">
|
<div class="setting full">
|
||||||
<div class="setting-label">
|
<div class="setting-label">
|
||||||
|
@ -124,28 +146,6 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="setting full field-mapper-setting">
|
|
||||||
<div class="setting-label">
|
|
||||||
<label>{{i18n "admin.wizard.action.create_topic.tags"}}</label>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="setting-value">
|
|
||||||
{{wizard-mapper
|
|
||||||
inputs=this.action.tags
|
|
||||||
property="tags"
|
|
||||||
onUpdate=(action "mappedFieldUpdated")
|
|
||||||
options=(hash
|
|
||||||
tagSelection="output"
|
|
||||||
outputDefaultSelection="tag"
|
|
||||||
listSelection="output"
|
|
||||||
wizardFieldSelection=true
|
|
||||||
userFieldSelection="key,value"
|
|
||||||
context="action"
|
|
||||||
)
|
|
||||||
}}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="setting full field-mapper-setting">
|
<div class="setting full field-mapper-setting">
|
||||||
<div class="setting-label">
|
<div class="setting-label">
|
||||||
<label>{{i18n "admin.wizard.action.create_topic.visible"}}</label>
|
<label>{{i18n "admin.wizard.action.create_topic.visible"}}</label>
|
||||||
|
|
|
@ -104,6 +104,7 @@ class CustomWizard::Action
|
||||||
end
|
end
|
||||||
|
|
||||||
params = basic_topic_params
|
params = basic_topic_params
|
||||||
|
params.delete(:tags) unless user_can_tag
|
||||||
|
|
||||||
targets = CustomWizard::Mapper.new(
|
targets = CustomWizard::Mapper.new(
|
||||||
inputs: action['recipient'],
|
inputs: action['recipient'],
|
||||||
|
@ -610,6 +611,10 @@ class CustomWizard::Action
|
||||||
user: user
|
user: user
|
||||||
).perform
|
).perform
|
||||||
|
|
||||||
|
if tags = action_tags
|
||||||
|
params[:tags] = tags
|
||||||
|
end
|
||||||
|
|
||||||
params[:raw] = action['post_builder'] ?
|
params[:raw] = action['post_builder'] ?
|
||||||
mapper.interpolate(
|
mapper.interpolate(
|
||||||
action['post_template'],
|
action['post_template'],
|
||||||
|
@ -632,10 +637,6 @@ class CustomWizard::Action
|
||||||
params[:category] = category
|
params[:category] = category
|
||||||
end
|
end
|
||||||
|
|
||||||
if tags = action_tags
|
|
||||||
params[:tags] = tags
|
|
||||||
end
|
|
||||||
|
|
||||||
if public_topic_fields.any?
|
if public_topic_fields.any?
|
||||||
public_topic_fields.each do |field|
|
public_topic_fields.each do |field|
|
||||||
unless action[field].nil? || action[field] == ""
|
unless action[field].nil? || action[field] == ""
|
||||||
|
@ -837,4 +838,9 @@ class CustomWizard::Action
|
||||||
@log.join('; ')
|
@log.join('; ')
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
def user_can_tag
|
||||||
|
allowed_groups =
|
||||||
|
SiteSetting.pm_tags_allowed_for_groups.split('|').map(&:to_i)
|
||||||
|
user.groups.pluck(:id).any? { |group| allowed_groups.include?(group) }
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Laden …
In neuem Issue referenzieren