Created
August 5, 2015 15:01
-
-
Save EmielM/ce40024c27a3a701bb66 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/client.coffee b/client.coffee | |
index 37b7239..a5eb7b9 100644 | |
--- a/client.coffee | |
+++ b/client.coffee | |
@@ -49,7 +49,10 @@ exports.render = !-> | |
Dom.div !-> | |
Dom.cls 'chat-info' | |
- Dom.text tr("Anonymous coward") | |
+ if userId = msg.get('userId') | |
+ Dom.text Plugin.userName(userId) | |
+ else | |
+ Dom.text tr("Anonymous coward") | |
Dom.text " • " | |
if time = msg.get('time') | |
Time.deltaText time, 'short' | |
diff --git a/server.coffee b/server.coffee | |
index 8e8e72e..3631655 100644 | |
--- a/server.coffee | |
+++ b/server.coffee | |
@@ -20,6 +20,9 @@ exports.onPhoto = (info, delay) !-> | |
post = (msg, eventText) !-> | |
msg.time = Math.floor(Date.now()*.001) | |
+ if Math.random() < .2 and userId = Plugin.userId() | |
+ msg.userId = userId | |
+ | |
id = Db.shared.modify 'maxId', (v) -> (v||0)+1 | |
Db.shared.set Math.floor(id/100), id%100, msg |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment