aboutsummaryrefslogtreecommitdiff
path: root/federationapi/routing/threepid.go
diff options
context:
space:
mode:
authorKegsay <kegan@matrix.org>2020-06-10 12:17:54 +0100
committerGitHub <noreply@github.com>2020-06-10 12:17:54 +0100
commitb7187a9a354530c1846c2a97be701ea484f91c2c (patch)
tree6d14903a444fa8bca964247dbe85ae8d9709d4c8 /federationapi/routing/threepid.go
parentd9d6f4568ce891ae0ae9d2a3449974d3777bd21d (diff)
Remove clientapi producers which aren't actually producers (#1111)
* Remove clientapi producers which aren't actually producers They are actually just convenience wrappers around the internal APIs for roomserver/eduserver. Move their logic to their respective `api` packages and call them directly. * Remove TODO * unbreak ygg
Diffstat (limited to 'federationapi/routing/threepid.go')
-rw-r--r--federationapi/routing/threepid.go14
1 files changed, 6 insertions, 8 deletions
diff --git a/federationapi/routing/threepid.go b/federationapi/routing/threepid.go
index 8053cedd..8f319387 100644
--- a/federationapi/routing/threepid.go
+++ b/federationapi/routing/threepid.go
@@ -25,7 +25,6 @@ import (
"github.com/matrix-org/dendrite/clientapi/auth/storage/accounts"
"github.com/matrix-org/dendrite/clientapi/httputil"
"github.com/matrix-org/dendrite/clientapi/jsonerror"
- "github.com/matrix-org/dendrite/clientapi/producers"
"github.com/matrix-org/dendrite/internal/config"
"github.com/matrix-org/dendrite/roomserver/api"
roomserverAPI "github.com/matrix-org/dendrite/roomserver/api"
@@ -60,7 +59,7 @@ var (
func CreateInvitesFrom3PIDInvites(
req *http.Request, rsAPI roomserverAPI.RoomserverInternalAPI,
asAPI appserviceAPI.AppServiceQueryAPI, cfg *config.Dendrite,
- producer *producers.RoomserverProducer, federation *gomatrixserverlib.FederationClient,
+ federation *gomatrixserverlib.FederationClient,
accountDB accounts.Database,
) util.JSONResponse {
var body invites
@@ -92,8 +91,8 @@ func CreateInvitesFrom3PIDInvites(
}
// Send all the events
- if _, err := producer.SendEvents(req.Context(), evs, cfg.Matrix.ServerName, nil); err != nil {
- util.GetLogger(req.Context()).WithError(err).Error("producer.SendEvents failed")
+ if _, err := api.SendEvents(req.Context(), rsAPI, evs, cfg.Matrix.ServerName, nil); err != nil {
+ util.GetLogger(req.Context()).WithError(err).Error("SendEvents failed")
return jsonerror.InternalServerError()
}
@@ -111,7 +110,6 @@ func ExchangeThirdPartyInvite(
rsAPI roomserverAPI.RoomserverInternalAPI,
cfg *config.Dendrite,
federation *gomatrixserverlib.FederationClient,
- producer *producers.RoomserverProducer,
) util.JSONResponse {
var builder gomatrixserverlib.EventBuilder
if err := json.Unmarshal(request.Content(), &builder); err != nil {
@@ -176,15 +174,15 @@ func ExchangeThirdPartyInvite(
}
// Send the event to the roomserver
- if _, err = producer.SendEvents(
- httpReq.Context(),
+ if _, err = api.SendEvents(
+ httpReq.Context(), rsAPI,
[]gomatrixserverlib.HeaderedEvent{
signedEvent.Event.Headered(verRes.RoomVersion),
},
cfg.Matrix.ServerName,
nil,
); err != nil {
- util.GetLogger(httpReq.Context()).WithError(err).Error("producer.SendEvents failed")
+ util.GetLogger(httpReq.Context()).WithError(err).Error("SendEvents failed")
return jsonerror.InternalServerError()
}