Browse Source

Fix profile and externalProfile to only show Follow/Unfollow and Mute/Unmute for authenticated users

pull/575/head
James Mills 2 weeks ago
parent
commit
e36846c8ad
Signed by: prologic GPG Key ID: AC4C014F1440EBD6
  1. 90
      internal/theme/templates/externalProfile.html
  2. 90
      internal/theme/templates/profile.html

90
internal/theme/templates/externalProfile.html

@ -12,54 +12,54 @@
<span class="p-name">{{ .Profile.Username }}</span>
</a><span class="p-org">@{{ .Profile.URL | hostnameFromURL }}</span>
</h2>
<h3>
<a class="followBtn" style="display: {{ if not .Profile.Follows }}inline{{ else }}none{{ end }};" href="/follow?nick={{ .Profile.Username }}&url={{ .Profile.URL }}">
<i class="ti ti-circle-plus"></i>
{{ tr . "FollowLinkTitle" }}
</a>
<a class="unfollowBtn" style="display: {{ if $.Profile.Follows }}inline{{ else }}none{{ end }};" href="/unfollow?nick={{ .Profile.Username }}">
<i class="ti ti-circle-minus"></i>
{{ tr . "UnfollowLinkTitle" }}
</a>
</h3>
{{ if $.Authenticated }}
<h3>
<a class="followBtn" style="display: {{ if not .Profile.Follows }}inline{{ else }}none{{ end }};" href="/follow?nick={{ .Profile.Username }}&url={{ .Profile.URL }}">
<i class="ti ti-circle-plus"></i>
{{ tr . "FollowLinkTitle" }}
</a>
<a class="unfollowBtn" style="display: {{ if $.Profile.Follows }}inline{{ else }}none{{ end }};" href="/unfollow?nick={{ .Profile.Username }}">
<i class="ti ti-circle-minus"></i>
{{ tr . "UnfollowLinkTitle" }}
</a>
</h3>
{{ end }}
<p><i>{{ .Profile.Tagline }}</i></p>
<details>
<summary>{{ tr . "ProfileBlockUserTitle" }}</summary>
{{ (tr . "ProfileBlockUserContent" (dict "InstanceName" .InstanceName)) | html }}
<ul>
<li>
<a id="muteBtn" style="display: {{ if not $.Profile.Muted }}inline{{ else }}none{{ end }};" href="/mute?nick={{ .Profile.Username }}&url={{ .Profile.URL }}">
<i class="ti ti-volume-3"></i>
{{ tr . "ProfileMuteLinkTitle" }}
</a>
<a id="unmuteBtn" style="display: {{ if .Profile.Muted }}inline{{ else }}none{{ end }};" href="/unmute?nick={{ .Profile.Username }}">
<i class="ti ti-volume"></i>
{{ tr . "ProfileUnmuteLinkTitle" }}
</a>
</li>
<li>
<a href="/report?nick={{ .Profile.Username }}&url={{ .Profile.URL }}">
<i class="ti ti-urgent" style="color:red;"></i>
{{ tr . "ProfileReportLinkTitle" }}
</a>
</li>
</ul>
</details>
{{ if $.Authenticated }}
<details>
<summary>{{ tr . "ProfileBlockUserTitle" }}</summary>
{{ (tr . "ProfileBlockUserContent" (dict "InstanceName" .InstanceName)) | html }}
<ul>
<li>
<a id="muteBtn" style="display: {{ if not $.Profile.Muted }}inline{{ else }}none{{ end }};" href="/mute?nick={{ .Profile.Username }}&url={{ .Profile.URL }}">
<i class="ti ti-volume-3"></i>
{{ tr . "ProfileMuteLinkTitle" }}
</a>
<a id="unmuteBtn" style="display: {{ if .Profile.Muted }}inline{{ else }}none{{ end }};" href="/unmute?nick={{ .Profile.Username }}">
<i class="ti ti-volume"></i>
{{ tr . "ProfileUnmuteLinkTitle" }}
</a>
</li>
<li>
<a href="/report?nick={{ .Profile.Username }}&url={{ .Profile.URL }}">
<i class="ti ti-urgent" style="color:red;"></i>
{{ tr . "ProfileReportLinkTitle" }}
</a>
</li>
</ul>
</details>
{{ end }}
{{ template "profileLinks" (dict "Profile" .Profile "ShowConfig" false "Ctx" .) }}
</hgroup>
<p>
{{ if .Profile.FollowedBy }}
<a href="{{ .Profile.URL }}">@{{ .Profile.Username }}
<i class="ti ti-user-check"></i>
</a>
{{ tr . "ProfileFollowsYou" }}
{{ else }}
<a href="{{ .Profile.URL }}">@{{ .Profile.Username }}
<i class="ti ti-user-check"></i>
</a>
{{(tr . "ProfileDoesNotFollowYou") | html }}
{{ end }}
</p>
{{ if $.Authenticated }}
<p>
{{ if .Profile.FollowedBy }}
<a href="{{ .Profile.URL }}">@{{ .Profile.Username }}<i class="ti ti-user-check"></i></a>&nbsp;{{ (tr . "ProfileFollowsYou") | html }}
{{ else }}
<a href="{{ .Profile.URL }}">@{{ .Profile.Username }}<i class="ti ti-user-check"></i></a>&nbsp;{{ (tr . "ProfileDoesNotFollowYou") | html }}
{{ end }}
</p>
{{ end }}
</div>
</div>
<div class="container">

90
internal/theme/templates/profile.html

@ -15,52 +15,58 @@
</a>
{{ end }}
</h2>
{{ if not ($.User.Is .Profile.URL) }}
<h3>
<a class="followBtn" style="display: {{ if not ($.User.Follows .Profile.URL) }}inline{{ else }}none{{ end }};" href="/follow?nick={{ .Profile.Username }}&url={{ .Profile.URL }}">
<i class="ti ti-circle-plus"></i>
{{ tr . "FollowLinkTitle" }}
</a>
<a class="unfollowBtn" style="display: {{ if $.User.Follows .Profile.URL }}inline{{ else }}none{{ end }};" href="/unfollow?nick={{ .Profile.Username }}">
<i class="ti ti-circle-minus"></i>
{{ tr . "UnfollowLinkTitle" }}
</a>
{{ if $.User.OwnsFeed .Profile.Username }}
| <a href="/feed/{{ .Profile.Username }}/manage">{{ tr . "FeedManageLinkTitle" }}</a>
{{ end }}
</h3>
{{ end }}
<p><i>{{ .Profile.Tagline }}</i></p>
<details>
<summary>{{ tr . "ProfileBlockUserTitle" }}</summary>
{{ (tr . "ProfileBlockUserContent" (dict "InstanceName" .InstanceName)) | html }}
<ul>
<li>
<a id="muteBtn" style="display: {{ if not ($.User.HasMuted .Profile.URL) }}inline{{ else }}none{{ end }};" href="/mute?nick={{ .Profile.Username }}&url={{ .Profile.URL }}">
<i class="ti ti-volume-3"></i>
{{ tr . "ProfileMuteLinkTitle" }}
</a>
<a id="unmuteBtn" style="display: {{ if $.User.HasMuted .Profile.URL }}inline{{ else }}none{{ end }};" href="/unmute?nick={{ .Profile.Username }}">
<i class="ti ti-volume"></i>
{{ tr . "ProfileUnmuteLinkTitle" }}
{{ if $.Authenticated }}
{{ if not ($.User.Is .Profile.URL) }}
<h3>
<a class="followBtn" style="display: {{ if not ($.User.Follows .Profile.URL) }}inline{{ else }}none{{ end }};" href="/follow?nick={{ .Profile.Username }}&url={{ .Profile.URL }}">
<i class="ti ti-circle-plus"></i>
{{ tr . "FollowLinkTitle" }}
</a>
</li>
<li>
<a href="/report?nick={{ .Profile.Username }}&url={{ .Profile.URL }}">
<i class="ti ti-urgent" style="color:red;"></i>
{{ tr . "ProfileReportLinkTitle" }}
<a class="unfollowBtn" style="display: {{ if $.User.Follows .Profile.URL }}inline{{ else }}none{{ end }};" href="/unfollow?nick={{ .Profile.Username }}">
<i class="ti ti-circle-minus"></i>
{{ tr . "UnfollowLinkTitle" }}
</a>
</li>
</ul>
</details>
{{ if $.User.OwnsFeed .Profile.Username }}
| <a href="/feed/{{ .Profile.Username }}/manage">{{ tr . "FeedManageLinkTitle" }}</a>
{{ end }}
</h3>
{{ end }}
{{ end }}
<p><i>{{ .Profile.Tagline }}</i></p>
{{ if $.Authenticated }}
<details>
<summary>{{ tr . "ProfileBlockUserTitle" }}</summary>
{{ (tr . "ProfileBlockUserContent" (dict "InstanceName" .InstanceName)) | html }}
<ul>
<li>
<a id="muteBtn" style="display: {{ if not ($.User.HasMuted .Profile.URL) }}inline{{ else }}none{{ end }};" href="/mute?nick={{ .Profile.Username }}&url={{ .Profile.URL }}">
<i class="ti ti-volume-3"></i>
{{ tr . "ProfileMuteLinkTitle" }}
</a>
<a id="unmuteBtn" style="display: {{ if $.User.HasMuted .Profile.URL }}inline{{ else }}none{{ end }};" href="/unmute?nick={{ .Profile.Username }}">
<i class="ti ti-volume"></i>
{{ tr . "ProfileUnmuteLinkTitle" }}
</a>
</li>
<li>
<a href="/report?nick={{ .Profile.Username }}&url={{ .Profile.URL }}">
<i class="ti ti-urgent" style="color:red;"></i>
{{ tr . "ProfileReportLinkTitle" }}
</a>
</li>
</ul>
</details>
{{ end }}
</hgroup>
<p>
{{ if $.Profile.FollowedBy }}
<a href="{{ .Profile.URL }}">@{{ .Profile.Username }}</a>{{ tr . "ProfileFollowsYou" }}
{{ else }}
<a href="{{ .Profile.URL }}">@{{ .Profile.Username }}</a>{{ (tr . "ProfileDoesNotFollowYou") | html }}
{{ if $.Authenticated }}
<p>
{{ if $.Profile.FollowedBy }}
<a href="{{ .Profile.URL }}">@{{ .Profile.Username }}</a>&nbsp;{{ (tr . "ProfileFollowsYou") | html }}
{{ else }}
<a href="{{ .Profile.URL }}">@{{ .Profile.Username }}</a>&nbsp;{{ (tr . "ProfileDoesNotFollowYou") | html }}
{{ end }}
</p>
{{ end }}
</p>
</div>
<div>
{{ template "profileLinks" (dict "Profile" .Profile "ShowConfig" false "Ctx" .) }}

Loading…
Cancel
Save