From 5d42e59c7f797deb6f461df564cecfc4643fa002 Mon Sep 17 00:00:00 2001
From: r <r@freesoftwareextremist.com>
Date: Sun, 30 May 2021 07:00:39 +0000
Subject: Hide post format setting in case of empty list

---
 templates/postform.tmpl | 2 +-
 templates/settings.tmpl | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/templates/postform.tmpl b/templates/postform.tmpl
index 9fb651e..421b118 100644
--- a/templates/postform.tmpl
+++ b/templates/postform.tmpl
@@ -15,7 +15,7 @@
 		<textarea id="post-content" name="content" class="post-content" cols="34" rows="5" accesskey="E" title="Edit post (E)">{{if .ReplyContext}}{{.ReplyContext.ReplyContent}}{{end}}</textarea>
 	</div>
 	<div>
-		{{if gt (len .Formats) 0}}
+		{{if .Formats}}
 		<span class="post-form-field">
 			{{$defFormat := .DefaultFormat}}
 			<select id="post-format" name="format" accesskey="F" title="Format (F)">
diff --git a/templates/settings.tmpl b/templates/settings.tmpl
index 8aee4e2..500aea8 100644
--- a/templates/settings.tmpl
+++ b/templates/settings.tmpl
@@ -5,6 +5,7 @@
 <form id="settings-form" action="/settings" method="POST">
 	<input type="hidden" name="csrf_token" value="{{$.Ctx.CSRFToken}}">
 	<input type="hidden" name="referrer" value="{{$.Ctx.Referrer}}">
+	{{if .PostFormats}}
 	<div class="settings-form-field">
 		<label for="visibility"> Default format </label>
 		{{$defFormat := .Settings.DefaultFormat}}
@@ -14,6 +15,7 @@
 			{{end}}
 		</select>
 	</div>
+	{{end}}
 	<div class="settings-form-field">
 		<label for="visibility"> Default scope </label>
 		<select id="visibility" name="visibility">
-- 
cgit v1.2.3