mirror of
https://github.com/element-hq/dendrite.git
synced 2025-09-15 05:32:25 +03:00
refactor: update GMSL (#3058)
Sister PR to https://github.com/matrix-org/gomatrixserverlib/pull/364 Read this commit by commit to avoid going insane.
This commit is contained in:
parent
9fa39263c0
commit
72285b2659
306 changed files with 2117 additions and 1934 deletions
|
@ -20,6 +20,7 @@ import (
|
|||
|
||||
"github.com/matrix-org/gomatrixserverlib"
|
||||
"github.com/matrix-org/gomatrixserverlib/fclient"
|
||||
"github.com/matrix-org/gomatrixserverlib/spec"
|
||||
"github.com/matrix-org/util"
|
||||
|
||||
"github.com/matrix-org/dendrite/clientapi/httputil"
|
||||
|
@ -35,7 +36,7 @@ type roomDirectoryResponse struct {
|
|||
Servers []string `json:"servers"`
|
||||
}
|
||||
|
||||
func (r *roomDirectoryResponse) fillServers(servers []gomatrixserverlib.ServerName) {
|
||||
func (r *roomDirectoryResponse) fillServers(servers []spec.ServerName) {
|
||||
r.Servers = make([]string, len(servers))
|
||||
for i, s := range servers {
|
||||
r.Servers[i] = string(s)
|
||||
|
@ -253,7 +254,7 @@ func GetVisibility(
|
|||
|
||||
var v roomVisibility
|
||||
if len(res.RoomIDs) == 1 {
|
||||
v.Visibility = gomatrixserverlib.Public
|
||||
v.Visibility = spec.Public
|
||||
} else {
|
||||
v.Visibility = "private"
|
||||
}
|
||||
|
@ -278,7 +279,7 @@ func SetVisibility(
|
|||
queryEventsReq := roomserverAPI.QueryLatestEventsAndStateRequest{
|
||||
RoomID: roomID,
|
||||
StateToFetch: []gomatrixserverlib.StateKeyTuple{{
|
||||
EventType: gomatrixserverlib.MRoomPowerLevels,
|
||||
EventType: spec.MRoomPowerLevels,
|
||||
StateKey: "",
|
||||
}},
|
||||
}
|
||||
|
@ -291,7 +292,7 @@ func SetVisibility(
|
|||
|
||||
// NOTSPEC: Check if the user's power is greater than power required to change m.room.canonical_alias event
|
||||
power, _ := gomatrixserverlib.NewPowerLevelContentFromEvent(queryEventsRes.StateEvents[0].Event)
|
||||
if power.UserLevel(dev.UserID) < power.EventLevel(gomatrixserverlib.MRoomCanonicalAlias, true) {
|
||||
if power.UserLevel(dev.UserID) < power.EventLevel(spec.MRoomCanonicalAlias, true) {
|
||||
return util.JSONResponse{
|
||||
Code: http.StatusForbidden,
|
||||
JSON: jsonerror.Forbidden("userID doesn't have power level to change visibility"),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue