From 11bdf47b6cd6a01f95b2c7ae7f08f62131083c72 Mon Sep 17 00:00:00 2001 From: cage Date: Fri, 15 May 2020 17:39:23 +0200 Subject: [PATCH] - added user mention on top of a reply message. --- src/db.lisp | 9 +++++++++ src/package.lisp | 1 + src/ui-goodies.lisp | 14 ++++++++------ 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/src/db.lisp b/src/db.lisp index 4a4f51a..b348ee7 100644 --- a/src/db.lisp +++ b/src/db.lisp @@ -1117,6 +1117,15 @@ identifier despite the name." (from :status) (where (:= :status-id status-id))))) +(defun find-message-id (status-id) + "Find a message (status with other columns like acct) by id, notes +that status id is not a unique identifier despite the name." + (fetch-single (make-filtered-message-select nil + nil + nil + nil + `(:= :status-id ,status-id)))) + (defun find-status-id-folder-timeline (status-id folder timeline) "Fetch a single message identified by `status-id', `folder' and `timeline'. diff --git a/src/package.lisp b/src/package.lisp index 9980969..7cb029c 100644 --- a/src/package.lisp +++ b/src/package.lisp @@ -745,6 +745,7 @@ :message-from-timeline-folder-message-index :message-index->tree :find-status-id + :find-message-id :data-id :row-id :row-message-visibility diff --git a/src/ui-goodies.lisp b/src/ui-goodies.lisp index f211e4c..05b4e20 100644 --- a/src/ui-goodies.lisp +++ b/src/ui-goodies.lisp @@ -753,16 +753,18 @@ Starting from the oldest toot and going back." ;; timeline here as the id in unique identifier for a ;; single message *content* regardless of the position ;; in db (folder, timeline). - (when-let* ((message (db:find-status-id reply-id)) - (quoted-text (db:row-message-rendered-text message)) - (lines (split-lines quoted-text)) - (quote-mark (swconf:quote-char)) - (quoted-lines (mapcar (lambda (a) (strcat quote-mark a)) - lines))) + (when-let* ((message (db:find-message-id reply-id)) + (reply-username (db:row-message-username message)) + (quoted-text (db:row-message-rendered-text message)) + (lines (split-lines quoted-text)) + (quote-mark (swconf:quote-char)) + (quoted-lines (mapcar (lambda (a) (strcat quote-mark a)) + lines))) (with-open-file (stream file :if-exists :append :direction :output :element-type 'character) + (format stream "~a~%" (msg-utils:add-mention-prefix reply-username)) (loop for line in quoted-lines do (format stream "~a~%" line)))))) (add-body ()