Open shreyasingh25 opened 7 years ago
Well, I can see that moderators are implemented, and that admin functions are bound to the UI here, so can you provide a minimal repro showing what you mean by "not registering"? That could mean just about anything, really.
Note that you do need to make sure you have security rules in place to enforce moderator privs.
What I meant by not registering is that the user doesnt get the moderator privileges. I have noticed that when i refresh the chat, a few fields get highlighted in the realtime database, like the user, room-metadata and user-names-online, but moderators doesn't. This made me wonder if I had set the moderator in the right manner.
About the security rules, I did add for moderator -
Do i need to add these in some other place as well?
Seems like you've done it correctly, from my limited expertise. Got a minimal repro you can share?
This is all I have in place -
var config = { config from firebase console here! };
firebase.initializeApp(config);
function login() { // Log the user in via google var provider = new firebase.auth.GoogleAuthProvider(); firebase.auth().signInWithPopup(provider).catch(function (error) { console.log("Error authenticating user:", error); }); }
firebase.auth().onAuthStateChanged(function (user) { // Once authenticated, instantiate Firechat with the logged in user if (user) { initChat(user); } });
function initChat(user) { // Get a Firebase Database ref var chatRef = firebase.database().ref("chat");
// Create a Firechat instance var chat = new FirechatUI(chatRef, document.getElementById("firechatWrapper")); // Set the Firechat user // user.isModerator = true; chat.setUser(user.uid, user.displayName);
}
Hi! it's been a long time but did you make it work? I'm having the same problem.
Thanks
Hi! it's been a long time but did you make it work? I'm having the same problem.
Thanks
Somehow I did make it work, but idk why. I think I add one more user as moderator and it works (maybe it's because of the firebase itselft). Also don't forget to include firebase-ui.js
How do we make users as moderators. I have tried adding a record with:true under /moderators in my Firebase console, but it isn't registering that user as moderator.
Is there any other way of doing this? Or Am I missing something