# Development

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

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

**Page:** 121

---

## [从控制台发送测试邮件？](https://meta.discourse.org/t/email-test-from-the-console/87295)

<div class="topic-metadata">

**Author:** [@pfaffman](https://meta.discourse.org/u/pfaffman)\
**回覆:** 3\
**Last updated:** [2018年五月12日 00:55 UTC](https://meta.discourse.org/t/email-test-from-the-console/87295 "2018-05-12T00:55:41Z")

</div>

是否可以从 Rails 控制台启动邮件测试？出于无数原因，我希望能无需创建账户即可发送测试邮件。我已经查看了 config/routes.rb 并全局搜索了所有...

---

## [插件在开发和生产环境中的行为不一致](https://meta.discourse.org/t/inconsistent-behaviour-in-plugins-between-development-and-production/87220)

<div class="topic-metadata">

**Author:** [@eatcodetravel](https://meta.discourse.org/u/eatcodetravel)\
**回覆:** 2\
**Last updated:** [2018年五月11日 13:06 UTC](https://meta.discourse.org/t/inconsistent-behaviour-in-plugins-between-development-and-production/87220 "2018-05-11T13:06:50Z")

</div>

在开发和生产环境中，add\_to\_serializer 的工作方式存在不一致。这是由于插件的应用方式不同所致。 由于我们在开发环境中会重新加载代码，因此对父序列化器所做的每次修改……

---

## [加载“推荐主题”延迟](https://meta.discourse.org/t/delay-in-loading-suggested-topics/87163)

<div class="topic-metadata">

**Author:** [@Stranik](https://meta.discourse.org/u/Stranik)\
**回覆:** 3\
**Last updated:** [2018年五月11日 08:05 UTC](https://meta.discourse.org/t/delay-in-loading-suggested-topics/87163 "2018-05-11T08:05:00Z")

</div>

建议主题：如果答案超过 20 条，显示会延迟。我查看了代码，但找不到延迟显示的具体位置。谢谢。

---

## [Starting discourse fails with bootstrap error](https://meta.discourse.org/t/starting-discourse-fails-with-bootstrap-error/65213)

<div class="topic-metadata">

**Author:** [@manishramteke](https://meta.discourse.org/u/manishramteke)\
**回覆:** 6\
**Last updated:** [2018年五月11日 02:59 UTC](https://meta.discourse.org/t/starting-discourse-fails-with-bootstrap-error/65213 "2018-05-11T02:59:29Z")

</div>

Hi Team, Facing below error when tried running rails server /var/lib/gems/2.3.0/gems/bootsnap-1.0.0/lib/bootsnap/compile\_cache/iseq.rb:73:in \`compile\_option\_crc32=': wrong argument type Bignum (expected Fixnum) (TypeEr…

---

## [如何在本地以生产模式运行 Discourse？](https://meta.discourse.org/t/how-to-run-discourse-in-production-mode-locally/87198)

<div class="topic-metadata">

**Author:** [@eatcodetravel](https://meta.discourse.org/u/eatcodetravel)\
**回覆:** 2\
**Last updated:** [2018年五月10日 23:15 UTC](https://meta.discourse.org/t/how-to-run-discourse-in-production-mode-locally/87198 "2018-05-10T23:15:41Z")

</div>

我正在尝试调试一个在本地运行正常但在生产环境中无法工作的插件。我想在生产环境中本地运行 Discourse，但遇到了一些问题，如果这不是正确的方法，我不想继续深入排查。 我所做的……

---

## [Change Users email address using the API without sending the confirmation Email](https://meta.discourse.org/t/change-users-email-address-using-the-api-without-sending-the-confirmation-email/77606)

<div class="topic-metadata">

**Author:** [@skodali](https://meta.discourse.org/u/skodali)\
**回覆:** 5\
**Last updated:** [2018年五月10日 22:01 UTC](https://meta.discourse.org/t/change-users-email-address-using-the-api-without-sending-the-confirmation-email/77606 "2018-05-10T22:01:10Z")

</div>

I am a new discourse user and I ran into a use case where I have to update the user email address using the API. Discourse is sending out an email to the new email address for verification. Is there a way to update the u…

---

## [关于迁移后处理方法的建议](https://meta.discourse.org/t/advice-on-approach-to-post-migration/87184)

<div class="topic-metadata">

**Author:** [@bletch](https://meta.discourse.org/u/bletch)\
**回覆:** 2\
**Last updated:** [2018年五月10日 19:12 UTC](https://meta.discourse.org/t/advice-on-approach-to-post-migration/87184 "2018-05-10T19:12:52Z")

</div>

你好，是否有推荐的 Ruby HTML 解析库？最好是 Discourse 已内置的，以便我用来解析正在迁移的 HTML 帖子结构。 背景 我正在处理一项迁移……

---

## [我在哪里可以找到搜索字段的定义](https://meta.discourse.org/t/where-do-i-find-the-definition-of-the-search-field/86875)

<div class="topic-metadata">

**Author:** [@nabeel](https://meta.discourse.org/u/nabeel)\
**回覆:** 1\
**Last updated:** [2018年五月10日 17:55 UTC](https://meta.discourse.org/t/where-do-i-find-the-definition-of-the-search-field/86875 "2018-05-10T17:55:18Z")

</div>

你好， 我正在使用 jquery.ime 插件修改 Discourse 中的文本字段。我只需找到相应的 Handlebars 模板并添加所需的 JavaScript 代码。但我找不到 hbs 文件……

---

## [Ember.js 中的函数错误](https://meta.discourse.org/t/function-error-in-ember-js/87138)

<div class="topic-metadata">

**Author:** [@nikitabytsko](https://meta.discourse.org/u/nikitabytsko)\
**回覆:** 1\
**Last updated:** [2018年五月10日 07:06 UTC](https://meta.discourse.org/t/function-error-in-ember-js/87138 "2018-05-10T07:06:30Z")

</div>

您好。我想修改邀请页面，并在“invites-show.js.es6”中添加一些新功能，但插件无法正常工作。邀请页面无法调用我的函数。抱歉英语不好。谢谢。

---

## [向管理员而非所有者发送请求](https://meta.discourse.org/t/send-request-to-admin-instead-of-owners/87055)

<div class="topic-metadata">

**Author:** [@Francois\_Douville](https://meta.discourse.org/u/Francois_Douville)\
**回覆:** 4\
**Last updated:** [2018年五月9日 11:54 UTC](https://meta.discourse.org/t/send-request-to-admin-instead-of-owners/87055 "2018-05-09T11:54:43Z")

</div>

我不是该群组的成员，且目前也没有群主。能否添加一个功能，将请求发送给我（管理员）而不是群主？谢谢

---

## [保持品牌头部固定而不是滚动？](https://meta.discourse.org/t/keep-brand-header-static-instead-of-scrolling/312630)

<div class="topic-metadata">

**Author:** [@cadriel](https://meta.discourse.org/u/cadriel)\
**回覆:** 4\
**Last updated:** [2018年五月8日 23:49 UTC](https://meta.discourse.org/t/keep-brand-header-static-instead-of-scrolling/312630 "2018-05-08T23:49:25Z")

</div>

确认；安装后，似乎标题会滚出页面。有没有办法将标题固定在现有 discourse 标题上方？

---

## [Webpush gem 并非最新版本](https://meta.discourse.org/t/webpush-gem-is-not-latest/86829)

<div class="topic-metadata">

**Author:** [@darix](https://meta.discourse.org/u/darix)\
**回覆:** 5\
**Last updated:** [2018年五月8日 11:24 UTC](https://meta.discourse.org/t/webpush-gem-is-not-latest/86829 "2018-05-08T11:24:27Z")

</div>

有什么原因吗？

---

## [Windows 上的 Discourse Vagrant 设置](https://meta.discourse.org/t/discourse-vagrant-setup-for-windows/86886)

<div class="topic-metadata">

**Author:** [@alfabetagama](https://meta.discourse.org/u/alfabetagama)\
**回覆:** 2\
**Last updated:** [2018年五月6日 21:22 UTC](https://meta.discourse.org/t/discourse-vagrant-setup-for-windows/86886 "2018-05-06T21:22:45Z")

</div>

如有兴趣，我整理了一套新的 Vagrant Discourse 开发环境： 它使用 WinFSD 驱动进行共享，因此性能应优于 SMB 或原生 VirtualBox 共享。已在 Windows 7 上测试，欢迎反馈……

---

## [登录时横幅显示用户名](https://meta.discourse.org/t/display-username-when-login-in-banner/83024)

<div class="topic-metadata">

**Author:** [@Francois\_Douville](https://meta.discourse.org/u/Francois_Douville)\
**回覆:** 14\
**Last updated:** [2018年五月6日 08:19 UTC](https://meta.discourse.org/t/display-username-when-login-in-banner/83024 "2018-05-06T08:19:03Z")

</div>

我想在我的横幅中显示“嘿 用户名”，该怎么做？并且希望在注销时不显示姓名……谢谢！

---

## [关于 add\_more\_topics\_if\_expected 及其内部的一个 bug](https://meta.discourse.org/t/about-add-more-topics-if-expected-and-a-bug-inside-it/86808)

<div class="topic-metadata">

**Author:** [@ballistic](https://meta.discourse.org/u/ballistic)\
**回覆:** 0\
**Last updated:** [2018年五月5日 03:05 UTC](https://meta.discourse.org/t/about-add-more-topics-if-expected-and-a-bug-inside-it/86808 "2018-05-05T03:05:56Z")

</div>

我想知道“add\_more\_topics\_if\_expected”背后的逻辑，为什么/在什么情况下我们需要额外的帖子。 def find\_grouped\_results if @results.type\_filter.present? ... send("#{@results.type\_filter}\_search") else...

---

## [我正在调用的登录 API 请求](https://meta.discourse.org/t/api-call-i-am-making-to-try-and-login/86743)

<div class="topic-metadata">

**Author:** [@saurabh.shukla](https://meta.discourse.org/u/saurabh.shukla)\
**回覆:** 1\
**Last updated:** [2018年五月4日 09:46 UTC](https://meta.discourse.org/t/api-call-i-am-making-to-try-and-login/86743 "2018-05-04T09:46:42Z")

</div>

我正在做的是：React Native 应用 这是我尝试登录时发出的 API 调用——这样做对吗？是否有其他方法？

---

## [OneBox 身份验证](https://meta.discourse.org/t/onebox-authentication/86740)

<div class="topic-metadata">

**Author:** [@BroiSatse](https://meta.discourse.org/u/BroiSatse)\
**回覆:** 1\
**Last updated:** [2018年五月4日 09:20 UTC](https://meta.discourse.org/t/onebox-authentication/86740 "2018-05-04T09:20:38Z")

</div>

你好， 是否可以在 Discourse 中为每个域名指定额外的身份验证标头？我们正在运行一个私有网站，我们的 Discourse 实例仅对会员开放。我们有一些页面是部分……

---

## [Should importers import users with invalid email addresses by default?](https://meta.discourse.org/t/should-importers-import-users-with-invalid-email-addresses-by-default/71424)

<div class="topic-metadata">

**Author:** [@pfaffman](https://meta.discourse.org/u/pfaffman)\
**回覆:** 7\
**Last updated:** [2018年五月2日 12:04 UTC](https://meta.discourse.org/t/should-importers-import-users-with-invalid-email-addresses-by-default/71424 "2018-05-02T12:04:18Z")

</div>

Re-running an import with a bunch of invalid emails is a drag since it has to re-try adding each block of 1000 users if one of them is bad. I don’t see a down side to importing users with bogus email addresses with a ra…

---

## [在分类横幅中扩展文本宽度](https://meta.discourse.org/t/extend-the-text-width-in-the-category-banner/298496)

<div class="topic-metadata">

**Author:** [@Francois\_Douville](https://meta.discourse.org/u/Francois_Douville)\
**回覆:** 1\
**Last updated:** [2018年五月2日 00:28 UTC](https://meta.discourse.org/t/extend-the-text-width-in-the-category-banner/298496 "2018-05-02T00:28:38Z")

</div>

主题很棒，谢谢！ 能否将 max-width 从 500px 改为 800px？目前的设置看起来不太协调，而且我的描述内容并不长。

---

## [Vbulletin 批量导入器无法找到 PG 数据库](https://meta.discourse.org/t/vbulletin-bulk-importer-cant-find-pg-database/78112)

<div class="topic-metadata">

**Author:** [@pfaffman](https://meta.discourse.org/u/pfaffman)\
**回覆:** 3\
**Last updated:** [2018年四月29日 17:26 UTC](https://meta.discourse.org/t/vbulletin-bulk-importer-cant-find-pg-database/78112 "2018-04-29T17:26:54Z")

</div>

继续关于“大型论坛的导入器”的讨论： 我确信自己可能犯了个低级错误，但我正在尝试运行 vBulletin 批量导入器，不知为何它找不到 PostgreSQL 数据库。 /home/pfaffman/…

---

## [关于分类自定义字段的问题](https://meta.discourse.org/t/questions-about-category-custom-fields/86115)

<div class="topic-metadata">

**Author:** [@Flower\_Child](https://meta.discourse.org/u/Flower_Child)\
**回覆:** 1\
**Last updated:** [2018年四月29日 23:23 UTC](https://meta.discourse.org/t/questions-about-category-custom-fields/86115 "2018-04-29T23:23:28Z")

</div>

你好！ 我正在开发一个简单的插件，允许为类别分配一个 Font Awesome 图标。如果未设置图片，则显示该图标。 我目前并不打算通过主题来实现……

---

## [PrettyText.markdown 调用有什么问题？](https://meta.discourse.org/t/what-is-the-problem-with-prettytext-markdown-call/84674)

<div class="topic-metadata">

**Author:** [@ballistic](https://meta.discourse.org/u/ballistic)\
**回覆:** 22\
**Last updated:** [2018年四月25日 23:57 UTC](https://meta.discourse.org/t/what-is-the-problem-with-prettytext-markdown-call/84674 "2018-04-25T23:57:20Z")

</div>

PrettyText.markdown("❤️❤️❤️", {}) 不会生成与以下代码相同的输出： PrettyText.markdown(":heart::heart::heart:", {}) 它将生成： =\> "

---

## [How to add custom field to topic?](https://meta.discourse.org/t/how-to-add-custom-field-to-topic/57948)

<div class="topic-metadata">

**Author:** [@Janno\_Liivak](https://meta.discourse.org/u/Janno_Liivak)\
**回覆:** 6\
**Last updated:** [2018年四月24日 23:41 UTC](https://meta.discourse.org/t/how-to-add-custom-field-to-topic/57948 "2018-04-24T23:41:12Z")

</div>

I tried to add custom field to Topic but doing it the same way as for category gives me error: Property set failed: object in path "custom\_fields" could not be found or was destroyed. Example of how it works successful…

---

## [如何在品牌标题中使用自定义/非标准图标？](https://meta.discourse.org/t/how-to-use-custom-non-standard-icons-in-brand-header/312629)

<div class="topic-metadata">

**Author:** [@icaria36](https://meta.discourse.org/u/icaria36)\
**回覆:** 2\
**Last updated:** [2018年四月21日 20:41 UTC](https://meta.discourse.org/t/how-to-use-custom-non-standard-icons-in-brand-header/312629 "2018-04-21T20:41:50Z")

</div>

重新发布： 使用 Font Awesome 中的图标来链接到社会服务非常适用于商业服务，因为大多数（如果不是全部）主流服务都在其中提供了对应的图标。然而，对于我们这些使用免费/开源社会服务的用户……

---

## [关于导入 JSON 的问题](https://meta.discourse.org/t/questions-about-importing-json/85829)

<div class="topic-metadata">

**Author:** [@tehspaceg](https://meta.discourse.org/u/tehspaceg)\
**回覆:** 2\
**Last updated:** [2018年四月20日 20:00 UTC](https://meta.discourse.org/t/questions-about-importing-json/85829 "2018-04-20T20:00:07Z")

</div>

我事先声明，我对 Ruby 的了解几乎为零，所以如果我说的话听起来很蠢，请见谅。在等待 Marketplace 中的人处理我的悬赏时，我想我可以自己尝试导入一些数据。……

---

## [Cleaning up our color palette 🎨](https://meta.discourse.org/t/cleaning-up-our-color-palette/61263)

<div class="topic-metadata">

**Author:** [@sam](https://meta.discourse.org/u/sam)\
**回覆:** 23\
**Last updated:** [2018年四月20日 17:36 UTC](https://meta.discourse.org/t/cleaning-up-our-color-palette/61263 "2018-04-20T17:36:55Z")

</div>

At the moment all our CSS has mountains of extreme levels of repetition when it comes to picking colors. When we need a color that is not in our “base” palate, we reach out to one of these 2 functions: dark-light-choos…

---

## [为什么 Discourse 代码库中的代码注释这么少？（Github）](https://meta.discourse.org/t/why-so-little-code-comment-in-discourse-codebase-github/85710)

<div class="topic-metadata">

**Author:** [@1c7](https://meta.discourse.org/u/1c7)\
**回覆:** 7\
**Last updated:** [2018年四月19日 12:51 UTC](https://meta.discourse.org/t/why-so-little-code-comment-in-discourse-codebase-github/85710 "2018-04-19T12:51:28Z")

</div>

https://github.com/discourse/discourse 背景 我试图自定义 Discourse。 （深度定制，主题/插件不够，不是简单的外观更改（如标志、颜色、图片等）） 我在笔记本电脑上通过 git clone 克隆了……

---

## [移动端注册按钮](https://meta.discourse.org/t/signup-button-on-mobile/84956)

<div class="topic-metadata">

**Author:** [@Paublio\_Martinez](https://meta.discourse.org/u/Paublio_Martinez)\
**回覆:** 3\
**Last updated:** [2018年四月18日 22:35 UTC](https://meta.discourse.org/t/signup-button-on-mobile/84956 "2018-04-18T22:35:50Z")

</div>

希望将移动端的“登录”按钮更改为“注册/登录”。请问有什么方法可以实现吗？

---

## [插件加载后执行一次 JavaScript 代码](https://meta.discourse.org/t/execute-javascript-code-from-a-plugin-once-after-load/85580)

<div class="topic-metadata">

**Author:** [@eatcodetravel](https://meta.discourse.org/u/eatcodetravel)\
**回覆:** 4\
**Last updated:** [2018年四月18日 00:10 UTC](https://meta.discourse.org/t/execute-javascript-code-from-a-plugin-once-after-load/85580 "2018-04-18T00:10:26Z")

</div>

你好！ 我正在寻找一种在 Discourse 加载完成后执行 JavaScript 代码的方法。我采用了以下做法，因为我在一些插件中看到过类似实现。 // 在初始化器内部 export default { name: 'my-initialize…

---

## [在自定义字段中使用 i18n（本地化）](https://meta.discourse.org/t/using-i18n-localization-in-custom-fields/85281)

<div class="topic-metadata">

**Author:** [@eatcodetravel](https://meta.discourse.org/u/eatcodetravel)\
**回覆:** 0\
**Last updated:** [2018年四月13日 20:55 UTC](https://meta.discourse.org/t/using-i18n-localization-in-custom-fields/85281 "2018-04-13T20:55:21Z")

</div>

你好！ 自定义字段是否支持国际化（i18n）？例如，您有一个下拉选项列表，并希望将这些选项翻译成多种语言。 谢谢！

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

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