mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-06-21 00:20:50 +00:00
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:
parent
4674aea25b
commit
b60a7c3358
8 changed files with 18 additions and 30 deletions
|
@ -20,7 +20,7 @@ type Email struct {
|
|||
// It accepts a list of usernames.
|
||||
// If DB contains these users it will send the email to them.
|
||||
// If to list == nil, it's supposed to send emails to every user present in DB
|
||||
func SendEmail(ctx context.Context, subject, message string, to []string) (string, ResponseExtra) {
|
||||
func SendEmail(ctx context.Context, subject, message string, to []string) (*ResponseText, ResponseExtra) {
|
||||
reqURL := setting.LocalURL + "api/internal/mail/send"
|
||||
|
||||
req := newInternalRequest(ctx, reqURL, "POST", Email{
|
||||
|
@ -29,9 +29,5 @@ func SendEmail(ctx context.Context, subject, message string, to []string) (strin
|
|||
To: to,
|
||||
})
|
||||
|
||||
resp, extra := requestJSONResp(req, &responseText{})
|
||||
if extra.HasError() {
|
||||
return "", extra
|
||||
}
|
||||
return resp.Text, extra
|
||||
return requestJSONResp(req, &ResponseText{})
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue