Locations 插件 🌍

:information_source: 摘要 一款 Discourse 插件,可为主题和用户添加结构化和地理编码的位置信息,并支持基于地图的探索功能
:hammer_and_wrench: 仓库链接 https://github.com/merefield/discourse-locations
:open_book: 安装指南 如何在 Discourse 中安装插件
:heart: 赞助支持 请考虑成为我开源工作的长期赞助者,选择适合您或您所在组织资源和需求的赞助级别,以确保该插件获得应有的维护,并能在未来继续为您的站点提供服务。

喜欢这个插件吗?请在 GitHub 上给它点个 :star: 吧! :pray:

功能特性

Discourse Locations 提供了完整的位置存储、地理编码和地图基础功能。可选的 Pro 扩展版增加了高级探索、自动化和用户地图展示功能,但它依赖于基础插件。

功能 基础插件 Pro 扩展版
结构化主题位置和可配置的输入字段 :white_check_mark:
可选或必需的地理编码,支持多个提供商 :white_check_mark:
分类和全站主题地图视图 :white_check_mark:
帖子、个人资料、名片和目录地图上的用户位置 :white_check_mark:
支持本地名称和用户名搜索的 Leaflet 用户地图 :white_check_mark:
可配置的位置标签、旗帜、地图标记、聚类和瓦片 :white_check_mark:
新主题默认设置为当前用户的位置 :white_check_mark:
基于 IP 的自动化用户位置估算 :white_check_mark: 独家功能
基于当前用户位置的附近主题探索 :white_check_mark: 独家功能
可选的位置感知 Discourse Chatbot 工具 :white_check_mark: 独家功能
权限感知的用户地图分组和结果限制过滤器 :white_check_mark: 独家功能
交互式 WebGL 用户地图地球仪 :white_check_mark: 独家功能
空闲地球仪屏幕保护程序 :white_check_mark: 独家功能

安装 Pro 扩展版会将独家功能添加到基础功能中;它不会替代基础插件。

配置

基础插件的设置使用 location_ 前缀,用于控制主题位置、地理编码、地图显示、用户位置以及标准用户地图。

有用的文档:

隐私与存储

用户可以选择是否保存个人资料位置。完整的可编辑主题和用户位置保留在基础插件拥有的自定义字段中,而由插件拥有的投影表则支持空间查询和地图排序。

原始位置自定义字段不会全局公开。主题、个人资料、名片、帖子和目录响应仅公开该界面所需的位置数据,并遵守 Discourse 的个人资料和群组可见性规则。

Pro 扩展版

Discourse Locations Pro 是一款可选扩展,面向 GitHub 赞助者开放,以感谢他们对持续开发的支持。个人和独立社区赞助者可以从 每月 7 美元的青铜层级 获得访问权限;企业和机构必须以 每月 40 美元的白银层级 或更高级别进行赞助。符合条件的赞助者将获得私有仓库的安装说明。

Pro 扩展版增加了自动化 IP 查找、附近主题、聊天机器人工具、增强的用户地图过滤器、交互式地球仪以及地球仪屏幕保护程序。每个可选的自动化或集成功能在配置之前均保持禁用状态,并且 Pro 主设置可以在不禁用基础插件的情况下禁用所有 Pro 行为。

在 GitHub 上赞助以获取 Locations Pro

