In my app’s database, I have Users and I have Posts.
Posts are created by Users.
The User datatype has a field Posts are Private = yes / no
I want the User to be able to choose whether their Posts are public (and viewable by all other Users) or private (and viewable only by them).
Initially, I wanted to use a Privacy Rule like this: This Post’s User’s Posts are Private is yes"… to restrict access.
It seems like that isn’t possible.
I am trying to avoid adding a field to Post like Post is Private that I would need to update every time a User changes their Posts are Private field. I’m imagining a User flipping their privacy on and off and backend workflows or database triggers flying all over the place trying to update thousands of Posts. Sounds like a nightmare.
I am considering doing it via restrictions in a search.
I’m not that familiar with nested searches. Is this a bad idea for performance or WUs? Wondering if there is something I haven’t considered, or if there might be a better way to achieve this “privacy setting”.
Avoid nested search as much as possible it is bad for peformance. Take a hard look at your database most of times nested searches can be avoided just by creating some extra datatypes
This is probably best route to go. It’s not as complex as you think it is. If you really want to solve it you could do a recursive workflow that goes through all the posts and edits them. Have a field ‘postVisibilityModifying’ yes/no. When the workflow kicks off, set it to yes. When it’s done, set it to no. Don’t allow the user to adjust the visibility if it’s set to yes.
There’s probably a better obvious solution I’ve missed…