I am using firebase as a backend for my Android App. And this app is a social media app where users can post, comment & like. so I am storing user data in user_collection
and this collection is secured by security rules where if uid == auth.uid
(any user can only access data of himself).
Now in this app when a user post something every user can see this post. And in post_collection I am saving userId in post_doc.
So the problem is I need to show name of user to other users and I have only userId but the problem is a user can't get name of other user by uid beacuse of security rules. now I have to solutions for this please tell me which one is better or you can also suggest any other solutions also?
I can use cloud functions
getUserNameById()
(Problem : I need to call this function very frequently in feed when user scroll)I can store name also in
post_doc
(problem : when user changes his name then It will show old name in old post)
Thanks for you kind help