Click on name in user window will request contact info.

This commit is contained in:
Robert C. Martin 2023-04-29 10:50:29 -05:00
parent 0868aefa4d
commit d595f3180e
3 changed files with 18 additions and 19 deletions

View File

@ -44,7 +44,7 @@
(let [latest-old-message-time
(if (not (config/is-test-run?))
(data-storage/load-event-history handler)
(-> (util/get-now) (- 86400)))
(-> (util/get-now) (- 7200)))
latest-old-message-time
(if (some? (get-mem :request-hours-ago))
(- (util/get-now) (* 3600 (get-mem :request-hours-ago)))

View File

@ -43,8 +43,9 @@
hexified-authors
(map #(subs % 0 10) (take 1000 (shuffle hexified-authors))))
r (rand-int 1000000)
request ["REQ" (str "ms-request-" r) {"kinds" [0 3]
"authors" trimmed-authors}]]
request ["REQ" (str "ms-request-" r)
{"kinds" [0 3]
"authors" trimmed-authors}]]
(send-request request)
))

View File

@ -80,8 +80,8 @@
(let [selected-listbox (select frame [:#selected-users])
trusted-listbox (select frame [:#trusted-users-listbox])
selected-group (get-mem [:user-window :selection-group])]
(config! selected-listbox :model (get-mem [:user-window selected-group]))
(config! trusted-listbox :model (get-mem [:user-window :trusted-user-items]))))
(config! selected-listbox :model (get-mem [:user-window selected-group]))
(config! trusted-listbox :model (get-mem [:user-window :trusted-user-items]))))
(defn select-recent-users [frame _e]
(set-mem [:user-window :selection-group] :recent-user-items)
@ -164,20 +164,18 @@
(set-mem [:user-window :contact-list-changed] true))))))
(defn listbox-click [listbox e]
(when (.isPopupTrigger e)
(let [index (.locationToIndex listbox (Point. (.getX e) (.getY e)))
model (.getModel listbox)
item (.getElementAt model index)
user-id (second item)
tab-names (vec (remove #(= "all" %) (map :name (get-mem :tabs-list))))
tab-names (conj tab-names "<new-tab>")
add-author-actions (map #(action :name % :handler (partial tabs/add-author-to-tab user-id %)) tab-names)
p (popup :items [(action :name "Get Info..." :handler (fn [_e] (article-panel/show-user-profile user-id)))
(menu :text "Add author to tab" :items add-author-actions)])]
(.show p (to-widget e) (.x (.getPoint e)) (.y (.getPoint e))))
)
)
(let [index (.locationToIndex listbox (Point. (.getX e) (.getY e)))
model (.getModel listbox)
item (.getElementAt model index)
user-id (second item)
tab-names (vec (remove #(= "all" %) (map :name (get-mem :tabs-list))))
tab-names (conj tab-names "<new-tab>")
add-author-actions (map #(action :name % :handler (partial tabs/add-author-to-tab user-id %)) tab-names)]
(protocol/request-profiles-and-contacts-for user-id)
(when (.isPopupTrigger e)
(let [p (popup :items [(action :name "Get Info..." :handler (fn [_e] (article-panel/show-user-profile user-id)))
(menu :text "Add author to tab" :items add-author-actions)])]
(.show p (to-widget e) (.x (.getPoint e)) (.y (.getPoint e)))))))
(defn- repaint-user-window [frame]
(.repaint frame))