Skip to content

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

Closed
neatchee wants to merge 66 commits into
glitch-soc:mainfrom
neatchee:feat/emoji_reactions
Closed

Add Support for Emoji Reactions (Replaces #1980)#2127
neatchee wants to merge 66 commits into
glitch-soc:mainfrom
neatchee:feat/emoji_reactions

Conversation

@neatchee

@neatchee neatchee commented Mar 8, 2023

Copy link
Copy Markdown

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
Copy Markdown

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

@neatchee

neatchee commented Mar 8, 2023 via email

Copy link
Copy Markdown
Author

@github-actions

Copy link
Copy Markdown

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

@kescherCode

Copy link
Copy Markdown

Highly suggest this e4c411e to be added.

@kescherCode

Copy link
Copy Markdown

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

@Plastikmensch

Plastikmensch commented Apr 3, 2023

Copy link
Copy Markdown

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

neatchee commented Apr 3, 2023

Copy link
Copy Markdown
Author

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
Copy Markdown

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

@neatchee

neatchee commented Apr 3, 2023 via email

Copy link
Copy Markdown
Author

@github-actions

github-actions Bot commented Apr 4, 2023

Copy link
Copy Markdown

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

@greyidol

Copy link
Copy Markdown

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

@Plastikmensch

Copy link
Copy Markdown

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
Copy Markdown

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
Copy Markdown

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

greyidol commented Apr 28, 2023

Copy link
Copy Markdown

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
Copy Markdown

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

@TheEssem

Copy link
Copy Markdown

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

neatchee commented Apr 30, 2023 via email

Copy link
Copy Markdown
Author

@github-actions

Copy link
Copy Markdown

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

@Reticulmz

Reticulmz commented May 3, 2023

Copy link
Copy Markdown

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

moyitpro commented May 5, 2023

Copy link
Copy Markdown

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

@Plastikmensch

Plastikmensch commented May 5, 2023

Copy link
Copy Markdown

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
Copy Markdown

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

neatchee commented May 7, 2023 via email

Copy link
Copy Markdown
Author

@InvoxiPlayGames

Copy link
Copy Markdown

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

neatchee commented May 7, 2023

Copy link
Copy Markdown
Author

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

kescherCode commented May 7, 2023

Copy link
Copy Markdown

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

neatchee commented May 7, 2023

Copy link
Copy Markdown
Author

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

@github-actions

github-actions Bot commented May 8, 2023

Copy link
Copy Markdown

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

@github-actions

github-actions Bot commented May 8, 2023

Copy link
Copy Markdown

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

@Plastikmensch Plastikmensch left a comment

Copy link
Copy Markdown

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.


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

@Plastikmensch Plastikmensch May 9, 2023

Copy link
Copy Markdown

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 )

Copy link
Copy Markdown

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.

Copy link
Copy Markdown

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?

Copy link
Copy Markdown

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';

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Wrong merge conflict resolution?

Copy link
Copy Markdown

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 =~ /^:.*:$/

Copy link
Copy Markdown

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 =~ /^:.*:$/

Copy link
Copy Markdown

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 No newline at end of file

Copy link
Copy Markdown

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.

Copy link
Copy Markdown

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)>'

Copy link
Copy Markdown

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.

Copy link
Copy Markdown

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

Copy link
Copy Markdown

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

github-actions Bot commented May 9, 2023

Copy link
Copy Markdown

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

@neatchee

neatchee commented May 9, 2023 via email

Copy link
Copy Markdown
Author

@Plastikmensch

Copy link
Copy Markdown

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
Copy Markdown

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

@neatchee

neatchee commented May 9, 2023 via email

Copy link
Copy Markdown
Author

@Plastikmensch

Copy link
Copy Markdown

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
Copy Markdown

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
Copy Markdown

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
Copy Markdown

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

neatchee commented May 9, 2023

Copy link
Copy Markdown
Author

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