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: (ement-room-send-reaction) Bail out early when there's no event at point #246

Merged
merged 3 commits into from
Jan 26, 2024

Conversation

phil-s
Copy link

@phil-s phil-s commented Dec 2, 2023

Don't read the reaction from the user if it can't be used.

@alphapapa
Copy link
Owner

Hm, I think probably the function should be refactored to only take the key and event as arguments, and all the reading and temporary highlighting should be done in the interactive form (if possible--maybe there's a reason I didn't do it that way already). What do you think? Thanks.

@alphapapa alphapapa added the bug Something isn't working label Dec 2, 2023
@alphapapa alphapapa added this to the 0.14 milestone Dec 2, 2023
@phil-s
Copy link
Author

phil-s commented Dec 3, 2023

Offhand it sounds sensible to me. We'd just need to call it out as an API change?

ement-room-toggle-reaction has a call to (ement-room-send-reaction key (point)) but I don't see a reason for that to not pass the event at point (which it looks like it already has as its event argument, and I don't see any non-interactive calls to that toggle function). So I'm not seeing any immediate reason to avoid refactoring.

@alphapapa
Copy link
Owner

Offhand it sounds sensible to me. We'd just need to call it out as an API change?

Even though it's not a double-dashed function, I don't think we need to record the API change, because I don't think anyone else is calling these functions from their own code. But if you want to, I don't object.

ement-room-toggle-reaction has a call to (ement-room-send-reaction key (point)) but I don't see a reason for that to not pass the event at point (which it looks like it already has as its event argument, and I don't see any non-interactive calls to that toggle function). So I'm not seeing any immediate reason to avoid refactoring.

Yeah, I think it will work. I'm still not sure why I did it that way in the first place; maybe something to do with toggling using the buttons.

@alphapapa
Copy link
Owner

In the long run, this command should probably be slightly refactored to take the room, session, and event as arguments, and provide them all interactively (so e.g. reactions could be sent from the notifications buffer). But until then, this is still an improvement, so I'll merge it for v0.14.

@alphapapa alphapapa merged commit 08d5dad into alphapapa:master Jan 26, 2024
0 of 4 checks passed
@phil-s phil-s deleted the phil-s/interactive-reaction branch January 27, 2024 07:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants