mirror of
https://github.com/signaller-matrix/signaller.git
synced 2024-11-24 11:22:20 +00:00
Make coomon.Filter synonym of filter request
This commit is contained in:
parent
330f362e54
commit
91b28d2dc1
@ -2,9 +2,9 @@ package internal
|
||||
|
||||
import (
|
||||
"github.com/signaller-matrix/signaller/internal/models"
|
||||
"github.com/signaller-matrix/signaller/internal/models/common"
|
||||
"github.com/signaller-matrix/signaller/internal/models/createroom"
|
||||
"github.com/signaller-matrix/signaller/internal/models/devices"
|
||||
"github.com/signaller-matrix/signaller/internal/models/filter"
|
||||
"github.com/signaller-matrix/signaller/internal/models/rooms"
|
||||
"github.com/signaller-matrix/signaller/internal/models/sync"
|
||||
)
|
||||
@ -51,6 +51,6 @@ type User interface {
|
||||
LogoutAll()
|
||||
JoinRoom(Room) models.ApiError
|
||||
Invite(Room, User) models.ApiError
|
||||
AddFilter(filterID string, filterReq filter.Request)
|
||||
GetFilterByID(filterID string) *filter.Request
|
||||
AddFilter(filterID string, filter common.Filter)
|
||||
GetFilterByID(filterID string) *common.Filter
|
||||
}
|
||||
|
@ -9,8 +9,8 @@ import (
|
||||
|
||||
"github.com/signaller-matrix/signaller/internal"
|
||||
"github.com/signaller-matrix/signaller/internal/models"
|
||||
"github.com/signaller-matrix/signaller/internal/models/common"
|
||||
"github.com/signaller-matrix/signaller/internal/models/createroom"
|
||||
"github.com/signaller-matrix/signaller/internal/models/filter"
|
||||
mSync "github.com/signaller-matrix/signaller/internal/models/sync"
|
||||
)
|
||||
|
||||
@ -54,7 +54,7 @@ func (backend *Backend) Register(username, password, device string) (user intern
|
||||
password: password,
|
||||
Tokens: make(map[string]Token),
|
||||
backend: backend,
|
||||
filters: make(map[string]filter.Request)}
|
||||
filters: make(map[string]common.Filter)}
|
||||
|
||||
backend.data[username] = user
|
||||
|
||||
|
@ -6,9 +6,9 @@ import (
|
||||
|
||||
"github.com/signaller-matrix/signaller/internal"
|
||||
"github.com/signaller-matrix/signaller/internal/models"
|
||||
"github.com/signaller-matrix/signaller/internal/models/common"
|
||||
"github.com/signaller-matrix/signaller/internal/models/createroom"
|
||||
"github.com/signaller-matrix/signaller/internal/models/devices"
|
||||
"github.com/signaller-matrix/signaller/internal/models/filter"
|
||||
"github.com/signaller-matrix/signaller/internal/models/rooms"
|
||||
)
|
||||
|
||||
@ -16,7 +16,7 @@ type User struct {
|
||||
name string
|
||||
password string
|
||||
Tokens map[string]Token
|
||||
filters map[string]filter.Request
|
||||
filters map[string]common.Filter
|
||||
|
||||
backend *Backend
|
||||
|
||||
@ -278,14 +278,14 @@ func (user *User) JoinRoom(room internal.Room) models.ApiError {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (user *User) AddFilter(filterID string, filterReq filter.Request) {
|
||||
func (user *User) AddFilter(filterID string, filter common.Filter) {
|
||||
user.mutex.Lock()
|
||||
defer user.mutex.Unlock()
|
||||
|
||||
user.filters[filterID] = filterReq
|
||||
user.filters[filterID] = filter
|
||||
}
|
||||
|
||||
func (user *User) GetFilterByID(filterID string) *filter.Request {
|
||||
func (user *User) GetFilterByID(filterID string) *common.Filter {
|
||||
user.mutex.RLock()
|
||||
defer user.mutex.RUnlock()
|
||||
|
||||
|
@ -351,7 +351,7 @@ func AddFilterHandler(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
filterID := RandomString(12)
|
||||
user.AddFilter(filterID, request)
|
||||
user.AddFilter(filterID, common.Filter(request))
|
||||
|
||||
response := filter.Response{FilterID: filterID}
|
||||
|
||||
|
5
internal/models/common/filter.go
Normal file
5
internal/models/common/filter.go
Normal file
@ -0,0 +1,5 @@
|
||||
package common
|
||||
|
||||
import "github.com/signaller-matrix/signaller/internal/models/filter"
|
||||
|
||||
type Filter filter.Request
|
Loading…
Reference in New Issue
Block a user