diff --git a/posts.py b/posts.py index 115cbf34..01d8b9fd 100644 --- a/posts.py +++ b/posts.py @@ -898,16 +898,6 @@ def createPostBase(baseDir: str, nickname: str, domain: str, port: int, if eventUUID: postObjectType = 'Event' - # public posts with mentions should include the mentioned - # actors within CC - # "I think we don’t notify about mentions unless the person - # is also addressed in to/cc" -- gargron - if toRecipients and toCC and mentionedRecipients: - if len(toRecipients) == 1 and len(toCC) == 1: - if toRecipients[0].endswith('#Public') and \ - toCC[0].endswith('/followers'): - toCC += mentionedRecipients - if not clientToServer: actorUrl = httpPrefix + '://' + domain + '/users/' + nickname diff --git a/tests.py b/tests.py index 05cbd5b4..a1befe72 100644 --- a/tests.py +++ b/tests.py @@ -20,6 +20,7 @@ from cache import getPersonFromCache from threads import threadWithTrace from daemon import runDaemon from session import createSession +from posts import getMentionedPeople from posts import validContentWarning from posts import deleteAllPosts from posts import createPublicPost @@ -2479,8 +2480,23 @@ def testGuessHashtagCategory() -> None: assert guess == "bar" +def testGetMentionedPeople() -> None: + print('testGetMentionedPeople') + baseDir = os.getcwd() + + content = "@dragon@cave.site @bat@cave.site This is a test." + actors = getMentionedPeople(baseDir, 'https', + content, + 'mydomain', False) + assert actors + assert len(actors) == 2 + assert actors[0] == "https://cave.site/users/dragon" + assert actors[1] == "https://cave.site/users/bat" + + def runAllTests(): print('Running tests...') + testGetMentionedPeople() testGuessHashtagCategory() testValidNickname() testParseFeedDate()