110 个赞
OpenStreet maps embedding
Learn how to build Discourse plugins by helping me
Job exception: undefined method `name' for
A plugin to "check" a portion of a post before it can be posted
Suitability of Discourse for Discussion on Page
Locations dropdown (Google maybe?)
Enable tagging only in some categories
My 2nd Discourse forum, 2 years after the first one
How to add custom fields to models
2020: The Year in Review
Angus' Events Plugin :calendar:
Listing users by group - ERROR: missing FROM-clause entry for table "groups"
2021: The Year in Review
A "Votes" option for the top menu in main page
Forum Completely Broken 2.8.5
It's Time We Talked About Tags
Who use event plugin in their discourse community?
Automated map
Configure plugin Custom Wizard for autoposting
2022: The Year in Review
Show a modal dialog after clicking toolbar button via a plugin
Must have plugins and components for Discourse?
Getting a 500 error on the mobile for bookmark and some category pages
Get aggregate user location data from IP addresses?
Could a List of Recommended Topics Be Added to the Top Menu?
2023: The Year in Review
¿Cómo encuentro a una persona en Discourse?
Angus' Events Plugin :calendar:
Usercard Redesign Experiment
Is it possible to add a location and display them on a map?
Generating an ical to use with a custom map
Remove overriding of cmd/ctrl-f
Locate a feature like the one shown in the photo
Discourse.fontawesome-6-upgrade needs updating
2024: The Year in Review
Migrated my old custom-built trail-journal/blog to Discourse
Newly created topic shown location based on device
Alternative post templates
What happens next?
Discourse-events 'this.router' error
请教关于MaxMind 错误日志问题
National Flags
How minimal is your forum?
Layouts Plugin
Suggestions on how I can have hundreds of small groups (e.g. streets in a town)?
Problème accès aux onglets des paramètres des catégories
Discourse Calendar and Events
Topic List Previews (legacy)
New Theme: Tag-Pages Navigation
Locations plugin modifications
Traditional multi level hierarchy vs flat discourse hierarchy
More options to filter users on users page
Project ideas for Google Summer of Code 2018
Traditional multi level hierarchy vs flat discourse hierarchy
Any way to display Location below the name in posts?
Developing with Discourse
Calendar plugin features to make it really useful for us
Learn how to build Discourse plugins by helping me
Developing
Discourse-common asset availability: difference between development and production?
2018: The Year in Review
Object instead of users due to locations plugin
Inserting a date with Paris timezone gives me Berlin
Failed building stable due to 3rd party plugin
Angus' Events Plugin :calendar:
How to make a topic filter based on current user group and topic location
2019: The Year in Review
United states map
Fig - Native Discourse client for iOS
Loading slider issues

我对这项技术还非常陌生。我已经安装了插件(我在汉堡菜单中看到了“地图”命令,并且在用户个人资料页面中有一个位置字段(已通过 Nominatim 成功进行地理编码)),但是……

我在编辑器中没有看到“添加位置”按钮。

这是我的配置:

这是编辑器窗口:

最后,这是我安装插件的方式:

hooks:
  after_code:
    - exec:
        cd: $home/plugins
        cmd:
          - git clone https://github.com/discourse/docker_manager.git
          - git clone https://github.com/discourse/discourse-math.git
          - git clone https://github.com/paviliondev/discourse-events.git
          - git clone https://github.com/paviliondev/discourse-locations.git
          - git clone https://github.com/davidtaylorhq/discourse-whos-online.git
          - git clone https://github.com/discourse/twitter-profile-link.git
          - git clone https://github.com/discourse/discourse-tooltips.git

我尝试将 locale 设置为 en,结果相同。

2 个赞

好吧,更正一下:该插件在用户资料中按预期工作。

根据地图显示,我已经“去世”了,因为地图上的定位点位于蒙特利尔最大的公墓中央:

13 个赞

您希望使用的每个类别也必须启用该功能。

6 个赞

谢谢!已经生效了。

顺便提一下,复选框默认是“开启”的,但!你需要先显示设置面板,取消勾选后再重新勾选,该功能才能真正生效。

4 个赞

很高兴它起作用了。我已经很久没使用这个插件了,所以那只是我的最佳猜测。

3 个赞

@angus 我最近注意到,当用户的个人资料中未填写位置时会出现这个问题:

不过并非所有用户都会出现此问题,我还无法完全确定其规律。

是否是因为那些删除了个人资料中位置的用户?或者是因为位置字段是空字符串(例如 “”)而不是 NULL?:thinking:

3 个赞

看起来最近的更新完全移除了用户卡片中的位置信息。

用户卡片:
user-card

用户资料:

3 个赞

这很可能是由于核心中的以下变更引起的:

5 个赞

@omarfilip @david 感谢分享见解 :+1:t2:

@angus 这个你能修改吗?

4 个赞

@david @Richie 谢谢,该插件已更新以支持此变更。

提醒一下,该插件即将与 Pavilion 其他主要插件采用相同的更新周期。这意味着它将在每月的第一周与最新的 Discourse 核心版本保持一致。关于该插件的具体细节将随后公布,但可先参考以下内容:

5 个赞

感谢迅速修复,Angus。

4 个赞

你好 @angus,已确认位置现在会显示在用户卡片上,但我们仍遇到以下问题:即使某些用户未输入位置信息,其卡片上仍会显示地图图钉和地图图标:

在完整的个人资料页面中也是如此:

4 个赞

由于 locations 插件,我无法启动 Discourse 应用。日志附在下面,如果我在 app.yml 中注释掉 locations 部分,它就能正常工作。有人能优先处理并修复这个问题吗?

另外,有没有办法只升级到该插件的“测试通过”版本(如果有的话),就像主 Discourse 应用那样?这样我们以后就不会再遇到类似的问题了。

日志
5: from /var/www/discourse/plugins/discourse-layouts/plugin.rb:49:in `block in activate!'
4: from /var/www/discourse/lib/discourse_event.rb:13:in `trigger'
3: from /usr/local/lib/ruby/2.6.0/set.rb:338:in `each'
2: from /usr/local/lib/ruby/2.6.0/set.rb:338:in `each_key'
1: from /var/www/discourse/lib/discourse_event.rb:14:in `block in trigger'
/var/www/discourse/plugins/discourse-locations/plugin.rb:234:in `block in activate!': uninitialized constant DiscourseLayouts::WidgetHelper
Did you mean?  DiscourseLayouts::WidgetSerializer (NameError)

** 不兼容的插件 **

由于插件 /var/www/discourse/plugins/discourse-locations 中的错误,您无法构建 Discourse。

请尝试移除该插件并重新构建!
I, [2020-04-25T20:32:06.399307 #1]  INFO -- : gem install icalendar -v 2.4.1 -i /var/www/discourse/plugins/discourse-events/gems/2.6.5 --no-document --ignore-dependencies --no-user-install
注意!iCalendar 2.0 与 1.x 版本不兼容。请参阅 README 了解新语法。

注意!icalendar 2.2.0 默认切换到非严格解析。如果您依赖严格解析,请参阅 README 了解如何启用它。

ActiveSupport 是 TimeWithZone 支持所必需的,但对于一般使用并非必需。
成功安装 icalendar-2.4.1
已安装 1 个 gem
gem install geocoder -v 1.4.4 -i /var/www/discourse/plugins/discourse-locations/gems/2.6.5 --no-document --ignore-dependencies --no-user-install
成功安装 geocoder-1.4.4
已安装 1 个 gem

I, [2020-04-25T20:32:06.400580 #1]  INFO -- : 终止异步进程
I, [2020-04-25T20:32:06.400773 #1]  INFO -- : 向 HOME=/var/lib/postgresql USER=postgres exec chpst -u postgres:postgres:ssl-cert -U postgres:postgres:ssl-cert /usr/lib/postgresql/10/bin/postmaster -D /etc/postgresql/10/main pid: 50 发送 INT 信号
I, [2020-04-25T20:32:06.400979 #1]  INFO -- : 向 exec chpst -u redis -U redis /usr/bin/redis-server /etc/redis/redis.conf pid: 167 发送 TERM 信号
167:signal-handler (1587846726) 收到 SIGTERM 信号,计划关闭...
2020-04-25 20:32:06.401 UTC [50] LOG:  收到快速关闭请求
2020-04-25 20:32:06.403 UTC [50] LOG:  中止所有活动事务
2020-04-25 20:32:06.406 UTC [50] LOG:  工作进程:逻辑复制启动器 (PID 59) 以退出代码 1 退出
167:M 25 Apr 2020 20:32:06.406 # 用户请求关闭...
167:M 25 Apr 2020 20:32:06.406 * 在退出前保存最终的 RDB 快照。
2020-04-25 20:32:06.409 UTC [54] LOG:  正在关闭
2020-04-25 20:32:06.439 UTC [50] LOG:  数据库系统已关闭
167:M 25 Apr 2020 20:32:06.502 * 数据库已保存到磁盘
167:M 25 Apr 2020 20:32:06.502 # Redis 现在可以退出,再见...


失败
--------------------
Pups::ExecError: cd /var/www/discourse && su discourse -c 'bundle exec rake db:migrate' 失败,返回状态为 #<Process::Status: pid 13098 exit 1>
失败位置:/pups/lib/pups/exec_command.rb:112:in `spawn'
执行失败,参数为 {"cd"=>"$home", "hook"=>"db_migrate", "cmd"=>["su discourse -c 'bundle exec rake db:migrate'"]}
b5a02d7f9df6b6a9dc160e269de30eef49bb0aeaf5dcb1b712bab5e6edad4030
** 引导失败 ** 请向上滚动并查找之前的错误消息,可能不止一条。
./discourse-doctor 可能有助于诊断问题。
root@discuss:/var/discourse#
3 个赞

@k4rtik 感谢您的报告,很抱歉给您带来了影响。您遇到的问题是由以下原因导致的:

  1. layouts 插件在两天前进行了更新。
  2. locations 插件当时仍支持 layouts 插件的旧版本。
  3. 您同时使用了这两个插件。
  4. 您在 layouts 插件首次更新后、locations 插件添加对新版本支持之前,更新了您的 Discourse。

我已更新 locations 插件以支持新的 layouts 插件版本:https://github.com/paviliondev/discourse-locations/commit/52aec30461f8439c6658fdc401127cb52881ab49。现在,当您同时安装这两个插件进行更新时,问题将得到解决。@Richie 这也将修复您的问题:Add include? to geo_json in user_card serializer · merefield/discourse-locations@5185063 · GitHub

在这种情况下,拥有 tests-passed 分支 unfortunately 无法提供太大帮助,而且在其他许多插件不兼容的情况下也是如此。用户的更新频率各不相同,自定义组合也多种多样。

不过,我们已经开始采取一些措施来解决这个问题。我们将实施一项计划,确保 Pavilion 的主要开源插件(包括本插件、Events、Topic List Previews 等)在每月的 1 日至 5 日(从 5 月开始)的每 24 小时内与 Discourse 保持同步更新。

这为您提供了一个安全窗口,以便在 try.thepavilion.io 上更新所有插件以及 Discourse 本身,并更有把握地确保:

  1. 您不会遇到插件与 Discourse 之间的冲突;即使出现冲突,也将在 24 小时内得到解决。

  2. 您不会因插件本身的变更而遇到问题。任何可能破坏兼容性的插件变更都将在此窗口期之外进行。

