Request metadata and contacts from authors when you click on their articles.

This commit is contained in:
Robert C. Martin 2023-04-17 16:17:56 -05:00
parent 8e949d0d0b
commit 4fffab9efd
3 changed files with 13 additions and 1 deletions

View File

@ -18,6 +18,14 @@
date (Date. (long time))]
(.format (SimpleDateFormat. "MM/dd/yyyy kk:mm:ss z") date)))
(defn request-metadata-and-contacts-for-user [author]
(doseq [url (keys @relays)]
(when (not= :read-none (get-in @relays [url :read]))
(let [relay (:connection (get @relays url))]
(when (some? relay)
(relay/send relay
["REQ" "ms-author" {"kinds" [0 3] "authors" [(util/hexify author)]}]))))))
(defn request-contact-lists [relay]
(let [now (quot (System/currentTimeMillis) 1000)
days-ago config/read-contact-lists-days-ago

View File

@ -9,6 +9,7 @@
[more-speech.mem :refer :all]
[more-speech.nostr.event-composers :as composers]
[more-speech.nostr.events :as events]
[more-speech.nostr.protocol :as protocol]
[more-speech.nostr.util :as util]
[more-speech.nostr.zaps :as zaps]
[more-speech.ui.formatter-util :as formatter-util]
@ -243,6 +244,7 @@
relay-names (map #(re-find config/relay-pattern %) (:relays event))
event-id (select main-frame [:#id-label])
author-name-label (select main-frame [:#author-name-label])]
(protocol/request-metadata-and-contacts-for-user (:pubkey event))
(text! reactions-label (str reactions))
(if reacted?
(do

View File

@ -1,15 +1,16 @@
(ns more-speech.ui.swing.tabs
(:require
[clojure.set :as set]
[more-speech.logger.default :refer [log-pr]]
[more-speech.config :as config]
[more-speech.config :refer [get-db]]
[more-speech.db.gateway :as gateway]
[more-speech.logger.default :refer [log-pr]]
[more-speech.mem :refer :all]
[more-speech.nostr.events :as events]
[more-speech.nostr.tab-searcher :as tab-searcher]
[more-speech.nostr.trust-updater :as trust-updater]
[more-speech.nostr.util :as util]
[more-speech.nostr.zaps :as zaps]
[more-speech.ui.formatters :as formatters]
[more-speech.ui.swing.article-panel :as article-panel]
[more-speech.ui.swing.article-tree-util :as at-util]
@ -271,6 +272,7 @@
(menu :text "Add article to tab" :items add-article-actions)
(menu :text "Block article from tab" :items block-article-actions)
(action :name "DM author..." :handler (partial dm-author event))
(action :name "Zap author..." :handler (partial zaps/zap-author event))
])]
(.show p (to-widget e) (.x (.getPoint e)) (.y (.getPoint e))))))