dkforest

A forum and chat platform (onion)
git clone https://git.dasho.dev/n0tr1v/dkforest.git
Log | Files | Refs | LICENSE

commit 392acfb50724ac54ab6d2875ca2769e1e799e036
parent 38e8631baf3b888a83ae63e46469137de5d4953d
Author: n0tr1v <n0tr1v@protonmail.com>
Date:   Thu, 12 Jan 2023 16:04:46 -0800

improve template spaces

Diffstat:
Mpkg/web/public/views/pages/chat-messages.gohtml | 153+++++++++++++++++++++++++++++++++++++++----------------------------------------
1 file changed, 76 insertions(+), 77 deletions(-)

diff --git a/pkg/web/public/views/pages/chat-messages.gohtml b/pkg/web/public/views/pages/chat-messages.gohtml @@ -166,45 +166,44 @@ <div style="{{ if not .AuthUser.HideRightColumn }}width: calc(100% - 170px); float: left; {{ end }}line-height: 1.2;"> {{ $readMarkerRendered := false }} {{ range $idx, $e := .Data.Messages }} - {{ if (.UserCanSee $.AuthUser) }} - <div class="msg" style=" - padding: 3px 0 3px 8px; border-bottom: 1px solid #444; color: #888; position: relative; - {{ if and (or .User.IsHellbanned .IsHellbanned) $.AuthUser.DisplayHellbanned }} background-color: rgba(0, 0, 0, 0.7); - {{ else if and (eq $.AuthUser.ID .User.ID) $.AuthUser.HighlightOwnMessages }} background-color: rgba(255,241,176,0.05);{{ end }} + {{- if (.UserCanSee $.AuthUser) -}} + <div class="msg" style="padding: 3px 0 3px 8px; border-bottom: 1px solid #444; color: #888; position: relative; + {{- if and (or .User.IsHellbanned .IsHellbanned) $.AuthUser.DisplayHellbanned -}} background-color: rgba(0, 0, 0, 0.7); + {{- else if and (eq $.AuthUser.ID .User.ID) $.AuthUser.HighlightOwnMessages -}} background-color: rgba(255,241,176,0.05);{{- end -}} - {{ if and $.AuthUser.ChatReadMarkerEnabled (.CreatedAt.Before $.Data.ReadMarker.ReadAt) (not $readMarkerRendered) }} - {{ if gt $idx 0 }} + {{- if and $.AuthUser.ChatReadMarkerEnabled (.CreatedAt.Before $.Data.ReadMarker.ReadAt) (not $readMarkerRendered) -}} + {{- if gt $idx 0 -}} border-top: {{ $.AuthUser.ChatReadMarkerSize }}px solid {{ $.AuthUser.ChatReadMarkerColor }}; - {{ end }} + {{- end -}} {{ $readMarkerRendered = true }} - {{ end }} + {{- end -}} "> - {{ if (.UserCanDelete $.AuthUser) }} - {{ if not .TooOldToDelete }} - {{ if $.AuthUser.DisplayDeleteButton }} + {{- if (.UserCanDelete $.AuthUser) -}} + {{- if not .TooOldToDelete -}} + {{- if $.AuthUser.DisplayDeleteButton -}} <form method="post" action="/api/v1/chat/messages/delete/{{ .UUID }}" style="display: inline;"> <input type="hidden" name="csrf" value="{{ $.CSRF }}" /> <button class="mod-btn delete_msg_btn" title="delete"></button> </form> - {{ end }} - {{ else if or (and $.AuthUser.IsModerator .TooOldToDelete (ne .UserID $.AuthUser.ID)) $.AuthUser.IsAdmin (and .Room.OwnerUserID (eq (derefUserID .Room.OwnerUserID) $.AuthUser.ID)) }} - {{ if $.AuthUser.DisplayDeleteButton }} + {{- end -}} + {{- else if or (and $.AuthUser.IsModerator .TooOldToDelete (ne .UserID $.AuthUser.ID)) $.AuthUser.IsAdmin (and .Room.OwnerUserID (eq (derefUserID .Room.OwnerUserID) $.AuthUser.ID)) -}} + {{- if $.AuthUser.DisplayDeleteButton -}} <form method="post" action="/api/v1/chat/messages/delete/{{ .UUID }}" style="display: inline;"> <input type="hidden" name="csrf" value="{{ $.CSRF }}" /> <button class="mod-btn delete_msg_btn" style="color: orange;" title="delete"></button> </form> - {{ end }} - {{ else if $.AuthUser.IsModerator }} - {{ if $.AuthUser.DisplayDeleteButton }} + {{- end -}} + {{- else if $.AuthUser.IsModerator }} + {{- if $.AuthUser.DisplayDeleteButton -}} <div style="display: inline-block; width: 16px;"></div> - {{ end }} - {{ else }} - {{ if $.AuthUser.DisplayDeleteButton }} + {{- end -}} + {{- else -}} + {{- if $.AuthUser.DisplayDeleteButton -}} <div style="display: inline-block; width: 16px;"></div> - {{ end }} - {{ end }} - {{ if $.AuthUser.IsModerator }} - {{ if ne .UserID $.AuthUser.ID }} + {{- end -}} + {{- end -}} + {{- if $.AuthUser.IsModerator -}} + {{- if ne .UserID $.AuthUser.ID -}} {{- if $.AuthUser.DisplayHellbanButton -}} {{- if eq .User.Username $.NullUsername -}} <div style="display: inline-block; width: 16px;"></div> @@ -215,22 +214,22 @@ </form> {{- end -}} {{- end -}} - {{ if $.AuthUser.DisplayKickButton }} + {{- if $.AuthUser.DisplayKickButton -}} <form method="post" action="/api/v1/users/{{ .UserID }}/kick" style="display: inline;"> <input type="hidden" name="csrf" value="{{ $.CSRF }}" /> <button class="mod-btn k_btn" style="color: orange;" title="kick"></button> </form> - {{ end }} - {{ else }} + {{- end -}} + {{- else -}} {{- if and $.AuthUser.DisplayKickButton $.AuthUser.DisplayHellbanButton -}} <div style="display: inline-block; width: 36px;"></div> {{- else if or $.AuthUser.DisplayKickButton $.AuthUser.DisplayHellbanButton -}} <div style="display: inline-block; width: 16px;"></div> {{- end -}} - {{ end }} - {{ end }} - {{ else }} - {{ if $.AuthUser.IsModerator }} + {{- end -}} + {{- end -}} + {{- else -}} + {{- if $.AuthUser.IsModerator -}} {{- if eq $.Data.NbButtons 3 -}} <div style="display: inline-block; width: 56px;"></div> {{- else if eq $.Data.NbButtons 2 -}} @@ -238,12 +237,12 @@ {{- else if eq $.Data.NbButtons 1 -}} <div style="display: inline-block; width: 16px;"></div> {{- end -}} - {{ else }} + {{- else -}} {{- if $.AuthUser.DisplayDeleteButton -}} <div style="display: inline-block; width: 16px;"></div> {{- end -}} - {{ end }} - {{ end }} + {{- end -}} + {{- end -}} {{- if ne $.Data.DateFormat "" -}} <a href="/api/v1/chat/top-bar/{{ $.Data.RoomName }}?quote={{ .UUID }}{{ $.Data.TopBarQueryParams | safeURL }}" target="iframe1" class="date date-link" title="{{ .CreatedAt.Format "01-02 15:04:05" }}">{{ .CreatedAt.Format $.Data.DateFormat }}</a>&nbsp; {{- end -}} @@ -328,90 +327,90 @@ {{- end -}} </div> {{- end -}} - {{ else }} + {{- else -}} <div style="color: #ddd;"><em>No message yet</em></div> - {{ end }} + {{- end -}} </div> - {{ if not .AuthUser.HideRightColumn }} + {{- if not .AuthUser.HideRightColumn -}} <div style="width: 150px; height: 100%; float: left; margin-left: 20px; position: fixed; right: 0; overflow-y: auto; line-height: 1.15; "> <div style="margin-bottom: 20px;"> <div style="font-weight: bolder; color: #ced4da;">Inbox (<a href="/settings/inbox" target="_top"{{ if gt .Data.InboxCount 0 }}style="color: #e74c3c;"{{ end }}>{{ .Data.InboxCount }}</a>)</div> </div> <div style="margin-bottom: 20px;"> <div style="font-weight: bolder; color: #ced4da;">Rooms:</div> - {{ range .Data.OfficialRooms }} - {{ if eq .Name "club" }} - {{ if $.AuthUser.IsClubMember }} + {{- range .Data.OfficialRooms -}} + {{- if eq .Name "club" -}} + {{- if $.AuthUser.IsClubMember -}} <div><a href="/chat/club" target="_top"{{ if .IsUnread }} class="unread_room"{{ end }}>#club</a></div> - {{ end }} - {{ else if eq .Name "moderators" }} - {{ if $.AuthUser.IsModerator }} + {{- end -}} + {{- else if eq .Name "moderators" -}} + {{- if $.AuthUser.IsModerator -}} <div><a href="/chat/moderators" target="_top"{{ if .IsUnread }} class="unread_room"{{ end }}>#moderators</a></div> - {{ end }} - {{ else }} + {{- end -}} + {{- else -}} <div><a href="/chat/{{ .Name }}" target="_top"{{ if .IsUnread }} class="unread_room"{{ end }}>#{{ .Name }}</a></div> - {{ end }} - {{ end }} + {{- end -}} + {{- end -}} - {{ if .Data.SubscribedRooms }} + {{- if .Data.SubscribedRooms -}} <div style="margin-top: 10px;"></div> {{ range .Data.SubscribedRooms }} <div><a href="/chat/{{ .Name }}" target="_top"{{ if .IsUnread }} class="unread_room"{{ end }}>#{{ .Name }}</a></div> {{ end }} - {{ end }} + {{- end -}} <div style="margin-top: 5px;"><a href="/rooms" target="_top">[...]</a></div> </div> <div style="margin-bottom: 20px"> <div style="font-weight: bolder; color: #ced4da;">In this room:</div> - {{ range .Data.Members }} - {{ if eq .Username $.AuthUser.Username }} + {{- range .Data.Members -}} + {{- if eq .Username $.AuthUser.Username -}} <div> <span style="color: {{ .Color }};">{{ .Username }}</span> - {{ if .AfkIndicatorEnabled }} + {{- if .AfkIndicatorEnabled -}} <small class="afk-indicator">afk</small> - {{ end }} + {{- end -}} </div> - {{ else }} - {{ if or (not .IsHellbanned) (eq $.AuthUser.ID .UserID) (and .IsHellbanned $.AuthUser.IsHellbanned) $.AuthUser.DisplayHellbanned }} + {{- else -}} + {{- if or (not .IsHellbanned) (eq $.AuthUser.ID .UserID) (and .IsHellbanned $.AuthUser.IsHellbanned) $.AuthUser.DisplayHellbanned -}} <div> <a href="/api/v1/chat/top-bar/{{ $.Data.RoomName }}?tag={{ .Username }}{{ $.Data.TopBarQueryParams | safeURL }}" target="iframe1" style="color: {{ .Color }};{{ if and (.IsHellbanned) $.AuthUser.DisplayHellbanned }} background-color: rgba(0, 0, 0, 0.7);{{ end }}">{{ .Username | first }}</a><a href="/api/v1/chat/top-bar/{{ $.Data.RoomName }}?pm={{ .Username }}{{ $.Data.TopBarQueryParams | safeURL }}" target="iframe1" style="color: {{ .Color }};{{ if and (.IsHellbanned) $.AuthUser.DisplayHellbanned }} background-color: rgba(0, 0, 0, 0.7);{{ end }}">{{ .Username | rest }}</a> - {{ if .AfkIndicatorEnabled }} + {{- if .AfkIndicatorEnabled -}} <small class="afk-indicator">afk</small> - {{ end }} + {{- end -}} </div> - {{ end }} - {{ end }} - {{ end }} + {{- end -}} + {{- end -}} + {{- end -}} </div> - {{ if or .Data.VisibleMemberInChat $.AuthUser.DisplayHellbanned }} + {{- if or .Data.VisibleMemberInChat $.AuthUser.DisplayHellbanned -}} <div style="margin-bottom: 30px;"> - {{ if .Data.MembersInChat }} + {{- if .Data.MembersInChat -}} <div style="font-weight: bolder; color: #ced4da;">In other rooms:</div> - {{ range .Data.MembersInChat }} - {{ if eq .Username $.AuthUser.Username }} + {{- range .Data.MembersInChat -}} + {{- if eq .Username $.AuthUser.Username -}} <div> <span style="color: {{ .Color }};">{{ .Username }}</span> - {{ if .AfkIndicatorEnabled }} + {{- if .AfkIndicatorEnabled -}} <small class="afk-indicator">afk</small> - {{ end }} + {{- end -}} </div> - {{ else }} - {{ if or (not .IsHellbanned) (eq $.AuthUser.ID .UserID) (and .IsHellbanned $.AuthUser.IsHellbanned) $.AuthUser.DisplayHellbanned }} + {{- else -}} + {{- if or (not .IsHellbanned) (eq $.AuthUser.ID .UserID) (and .IsHellbanned $.AuthUser.IsHellbanned) $.AuthUser.DisplayHellbanned -}} <div> <a href="/api/v1/chat/top-bar/{{ $.Data.RoomName }}?tag={{ .Username }}{{ $.Data.TopBarQueryParams | safeURL }}" target="iframe1" style="color: {{ .Color }};{{ if and (.IsHellbanned) $.AuthUser.DisplayHellbanned }} background-color: rgba(0, 0, 0, 0.7);{{ end }}">{{ .Username | first }}</a><a href="/api/v1/chat/top-bar/{{ $.Data.RoomName }}?pm={{ .Username }}{{ $.Data.TopBarQueryParams | safeURL }}" target="iframe1" style="color: {{ .Color }};{{ if and (.IsHellbanned) $.AuthUser.DisplayHellbanned }} background-color: rgba(0, 0, 0, 0.7);{{ end }}">{{ .Username | rest }}</a> - {{ if .AfkIndicatorEnabled }} + {{- if .AfkIndicatorEnabled -}} <small class="afk-indicator">afk</small> - {{ end }} + {{- end -}} </div> - {{ end }} - {{ end }} - {{ end }} - {{ end }} + {{- end -}} + {{- end -}} + {{- end -}} + {{- end -}} </div> - {{ end }} + {{- end -}} </div> - {{ end }} + {{- end -}} {{- if .AuthUser.CollectMetadata -}} <div class="div_1"></div>