# התראות "יש לאשר משתמשים" מופעלות בטעות על ידי משתמשים קיימים

**URL:** https://meta.discourse.org/t/must-approve-users-notifications-are-incorrectly-triggered-by-old-users/240731
**Category:** Bug
**Created:** [3 באוקטובר,‏ 2022,‏ 12:35pm UTC](https://meta.discourse.org/t/must-approve-users-notifications-are-incorrectly-triggered-by-old-users/240731 "2022-10-03T12:35:44Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![InterAction\_studios](https://avatars.discourse-cdn.com/v4/letter/i/cdc98d/32.png) [@InterAction\_studios](https://meta.discourse.org/u/InterAction_studios)
#### Post date: [3 באוקטובר,‏ 2022,‏ 12:35pm UTC](https://meta.discourse.org/t/must-approve-users-notifications-are-incorrectly-triggered-by-old-users/240731/1 "2022-10-03T12:35:44Z")

</div>

During the past few weeks, certain problematic (banned) users have been creating accounts with offensive/inappropriate usernames. To prevent this, I have turned on the setting marked **“Staff must approve all new user accounts before they are allowed to access the site.”** and it does indeed require approval for all **new** accounts.

However, rather annoyingly, every few hours I am also notified of “users waiting for approval” for old users that **joined months or even years ago** , way before this setting was even activated.

 ![image](https://global.discourse-cdn.com/meta/original/4X/9/2/2/922d88722193be6135e2c698191d0059dd308380.png)

Clicking on the notification I see:

> `There are new user signups waiting to be approved (or rejected) before they can access this forum. Please review them.`

… but clicking on “Please review them” shows that there aren’t any:

> `There are no items to review.`

Searching down the list `admin/users/list/new`, **I see that some users are indeed listed as “not approved”**. I can’t find any commonalities between these “not approved” users except the fact that all of them were created before the setting was toggled. Some of them have “primary email: Not verified”, while others are verified.

I tried to approve each one manually, but I need to scroll back several hundred “pages” and I don’t see an easy way to filter the list by “not approved”.

Is there a quick way to mark every single existing user as “approved”? Or at least prevent the notifications about these old users from being sent out?

---

<div class="post-metadata">

### Author: ![Ed\_S](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ed_s/32/134015_2.png) [@Ed\_S](https://meta.discourse.org/u/Ed_S)
#### Post date: [11 באוקטובר,‏ 2022,‏ 2:56pm UTC](https://meta.discourse.org/t/must-approve-users-notifications-are-incorrectly-triggered-by-old-users/240731/2 "2022-10-11T14:56:26Z")

</div>

Are you still suffering from this?

---

<div class="post-metadata">

### Author: ![InterAction\_studios](https://avatars.discourse-cdn.com/v4/letter/i/cdc98d/32.png) [@InterAction\_studios](https://meta.discourse.org/u/InterAction_studios)
#### Post date: [12 באוקטובר,‏ 2022,‏ 11:53am UTC](https://meta.discourse.org/t/must-approve-users-notifications-are-incorrectly-triggered-by-old-users/240731/3 "2022-10-12T11:53:08Z")

</div>

In the end I bit the bullet and scrolled down the entire list of users (manually looking for ones that had “Approved: No”), then entered each one’s profile and approved them individually :sweat:

---

<div class="post-metadata">

### Author: ![Moin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/moin/32/554653_2.png) [@Moin](https://meta.discourse.org/u/Moin)
#### Post date: [20 באפריל,‏ 2024,‏ 2:08pm UTC](https://meta.discourse.org/t/must-approve-users-notifications-are-incorrectly-triggered-by-old-users/240731/4 "2024-04-20T14:08:37Z")

</div>

I noticed the same behaviour and I think I found out why this happens (not why thoses users do not appear in the review queue but why they were not approved at all):

As I understand the code[[1]](#footnote-1501220-1) when you enable ‘must\_approve\_users’, most users who were created before the setting was enabled should be approved:

> <https://github.com/discourse/discourse/blob/a564274ba277a834b8a3ab4c28b2c1022fd9521e/config/initializers/014-track-setting-changes.rb#L8-L16>

This worked for most of my users, but some were not marked as approved.

> **Data Explorer Query**
>
> ```plaintext
> SELECT
> id as UserID, approved
> FROM
> users
> ORDER BY id
> 
> ```

| UserID | Approved |
| --- | --- |
| 1 | true |
| 3 | true |
| … | … |
| 8 | true |
| 10 | false |
| 11 | false |
| 12 | false |
| 13 | true |

When you look at the reviewables table you can notice that users with a user ID matching the target ID of a chat message were not approved.

> **Data Explorer Query**
>
> ```plaintext
> SELECT id, target_id, target_type
> FROM reviewables
> ORDER BY target_id
> 
> ```

| id | target\_id | target\_type |
| --- | --- | --- |
| 6 | 9 | ChatMessage |
| 7 | 10 | ChatMessage |
| 8 | 11 | ChatMessage |
| 9 | 12 | ChatMessage |
| 1 | 2901 | Post |
| 2 | 2909 | Post |
| 5 | 2991 | Post |

I think it’s a bug that users aren’t approved when there is a matching target ID that has a target type different than ‘user’.

* * *

1. I have hardly any programming skills [↩︎](#footnote-ref-1501220-1)
