mirror of
https://github.com/discourse/discourse-signatures.git
synced 2025-12-12 18:03:31 +00:00
FIX: Only serialize user custom fields specific to this plugin
This commit is contained in:
parent
e4ea890f77
commit
2766a4d01d
11
plugin.rb
11
plugin.rb
@ -19,6 +19,8 @@ after_initialize do
|
||||
User.register_custom_field_type('signature_raw', :text)
|
||||
|
||||
register_editable_user_custom_field [:see_signatures, :signature_url, :signature_raw]
|
||||
whitelist_public_user_custom_field :signature_cooked
|
||||
whitelist_public_user_custom_field :signature_url
|
||||
|
||||
add_to_serializer(:post, :user_signature) {
|
||||
if SiteSetting.signatures_advanced_mode then
|
||||
@ -28,15 +30,6 @@ after_initialize do
|
||||
end
|
||||
}
|
||||
|
||||
# I guess this should be the default @ discourse. PR maybe?
|
||||
add_to_serializer(:user, :custom_fields) {
|
||||
if object.custom_fields == nil then
|
||||
{}
|
||||
else
|
||||
object.custom_fields
|
||||
end
|
||||
}
|
||||
|
||||
# This is the code responsible for cooking a new advanced mode sig on user update
|
||||
DiscourseEvent.on(:user_updated) do |user|
|
||||
if SiteSetting.signatures_enabled? && SiteSetting.signatures_advanced_mode && user.custom_fields['signature_raw']
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user