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

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

KrisVos130 9 жил өмнө
parent
commit
84b5fee281

+ 1 - 0
app/.meteor/packages

@@ -30,3 +30,4 @@ http
 zimme:iron-router-active
 momentjs:moment
 copleykj:livestamp
+emojione:emojione

+ 1 - 0
app/.meteor/versions

@@ -30,6 +30,7 @@ ecmascript@0.1.6
 ecmascript-runtime@0.2.6
 ejson@1.0.7
 email@1.0.8
+emojione:emojione@1.5.2
 es5-shim@4.1.14
 facebook@1.2.2
 fastclick@1.0.7

+ 1 - 1
app/client/client.js

@@ -362,7 +362,7 @@ Template.room.events({
     "keyup #chat-input": function(e) {
         if (e.type == "keyup" && e.which == 13) {
             e.preventDefault();
-            sendMessage();
+            sendMessage()
         }
     },
     "click #like": function(e) {

+ 8 - 2
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">-->
@@ -109,7 +113,9 @@
                         <div class="tab-pane" id="chat">
                             <ul id="chat-ul">
                                 {{#each chat}}
-                                    <li class="chat-message"><small class="rank-{{this.rawrank}}">{{this.rank}}</small> <a style="text-decoration: none" href="/u/{{this.username}}" target="_blank"><b class="bold">{{this.username}}</b></a> <span data-livestamp="{{time}}" title="{{time}}" style="float: right;"></span> <br/>{{this.message}}</li>
+                                    {{#emojione}}
+                                        <li class="chat-message"><small class="rank-{{this.rawrank}}">{{this.rank}}</small> <a style="text-decoration: none" href="/u/{{this.username}}" target="_blank"><b class="bold">{{this.username}}</b></a> <span data-livestamp="{{time}}" title="{{time}}" style="float: right;"></span> <br/>{{this.message}}</li>
+                                    {{/emojione}}
                                     <hr>
                                 {{/each}}
                             </ul>

+ 9 - 4
app/server/server.js

@@ -8,6 +8,7 @@ Meteor.startup(function() {
             createRoom(stations[i].display, stations[i].tag);
         }
     }
+    emojione.ascii = true;
 });
 
 Alerts.update({active: true}, {$set: {active: false}}, { multi: true });
@@ -496,24 +497,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;
             }