-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Removed same text on comment reply form #9509
Conversation
Code Climate has analyzed commit 45a1ba9 and detected 0 issues on this pull request. View more on Code Climate. |
Codecov Report
@@ Coverage Diff @@
## main #9509 +/- ##
=======================================
Coverage ? 81.35%
=======================================
Files ? 98
Lines ? 5928
Branches ? 0
=======================================
Hits ? 4823
Misses ? 1105
Partials ? 0 |
Thanks, @waridrox, is it possible to add a test for this? |
Sure, @RuthNjeri I'll add one 😄 but first I wanted to confirm if this problem persists on production env, which may then bring some modifications to the above changes. Thanks :) |
Hi, actually you need push rights to publiclab/plots2 Thanks! |
Thanks @jywarren, I pushed your changes to the unstable branch @waridrox, you can test your changes in the link Jeff shared for the stable branch |
Thanks a lot @RuthNjeri for the help, yes the issue does solves partially on the first reply but repeats after the second reply. This has also been tested on the official website here: unstable.mp4So I think we need to make the changes such that the |
@waridrox, the unstable site has the changes for this PR, to understand you better, are you saying that the current changes do not fix the initial problem that was also happening on the main website? |
I'm sorry if I puzzled you 😅, but in an attempt to solve the main issue, i.e.
|
app/views/comments/_form.html.erb
Outdated
@@ -92,7 +92,7 @@ | |||
rows="6" | |||
cols="40" | |||
placeholder="<%= placeholder %>" | |||
><%= location == :edit ? comment.comment : params[:body] %></textarea> | |||
><%= location == :edit ? comment.comment : params[:none] %></textarea> |
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.
Hmm, i guess we need a different solution. What was the original intent of this phrase?
location == :edit ? comment.comment : params[:body]
Is it to see if the location is "edit" and if it is, display the existing comment text, but if not, to display the value of the params[:body]
variable?
I wonder if it makes the assumption that the params[:body]
variable is corresponding to... the submitted content of a comment, and if we should be checking to ensure it's the correct value in some other way? Remember that this may be used both on initial pageload and also in an AJAX response, which complicates this.
It could be useful to monitor the network pane of the Dev Tools to see if the partial template being sent from the server to generate this textarea is bearing the correct content?
@jywarren @RuthNjeri, so I tried to investigate the problem further, figuring out where the data gets passed on after making a comment, and I realised that the text input field’s value was not cleared after making a POST AJAX request along with a NotyNotification! 😅. That's why the same text was repeating in the comment reply form... So, resetting the text input field value resolved the issue: fixed.mp4 |
Oh wow awesome! Hmm, is the system test failure unrelated? Shall we restart it? |
Will take a look at this soon... Also, I think maybe these tests will have some effect if #9384 got merged due to the waiting time of the debounce function... |
Ok so finally figured out why the tests were failing, the final-test.mp4 |
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.
Good work @waridrox 🎉
Thanks for working on this @waridrox and great job investigating the edge cases. Would you like to write a test for this? I think it will be useful for anyone to understand what is expected of the code written. You can also set it up as another issue so that we merge this one first if you would like. |
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.
LGTM: just a pending test.
Sure thing! 🚀 |
Awesome work. Thank you so much!!!!!! |
* Removed same text on first comment reply * cleared textarea value * Clear value only for the textarea * Fixed redundant removal of content on individual reply * Added tests to check clear input field on comment replies
* Removed same text on first comment reply * cleared textarea value * Clear value only for the textarea * Fixed redundant removal of content on individual reply * Added tests to check clear input field on comment replies
Fixes #9500 and #9508
Removed same text on first comment reply
Make sure these boxes are checked before your pull request (PR) is ready to be reviewed and merged. Thanks!
rake test
@publiclab/reviewers
for help, in a comment belowIf tests do fail, click on the red
X
to learn why by reading the logs.Please be sure you've reviewed our contribution guidelines at https://publiclab.org/contributing-to-public-lab-software
Thanks!