这适用于此处列出的所有插件:

此列表未来可能会扩展。更多信息请访问:https://try.thepavilion.io

如果您对此有任何疑问,请随时通过私信联系我,或访问 thepavilion.io 联系我们。

8 个赞

谢谢,是的,我一直在试图弄清楚为什么我的自定义布局在上次更新后也没有显示出来。它似乎仍然没有出现,但我在 Pavilion 上看到你们正在准备发布关于插件变更的更新文档,所以我会再等一段时间。

2 个赞

@angus 已确认 - 问题已解决 :clap:t2:

再次感谢你对该插件的持续支持 :smiley:

4 个赞

你好 @angus,我看到通知说本线程的首条帖子已被编辑。

看起来仓库的位置已变更。

我们需要将 Discourse 设置更新为新位置,还是现有的/旧位置仍会继续更新?

更改插件源位置后,我们是否需要重新构建任何内容?

3 个赞

@Richie,你可以继续使用旧的 URL:https://github.com/angusmcleod/discourse-locations。你可以等到自然有机会时再更新,例如因为其他原因需要重建你的网站时。

该插件已于之前从我的个人 GitHub 仓库转移到了 Pavilion 的仓库。当仓库被转移时,GitHub 会自动将所有指向旧位置的链接重定向到新位置。

首帖在未来几周内会有所调整。我将在 thepavilion.io 上为它编写一些文档,并在这里的 meta 上提供一个简短的描述。

4 个赞

太好了,我之前还不知道这一点 :+1:t2:

再次感谢您的支持!

3 个赞