Don't give notifications for mentions & replies to self ()

Dont give notifciations for metnions & replies to self
This commit is contained in:
Daniel Holmgren 2022-11-17 15:22:14 -06:00 committed by GitHub
parent 227b85608e
commit 53d8209c9c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -69,29 +69,33 @@ const eventsForInsert = (obj: IndexedPost): Message[] => {
const notifs: Message[] = []
for (const entity of obj.entities || []) {
if (entity.type === 'mention') {
notifs.push(
messages.createNotification({
userDid: entity.value,
author: obj.post.creator,
recordUri: obj.post.uri,
recordCid: obj.post.cid,
reason: 'mention',
}),
)
if (entity.value !== obj.post.creator) {
notifs.push(
messages.createNotification({
userDid: entity.value,
author: obj.post.creator,
recordUri: obj.post.uri,
recordCid: obj.post.cid,
reason: 'mention',
}),
)
}
}
}
if (obj.post.replyParent) {
const parentUri = new AtUri(obj.post.replyParent)
notifs.push(
messages.createNotification({
userDid: parentUri.host,
author: obj.post.creator,
recordUri: obj.post.uri,
recordCid: obj.post.cid,
reason: 'reply',
reasonSubject: parentUri.toString(),
}),
)
if (parentUri.host !== obj.post.creator) {
notifs.push(
messages.createNotification({
userDid: parentUri.host,
author: obj.post.creator,
recordUri: obj.post.uri,
recordCid: obj.post.cid,
reason: 'reply',
reasonSubject: parentUri.toString(),
}),
)
}
}
return notifs
}