Ok, I'm Stuck. Blocking Users

As many of you know if you make an app that allows users to upload pictures and whatnot, Apple requires that you also be able to block users.

I cant figure this one out. Not sure what is stumping me, and I know it can be done, but i’m just hitting a roadblock here.

Any help would be greatly appreciated!

Hi Bobby,

This is pretty easy.

In your user’s collection, create a true/false property called “Blocked?”

image

Blocking Users By Actions

If Logged In User > Blocked is false, link them to the “Create Post” screen. If Blocked is true, DON"T link them to the “Create Post” Screen. (link them to a screen that says they are blocked.

image

Blocking Users By Visibilty Conditions

This text will show when the Logged In User is TRUE.

image

Blocking Users By List Filtering

This list will ONLY show if the user Blocked > is false.
image

How to Block Users

First, you update the user.

image

Then, you update the “Blocked?” true/false property to TRUE.

image

I hope this helps! Good luck with your app!

James,

Thanks. But I think the requirement is that users can block each other. Happen to have a solution for that?

Sorry, I should have been more clear.

So do you mean if User A goes on User B’s profile, User A can block User B’s profile?

If I don’t understand what you mean, can you give me a use case?

Exactly.

Basically Apple wants that If User A is harassed by User B then User A can block User B from contacting them, or even seeing their profile.

Now I know what you mean. :slight_smile:

Let me try to wrap my head around this

Thanks!

Ive been trying for a bit. I know it’s possible, but i’m just fried at the moment :smiley:

1 Like

How about having a one-to-many relationship, e.g. User A blocks (B and C).

And then filter the shown users, so that the user X email (or id) is not part of the blocked users of the current user.

E.g. Email (id) /is not equal to / Logged in User’s / blocked / email (id)

A one to many user/user relationship?

Yes, since user X can block users A, B, C, …

I could be wrong, but when its a user/user relationship the only way to add multiple users to that field is a many/many relationship, which ive tried and doesnt work our right.

Hi Bobby :wave:

Like this?

Thank you

It works with my sample app.

Many-to-many is better, if user A blocks B, then both block each other.

However, a one-direction block, e.g. A blocks B, but B doesn’t block B, would be a one-to-many relationship.

So you use two, many to many fields… Let me try that out!

1 Like

Hey Bobby,

I’m almost complete with the cloneable.

You can check it out here: (click “Block user to see”)

2 Likes

Thanks, James.

Let me ask you this. Using this method, how would you filter a list of users so that you cannot see any of the users that have you blocked or that you have blocked.

I think I got it… When I blocked the user i was only updating the logged in user, with the user im blocking, I also need to update the current user’s “users blocking me”

What a pain :smiley:

Thank you all!

2 Likes

Your Welcome Bobby! Happy to help!

All the best with your app :facepunch:

1 Like

Glad that’s sorted.

I was going to suggest checking the followers tutorial on YouTube and adapt that to blocking users.

2 Likes

Yeah, I dont know why a double relationship never occurred to me.