Râu Cao c53d9d3c60
All checks were successful
continuous-integration/drone/push Build is passing
WIP Sync Mastodon IDs/profiles to local accounts
2025-05-17 16:46:43 +04:00

15 lines
392 B
Ruby

module MastodonManager
class FindUser < MastodonManagerService
def initialize(username:)
@username = username
end
def call
users = get "v2/admin/accounts?username=#{@username}&origin=local"
users = users.map { |u| u.with_indifferent_access }
# Results may contain partial matches
users.find { |u| u.dig(:username) == @username }
end
end
end