mirror of
https://gitea.com/gitea/gitea-mirror.git
synced 2026-03-20 11:50:27 +00:00
fix(repo): unify DEFAULT_SHOW_FULL_NAME output in templates and dropdown (#36597)
The design of DefaultShowFullName has some problems, which make the UI inconsistent, see the new comment in code This PR does a clean up for various legacy problems, and clarify some "user name display" behaviors. --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
@@ -158,18 +158,23 @@ func (b64embedder *mailAttachmentBase64Embedder) AttachmentSrcToBase64DataURI(ct
|
||||
|
||||
func fromDisplayName(u *user_model.User) string {
|
||||
if setting.MailService.FromDisplayNameFormatTemplate != nil {
|
||||
var ctx bytes.Buffer
|
||||
err := setting.MailService.FromDisplayNameFormatTemplate.Execute(&ctx, map[string]any{
|
||||
var buf bytes.Buffer
|
||||
err := setting.MailService.FromDisplayNameFormatTemplate.Execute(&buf, map[string]any{
|
||||
"DisplayName": u.DisplayName(),
|
||||
"AppName": setting.AppName,
|
||||
"Domain": setting.Domain,
|
||||
})
|
||||
if err == nil {
|
||||
return mime.QEncoding.Encode("utf-8", ctx.String())
|
||||
return mime.QEncoding.Encode("utf-8", buf.String())
|
||||
}
|
||||
log.Error("fromDisplayName: %w", err)
|
||||
}
|
||||
return u.GetCompleteName()
|
||||
def := u.Name
|
||||
if fullName := strings.TrimSpace(u.FullName); fullName != "" {
|
||||
// use "Full Name (username)" for email's sender name if Full Name is not empty
|
||||
def = fullName + " (" + u.Name + ")"
|
||||
}
|
||||
return def
|
||||
}
|
||||
|
||||
func generateMetadataHeaders(repo *repo_model.Repository) map[string]string {
|
||||
|
||||
Reference in New Issue
Block a user