Merge branch 's7evink/consent-tracking' of github.com:matrix-org/dendrite into s7evink/consent-tracking
This commit is contained in:
commit
1f64fc79c8
|
@ -68,4 +68,3 @@ func AddPublicRoutes(
|
||||||
extRoomsProvider, mscCfg, natsClient,
|
extRoomsProvider, mscCfg, natsClient,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -107,7 +107,7 @@ func sendServerNotice(
|
||||||
return util.JSONResponse{
|
return util.JSONResponse{
|
||||||
Code: http.StatusBadRequest,
|
Code: http.StatusBadRequest,
|
||||||
JSON: jsonerror.BadJSON("Invalid request"),
|
JSON: jsonerror.BadJSON("Invalid request"),
|
||||||
}, fmt.Errorf("invalid server notice request")
|
}, fmt.Errorf("Invalid JSON")
|
||||||
}
|
}
|
||||||
|
|
||||||
qryServerNoticeRoom := &userapi.QueryServerNoticeRoomResponse{}
|
qryServerNoticeRoom := &userapi.QueryServerNoticeRoomResponse{}
|
||||||
|
@ -177,7 +177,7 @@ func sendServerNotice(
|
||||||
|
|
||||||
default:
|
default:
|
||||||
// if we didn't get a createRoomResponse, we probably received an error, so return that.
|
// if we didn't get a createRoomResponse, we probably received an error, so return that.
|
||||||
return roomRes, err
|
return roomRes, fmt.Errorf("Unable to create room")
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
@ -188,10 +188,10 @@ func sendServerNotice(
|
||||||
}
|
}
|
||||||
// re-invite the user
|
// re-invite the user
|
||||||
if res.Membership != gomatrixserverlib.Join {
|
if res.Membership != gomatrixserverlib.Join {
|
||||||
var sendInviteRes util.JSONResponse
|
var inviteRes util.JSONResponse
|
||||||
sendInviteRes, err = sendInvite(ctx, userAPI, senderDevice, roomID, serverNoticeRequest.UserID, "Server notice room", cfgClient, rsAPI, asAPI, time.Now())
|
inviteRes, err = sendInvite(ctx, userAPI, senderDevice, roomID, serverNoticeRequest.UserID, "Server notice room", cfgClient, rsAPI, asAPI, time.Now())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return sendInviteRes, err
|
return inviteRes, err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -205,7 +205,7 @@ func sendServerNotice(
|
||||||
e, resErr := generateSendEvent(ctx, request, senderDevice, roomID, "m.room.message", nil, cfgClient, rsAPI, time.Now())
|
e, resErr := generateSendEvent(ctx, request, senderDevice, roomID, "m.room.message", nil, cfgClient, rsAPI, time.Now())
|
||||||
if resErr != nil {
|
if resErr != nil {
|
||||||
logrus.Errorf("failed to send message: %+v", resErr)
|
logrus.Errorf("failed to send message: %+v", resErr)
|
||||||
return *resErr, err
|
return *resErr, fmt.Errorf("Unable to send event")
|
||||||
}
|
}
|
||||||
timeToGenerateEvent := time.Since(startedGeneratingEvent)
|
timeToGenerateEvent := time.Since(startedGeneratingEvent)
|
||||||
|
|
||||||
|
@ -220,7 +220,7 @@ func sendServerNotice(
|
||||||
// pass the new event to the roomserver and receive the correct event ID
|
// pass the new event to the roomserver and receive the correct event ID
|
||||||
// event ID in case of duplicate transaction is discarded
|
// event ID in case of duplicate transaction is discarded
|
||||||
startedSubmittingEvent := time.Now()
|
startedSubmittingEvent := time.Now()
|
||||||
if err := api.SendEvents(
|
if err = api.SendEvents(
|
||||||
ctx, rsAPI,
|
ctx, rsAPI,
|
||||||
api.KindNew,
|
api.KindNew,
|
||||||
[]*gomatrixserverlib.HeaderedEvent{
|
[]*gomatrixserverlib.HeaderedEvent{
|
||||||
|
|
|
@ -397,14 +397,6 @@ func (h *httpUserInternalAPI) PerformSaveThreePIDAssociation(ctx context.Context
|
||||||
return httputil.PostJSON(ctx, span, h.httpClient, apiURL, req, res)
|
return httputil.PostJSON(ctx, span, h.httpClient, apiURL, req, res)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (h *httpUserInternalAPI) QueryPolicyVersion(ctx context.Context, req *api.QueryPolicyVersionRequest, res *api.QueryPolicyVersionResponse) error {
|
|
||||||
span, ctx := opentracing.StartSpanFromContext(ctx, "QueryPolicyVersion")
|
|
||||||
defer span.Finish()
|
|
||||||
|
|
||||||
apiURL := h.apiURL + QueryPolicyVersionPath
|
|
||||||
return httputil.PostJSON(ctx, span, h.httpClient, apiURL, req, res)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (h *httpUserInternalAPI) QueryOutdatedPolicy(ctx context.Context, req *api.QueryOutdatedPolicyRequest, res *api.QueryOutdatedPolicyResponse) error {
|
func (h *httpUserInternalAPI) QueryOutdatedPolicy(ctx context.Context, req *api.QueryOutdatedPolicyRequest, res *api.QueryOutdatedPolicyResponse) error {
|
||||||
span, ctx := opentracing.StartSpanFromContext(ctx, "QueryOutdatedPolicy")
|
span, ctx := opentracing.StartSpanFromContext(ctx, "QueryOutdatedPolicy")
|
||||||
defer span.Finish()
|
defer span.Finish()
|
||||||
|
@ -429,6 +421,14 @@ func (h *httpUserInternalAPI) SelectServerNoticeRoomID(ctx context.Context, req
|
||||||
return httputil.PostJSON(ctx, span, h.httpClient, apiURL, req, res)
|
return httputil.PostJSON(ctx, span, h.httpClient, apiURL, req, res)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (h *httpUserInternalAPI) QueryPolicyVersion(ctx context.Context, req *api.QueryPolicyVersionRequest, res *api.QueryPolicyVersionResponse) error {
|
||||||
|
span, ctx := opentracing.StartSpanFromContext(ctx, "QueryPolicyVersion")
|
||||||
|
defer span.Finish()
|
||||||
|
|
||||||
|
apiURL := h.apiURL + QueryPolicyVersionPath
|
||||||
|
return httputil.PostJSON(ctx, span, h.httpClient, apiURL, req, res)
|
||||||
|
}
|
||||||
|
|
||||||
func (h *httpUserInternalAPI) UpdateServerNoticeRoomID(ctx context.Context, req *api.UpdateServerNoticeRoomRequest, res *api.UpdateServerNoticeRoomResponse) (err error) {
|
func (h *httpUserInternalAPI) UpdateServerNoticeRoomID(ctx context.Context, req *api.UpdateServerNoticeRoomRequest, res *api.UpdateServerNoticeRoomResponse) (err error) {
|
||||||
span, ctx := opentracing.StartSpanFromContext(ctx, "UpdateServerNoticeRoomID")
|
span, ctx := opentracing.StartSpanFromContext(ctx, "UpdateServerNoticeRoomID")
|
||||||
defer span.Finish()
|
defer span.Finish()
|
||||||
|
|
|
@ -19,6 +19,7 @@ import (
|
||||||
"database/sql"
|
"database/sql"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/matrix-org/dendrite/internal"
|
||||||
"github.com/matrix-org/gomatrixserverlib"
|
"github.com/matrix-org/gomatrixserverlib"
|
||||||
|
|
||||||
"github.com/matrix-org/dendrite/clientapi/userutil"
|
"github.com/matrix-org/dendrite/clientapi/userutil"
|
||||||
|
@ -232,7 +233,7 @@ func (s *accountsStatements) BatchSelectPrivacyPolicy(
|
||||||
stmt = sqlutil.TxStmt(txn, stmt)
|
stmt = sqlutil.TxStmt(txn, stmt)
|
||||||
}
|
}
|
||||||
rows, err := stmt.QueryContext(ctx, policyVersion)
|
rows, err := stmt.QueryContext(ctx, policyVersion)
|
||||||
defer rows.Close()
|
defer internal.CloseAndLogIfError(ctx, rows, "BatchSelectPrivacyPolicy: rows.close() failed")
|
||||||
for rows.Next() {
|
for rows.Next() {
|
||||||
var userID string
|
var userID string
|
||||||
if err := rows.Scan(&userID); err != nil {
|
if err := rows.Scan(&userID); err != nil {
|
||||||
|
|
|
@ -19,6 +19,7 @@ import (
|
||||||
"database/sql"
|
"database/sql"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/matrix-org/dendrite/internal"
|
||||||
"github.com/matrix-org/gomatrixserverlib"
|
"github.com/matrix-org/gomatrixserverlib"
|
||||||
|
|
||||||
"github.com/matrix-org/dendrite/clientapi/userutil"
|
"github.com/matrix-org/dendrite/clientapi/userutil"
|
||||||
|
@ -235,7 +236,7 @@ func (s *accountsStatements) BatchSelectPrivacyPolicy(
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
defer rows.Close()
|
defer internal.CloseAndLogIfError(ctx, rows, "BatchSelectPrivacyPolicy: rows.close() failed")
|
||||||
for rows.Next() {
|
for rows.Next() {
|
||||||
var userID string
|
var userID string
|
||||||
if err := rows.Scan(&userID); err != nil {
|
if err := rows.Scan(&userID); err != nil {
|
||||||
|
|
Loading…
Reference in a new issue