mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-12-12 07:42:08 +01:00
d03be77665
This is a follow-up for 5e1bd8af5f
, which
was my first commit to Gitea. It is also a follow up for the
Gitea PR #29300 (https://github.com/go-gitea/gitea/pull/23900) created
by myself, which turned stale.
This change partially restores the behavior of Gitea PR #23747
(https://github.com/go-gitea/gitea/pull/23747) by wxiaoguang, but
maintains the lock.
The original idea was to differentiate things from GitHub and GitLab a
little bit, and show the email address on the profile. The profile is
not only a place where the user chooses to show how they present
themselves on an instance, it is also a place where they can assess
their relationship *with* the instance, as it provides features such
as the Public Activity feed that can be only shown to the user, in
private.
It's, in some way, a dashboard. The email was shown there to remind
the user that this is the primary email that will be used by a supposed
administrator to contact them. There were other motivations behind that
change as well, but, long story short, the idea did not work very well,
as some people (e.g. people livestreaming on the Internet, or 'normal'
users sharing their screens) do not want to put their email address
out there when showing their screen to other people.
Other alternatives, such as blurring the text or only showing the real
email address, were explored, but were rejected because of
browser compatibility and simplicity reasons. The padlock icon that
is shown when showing the email address to other people has been kept.
One viable alternative could be displaying the placeholder email
instead, but that requires some more thought.
Fixes https://codeberg.org/forgejo/forgejo/issues/1950.
127 lines
4.9 KiB
Go HTML Template
127 lines
4.9 KiB
Go HTML Template
<div id="profile-avatar-card" class="ui card">
|
|
<div id="profile-avatar" class="content tw-flex">
|
|
{{if eq .SignedUserID .ContextUser.ID}}
|
|
<a class="image" href="{{AppSubUrl}}/user/settings" data-tooltip-content="{{ctx.Locale.Tr "user.change_avatar"}}">
|
|
{{/* the size doesn't take affect (and no need to take affect), image size(width) should be controlled by the parent container since this is not a flex layout*/}}
|
|
{{ctx.AvatarUtils.Avatar .ContextUser 256}}
|
|
</a>
|
|
{{else}}
|
|
<span class="image">
|
|
{{ctx.AvatarUtils.Avatar .ContextUser 256}}
|
|
</span>
|
|
{{end}}
|
|
</div>
|
|
<div class="content gt-word-break profile-avatar-name">
|
|
{{if .ContextUser.FullName}}<span class="header text center">{{.ContextUser.FullName}}</span>{{end}}
|
|
<span class="username text center">{{.ContextUser.Name}}{{if .ContextUser.Pronouns}} · {{.ContextUser.Pronouns}}{{end}} {{if .IsAdmin}}
|
|
<a class="muted" href="{{AppSubUrl}}/admin/users/{{.ContextUser.ID}}" data-tooltip-content="{{ctx.Locale.Tr "admin.users.details"}}">
|
|
{{svg "octicon-gear" 18}}
|
|
</a>
|
|
{{end}}</span>
|
|
<div class="tw-mt-2">
|
|
<a class="muted" href="{{.ContextUser.HomeLink}}?tab=followers">{{svg "octicon-people" 18 "tw-mr-1"}}{{ctx.Locale.TrN .NumFollowers "user.followers_one" "user.followers_few" .NumFollowers}}</a> · <a class="muted" href="{{.ContextUser.HomeLink}}?tab=following">{{ctx.Locale.TrN .NumFollowing "user.following_one" "user.following_few" .NumFollowing}}</a>
|
|
{{if .EnableFeed}}
|
|
<a href="{{.ContextUser.HomeLink}}.rss"><i class="ui text grey tw-ml-2" data-tooltip-content="{{ctx.Locale.Tr "rss_feed"}}">{{svg "octicon-rss" 18}}</i></a>
|
|
{{end}}
|
|
</div>
|
|
</div>
|
|
<div class="extra content gt-word-break">
|
|
<ul>
|
|
{{if .ContextUser.Location}}
|
|
<li>
|
|
{{svg "octicon-location"}}
|
|
<span class="tw-flex-1">{{.ContextUser.Location}}</span>
|
|
{{if .ContextUserLocationMapURL}}
|
|
<a href="{{.ContextUserLocationMapURL}}" rel="nofollow noreferrer" data-tooltip-content="{{ctx.Locale.Tr "user.show_on_map"}}">
|
|
{{svg "octicon-link-external"}}
|
|
</a>
|
|
{{end}}
|
|
</li>
|
|
{{end}}
|
|
{{if .ShowUserEmail}}
|
|
<li>
|
|
{{svg "octicon-mail"}}
|
|
<a class="tw-flex-1" href="mailto:{{.ContextUser.Email}}" rel="nofollow">{{.ContextUser.Email}}</a>
|
|
{{if (eq .SignedUserID .ContextUser.ID)}}
|
|
<a href="{{AppSubUrl}}/user/settings#privacy-user-settings">
|
|
<i data-tooltip-content="{{ctx.Locale.Tr "user.email_visibility.limited"}}">
|
|
{{svg "octicon-unlock"}}
|
|
</i>
|
|
</a>
|
|
{{end}}
|
|
</li>
|
|
{{end}}
|
|
{{if .ContextUser.Website}}
|
|
<li>
|
|
{{svg "octicon-link"}}
|
|
<a target="_blank" rel="noopener noreferrer me" href="{{.ContextUser.Website}}">{{.ContextUser.Website}}</a>
|
|
</li>
|
|
{{end}}
|
|
{{if $.RenderedDescription}}
|
|
<li>
|
|
<div class="render-content markup">{{$.RenderedDescription}}</div>
|
|
</li>
|
|
{{end}}
|
|
{{range .OpenIDs}}
|
|
{{if .Show}}
|
|
<li>
|
|
{{svg "fontawesome-openid"}}
|
|
<a target="_blank" rel="noopener noreferrer" href="{{.URI}}">{{.URI}}</a>
|
|
</li>
|
|
{{end}}
|
|
{{end}}
|
|
<li>{{svg "octicon-calendar"}} <span>{{ctx.Locale.Tr "user.joined_on" (DateTime "short" .ContextUser.CreatedUnix)}}</span></li>
|
|
{{if and .Orgs .HasOrgsVisible}}
|
|
<li>
|
|
<ul class="user-orgs">
|
|
{{range .Orgs}}
|
|
{{if (or .Visibility.IsPublic (and ($.SignedUser) (or .Visibility.IsLimited (and (.HasMemberWithUserID ctx $.SignedUserID) .Visibility.IsPrivate) ($.IsAdmin))))}}
|
|
<li>
|
|
<a href="{{.HomeLink}}" data-tooltip-content="{{.Name}}">
|
|
{{ctx.AvatarUtils.Avatar .}}
|
|
</a>
|
|
</li>
|
|
{{end}}
|
|
{{end}}
|
|
</ul>
|
|
</li>
|
|
{{end}}
|
|
{{if .Badges}}
|
|
<li>
|
|
<ul class="user-badges">
|
|
{{range .Badges}}
|
|
<li>
|
|
<img width="64" height="64" src="{{.ImageURL}}" alt="{{.Description}}" data-tooltip-content="{{.Description}}">
|
|
</li>
|
|
{{end}}
|
|
</ul>
|
|
</li>
|
|
{{end}}
|
|
{{if and .IsSigned (ne .SignedUserID .ContextUser.ID)}}
|
|
<li class="follow" hx-target="#profile-avatar-card" hx-indicator="#profile-avatar-card" >
|
|
{{if $.IsFollowing}}
|
|
<button hx-post="{{.ContextUser.HomeLink}}?action=unfollow" class="ui basic red button">
|
|
{{svg "octicon-person"}} {{ctx.Locale.Tr "user.unfollow"}}
|
|
</button>
|
|
{{else}}
|
|
<button hx-post="{{.ContextUser.HomeLink}}?action=follow" class="ui basic primary button">
|
|
{{svg "octicon-person"}} {{ctx.Locale.Tr "user.follow"}}
|
|
</button>
|
|
{{end}}
|
|
</li>
|
|
<li class="block">
|
|
{{if $.IsBlocked}}
|
|
<button class="ui basic red button link-action" data-url="{{.ContextUser.HomeLink}}?action=unblock&redirect_to={{$.Link}}">
|
|
{{svg "octicon-person"}} {{ctx.Locale.Tr "user.unblock"}}
|
|
</button>
|
|
{{else}}
|
|
<button type="submit" class="ui basic orange button delete-button"
|
|
data-modal-id="block-user" data-url="{{.ContextUser.HomeLink}}?action=block">
|
|
{{svg "octicon-blocked"}} {{ctx.Locale.Tr "user.block"}}
|
|
</button>
|
|
{{end}}
|
|
</li>
|
|
{{end}}
|
|
</ul>
|
|
</div>
|
|
</div>
|