mirror of
https://github.com/discourse/discourse-signatures.git
synced 2025-12-13 02:13:32 +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)
|
User.register_custom_field_type('signature_raw', :text)
|
||||||
|
|
||||||
register_editable_user_custom_field [:see_signatures, :signature_url, :signature_raw]
|
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) {
|
add_to_serializer(:post, :user_signature) {
|
||||||
if SiteSetting.signatures_advanced_mode then
|
if SiteSetting.signatures_advanced_mode then
|
||||||
@ -28,15 +30,6 @@ after_initialize do
|
|||||||
end
|
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
|
# This is the code responsible for cooking a new advanced mode sig on user update
|
||||||
DiscourseEvent.on(:user_updated) do |user|
|
DiscourseEvent.on(:user_updated) do |user|
|
||||||
if SiteSetting.signatures_enabled? && SiteSetting.signatures_advanced_mode && user.custom_fields['signature_raw']
|
if SiteSetting.signatures_enabled? && SiteSetting.signatures_advanced_mode && user.custom_fields['signature_raw']
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user