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

Add Support for Emoji Reactions (Replaces #1980) #2127

Closed
wants to merge 66 commits into from

Conversation

neatchee
Copy link

@neatchee neatchee commented Mar 8, 2023

Originally #1980

This has been running in production without issue at https://urusai.social for several weeks now.
Urusai's repo is here: https://github.com/neatchee/mastodon

@Plastikmensch
Copy link

Not a review, but this reintroduces some of the deleted js locale files, which have been replaced with json files.

@neatchee
Copy link
Author

neatchee commented Mar 8, 2023 via email

@github-actions
Copy link

This pull request has merge conflicts that must be resolved before it can be merged.

@kescherCode
Copy link

Highly suggest this e4c411e to be added.

@kescherCode
Copy link

Ah, I messed that commit up. Apply 9c4e060 afterwards.

@Plastikmensch
Copy link

Plastikmensch commented Apr 3, 2023

Highly suggest this e4c411e to be added.

Hmh. Maybe something went wrong while porting, but integer_cast_setting doesn't prevent "e" in numbers anymore.

Edit: Not important anymore, since "e" doesn't cause any errors anymore

@neatchee
Copy link
Author

neatchee commented Apr 3, 2023

Apologies if this should be obvious, as I'm not really a Ruby/React dev:
Is the intent of this patch to provide a user-facing setting for the number of visible reactions per status?

I'm not sure if I agree with exposing this setting to the end-user. Certainly not without enforcing a server-supplied maximum value.

I am generally opposed to any changes that will fragment user experience without a clear advantage to the end-user. This also increases the test surface area as we'll need to make sure nothing breaks visually across any of the UI - desktop and mobile - regardless of what the user sets this value to.

Can you make a compelling argument for why a user would want to make fewer reactions visible? More than a single line of reactions visible?

@kescherCode
Copy link

@neatchee this was part of the original patch, I merely ported it.

@neatchee
Copy link
Author

neatchee commented Apr 3, 2023 via email

@github-actions
Copy link

github-actions bot commented Apr 4, 2023

This pull request has resolved merge conflicts and is ready for review.

@greyidol
Copy link

This doesn't seem to work on Husky. I would like to be able to add emoji reactions from Husky.

@Plastikmensch
Copy link

This doesn't seem to work on Husky. I would like to be able to add emoji reactions from Husky.

Husky has to implement the ability to add reactions.

@kescherCode
Copy link

I think Husky has this ability - but since it's a fork of Tusky specifically for Pleroma, it would need adjustment for this PR.

@Plastikmensch
Copy link

I think Husky has this ability - but since it's a fork of Tusky specifically for Pleroma, it would need adjustment for this PR.

Yes, most likely they don't check Mastodon instances for availability of this feature.

@greyidol
Copy link

greyidol commented Apr 28, 2023

Yes, most likely they don't check Mastodon instances for availability of this feature.

It doesn't check. It just displays the emoji reaction button on every post, on every instance. I was hoping that this PR could implement the endpoint that Husky uses for emoji reactions, for compatibility's sake.

@kescherCode
Copy link

It is not the server's responsibility to implement the API as the client expects for another software's implementation.

@TheEssem
Copy link

Would it be possible to implement the ability to see who reacted to a post? Not showing what users reacted with while also showing who boosted/liked a post can cause confusion in quite a few contexts.

@neatchee
Copy link
Author

neatchee commented Apr 30, 2023 via email

@github-actions
Copy link

This pull request has merge conflicts that must be resolved before it can be merged.

@Reticulmz
Copy link

Reticulmz commented May 3, 2023

Fedibird uses the value "emoji_reaction" in the "fedibird_capabilities" key in the "/api/v1/instance" response to notify the client of the feature
SubwayTooter, for example, can use the emoji reaction if this value exists.

@moyitpro
Copy link

moyitpro commented May 5, 2023

I noticed a bug with the latest Glitch SOC update. The reactions on threaded posts are misaligned.
2023-05-05_17-48-50

@Plastikmensch
Copy link

Plastikmensch commented May 5, 2023

I noticed a bug with the latest Glitch SOC update. The reactions on threaded posts are misaligned.

Ah, it's missing the margin.
adding .reactions-bar like this in flavours/glitch/styles/components/status.scss fixes that:

// line 1034
&--in-thread {
    border-bottom: 0;

    .status__content,
    .status__action-bar,
    .reactions-bar {
      margin-left: 46px + 10px;
      width: calc(100% - (46px + 10px));
    }
  }

(This also needs to be done in vanilla styles)

@InvoxiPlayGames
Copy link

There's a bug in this in which someone can react to a post that's not visible to them (for example, a blocked account)

@neatchee
Copy link
Author

neatchee commented May 7, 2023 via email

@InvoxiPlayGames
Copy link

Via direct API call? Or also via UI if the user was blocked after seeing the post?

Yes via the API, however I see no reason it wouldn't work via UI so long as the client hasn't received the updates that lead the post to disappear when blocked.

Does the user receive a notification that the blocked user reacted to them?

No.

Will need to think about ideal behavior in that scenario

The /:id/favourite and /:id/reblog endpoints return a 404 for any post you can't see, for any reason (block, post privacy, etc) - I assume that would be the behaviour to replicate here as well.

@neatchee
Copy link
Author

neatchee commented May 7, 2023

Uh, the custom_emojis_controller commit should not be in here. That was only concerning a broken merge I introduced in my fork.

Actually, a bunch of unrelated commits landed in here. Why is a broken version.rb change here :D

..........What the hell did I do....

@neatchee
Copy link
Author

neatchee commented May 7, 2023

oh ok. I see.

The custom_emojis_controller commit was pulled in because it was apparently also missed on this side?

As for broken version.rb that's just a mistake on my part during conflict resolution.

Are there other commits you see in there that shouldn't?

@kescherCode
Copy link

kescherCode commented May 7, 2023

yeah, 34f9e54 should not be in this PR, either (because it was another Catstodon specific commit)

Actually, it wasn't a bunch, it was mostly the same commit from multiple rebases being shown after each other lol.

@neatchee
Copy link
Author

neatchee commented May 7, 2023

I'm not gonna deal with rewinding the log again >.> Just reverting.

@github-actions
Copy link

github-actions bot commented May 8, 2023

This pull request has merge conflicts that must be resolved before it can be merged.

@github-actions
Copy link

github-actions bot commented May 8, 2023

This pull request has resolved merge conflicts and is ready for review.

Copy link

@Plastikmensch Plastikmensch left a comment

Choose a reason for hiding this comment

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

This is only a surface level review for now.
Gawd this one is too big and went through too many changes...

Another thing:
reaction should be added to NON_EMAIL_TYPES in app/services/notify_service.rb as e-mail notifications for reactions are currently not supported.

@@ -2,6 +2,7 @@

class Api::V1::CustomEmojisController < Api::BaseController
vary_by '', unless: :disallow_unauthenticated_api_access?
skip_before_action :require_authenticated_user!, unless: :whitelist_mode?
Copy link

@Plastikmensch Plastikmensch May 9, 2023

Choose a reason for hiding this comment

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

Isn't this also a catstodon specific thing to allow anyone to copy custom emojis? (@kescherCode )

Choose a reason for hiding this comment

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

It is and should not be in here.

Choose a reason for hiding this comment

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

Why is visibleReactions missing from this file?

Choose a reason for hiding this comment

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

This file should have the .jsx extension (or better yet rewritten for .tsx)

Comment on lines +44 to +46
import AccountContainer from 'flavours/glitch/containers/account_container';
import Spoilers from '../components/spoilers';
import Icon from 'flavours/glitch/components/icon';

Choose a reason for hiding this comment

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

Wrong merge conflict resolution?

Choose a reason for hiding this comment

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

visibleReactions is also missing here.

@account.reacted?(original_status, name)

custom_emoji = nil
if name =~ /^:.*:$/

Choose a reason for hiding this comment

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

Suggested change
if name =~ /^:.*:$/
/^:.*:$/.match?(name)

return false if name.nil?

custom_emoji = nil
if name =~ /^:.*:$/

Choose a reason for hiding this comment

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

Suggested change
if name =~ /^:.*:$/
if /^:.*:$/.match?(name)

Comment on lines +1 to +6
Fabricator(:status_reaction) do
account nil
status nil
name "MyString"
custom_emoji nil
end

Choose a reason for hiding this comment

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

Suggested change
Fabricator(:status_reaction) do
account nil
status nil
name "MyString"
custom_emoji nil
end
# frozen_string_literal: true
Fabricator(:status_reaction) do
account
status
name '👍'
custom_emoji nil
end

At least making the fabricator usable.

Choose a reason for hiding this comment

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

Hmh this seems to cause a failure:

  1) The status_reaction factory is valid
     Failure/Error: expect(factory).to be_valid
       expected #<StatusReaction id: 1, account_id: 110339817053204859, status_id: 110339817053191929, name: "👍", custom_emoji_id: nil, created_at: "2023-05-09 17:06:33.686302000 +0000", updated_at: "2023-05-09 17:06:33.686302000 +0000"> to be valid, but got errors: Limit of different reactions reached
     # ./spec/fabricators_spec.rb:9:in `block (3 levels) in <top (required)>'

