Add ?_=1234 to comment update action to clear browser cache when editing comments
Hi, this is a first-timers-only issue. This means we've worked to make it more legible to folks who either haven't contributed to our codebase before, or even folks who haven't contributed to open source before.
If that's you, we're interested in helping you take the first step and can answer questions and help you out as you do. Note that we're especially interested in contributions from people from groups underrepresented in free and open source software!
If you have contributed before, consider leaving this one for someone new, and looking through our general help wanted issues. Thanks!
The problem
I edited and saved a comment on this page, which reloads the page, but to the same URL, so some browsers (chrome) don't refresh it -- they use a cached version, assuming nothing's changed. So I didn't see my updated comment -- i saw the old version until i refreshed the page!
This'll happen when editing any comment on the site, unfortunately.
Solution
The redirect after making the update happens here:
https://github.com/publiclab/plots2/blob/master/app/controllers/comment_controller.rb#L70
We should change the destination to:
redirect_to @node.path(format) + "?_=" + Time.now.to_i.to_s
Similarly to how we do this in the notes_controller. This adds a semi-random number to the end of the URL, so while it fetches the same page, the browser sees it as a different URL and doesn't use the cached version.
We'd need to update the tests to match, here:
https://github.com/publiclab/plots2/blob/master/test/functional/comment_controller_test.rb#L81
And a few other spots in that test suite -- wherever we go through the update action! You'll see all the changes needed if you run tests -- since the redirect has changed, the affected tests will fail until you update them. Also, the easiest way to run tests is actually to open a pull request!
Give it a try!
Steps to Fix
- [x] claim this issue with a comment here, below, and ask any clarifying questions you need
- [ ] set up a repository locally following the README instructions, and make sure that all tests pass
- [ ] try to fix the issue following the steps above, but even before you're done, you can:
- [ ] commit your changes and start a pull request (see contributing to Public Lab software) but mark it as "in progress" if you have questions or if you haven't finished
- [ ] alert someone via the developers list (see below) to have your pull request merged. This may take a few extra steps depending on when you do it, but we'll help you out!
Please email the developers list (see https://publiclab.org/developers) if you have questions, and take a look at our first-timers landing page for more information!
Hi @jywarren this is my first time contributing to open source so I would like to claim this issue. should I proceed to setup perform the following tasks that you have laid out?
Yes -- thank you, we'd love to have your contribution. Just a note that while there are other @publiclab/reviewers around, I will be intermittently available over the next 48 hours due to a couple events I'm participating in. But we're here to help -- just a little slower than usual!
Thanks!! 👍
No worries. Thank you for the advice. I will try to close this and submit a pull request when I am done. Enjoy your weekends!
Hi again, I have a question, although not directly relating to this issue. I am trying to install the gem but I get "Your Ruby version is 2.3.3, but your Gemfile specified 2.1.2" when I try to run "bundle install --without production mysql".
In addition when I type "bundle update", I also get "Your Ruby version is 2.3.3, but your Gemfile specified 2.1.2".
When I run ruby -v I get "ruby 2.3.3p222 (2016-11-21 revision 56859) [i386-mingw32]"
I take it that I don't have ruby version 2.1.2 but from the archives: http://rubyinstaller.org/downloads/archives, I cant seem to find a version 2.1.2.
I am sorry I am not really familiar with ruby but I am trying to learn! How can I overcome this hurdle?
Ah sorry about that, just found that I was supposed to install the RVM first
https://github.com/publiclab/plots2/wiki/Prerequisites\
yes, you'd need rvm to conveniently switch between multiple ruby installations and then use rvm to install 2.1.2
Glad you worked it out! Thanks and if you have a PR to submit we're happy to look over your work so far and offer input!
Hi @jywarren, sorry for my late reply. work has been a little bit intense lately. too many items in parallel. Can you advise me what is the best route to take if I desire to setup ruby on rail on my windows 10? I see that there is a recent new way of having Ubuntu on windows in an integrated manner. The reference link that I saw is in https://gorails.com/setup/windows/10. Would you advise me to take this route or would it be better to go with the classical vm and run rails in Linux in the vm?
Hi, no problem at all -- thanks for checking in!
honestly I'm not that familiar with the new windows 10 system, but I've heard of it and it sounds interesting. I might be less able to provide troubleshooting as a result though... but it's your choice, as I don't have a strong preference?
Thanks!
On Tue, Dec 13, 2016 at 12:09 PM, rosj91 [email protected] wrote:
Hi @jywarren https://github.com/jywarren, sorry for my late reply. work has been a little bit intense lately. too many items in parallel. Can you advise me what is the best route to take if I desire to setup ruby on rail on my windows 10? I see that there is a recent new way of having Ubuntu on windows in an integrated manner. The reference link that I saw is in https://gorails.com/setup/windows/10. Would you advise me to take this route or would it be better to go with the classical vm and run rails in Linux in the vm?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/publiclab/plots2/issues/1086#issuecomment-266798923, or mute the thread https://github.com/notifications/unsubscribe-auth/AABfJxAGwruzgL145m0er8MvLhHLta3Nks5rHtFWgaJpZM4LIJ5Y .
Hi @jywarren, Thank you for understanding. I really appreciate the chance to get to work on this. I will try this method out because it sounds very interesting to me, since I will also be able to tie it together with the new VS2017 RTM package which now support Linux development. Will let you know how it goes. Please give me another day or two to fully setup the system and to make the pull request of course!
Now I am burning the midnight oil to clock in some VHDL code for work..
OK, great! Good luck!
@jywarren I would like to claim this issue, since the previous poster hasn't responded in a month. This is my first time contributing to plots2.
Thank you, we'd love to have your contribution! Please ask if you need any help or tips.
On Tue, Jan 17, 2017 at 10:22 AM, VSN Reddy Janga [email protected] wrote:
I would like to claim this issue, since the previous poster hasn't responded in a month. This is my first time contributing to plots2.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/publiclab/plots2/issues/1086#issuecomment-273199427, or mute the thread https://github.com/notifications/unsubscribe-auth/AABfJ-TqzxsmRF2VrEY1E2O6UJiQpUC0ks5rTNzNgaJpZM4LIJ5Y .
First time trying to contribute. Is anyone else working on this issue? If no-one I would love to give it a try
Please do -- it sounds like nobody's made much progress on it yet, but I'm happy to help anyone who's taking a crack at it! Please open a pull request and ping in here if you do!
I opened the pull request #1086 adding ?=123 to comment controller #1227 . I would appreciate any feedback
Fixed in #1227! Thanks!