aboutsummaryrefslogtreecommitdiff
path: root/service/service.go
diff options
context:
space:
mode:
authorr <r@freesoftwareextremist.com>2022-01-27 12:05:15 +0000
committerr <r@freesoftwareextremist.com>2022-01-27 12:05:15 +0000
commitb8c0133bcd5e7f1d4063ad992949cc19d18e7aad (patch)
tree5322b83d194c9ffcb498627bdd16175f9508d87d /service/service.go
parent54c42455f393c5ae8ebdb19884d40ebd9a18f755 (diff)
parent4ef5e0daf285f41850c9ac53b0322d85fbf5eaec (diff)
downloadbloat-b8c0133bcd5e7f1d4063ad992949cc19d18e7aad.tar.gz
bloat-b8c0133bcd5e7f1d4063ad992949cc19d18e7aad.zip
Merge branch 'master' into absolute_fluoride
Diffstat (limited to 'service/service.go')
-rw-r--r--service/service.go19
1 files changed, 13 insertions, 6 deletions
diff --git a/service/service.go b/service/service.go
index a846322..c56114c 100644
--- a/service/service.go
+++ b/service/service.go
@@ -114,7 +114,8 @@ func (s *service) ErrorPage(c *client, err error, retry bool) error {
var sessionErr bool
if err != nil {
errStr = err.Error()
- if err == errInvalidSession || err == errInvalidCSRFToken {
+ if me, ok := err.(mastodon.Error); ok && me.IsAuthError() ||
+ err == errInvalidSession || err == errInvalidCSRFToken {
sessionErr = true
}
}
@@ -417,18 +418,24 @@ 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"}
+ }
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
}
@@ -914,8 +921,8 @@ func (s *service) Reject(c *client, id string) (err error) {
return c.FollowRequestReject(c.ctx, id)
}
-func (s *service) Mute(c *client, id string) (err error) {
- _, err = c.AccountMute(c.ctx, id)
+func (s *service) Mute(c *client, id string, notifications *bool) (err error) {
+ _, err = c.AccountMute(c.ctx, id, notifications)
return
}