main
Bob Mottram 2021-07-06 22:53:55 +01:00
parent 71c2794a19
commit 6a73192c24
3 changed files with 7 additions and 7 deletions

View File

@ -2526,8 +2526,8 @@ def _inboxAfterInitial(recentPostsCache: {}, maxRecentPosts: int,
# save the post to file # save the post to file
if saveJson(postJsonObject, destinationFilename): if saveJson(postJsonObject, destinationFilename):
# should we notify that a post from this person has arrived?
if not postIsDM: if not postIsDM:
# should we notify that a post from this person has arrived?
handleNickname = handle.split('@')[0] handleNickname = handle.split('@')[0]
handleDomain = handle.split('@')[1] handleDomain = handle.split('@')[1]
if notifyWhenPersonPosts(baseDir, nickname, domain, if notifyWhenPersonPosts(baseDir, nickname, domain,

View File

@ -94,8 +94,8 @@ def notifyWhenPersonPosts(baseDir: str, nickname: str, domain: str,
""" """
if followingNickname == nickname and followingDomain == domain: if followingNickname == nickname and followingDomain == domain:
return False return False
notifyOnPostFilename = baseDir + '/accounts/' + \ notifyOnPostFilename = \
nickname + '@' + domain + '/notifyOnPost.txt' baseDir + '/accounts/' + nickname + '@' + domain + '/notifyOnPost.txt'
handle = followingNickname + '@' + followingDomain handle = followingNickname + '@' + followingDomain
if not os.path.isfile(notifyOnPostFilename): if not os.path.isfile(notifyOnPostFilename):
# create a new notifyOnPost file # create a new notifyOnPost file

View File

@ -219,12 +219,12 @@ function notifications {
epicyonNotifyFile="$epicyonDir/.newNotifiedPost" epicyonNotifyFile="$epicyonDir/.newNotifiedPost"
if [ -f "$epicyonNotifyFile" ]; then if [ -f "$epicyonNotifyFile" ]; then
if ! grep -q "##sent##" "$epicyonNotifyFile"; then if ! grep -q "##sent##" "$epicyonNotifyFile"; then
epicyonReplyMessage=$(notification_translate_text 'New post') epicyonNotifyMessage=$(notification_translate_text 'New post')
epicyonNotifyFileContent=$(echo "$epicyonReplyMessage")" "$(cat "$epicyonNotifyFile") epicyonNotifyFileContent=$(echo "$epicyonNotifyMessage")" "$(cat "$epicyonNotifyFile")
if [[ "$epicyonNotifyFileContent" == *':'* ]]; then if [[ "$epicyonNotifyFileContent" == *':'* ]]; then
epicyonReplyMessage="Epicyon: $epicyonNotifyFileContent" epicyonNotifyMessage="Epicyon: $epicyonNotifyFileContent"
fi fi
sendNotification "$USERNAME" "Epicyon" "$epicyonReplyMessage" sendNotification "$USERNAME" "Epicyon" "$epicyonNotifyMessage"
echo "##sent##" > "$epicyonNotifyFile" echo "##sent##" > "$epicyonNotifyFile"
chown ${PROJECT_NAME}:${PROJECT_NAME} "$epicyonNotifyFile" chown ${PROJECT_NAME}:${PROJECT_NAME} "$epicyonNotifyFile"
fi fi