aboutsummaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
authorr <r@freesoftwareextremist.com>2021-12-13 13:58:15 +0000
committerr <r@freesoftwareextremist.com>2021-12-13 13:58:15 +0000
commitdb29c3d87404677c9c02f62097d8a0307cd8d5da (patch)
treed0dc0d24b67edb26521c6dfa0f1b453868255d0f /service
parent1c8c661abb4beda77edefe421fba1a52cf933956 (diff)
downloadbloat-db29c3d87404677c9c02f62097d8a0307cd8d5da.tar.gz
bloat-db29c3d87404677c9c02f62097d8a0307cd8d5da.zip
Add an option to hide unsupported notifications
Diffstat (limited to 'service')
-rw-r--r--service/service.go17
-rw-r--r--service/transport.go24
2 files changed, 27 insertions, 14 deletions
diff --git a/service/service.go b/service/service.go
index 7122666..9cad731 100644
--- a/service/service.go
+++ b/service/service.go
@@ -410,18 +410,29 @@ func (s *service) NotificationPage(c *client, maxID string,
var nextLink string
var unreadCount int
var readID string
- var excludes []string
+ var includes, excludes []string
var pg = mastodon.Pagination{
MaxID: maxID,
MinID: minID,
Limit: 20,
}
+ if c.s.Settings.HideUnsupportedNotifs {
+ // Explicitly include the supported types.
+ // For now, only Pleroma supports this option, Mastadon
+ // will simply ignore the unknown params.
+ includes = []string{"follow", "follow_request", "mention", "reblog", "favourite"}
+
+ // Explicitly exclude the unsupported types.
+ // Pleroma prioritizes includes over excludes, but we
+ // still specify excludes to make it work with Mastadon.
+ excludes = []string{"poll"}
+ }
if c.s.Settings.AntiDopamineMode {
- excludes = []string{"follow", "favourite", "reblog"}
+ excludes = append(excludes, "follow", "favourite", "reblog")
}
- notifications, err := c.GetNotifications(c.ctx, &pg, excludes)
+ notifications, err := c.GetNotifications(c.ctx, &pg, includes, excludes)
if err != nil {
return
}
diff --git a/service/transport.go b/service/transport.go
index a7912e6..615fe2a 100644
--- a/service/transport.go
+++ b/service/transport.go
@@ -481,20 +481,22 @@ func NewHandler(s *service, logger *log.Logger, staticDir string) http.Handler {
fluorideMode := c.r.FormValue("fluoride_mode") == "true"
darkMode := c.r.FormValue("dark_mode") == "true"
antiDopamineMode := c.r.FormValue("anti_dopamine_mode") == "true"
+ hideUnsupportedNotifs := c.r.FormValue("hide_unsupported_notifs") == "true"
css := c.r.FormValue("css")
settings := &model.Settings{
- DefaultVisibility: visibility,
- DefaultFormat: format,
- CopyScope: copyScope,
- ThreadInNewTab: threadInNewTab,
- HideAttachments: hideAttachments,
- MaskNSFW: maskNSFW,
- NotificationInterval: ni,
- FluorideMode: fluorideMode,
- DarkMode: darkMode,
- AntiDopamineMode: antiDopamineMode,
- CSS: css,
+ DefaultVisibility: visibility,
+ DefaultFormat: format,
+ CopyScope: copyScope,
+ ThreadInNewTab: threadInNewTab,
+ HideAttachments: hideAttachments,
+ MaskNSFW: maskNSFW,
+ NotificationInterval: ni,
+ FluorideMode: fluorideMode,
+ DarkMode: darkMode,
+ AntiDopamineMode: antiDopamineMode,
+ HideUnsupportedNotifs: hideUnsupportedNotifs,
+ CSS: css,
}
err := s.SaveSettings(c, settings)