Remove redundant parameters

This commit is contained in:
Anant Prakash 2018-07-04 10:52:39 +05:30
parent 00f4da67b5
commit dcd72f4f34
No known key found for this signature in database
GPG key ID: C5D399F626523045
2 changed files with 5 additions and 8 deletions

View file

@ -13,7 +13,6 @@
package routing package routing
import ( import (
"context"
"encoding/json" "encoding/json"
"net/http" "net/http"
@ -29,7 +28,6 @@ import (
// MakeLeave implements the /make_leave API // MakeLeave implements the /make_leave API
func MakeLeave( func MakeLeave(
ctx context.Context,
httpReq *http.Request, httpReq *http.Request,
request *gomatrixserverlib.FederationRequest, request *gomatrixserverlib.FederationRequest,
cfg config.Dendrite, cfg config.Dendrite,
@ -63,7 +61,7 @@ func MakeLeave(
} }
var queryRes api.QueryLatestEventsAndStateResponse var queryRes api.QueryLatestEventsAndStateResponse
event, err := common.BuildEvent(ctx, &builder, cfg, query, &queryRes) event, err := common.BuildEvent(httpReq.Context(), &builder, cfg, query, &queryRes)
if err == common.ErrRoomNoExists { if err == common.ErrRoomNoExists {
return util.JSONResponse{ return util.JSONResponse{
Code: http.StatusNotFound, Code: http.StatusNotFound,
@ -94,7 +92,6 @@ func MakeLeave(
// SendLeave implements the /send_leave API // SendLeave implements the /send_leave API
func SendLeave( func SendLeave(
ctx context.Context,
httpReq *http.Request, httpReq *http.Request,
request *gomatrixserverlib.FederationRequest, request *gomatrixserverlib.FederationRequest,
cfg config.Dendrite, cfg config.Dendrite,
@ -140,7 +137,7 @@ func SendLeave(
Message: event.Redact().JSON(), Message: event.Redact().JSON(),
AtTS: event.OriginServerTS(), AtTS: event.OriginServerTS(),
}} }}
verifyResults, err := keys.VerifyJSONs(ctx, verifyRequests) verifyResults, err := keys.VerifyJSONs(httpReq.Context(), verifyRequests)
if err != nil { if err != nil {
return httputil.LogThenError(httpReq, err) return httputil.LogThenError(httpReq, err)
} }
@ -154,7 +151,7 @@ func SendLeave(
// Send the events to the room server. // Send the events to the room server.
// We are responsible for notifying other servers that the user has left // We are responsible for notifying other servers that the user has left
// the room, so set SendAsServer to cfg.Matrix.ServerName // the room, so set SendAsServer to cfg.Matrix.ServerName
_, err = producer.SendEvents(ctx, []gomatrixserverlib.Event{event}, cfg.Matrix.ServerName, nil) _, err = producer.SendEvents(httpReq.Context(), []gomatrixserverlib.Event{event}, cfg.Matrix.ServerName, nil)
if err != nil { if err != nil {
return httputil.LogThenError(httpReq, err) return httputil.LogThenError(httpReq, err)
} }

View file

@ -189,7 +189,7 @@ func Setup(
roomID := vars["roomID"] roomID := vars["roomID"]
userID := vars["userID"] userID := vars["userID"]
return MakeLeave( return MakeLeave(
httpReq.Context(), httpReq, request, cfg, query, roomID, userID, httpReq, request, cfg, query, roomID, userID,
) )
}, },
)).Methods(http.MethodGet) )).Methods(http.MethodGet)
@ -201,7 +201,7 @@ func Setup(
roomID := vars["roomID"] roomID := vars["roomID"]
userID := vars["userID"] userID := vars["userID"]
return SendLeave( return SendLeave(
httpReq.Context(), httpReq, request, cfg, producer, keys, roomID, userID, httpReq, request, cfg, producer, keys, roomID, userID,
) )
}, },
)).Methods(http.MethodPut) )).Methods(http.MethodPut)