-
Notifications
You must be signed in to change notification settings - Fork 42
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
ref(#150): unify django views responses #151
Conversation
4e91b5e
to
167449b
Compare
I get an error when trying to post an anonymous parent comment from the UI, Also, you probably forgot to change the response for |
I am not sure that I can help with the current info since it's working for me locally.
In |
I will make a new release |
Yes, you're right but there's also a case, where you render a template when the key passed doesn't resolve into a valid comment. Comment/comment/views/comments.py Lines 125 to 126 in 5f845cf
|
Oh nice observation, good you mentioned that. I will update it. |
The GIF of the error when trying to post an anonymous comment locally on my machine. I got the issue, it is occurring because of the I have used comments in the ...
/* here formButton actually captures the relay-icon */
let formButton = form.querySelector("button");
...
/* Although it is a parent comment, since it doesn't get the attribute `value`, hence considers it as a child comment */
// parent comment
if (formButton.getAttribute('value') === 'parent') {
// reload all comments only when posting parent comment
if (result.anonymous) {
createInfoElement(form.closest('.js-comment'), 'success', result.msg, 3);
form.reset();
return;
}
document.getElementById("comments").outerHTML = result.data;
} else {
// child comment
if (result.anonymous) {
/*Since it doesn't get the parent element here, it passed null to `createInfoElement` which was causing an error*/
createInfoElement(form.closest('.js-parent-comment'), 'success', result.msg, 3);
form.reset();
return;
}
...
} Although this might not occur with a lot of other people, maybe we can use a more comprehensive check to use some sort of id or class rather than using the element name for the query to find the button. |
Comment/comment/views/comments.py Lines 125 to 126 in 5f845cf
I don't think this needs to be changed to JsonResponse since this call is not handled in JS. The current response seems to be the right one. |
Yes, it won't affect unless you use an extension firefox-relay. This generates email aliases that can be forwarded to your original email and ... So in my case it is causing an issue because it creates a button icon(to generate email aliases) as seen in the GIF above on the email fields. |
So this is a very special case. However, I am thinking to change the UI for creating anonymous comments to be similar to the one implemented in the subscription feature. That means the email field will be removed from the current UI form and instead will be prompted by a modal form. |
167449b
to
12e09a5
Compare
I think this should ideally be done in a separate issue. |
resolves #150
fixes #149