Choose a reason for hiding this comment

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

Hm, that's odd indeed. I'll not apply this for now.

Choose a reason for hiding this comment

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

Yeah, I don't know how to fix that.
The fabricator itself works, it's just the fabricators_spec which fails

Choose a reason for hiding this comment

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

This migration should only be needed for people who already merged this into their forks.
Though, that is basically everyone working on this ^^

@github-actions
Copy link

github-actions bot commented May 9, 2023

This pull request has merge conflicts that must be resolved before it can be merged.

@neatchee
Copy link
Author

neatchee commented May 9, 2023 via email

@Plastikmensch
Copy link

Would either of you like to take over this PR? :) As mentioned above, I'm not really a Ruby dev, I just wanted the feature and it was stagnant. Happy to keep applying feedback but figured I'd offer it up :D

I really shouldn't put more work upon myself, but I would be willing to take over.
Already considered it when the old PR became stagnant.

@kescherCode
Copy link

As I actively maintain this in my own fork, I'd be happy to take over.

@neatchee
Copy link
Author

neatchee commented May 9, 2023 via email

@Plastikmensch
Copy link

If @kescherCode can't take it, would it be easier on you if you provide instruction and I implement to the best of my ability? Even if that means a longer review? I don't mind at all, I just don't want to make this harder than it needs to be

I actually don't know, though it can be hard for me to give instructions sometimes.
I don't really mind who takes over, but I would really like this being split into frontend and backend changes, as this is so large that I actually dread looking at this.

@kescherCode
Copy link

I won't really split this into backend and frontend because that would really mess with the history of the existing commits...

@Plastikmensch
Copy link

I won't really split this into backend and frontend because that would really mess with the history of the existing commits...

Yeah... :/

@kescherCode
Copy link

One more migration that didn't belong here in the first place: db/migrate/20221218015350_fix_foreign_keys_status_reactions.rb. Catstodon-specific, or for folks having merged an older version of the initial emoji reaction migration.

@neatchee
Copy link
Author

neatchee commented May 9, 2023

We're off to PR number three. #2221

Closing this one out. <3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants