diff --git a/tests.py b/tests.py
index fe0a63615..dd5babc0a 100644
--- a/tests.py
+++ b/tests.py
@@ -42,6 +42,7 @@ from follow import clearFollowers
 from follow import sendFollowRequestViaServer
 from follow import sendUnfollowRequestViaServer
 from siteactive import siteIsActive
+from utils import canReplyTo
 from utils import isGroupAccount
 from utils import getActorLanguagesList
 from utils import getCategoryTypes
@@ -5447,12 +5448,72 @@ def _translateOntology() -> None:
         saveJson(ontologyJson, filename + '.new')
 
 
+def _testCanReplyTo() -> None:
+    print('testCanReplyTo')
+    baseDir = os.getcwd()
+    systemLanguage = 'en'
+    nickname = 'test27637'
+    domain = 'rando.site'
+    port = 443
+    httpPrefix = 'https'
+    content = 'This is a test post with links.\n\n' + \
+        'ftp://ftp.ncdc.noaa.gov/pub/data/ghcn/v4/\n\nhttps://freedombone.net'
+    followersOnly = False
+    saveToFile = False
+    clientToServer = False
+    commentsEnabled = True
+    attachImageFilename = None
+    mediaType = None
+    imageDescription = None
+    city = 'London, England'
+    testInReplyTo = None
+    testInReplyToAtomUri = None
+    testSubject = None
+    testSchedulePost = False
+    testEventDate = None
+    testEventTime = None
+    testLocation = None
+    testIsArticle = False
+    conversationId = None
+    lowBandwidth = True
+
+    postJsonObject = \
+        createPublicPost(baseDir, nickname, domain, port, httpPrefix,
+                         content, followersOnly, saveToFile,
+                         clientToServer, commentsEnabled,
+                         attachImageFilename, mediaType,
+                         imageDescription, city,
+                         testInReplyTo, testInReplyToAtomUri,
+                         testSubject, testSchedulePost,
+                         testEventDate, testEventTime, testLocation,
+                         testIsArticle, systemLanguage, conversationId,
+                         lowBandwidth)
+    # set the date on the post
+    currDateStr = "2021-09-08T20:45:00Z"
+    postJsonObject['published'] = currDateStr
+    postJsonObject['object']['published'] = currDateStr
+
+    postUrl = postJsonObject['object']['id']
+    replyIntervalHours = 2
+    currDateStr = "2021-09-08T21:32:10Z"
+    assert canReplyTo(baseDir, nickname, domain,
+                      postUrl, replyIntervalHours,
+                      currDateStr,
+                      postJsonObject)
+    currDateStr = "2021-09-09T09:24:47Z"
+    assert not canReplyTo(baseDir, nickname, domain,
+                          postUrl, replyIntervalHours,
+                          currDateStr,
+                          postJsonObject)
+
+
 def runAllTests():
     print('Running tests...')
     updateDefaultThemesList(os.getcwd())
     _translateOntology()
     _testGetPriceFromString()
     _testFunctions()
+    _testCanReplyTo()
     _testDateConversions()
     _testAuthorizeSharedItems()
     _testValidPassword()
diff --git a/utils.py b/utils.py
index 6d85e6955..fc6ebedc1 100644
--- a/utils.py
+++ b/utils.py
@@ -1369,15 +1369,17 @@ def setReplyIntervalHours(baseDir: str, nickname: str, domain: str,
 
 def canReplyTo(baseDir: str, nickname: str, domain: str,
                postUrl: str, replyIntervalHours: int,
-               currDateStr: str = None) -> bool:
+               currDateStr: str = None,
+               postJsonObject: {} = None) -> bool:
     """Is replying to the given post permitted?
     This is a spam mitigation feature, so that spammers can't
     add a lot of replies to old post which you don't notice.
     """
-    postFilename = locatePost(baseDir, nickname, domain, postUrl)
-    if not postFilename:
-        return False
-    postJsonObject = loadJson(postFilename)
+    if not postJsonObject:
+        postFilename = locatePost(baseDir, nickname, domain, postUrl)
+        if not postFilename:
+            return False
+        postJsonObject = loadJson(postFilename)
     if not postJsonObject:
         return False
     published = _getPublishedDate(postJsonObject)