2
0
Эх сурвалжийг харах

Moved some stuff and fixed mod rank

Yes i know... === not = :/ me a noob
Johand 9 жил өмнө
parent
commit
f893080b26

+ 5 - 1
app/client/templates/room.html

@@ -20,7 +20,7 @@
                         </div>
 
                         <h3 id="room-header">
-                            {{{type}}} <span title="People in this station">({{{users}}})</span>
+                            {{{type}}}
                         </h3>
                         <div id="volume-container">
                             <i class="fa fa-volume-down" id="volume-icon"></i>
@@ -40,6 +40,10 @@
                             <img alt="Not loading" class="song-img" onError="this.src='http://static.boredpanda.com/blog/wp-content/uploads/2014/04/amazing-fox-photos-182.jpg'" id="song-img"/>
                             <h2 class="room-title">{{{title}}} <small id="time-display">(<span id="time-elapsed"></span> / <span id="time-total"></span>)</small></h2>
                             <h2 class="room-artist">{{{artist}}}</h2>
+                            <hr />
+                            <h2 class="room-title">Room statistics:</h2>
+                            <h2 class="room-artist">There is {{{users}}} user(s) online in this room</h2>
+
                         </div>
                     </div>
                     <!--<div class="row" id="settings">-->

+ 8 - 4
app/server/server.js

@@ -474,24 +474,28 @@ Meteor.methods({
     sendMessage: function(type, message) {
         if (Meteor.userId()) {
             var user = Meteor.user();
+            console.log(user);
             var time = new Date();
             var rawrank = user.profile.rank;
             var username = user.profile.username;
-            var rank = user.profile.rank;
             if (!message.replace(/\s/g, "").length > 0) {
                 throw new Meteor.Error(406, "Message length cannot be 0.");
             }
             if (message.length > 300) {
                 throw new Meteor.Error(406, "Message length cannot be more than 300 characters long..");
             }
-            if (user.profile.rank = "admin") {
+            else if (user.profile.rank === "admin") {
+                console.log("Log admin");
                 Chat.insert({type: type, rawrank: rawrank, rank: "[A]", message: message, time: time, username: username});
                 return true;
-            } else if (user.profile.rank = "mod") {
-                Chat.insert({type: type, rank: "[M]", message: message, time: time, username: username});
+            } 
+            else if (user.profile.rank === "mod") {
+                console.log("Log mod");
+                Chat.insert({type: type, rawrank: rawrank, rank: "[M]", message: message, time: time, username: username});
                 return true;
             }
             else {
+                console.log("Log " + rawrank);
                 Chat.insert({type: type, rawrank: rawrank, message: message, time: time, username: username});
                 return true;
             }