Locations Plugin

I cannot repro that, please provide steps.

This does it for meā€¦

  1. Create a location enabled category (all three location settings ticked but I donā€™t know if this makes a difference)
  2. Create a new topic in the category and add a location to it. The topic displays the Show Map button and if you click it thereā€™s a marker at the correct location.
  3. Create a second new topic in the category but donā€™t add a location to it. The topic still displays the Show Map button but if you click on it thereā€™s no marker, just a blank map.
  4. I created a third topic with no location and got the same as (3)
  5. I removed the location from the first topic. The other topics still showed the Show Map button/blank map.
  6. With the location removed from the first topic I created a fourth topic, again not adding a location. The fourth topic still had a Show Map button leading to a blank map.
  7. In a different location enabled category I added a new topic without defining a locaton. This topic also had a Show Map button with blank map.
  8. In a different non-location enabled category (no location settings ticked) I created a new topic, which didnā€™t have the option to add a location, but after saving the topic it had gained a Show Map button leading to a blank map. As this topic is in a non-location enabled category thereā€™s no way to edit it to remove the location.

Itā€™s like Iā€™ve got a sticky topic location marker stuck to me! Hopefully you can replicate this.

1 Like

Iā€™ll take a look when I have time.

I would also be interested if anyone else can replicate this ā€¦

1 Like

I simply canā€™t repro this, the first has a location:

this is my second topic, without:

Note that my user has a location associated with it (which is independent).

This is a development instance, Iā€™ve also checked this in Production.

Are you on tests-passed?

Could you describe in detail how you created the first location?

If you clear the cache of the browser for this website, can you recreate the problem?

As far as I know Iā€™m on tests-passed because Iā€™ve never changed the default.

My user had a location associated with it, but I removed it to see if it affected anything. All the tests documented in my previous post (and below) were without a location set for my user.

When it was set, my user location was set by lat/long to get a more accurate location, but the topic tests were either set by finding my location - City=ā€œLayton, Blackpoolā€, blank state and ā€œUnited Kingdomā€ and choosing the location with FY3 8JL postcode, or by an approximate set of lat/long coordinates - 53.5N 3.01W I thinkā€¦somewhere near Little Crosby because I mistyped the latitude! When displayed the locations were definitely showing the topic locations and not the previously defined more exact location.

Iā€™ve cleared the cache, cookies and site data for my Discourse sub-domain and after logging back in Iā€™m still creating topics with the blank map. I then tried a different browser that I donā€™t think Iā€™ve ever accessed my Discourse instance with and that also created new topics with the Show Map button and a blank map.

I then created a new account and didnā€™t set a user location for it. I created a topic with a location which worked as expected (Map with marker) and then created a second topic which didnā€™t get a stored location. This replicates what youā€™re seeing.

I created a second new user and added a user location to the profile. When I created a new topic the topic location defaulted to the user location (is it supposed to do this?) and the topic location was correctly stored. I then created a second topic, clicked the X against the default location and the topic was stored without a location.

So it looks like itā€™s something weird thatā€™s happened to my account. Iā€™ll do some more digging after lunch to see if I can find a way to reset it.

1 Like

Thatā€™s super weird. If you have access to rails console, can you also please look at:

TopicCustomField.last(10)

And see if there are locations for the Topics you are seeing issues with in the back end.

1 Like

This is a topic that shows the map button but no marker on the map. I assume this is saying the topic has a location but the location is ā€˜nullā€™ (or equivalent)?

#<TopicCustomField:0x00007fae3f9838f8
  id: 62820,
  topic_id: 71985,
  name: "location",
  value: "{\"geo_location\":\"{}\"}",
  created_at: Thu, 20 Jul 2023 09:55:11.188231000 UTC +00:00,
  updated_at: Thu, 20 Jul 2023 09:55:11.188231000 UTC +00:00>,
#<TopicCustomField:0x00007fae3f983b78
  id: 62821,
  topic_id: 71985,
  name: "has_geo_location",
  value: "t",
  created_at: Thu, 20 Jul 2023 09:55:11.188676000 UTC +00:00,
  updated_at: Thu, 20 Jul 2023 09:55:11.188676000 UTC +00:00>,

Edit: Just digging furtherā€¦in user_custom_fields my account has geo_location = "{}"

Thatā€™s useful. Thanks.

Away from comp but can you try adding a location to that topic then hitting the clear button?

