From 2eed0f6659463b3d484d54eda96ecd1add1fbe23 Mon Sep 17 00:00:00 2001 From: cage Date: Tue, 22 Oct 2024 20:54:05 +0200 Subject: [PATCH] - [fediverse] ensured, when opening a post that boosted a poll, that the reblogged poll's text is rendered. --- src/db.lisp | 4 +++- src/thread-window.lisp | 30 +++++++++++++++++------------- 2 files changed, 20 insertions(+), 14 deletions(-) diff --git a/src/db.lisp b/src/db.lisp index 7c4012e..c6e7551 100644 --- a/src/db.lisp +++ b/src/db.lisp @@ -1477,7 +1477,9 @@ than (swconf:config-purge-history-days-offset) days in the past" (hooks:run-hook-compose 'hooks:*after-saving-message* db-status))) ;; add poll or update poll's votes (when poll - (update-db poll :status-id id))))))) + (if reblog-id + (update-db poll :status-id reblog-id) + (update-db poll :status-id id)))))))) (defun find-chat (chat-id) (fetch-single (select :* diff --git a/src/thread-window.lisp b/src/thread-window.lisp index cd40783..04f49a5 100644 --- a/src/thread-window.lisp +++ b/src/thread-window.lisp @@ -860,7 +860,7 @@ db:renumber-timeline-message-index." (reblogged-status (db:find-status-id reblogged-id))) (let ((body (db:row-message-rendered-text reblogged-status)) (attachments (status-attachments->text reblogged-id))) - (values body attachments)))) + (values body attachments reblogged-id)))) (defun maybe-remove-mentions (window status-id) (a:when-let ((exists-mention-p (db:single-status-exists-p status-id @@ -909,19 +909,23 @@ db:renumber-timeline-message-index." (header (message-original->text-header fields))) (let* ((body (db:row-message-rendered-text fields)) (attachments (status-attachments->text status-id)) - (refresh-event (make-instance 'program-events:refresh-conversations-window-event)) - (poll (db:find-poll-bound-to-status status-id)) - (poll-text (poll->text (db:row-id poll) - (truncate (/ (win-width-no-border object) - 2))))) - (multiple-value-bind (reblogged-status-body reblogged-status-attachments) + (refresh-event (make-instance 'program-events:refresh-conversations-window-event))) + (multiple-value-bind (reblogged-status-body + reblogged-status-attachments + reblogged-id) (reblogged-data fields) - (let ((actual-body (if (string= body reblogged-status-body) - body - (strcat body reblogged-status-body))) - (actual-attachments (if (string= attachments reblogged-status-attachments) - attachments - (strcat reblogged-status-attachments attachments)))) + (let* ((status-id-for-poll (or reblogged-id + status-id)) + (poll (db:find-poll-bound-to-status status-id-for-poll)) + (poll-text (poll->text (db:row-id poll) + (truncate (/ (win-width-no-border object) + 2)))) + (actual-body (if (string= body reblogged-status-body) + body + (strcat body reblogged-status-body))) + (actual-attachments (if (string= attachments reblogged-status-attachments) + attachments + (strcat reblogged-status-attachments attachments)))) (maybe-remove-mentions object status-id) (maybe-initialize-metadata *message-window*) (set-status-tuple-shown-status *message-window*