mirror of
https://gitea.phreedom.club/localhost_frssoft/bloat.git
synced 2025-05-09 13:28:44 +00:00
Just merge with upstream/master
This commit is contained in:
commit
fa5eaa4442
8 changed files with 66 additions and 57 deletions
|
@ -734,6 +734,19 @@ func (s *service) UserSearchPage(c *client,
|
|||
return s.renderer.Render(c.rctx, c.w, renderer.UserSearchPage, data)
|
||||
}
|
||||
|
||||
func (s *service) MutePage(c *client, id string) (err error) {
|
||||
user, err := c.GetAccount(c.ctx, id)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
cdata := s.cdata(c, "Mute"+user.DisplayName+" @"+user.Acct, 0, 0, "")
|
||||
data := &renderer.UserData{
|
||||
User: user,
|
||||
CommonData: cdata,
|
||||
}
|
||||
return s.renderer.Render(c.rctx, c.w, renderer.MutePage, data)
|
||||
}
|
||||
|
||||
func (s *service) AboutPage(c *client) (err error) {
|
||||
cdata := s.cdata(c, "about", 0, 0, "")
|
||||
data := &renderer.AboutData{
|
||||
|
@ -1104,8 +1117,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, notifications *bool) (err error) {
|
||||
_, err = c.AccountMute(c.ctx, id, notifications)
|
||||
func (s *service) Mute(c *client, id string, notifications bool, duration int) (err error) {
|
||||
_, err = c.AccountMute(c.ctx, id, notifications, duration)
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
@ -178,6 +178,11 @@ func NewHandler(s *service, logger *log.Logger, staticDir string) http.Handler {
|
|||
return s.UserSearchPage(c, id, sq, offset)
|
||||
}, SESSION, HTML)
|
||||
|
||||
mutePage := handle(func(c *client) error {
|
||||
id, _ := mux.Vars(c.r)["id"]
|
||||
return s.MutePage(c, id)
|
||||
}, SESSION, HTML)
|
||||
|
||||
aboutPage := handle(func(c *client) error {
|
||||
return s.AboutPage(c)
|
||||
}, SESSION, HTML)
|
||||
|
@ -467,17 +472,13 @@ func NewHandler(s *service, logger *log.Logger, staticDir string) http.Handler {
|
|||
|
||||
mute := handle(func(c *client) error {
|
||||
id, _ := mux.Vars(c.r)["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)
|
||||
notifications, _ := strconv.ParseBool(c.r.FormValue("notifications"))
|
||||
duration, _ := strconv.Atoi(c.r.FormValue("duration"))
|
||||
err := s.Mute(c, id, notifications, duration)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
c.redirect(c.r.FormValue("referrer"))
|
||||
c.redirect("/user/" + id)
|
||||
return nil
|
||||
}, CSRF, HTML)
|
||||
|
||||
|
@ -805,6 +806,7 @@ func NewHandler(s *service, logger *log.Logger, staticDir string) http.Handler {
|
|||
r.HandleFunc("/user/{id}", userPage).Methods(http.MethodGet)
|
||||
r.HandleFunc("/user/{id}/{type}", userPage).Methods(http.MethodGet)
|
||||
r.HandleFunc("/usersearch/{id}", userSearchPage).Methods(http.MethodGet)
|
||||
r.HandleFunc("/mute/{id}", mutePage).Methods(http.MethodGet)
|
||||
r.HandleFunc("/about", aboutPage).Methods(http.MethodGet)
|
||||
r.HandleFunc("/aboutinstance", aboutInstance).Methods(http.MethodGet)
|
||||
r.HandleFunc("/emojis", emojisPage).Methods(http.MethodGet)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue