aboutsummaryrefslogtreecommitdiff
path: root/roomserver/api
diff options
context:
space:
mode:
authorS7evinK <2353100+S7evinK@users.noreply.github.com>2022-02-18 16:05:03 +0100
committerGitHub <noreply@github.com>2022-02-18 16:05:03 +0100
commit002429c9e24cc746e0929b41eccbe429f89a6e1f (patch)
tree217eaea280343f46c61868a694d75fccd8fe66af /roomserver/api
parentdbded875257703eb63c8eb8af8d47d74c811642f (diff)
Implement server notices (#2180)
* Add server_notices config * Disallow rejecting "server notice" invites * Update config * Slightly refactor sendEvent and CreateRoom so it can be reused * Implement unspecced server notices * Validate the request * Set the user api when starting * Rename function/variables * Update comments * Update config * Set the avatar on account creation * Update test * Only create the account when starting Only add routes if sever notices are enabled * Use reserver username Check that we actually got roomData * Add check for admin account Enable server notices for CI Return same values as Synapse * Add custom error for rejecting server notice invite * Move building an invite to it's own function, for reusability * Don't create new rooms, use the existing one (follow Synapse behavior) Co-authored-by: kegsay <kegan@matrix.org>
Diffstat (limited to 'roomserver/api')
-rw-r--r--roomserver/api/api.go5
-rw-r--r--roomserver/api/api_trace.go10
-rw-r--r--roomserver/api/perform.go2
3 files changed, 14 insertions, 3 deletions
diff --git a/roomserver/api/api.go b/roomserver/api/api.go
index e6d37e8f..bcbf0e4f 100644
--- a/roomserver/api/api.go
+++ b/roomserver/api/api.go
@@ -3,9 +3,11 @@ package api
import (
"context"
+ "github.com/matrix-org/gomatrixserverlib"
+
asAPI "github.com/matrix-org/dendrite/appservice/api"
fsAPI "github.com/matrix-org/dendrite/federationapi/api"
- "github.com/matrix-org/gomatrixserverlib"
+ userapi "github.com/matrix-org/dendrite/userapi/api"
)
// RoomserverInputAPI is used to write events to the room server.
@@ -14,6 +16,7 @@ type RoomserverInternalAPI interface {
// interdependencies between the roomserver and other input APIs
SetFederationAPI(fsAPI fsAPI.FederationInternalAPI, keyRing *gomatrixserverlib.KeyRing)
SetAppserviceAPI(asAPI asAPI.AppServiceQueryAPI)
+ SetUserAPI(userAPI userapi.UserInternalAPI)
InputRoomEvents(
ctx context.Context,
diff --git a/roomserver/api/api_trace.go b/roomserver/api/api_trace.go
index 16f52abb..88b37215 100644
--- a/roomserver/api/api_trace.go
+++ b/roomserver/api/api_trace.go
@@ -5,10 +5,12 @@ import (
"encoding/json"
"fmt"
- asAPI "github.com/matrix-org/dendrite/appservice/api"
- fsAPI "github.com/matrix-org/dendrite/federationapi/api"
"github.com/matrix-org/gomatrixserverlib"
"github.com/matrix-org/util"
+
+ asAPI "github.com/matrix-org/dendrite/appservice/api"
+ fsAPI "github.com/matrix-org/dendrite/federationapi/api"
+ userapi "github.com/matrix-org/dendrite/userapi/api"
)
// RoomserverInternalAPITrace wraps a RoomserverInternalAPI and logs the
@@ -25,6 +27,10 @@ func (t *RoomserverInternalAPITrace) SetAppserviceAPI(asAPI asAPI.AppServiceQuer
t.Impl.SetAppserviceAPI(asAPI)
}
+func (t *RoomserverInternalAPITrace) SetUserAPI(userAPI userapi.UserInternalAPI) {
+ t.Impl.SetUserAPI(userAPI)
+}
+
func (t *RoomserverInternalAPITrace) InputRoomEvents(
ctx context.Context,
req *InputRoomEventsRequest,
diff --git a/roomserver/api/perform.go b/roomserver/api/perform.go
index 51cbcb1a..d640858a 100644
--- a/roomserver/api/perform.go
+++ b/roomserver/api/perform.go
@@ -95,6 +95,8 @@ type PerformLeaveRequest struct {
}
type PerformLeaveResponse struct {
+ Code int `json:"code,omitempty"`
+ Message interface{} `json:"message,omitempty"`
}
type PerformInviteRequest struct {