0

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"}
Eye Lamp
  • 69
  • 5
  • 1
    Why not disable anonymous auth and delete the user altogether? Besides, it is hard to understand why you don't just add a users node, or at least a banned users node, which would have their UID. – Martin Zeitler Dec 17 '21 at 05:59
  • I'm using google auth. If the blocking function removes the user, certain users can delete innocence users. – Eye Lamp Dec 17 '21 at 06:04
  • Yes you are right. I'will add a banned users node. and when I completed it I'll edit my question. – Eye Lamp Dec 17 '21 at 06:04
  • @MartinZeitler I edited it. Can you give me a advice plz? – Eye Lamp Dec 17 '21 at 07:33

0 Answers0