Skip to content

Commit 90c4d2b

Browse files
authored
Merge branch 'main' into feature-markdown-tasklist
2 parents 2b718c5 + b4d1059 commit 90c4d2b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+308
-1147
lines changed

.github/pull_request_template.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Please check the following:
22

3-
1. Make sure you are targeting the `master` branch, pull requests on release branches are only allowed for bug fixes.
3+
1. Make sure you are targeting the `main` branch, pull requests on release branches are only allowed for bug fixes.
44
2. Read contributing guidelines: https://github.com/go-gitea/gitea/blob/master/CONTRIBUTING.md
55
3. Describe what your pull request does and which issue you're targeting (if any)
66

models/avatar.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ const DefaultAvatarSize = -1
4444
const DefaultAvatarPixelSize = 28
4545

4646
// AvatarRenderedSizeFactor is the factor by which the default size is increased for finer rendering
47-
const AvatarRenderedSizeFactor = 2
47+
const AvatarRenderedSizeFactor = 4
4848

4949
// HashEmail hashes email address to MD5 string.
5050
// https://en.gravatar.com/site/implement/hash/

modules/repository/commits_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,13 +112,13 @@ func TestPushCommits_AvatarLink(t *testing.T) {
112112
pushCommits.Len = len(pushCommits.Commits)
113113

114114
assert.Equal(t,
115-
"https://secure.gravatar.com/avatar/ab53a2911ddf9b4817ac01ddcd3d975f?d=identicon&s=56",
115+
"https://secure.gravatar.com/avatar/ab53a2911ddf9b4817ac01ddcd3d975f?d=identicon&s=112",
116116
pushCommits.AvatarLink("[email protected]"))
117117

118118
assert.Equal(t,
119119
"https://secure.gravatar.com/avatar/"+
120120
fmt.Sprintf("%x", md5.Sum([]byte("[email protected]")))+
121-
"?d=identicon&s=56",
121+
"?d=identicon&s=112",
122122
pushCommits.AvatarLink("[email protected]"))
123123
}
124124

options/locale/locale_cs-CZ.ini

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2225,7 +2225,6 @@ auths.host=Server
22252225
auths.port=Port
22262226
auths.bind_dn=Připojení DN
22272227
auths.bind_password=Heslo připojení
2228-
auths.bind_password_helper=Upozornění: Toto heslo je ukládáno v nešifrované podobě. Použijte účet pouze pro čtení, pokud je to možné.
22292228
auths.user_base=Výchozí bod hledání uživatelů
22302229
auths.user_dn=DN uživatele
22312230
auths.attribute_username=Atribut uživatelského jména

options/locale/locale_de-DE.ini

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2278,7 +2278,6 @@ auths.host=Host
22782278
auths.port=Port
22792279
auths.bind_dn=DN binden
22802280
auths.bind_password=Passwort binden
2281-
auths.bind_password_helper=Achtung: Das Passwort wird im Klartext gespeichert. Benutze, wenn möglich, einen Account, der nur über Lesezugriff verfügt.
22822281
auths.user_base=Basis für Benutzersuche
22832282
auths.user_dn=Benutzer-DN
22842283
auths.attribute_username=Benutzernamens-Attribut

options/locale/locale_es-ES.ini

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2282,7 +2282,6 @@ auths.host=Servidor
22822282
auths.port=Puerto
22832283
auths.bind_dn=Bind DN
22842284
auths.bind_password=Contraseña Bind
2285-
auths.bind_password_helper=Advertencia: Esta contraseña se almacena en texto plano. Utilice una cuenta de sólo lectura si es posible.
22862285
auths.user_base=Base de búsqueda de usuarios
22872286
auths.user_dn=DN de Usuario
22882287
auths.attribute_username=Atributo nombre de usuario

options/locale/locale_fa-IR.ini

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1896,7 +1896,6 @@ auths.host=میزبان
18961896
auths.port=درگاه (پورت)
18971897
auths.bind_dn=DN متصل شده
18981898
auths.bind_password=اتصال گذرواژه
1899-
auths.bind_password_helper=هشدار: این گذرواژه به صورت متن خام ذخیره می شود. استفاده حساب های کاربری فقط-خواندنی امکان پذیر هست.
19001899
auths.user_base=پایگاه جستجوی کاربر
19011900
auths.user_dn=کاربر DN
19021901
auths.attribute_username=ویژگی نام کاربری

options/locale/locale_fr-FR.ini

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2222,7 +2222,6 @@ auths.host=Hôte
22222222
auths.port=Port
22232223
auths.bind_dn=Bind DN
22242224
auths.bind_password=Bind mot de passe
2225-
auths.bind_password_helper=Attention: ce mot de passe est stocké en clair. Veuillez utiliser, si possible, un compte avec des droits limités en lecture seule.
22262225
auths.user_base=Utilisateur Search Base
22272226
auths.user_dn=Utilisateur DN
22282227
auths.attribute_username=Attribut nom d'utilisateur

