Unable to ignore user using API

Hello friends,

I am building a mobile forum app using Discourse API, and Google requires all apps with UGC to have a blocking feature.

I’ve done some research and it looks like Discourse lets a user ignore another user, which would satisfy this requirement.

However, when I use the following API to ignore a user, I got a 422 error that says “Sorry, you can’t ignore that user.” for any user that I tried ignoring.

u/{username}/notification_level.json
with
notification_level=ignore

Does anyone know why this is happening?

Thanks in advance and best,
Chris

Hello and welcome @chrisbai2021 :slight_smile:

The ignore feature is Trust Level based, so it could be that your test user is not at TL2 yet (the default level to use that feature).

You also can’t ignore admins and mods, so it would also depend on who you’re trying to ignore. :slight_smile:

3 Likes

Hi @JammyDodger, thanks for the quick reply.

That makes sense - I guess this means we need to default everyone to at least TL2 upon signup in order to be compliant with Google…

Thanks again!

Alternatively, you can adjust the min trust level to allow ignore setting:

There’s also a ‘mute’ feature that may be of interest to you as well, depending on what you need. That’s available to everyone.

And here’s a topic of lots of features and their trust levels, plus the admin settings connected to them: :slight_smile: :+1: Trust Level Permissions Table (inc Moderator Roles)

2 Likes

Ah awesome, thanks for these pointers!

I tried making myself a TL2 + lowering min trust level to allow ignore to TL0. However, I am now getting a 500 error.

To test things, I changed the supplied notification_level to mute and the request succeeded.

I wonder if there’s a site setting for allowing ignoring as a feature at all… been search in admin settings and seen nothing so far…

Oh, i think i might need to supply a expiring_at

1 Like

Looking at the request that gets sent through when I perform the action in the UI, you may need to add the timeframe:

Edit:

Ah, you beat me to it. :slight_smile:

1 Like

Amazing, thank you! This is super helpful :slight_smile:

1 Like

This worked!! But I have one last question…

It looks like posts by ignored users are hidden, but not topics… this seems to be the case in the web UI as well. Is this expected?

Ah, I guess I need to use ignored_usernames in the user object to implement the hiding behavior :slight_smile: