# currentUser 服务在哪里？

**URL:** https://meta.discourse.org/t/where-is-the-currentuser-service-located/392449
**Category:** Development
**Created:** [2025年十二月31日 11:15 UTC](https://meta.discourse.org/t/where-is-the-currentuser-service-located/392449 "2025-12-31T11:15:04Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![NateDhaliwal](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/natedhaliwal/32/313494_2.png) [@NateDhaliwal](https://meta.discourse.org/u/NateDhaliwal)
#### Post date: [2025年十二月31日 11:15 UTC](https://meta.discourse.org/t/where-is-the-currentuser-service-located/392449/1 "2025-12-31T11:15:04Z")

</div>

这可能是一个愚蠢的问题，但有人能给我指个方向吗？我似乎在 Discourse 仓库中找不到 `currentUser` 服务文件。`app/services` 目录中根本没有 `current-user.js` 文件。然而，`@service currentUser` 确实存在。这是 Ember 核心的一部分（我怀疑）？还是某个 Ember 扩展/附加的 NPM \[1\] 包？

谢谢。

* * *

1. 技术上是 pnpm

---

<div class="post-metadata">

### Author: ![RGJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rgj/32/523185_2.png) [@RGJ](https://meta.discourse.org/u/RGJ)
#### Post date: [2025年十二月31日 11:47 UTC](https://meta.discourse.org/t/where-is-the-currentuser-service-located/392449/2 "2025-12-31T11:47:04Z")

</div>

它在这里——包括一个关于它为什么不是“真正”服务的评论。

> <https://github.com/discourse/discourse/blob/5b51f071caa80e2f9b3e06eb6fd4a0c9a785bc25/frontend/discourse/app/initializers/inject-discourse-objects.js#L14-L18>

---

<div class="post-metadata">

### Author: ![NateDhaliwal](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/natedhaliwal/32/313494_2.png) [@NateDhaliwal](https://meta.discourse.org/u/NateDhaliwal)
#### Post date: [2025年十二月31日 13:16 UTC](https://meta.discourse.org/t/where-is-the-currentuser-service-located/392449/3 "2025-12-31T13:16:22Z")

</div>

谢谢！我本来没想到会去那里查看。

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [2026年一月30日 13:17 UTC](https://meta.discourse.org/t/where-is-the-currentuser-service-located/392449/4 "2026-01-30T13:17:17Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
