Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix logged_in_as in controllers #5677

Merged
merged 5 commits into from
May 7, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -194,4 +194,15 @@ def signed_in?
def page_not_found
render file: "#{Rails.root}/public/404.html", layout: false, status: :not_found
end

# TODO: make less redundant with https://github.com/publiclab/plots2/blob/master/app/helpers/application_helper.rb#L3
def logged_in_as(roles)
return false unless current_user

has_valid_role = false
roles.each do |role|
has_valid_role = true if current_user.role == role
end
has_valid_role
end
end
2 changes: 1 addition & 1 deletion app/views/stats/subscriptions.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<th>Tags</th>
</thead>
</tr>
<% @tags.reverse.each do |range,tags| %>
<% @tags.reverse_each do |range,tags| %>
<tr>
<td>
<%= range * 10 %> - <%= range * 10 + 9 %>
Expand Down
2 changes: 1 addition & 1 deletion test/system/post_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def setup

visit '/post'

fill_in("Title", with: "My new post")
fill_in("Title", with: "My new post", wait: 4)

el = find(".wk-wysiwyg") # rich text input
el.set("All about this interesting stuff")
Expand Down