main
Bob Mottram 2021-07-07 10:52:05 +01:00
parent 7b6c939b92
commit f294fbd356
1 changed files with 5 additions and 4 deletions

View File

@ -2413,6 +2413,7 @@ def _inboxAfterInitial(recentPostsCache: {}, maxRecentPosts: int,
postJsonObject = messageJson postJsonObject = messageJson
nickname = handle.split('@')[0] nickname = handle.split('@')[0]
jsonObj = None
if _validPostContent(baseDir, nickname, domain, if _validPostContent(baseDir, nickname, domain,
postJsonObject, maxMentions, maxEmoji, postJsonObject, maxMentions, maxEmoji,
allowLocalNetworkAccess, debug): allowLocalNetworkAccess, debug):
@ -2535,16 +2536,16 @@ def _inboxAfterInitial(recentPostsCache: {}, maxRecentPosts: int,
# should we notify that a post from this person has arrived? # should we notify that a post from this person has arrived?
# This is for cases where the notify checkbox is enabled # This is for cases where the notify checkbox is enabled
# on the person options screen # on the person options screen
if not postIsDM and hasObjectDict(postJsonObject): if not postIsDM and jsonObj:
if postJsonObject['object'].get('attributedTo'): if jsonObj.get('attributedTo') and jsonObj.get('id'):
attributedTo = postJsonObject['object']['attributedTo'] attributedTo = jsonObj['attributedTo']
if isinstance(attributedTo, str): if isinstance(attributedTo, str):
fromNickname = getNicknameFromActor(attributedTo) fromNickname = getNicknameFromActor(attributedTo)
fromDomain, fromPort = getDomainFromActor(attributedTo) fromDomain, fromPort = getDomainFromActor(attributedTo)
fromDomainFull = getFullDomain(fromDomain, fromPort) fromDomainFull = getFullDomain(fromDomain, fromPort)
if notifyWhenPersonPosts(baseDir, nickname, domain, if notifyWhenPersonPosts(baseDir, nickname, domain,
fromNickname, fromDomainFull): fromNickname, fromDomainFull):
postId = removeIdEnding(postJsonObject['id']) postId = removeIdEnding(jsonObj['id'])
_notifyPostArrival(baseDir, handle, postId) _notifyPostArrival(baseDir, handle, postId)
# If this is a reply to a muted post then also mute it. # If this is a reply to a muted post then also mute it.