mirror of https://git.lenooby09.tech/LeNooby09/social-app.git
1import {AppBskyActorDefs} from '@atproto/api' 2 3export function canBeMessaged(profile: AppBskyActorDefs.ProfileView) { 4 switch (profile.associated?.chat?.allowIncoming) { 5 case 'none': 6 return false 7 case 'all': 8 return true 9 // if unset, treat as following 10 case 'following': 11 case undefined: 12 return Boolean(profile.viewer?.followedBy) 13 // any other values are invalid according to the lexicon, so 14 // let's treat as false to be safe 15 default: 16 return false 17 } 18}