mirror of
https://gitea.phreedom.club/localhost_frssoft/bloat.git
synced 2025-05-06 03:48:45 +00:00
Added pin\unpin statuses; Status ID in code tag
This commit is contained in:
parent
9a6e1324d5
commit
4df1f096be
4 changed files with 48 additions and 2 deletions
|
@ -1150,6 +1150,14 @@ func (s *service) UnMuteConversation(c *client, id string) (err error) {
|
|||
return
|
||||
}
|
||||
|
||||
func (s *service) Pin(c *client, id string) (err error) {
|
||||
return c.Pin(c.ctx, id)
|
||||
}
|
||||
|
||||
func (s *service) UnPin(c *client, id string) (err error) {
|
||||
return c.UnPin(c.ctx, id)
|
||||
}
|
||||
|
||||
func (s *service) Delete(c *client, id string) (err error) {
|
||||
return c.DeleteStatus(c.ctx, id)
|
||||
}
|
||||
|
|
|
@ -572,6 +572,26 @@ func NewHandler(s *service, logger *log.Logger, staticDir string) http.Handler {
|
|||
return nil
|
||||
}, CSRF, HTML)
|
||||
|
||||
pin := handle(func(c *client) error {
|
||||
id, _ := mux.Vars(c.r)["id"]
|
||||
err := s.Pin(c, id)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
redirect(c, c.r.FormValue("referrer"))
|
||||
return nil
|
||||
}, CSRF, HTML)
|
||||
|
||||
unpin := handle(func(c *client) error {
|
||||
id, _ := mux.Vars(c.r)["id"]
|
||||
err := s.UnPin(c, id)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
redirect(c, c.r.FormValue("referrer"))
|
||||
return nil
|
||||
}, CSRF, HTML)
|
||||
|
||||
delete := handle(func(c *client) error {
|
||||
id, _ := mux.Vars(c.r)["id"]
|
||||
err := s.Delete(c, id)
|
||||
|
@ -794,6 +814,8 @@ func NewHandler(s *service, logger *log.Logger, staticDir string) http.Handler {
|
|||
r.HandleFunc("/settings", settings).Methods(http.MethodPost)
|
||||
r.HandleFunc("/muteconv/{id}", muteConversation).Methods(http.MethodPost)
|
||||
r.HandleFunc("/unmuteconv/{id}", unMuteConversation).Methods(http.MethodPost)
|
||||
r.HandleFunc("/pin/{id}", pin).Methods(http.MethodPost)
|
||||
r.HandleFunc("/unpin/{id}", unpin).Methods(http.MethodPost)
|
||||
r.HandleFunc("/delete/{id}", delete).Methods(http.MethodPost)
|
||||
r.HandleFunc("/notifications/read", readNotifications).Methods(http.MethodPost)
|
||||
r.HandleFunc("/bookmark/{id}", bookmark).Methods(http.MethodPost)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue