mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-29 01:33:10 -06:00
Reformat canonical alias stuff
This commit is contained in:
parent
4e68ce3a06
commit
d9ca7565b0
|
|
@ -169,15 +169,16 @@ func NotTrusted(serverName string) *MatrixError {
|
||||||
Err: fmt.Sprintf("Untrusted server '%s'", serverName),
|
Err: fmt.Sprintf("Untrusted server '%s'", serverName),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// BadAlias is an error which is returned when one or more aliases within a
|
// BadAlias is an error which is returned when one or more aliases within a
|
||||||
// m.room.canonical_alias event do not point to the room ID for which the state
|
// m.room.canonical_alias event do not point to the room ID for which the state
|
||||||
// event is to be sent to.
|
// event is to be sent to.
|
||||||
func BadAlias(msg string) *MatrixError {
|
func BadAlias(msg string) *MatrixError {
|
||||||
return &MatrixError{"M_BAD_ALIAS", msg}
|
return &MatrixError{"M_BAD_ALIAS", msg}
|
||||||
}
|
}
|
||||||
|
|
||||||
// InvalidParam is an error return when an alias from a m.room.canonical_alias
|
// InvalidParam is an error return when an alias from a m.room.canonical_alias
|
||||||
// contains a malformed alias
|
// contains a malformed alias
|
||||||
func InvalidParam(msg string) *MatrixError {
|
func InvalidParam(msg string) *MatrixError {
|
||||||
return &MatrixError{"M_INVALID_PARAM", msg}
|
return &MatrixError{"M_INVALID_PARAM", msg}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,14 +15,14 @@
|
||||||
package routing
|
package routing
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
"encoding/json"
|
|
||||||
|
|
||||||
"github.com/matrix-org/dendrite/clientapi/httputil"
|
"github.com/matrix-org/dendrite/clientapi/httputil"
|
||||||
"github.com/matrix-org/dendrite/clientapi/jsonerror"
|
"github.com/matrix-org/dendrite/clientapi/jsonerror"
|
||||||
"github.com/matrix-org/dendrite/internal/eventutil"
|
|
||||||
federationSenderAPI "github.com/matrix-org/dendrite/federationsender/api"
|
federationSenderAPI "github.com/matrix-org/dendrite/federationsender/api"
|
||||||
|
"github.com/matrix-org/dendrite/internal/eventutil"
|
||||||
roomserverAPI "github.com/matrix-org/dendrite/roomserver/api"
|
roomserverAPI "github.com/matrix-org/dendrite/roomserver/api"
|
||||||
"github.com/matrix-org/dendrite/setup/config"
|
"github.com/matrix-org/dendrite/setup/config"
|
||||||
"github.com/matrix-org/dendrite/userapi/api"
|
"github.com/matrix-org/dendrite/userapi/api"
|
||||||
|
|
@ -196,7 +196,7 @@ func RemoveLocalAlias(
|
||||||
req *http.Request,
|
req *http.Request,
|
||||||
device *api.Device,
|
device *api.Device,
|
||||||
alias string,
|
alias string,
|
||||||
cfg *config.ClientAPI,
|
cfg *config.ClientAPI,
|
||||||
rsAPI roomserverAPI.RoomserverInternalAPI,
|
rsAPI roomserverAPI.RoomserverInternalAPI,
|
||||||
) util.JSONResponse {
|
) util.JSONResponse {
|
||||||
queryReq := roomserverAPI.RemoveRoomAliasRequest{
|
queryReq := roomserverAPI.RemoveRoomAliasRequest{
|
||||||
|
|
@ -223,19 +223,22 @@ func RemoveLocalAlias(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var updatedCanonicalAlias *eventutil.CanonicalAlias
|
updatedCanonicalAlias := eventutil.CanonicalAlias{
|
||||||
updated, resErr := getUpdatedCanonicalAliasState(req, device, queryRes.RoomID, alias, rsAPI, updatedCanonicalAlias)
|
Alias: "",
|
||||||
if resErr != nil {
|
AltAliases: []string{""},
|
||||||
return *resErr;
|
}
|
||||||
}
|
updated, resErr := getUpdatedCanonicalAliasState(req, queryRes.RoomID, alias, rsAPI, &updatedCanonicalAlias)
|
||||||
// If the alias removed is one of the alt_aliases or the canonical one,
|
if resErr != nil {
|
||||||
// we need to also remove it from the canonical_alias event
|
return *resErr
|
||||||
if updated {
|
}
|
||||||
resErr := updateCanonicalAlias(req, device, queryRes.RoomID, cfg, rsAPI, updatedCanonicalAlias)
|
// If the alias removed is one of the alt_aliases or the canonical one,
|
||||||
if resErr != nil {
|
// we need to also remove it from the canonical_alias event
|
||||||
return *resErr;
|
if updated {
|
||||||
}
|
resErr := updateCanonicalAlias(req, device, queryRes.RoomID, cfg, rsAPI, &updatedCanonicalAlias)
|
||||||
}
|
if resErr != nil {
|
||||||
|
return *resErr
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return util.JSONResponse{
|
return util.JSONResponse{
|
||||||
Code: http.StatusOK,
|
Code: http.StatusOK,
|
||||||
|
|
@ -245,109 +248,105 @@ func RemoveLocalAlias(
|
||||||
|
|
||||||
func getUpdatedCanonicalAliasState(
|
func getUpdatedCanonicalAliasState(
|
||||||
req *http.Request,
|
req *http.Request,
|
||||||
device *api.Device,
|
|
||||||
roomID string,
|
roomID string,
|
||||||
alias string,
|
alias string,
|
||||||
rsAPI roomserverAPI.RoomserverInternalAPI,
|
rsAPI roomserverAPI.RoomserverInternalAPI,
|
||||||
updatedCanonicalAlias *eventutil.CanonicalAlias,
|
updatedCanonicalAlias *eventutil.CanonicalAlias,
|
||||||
) ( bool, *util.JSONResponse ) {
|
) (bool, *util.JSONResponse) {
|
||||||
updated := false
|
updated := false
|
||||||
stateTuple := gomatrixserverlib.StateKeyTuple{
|
stateTuple := gomatrixserverlib.StateKeyTuple{
|
||||||
EventType: gomatrixserverlib.MRoomCanonicalAlias,
|
EventType: gomatrixserverlib.MRoomCanonicalAlias,
|
||||||
StateKey: "",
|
StateKey: "",
|
||||||
}
|
}
|
||||||
stateReq := roomserverAPI.QueryCurrentStateRequest {
|
stateReq := roomserverAPI.QueryCurrentStateRequest{
|
||||||
RoomID: roomID,
|
RoomID: roomID,
|
||||||
StateTuples: []gomatrixserverlib.StateKeyTuple{stateTuple},
|
StateTuples: []gomatrixserverlib.StateKeyTuple{stateTuple},
|
||||||
}
|
}
|
||||||
stateRes := &roomserverAPI.QueryCurrentStateResponse{}
|
stateRes := &roomserverAPI.QueryCurrentStateResponse{}
|
||||||
err := rsAPI.QueryCurrentState(req.Context(), &stateReq, stateRes)
|
err := rsAPI.QueryCurrentState(req.Context(), &stateReq, stateRes)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
util.GetLogger(req.Context()).WithError(err).Error("Query state failed")
|
util.GetLogger(req.Context()).WithError(err).Error("Query state failed")
|
||||||
resErr := jsonerror.InternalServerError()
|
resErr := jsonerror.InternalServerError()
|
||||||
return false, &resErr
|
return false, &resErr
|
||||||
}
|
}
|
||||||
|
|
||||||
updatedCanonicalAlias = &eventutil.CanonicalAlias {
|
// We try to get the current canonical_alias state, and if found compare its content
|
||||||
Alias: "",
|
// to the removed alias
|
||||||
AltAliases: []string{""},
|
if canonicalAliasEvent, ok := stateRes.StateEvents[stateTuple]; ok {
|
||||||
}
|
canonicalAliasContent := eventutil.CanonicalAlias{
|
||||||
// We try to get the current canonical_alias state, and if found compare its content
|
Alias: "",
|
||||||
// to the removed alias
|
AltAliases: []string{""},
|
||||||
if canonicalAliasEvent, ok := stateRes.StateEvents[stateTuple]; ok {
|
}
|
||||||
canonicalAliasContent := eventutil.CanonicalAlias {
|
// TODO handle differently malformed event?
|
||||||
Alias: "",
|
err := json.Unmarshal(canonicalAliasEvent.Content(), &canonicalAliasContent)
|
||||||
AltAliases: []string{""},
|
if err != nil {
|
||||||
}
|
util.GetLogger(req.Context()).WithError(err).Error("Get canonical_alias event content failed")
|
||||||
err := json.Unmarshal(canonicalAliasEvent.Content(), &canonicalAliasContent)
|
resErr := jsonerror.InternalServerError()
|
||||||
if err != nil {
|
return false, &resErr
|
||||||
util.GetLogger(req.Context()).WithError(err).Error("Get canonical_alias event content failed")
|
}
|
||||||
resErr := jsonerror.InternalServerError()
|
if alias == canonicalAliasContent.Alias {
|
||||||
return false, &resErr
|
updated = true
|
||||||
}
|
} else {
|
||||||
if alias == canonicalAliasContent.Alias {
|
updatedCanonicalAlias.Alias = canonicalAliasContent.Alias
|
||||||
updated = true
|
}
|
||||||
} else {
|
for _, s := range canonicalAliasContent.AltAliases {
|
||||||
updatedCanonicalAlias.Alias = canonicalAliasContent.Alias
|
if alias == s {
|
||||||
}
|
updated = true
|
||||||
for _, s := range(canonicalAliasContent.AltAliases) {
|
} else {
|
||||||
if alias == s {
|
updatedCanonicalAlias.AltAliases = append(updatedCanonicalAlias.AltAliases, s)
|
||||||
updated = true
|
}
|
||||||
} else {
|
}
|
||||||
updatedCanonicalAlias.AltAliases = append(updatedCanonicalAlias.AltAliases, s)
|
}
|
||||||
}
|
return updated, nil
|
||||||
}
|
|
||||||
}
|
|
||||||
return updated, nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func updateCanonicalAlias(
|
func updateCanonicalAlias(
|
||||||
req *http.Request,
|
req *http.Request,
|
||||||
device *api.Device,
|
device *api.Device,
|
||||||
roomID string,
|
roomID string,
|
||||||
cfg *config.ClientAPI,
|
cfg *config.ClientAPI,
|
||||||
rsAPI roomserverAPI.RoomserverInternalAPI,
|
rsAPI roomserverAPI.RoomserverInternalAPI,
|
||||||
updatedCanonicalAlias *eventutil.CanonicalAlias,
|
updatedCanonicalAlias *eventutil.CanonicalAlias,
|
||||||
) *util.JSONResponse {
|
) *util.JSONResponse {
|
||||||
var stateKey = ""
|
var stateKey = ""
|
||||||
// We create a new canonical_alias event with the new alias and alt_aliase
|
// We create a new canonical_alias event with the new alias and alt_aliase
|
||||||
// May cause some auth problems
|
// May cause some auth problems
|
||||||
builder := gomatrixserverlib.EventBuilder {
|
builder := gomatrixserverlib.EventBuilder{
|
||||||
Sender: device.UserID,
|
Sender: device.UserID,
|
||||||
RoomID: roomID,
|
RoomID: roomID,
|
||||||
Type: gomatrixserverlib.MRoomCanonicalAlias,
|
Type: gomatrixserverlib.MRoomCanonicalAlias,
|
||||||
StateKey: &stateKey,
|
StateKey: &stateKey,
|
||||||
}
|
}
|
||||||
err := builder.SetContent(updatedCanonicalAlias)
|
err := builder.SetContent(updatedCanonicalAlias)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
util.GetLogger(req.Context()).WithError(err).Error("builder.SetContent failed")
|
util.GetLogger(req.Context()).WithError(err).Error("builder.SetContent failed")
|
||||||
resErr := jsonerror.InternalServerError()
|
resErr := jsonerror.InternalServerError()
|
||||||
return &resErr
|
return &resErr
|
||||||
}
|
}
|
||||||
|
|
||||||
evTime, err := httputil.ParseTSParam(req)
|
evTime, err := httputil.ParseTSParam(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return &util.JSONResponse{
|
return &util.JSONResponse{
|
||||||
Code: http.StatusBadRequest,
|
Code: http.StatusBadRequest,
|
||||||
JSON: jsonerror.InvalidArgumentValue(err.Error()),
|
JSON: jsonerror.InvalidArgumentValue(err.Error()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Build the event
|
// Build the event
|
||||||
e, err := eventutil.QueryAndBuildEvent(req.Context(), &builder, cfg.Matrix, evTime, rsAPI, nil)
|
e, err := eventutil.QueryAndBuildEvent(req.Context(), &builder, cfg.Matrix, evTime, rsAPI, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
util.GetLogger(req.Context()).WithError(err).Errorf("failed to QueryAndBuildEvent")
|
util.GetLogger(req.Context()).WithError(err).Errorf("failed to QueryAndBuildEvent")
|
||||||
resErr := jsonerror.InternalServerError()
|
resErr := jsonerror.InternalServerError()
|
||||||
return &resErr
|
return &resErr
|
||||||
}
|
}
|
||||||
// Send the event to the room server
|
// Send the event to the room server
|
||||||
err = roomserverAPI.SendEvents(req.Context(), rsAPI, roomserverAPI.KindNew, []*gomatrixserverlib.HeaderedEvent{e}, cfg.Matrix.ServerName, nil)
|
err = roomserverAPI.SendEvents(req.Context(), rsAPI, roomserverAPI.KindNew, []*gomatrixserverlib.HeaderedEvent{e}, cfg.Matrix.ServerName, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
util.GetLogger(req.Context()).WithError(err).Errorf("failed to SendEvents")
|
util.GetLogger(req.Context()).WithError(err).Errorf("failed to SendEvents")
|
||||||
resErr := jsonerror.InternalServerError()
|
resErr := jsonerror.InternalServerError()
|
||||||
return &resErr
|
return &resErr
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
type roomVisibility struct {
|
type roomVisibility struct {
|
||||||
|
|
|
||||||
|
|
@ -15,8 +15,8 @@
|
||||||
package routing
|
package routing
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"net/http"
|
"net/http"
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
@ -71,7 +71,7 @@ func SendEvent(
|
||||||
req *http.Request,
|
req *http.Request,
|
||||||
device *userapi.Device,
|
device *userapi.Device,
|
||||||
roomID, eventType string, txnID, stateKey *string,
|
roomID, eventType string, txnID, stateKey *string,
|
||||||
federation *gomatrixserverlib.FederationClient,
|
federation *gomatrixserverlib.FederationClient,
|
||||||
cfg *config.ClientAPI,
|
cfg *config.ClientAPI,
|
||||||
rsAPI api.RoomserverInternalAPI,
|
rsAPI api.RoomserverInternalAPI,
|
||||||
txnCache *transactions.Cache,
|
txnCache *transactions.Cache,
|
||||||
|
|
@ -157,7 +157,7 @@ func generateSendEvent(
|
||||||
req *http.Request,
|
req *http.Request,
|
||||||
device *userapi.Device,
|
device *userapi.Device,
|
||||||
roomID, eventType string, stateKey *string,
|
roomID, eventType string, stateKey *string,
|
||||||
federation *gomatrixserverlib.FederationClient,
|
federation *gomatrixserverlib.FederationClient,
|
||||||
cfg *config.ClientAPI,
|
cfg *config.ClientAPI,
|
||||||
rsAPI api.RoomserverInternalAPI,
|
rsAPI api.RoomserverInternalAPI,
|
||||||
) (*gomatrixserverlib.Event, *util.JSONResponse) {
|
) (*gomatrixserverlib.Event, *util.JSONResponse) {
|
||||||
|
|
@ -233,95 +233,94 @@ func generateSendEvent(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the event is a canonical_alias one, we have to check if each alias is correctly formed
|
// If the event is a canonical_alias one, we have to check if each alias is correctly formed
|
||||||
// and if each alias exists pointing to the correct room
|
// and if each alias exists pointing to the correct room
|
||||||
if eventType == gomatrixserverlib.MRoomCanonicalAlias {
|
if eventType == gomatrixserverlib.MRoomCanonicalAlias {
|
||||||
var content *eventutil.CanonicalAlias
|
var content *eventutil.CanonicalAlias
|
||||||
err = json.Unmarshal(builder.Content, &content)
|
err = json.Unmarshal(builder.Content, &content)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, &util.JSONResponse{
|
return nil, &util.JSONResponse{
|
||||||
Code: http.StatusBadRequest,
|
Code: http.StatusBadRequest,
|
||||||
JSON: jsonerror.BadJSON(err.Error()),
|
JSON: jsonerror.BadJSON(err.Error()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
queryRes := api.GetAliasesForRoomIDResponse {
|
queryRes := api.GetAliasesForRoomIDResponse{
|
||||||
Aliases: make([]string, 1),
|
Aliases: make([]string, 1),
|
||||||
}
|
}
|
||||||
|
|
||||||
err = rsAPI.GetAliasesForRoomID(
|
err = rsAPI.GetAliasesForRoomID(
|
||||||
req.Context(),
|
req.Context(),
|
||||||
&api.GetAliasesForRoomIDRequest {
|
&api.GetAliasesForRoomIDRequest{
|
||||||
RoomID: roomID,
|
RoomID: roomID,
|
||||||
},
|
},
|
||||||
&queryRes,
|
&queryRes,
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
resErr := jsonerror.InternalServerError()
|
resErr := jsonerror.InternalServerError()
|
||||||
return nil, &resErr
|
return nil, &resErr
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO: maybe do something like synapse where state is retrieved in order to only check new aliases
|
//TODO: maybe do something like synapse where state is retrieved in order to only check new aliases
|
||||||
for _, alias := range content.AltAliases {
|
for _, alias := range content.AltAliases {
|
||||||
resErr = checkAlias(req.Context(), device, alias, queryRes.Aliases, federation, cfg)
|
resErr = checkAlias(req.Context(), alias, queryRes.Aliases, federation, cfg)
|
||||||
if resErr != nil {
|
if resErr != nil {
|
||||||
return nil, resErr
|
return nil, resErr
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if content.Alias != "" {
|
if content.Alias != "" {
|
||||||
resErr = checkAlias(req.Context(), device, content.Alias, queryRes.Aliases, federation, cfg)
|
resErr = checkAlias(req.Context(), content.Alias, queryRes.Aliases, federation, cfg)
|
||||||
if resErr != nil {
|
if resErr != nil {
|
||||||
return nil, resErr
|
return nil, resErr
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return e.Event, nil
|
return e.Event, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func checkAlias(
|
func checkAlias(
|
||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
device *userapi.Device,
|
|
||||||
alias string,
|
alias string,
|
||||||
roomAliases []string,
|
roomAliases []string,
|
||||||
federation *gomatrixserverlib.FederationClient,
|
federation *gomatrixserverlib.FederationClient,
|
||||||
cfg *config.ClientAPI,
|
cfg *config.ClientAPI,
|
||||||
) *util.JSONResponse {
|
) *util.JSONResponse {
|
||||||
_, domain, err := gomatrixserverlib.SplitID('#', alias)
|
_, domain, err := gomatrixserverlib.SplitID('#', alias)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return &util.JSONResponse{
|
return &util.JSONResponse{
|
||||||
Code: http.StatusBadRequest,
|
Code: http.StatusBadRequest,
|
||||||
JSON: jsonerror.InvalidParam("Room alias must be in the form '#localpart:domain'"),
|
JSON: jsonerror.InvalidParam("Room alias must be in the form '#localpart:domain'"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
found := false
|
found := false
|
||||||
for _, s := range roomAliases {
|
for _, s := range roomAliases {
|
||||||
if alias == s {
|
if alias == s {
|
||||||
found = true
|
found = true
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if !found {
|
if !found {
|
||||||
if domain == cfg.Matrix.ServerName {
|
if domain == cfg.Matrix.ServerName {
|
||||||
return &util.JSONResponse{
|
return &util.JSONResponse{
|
||||||
Code: http.StatusBadRequest,
|
Code: http.StatusBadRequest,
|
||||||
JSON: jsonerror.BadAlias("Canonical alias not present in the room aliases"),
|
JSON: jsonerror.BadAlias("Canonical alias not present in the room aliases"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fedRes, fedErr := federation.LookupRoomAlias(ctx, domain, alias)
|
fedRes, fedErr := federation.LookupRoomAlias(ctx, domain, alias)
|
||||||
if fedErr != nil {
|
if fedErr != nil {
|
||||||
// TODO: Return 502 if the remote server errored.
|
// TODO: Return 502 if the remote server errored.
|
||||||
// TODO: Return 504 if the remote server timed out.
|
// TODO: Return 504 if the remote server timed out.
|
||||||
util.GetLogger(ctx).WithError(fedErr).Error("federation.LookupRoomAlias failed")
|
util.GetLogger(ctx).WithError(fedErr).Error("federation.LookupRoomAlias failed")
|
||||||
resErr := jsonerror.InternalServerError()
|
resErr := jsonerror.InternalServerError()
|
||||||
return &resErr
|
return &resErr
|
||||||
}
|
}
|
||||||
if fedRes.RoomID == "" {
|
if fedRes.RoomID == "" {
|
||||||
return &util.JSONResponse{
|
return &util.JSONResponse{
|
||||||
Code: http.StatusBadRequest,
|
Code: http.StatusBadRequest,
|
||||||
JSON: jsonerror.BadAlias("Canonical alias not present in the room aliases"),
|
JSON: jsonerror.BadAlias("Canonical alias not present in the room aliases"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -38,8 +38,8 @@ type HistoryVisibilityContent struct {
|
||||||
|
|
||||||
// CanonicalAlias is the event content for https://matrix.org/docs/spec/client_server/r0.6.0#m-room-canonical-alias
|
// CanonicalAlias is the event content for https://matrix.org/docs/spec/client_server/r0.6.0#m-room-canonical-alias
|
||||||
type CanonicalAlias struct {
|
type CanonicalAlias struct {
|
||||||
Alias string `json:"alias,omitempty"`
|
Alias string `json:"alias,omitempty"`
|
||||||
AltAliases []string `json:"alt_aliases,omitempty"`
|
AltAliases []string `json:"alt_aliases,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// InitialPowerLevelsContent returns the initial values for m.room.power_levels on room creation
|
// InitialPowerLevelsContent returns the initial values for m.room.power_levels on room creation
|
||||||
|
|
|
||||||
|
|
@ -83,6 +83,6 @@ type RemoveRoomAliasResponse struct {
|
||||||
Found bool `json:"found"`
|
Found bool `json:"found"`
|
||||||
// Did we remove it?
|
// Did we remove it?
|
||||||
Removed bool `json:"removed"`
|
Removed bool `json:"removed"`
|
||||||
// The room ID the alias refers to
|
// The room ID the alias refers to
|
||||||
RoomID string `json:"room_id"`
|
RoomID string `json:"room_id"`
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -154,7 +154,7 @@ func (r *RoomserverInternalAPI) RemoveRoomAlias(
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("r.DB.GetRoomIDForAlias: %w", err)
|
return fmt.Errorf("r.DB.GetRoomIDForAlias: %w", err)
|
||||||
}
|
}
|
||||||
response.RoomID = roomID
|
response.RoomID = roomID
|
||||||
if roomID == "" {
|
if roomID == "" {
|
||||||
response.Found = false
|
response.Found = false
|
||||||
response.Removed = false
|
response.Removed = false
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue