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

Highlight notifications for /me actions. #674

Merged
merged 5 commits into from
Dec 19, 2024

Conversation

englut
Copy link
Contributor

@englut englut commented Dec 12, 2024

Found bugs with highlighting notifications when someone mentions you with a /me action.

There's three related issues:

  • Notification events for /me action highlights are not triggered.
  • /me action is not visually highlighted.
  • /me action highlights not showing in Highlights buffer.
  • Highlights in the query buffer is missing.

Above issues should be addressed with this PR.

@englut englut force-pushed the fix/highlight-notifications branch from 6dbe956 to 048fad4 Compare December 12, 2024 21:19
@englut englut changed the title Filter out SOH control char before matching logic for highlight notification Highlight notifications for /me actions. Dec 12, 2024
@englut englut force-pushed the fix/highlight-notifications branch from 048fad4 to 76f49d4 Compare December 12, 2024 21:44
@englut englut marked this pull request as ready for review December 12, 2024 21:54
Comment on lines 217 to 225
let text_container =
container(message_content).style(move |theme| match user {
Some(user) => match our_nick {
Some(nick)
if message::references_user(
user.nickname(),
nick,
message,
) =>
{
theme::container::highlight(theme)
}
_ => Default::default(),
},
_ => Default::default(),
});

Copy link
Member

Choose a reason for hiding this comment

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

This could be simplified a bit, not tested but something like:

let text_container = container(message_content).style(|theme| {
    if let (Some(user), Some(nick)) = (user, our_nick) {
        if message::references_user(user.nickname(), nick, message) {
            return theme::container::highlight(theme);
        }
    }
    Default::default()
});

Copy link
Contributor Author

@englut englut Dec 16, 2024

Choose a reason for hiding this comment

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

Ah! That's so much nicer. I didn't know that you could combine the Some(..) assignment that way. I did think that there was something to optimize there! Thanks for this 🙏

The simplification has been tested and pushed!

@englut englut requested a review from casperstorm December 16, 2024 15:38
@englut englut force-pushed the fix/highlight-notifications branch from bd8af8d to 3506255 Compare December 16, 2024 15:42
@englut englut force-pushed the fix/highlight-notifications branch from 3506255 to 3d97d05 Compare December 16, 2024 19:13
@englut
Copy link
Contributor Author

englut commented Dec 17, 2024

I noticed that highlights in query weren't present. I've added this to the PR.

@englut englut force-pushed the fix/highlight-notifications branch from 903df07 to 41d2e61 Compare December 17, 2024 08:13
@casperstorm casperstorm merged commit 575e47e into squidowl:main Dec 19, 2024
1 check passed
@englut englut deleted the fix/highlight-notifications branch December 19, 2024 09:26
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