浏览代码

Fixed merge issues.

Wesley McCann 9 年之前
父节点
当前提交
4817535763
共有 1 个文件被更改,包括 8 次插入21 次删除
  1. 8 21
      app/server/server.js

+ 8 - 21
app/server/server.js

@@ -413,10 +413,6 @@ Meteor.publish("isAdmin", function() {
     return Meteor.users.find({_id: this.userId, "profile.rank": "admin"});
 });
 
-Meteor.publish("isModerator", function() {
-    return Meteor.users.find({_id: this.userId, "profile.rank": "moderator"});
-});
-
 function isAdmin() {
     var userData = Meteor.users.find(Meteor.userId());
     if (Meteor.userId() && userData.count !== 0 && userData.fetch()[0].profile.rank === "admin") {
@@ -426,15 +422,6 @@ function isAdmin() {
     }
 }
 
-function isModerator() {
-    var userData = Meteor.users.find(Meteor.userId());
-    if (Meteor.userId() && userData.count !== 0 && userData.fetch()[0].profile.rank === "moderator") {
-        return true;
-    } else {
-        return isAdmin();
-    }
-}
-
 function isBanned() {
     var userData = Meteor.users.findOne(Meteor.userId());
     if (Meteor.userId() && userData !== undefined && userData.punishments !== undefined && userData.punishments.ban !== undefined) {
@@ -541,8 +528,8 @@ Meteor.methods({
             else if (user.profile.rank === "admin") {
                 Chat.insert({type: type, rawrank: rawrank, rank: "[A]", message: message, time: time, username: username});
                 return true;
-            } 
-            else if (user.profile.rank === "moderator") {
+            }
+            else if (user.profile.rank === "mod") {
                 Chat.insert({type: type, rawrank: rawrank, rank: "[M]", message: message, time: time, username: username});
                 return true;
             }
@@ -728,7 +715,7 @@ Meteor.methods({
         }
     },
     updateQueueSong: function(genre, oldSong, newSong) {
-        if (isModerator() && !isBanned()) {
+        if (isAdmin() && !isBanned()) {
             newSong.mid = oldSong.mid;
             Queues.update({type: genre, "songs": oldSong}, {$set: {"songs.$": newSong}});
             return true;
@@ -737,7 +724,7 @@ Meteor.methods({
         }
     },
     updatePlaylistSong: function(genre, oldSong, newSong) {
-        if (isModerator() && !isBanned()) {
+        if (isAdmin() && !isBanned()) {
             newSong.mid = oldSong.mid;
             Playlists.update({type: genre, "songs": oldSong}, {$set: {"songs.$": newSong}});
             return true;
@@ -746,7 +733,7 @@ Meteor.methods({
         }
     },
     removeSongFromQueue: function(type, mid) {
-        if (isModerator() && !isBanned()) {
+        if (isAdmin() && !isBanned()) {
             type = type.toLowerCase();
             Queues.update({type: type}, {$pull: {songs: {mid: mid}}});
         } else {
@@ -754,7 +741,7 @@ Meteor.methods({
         }
     },
     removeSongFromPlaylist: function(type, mid) {
-        if (isModerator() && !isBanned()) {
+        if (isAdmin() && !isBanned()) {
             type = type.toLowerCase();
             Playlists.update({type: type}, {$pull: {songs: {mid: mid}}});
         } else {
@@ -762,7 +749,7 @@ Meteor.methods({
         }
     },
     addSongToPlaylist: function(type, songData) {
-        if (isModerator() && !isBanned()) {
+        if (isAdmin() && !isBanned()) {
             type = type.toLowerCase();
             if (Rooms.find({type: type}).count() === 1) {
                 if (Playlists.find({type: type}).count() === 0) {
@@ -829,4 +816,4 @@ Meteor.methods({
 
 Meteor.setInterval(function() {
     checkUsersPR();
-}, 10000);
+}, 10000);