-
Notifications
You must be signed in to change notification settings - Fork 356
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 session[:edit] breakage in picture controller. #2756
Conversation
632e3c9
to
7eeba19
Compare
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.
Looks good to me . . . I wasn't aware that picture controller wasn't ACTUALLY involved in the edit session, so I like this fix . . . pending testing of course.
When picture controller is accessed the current content of session[:edit] is lost. This is due to asymetry in get_global_session_data vs set_global_session_data. One side always sets the session[:edit] while the other does not always read it. Furthemor the logic of {set/get}_global_session_data is not needed in the picture controller.
7eeba19
to
612b95d
Compare
Push forced to fix deprecation warning. |
Checked commit martinpovolny@612b95d with ruby 2.3.3, rubocop 0.47.1, haml-lint 0.20.0, and yamllint 1.10.0 app/controllers/picture_controller.rb
|
@martinpovolny First off, thank you for making the fix in the I have no idea why you closed my PR (#2747), when you could have suggested me this solution in my PR (#2747) itself. P.S. Going forward, please do not close my PRs without my knowledge. Thanks. |
@martinpovolny Verified in the UI that the fix works. I'm still thinking about the spec... context 'skip_before_action :get_global_session_data / skip_after_action :set_global_session_data' do
before do
session[:edit] = "abc"
end
it 'retains the existing value of session[:edit] after the GET request' do
get :show, :params => { :basename => "#{picture.compressed_id}.#{picture.extension}" }
expect(session[:edit]).to eq("abc")
expect(response.status).to eq(200)
end
end If you like it, add it to the PR. |
@AparnaKarve : My comment in your PR pointed out the 2 problematic lines. Yes, the solution was to avoid the 2 problematic lines. I did not say "Go into the ApplicationController and HACK IT there." I fixed the issue by actually removing code from the execution path in the What I am trying to explain to you (not only in this PR) is that fixing problematic places in code by adding lines that compensate around that in other places is bad. It's soooo bad, it's really a road to hell. This is our constant missunderstanding and source of friction although I honestly try to explain that from different angles. At the time of writing the original comment I did not know that the best way to avoid the problematic lines is to avoid the whole before/after action. To know that I needed to:
I did that only after you wrote that you refuse to search for a proper fix and I should go and do it myself. At that point the simplest for me is to write As for closing your PR. I apologize again. I wanted to avoid this long discussion by making a full stop. It was not a good idea and we probably need to tell all these things and make it straight and clear. |
yes, that makes perfect sense. Please, do. |
@martinpovolny Thanks for the clarification above - #2756 (comment) Based on your note, I think what happened yesterday was a communication mishap. IMO, Hindsight is 20/20. One way to avoid this in the future would be to - adopt a model of brief and to-the-point messaging in the PRs (applies to me as well). Just a thought. |
Created #2760 for the spec
|
Ping @dclarizio, @himdel, @h-kataria, @mzazrivec : merge? |
Fix session[:edit] breakage in picture controller. (cherry picked from commit a4f3759)
Gaprindashvili backport details:
|
When picture controller is accessed the current content of
session[:edit]
is lost. This is due to asymetry inget_global_session_data
vsset_global_session_data
. One side always setsthe
session[:edit]
while the other does not always read it.Furthemor the logic of
{set/get}_global_session_data
is not needed inthe picture controller.
Fixes: #2625
Replaces: #2747
ping @AparnaKarve, please, review, test, add a spec for this. Thank you!