# 用户自行移除了他们自己私信（PM）然后管理员就无法看到他们的私信历史记录了

**URL:** <https://meta.discourse.org/t/users-removed-themselves-from-private-messages-pm-and-then-the-mods-cant-see-their-pm-history/254822>\
**Category:** Bug\
**Tags:** moderation\
**Created:** [2023年二月11日 02:41 UTC](https://meta.discourse.org/t/users-removed-themselves-from-private-messages-pm-and-then-the-mods-cant-see-their-pm-history/254822 "2023-02-11T02:41:48Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![physixfan](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/physixfan/32/184201_2.png) [@physixfan](https://meta.discourse.org/u/physixfan)\
**Post date:** [2023年二月11日 02:41 UTC](https://meta.discourse.org/t/users-removed-themselves-from-private-messages-pm-and-then-the-mods-cant-see-their-pm-history/254822/1 "2023-02-11T02:41:48Z")

</div>

我们发现现在用户可以自行退出私信了。

> [@Removing oneself from private messages](https://meta.discourse.org/t/removing-oneself-from-private-messages/56170/17):
>
> Yes this is definitely done, users can remove themselves from a PM as of version 1.8 I believe.

此功能带来了一个意想不到的后果。我发现我们论坛上有几位用户发送私信分享微信群二维码，这违反了我们的论坛政策。但他们非常聪明，总是在完成后自行退出私信，这样私信记录就消失了。因此，作为版主，我无法再通过查看他们的个人资料来了解他们讨论了什么。这极大地限制了版主执行论坛政策的能力。请修复此问题！

---

<div class="post-metadata">

**Author:** ![nathank](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nathank/32/290039_2.png) [@nathank](https://meta.discourse.org/u/nathank)\
**Post date:** [2023年二月11日 06:20 UTC](https://meta.discourse.org/t/users-removed-themselves-from-private-messages-pm-and-then-the-mods-cant-see-their-pm-history/254822/2 "2023-02-11T06:20:09Z")

</div>

您应该能够使用数据浏览器查询来识别已完成此操作的 PM - 只需关注用户自行移除时发生的自动帖子。

为了更智能，您甚至可以通过徽章查询来自动化它。惯犯将迅速显现！

---

<div class="post-metadata">

**Author:** ![physixfan](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/physixfan/32/184201_2.png) [@physixfan](https://meta.discourse.org/u/physixfan)\
**Post date:** [2023年二月13日 18:26 UTC](https://meta.discourse.org/t/users-removed-themselves-from-private-messages-pm-and-then-the-mods-cant-see-their-pm-history/254822/3 "2023-02-13T18:26:33Z")

</div>

非常感谢！  
我对 SQL 不是很熟悉，您能告诉我应该在 [Data Explorer](https://meta.discourse.org/t/32566?silent=true) 中编写什么 SQL 代码吗？

---

<div class="post-metadata">

**Author:** ![Canapin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/canapin/32/119591_2.png) [@Canapin](https://meta.discourse.org/u/Canapin)\
**Post date:** [2023年二月13日 19:26 UTC](https://meta.discourse.org/t/users-removed-themselves-from-private-messages-pm-and-then-the-mods-cant-see-their-pm-history/254822/4 "2023-02-13T19:26:26Z")

</div>

> [@nathankershaw](#):
>
> just focus on the automated post that occurs when a user removes themselves.

我试过了，似乎没有这样的自动“小动作”帖子或类似的东西。我甚至怀疑数据库中是否有此操作的任何记录。🤔

---

<div class="post-metadata">

**Author:** ![Canapin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/canapin/32/119591_2.png) [@Canapin](https://meta.discourse.org/u/Canapin)\
**Post date:** [2023年二月14日 13:45 UTC](https://meta.discourse.org/t/users-removed-themselves-from-private-messages-pm-and-then-the-mods-cant-see-their-pm-history/254822/5 "2023-02-14T13:45:37Z")

</div>

当用户将自己从群组讨论中移除时，应该有一个小的操作帖子。目前，只有当作者移除自己时才有一个。

我会修复它，完成后会通知你。然后你就可以跟踪这个操作了，无论是通过数据浏览器查询还是自定义插件。 🙂

---

<div class="post-metadata">

**Author:** ![nathank](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nathank/32/290039_2.png) [@nathank](https://meta.discourse.org/u/nathank)\
**Post date:** [2023年二月20日 18:53 UTC](https://meta.discourse.org/t/users-removed-themselves-from-private-messages-pm-and-then-the-mods-cant-see-their-pm-history/254822/7 "2023-02-20T18:53:30Z")

</div>

> [@Canapin](#):
>
> 目前，只有作者自己移除自己时才有一个。

现在从我观察到的情况来看，这确实说得通。对于上述用例（@physixfan，你是否已经解决了某些 SQL 问题？）来说，它可能没问题，但如果能有一个关于那些被移出私人消息的人的良好记录，那将是一个改进。

---

<div class="post-metadata">

**Author:** ![physixfan](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/physixfan/32/184201_2.png) [@physixfan](https://meta.discourse.org/u/physixfan)\
**Post date:** [2023年二月20日 18:56 UTC](https://meta.discourse.org/t/users-removed-themselves-from-private-messages-pm-and-then-the-mods-cant-see-their-pm-history/254822/8 "2023-02-20T18:56:24Z")

</div>

> [@nathankershaw](#):
>
> @physixfan，你已经写出一些SQL了吗？

还没有，我对 Discourse 的数据库结构不熟悉……

---

<div class="post-metadata">

**Author:** ![Canapin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/canapin/32/119591_2.png) [@Canapin](https://meta.discourse.org/u/Canapin)\
**Post date:** [2023年二月20日 21:49 UTC](https://meta.discourse.org/t/users-removed-themselves-from-private-messages-pm-and-then-the-mods-cant-see-their-pm-history/254822/9 "2023-02-20T21:49:57Z")

</div>

> [@nathankershaw](#):
>
> 根据我的观察，这确实说得通。

实际上，内部已确认这是一个漏洞，预计将在未来修复，因此我将该话题移至 #Contribute > Bug 分类 🙂

---

<div class="post-metadata">

**Author:** ![Canapin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/canapin/32/119591_2.png) [@Canapin](https://meta.discourse.org/u/Canapin)\
**Post date:** [2023年三月2日 15:02 UTC](https://meta.discourse.org/t/users-removed-themselves-from-private-messages-pm-and-then-the-mods-cant-see-their-pm-history/254822/10 "2023-03-02T15:02:03Z")

</div>

您好 @physixfan！

如果所有用户都已退出，您仍然无法通过界面跟踪私人消息（并且不在路线图上）。

不过，[此 bug 已修复](https://github.com/discourse/discourse/commit/96d03ea9c0500fc715e8b6f9713488d4d8548aa6)，用户退出私人消息会创建小的操作帖子：

 ![image](https://global.discourse-cdn.com/meta/original/4X/3/f/c/3fc0e0ef7d2e1a05ccfa16a0e4649680d4f83378.png)

请记住更新 Discourse 以应用修复程序，并在您仍需要跟踪这些操作时安装数据探索器。

有效的 SQL 查询将是：

```sql
SELECT user_id, topic_id
FROM posts
WHERE action_code = 'user_left'
ORDER BY id DESC
LIMIT 10

```

---

<div class="post-metadata">

**Author:** ![Canapin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/canapin/32/119591_2.png) [@Canapin](https://meta.discourse.org/u/Canapin)\
**Post date:** [2023年三月2日 21:02 UTC](https://meta.discourse.org/t/users-removed-themselves-from-private-messages-pm-and-then-the-mods-cant-see-their-pm-history/254822/11 "2023-03-02T21:02:21Z")

</div>

此主题在 6 小时后自动关闭。不再允许回复。
