-
Notifications
You must be signed in to change notification settings - Fork 28
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
Browsing without login by setting environment variable #93
base: master
Are you sure you want to change the base?
Conversation
kitsuyui
commented
Dec 9, 2017
- Enable readonly browsing when DMEMO_ALLOW_ANONYMOUS_TO_READ is set
- Feature Request: Browsing without login #92
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you write spec?
@@ -4,6 +4,9 @@ class ApplicationController < ActionController::Base | |||
helper_method :current_user | |||
|
|||
before_action :require_login | |||
if ENV.has_key? 'DMEMO_ALLOW_ANONYMOUS_TO_READ' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DMEMO_
prefix is unneccessary.
@favorite_tables = TableMemo.where(id: current_user.favorite_tables.pluck(:table_memo_id)) | ||
else | ||
@favorite_tables = [] | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
app/views/shared/_navbar.html.haml
Outdated
%li | ||
= link_to google_oauth2_path(state: url_for(params.merge(only_path: true))) do | ||
%i.fa.fa-sign-in | ||
Login |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer Sign-in
here.
dmemo using Sign-out
yet https://github.com/hogelog/dmemo/pull/93/files#diff-fdf07dae26df4b84203e7a8380c4fdcaR16
app/views/users/index.html.haml
Outdated
@@ -27,6 +27,6 @@ | |||
- if user.admin? | |||
%i.fa.fa-check | |||
%td | |||
- if current_user.editable_user?(user.id) | |||
- if current_user and current_user.editable_user?(user.id) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like current_user.try!(:editable_user?, user.id)
@hogelog |
@hogelog |
Sorry too late response. Please use context like http://www.betterspecs.org/#contexts and other specs.f |
- Enable readonly browsing when DMEMO_ALLOW_ANONYMOUS_TO_READ is set - Hide favorite tables without login user. - Update RSpec for anonymous login
5c736a2
to
c2e62c0
Compare
I'm sorry to have kept you waiting. I've updated the rspec and rebased these commits. (CI Hakiri shows warning because of Nokogiri v1.10.3 (CVE-2019-11068). |