This introduces a new metadata option that when set by a user will
inform the client that all messages sent on that buffer should display
a notification to the user.
Introduce METADATA soju.im/alert #73
amk/soju:metadata-alert into master
e3eba066e8
624550e758
related https://todo.sr.ht/~emersion/soju/107
at least for the usecase of always receiving notifications for some channels
624550e758
337271305f
@ -693,12 +694,20 @@ func (uc *upstreamConn) handleMessage(ctx context.Context, msg *irc.Message) err
uc.updateChannelAutoDetach(bufferName)
}
cmt,err:=uc.srv.db.GetMessageTarget(ctx,uc.network.ID,ch.Name)
Should the alert db field go on the Channel table instead to avoid this extra lookup? I put it there as it seemed most similar to Muted/Pinned but the later message target lookup is done on the user who sent the message and I want this feature to make it so all messages to a channel with this set cause a notification rather than specific users
Right: soju.im/alert=1 wouldn't make sense for users since that's already the default. One could argue that soju.im/alert=0 on a user should stop notifying each time a message is sent, but we already have soju.im/muted for this.
tl;dr I agree it would make more sense to have in Channel.
337271305f
96f5177a2d
How does this interact with:
soju.im/muted: it seems a bit weird to set a channel as muted and to ask to be notified each time a message is sent. Not sure we want to add dependencies between metadata keys though...- The existing
-relay-detached=messagesetting for channels? It sounds pretty similar? I'm not sure we want to introduce two knobs for the same thing. - Instead of a boolean, would it make more sense to add a tri-state, e.g.
soju.im/notify=none|highlight|message? Hm, but still wouldn't let us get rid ofsoju.im/mutedor else we'd break existing clients... (Also as discussed above not sure all values make sense for users...)
@emersion wrote in #73 (comment):
How does this interact with:
* `soju.im/muted`: it seems a bit weird to set a channel as muted _and_ to ask to be notified each time a message is sent. Not sure we want to add dependencies between metadata keys though...
Yeah I thought about this, as it stands muting a channel will take precedence and notifications wont come through which I think is as one would expect. Having soju toggle muted when alert is set and vice versa and broadcast the METADATA SET for the automatically toggled entry might be an okay solution, but I'm not sure if that's a good behavior
* The existing `-relay-detached=message` setting for channels? It sounds pretty similar? I'm not sure we want to introduce two knobs for the same thing.
I'm not sure how this works, does it basically operate as BouncerServ sending a DM that there was a message in channel x? I think that does have some overlap but with this it does make it easier to build UI and also not require setting channels as detached, I havent used that feature of soju though so dont know much about it.
* Instead of a boolean, would it make more sense to add a tri-state, e.g. `soju.im/notify=none|highlight|message`? Hm, but still wouldn't let us get rid of `soju.im/muted` or else we'd break existing clients... (Also as discussed above not sure all values make sense for users...)
Yeah I think this would be ideal but the process of migration seems like itd be fairly painful. We could keep soju.im/muted and have it exist as a deprecated front for soju.im/notify maybe?
Having soju toggle muted when alert is set and vice versa and broadcast the METADATA SET for the automatically toggled entry might be an okay solution, but I'm not sure if that's a good behavior
Yeah, it's a bit annoying to implement. (If we go for soju.im/notify, we'd need to do something similar.)
does it basically operate as BouncerServ sending a DM that there was a message in channel x?
Detached channels are hidden from clients but still joined. Enabling -relay-detached=message means that the user is interested in being notified about all messages in the channel, which results in BouncerServ relaying these messages. I think we could have a single setting notify=none|highlight|message which works when the channel is attached and when it's detached, instead of two separate knobs. I'm not suggesting that we re-use that setting as-is, I'm suggesting that we could generalize it for attached channels.
Yeah I think this would be ideal but the process of migration seems like itd be fairly painful. We could keep soju.im/muted and have it exist as a deprecated front for soju.im/notify maybe?
Yeah, with some work (as hinted above), it can be a solution I think.
If we make this new setting a channel thing DB-wise, then we'd need to store the metadata value differently depending on whether it's a channel vs user.
Okay I think this all make sense to me, the plan I'll go for is to
- add a column to
MessageTargetcalled notify that uses the existingMessageFiltersemantics - Maybe rename the relay_detached column and usage to be notify for consistency?
- migrate the
mutedcolumn to use the newnotifycolumn inMessageTargetas well as migrating the existing values to therelay_detachedcolumn inChannels - keep current
relay_detachedbehavior on detached channels, for attached channels send notifications as configured - when listing metadata include notify metadata retrieved from Channels in addition to MessageTarget
- For clients subscribed
soju.im/mutedset it to true only ifnotifyis set to None, when modifying muted send metadata notifications to clients subscribed tosoju.im/notifythat its been updated
- database/postgres_migrations.go
- database/sqlite_migrations.go
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.No due date set.
No dependencies set.
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?