Permalink
Browse files

stop showing votes for voters

  • Loading branch information...
1 parent abda4ce commit 994ebac0fd89e68a2cb39f42002c4b04efcc685c @gerad gerad committed Nov 17, 2012
Showing with 27 additions and 22 deletions.
  1. +5 −1 controllers/middleware.coffee
  2. +22 −21 views/teams/votes.jade
@@ -76,8 +76,12 @@ module.exports =
loadTeamVotes: (req, res, next) ->
query = teamId: req.team.id
# exclude my vote from the vote list on the team page
- if req.user
+ if req.user && !req.user.voter
query.personId = $ne: req.user.id
+ else
+ req.publicVotes = []
+ req.votes = []
+ return next()
Vote.find query, {}, { sort: [['updatedAt', -1]] }, (err, votes) ->
return next err if err
publicVotes = []
View
@@ -8,24 +8,25 @@ h2 Your Vote
- if (req.user)
p: a( href='/people/' + req.user + '#votes' ) View all your votes →
-h2 Other Votes
-if publicVotes.length
- ul.votes
- li.vote
- .info.hearts
- - each vote in publicVotes
- img.heart( src='/images/iframe/heart.png' )
- | (#{publicVotes.length})
- .people
- - each vote in publicVotes
- - if (vote.person)
- a( href='/people/' + vote.person, title=vote.person.login )
- img.avatar( src=avatar_url(vote.person, 30) )
-if shouldShowVoteList
- ul.votes
- if canSeeVotes
- != partial('votes/vote', votes)
- else
- li Votes are hidden.
- a( href='#votes' ) Vote on this entry
- | to reveal them.
+if votes.length || publicVotes.length
+ h2 Other Votes
+ if publicVotes.length
+ ul.votes
+ li.vote
+ .info.hearts
+ - each vote in publicVotes
+ img.heart( src='/images/iframe/heart.png' )
+ | (#{publicVotes.length})
+ .people
+ - each vote in publicVotes
+ - if (vote.person)
+ a( href='/people/' + vote.person, title=vote.person.login )
+ img.avatar( src=avatar_url(vote.person, 30) )
+ if shouldShowVoteList
+ ul.votes
+ if canSeeVotes
+ != partial('votes/vote', votes)
+ else
+ li Votes are hidden.
+ a( href='#votes' ) Vote on this entry
+ | to reveal them.

0 comments on commit 994ebac

Please sign in to comment.