mirror of https://gitlab.com/bashrc2/epicyon
Match shared inbox to followers on inbox requests
parent
b2ecda1b2a
commit
f6a71b9f35
17
posts.py
17
posts.py
|
@ -838,12 +838,23 @@ def createBoxBase(baseDir: str,boxname: str, \
|
||||||
|
|
||||||
# combine the inbox for the account with the shared inbox
|
# combine the inbox for the account with the shared inbox
|
||||||
if sharedBoxDir:
|
if sharedBoxDir:
|
||||||
|
handle=nickname+'@'+domain
|
||||||
|
followingFilename=baseDir+'/accounts/'+handle+'/following.txt'
|
||||||
postsInSharedInbox=os.listdir(sharedBoxDir)
|
postsInSharedInbox=os.listdir(sharedBoxDir)
|
||||||
for postFilename in postsInSharedInbox:
|
for postFilename in postsInSharedInbox:
|
||||||
statusNumber=getStatusNumberFromPostFilename(postFilename)
|
statusNumber=getStatusNumberFromPostFilename(postFilename)
|
||||||
if statusNumber:
|
if statusNumber:
|
||||||
postsInBoxDict[statusNumber]=os.path.join(sharedBoxDir, postFilename)
|
sharedInboxFilename=os.path.join(sharedBoxDir, postFilename)
|
||||||
postsCtr+=1
|
# get the actor from the shared post
|
||||||
|
with open(sharedInboxFilename, 'r') as fp:
|
||||||
|
postJson=commentjson.load(fp)
|
||||||
|
actorNickname=getNicknameFromActor(postJson['actor'])
|
||||||
|
actorDomain,actorPort=getDomainFromActor(postJson['actor'])
|
||||||
|
if actorNickname and actorDomain:
|
||||||
|
# is the actor followed by this account?
|
||||||
|
if actorNickname+'@'+actorDomain in open(followingFilename).read():
|
||||||
|
postsInBoxDict[statusNumber]=sharedInboxFilename
|
||||||
|
postsCtr+=1
|
||||||
|
|
||||||
# sort the list in descending order of date
|
# sort the list in descending order of date
|
||||||
postsInBox=OrderedDict(sorted(postsInBoxDict.items(),reverse=True))
|
postsInBox=OrderedDict(sorted(postsInBoxDict.items(),reverse=True))
|
||||||
|
|
Loading…
Reference in New Issue