options/locale/locale_hu-HU.ini

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1495,7 +1495,6 @@ auths.host=Kiszolgáló
14951495
auths.port=Port
14961496
auths.bind_dn=Bind DN
14971497
auths.bind_password=Bind Jelszó
1498-
auths.bind_password_helper=Figyelem: Ez a jelszó egyszerű szövegben van tárolva. Ha lehetséges használjon csak olvasható fiókot.
14991498
auths.user_base=Felhasználókeresés alapja (BaseDN)
15001499
auths.user_dn=Felhasználói DN
15011500
auths.attribute_username=Felhasználónév attribútum

options/locale/locale_it-IT.ini

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2097,7 +2097,6 @@ auths.host=Host
20972097
auths.port=Porta
20982098
auths.bind_dn=Binda DN
20992099
auths.bind_password=Binda Password
2100-
auths.bind_password_helper=Attenzione: La password è memorizzata in testo normale. Se possibile, utilizzare un account di sola lettura.
21012100
auths.user_base=Base ricerca utente
21022101
auths.user_dn=DN dell'utente
21032102
auths.attribute_username=Attributo nome utente

options/locale/locale_ja-JP.ini

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2282,7 +2282,6 @@ auths.host=ホスト
22822282
auths.port=ポート
22832283
auths.bind_dn=バインドDN
22842284
auths.bind_password=バインドパスワード
2285-
auths.bind_password_helper=警告: このパスワードはプレーンテキストで保存されます。 可能であれば読み取り専用アカウントを使用してください。
22862285
auths.user_base=ユーザー検索ベース
22872286
auths.user_dn=ユーザーDN
22882287
auths.attribute_username=ユーザー名

options/locale/locale_lv-LV.ini

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2248,7 +2248,6 @@ auths.host=Resursdators
22482248
auths.port=Ports
22492249
auths.bind_dn=Saistīšanas DN
22502250
auths.bind_password=Saistīšanas parole
2251-
auths.bind_password_helper=Brīdinājums: Šī parole tiks glabāta nešifrētā veidā. Ieteicams izmantot kontu ar tikai lasīšanas tiesībām.
22522251
auths.user_base=Lietotāja pamatnosacījumi
22532252
auths.user_dn=Lietotāja DN
22542253
auths.attribute_username=Lietotājvārda atribūts

options/locale/locale_nl-NL.ini

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2118,7 +2118,6 @@ auths.host=Host
21182118
auths.port=Poort
21192119
auths.bind_dn=Binden DN
21202120
auths.bind_password=Bind wachtwoord
2121-
auths.bind_password_helper=Waarschuwing: Dit wachtwoord wordt opgeslagen in platte tekst. Indien mogelijk gebruik dan een alleen-lezen account.
21222121
auths.user_base=User Search Base
21232122
auths.user_dn=User DN
21242123
auths.attribute_username=Gebruikersnaam attribuut

options/locale/locale_pl-PL.ini

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2027,7 +2027,6 @@ auths.host=Serwer
20272027
auths.port=Port
20282028
auths.bind_dn=DN powiązania
20292029
auths.bind_password=Hasło Bind
2030-
auths.bind_password_helper=Uwaga: To hasło będzie przechowywane w czystym tekście. Użyj konta "tylko do odczytu", jeśli to możliwe.
20312030
auths.user_base=Baza wyszukiwania
20322031
auths.user_dn=DN użytkownika
20332032
auths.attribute_username=Atrybut nazwy użytkownika

options/locale/locale_pt-BR.ini

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2016,7 +2016,6 @@ auths.host=Servidor
20162016
auths.port=Porta
20172017
auths.bind_dn=Vincular DN
20182018
auths.bind_password=Vincular senha
2019-
auths.bind_password_helper=Atenção: Esta senha é armazenada em texto sem formatação. Se possível, use uma conta de somente leitura.
20202019
auths.user_base=Base de pesquisa do usuário
20212020
auths.user_dn=Usuário do DN
20222021
auths.attribute_username=Atributo nome de usuário

options/locale/locale_pt-PT.ini

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2269,7 +2269,6 @@ auths.host=Servidor
22692269
auths.port=Porto
22702270
auths.bind_dn=Vincular DN
22712271
auths.bind_password=Vincular senha
2272-
auths.bind_password_helper=Atenção: Esta senha é armazenada em texto simples. Use uma conta só de leitura, se possível.
22732272
auths.user_base=Base de pesquisa de utilizador
22742273
auths.user_dn=DN do utilizador
22752274
auths.attribute_username=Atributo do nome de utilizador

options/locale/locale_ru-RU.ini

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2250,7 +2250,6 @@ auths.host=Сервер
22502250
auths.port=Порт
22512251
auths.bind_dn=Bind DN
22522252
auths.bind_password=Привязать пароль
2253-
auths.bind_password_helper=Предупреждение: этот пароль хранится в виде простого текста. Используйте учетную запись только для чтения, если это возможно.
22542253
auths.user_base=База для поиска пользователя
22552254
auths.user_dn=DN пользователя
22562255
auths.attribute_username=Атрибут Username

options/locale/locale_sv-SE.ini

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1905,7 +1905,6 @@ auths.host=Värd
19051905
auths.port=Port
19061906
auths.bind_dn=Bind DN
19071907
auths.bind_password=Bind Lösenord
1908-
auths.bind_password_helper=Varning: Detta lösenord lagras i klartext. Använd ett konto med endast läsrättigheter om möjligt.
19091908
auths.user_base=Användarsökbas
19101909
auths.user_dn=Användarnas DN
19111910
auths.attribute_username=Användarnamnsattribut

options/locale/locale_tr-TR.ini

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2275,7 +2275,6 @@ auths.host=Sunucu
22752275
auths.port=Bağlantı Noktası
22762276
auths.bind_dn=Bağlama DN'i
22772277
auths.bind_password=Bağlama Parolası
2278-
auths.bind_password_helper=Uyarı: Bu parola düz metin olarak saklanır. Mümkünse salt okunur bir hesap kullanın.
22792278
auths.user_base=Kullanıcı Arama Tabanı
22802279
auths.user_dn=Kullanıcı DN'i
22812280
auths.attribute_username=Kullanıcı Adı Özelliği

options/locale/locale_uk-UA.ini

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2035,7 +2035,6 @@ auths.host=Хост
20352035
auths.port=Порт
20362036
auths.bind_dn=Прив'язати DN
20372037
auths.bind_password=Прив'язати пароль
2038-
auths.bind_password_helper=Попередження: цей пароль зберігається у вигляді простого тексту. Використовуйте обліковий запис тільки для читання, якщо це можливо.
20392038
auths.user_base=База пошуку користувачів
20402039
auths.user_dn=DN користувача
20412040
auths.attribute_username=Атрибут імені користувача

options/locale/locale_zh-CN.ini

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2281,7 +2281,6 @@ auths.host=主机
22812281
auths.port=端口
22822282
auths.bind_dn=绑定 DN
22832283
auths.bind_password=绑定密码
2284-
auths.bind_password_helper=警告:密码将会被明文存储。如果可能请使用只读账号。
22852284
auths.user_base=用户搜索基准
22862285
auths.user_dn=用户 DN
22872286
auths.attribute_username=用户名属性

options/locale/locale_zh-TW.ini

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2280,7 +2280,6 @@ auths.host=主機地址
22802280
auths.port=連接埠
22812281
auths.bind_dn=Bind DN
22822282
auths.bind_password=Bind 密碼
2283-
auths.bind_password_helper=警告:此密碼以明文存儲。 請儘可能使用唯讀帳戶。
22842283
auths.user_base=用戶搜尋基準
22852284
auths.user_dn=用戶 DN
22862285
auths.attribute_username=帳號屬性

public/img/svg/fontawesome-openid.svg

Lines changed: 1 addition & 0 deletions
Loading
Lines changed: 1 addition & 0 deletions
Loading

services/mailer/mail.go

Lines changed: 46 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111
"html/template"
1212
"mime"
1313
"regexp"
14+
"strconv"
1415
"strings"
1516
texttmpl "text/template"
1617

@@ -174,7 +175,7 @@ func SendCollaboratorMail(u, doer *models.User, repo *models.Repository) {
174175
SendAsync(msg)
175176
}
176177

