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

Fix most backend issues #4

Conversation

Plastikmensch
Copy link

@Plastikmensch Plastikmensch commented May 14, 2023

Fixes multiple occurrences of looking for :shortcode: in the database, preventing Undo activities to be processed.
Added handling for Undo with Misskey reactions.
Fixes an issue where me was true when a remote reaction had the same shortcode as an already present reaction.
Added custom_emoji to reacted? to be able to differentiate between reactions with the same shortcode but different emojis.

Don't know if you were already working on this or not, but I thought I offer my solution.
Some of it could probably be optimised, but I worked multiple days on this and I'm tired.

Outstanding issues:
Because reactions from the same account with the same name, but different custom emojis can exist, it is possible for sidekiq to throw:

ActiveRecord::RecordNotUnique: PG::UniqueViolation: ERROR: duplicate key value violates unique constraint "index_status_reactions_on_account_id_and_status_id"

for remote reactions and Duplicate record for local reactions.

Signed-off-by: Plastikmensch <[email protected]>
These occur when an account tries to react with disabled custom emojis.
In both `EmojiReact` and `Like? activities, the activity is discarded.

Signed-off-by: Plastikmensch <[email protected]>
Processing all custom emojis is neither wise nor necessary as both `Like` and `EmojiReact` only expect a single custom emoji

Signed-off-by: Plastikmensch <[email protected]>
Right now Misskey users were able to react, but couldn't remove their reactions.
delegates `Undo` for a `Like` to `undo_emoji_react` when there is no favourite found.

(Misskey `Like` activities can still create a fav when the emoji tag is invalid, I don't see the point though)

Signed-off-by: Plastikmensch <[email protected]>
Also doesn't set custom_emoji to a local variant of name when not given.

Signed-off-by: Plastikmensch <[email protected]>
When an account and a remote account reacted with a custom emoji with the same shortcode, the `me` attribute was also true for the remote reaction, despite being a different emoji.

This query should probably be optimised, but it works.

Signed-off-by: Plastikmensch <[email protected]>
Handling remote reactions with foreign emojis would require an extensive rewrite of vanilla code, so instead prevent reactions with remote emojis when the status is not local.

Signed-off-by: Plastikmensch <[email protected]>
Instead of processing tag and then look for the custom emoji, let the processing return an emoji.

Add `name` to `process_emoji_tags` to check if it matches the shortcode.

Removed `process_single_emoji` and added its code to `process_emoji_tags`

Removed arg from `maybe_process_misskey_reaction`.
Ideally, `original_status` should be a global object, but I wanted to modify vanilla code as little as possible.

Signed-off-by: Plastikmensch <[email protected]>
When reacting with different custom emojis with the same shortcode, it would count as an already present reaction and processed, bypassing the limit.

Signed-off-by: Plastikmensch <[email protected]>
@kescherCode kescherCode merged this pull request into CatCatNya:feature/emoji_reactions May 27, 2023
kescherCode added a commit that referenced this pull request May 27, 2023
kescherCode pushed a commit that referenced this pull request Feb 17, 2024
… into local and federated (#8)

* Showing all federated boosts is noisy while local boosts may be acceptable (especially once #4 is addressed)
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.

2 participants