Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Display an invitation notice when user is alone #15

Merged
merged 4 commits into from over 1 year ago

2 participants

Nicolas Perriault fqueze
Nicolas Perriault
Collaborator
n1k0 commented

As @fqueze noticed:

So the "As the first user logged in, I see a message that I am the only person logged in, and see an offer to invite friends" story is no longer done, then?

So here's a patch for fixing this issue.

r=@fqueze

fqueze fqueze merged commit 569dd40 into from
fqueze fqueze closed this
fqueze
Collaborator

r=fqueze

Nicolas Perriault n1k0 deleted the branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
2  server.js
@@ -35,9 +35,9 @@ server.post('/signin', function(req, res) {
35 35 }
36 36 while (exists(nick))
37 37 nick = findNewNick(nick);
  38 + res.send(200, JSON.stringify({nick: nick, users: users}));
38 39 users.push({nick: nick});
39 40 server.set('users', users);
40   - res.send(200, JSON.stringify({nick: nick, users: users}));
41 41 });
42 42
43 43 server.post('/signout', function(req, res) {
1  static/index.html
@@ -30,6 +30,7 @@
30 30 </form>
31 31 </div>
32 32 <div class="span3" id="users">
  33 + <p id="invite" class="alert hide">You are the only person logged in, invite your friends.</p>
33 34 <ul class="nav nav-list">
34 35 <li class="nav-header">Online users</li>
35 36 <li>Empty room</li>
4 static/js/talkilla.js
@@ -86,6 +86,10 @@ var Talkilla = (function($, Backbone) {
86 86 render: function() {
87 87 var $list = this.$el.find('ul');
88 88 $list.find('li:not([class=nav-header])').remove();
  89 + if (app.data.user && this.collection.length === 0)
  90 + $('#invite').show();
  91 + else
  92 + $('#invite').hide();
89 93 this.collection.each(function(user) {
90 94 $list.append($('<li/>').text(user.get('nick')));
91 95 });
4 test/presence_api_test.js
@@ -57,7 +57,7 @@ describe("Server", function() {
57 57 signin('foo', function(err, res, body) {
58 58 var data = JSON.parse(body);
59 59 expect(data.nick).to.eql(nick1);
60   - expect(data.users).to.eql([{nick: "foo"}]);
  60 + expect(data.users).to.be.empty;
61 61 done();
62 62 });
63 63 });
@@ -103,7 +103,7 @@ describe("Server", function() {
103 103 signin(nick2, function(err, res, body) {
104 104 var data = JSON.parse(body);
105 105 expect(data.nick).to.eql(nick2);
106   - expect(data.users).to.eql([{nick: nick1}, {nick: nick2}]);
  106 + expect(data.users).to.eql([{nick: nick1}]);
107 107 done();
108 108 });
109 109 });

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.