Browse Source

Only show date edition controls if it's new, drafted or scheduled.

default 1 year ago
parent
commit
dde907f55a
1 changed files with 16 additions and 14 deletions
  1. 16 14
      html.c

+ 16 - 14
html.c

@@ -453,20 +453,22 @@ xs_html *html_note(snac *user, const char *summary,
         }
     }
 
-    xs_html_add(form,
-        xs_html_tag("p",
-            xs_html_text(L("Post date and time (empty, right now; in the future, schedule for later):")),
-            xs_html_sctag("br", NULL),
-            xs_html_sctag("input",
-                xs_html_attr("type",  "date"),
-                xs_html_attr("value", post_date ? post_date : ""),
-                xs_html_attr("name",  "post_date")),
-            xs_html_text(" "),
-            xs_html_sctag("input",
-                xs_html_attr("type",  "time"),
-                xs_html_attr("value", post_time ? post_time : ""),
-                xs_html_attr("step",  "1"),
-                xs_html_attr("name",  "post_time"))));
+    if (edit_id == NULL || is_draft || is_scheduled(user, edit_id)) {
+        xs_html_add(form,
+            xs_html_tag("p",
+                xs_html_text(L("Post date and time (empty, right now; in the future, schedule for later):")),
+                xs_html_sctag("br", NULL),
+                xs_html_sctag("input",
+                    xs_html_attr("type",  "date"),
+                    xs_html_attr("value", post_date ? post_date : ""),
+                    xs_html_attr("name",  "post_date")),
+                xs_html_text(" "),
+                xs_html_sctag("input",
+                    xs_html_attr("type",  "time"),
+                    xs_html_attr("value", post_time ? post_time : ""),
+                    xs_html_attr("step",  "1"),
+                    xs_html_attr("name",  "post_time"))));
+    }
 
     if (edit_id)
         xs_html_add(form,