aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Tom Willemse2023-12-07 21:59:45 -0800
committerGravatar Tom Willemse2023-12-07 21:59:45 -0800
commit0f663fabc68d726ac02bc41a875a6e564ecd15ae (patch)
tree72c572cd6b48b249dfec00f8f4fbb71ffb453efb
parentd41e65e40681bea513f7919df5c7c63782c26ccf (diff)
downloadtekuti-el-0f663fabc68d726ac02bc41a875a6e564ecd15ae.tar.gz
tekuti-el-0f663fabc68d726ac02bc41a875a6e564ecd15ae.zip
Display a different message for an update rather than create
-rw-r--r--tekuti.el14
1 files changed, 8 insertions, 6 deletions
diff --git a/tekuti.el b/tekuti.el
index e01c609..bbd4e56 100644
--- a/tekuti.el
+++ b/tekuti.el
@@ -93,7 +93,7 @@
data
"&"))
-(defun tekuti--send-finished (status buffer args)
+(defun tekuti--send-finished (status buffer args updatep)
(pcase-exhaustive status
(`(:redirect ,url . ,_)
(save-excursion
@@ -117,9 +117,9 @@
(car (url-path-and-query
(url-generic-parse-url url))))
"\n"))))
- (message "Created new post: %s" url))
+ (message "%s post: %s" (if updatep "Updated" "Created new") url))
(`(:error (error http ,code) . ,_)
- (message "Failed to create post: %d" code))))
+ (message "Failed to %s post: %d" (if updatep "update" "create") code))))
(defun tekuti--get-update-url ()
(save-excursion
@@ -133,12 +133,14 @@
(url-request-method "POST")
(url-request-extra-headers
`(("Content-Type" . "application/x-www-form-urlencoded")))
- (url-request-data (tekuti-form-encode-data data)))
+ (url-request-data (tekuti-form-encode-data data))
+ (previous-update-url (tekuti--get-update-url))
+ (updatep (not (null previous-update-url))))
(url-retrieve (format "%s%s" tekuti-host
- (or (tekuti--get-update-url)
+ (or previous-update-url
"/admin/new-post"))
#'tekuti--send-finished
- (list (current-buffer) data))))
+ (list (current-buffer) data updatep))))
(provide 'tekuti)
;;; tekuti.el ends here