# Development

**URL:** https://meta.discourse.org/c/dev/7.md?page=54

[最新版本](https://meta.discourse.org/latest.md) · [分類](https://meta.discourse.org/categories.md) · [標簽](https://meta.discourse.org/tags.md)

**Page:** 55

---

## [是否支持加载插件中定义的 rake 任务？](https://meta.discourse.org/t/any-support-for-loading-rake-tasks-defined-in-plugins/142479)

<div class="topic-metadata">

**Author:** [@jamesmarkcook](https://meta.discourse.org/u/jamesmarkcook)\
**回覆:** 7\
**Last updated:** [2023年一月16日 10:27 UTC](https://meta.discourse.org/t/any-support-for-loading-rake-tasks-defined-in-plugins/142479 "2023-01-16T10:27:07Z")

</div>

我需要能够在 Discourse 论坛上运行自定义任务。是否有任何方法可以加载插件中定义的 rake 任务，以便在生产环境中使用？

---

## [切换搜索自定义按钮](https://meta.discourse.org/t/toggling-search-custom-button/251881)

<div class="topic-metadata">

**Author:** [@misham](https://meta.discourse.org/u/misham)\
**回覆:** 0\
**Last updated:** [2023年一月16日 07:46 UTC](https://meta.discourse.org/t/toggling-search-custom-button/251881 "2023-01-16T07:46:00Z")

</div>

您好！前段时间我问是否可以在自定义位置插入搜索，并收到了答复 Header search in custom header - #2 by awesomerobot。但由此产生了一个问题：我能否切换搜索的可见性……

---

## [如何用姓名（用户名和姓名）替换头像图片](https://meta.discourse.org/t/how-to-replace-avatar-image-with-name-username-and-name/251839)

<div class="topic-metadata">

**Author:** [@hoangviet](https://meta.discourse.org/u/hoangviet)\
**回覆:** 1\
**Last updated:** [2023年一月15日 16:44 UTC](https://meta.discourse.org/t/how-to-replace-avatar-image-with-name-username-and-name/251839 "2023-01-15T16:44:36Z")

</div>

谢谢！ 希望有人能帮忙 在主页的移动界面上 如何用姓名（用户名和姓名）替换头像图片。 意思是我不想显示头像，但我想显示姓名+用户名（在移动设备上……

---

## [用文本替换 #current-user 导航项](https://meta.discourse.org/t/replacing-current-user-nav-item-with-text/123442)

<div class="topic-metadata">

**Author:** [@ahmadabdolsaheb](https://meta.discourse.org/u/ahmadabdolsaheb)\
**回覆:** 3\
**Last updated:** [2023年一月15日 09:53 UTC](https://meta.discourse.org/t/replacing-current-user-nav-item-with-text/123442 "2023-01-15T09:53:15Z")

</div>

大家好。 我需要将导航栏中的 #current-user（个人资料图片）项替换为文本“profile”。 最佳做法是什么？ 我尝试在 #current-user a::before 中添加文本，但……

---

## [渐变用户名颜色无效，为什么？](https://meta.discourse.org/t/gradient-username-colors-dont-work-why/251740)

<div class="topic-metadata">

**Author:** [@danielabc](https://meta.discourse.org/u/danielabc)\
**回覆:** 2\
**Last updated:** [2023年一月15日 06:50 UTC](https://meta.discourse.org/t/gradient-username-colors-dont-work-why/251740 "2023-01-15T06:50:14Z")

</div>

如果我的版主使用此代码，CSS代码将起作用 .names { span.moderator a { background: linear-gradient(to right,#BF953F, #FCF6BA, #B38728, #FBF5B7, #AA771C); -webkit-background-clip: text; -webkit-text…

---

## [CSS更改自定义组的用户名颜色，有时有效有时无效？](https://meta.discourse.org/t/css-change-username-color-for-entire-custom-groups-works-sometimes-then-doesnt/249110)

<div class="topic-metadata">

**Author:** [@Kartoon](https://meta.discourse.org/u/Kartoon)\
**回覆:** 8\
**Last updated:** [2023年一月15日 03:58 UTC](https://meta.discourse.org/t/css-change-username-color-for-entire-custom-groups-works-sometimes-then-doesnt/249110 "2023-01-15T03:58:35Z")

</div>

我不确定具体是什么原因，但我用来做这个的任何 CSS 代码似乎都会随机开启和关闭，我不知道这是否是由于更新、某些设置等原因…… 我用得最久的代码是 .topic-post .Ve……

---

## [自动删除被系统标记的用户？](https://meta.discourse.org/t/automatically-delete-users-flagged-by-system/249765)

<div class="topic-metadata">

**Author:** [@Canapin](https://meta.discourse.org/u/Canapin)\
**回覆:** 5\
**Last updated:** [2023年一月14日 17:09 UTC](https://meta.discourse.org/t/automatically-delete-users-flagged-by-system/249765 "2023-01-14T17:09:46Z")

</div>

您好！ 我每天都会收到十几条垃圾邮件账户被标记为“新用户在未阅读任何主题或帖子的情况下输入了个人资料信息”。 两年里，我们从未出现过误报。 所以，我想我们可以自动……

---

## [PG::UndefinedTable: ERROR: relation "pg\_range" 不存在](https://meta.discourse.org/t/pg-error-relation-pg-range-does-not-exist/251451)

<div class="topic-metadata">

**Author:** [@joecooldoo](https://meta.discourse.org/u/joecooldoo)\
**回覆:** 9\
**Last updated:** [2023年一月12日 19:44 UTC](https://meta.discourse.org/t/pg-error-relation-pg-range-does-not-exist/251451 "2023-01-12T19:44:50Z")

</div>

我正在遵循这里的指南： 当我运行 bundle exec rake db:create 时，它会报错并显示： \[警告\] Discourse 建议使用 Ruby v3.1.3 或更高版本进行开发。您正在使用 v2.7.6。 PG::UndefinedTable：错误：…

---

## [API: Getting all posts in a topic](https://meta.discourse.org/t/api-getting-all-posts-in-a-topic/41018)

<div class="topic-metadata">

**Author:** [@pfaffman](https://meta.discourse.org/u/pfaffman)\
**回覆:** 19\
**Last updated:** [2023年一月11日 12:36 UTC](https://meta.discourse.org/t/api-getting-all-posts-in-a-topic/41018 "2023-01-11T12:36:39Z")

</div>

I’m working on a script that will evaluate participation in a discussion and produce a number based on how many messages they wrote, likes, and replies and such that will become students’ grade for “participating” in a d…

---

## [Tabbis 主题组件](https://meta.discourse.org/t/tabbis-theme-component/251096)

<div class="topic-metadata">

**Author:** [@unfairest](https://meta.discourse.org/u/unfairest)\
**回覆:** 5\
**Last updated:** [2023年一月9日 15:29 UTC](https://meta.discourse.org/t/tabbis-theme-component/251096 "2023-01-09T15:29:41Z")

</div>

您好！我正在尝试创建一个主题组件来使用外部脚本 tabbis.js，以便在帖子中创建选项卡。我遵循了这里的演练：在主题中的文本中嵌入小部件 - #2 Johani 这是我的主题……

---

## [编辑公共主题的最佳实践](https://meta.discourse.org/t/best-practices-for-editing-public-themes/251041)

<div class="topic-metadata">

**Author:** [@dmc](https://meta.discourse.org/u/dmc)\
**回覆:** 8\
**Last updated:** [2023年一月8日 16:08 UTC](https://meta.discourse.org/t/best-practices-for-editing-public-themes/251041 "2023-01-08T16:08:34Z")

</div>

您好！ 在构建 Discourse 空间时，我选择了一些主题，我想对其进行一些编辑。这方面的最佳实践是什么？ 我应该只克隆主题存储库，在那里进行更改然后安装它……

---

## [聊天外观定制](https://meta.discourse.org/t/chat-look-customization/250955)

<div class="topic-metadata">

**Author:** [@agf1997](https://meta.discourse.org/u/agf1997)\
**回覆:** 6\
**Last updated:** [2023年一月6日 17:35 UTC](https://meta.discourse.org/t/chat-look-customization/250955 "2023-01-06T17:35:41Z")

</div>

我正在尝试自定义桌面上的新聊天窗口（全屏模式）。 我有想要使用的 CSS，但我无法弄清楚在我的主题中放在哪里才能生效。 我尝试过…… my\_theme/desktop/chat……

---

## [动态设置主题](https://meta.discourse.org/t/set-theme-dynamically/250719)

<div class="topic-metadata">

**Author:** [@Lai\_Chau\_Koi](https://meta.discourse.org/u/Lai_Chau_Koi)\
**回覆:** 2\
**Last updated:** [2023年一月5日 21:38 UTC](https://meta.discourse.org/t/set-theme-dynamically/250719 "2023-01-05T21:38:42Z")

</div>

新年快乐！ 我想在我的网站（基于 discourse）上动态设置主题。 所以我想每隔几个小时或为不同的域设置不同的主题（我已经导入了一些主题）。 这可能吗……

---

## [新的侧边栏自定义 CSS](https://meta.discourse.org/t/new-sidebar-custom-css/250613)

<div class="topic-metadata">

**Author:** [@10ColorsTenkara](https://meta.discourse.org/u/10ColorsTenkara)\
**回覆:** 5\
**Last updated:** [2023年一月4日 15:34 UTC](https://meta.discourse.org/t/new-sidebar-custom-css/250613 "2023-01-04T15:34:56Z")

</div>

继续讨论“试用新的侧边栏和通知菜单！”： @Canapin 请原谅我这个无知的问题，我很久没来 meta 了，而且我没有对我的 insta 做过太多 CSS 更改……

---

## [收到新消息时更新小部件？](https://meta.discourse.org/t/update-widget-when-new-message-received/250637)

<div class="topic-metadata">

**Author:** [@piffy](https://meta.discourse.org/u/piffy)\
**回覆:** 1\
**Last updated:** [2023年一月4日 03:01 UTC](https://meta.discourse.org/t/update-widget-when-new-message-received/250637 "2023-01-04T03:01:21Z")

</div>

我有一个主题组件小部件，当有新主题或未读主题时会显示一个小气泡。为了让它实时更新，我这样做： topicTrackingState.onStateChange(() =\> { this.scheduleRerender(); …

---

## [baseURI 在 decorateCooked 中无效](https://meta.discourse.org/t/baseuri-not-valid-in-decoratecooked/250624)

<div class="topic-metadata">

**Author:** [@markschmucker](https://meta.discourse.org/u/markschmucker)\
**回覆:** 2\
**Last updated:** [2023年一月3日 22:27 UTC](https://meta.discourse.org/t/baseuri-not-valid-in-decoratecooked/250624 "2023-01-03T22:27:55Z")

</div>

api.decorateCooked($elem =\> { var uri = $elem\[0\].baseURI; }); uri 不一致。它具有以下值之一，频率大致相等。 https://forum.example.com/t/test-topic-1/43803 (预期行为…

---

## [想要修改 discourse 应用的 rails 代码](https://meta.discourse.org/t/want-to-modify-rails-code-of-discourse-application/250544)

<div class="topic-metadata">

**Author:** [@kapil65](https://meta.discourse.org/u/kapil65)\
**回覆:** 1\
**Last updated:** [2023年一月3日 10:40 UTC](https://meta.discourse.org/t/want-to-modify-rails-code-of-discourse-application/250544 "2023-01-03T10:40:03Z")

</div>

我想修改 discourse 的后端代码，并更改某些模型的范围，但这不会反映在 UI 上，我该如何修改 discourse 应用程序的后端代码。 比如我想更改某些模型的作用域……

---

## [自定义标签？](https://meta.discourse.org/t/custom-tags/250335)

<div class="topic-metadata">

**Author:** [@Samir\_Sabri](https://meta.discourse.org/u/Samir_Sabri)\
**回覆:** 4\
**Last updated:** [2023年一月2日 15:06 UTC](https://meta.discourse.org/t/custom-tags/250335 "2023-01-02T15:06:22Z")

</div>

你好 有什么方法可以添加自定义标签，该标签将被自定义的 JavaScript 和 HTML 标签替换吗？ 例如，custom tag content 可以被我定义的 HTML 标签替换，这是……

---

## [如何从PluginAPI获取主题的slug或id？](https://meta.discourse.org/t/how-to-get-topic-slug-or-id-from-pluginapi/250362)

<div class="topic-metadata">

**Author:** [@markschmucker](https://meta.discourse.org/u/markschmucker)\
**回覆:** 0\
**Last updated:** [2023年一月2日 03:37 UTC](https://meta.discourse.org/t/how-to-get-topic-slug-or-id-from-pluginapi/250362 "2023-01-02T03:37:46Z")

</div>

PluginAPI 新手。我有一个可用的脚本，大致如下： api.decorateCooked($elem =\> { var iframes = $elem\[0\].querySelectorAll('iframe'); var uri = $elem\[0\].baseURI; // 以某种方式修改 iframe…

---

## [将过滤器中的“类别”重命名为“所有主题”](https://meta.discourse.org/t/rename-categories-to-all-topics-in-filter/250180)

<div class="topic-metadata">

**Author:** [@misham](https://meta.discourse.org/u/misham)\
**回覆:** 0\
**Last updated:** [2022年十二月30日 08:46 UTC](https://meta.discourse.org/t/rename-categories-to-all-topics-in-filter/250180 "2022-12-30T08:46:26Z")

</div>

您好！我在类别过滤器上有一个过滤器 https://i.imgur.com/nIhRnhR.png，但我想将此选项卡重命名为“所有主题”，这是否可行以及如何操作？

---

## [如何在“登录”前添加btn](https://meta.discourse.org/t/how-to-add-btn-before-sign-in/250084)

<div class="topic-metadata">

**Author:** [@Ryen\_Lee](https://meta.discourse.org/u/Ryen_Lee)\
**回覆:** 1\
**Last updated:** [2022年十二月29日 10:25 UTC](https://meta.discourse.org/t/how-to-add-btn-before-sign-in/250084 "2022-12-29T10:25:01Z")

</div>

我想在“登录”按钮前添加一个按钮。 我该怎么做？

---

## [在插件的前端测试中，是否可以覆盖Site对象及其自己的fixture？](https://meta.discourse.org/t/is-it-possible-to-override-the-site-object-with-own-fixture-during-front-end-tests-of-a-plugin/249167)

<div class="topic-metadata">

**Author:** [@merefield](https://meta.discourse.org/u/merefield)\
**回覆:** 2\
**Last updated:** [2022年十二月28日 21:57 UTC](https://meta.discourse.org/t/is-it-possible-to-override-the-site-object-with-own-fixture-during-front-end-tests-of-a-plugin/249167 "2022-12-28T21:57:56Z")

</div>

我目前正在处理这个 PR：FIX：在用户卡片上显示格式化位置 by merefield · Pull Request #73 · paviliondev/discourse-locations · GitHub 我正试图用一个新的前端测试来覆盖这个更改。 …

---

## [Curl API搜索中关于Group\_Messages和In Options的查询](https://meta.discourse.org/t/query-re-group-messages-in-options-in-curl-api-search/248884)

<div class="topic-metadata">

**Author:** [@ddbm001](https://meta.discourse.org/u/ddbm001)\
**回覆:** 1\
**Last updated:** [2022年十二月28日 18:41 UTC](https://meta.discourse.org/t/query-re-group-messages-in-options-in-curl-api-search/248884 "2022-12-28T18:41:36Z")

</div>

大家好， 我所在的企业有一个托管的 Discourse 套餐，面向内部和外部客户。 作为论坛管理员，我需要执行一些特定的报告功能来生成双周报、月报……

---

## [评论页面独有的自定义图标](https://meta.discourse.org/t/unique-custom-icon-for-review-page-only/246621)

<div class="topic-metadata">

**Author:** [@Joart](https://meta.discourse.org/u/Joart)\
**回覆:** 5\
**Last updated:** [2022年十一月30日 07:31 UTC](https://meta.discourse.org/t/unique-custom-icon-for-review-page-only/246621 "2022-11-30T07:31:58Z")

</div>

你好， 我想替换审阅页面中的勾选图标。你可以在这里找到它： …

---

## [如何为子域使用不同的设置值？](https://meta.discourse.org/t/how-can-i-use-different-setting-value-for-subdomain/249875)

<div class="topic-metadata">

**Author:** [@Lai\_Chau\_Koi](https://meta.discourse.org/u/Lai_Chau_Koi)\
**回覆:** 2\
**Last updated:** [2022年十二月26日 20:45 UTC](https://meta.discourse.org/t/how-can-i-use-different-setting-value-for-subdomain/249875 "2022-12-26T20:45:20Z")

</div>

大家好！圣诞快乐！ 我有一个基于 Discourse 的论坛，它有几个子域，如下所示： 主论坛：example.com 子域：A.example.com、B.example.com、… 所有论坛都使用相同的用户和相同的主题和…

---

## [特色主题中未定义标签和类别](https://meta.discourse.org/t/in-featured-topic-no-tags-and-categories-defined/247500)

<div class="topic-metadata">

**Author:** [@misham](https://meta.discourse.org/u/misham)\
**回覆:** 5\
**Last updated:** [2022年十二月26日 15:55 UTC](https://meta.discourse.org/t/in-featured-topic-no-tags-and-categories-defined/247500 "2022-12-26T15:55:18Z")

</div>

您好！似乎我发现了一个问题，当启用了“显示类别和精选主题”选项时，它会出现在 FeaturedTopic 对象中。当我想要在 featured-topic.hbs 中获取 {{topic.tags}} 时，它返回的是 und…

---

## [我想为 Latest 添加一列](https://meta.discourse.org/t/i-want-to-add-a-column-to-latest/249876)

<div class="topic-metadata">

**Author:** [@piffy](https://meta.discourse.org/u/piffy)\
**回覆:** 0\
**Last updated:** [2022年十二月26日 08:33 UTC](https://meta.discourse.org/t/i-want-to-add-a-column-to-latest/249876 "2022-12-26T08:33:40Z")

</div>

我想在“最新主题”列表/表中（或所有主题列表）添加一列。这一列将包含一个符号，用于指示某个主题是否已被收藏以及/或是否已获得特定标签（例如……

---

## [如何使用 rails 在 discourse 应用程序的后端进行更改](https://meta.discourse.org/t/how-to-make-changes-on-backend-side-of-discourse-application-using-rails/249682)

<div class="topic-metadata">

**Author:** [@kapil65](https://meta.discourse.org/u/kapil65)\
**回覆:** 7\
**Last updated:** [2022年十二月26日 06:32 UTC](https://meta.discourse.org/t/how-to-make-changes-on-backend-side-of-discourse-application-using-rails/249682 "2022-12-26T06:32:16Z")

</div>

我在 discourse 应用程序中进行更改，我想根据回复数量显示主题，我创建了 rails 查询，但我找不到视图部分，我需要在哪里显示并添加此范围。

---

## [限制欢迎横幅仅在用户主页显示](https://meta.discourse.org/t/restrict-welcome-banner-to-users-homepage/270596)

<div class="topic-metadata">

**Author:** [@Discoursenaut](https://meta.discourse.org/u/Discoursenaut)\
**回覆:** 4\
**Last updated:** [2022年十二月25日 14:13 UTC](https://meta.discourse.org/t/restrict-welcome-banner-to-users-homepage/270596 "2022-12-25T14:13:42Z")

</div>

我有一个用户询问是否可以将横幅限制为主页，这样如果他们收藏了最新内容，横幅就不会显示？目前它似乎在两种情况下都显示。

---

## [如何挂载Widget参数](https://meta.discourse.org/t/how-to-mountwidget-args/249755)

<div class="topic-metadata">

**Author:** [@misham](https://meta.discourse.org/u/misham)\
**回覆:** 1\
**Last updated:** [2022年十二月23日 15:17 UTC](https://meta.discourse.org/t/how-to-mountwidget-args/249755 "2022-12-23T15:17:38Z")

</div>

您好！我正在尝试在原始 hbs 模板中挂载一个 widget \<MountWidget @widget="header-notifications" @args={{this.currentUser}}/\> 但它抛出了一个错误。我认为这是因为我添加了错误的参数，但我不知道……

[上一頁](https://meta.discourse.org/c/dev/7.md?page=53)

[下一頁](https://meta.discourse.org/c/dev/7.md?page=55)
