소스 검색

Merge branch 'master' of https://github.com/Musare/Musare

KrisVos130 9 년 전
부모
커밋
33316e7ee1
2개의 변경된 파일23개의 추가작업 그리고 1개의 파일을 삭제
  1. 12 0
      app/client/client.js
  2. 11 1
      app/client/routes.js

+ 12 - 0
app/client/client.js

@@ -361,6 +361,18 @@ Template.dashboard.onCreated(function() {
     Session.set("type", undefined);
 });
 
+Template.dashboard.onRendered(function(){
+    Rooms.find().fetch().forEach(function(room){
+        if(room.private === true){
+            $(".station h3").each(function(i, el){
+                if($(el).text() === room.display && Meteor.user().profile.rank !== "admin"){
+                    $(el).parent().css("display", "none");
+                }
+            })
+        }
+    })
+})
+
 function executeCommand(command, params){
     if (command === "help" || command === "commands") {
         $('#helpModal').modal('show');

+ 11 - 1
app/client/routes.js

@@ -131,7 +131,17 @@ Router.route("/admin/alerts", {
 });
 
 Router.route("/:type", {
-    template: "room"
+    waitOn: function() {
+        return [Meteor.subscribe("isModerator", Meteor.userId()), Meteor.subscribe("isAdmin", Meteor.userId())];
+    },
+    action: function() {
+        var user = Meteor.users.findOne({});
+        if (user !== undefined && user.profile !== undefined && (user.profile.rank === "admin" || user.profile.rank === "moderator")) {
+            this.render("room");
+        } else {
+            this.redirect("/");
+        }
+    }
 });
 
 Router.route("/u/:user", {