mirror of
https://github.com/matrix-org/dendrite.git
synced 2026-01-07 14:13:11 -06:00
remove unused GetCreatorIDForAlias
This commit is contained in:
parent
aa758e4826
commit
dc6729c8be
|
|
@ -59,18 +59,6 @@ type GetAliasesForRoomIDResponse struct {
|
|||
Aliases []string `json:"aliases"`
|
||||
}
|
||||
|
||||
// GetCreatorIDForAliasRequest is a request to GetCreatorIDForAlias
|
||||
type GetCreatorIDForAliasRequest struct {
|
||||
// The alias we want to find the creator of
|
||||
Alias string `json:"alias"`
|
||||
}
|
||||
|
||||
// GetCreatorIDForAliasResponse is a response to GetCreatorIDForAlias
|
||||
type GetCreatorIDForAliasResponse struct {
|
||||
// The user ID of the alias creator
|
||||
UserID string `json:"user_id"`
|
||||
}
|
||||
|
||||
// RemoveRoomAliasRequest is a request to RemoveRoomAlias
|
||||
type RemoveRoomAliasRequest struct {
|
||||
// ID of the user removing the alias
|
||||
|
|
|
|||
|
|
@ -33,13 +33,6 @@ type RoomserverInternalAPI interface {
|
|||
req *QueryAuthChainRequest,
|
||||
res *QueryAuthChainResponse,
|
||||
) error
|
||||
|
||||
// Get the user ID of the creator of an alias
|
||||
GetCreatorIDForAlias(
|
||||
ctx context.Context,
|
||||
req *GetCreatorIDForAliasRequest,
|
||||
res *GetCreatorIDForAliasResponse,
|
||||
) error
|
||||
}
|
||||
|
||||
type InputRoomEventsAPI interface {
|
||||
|
|
|
|||
|
|
@ -293,16 +293,6 @@ func (t *RoomserverInternalAPITrace) GetAliasesForRoomID(
|
|||
return err
|
||||
}
|
||||
|
||||
func (t *RoomserverInternalAPITrace) GetCreatorIDForAlias(
|
||||
ctx context.Context,
|
||||
req *GetCreatorIDForAliasRequest,
|
||||
res *GetCreatorIDForAliasResponse,
|
||||
) error {
|
||||
err := t.Impl.GetCreatorIDForAlias(ctx, req, res)
|
||||
util.GetLogger(ctx).WithError(err).Infof("GetCreatorIDForAlias req=%+v res=%+v", js(req), js(res))
|
||||
return err
|
||||
}
|
||||
|
||||
func (t *RoomserverInternalAPITrace) RemoveRoomAlias(
|
||||
ctx context.Context,
|
||||
req *RemoveRoomAliasRequest,
|
||||
|
|
|
|||
|
|
@ -41,9 +41,6 @@ type RoomserverInternalAPIDatabase interface {
|
|||
// Look up all aliases referring to a given room ID.
|
||||
// Returns an error if there was a problem talking to the database.
|
||||
GetAliasesForRoomID(ctx context.Context, roomID string) ([]string, error)
|
||||
// Get the user ID of the creator of an alias.
|
||||
// Returns an error if there was a problem talking to the database.
|
||||
GetCreatorIDForAlias(ctx context.Context, alias string) (string, error)
|
||||
// Remove a given room alias.
|
||||
// Returns an error if there was a problem talking to the database.
|
||||
RemoveRoomAlias(ctx context.Context, alias string) error
|
||||
|
|
@ -134,22 +131,6 @@ func (r *RoomserverInternalAPI) GetAliasesForRoomID(
|
|||
return nil
|
||||
}
|
||||
|
||||
// GetCreatorIDForAlias implements alias.RoomserverInternalAPI
|
||||
func (r *RoomserverInternalAPI) GetCreatorIDForAlias(
|
||||
ctx context.Context,
|
||||
request *api.GetCreatorIDForAliasRequest,
|
||||
response *api.GetCreatorIDForAliasResponse,
|
||||
) error {
|
||||
// Look up the aliases in the database for the given RoomID
|
||||
creatorID, err := r.DB.GetCreatorIDForAlias(ctx, request.Alias)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
response.UserID = creatorID
|
||||
return nil
|
||||
}
|
||||
|
||||
// RemoveRoomAlias implements alias.RoomserverInternalAPI
|
||||
func (r *RoomserverInternalAPI) RemoveRoomAlias(
|
||||
ctx context.Context,
|
||||
|
|
|
|||
|
|
@ -137,19 +137,6 @@ func (h *httpRoomserverInternalAPI) GetAliasesForRoomID(
|
|||
return httputil.PostJSON(ctx, span, h.httpClient, apiURL, request, response)
|
||||
}
|
||||
|
||||
// GetCreatorIDForAlias implements RoomserverAliasAPI
|
||||
func (h *httpRoomserverInternalAPI) GetCreatorIDForAlias(
|
||||
ctx context.Context,
|
||||
request *api.GetCreatorIDForAliasRequest,
|
||||
response *api.GetCreatorIDForAliasResponse,
|
||||
) error {
|
||||
span, ctx := opentracing.StartSpanFromContext(ctx, "GetCreatorIDForAlias")
|
||||
defer span.Finish()
|
||||
|
||||
apiURL := h.roomserverURL + RoomserverGetCreatorIDForAliasPath
|
||||
return httputil.PostJSON(ctx, span, h.httpClient, apiURL, request, response)
|
||||
}
|
||||
|
||||
// RemoveRoomAlias implements RoomserverAliasAPI
|
||||
func (h *httpRoomserverInternalAPI) RemoveRoomAlias(
|
||||
ctx context.Context,
|
||||
|
|
|
|||
|
|
@ -353,20 +353,6 @@ func AddRoutes(r api.RoomserverInternalAPI, internalAPIMux *mux.Router) {
|
|||
return util.JSONResponse{Code: http.StatusOK, JSON: &response}
|
||||
}),
|
||||
)
|
||||
internalAPIMux.Handle(
|
||||
RoomserverGetCreatorIDForAliasPath,
|
||||
httputil.MakeInternalAPI("GetCreatorIDForAlias", func(req *http.Request) util.JSONResponse {
|
||||
var request api.GetCreatorIDForAliasRequest
|
||||
var response api.GetCreatorIDForAliasResponse
|
||||
if err := json.NewDecoder(req.Body).Decode(&request); err != nil {
|
||||
return util.ErrorResponse(err)
|
||||
}
|
||||
if err := r.GetCreatorIDForAlias(req.Context(), &request, &response); err != nil {
|
||||
return util.ErrorResponse(err)
|
||||
}
|
||||
return util.JSONResponse{Code: http.StatusOK, JSON: &response}
|
||||
}),
|
||||
)
|
||||
internalAPIMux.Handle(
|
||||
RoomserverGetAliasesForRoomIDPath,
|
||||
httputil.MakeInternalAPI("getAliasesForRoomID", func(req *http.Request) util.JSONResponse {
|
||||
|
|
|
|||
Loading…
Reference in a new issue