mirror of
https://github.com/signaller-matrix/signaller.git
synced 2024-11-09 12:11:03 +00:00
fix: Fix bug with filter adding
This commit is contained in:
parent
501c7b0795
commit
6dba957e5f
@ -7,6 +7,8 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
|
"github.com/signaller-matrix/signaller/internal/models/common"
|
||||||
|
|
||||||
"github.com/signaller-matrix/signaller/internal"
|
"github.com/signaller-matrix/signaller/internal"
|
||||||
"github.com/signaller-matrix/signaller/internal/models"
|
"github.com/signaller-matrix/signaller/internal/models"
|
||||||
"github.com/signaller-matrix/signaller/internal/models/createroom"
|
"github.com/signaller-matrix/signaller/internal/models/createroom"
|
||||||
@ -52,7 +54,8 @@ func (backend *Backend) Register(username, password, device string) (user intern
|
|||||||
name: username,
|
name: username,
|
||||||
password: password,
|
password: password,
|
||||||
Tokens: make(map[string]Token),
|
Tokens: make(map[string]Token),
|
||||||
backend: backend}
|
backend: backend,
|
||||||
|
filters: make(map[string]common.Filter)}
|
||||||
|
|
||||||
backend.data[username] = user
|
backend.data[username] = user
|
||||||
|
|
||||||
|
@ -324,7 +324,7 @@ func CapabilitiesHandler(w http.ResponseWriter, r *http.Request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func AddFilterHandler(w http.ResponseWriter, r *http.Request) {
|
func AddFilterHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
if r.Method != http.MethodGet {
|
if r.Method != http.MethodPost {
|
||||||
errorResponse(w, models.M_UNKNOWN, http.StatusBadRequest, "wrong method: "+r.Method)
|
errorResponse(w, models.M_UNKNOWN, http.StatusBadRequest, "wrong method: "+r.Method)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -40,7 +40,7 @@ func NewServer(port int) (*Server, error) {
|
|||||||
router.HandleFunc("/_matrix/client/r0/rooms/{roomId}/leave", leaveRoomHandler)
|
router.HandleFunc("/_matrix/client/r0/rooms/{roomId}/leave", leaveRoomHandler)
|
||||||
router.HandleFunc("/_matrix/client/r0/register/available", registerAvailableHandler)
|
router.HandleFunc("/_matrix/client/r0/register/available", registerAvailableHandler)
|
||||||
router.HandleFunc("/_matrix/client/r0/publicRooms", publicRoomsHandler)
|
router.HandleFunc("/_matrix/client/r0/publicRooms", publicRoomsHandler)
|
||||||
router.HandleFunc("/_matrix/client/r0/user/{userId}/filter/{filterId}", GetFilterHandler).Methods("GET")
|
router.HandleFunc("/_matrix/client/r0/user/{userId}/filter/{filterID}", GetFilterHandler).Methods("GET")
|
||||||
router.HandleFunc("/_matrix/client/r0/user/{userId}/filter", AddFilterHandler).Methods("POST")
|
router.HandleFunc("/_matrix/client/r0/user/{userId}/filter", AddFilterHandler).Methods("POST")
|
||||||
|
|
||||||
router.HandleFunc("/", RootHandler)
|
router.HandleFunc("/", RootHandler)
|
||||||
|
Loading…
Reference in New Issue
Block a user