Display vote name even when unauthenticated
For example, when sharing the link in messaging apps.
This commit is contained in:
parent
33bc3e1446
commit
45c8e9b6b4
3 changed files with 33 additions and 11 deletions
25
vedia.rb
25
vedia.rb
|
|
@ -317,22 +317,25 @@ post '/votes/new' do
|
|||
end
|
||||
|
||||
get '/votes/:id' do
|
||||
require_login
|
||||
find_vote
|
||||
if not @vote
|
||||
erb :votes_show_unknown
|
||||
else
|
||||
case @vote.state
|
||||
when 'draft'
|
||||
if @vote.users.exists?(current_user.id)
|
||||
erb :votes_edit
|
||||
else
|
||||
erb :votes_show_draft
|
||||
if not current_user
|
||||
erb :votes_show_unauthenticated
|
||||
else
|
||||
case @vote.state
|
||||
when 'draft'
|
||||
if @vote.users.exists?(current_user.id)
|
||||
erb :votes_edit
|
||||
else
|
||||
erb :votes_show_draft
|
||||
end
|
||||
when 'open'
|
||||
erb :votes_show_open
|
||||
when 'closed'
|
||||
erb :votes_show_closed
|
||||
end
|
||||
when 'open'
|
||||
erb :votes_show_open
|
||||
when 'closed'
|
||||
erb :votes_show_closed
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue