I want to make a app. -> When user a blocks user b user a immediately can't see user b's posts or comments
My structure data doesn't have Users node. Because I'm making app simply.
"Comment" : {
"-MptDdCq-j5JAuqgHkGt" : {
"-Mq8JFEZ5gdJhYIpQ4Vm" : {
"content" : "1",
"timestamp" : 1638686327979,
"uid" : "",
"uimg" : "",
"uname" : ""
}
}
"Posts" : {
"-Mqsc-nqUAOWNb9_kSvl" : {
"description" : "",
"picture" : "",
"postKey" : "-Mqsc-nqUAOWNb9_kSvl",
"timeStamp" : 1639480036785,
"title" : "",
"userId" : "",
"userPhoto" : ""
},
"-MqshZSrx0aO8OPMGC2M" : {
"description" : "",
"picture" : "",
"postKey" : "-MqshZSrx0aO8OPMGC2M",
"timeStamp" : 1639481493534,
"title" : "",
"userId" : "",
"userPhoto" : ""
}
Here is my structure. Can I make a blocking function without Users node?
I learned solution by How to block users on Firebase in a social media app? for iOS
But that solution needs Users node.. Is there no other way?
I updated BlockUser node.
Here is a new structure.
"BlockUser" : {
"k1kn0JF5idhrMzuw46GarEIBgPw2" : "OMBueDmbXdQhePnVaVH2teyOGzl2",
"kVAREcjmrHgLlvOldJetBCoiLx93" : "kVAREXdQhePnVaVH2JetBCoiLx93"}
left part is user id who blocks and right part is user id who have been blocked.
Then can I make block user function? Using firebase rules.
My firebase rule
"rules": {
".read": "auth.uid != null",
".write": "auth.uid != null"}