mirror of
https://github.com/unclebob/more-speech.git
synced 2024-09-30 10:30:56 +00:00
Request metadata and contacts from authors when you click on their articles.
This commit is contained in:
parent
8e949d0d0b
commit
4fffab9efd
@ -18,6 +18,14 @@
|
|||||||
date (Date. (long time))]
|
date (Date. (long time))]
|
||||||
(.format (SimpleDateFormat. "MM/dd/yyyy kk:mm:ss z") date)))
|
(.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]
|
(defn request-contact-lists [relay]
|
||||||
(let [now (quot (System/currentTimeMillis) 1000)
|
(let [now (quot (System/currentTimeMillis) 1000)
|
||||||
days-ago config/read-contact-lists-days-ago
|
days-ago config/read-contact-lists-days-ago
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
[more-speech.mem :refer :all]
|
[more-speech.mem :refer :all]
|
||||||
[more-speech.nostr.event-composers :as composers]
|
[more-speech.nostr.event-composers :as composers]
|
||||||
[more-speech.nostr.events :as events]
|
[more-speech.nostr.events :as events]
|
||||||
|
[more-speech.nostr.protocol :as protocol]
|
||||||
[more-speech.nostr.util :as util]
|
[more-speech.nostr.util :as util]
|
||||||
[more-speech.nostr.zaps :as zaps]
|
[more-speech.nostr.zaps :as zaps]
|
||||||
[more-speech.ui.formatter-util :as formatter-util]
|
[more-speech.ui.formatter-util :as formatter-util]
|
||||||
@ -243,6 +244,7 @@
|
|||||||
relay-names (map #(re-find config/relay-pattern %) (:relays event))
|
relay-names (map #(re-find config/relay-pattern %) (:relays event))
|
||||||
event-id (select main-frame [:#id-label])
|
event-id (select main-frame [:#id-label])
|
||||||
author-name-label (select main-frame [:#author-name-label])]
|
author-name-label (select main-frame [:#author-name-label])]
|
||||||
|
(protocol/request-metadata-and-contacts-for-user (:pubkey event))
|
||||||
(text! reactions-label (str reactions))
|
(text! reactions-label (str reactions))
|
||||||
(if reacted?
|
(if reacted?
|
||||||
(do
|
(do
|
||||||
|
@ -1,15 +1,16 @@
|
|||||||
(ns more-speech.ui.swing.tabs
|
(ns more-speech.ui.swing.tabs
|
||||||
(:require
|
(:require
|
||||||
[clojure.set :as set]
|
[clojure.set :as set]
|
||||||
[more-speech.logger.default :refer [log-pr]]
|
|
||||||
[more-speech.config :as config]
|
[more-speech.config :as config]
|
||||||
[more-speech.config :refer [get-db]]
|
[more-speech.config :refer [get-db]]
|
||||||
[more-speech.db.gateway :as gateway]
|
[more-speech.db.gateway :as gateway]
|
||||||
|
[more-speech.logger.default :refer [log-pr]]
|
||||||
[more-speech.mem :refer :all]
|
[more-speech.mem :refer :all]
|
||||||
[more-speech.nostr.events :as events]
|
[more-speech.nostr.events :as events]
|
||||||
[more-speech.nostr.tab-searcher :as tab-searcher]
|
[more-speech.nostr.tab-searcher :as tab-searcher]
|
||||||
[more-speech.nostr.trust-updater :as trust-updater]
|
[more-speech.nostr.trust-updater :as trust-updater]
|
||||||
[more-speech.nostr.util :as util]
|
[more-speech.nostr.util :as util]
|
||||||
|
[more-speech.nostr.zaps :as zaps]
|
||||||
[more-speech.ui.formatters :as formatters]
|
[more-speech.ui.formatters :as formatters]
|
||||||
[more-speech.ui.swing.article-panel :as article-panel]
|
[more-speech.ui.swing.article-panel :as article-panel]
|
||||||
[more-speech.ui.swing.article-tree-util :as at-util]
|
[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 "Add article to tab" :items add-article-actions)
|
||||||
(menu :text "Block article from tab" :items block-article-actions)
|
(menu :text "Block article from tab" :items block-article-actions)
|
||||||
(action :name "DM author..." :handler (partial dm-author event))
|
(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))))))
|
(.show p (to-widget e) (.x (.getPoint e)) (.y (.getPoint e))))))
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user