ulyssa / iamb

A Matrix client for Vim addicts
https://iamb.chat
Apache License 2.0
608 stars 45 forks source link

Add command to set per-room notification levels #305

Closed rmsthebest closed 1 month ago

rmsthebest commented 3 months ago

As mentioned in the issue #304, I couldn't find a way to set notification options.

Here is an attempt to implement it. It isn't working, I'm not sure why so help is appreciated.

I apologize for breaking formatting, maybe my editor isnt picking up the rustfmt.toml from the repo? If we get this working we can fix that later

ulyssa commented 1 month ago

I've fixed the merge conflicts and added support for using with the RoomAction::Show action that was added in #279.

ulyssa commented 1 month ago

From what I can tell playing around with this, it seems good to me! If there are any other issues we can fix those in a follow-up PR.

rmsthebest commented 1 month ago

This looks good! Thank you for implementing this!

I apologize for breaking formatting, maybe my editor isnt picking up the rustfmt.toml from the repo?

The formatting thing is probably because your editor isn't using cargo +nightly fmt to enable the nightly-only options that are in .rustfmt.toml. I've run it by hand and pushed to the branch to make it easier to read.

If we get this working we can fix that later

What part wasn't working for you? I tried playing around with this locally and it seemed to be working at a first glance to me. I could mute and unmute rooms and messages sent to that room by other accounts disappeared/appeared based on the settings. The settings changes are also visible in Element.

I've added an unset command that uses delete_user_defined_room_rules() to restore settings to the account default, and I've removed some of the level name variants to keep it a small easy-to-type list for now.

So a few days after I wrote this I noticed that the notification settings seems to had changed, because it changed them on my phone, but in iamb on my desktop it didnt seem to care about the per room settings at all.

I'm glad it works for you though. Thanks for fixing it up and merging!