Skip to content

Commit 937d2fa

Browse files
author
cage
committed
- added a configuration directive to leave or delete mentions from the server after fetching them.
1 parent c83f21a commit 937d2fa

File tree

5 files changed

+28
-14
lines changed

5 files changed

+28
-14
lines changed

etc/shared.conf

+4
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ post-allowed-language = ".*"
4545
# (default 'no', change to 'yes' if desired)
4646
start.update.gemlog = no
4747

48+
# delete mentions fetched from the server
49+
50+
delete.fetched.mentions = yes
51+
4852
# directory to scan for gempub files, default the same as
4953
# $XDG_DATA_HOME (usually something like %HOME/.local/share/tinmop/").
5054

src/api-client.lisp

-2
Original file line numberDiff line numberDiff line change
@@ -756,7 +756,6 @@ the latest 15 mentions)."
756756
mentions-so-far))
757757

758758
(defun update-mentions-folder (&key (delete-mentions-on-server t))
759-
(declare (ignorable delete-mentions-on-server)) ; because of the render macro '#-debug-mode'
760759
(let ((trees '()))
761760
(when-let* ((all-mentions (all-mentions))
762761
(statuses (loop for mention in all-mentions
@@ -774,7 +773,6 @@ the latest 15 mentions)."
774773
:folder db:+mentions-status-folder+
775774
:localp t
776775
:min-id nil)))
777-
#-debug-mode
778776
(when delete-mentions-on-server
779777
(loop for mention in all-mentions do
780778
(delete-notification (tooter:id mention))))

src/package.lisp

+1
Original file line numberDiff line numberDiff line change
@@ -1252,6 +1252,7 @@
12521252
:tree-config-rendering-values
12531253
:make-tree-colormap
12541254
:left-arrow
1255+
:config-delete-fetched-mentions-p
12551256
:config-gemini-fullscreen-toc-width
12561257
:config-gemini-fullscreen-links-height
12571258
:config-post-allowed-language

src/program-events.lisp

+13-11
Original file line numberDiff line numberDiff line change
@@ -971,17 +971,19 @@
971971
(defclass update-mentions-event (program-event) ())
972972

973973
(defmethod process-event ((object update-mentions-event))
974-
(when-let* ((mentions (api-client:update-mentions-folder :delete-mentions-on-server t))
975-
(mentions-count (length mentions))
976-
(thread-window specials:*thread-window*))
977-
(when command-line:*notify-mentions*
978-
(loop for mention in mentions do
979-
(thread-window:add-mention thread-window mention))
980-
(ui:notify (format nil
981-
(n_ "Got ~a notification"
982-
"Got ~a notifications"
983-
mentions-count)
984-
mentions-count)))))
974+
(let ((delete-fetched-mentions-required (swconf:config-delete-fetched-mentions-p)))
975+
(when-let* ((mentions (api-client:update-mentions-folder
976+
:delete-mentions-on-server delete-fetched-mentions-required))
977+
(mentions-count (length mentions))
978+
(thread-window specials:*thread-window*))
979+
(when command-line:*notify-mentions*
980+
(loop for mention in mentions do
981+
(thread-window:add-mention thread-window mention))
982+
(ui:notify (format nil
983+
(n_ "Got ~a notification"
984+
"Got ~a notifications"
985+
mentions-count)
986+
mentions-count))))))
985987

986988
(defclass expand-thread-event (program-event event-with-timeline-and-folder)
987989
((status-id

src/software-configuration.lisp

+10-1
Original file line numberDiff line numberDiff line change
@@ -601,6 +601,8 @@
601601
selected
602602
unselected
603603
deleted
604+
fetched
605+
delete
604606
input
605607
read
606608
unread
@@ -622,7 +624,8 @@
622624
ignore-user-boost-re
623625
post-allowed-language
624626
purge-history-days-offset
625-
purge-cache-days-offset)
627+
purge-cache-days-offset
628+
mentions)
626629

627630
(defun perform-missing-value-check (file)
628631
(handler-case
@@ -983,6 +986,12 @@
983986
(,transform-value-fn (access:accesses *software-configuration*
984987
,@keys))))
985988

989+
(gen-simple-access (delete-fetched-mentions-p
990+
:transform-value-fn db-utils:db-not-nil-p)
991+
+key-delete+
992+
+key-fetched+
993+
+key-mentions+)
994+
986995
(gen-simple-access (gemini-fullscreen-toc-width
987996
:transform-value-fn main-window:parse-subwin-w)
988997
+key-gemini+

0 commit comments

Comments
 (0)