Manage notification channels separately and migrate

It's more convenient to manage notification channels separately, as it
is done with email settings. Notification hook and other forms are
adopted to only select channels. Hooks can now use more than one
channel.
This commit is contained in:
eikek
2022-01-19 21:51:18 +01:00
parent d41490dd88
commit 23cb34a6ff
78 changed files with 2583 additions and 1422 deletions

View File

@ -48,17 +48,11 @@ type alias HttpModel =
}
type alias RefModel =
{ channelType : ChannelType
}
type Model
= Matrix MatrixModel
| Gotify GotifyModel
| Mail MailModel
| Http HttpModel
| Ref RefModel
type Msg
@ -147,11 +141,6 @@ initWith flags channel =
, Cmd.none
)
Data.NotificationChannel.Ref m ->
( Ref { channelType = m.channelType }
, Cmd.none
)
channelType : Model -> ChannelType
channelType model =
@ -168,9 +157,6 @@ channelType model =
Http _ ->
Data.ChannelType.Http
Ref ref ->
ref.channelType
getChannel : Model -> Maybe NotificationChannel
getChannel model =
@ -187,9 +173,6 @@ getChannel model =
Http mm ->
Maybe.map Data.NotificationChannel.Http mm.value
Ref _ ->
Nothing
--- Update
@ -269,12 +252,3 @@ view texts settings model =
Http m ->
Html.map HttpMsg
(Comp.NotificationHttpForm.view texts.httpForm m.form)
-- Note: currently when retrieving hooks, this is not
-- send from the server. The server always sends
-- concrete channel details. However, it is possible
-- to create hooks with a reference to an existing
-- channel, but this is not supported in this client.
-- So this channel is ignored here.
Ref _ ->
span [ class "hidden" ] []