Browse Source

Added snowflake image, changed mod to moderator, gave moderator rights to /admin to manage songs.

KrisVos130 9 years ago
parent
commit
55942d78f9

+ 1 - 1
app/client/app.css

@@ -1226,7 +1226,7 @@ nav form input[type="image"]{
     font-size: 20px;
     font-size: 20px;
     font-weight: bold;
     font-weight: bold;
 }
 }
-.rank-mod {
+.rank-mod, .rank-moderator {
     color: darkgoldenrod;
     color: darkgoldenrod;
     font-size: 20px;
     font-size: 20px;
     font-weight: bold;
     font-weight: bold;

+ 15 - 1
app/client/client.js

@@ -171,7 +171,14 @@ Template.header.helpers({
         } else {
         } else {
             return false;
             return false;
         }
         }
-    }
+    },
+    isModerator: function() {
+        if (Meteor.user() && Meteor.user().profile && (Meteor.user().profile.rank === "admin" || Meteor.user().profile.rank === "moderator")) {
+            return true;
+        } else {
+            return false;
+        }
+    },
 });
 });
 
 
 Template.header.events({
 Template.header.events({
@@ -839,6 +846,13 @@ Template.room.helpers({
             return false;
             return false;
         }
         }
     },
     },
+    isModerator: function() {
+        if (Meteor.user() && Meteor.user().profile && (Meteor.user().profile.rank === "admin" || Meteor.user().profile.rank === "moderator")) {
+            return true;
+        } else {
+            return false;
+        }
+    },
     paused: function() {
     paused: function() {
         return Session.get("state") === "paused";
         return Session.get("state") === "paused";
     },
     },

+ 11 - 11
app/client/routes.js

@@ -77,11 +77,11 @@ Router.route("/about", {
 
 
 Router.route("/admin", {
 Router.route("/admin", {
     waitOn: function() {
     waitOn: function() {
-        return Meteor.subscribe("isAdmin", Meteor.userId());
+        return [Meteor.subscribe("isModerator", Meteor.userId()), Meteor.subscribe("isAdmin", Meteor.userId())];
     },
     },
     action: function() {
     action: function() {
         var user = Meteor.users.findOne({});
         var user = Meteor.users.findOne({});
-        if (user !== undefined && user.profile !== undefined && user.profile.rank === "admin") {
+        if (user !== undefined && user.profile !== undefined && (user.profile.rank === "admin" || user.profile.rank === "moderator")) {
             this.render("admin");
             this.render("admin");
         } else {
         } else {
             this.redirect("/");
             this.redirect("/");
@@ -91,25 +91,25 @@ Router.route("/admin", {
 
 
 Router.route("/stations", {
 Router.route("/stations", {
     waitOn: function() {
     waitOn: function() {
-        return Meteor.subscribe("isAdmin", Meteor.userId());
+        return [Meteor.subscribe("isModerator", Meteor.userId()), Meteor.subscribe("isAdmin", Meteor.userId())];
     },
     },
     action: function() {
     action: function() {
-      var user = Meteor.users.findOne({});
-      if (user !== undefined && user.profile !== undefined && user.profile.rank === "admin") {
-          this.render("stations");
-      } else {
-          this.redirect("/");
-      }
+        var user = Meteor.users.findOne({});
+        if (user !== undefined && user.profile !== undefined && (user.profile.rank === "admin" || user.profile.rank === "moderator")) {
+            this.render("stations");
+        } else {
+            this.redirect("/");
+        }
     }
     }
 });
 });
 
 
 Router.route("/admin/alerts", {
 Router.route("/admin/alerts", {
     waitOn: function() {
     waitOn: function() {
-        return Meteor.subscribe("isAdmin", Meteor.userId());
+        return [Meteor.subscribe("isModerator", Meteor.userId()), Meteor.subscribe("isAdmin", Meteor.userId())];
     },
     },
     action: function() {
     action: function() {
         var user = Meteor.users.findOne({});
         var user = Meteor.users.findOne({});
-        if (user !== undefined && user.profile !== undefined && user.profile.rank === "admin") {
+        if (user !== undefined && user.profile !== undefined && (user.profile.rank === "admin" || user.profile.rank === "moderator")) {
             this.render("alertsDashboard");
             this.render("alertsDashboard");
         } else {
         } else {
             this.redirect("/");
             this.redirect("/");

+ 10 - 10
app/client/templates/bubbles.html

@@ -1,14 +1,14 @@
 <template name="bubbles">
 <template name="bubbles">
     <ul class="bg-bubbles">
     <ul class="bg-bubbles">
-        <li><img src="/Snowflake 2.png"/></li>
-        <li><img src="/Snowflake 2.png"/></li>
-        <li><img src="/Snowflake 2.png"/></li>
-        <li><img src="/Snowflake 2.png"/></li>
-        <li><img src="/Snowflake 2.png"/></li>
-        <li><img src="/Snowflake 2.png"/></li>
-        <li><img src="/Snowflake 2.png"/></li>
-        <li><img src="/Snowflake 2.png"/></li>
-        <li><img src="/Snowflake 2.png"/></li>
-        <li><img src="/Snowflake 2.png"/></li>
+        <li><img src="/Snowflake.png"/></li>
+        <li><img src="/Snowflake.png"/></li>
+        <li><img src="/Snowflake.png"/></li>
+        <li><img src="/Snowflake.png"/></li>
+        <li><img src="/Snowflake.png"/></li>
+        <li><img src="/Snowflake.png"/></li>
+        <li><img src="/Snowflake.png"/></li>
+        <li><img src="/Snowflake.png"/></li>
+        <li><img src="/Snowflake.png"/></li>
+        <li><img src="/Snowflake.png"/></li>
     </ul>
     </ul>
 </template>
 </template>

+ 2 - 2
app/client/templates/header.html

@@ -17,8 +17,8 @@
                 <ul class="nav navbar-nav">
                 <ul class="nav navbar-nav">
                     <!--li class="active"><a href="">Link <span class="sr-only">(current)</span></a></li-->
                     <!--li class="active"><a href="">Link <span class="sr-only">(current)</span></a></li-->
                     <li class="{{isActivePath '/'}}"><a href="/">Home</a></li>
                     <li class="{{isActivePath '/'}}"><a href="/">Home</a></li>
-                    {{#if isAdmin}}
-                        <li class="{{isActivePath '/admin'}}"><a href="/admin">Admin</a></li>
+                    {{#if isModerator}}
+                    <li class="{{isActivePath '/admin'}}"><a href="/admin">Admin</a></li>
                     {{/if}}
                     {{/if}}
                 </ul>
                 </ul>
                 {{#if currentUser}}
                 {{#if currentUser}}

+ 19 - 6
app/server/server.js

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