1
0
Fork 0

DEV: Add logic to append tag if user allowed

Dieser Commit ist enthalten in:
jumagura 2023-09-21 22:32:31 -04:00
Ursprung a518955423
Commit c29c3b084e

Datei anzeigen

@ -104,6 +104,7 @@ class CustomWizard::Action
end
params = basic_topic_params
params.delete(:tags) unless user_can_tag
targets = CustomWizard::Mapper.new(
inputs: action['recipient'],
@ -610,6 +611,10 @@ class CustomWizard::Action
user: user
).perform
if tags = action_tags
params[:tags] = tags
end
params[:raw] = action['post_builder'] ?
mapper.interpolate(
action['post_template'],
@ -632,10 +637,6 @@ class CustomWizard::Action
params[:category] = category
end
if tags = action_tags
params[:tags] = tags
end
if public_topic_fields.any?
public_topic_fields.each do |field|
unless action[field].nil? || action[field] == ""
@ -837,4 +838,9 @@ class CustomWizard::Action
@log.join('; ')
)
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