Browsing without login by setting environment variable#93
Browsing without login by setting environment variable#93kitsuyui wants to merge 1 commit intocookpad:masterfrom
Conversation
kitsuyui
commented
Dec 9, 2017
- Enable readonly browsing when DMEMO_ALLOW_ANONYMOUS_TO_READ is set
- Feature Request: Browsing without login #92
| helper_method :current_user | ||
|
|
||
| before_action :require_login | ||
| if ENV.has_key? 'DMEMO_ALLOW_ANONYMOUS_TO_READ' |
There was a problem hiding this comment.
DMEMO_ prefix is unneccessary.
| @favorite_tables = TableMemo.where(id: current_user.favorite_tables.pluck(:table_memo_id)) | ||
| else | ||
| @favorite_tables = [] | ||
| end |
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.
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
| %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.
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). |
