Browse Source

Fixed issue where people who weren't moderator/admin couldn't visit a room.

KrisVos130 9 years ago
parent
commit
4783f29f7b
1 changed files with 3 additions and 2 deletions
  1. 3 2
      app/client/routes.js

+ 3 - 2
app/client/routes.js

@@ -132,11 +132,12 @@ Router.route("/admin/alerts", {
 
 Router.route("/:type", {
     waitOn: function() {
-        return [Meteor.subscribe("isModerator", Meteor.userId()), Meteor.subscribe("isAdmin", Meteor.userId())];
+        return [Meteor.subscribe("isModerator", Meteor.userId()), Meteor.subscribe("isAdmin", Meteor.userId()), Meteor.subscribe("rooms")];
     },
     action: function() {
         var user = Meteor.users.findOne({});
-        if (user !== undefined && user.profile !== undefined && (user.profile.rank === "admin" || user.profile.rank === "moderator")) {
+        var room = Rooms.findOne({type: this.params.type});
+        if ((room.private === true && user !== undefined && user.profile !== undefined && (user.profile.rank === "admin" || user.profile.rank === "moderator")) || room.private === false) {
             this.render("room");
         } else {
             this.redirect("/");