From 36796b4deb76728a88c7015cbf00533099d7d19e Mon Sep 17 00:00:00 2001 From: merefield Date: Thu, 29 Dec 2022 17:31:59 +0000 Subject: [PATCH 1/3] FIX: user location not saving --- plugin.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugin.rb b/plugin.rb index 65d36fc7..72e67ca4 100644 --- a/plugin.rb +++ b/plugin.rb @@ -91,7 +91,8 @@ class SiteSettings::TypeSupervisor add_to_serializer(:topic_list_item, :include_location?) { object.location.present? } User.register_custom_field_type('geo_location', :json) - register_editable_user_custom_field :geo_location if defined? register_editable_user_custom_field + # register_editable_user_custom_field :geo_location if defined? register_editable_user_custom_field + register_editable_user_custom_field geo_location: {} if defined? register_editable_user_custom_field add_to_serializer(:user, :geo_location, false) { object.custom_fields['geo_location'] } add_to_serializer(:user_card, :geo_location, false) { object.custom_fields['geo_location'] } add_to_serializer(:user_card, :include_geo_location?) do From 1c9e8cdb49fb417aa4deb0f0bf894d9cec37d3e6 Mon Sep 17 00:00:00 2001 From: merefield Date: Thu, 29 Dec 2022 17:58:12 +0000 Subject: [PATCH 2/3] another attempt --- plugin.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugin.rb b/plugin.rb index 72e67ca4..9db2c7e4 100644 --- a/plugin.rb +++ b/plugin.rb @@ -91,8 +91,8 @@ class SiteSettings::TypeSupervisor add_to_serializer(:topic_list_item, :include_location?) { object.location.present? } User.register_custom_field_type('geo_location', :json) - # register_editable_user_custom_field :geo_location if defined? register_editable_user_custom_field - register_editable_user_custom_field geo_location: {} if defined? register_editable_user_custom_field + register_editable_user_custom_field [:geo_location, geo_location: {}] if defined? register_editable_user_custom_field + # register_editable_user_custom_field geo_location: {} if defined? register_editable_user_custom_field add_to_serializer(:user, :geo_location, false) { object.custom_fields['geo_location'] } add_to_serializer(:user_card, :geo_location, false) { object.custom_fields['geo_location'] } add_to_serializer(:user_card, :include_geo_location?) do From 2cb4b95afe664161279d9c1b0d621e17a8d15e62 Mon Sep 17 00:00:00 2001 From: merefield Date: Thu, 29 Dec 2022 18:42:18 +0000 Subject: [PATCH 3/3] Clean up and bump patch --- plugin.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/plugin.rb b/plugin.rb index 9db2c7e4..c5c492a4 100644 --- a/plugin.rb +++ b/plugin.rb @@ -1,6 +1,6 @@ # name: discourse-locations # about: Tools for handling locations in Discourse -# version: 6.2.7 +# version: 6.2.8 # authors: Angus McLeod, Robert Barrow # contact_emails: development@pavilion.tech # url: https://github.com/angusmcleod/discourse-locations @@ -92,7 +92,6 @@ class SiteSettings::TypeSupervisor User.register_custom_field_type('geo_location', :json) register_editable_user_custom_field [:geo_location, geo_location: {}] if defined? register_editable_user_custom_field - # register_editable_user_custom_field geo_location: {} if defined? register_editable_user_custom_field add_to_serializer(:user, :geo_location, false) { object.custom_fields['geo_location'] } add_to_serializer(:user_card, :geo_location, false) { object.custom_fields['geo_location'] } add_to_serializer(:user_card, :include_geo_location?) do