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

537 react to comments #1255

Merged
merged 29 commits into from
Apr 20, 2021
Merged

Conversation

squigglybob
Copy link
Collaborator

@squigglybob squigglybob commented Mar 26, 2021

resolves #537

@squigglybob squigglybob marked this pull request as ready for review April 14, 2021 15:01
@squigglybob
Copy link
Collaborator Author

Hi @corsacca @ahillbilly I think I'm done with this one if you could check it out.

Let me know if any of the styling needs adjusting.

Also @corsacca I wasn't sure what the best permissions to check for on the API of this, so have just used the self::can_update(post, id) function for now let me know if it needs anything else

Copy link
Collaborator

@micahmills micahmills left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @squigglybob this is great! It works exactly as I would expect and even works in a right to left language!

One question I have is what is the advantage of using the images of emojis instead of the HTML entities directly? I would think we could save the HTTP requests for the images and the user would get the platform specific emoji designs if we used the HTML entities, but I might be missing something that requires the images.

I did notice one edge case styling thing. If you have a lot of emojis selected and the screen size is small enough the comment controls flow to multiple lines making the emoji pill buttons expend to multiple lines.

Screen Shot 2021-04-14 at 9 11 02 PM
Screen Shot 2021-04-14 at 9 39 26 PM

dt-assets/functions/enqueue-scripts.php Outdated Show resolved Hide resolved
dt-assets/js/comments.js Show resolved Hide resolved
@squigglybob
Copy link
Collaborator Author

I'll have a look at the small screen size issue, and see if I can get the edit/delete controls to go to the next line on smaller screens.

I'll also investigate just using the emoji utf8 charachters instead of paths, I guess one benifit is that any emoji image can be used, and it's not limited to what you can find in the utf8 emoji list (although it is pretty extensive :)

@squigglybob
Copy link
Collaborator Author

image
Looks better on an iPhone 5 size now (320px!!!)

@corsacca
Copy link
Member

Thanks for this great work @squigglybob and the review @micahmills
I'm getting this error when adding a comment.
The submit comment button stays disabled, keeping me from adding another comment.
image

@micahmills
Copy link
Collaborator

Thanks for this great work @squigglybob and the review @micahmills
I'm getting this error when adding a comment.
The submit comment button stays disabled, keeping me from adding another comment.
image

I am seeing the same thing with an console error of
TypeError: Cannot convert undefined or null to object at Function.entries (<anonymous>) at eval (lodash.templateSources[0]:39) at r (lodash.min.js?ver=4.17.19:9) at Function.hf (lodash.min.js?ver=4.17.19:83) at eval (lodash.templateSources[0]:18) at comments.js?ver=1618482543:371 at Array.forEach (<anonymous>) at display_activity_comment (comments.js?ver=1618482543:345) at Object.<anonymous> (comments.js?ver=1618482543:30) at e (jquery.min.js?ver=3.5.1:2)

@squigglybob
Copy link
Collaborator Author

Ok, I've added in a default object for the comment reactions so hopefully that fixes the error you both found in the previous two comments. Let me know if that does it...

It's strange that I didn't get the same error on my machine Ubuntu 20.04, Chrome 88.0.4324.150

if more than 6 reactions are added, the dropdown box will expand upwards instead of downwards
@micahmills
Copy link
Collaborator

This seems to have fixed the issue, and the addition of the UTF-8 emojis is great.

This looks good to go. Great work!

dt-assets/functions/enqueue-scripts.php Outdated Show resolved Hide resolved
height needed when reactions wrap as otherwise second row looks a bit squashed
…/disciple-tools-theme into 537-react-to-comments
@corsacca
Copy link
Member

Hey. Thanks bearing with me on one more request.
Can you make sure all the strings are being escaped?
One example is
<img class="emoji" alt="${reaction.name}" src="${reaction.path}">
reaction.name can be a translated value, so it could contain js.
As much as possible we try to run all variables through window.lodash.escape() to deal with any xxs attacks, even ones that likely aren't (like reaction.path).

( Using <%- in the commentTemplate i think does escaping )

@squigglybob
Copy link
Collaborator Author

@corsacca I've had a look through the comments.js file and think that the only one that needed escaping was the one mentioned in your change request.

The only other ones are in the lodash template and being escaped by the <%- tags

@corsacca corsacca merged commit 809c105 into DiscipleTools:master Apr 20, 2021
@corsacca
Copy link
Member

Thank you @squigglybob !
I'm looking forward to using this one :)

@squigglybob squigglybob deleted the 537-react-to-comments branch April 20, 2021 08:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Comments: like, favorite or react to a comment.
3 participants