177-
func composeIssueCommentMessages(ctx *mailCommentContext, lang string, tos []string, fromMention bool, info string) ([]*Message, error) {
178+
func composeIssueCommentMessages(ctx *mailCommentContext, lang string, recipients []*models.User, fromMention bool, info string) ([]*Message, error) {
178179
var (
179180
subject string
180181
link string
@@ -265,9 +266,9 @@ func composeIssueCommentMessages(ctx *mailCommentContext, lang string, tos []str
265266
}
266267

267268
// Make sure to compose independent messages to avoid leaking user emails
268-
msgs := make([]*Message, 0, len(tos))
269-
for _, to := range tos {
270-
msg := NewMessageFrom([]string{to}, ctx.Doer.DisplayName(), setting.MailService.FromEmail, subject, mailBody.String())
269+
msgs := make([]*Message, 0, len(recipients))
270+
for _, recipient := range recipients {
271+
msg := NewMessageFrom([]string{recipient.Email}, ctx.Doer.DisplayName(), setting.MailService.FromEmail, subject, mailBody.String())
271272
msg.Info = fmt.Sprintf("Subject: %s, %s", subject, info)
272273

273274
// Set Message-ID on first message so replies know what to reference
@@ -277,12 +278,51 @@ func composeIssueCommentMessages(ctx *mailCommentContext, lang string, tos []str
277278
msg.SetHeader("In-Reply-To", "<"+ctx.Issue.ReplyReference()+">")
278279
msg.SetHeader("References", "<"+ctx.Issue.ReplyReference()+">")
279280
}
281+
282+
for key, value := range generateAdditionalHeaders(ctx, actType, recipient) {
283+
msg.SetHeader(key, value)
284+
}
285+
280286
msgs = append(msgs, msg)
281287
}
282288

283289
return msgs, nil
284290
}
285291

292+
func generateAdditionalHeaders(ctx *mailCommentContext, reason string, recipient *models.User) map[string]string {
293+
repo := ctx.Issue.Repo
294+
295+
return map[string]string{
296+
// https://datatracker.ietf.org/doc/html/rfc2919
297+
"List-ID": fmt.Sprintf("%s <%s.%s.%s>", repo.FullName(), repo.Name, repo.OwnerName, setting.Domain),
298+
299+
// https://datatracker.ietf.org/doc/html/rfc2369
300+
"List-Archive": fmt.Sprintf("<%s>", repo.HTMLURL()),
301+
//"List-Post": https://github.com/go-gitea/gitea/pull/13585
302+
//"List-Unsubscribe": https://github.com/go-gitea/gitea/issues/10808, https://github.com/go-gitea/gitea/issues/13283
303+
304+
"X-Gitea-Reason": reason,
305+
"X-Gitea-Sender": ctx.Doer.DisplayName(),
306+
"X-Gitea-Recipient": recipient.DisplayName(),
307+
"X-Gitea-Recipient-Address": recipient.Email,
308+
"X-Gitea-Repository": repo.Name,
309+
"X-Gitea-Repository-Path": repo.FullName(),
310+
"X-Gitea-Repository-Link": repo.HTMLURL(),
311+
"X-Gitea-Issue-ID": strconv.FormatInt(ctx.Issue.Index, 10),
312+
"X-Gitea-Issue-Link": ctx.Issue.HTMLURL(),
313+
314+
"X-GitHub-Reason": reason,
315+
"X-GitHub-Sender": ctx.Doer.DisplayName(),
316+
"X-GitHub-Recipient": recipient.DisplayName(),
317+
"X-GitHub-Recipient-Address": recipient.Email,
318+
319+
"X-GitLab-NotificationReason": reason,
320+
"X-GitLab-Project": repo.Name,
321+
"X-GitLab-Project-Path": repo.FullName(),
322+
"X-GitLab-Issue-IID": strconv.FormatInt(ctx.Issue.Index, 10),
323+
}
324+
}
325+
286326
func sanitizeSubject(subject string) string {
287327
runes := []rune(strings.TrimSpace(subjectRemoveSpaces.ReplaceAllLiteralString(subject, " ")))
288328
if len(runes) > mailMaxSubjectRunes {
@@ -294,9 +334,9 @@ func sanitizeSubject(subject string) string {
294334

295335
// SendIssueAssignedMail composes and sends issue assigned email
296336
func SendIssueAssignedMail(issue *models.Issue, doer *models.User, content string, comment *models.Comment, recipients []*models.User) error {
297-
langMap := make(map[string][]string)
337+
langMap := make(map[string][]*models.User)
298338
for _, user := range recipients {
299-
langMap[user.Language] = append(langMap[user.Language], user.Email)
339+
langMap[user.Language] = append(langMap[user.Language], user)
300340
}
301341

302342
for lang, tos := range langMap {

services/mailer/mail_issue.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ func mailIssueCommentBatch(ctx *mailCommentContext, users []*models.User, visite
116116
checkUnit = models.UnitTypePullRequests
117117
}
118118

119-
langMap := make(map[string][]string)
119+
langMap := make(map[string][]*models.User)
120120
for _, user := range users {
121121
// At this point we exclude:
122122
// user that don't have all mails enabled or users only get mail on mention and this is one ...
@@ -138,7 +138,7 @@ func mailIssueCommentBatch(ctx *mailCommentContext, users []*models.User, visite
138138
continue
139139
}
140140

141-
langMap[user.Language] = append(langMap[user.Language], user.Email)
141+
langMap[user.Language] = append(langMap[user.Language], user)
142142
}
143143

144144
for lang, receivers := range langMap {

0 commit comments

Comments
 (0)