Return responseText
instead of string in some functions (#28836)
Follow https://github.com/go-gitea/gitea/pull/28796#issuecomment-1891727591
This commit is contained in:
@ -15,20 +15,16 @@ func UpdatePublicKeyInRepo(ctx context.Context, keyID, repoID int64) error {
|
||||
// Ask for running deliver hook and test pull request tasks.
|
||||
reqURL := setting.LocalURL + fmt.Sprintf("api/internal/ssh/%d/update/%d", keyID, repoID)
|
||||
req := newInternalRequest(ctx, reqURL, "POST")
|
||||
_, extra := requestJSONResp(req, &responseText{})
|
||||
_, extra := requestJSONResp(req, &ResponseText{})
|
||||
return extra.Error
|
||||
}
|
||||
|
||||
// AuthorizedPublicKeyByContent searches content as prefix (leak e-mail part)
|
||||
// and returns public key found.
|
||||
func AuthorizedPublicKeyByContent(ctx context.Context, content string) (string, ResponseExtra) {
|
||||
func AuthorizedPublicKeyByContent(ctx context.Context, content string) (*ResponseText, ResponseExtra) {
|
||||
// Ask for running deliver hook and test pull request tasks.
|
||||
reqURL := setting.LocalURL + "api/internal/ssh/authorized_keys"
|
||||
req := newInternalRequest(ctx, reqURL, "POST")
|
||||
req.Param("content", content)
|
||||
resp, extra := requestJSONResp(req, &responseText{})
|
||||
if extra.HasError() {
|
||||
return "", extra
|
||||
}
|
||||
return resp.Text, extra
|
||||
return requestJSONResp(req, &ResponseText{})
|
||||
}
|
||||
|
Reference in New Issue
Block a user