mirror of https://codeberg.org/cage/tinmop/
- [TUI][fediverse] ensured the printed status is updated after editing.
This commit is contained in:
parent
0f5fe10ab6
commit
ebbee28430
|
@ -501,13 +501,15 @@ become an emty string (\"\")
|
|||
:limit limit
|
||||
:min-id max-id))))
|
||||
|
||||
(defun-api-call fetch-remote-status (status-id)
|
||||
(defun-api-call fetch-remote-status (status-id &optional folder timeline)
|
||||
"Fetch a single status identified by status-id and generate an event
|
||||
`fetch-remote-status-event' that, in turn will save the status to the
|
||||
database."
|
||||
(when-let* ((status (tooter:find-status *client* status-id))
|
||||
(event (make-instance 'program-events:fetch-remote-status-event
|
||||
:payload status)))
|
||||
:payload status
|
||||
:folder folder
|
||||
:timeline timeline)))
|
||||
(program-events:push-event event)))
|
||||
|
||||
(defun-api-call get-remote-status (status-id)
|
||||
|
|
|
@ -556,15 +556,25 @@
|
|||
(going-backward
|
||||
(ui:update-current-timeline-backwards (1+ recover-count)))))))))
|
||||
|
||||
(defclass fetch-remote-status-event (program-event) ())
|
||||
(defclass fetch-remote-status-event (program-event)
|
||||
((timeline
|
||||
:initform nil
|
||||
:initarg :timeline
|
||||
:accessor timeline)
|
||||
(folder
|
||||
:initform nil
|
||||
:initarg :folder
|
||||
:accessor folder)))
|
||||
|
||||
(defmethod process-event ((object fetch-remote-status-event))
|
||||
(let ((status (payload object)))
|
||||
#+debug-mode
|
||||
(let ((dump (with-output-to-string (stream)
|
||||
(tooter::present status stream))))
|
||||
(dbg "fetch single status ~a" dump))
|
||||
(db:update-db status)))
|
||||
(with-accessors ((folder folder)
|
||||
(timeline timeline)) object
|
||||
#+debug-mode
|
||||
(let ((dump (with-output-to-string (stream)
|
||||
(tooter::present status stream))))
|
||||
(dbg "fetch single status ~a" dump))
|
||||
(db:update-db status :folder folder :timeline timeline))))
|
||||
|
||||
(defparameter *search-next-saved-event* nil)
|
||||
|
||||
|
@ -2068,9 +2078,12 @@
|
|||
|
||||
(defmethod process-event ((object edit-status-event))
|
||||
(with-accessors ((status-id payload)) object
|
||||
(when-let* ((status (db:find-status-id status-id))
|
||||
(text (db:row-message-rendered-text status))
|
||||
(status-id (db:row-message-status-id status)))
|
||||
(when-let* ((status (db:find-status-id status-id))
|
||||
(text (db:row-message-rendered-text status))
|
||||
(status-id (db:row-message-status-id status))
|
||||
(folder (db:row-message-folder status))
|
||||
(timeline (db:row-message-timeline status))
|
||||
(message-index (db:row-message-index status)))
|
||||
(let ((temp-file (fs:temporary-file)))
|
||||
(with-open-file (stream temp-file
|
||||
:direction :output
|
||||
|
@ -2080,15 +2093,16 @@
|
|||
(croatoan:end-screen)
|
||||
(tui:with-notify-errors
|
||||
(os-utils:open-with-editor temp-file))
|
||||
(let* ((new-content (fs:slurp-file temp-file))
|
||||
(raw-rows (text-utils:split-lines new-content)))
|
||||
(message-window:prepare-for-rendering specials:*message-window* raw-rows)
|
||||
(windows:win-clear specials:*message-window*)
|
||||
(windows:draw specials:*message-window*)
|
||||
(ui:with-blocking-notify-procedure ((_ "Editing post…")
|
||||
(_ "Post modified"))
|
||||
(api-client:edit-status status-id new-content nil nil nil nil)
|
||||
(client:fetch-remote-status status-id)))))))
|
||||
(let ((new-content (fs:slurp-file temp-file)))
|
||||
(ui:notify (_ "Editing post…"))
|
||||
(client:edit-status status-id new-content nil nil nil nil)
|
||||
(db:remove-from-status-ignored status-id folder timeline)
|
||||
(db::delete-status timeline folder status-id)
|
||||
(client:fetch-remote-status status-id folder timeline)
|
||||
(ui:refresh-thread)
|
||||
(with-enqueued-process (+minimum-event-priority+)
|
||||
(ui:thread-open-selected-message)
|
||||
(ui:notify (_ "Post modified"))))))))
|
||||
|
||||
;;;; end events
|
||||
|
||||
|
|
|
@ -955,7 +955,8 @@ Starting from the oldest toot and going back."
|
|||
:new-timeline timeline
|
||||
:status-id status-id))
|
||||
(refresh-event (make-instance 'refresh-thread-windows-event
|
||||
:priority +minimum-event-priority+
|
||||
:priority
|
||||
(1+ +standard-event-priority+)
|
||||
:message-status-id status-id)))
|
||||
(push-event expand-event)
|
||||
(push-event refresh-event))))
|
||||
|
|
Loading…
Reference in New Issue