Filter posts by blocked users

In my social networking app, I need a way for users to block other users & their posts (in a list of all posts).

I’ve seen several topics on following Appstore rules for User Generated Content, e.g., filtering the list of users to exclude blocked users. Tried a similar approach but to no avail.

How can I do that? Sure seems like a simple one :slight_smile:

So you need a couple of relationships between users.

For example ‘myblocklist’ relationship and ‘blockedby’

Filter the list something like this:
Post > Post creator > MyBlockList > does not include > logged in user.
Post > Post creator > BlockedBy > does not include > logged in user

That covers both sides of the blocking equation

I thought along those lines, but am having trouble executing

This is what I get when trying to add the filter such as:
Current Post > Posting user > BlockedBy > does not include > logged in user

There’s no “BlockedBy > All” list, so I cannot choose “does not include > logged in user”

I think you need to set these up as many-to-many relationships.

Tried that. It does work in terms of filtering.

However, blocking becomes mutual - if User1 blocks User2, then User1 is automatically becomes blocked by User2.

Thanks a lot for your responses!

Surprised though that it’s not some ready-made feature - AppStore requires EVERY app with user-generated content to have that functionality.


It’s a bit of a fiddle. As app makers, we do need to distinguish between who is the blocked user and who is the blocker though, as people’s functionality will vary.

I see. What do you suggest then?

I do it exactly as I described here, I don’t know a shortcut at the moment, but I’d also be interested to hear if other makers have found a better solution.

You mean to leave it as mutual blocking? Maybe you’re right it’s better than nothing…

It isn’t quite mutual blocking, it’s more that if you block someone, you shouldn’t be able to see their stuff either (that seems a bit unfair for the users).

That’s why I implement both relationships, because in my apps I don’t want users to block someone yet still be able to see all of their stuff.

not sure I got what you mean(

that’s what happens as I see it:

  • say BlockedBy is an m2m relationship
  • User1 blocks User2 > User1 is in User2’s BlockedBy list
  • User1 won’t see User2’s posts, because the filter is “Current Post > Posting User (User2) > BolckedBy > does not include > logged in user”
  • because it’s an m2m, User2 is also in User1’s BlockedBy list
  • User2 won’t see User1’s posts

…and I don’t want it to happen - I want User2 to see User1’s posts!


thanx a lot for your help!

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