mirror of
https://gitea.phreedom.club/localhost_frssoft/bloat.git
synced 2025-06-15 07:28:45 +00:00
Merge branch 'master' into absolute_fluoride
This commit is contained in:
commit
b8c0133bcd
29 changed files with 214 additions and 263 deletions
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
@ -415,7 +415,13 @@ func NewHandler(s *service, logger *log.Logger, staticDir string) http.Handler {
|
|||
|
||||
mute := handle(func(c *client) error {
|
||||
id, _ := mux.Vars(c.r)["id"]
|
||||
err := s.Mute(c, id)
|
||||
q := c.r.URL.Query()
|
||||
var notifications *bool
|
||||
if r, ok := q["notifications"]; ok && len(r) > 0 {
|
||||
notifications = new(bool)
|
||||
*notifications = r[0] == "true"
|
||||
}
|
||||
err := s.Mute(c, id, notifications)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -484,20 +490,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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue