Skip to content
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

Sending an answer inserts answer text into other textareas on the page #3836

Closed
jywarren opened this issue Oct 29, 2018 · 12 comments
Closed
Labels
gci-candidate help wanted requires help by anyone willing to contribute HTML JavaScript

Comments

@jywarren
Copy link
Member

I entered an answer and posted it on this page: https://publiclab.org/questions/warren/10-29-2018/help-us-refine-the-search-interface-at-publiclab-org

My answer was posted, but strangely, its comment box also contained my original answer text, and the text also remained in the answer posting textarea:

screen shot 2018-10-29 at 6 22 11 pm

I would guess there's something going wrong with the ids of these textareas that is causing the content to be inserted incorrectly:

<div id="post-answer">
<% if current_user %>
<%= render :partial => "comments/form", :locals => { title: "Post an answer", comment: false, placeholder: "Help users by posting an answer to this question", is_answer: true } %>
<% else %>
<p><%= link_to "Sign up", signup_path( return_to: request.path )%> or <%= link_to "Login", new_user_session_path( return_to: request.path )%> to post an answer to this question.</p>
<% end %>

Notice how the answer posting form re-uses the comment form. Perhaps there is a collision of unique IDs between these.

@jywarren jywarren added help wanted requires help by anyone willing to contribute JavaScript HTML gci-candidate labels Oct 29, 2018
@SidharthBansal
Copy link
Member

Published on GCI dashboard

@oorjitchowdhary
Copy link
Member

I can't find this task on the gci dashboard.. is it already solved?

@oorjitchowdhary
Copy link
Member

@SidharthBansal @jywarren

@handlerug
Copy link
Contributor

I solved it in PR #4049, please, check it :)

@grvsachdeva
Copy link
Member

Hey @jywarren @handlerug while reviewing PR created by @handlerug , i was trying to replicate the error and found that this error is not due to unique id problem or so, but somewhat related to comment template. Like, when I created a test question on the website and added tag as comment-template:ui-feedback-template. All text areas got this template.

Information about comment templates - https://publiclab.org/comment-templates

Test question - https://publiclab.org/questions/gauravano/11-26-2018/test-question

Thanks!

@handlerug
Copy link
Contributor

It's problem with response from the server. When user submits comment, server returns filled answer template with new comment form prefilled with answer text. So I added special flag to disable auto-filling and now it's working fine.

I will do some extra checks today and will try to solve it, thanks! 👍

@jywarren
Copy link
Member Author

jywarren commented Nov 27, 2018 via email

@handlerug
Copy link
Contributor

It's problem inside new comment view, so I fixed it already. Can you check it again @jywarren @gauravano?

@grvsachdeva
Copy link
Member

@jywarren don't you think the issue you mentioned was due to the tag comment-template:ui-feedback-template in https://publiclab.org/questions/warren/10-29-2018/help-us-refine-the-search-interface-at-publiclab-org. See https://publiclab.org/comment-templates for more details. If you think the issue you faced was due to tag and it's the natural function of tag, then it's possibility that we might have intruded in comment-template tag's working by merging PR #4049 . Thanks!

@jywarren
Copy link
Member Author

Hmm, it's worth watching this carefully. I don't think the original issue was related to the comment template feature. So i think this is OK. But let's keep an eye out. I also haven't seen the local_assigns usage that the solution in #4049 has, so maybe i'm not quite sure what's going on. Let's watch the production server to be sure comment-templates still work, as in https://publiclab.org/questions/warren/10-29-2018/help-us-refine-the-search-interface-at-publiclab-org

@handlerug i'm going to be publishing new code in about an hour. Would you be able to test and ensure both features are working? Thanks!

@handlerug
Copy link
Contributor

I think comment templates will be broken because I ever didn't know about this feature and my fix removes any text from comment form inside answer view. I will check it in two hours, can I add more commits to my pull request? Thanks!

@jywarren
Copy link
Member Author

jywarren commented Dec 1, 2018 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
gci-candidate help wanted requires help by anyone willing to contribute HTML JavaScript
Projects
None yet
Development

No branches or pull requests

5 participants