diff --git a/damus/Models/ProfileModel.swift b/damus/Models/ProfileModel.swift index c463fe98..b743b97b 100644 --- a/damus/Models/ProfileModel.swift +++ b/damus/Models/ProfileModel.swift @@ -20,6 +20,24 @@ class ProfileModel: ObservableObject, Equatable { var sub_id = UUID().description var prof_subid = UUID().description + func follows(pubkey: String) -> Bool { + guard let contacts = self.contacts else { + return false + } + + for tag in contacts.tags { + guard tag.count >= 2 && tag[0] == "p" else { + continue + } + + if tag[1] == pubkey { + return true + } + } + + return false + } + func get_follow_target() -> FollowTarget { if let contacts = contacts { return .contact(contacts)