diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/send/ChannelNewMessageViewModel.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/send/ChannelNewMessageViewModel.kt index 53c7546bdb..a4e1818b7d 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/send/ChannelNewMessageViewModel.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/send/ChannelNewMessageViewModel.kt @@ -94,6 +94,7 @@ import com.vitorpamplona.quartz.nip01Core.tags.geohash.geohash import com.vitorpamplona.quartz.nip01Core.tags.geohash.getGeoHash import com.vitorpamplona.quartz.nip01Core.tags.hashtags.hashtags import com.vitorpamplona.quartz.nip01Core.tags.people.pTag +import com.vitorpamplona.quartz.nip01Core.tags.people.pTags import com.vitorpamplona.quartz.nip01Core.tags.people.toPTag import com.vitorpamplona.quartz.nip01Core.tags.references.references import com.vitorpamplona.quartz.nip10Notes.content.findHashtags @@ -102,6 +103,7 @@ import com.vitorpamplona.quartz.nip10Notes.content.findURLs import com.vitorpamplona.quartz.nip13Pow.miner.PoWMiner import com.vitorpamplona.quartz.nip18Reposts.quotes.quotes import com.vitorpamplona.quartz.nip22Comments.CommentEvent +import com.vitorpamplona.quartz.nip22Comments.notify import com.vitorpamplona.quartz.nip28PublicChat.base.notify import com.vitorpamplona.quartz.nip28PublicChat.message.ChannelMessageEvent import com.vitorpamplona.quartz.nip29RelayGroups.hTag @@ -622,6 +624,14 @@ open class ChannelNewMessageViewModel : hTag(channel.groupId.id) previous(channel.previousEventRefs(account.userProfile().pubkeyHex)) } + // `p` mentions for everyone else cited in the body — replyBuilder already tags the + // parent/root author, so exclude the parent to avoid a duplicate `p`. + notify( + tagger.pTags + ?.filter { it.pubkeyHex != minichatParent.pubKey } + ?.map { it.toPTag() } + .orEmpty(), + ) hashtags(findHashtags(tagger.message)) references(findURLs(tagger.message)) quotes(findNostrUris(tagger.message)) @@ -843,6 +853,14 @@ open class ChannelNewMessageViewModel : hTag(channel.groupId.id) previous(channel.previousEventRefs(account.userProfile().pubkeyHex)) pTag(replyingToEvent.toPTag()) + // `p` mentions for everyone else cited in the body (the parent author is + // already tagged above with its relay hint) so a named member is notified. + pTags( + tagger.pTags + ?.filter { it.pubkeyHex != replyingToEvent.event.pubKey } + ?.map { it.toPTag() } + .orEmpty(), + ) hashtags(findHashtags(tagger.message)) references(findURLs(tagger.message)) @@ -857,6 +875,8 @@ open class ChannelNewMessageViewModel : ChatEvent.build(tagger.message) { hTag(channel.groupId.id) previous(channel.previousEventRefs(account.userProfile().pubkeyHex)) + // `p` mentions for everyone cited in the body so a named member is notified. + pTags(tagger.pTags?.map { it.toPTag() }.orEmpty()) hashtags(findHashtags(tagger.message)) references(findURLs(tagger.message)) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/home/ShortNotePostViewModel.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/home/ShortNotePostViewModel.kt index e2d1fd6afb..304249f1a3 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/home/ShortNotePostViewModel.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/home/ShortNotePostViewModel.kt @@ -1265,6 +1265,9 @@ open class ShortNotePostViewModel : // authorizes the write. ThreadEvent.build(tagger.message, subjectValue) { hTag(threadTarget.groupId) + // `p` mentions for everyone cited in the body, so a named member is notified and the + // `nostr:` reference resolves — matching the Poll/ZapPoll branches below. + pTags(tagger.directMentionsUsers.map { it.toPTag() }) hashtags(findHashtags(tagger.message)) references(findURLs(tagger.message))