aboutsummaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
authorHyphen <hyphen@tfwno.gf>2020-09-02 19:50:48 +0200
committerr <r@freesoftwareextremist.com>2020-09-03 04:49:11 +0000
commit28695fb8e6b299389347fc8c42f7dc3923b42f24 (patch)
tree21d2690cb09f86c81fb4d85e86beff9fb5602450 /service
parent71c5da7b3b9e816caa52dbf9e332c5b10112c93d (diff)
downloadbloat-28695fb8e6b299389347fc8c42f7dc3923b42f24.tar.gz
bloat-28695fb8e6b299389347fc8c42f7dc3923b42f24.zip
Add the Anti Dopamine feature
Diffstat (limited to 'service')
-rw-r--r--service/service.go9
-rw-r--r--service/transport.go2
2 files changed, 10 insertions, 1 deletions
diff --git a/service/service.go b/service/service.go
index 35ce3bd..cc59cb6 100644
--- a/service/service.go
+++ b/service/service.go
@@ -116,6 +116,7 @@ func getRendererContext(c *model.Client) *renderer.Context {
DarkMode: settings.DarkMode,
CSRFToken: session.CSRFToken,
UserID: session.UserID,
+ AntiDopamineMode: settings.AntiDopamineMode,
}
}
@@ -402,13 +403,19 @@ func (svc *service) ServeNotificationPage(c *model.Client, maxID string,
var nextLink string
var unreadCount int
var readID string
+ var excludes []string
var pg = mastodon.Pagination{
MaxID: maxID,
MinID: minID,
Limit: 20,
}
- notifications, err := c.GetNotifications(ctx, &pg)
+ dope := c.Session.Settings.AntiDopamineMode
+ if dope {
+ excludes = append(excludes, "follow", "favourite", "reblog")
+ }
+
+ notifications, err := c.GetNotifications(ctx, &pg, excludes...)
if err != nil {
return
}
diff --git a/service/transport.go b/service/transport.go
index 131c580..7d27a84 100644
--- a/service/transport.go
+++ b/service/transport.go
@@ -591,6 +591,7 @@ func NewHandler(s Service, staticDir string) http.Handler {
arn := req.FormValue("auto_refresh_notifications") == "true"
fluorideMode := req.FormValue("fluoride_mode") == "true"
darkMode := req.FormValue("dark_mode") == "true"
+ antiDopamineMode := req.FormValue("anti_dopamine_mode") == "true"
settings := &model.Settings{
DefaultVisibility: visibility,
@@ -601,6 +602,7 @@ func NewHandler(s Service, staticDir string) http.Handler {
AutoRefreshNotifications: arn,
FluorideMode: fluorideMode,
DarkMode: darkMode,
+ AntiDopamineMode: antiDopamineMode,
}
err := s.SaveSettings(c, settings)