Adding a location then clearing the location removes the Show Map button and blank map. After clearing TopicCustomField isā€¦

 #<TopicCustomField:0x00007fe540801600
  id: 62834,
  topic_id: 71985,
  name: "has_geo_location",
  value: "f",
  created_at: Thu, 20 Jul 2023 14:48:16.645528000 UTC +00:00,
  updated_at: Thu, 20 Jul 2023 14:48:16.645528000 UTC +00:00>,
 #<TopicCustomField:0x00007fe5393c3d60
  id: 62835,
  topic_id: 71985,
  name: "location",
  value: "{}",
  created_at: Thu, 20 Jul 2023 14:48:16.645876000 UTC +00:00,
  updated_at: Thu, 20 Jul 2023 14:48:16.645876000 UTC +00:00>]
1 Like

Ok so thatā€™s the workaround for now.

If I can repro it Iā€™ll be in a better place to fix it.

Let me know if it keeps happening.

1 Like

It removes the button from the affected topic, but each new post I create still has the button with blank map (null location)

Feel free to PM me your entire Locations settings

I have a thoughtā€¦I was just looking at the location settings again and ā€˜location topic defaultā€™ was set to ā€˜userā€™. I set that to none and now I can create a topic without a location, or select to add a location if I want one. Iā€™m not sure why Iā€™d missed this setting before.

Iā€™m wondering whether when that option is set to ā€˜userā€™ the code checks to see if a user has a geo_location custom field. If a user has never set a location then thereā€™s no custom value and nothing happens, but if it finds the field itā€™s added to the topic. When youā€™ve set a location and removed it, the geo_location field exists but is set to null. The null value gets applied to the topic which means it gets the button but a blank map.

Iā€™m also wondering whether the users with null locations and/or topics with no locations are whatā€™s causing the world map to do odd things because it doesnā€™t expect to see null location values? I think Iā€™ve removed all the locations from the topics where it was probably set to null and the world map is working better, e.g. no scrolling problems so far.

1 Like

Hello!

We just did an upgrade of our forum, and we are seeing some bugs here and there with the Locations Plugin.

Sometimes, looking at the map inside a discussion with geolocation show a map without the marker. Refreshing the page (shift+maj+r) seems solve the issue.

Showing a map with multiple markers inside a category also show a map without any marker sometimes. Refreshing the page (shit+maj+r) shows some markers, but only 30 of them, instead of hundreds.

Switching between direct URLs to different maps filtered by categories will not update the map. markers from the previous category are shown (with the same bug above, only showing 30 markers instead of hundreds).

I can get all markers to show up at /map (to our maximum of 1700 markers specified in Settings). Itā€™s just not working when looking at the map for a specific category.

Everything is up to date. Our last update before that was 3 months ago and everything was fine :slight_smile:

If it can help, here is the forum: https://forum.agoramtl.com/

Thank you for your work on this plugin.

1 Like

Thanks for the report. Iā€™ll take a look at this in time. Please bare with as this appears to be an intermittent non-critical issue and it is a free plugin. PR for fix welcome.

2 Likes

I understand perfectly :slight_smile: Iā€™m very grateful for your work on this plugin.

I donā€™t know if itā€™s related, but Iā€™m seeing those errors in our logs, seems related to the map?

ActionView::Template::Error (No route matches {:action=>"map_feed", :controller=>"list"})
app/views/list/list.erb:134
app/views/list/list.erb:132
lib/topic_list_responder.rb:15:in `block (2 levels) in respond_with_list'
lib/topic_list_responder.rb:8:in `respond_with_list'
app/controllers/list_controller.rb:110:in `block (2 levels) in <class:ListController>'
app/controllers/application_controller.rb:420:in `block in with_resolved_locale'
app/controllers/application_controller.rb:420:in `with_resolved_locale'
lib/middleware/omniauth_bypass_middleware.rb:74:in `call'
lib/content_security_policy/middleware.rb:12:in `call'
lib/middleware/anonymous_cache.rb:387:in `call'
lib/middleware/gtm_script_nonce_injector.rb:10:in `call'
config/initializers/008-rack-cors.rb:24:in `call'
config/initializers/100-quiet_logger.rb:20:in `call'
config/initializers/100-silence_logger.rb:29:in `call'
lib/middleware/enforce_hostname.rb:24:in `call'
lib/middleware/request_tracker.rb:228:in `call'

EDIT: Yes, this message is appearing when accessing the map and the forum is encountering an error.

1 Like

Thatā€™s useful info, thank you.

2 Likes

Is this policy still in place?

1 Like

No. This is a free plugin so no longer any guarantees on compatibility. Best efforts from us and we expect the community to start to contribute more.

That said, compatibility is tracked and dashboarded at:

So please check there before upgrading: I have been making a particular effort to add test cases for a while.

In reality big breaks will get looked at fairly soon.

2 Likes

Thatā€™s good to know, thanks!