Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Display an invitation notice when user is alone #15

Merged
merged 4 commits into from

2 participants

@n1k0
Collaborator

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 mozilla:master

1 check passed

Details default The Travis build passed
@fqueze
Collaborator

r=fqueze

@n1k0 n1k0 deleted the n1k0:invite-message branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 27, 2013
  1. @n1k0
Commits on Mar 28, 2013
  1. @n1k0
  2. @n1k0

    proper use of the chai api

    n1k0 authored
  3. @n1k0

    removed obsolete style rule

    n1k0 authored
This page is out of date. Refresh to see the latest.
View
2  server.js
@@ -35,9 +35,9 @@ server.post('/signin', function(req, res) {
}
while (exists(nick))
nick = findNewNick(nick);
+ res.send(200, JSON.stringify({nick: nick, users: users}));
users.push({nick: nick});
server.set('users', users);
- res.send(200, JSON.stringify({nick: nick, users: users}));
});
server.post('/signout', function(req, res) {
View
1  static/index.html
@@ -30,6 +30,7 @@
</form>
</div>
<div class="span3" id="users">
+ <p id="invite" class="alert hide">You are the only person logged in, invite your friends.</p>
<ul class="nav nav-list">
<li class="nav-header">Online users</li>
<li>Empty room</li>
View
4 static/js/talkilla.js
@@ -86,6 +86,10 @@ var Talkilla = (function($, Backbone) {
render: function() {
var $list = this.$el.find('ul');
$list.find('li:not([class=nav-header])').remove();
+ if (app.data.user && this.collection.length === 0)
+ $('#invite').show();
+ else
+ $('#invite').hide();
this.collection.each(function(user) {
$list.append($('<li/>').text(user.get('nick')));
});
View
4 test/presence_api_test.js
@@ -57,7 +57,7 @@ describe("Server", function() {
signin('foo', function(err, res, body) {
var data = JSON.parse(body);
expect(data.nick).to.eql(nick1);
- expect(data.users).to.eql([{nick: "foo"}]);
+ expect(data.users).to.be.empty;
done();
});
});
@@ -103,7 +103,7 @@ describe("Server", function() {
signin(nick2, function(err, res, body) {
var data = JSON.parse(body);
expect(data.nick).to.eql(nick2);
- expect(data.users).to.eql([{nick: nick1}, {nick: nick2}]);
+ expect(data.users).to.eql([{nick: nick1}]);
done();
});
});
Something went wrong with that request. Please try again.