From 3e3f2b1f3c25d3c85afb08786fbd6bf9e627cc1b Mon Sep 17 00:00:00 2001 From: cage Date: Fri, 27 Oct 2023 18:15:32 +0200 Subject: [PATCH] - checked for tags and languages in the parent status if it is non null, when filtering out statuses; - ensured the post containing mentions is saved also in the home timeline. Pleroma provides status that mentions the user in the home timeline whilst mastodon does not. The code manually copy each status with mention in the local home timeline when using tinmop with a mastodon instance. --- src/api-client.lisp | 27 +++++++++++++++++++-------- src/program-events.lisp | 19 ++++++++++++------- 2 files changed, 31 insertions(+), 15 deletions(-) diff --git a/src/api-client.lisp b/src/api-client.lisp index 157b41a..1c5edef 100644 --- a/src/api-client.lisp +++ b/src/api-client.lisp @@ -839,7 +839,10 @@ the latest 15 mentions)." (tooter:account-name (tooter:account notification))))) (tui:make-tui-string raw-text))) -(defun update-mentions-folder (&key (delete-mentions-on-server t) (collect-threads t)) +(defun update-mentions-folder (&key + (delete-mentions-on-server t) + (collect-threads t) + (save-mentions-in-home nil)) (let ((trees '())) (when-let* ((all-mentions (all-mentions)) (statuses (loop for mention in all-mentions @@ -853,16 +856,24 @@ the latest 15 mentions)." do (pushnew node trees))) (setf trees statuses)) - (let ((event (make-instance 'program-events:save-timeline-in-db-event - :payload trees - :timeline-type db:+home-timeline+ - :folder db:+mentions-status-folder+ - :localp t - :min-id nil))) + (let ((event-save-in-mention-folder (make-instance 'program-events:save-timeline-in-db-event + :payload trees + :timeline-type db:+home-timeline+ + :folder db:+mentions-status-folder+ + :localp t + :min-id nil)) + (event-save-in-home-folder (make-instance 'program-events:save-timeline-in-db-event + :payload trees + :timeline-type db:+home-timeline+ + :folder db:+default-status-folder+ + :localp t + :min-id nil))) (when delete-mentions-on-server (loop for mention in all-mentions do (delete-notification (tooter:id mention)))) - (program-events:push-event event) + (program-events:push-event event-save-in-mention-folder) + (when save-mentions-in-home + (program-events:push-event event-save-in-home-folder)) all-mentions)))) (defun expand-status-thread (status-id timeline folder force-saving-of-ignored-status-p) diff --git a/src/program-events.lisp b/src/program-events.lisp index a60bece..b354968 100644 --- a/src/program-events.lisp +++ b/src/program-events.lisp @@ -467,12 +467,16 @@ statuses)))) (dbg "statuses ~a" dump)) (loop for status in statuses do - (let ((account-id (tooter:id (tooter:account status))) - (status-id (tooter:id status)) - (language (tooter:language status)) - (rebloggedp (tooter:parent status)) - (tags (db::concat-tags status)) - (skip-this-status nil)) + (let* ((account-id (tooter:id (tooter:account status))) + (status-id (tooter:id status)) + (rebloggedp (tooter:parent status)) + (language (if rebloggedp + (tooter:language (tooter:parent status)) + (tooter:language status))) + (tags (if rebloggedp + (db::concat-tags (tooter:parent status)) + (db::concat-tags status))) + (skip-this-status nil)) (when force-saving-of-ignored-status-p (db:remove-from-status-ignored status-id folder timeline-type)) (when (or (and (db:user-ignored-p account-id) @@ -1088,7 +1092,8 @@ (let ((delete-fetched-mentions-required (swconf:config-delete-fetched-mentions-p))) (when-let* ((mentions (api-client:update-mentions-folder :delete-mentions-on-server delete-fetched-mentions-required - :collect-threads nil)) + :collect-threads nil + :save-mentions-in-home (not (api-pleroma:instance-pleroma-p)))) (mentions-count (length mentions)) (thread-window specials:*thread-window*)) (when command-line:*notify-mentions*