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!
This is pretty easy.
In your user’s collection, create a true/false property called “Blocked?”
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.
Blocking Users By Visibilty Conditions
This text will show when the Logged In User is TRUE.
Blocking Users By List Filtering
This list will ONLY show if the user Blocked > is false.
How to Block Users
First, you update the user.
Then, you update the “Blocked?” true/false property to TRUE.
I hope this helps! Good luck with your app!
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?
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.
Let me try to wrap my head around this
Ive been trying for a bit. I know it’s possible, but i’m just fried at the moment
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
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.
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!
I’m almost complete with the cloneable.
You can check it out here: (click “Block user to see”)
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
Thank you all!
Your Welcome Bobby! Happy to help!
All the best with your app
Glad that’s sorted.
I was going to suggest checking the followers tutorial on YouTube and adapt that to blocking users.
Yeah, I dont know why a double relationship never occurred to me.