WIP Refactor stuff
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2024-10-18 18:15:52 +02:00
parent 04a9061663
commit 79ef9fa6d5
7 changed files with 97 additions and 88 deletions

View File

@@ -136,10 +136,11 @@ class SettingsController < ApplicationController
def fetch_nostr_user_metadata
if @user.nostr_pubkey.present?
if @nip65_event = NostrManager::DiscoverUserRelays.call(pubkey: @user.nostr_pubkey)
@relay_urls = @nip65_event["tags"].select{ |t| t[0] == "r" }&.map{ |t| t[1] }
relay_tags = @nip65_event["tags"].select{ |t| t[0] == "r" }
outbox_relay_urls = relay_tags&.select{ |t| t[2] != "read" }&.map{ |t| t[1] }
end
@profile = NostrManager::DiscoverUserProfile.call(pubkey: @user.nostr_pubkey, relays: @relay_urls)
@profile = NostrManager::DiscoverUserProfile.call(pubkey: @user.nostr_pubkey, relays: outbox_relay_urls)
else
@relays, @profile = [nil, nil]
end