Option to enable emoji reaction notifications

main
Bob Mottram 2021-11-10 19:33:28 +00:00
parent 6b86c83db0
commit c7d0f66893
21 changed files with 80 additions and 23 deletions

View File

@ -5708,6 +5708,32 @@ class PubServer(BaseHTTPRequestHandler):
notifyLikesFilename)
pass
notifyReactionsFilename = \
acctDir(baseDir, nickname, domain) + \
'/.notifyReactions'
if onFinalWelcomeScreen:
# default setting from welcome screen
with open(notifyReactionsFilename, 'w+') as rFile:
rFile.write('\n')
actorChanged = True
else:
notifyReactionsActive = False
if fields.get('notifyReactions'):
if fields['notifyReactions'] == 'on':
notifyReactionsActive = True
with open(notifyReactionsFilename,
'w+') as rFile:
rFile.write('\n')
if not notifyReactionsActive:
if os.path.isfile(notifyReactionsFilename):
try:
os.remove(notifyReactionsFilename)
except BaseException:
print('EX: _profileUpdate ' +
'unable to delete ' +
notifyReactionsFilename)
pass
# this account is a bot
if fields.get('isBot'):
if fields['isBot'] == 'on':

View File

@ -2460,7 +2460,7 @@ def _reactionNotify(baseDir: str, domain: str, onionDomain: str,
accountDir = baseDir + '/accounts/' + handle
# are reaction notifications enabled?
notifyReactionEnabledFilename = accountDir + '/.notifyReaction'
notifyReactionEnabledFilename = accountDir + '/.notifyReactions'
if not os.path.isfile(notifyReactionEnabledFilename):
return
@ -2479,8 +2479,8 @@ def _reactionNotify(baseDir: str, domain: str, onionDomain: str,
reactionHandle = actor
if reactionHandle != handle:
reactionStr = \
reactionHandle + ' ' + url + '?reactionBy=' + actor + \
';emoji=' + emojiContent
reactionHandle + ' ' + url + '?reactBy=' + actor + \
';emoj=' + emojiContent
prevReactionFile = accountDir + '/.prevReaction'
# was there a previous reaction notification?
if os.path.isfile(prevReactionFile):

View File

@ -635,6 +635,13 @@ def createPerson(baseDir: str, nickname: str, domain: str, port: int,
with open(notifyLikesFilename, 'w+') as nFile:
nFile.write('\n')
# notify when posts have emoji reactions
if nickname != 'news':
notifyReactionsFilename = \
acctDir(baseDir, nickname, domain) + '/.notifyReactions'
with open(notifyReactionsFilename, 'w+') as nFile:
nFile.write('\n')
theme = getConfigParam(baseDir, 'theme')
if not theme:
theme = 'default'

View File

@ -493,5 +493,6 @@
"Known Web Crawlers": "برامج زحف الويب المعروفة",
"Add to the calendar": "أضف إلى التقويم",
"Content License": "ترخيص المحتوى",
"Reaction by": "رد فعل"
"Reaction by": "رد فعل",
"Notify on emoji reactions": "يخطر على ردود الفعل الرموز التعبيرية"
}

View File

@ -493,5 +493,6 @@
"Known Web Crawlers": "Exploradors web coneguts",
"Add to the calendar": "Afegeix al calendari",
"Content License": "Llicència de contingut",
"Reaction by": "Reacció de"
"Reaction by": "Reacció de",
"Notify on emoji reactions": "Notificar sobre les reaccions dels emojis"
}

View File

@ -493,5 +493,6 @@
"Known Web Crawlers": "Crawlers Gwe Hysbys",
"Add to the calendar": "Ychwanegwch at y calendr",
"Content License": "Trwydded Cynnwys",
"Reaction by": "Ymateb gan"
"Reaction by": "Ymateb gan",
"Notify on emoji reactions": "Hysbysu ar ymatebion emoji"
}

View File

@ -493,5 +493,6 @@
"Known Web Crawlers": "Bekannte Web-Crawler",
"Add to the calendar": "Zum Kalender hinzufügen",
"Content License": "Inhaltslizenz",
"Reaction by": "Reaktion von"
"Reaction by": "Reaktion von",
"Notify on emoji reactions": "Bei Emoji-Reaktionen benachrichtigen"
}

View File

@ -493,5 +493,6 @@
"Known Web Crawlers": "Known Web Crawlers",
"Add to the calendar": "Add to the calendar",
"Content License": "Content License",
"Reaction by": "Reaction by"
"Reaction by": "Reaction by",
"Notify on emoji reactions": "Notify on emoji reactions"
}

View File

@ -493,5 +493,6 @@
"Known Web Crawlers": "Rastreadores web conocidos",
"Add to the calendar": "Agregar al calendario",
"Content License": "Licencia de contenido",
"Reaction by": "Reacción de"
"Reaction by": "Reacción de",
"Notify on emoji reactions": "Notificar sobre reacciones emoji"
}

View File

@ -493,5 +493,6 @@
"Known Web Crawlers": "Crawlers Web connus",
"Add to the calendar": "Ajouter au calendrier",
"Content License": "Licence de contenu",
"Reaction by": "Réaction par"
"Reaction by": "Réaction par",
"Notify on emoji reactions": "Avertir sur les réactions emoji"
}

View File

@ -493,5 +493,6 @@
"Known Web Crawlers": "Crawlers Gréasáin Aitheanta",
"Add to the calendar": "Cuir leis an bhféilire",
"Content License": "Ceadúnas Ábhar",
"Reaction by": "Imoibriú le"
"Reaction by": "Imoibriú le",
"Notify on emoji reactions": "Fógra a thabhairt faoi imoibrithe emoji"
}

View File

@ -493,5 +493,6 @@
"Known Web Crawlers": "ज्ञात वेब क्रॉलर",
"Add to the calendar": "कैलेंडर में जोड़ें",
"Content License": "सामग्री लाइसेंस",
"Reaction by": "द्वारा प्रतिक्रिया"
"Reaction by": "द्वारा प्रतिक्रिया",
"Notify on emoji reactions": "इमोजी प्रतिक्रियाओं पर सूचित करें"
}

View File

@ -493,5 +493,6 @@
"Known Web Crawlers": "Crawler Web conosciuti",
"Add to the calendar": "Aggiungi al calendario",
"Content License": "Licenza sui contenuti",
"Reaction by": "Reazione di"
"Reaction by": "Reazione di",
"Notify on emoji reactions": "Notifica sulle reazioni emoji"
}

View File

@ -493,5 +493,6 @@
"Known Web Crawlers": "既知のWebクローラー",
"Add to the calendar": "カレンダーに追加",
"Content License": "コンテンツライセンス",
"Reaction by": "による反応"
"Reaction by": "による反応",
"Notify on emoji reactions": "絵文字の反応を通知する"
}

View File

@ -493,5 +493,6 @@
"Known Web Crawlers": "Crawlerên Webê yên naskirî",
"Add to the calendar": "Di salnameyê de zêde bike",
"Content License": "Naverok License de",
"Reaction by": "Reaction by"
"Reaction by": "Reaction by",
"Notify on emoji reactions": "Li ser reaksiyonên emoji agahdar bikin"
}

View File

@ -489,5 +489,6 @@
"Known Web Crawlers": "Known Web Crawlers",
"Add to the calendar": "Add to the calendar",
"Content License": "Content License",
"Reaction by": "Reaction by"
"Reaction by": "Reaction by",
"Notify on emoji reactions": "Notify on emoji reactions"
}

View File

@ -493,5 +493,6 @@
"Known Web Crawlers": "Rastreadores da Web conhecidos",
"Add to the calendar": "Adicionar ao calendário",
"Content License": "Licença de Conteúdo",
"Reaction by": "Reazione di"
"Reaction by": "Reazione di",
"Notify on emoji reactions": "Notificar sobre reações de emoji"
}

View File

@ -493,5 +493,6 @@
"Known Web Crawlers": "Известные веб-сканеры",
"Add to the calendar": "Добавить в календарь",
"Content License": "Лицензия на содержание",
"Reaction by": "Реакция со стороны"
"Reaction by": "Реакция со стороны",
"Notify on emoji reactions": "Уведомлять о реакции на смайлики"
}

View File

@ -493,5 +493,6 @@
"Known Web Crawlers": "Watambaji Wavuti Wanaojulikana",
"Add to the calendar": "Ongeza kwenye kalenda",
"Content License": "Leseni ya Maudhui",
"Reaction by": "Majibu kwa"
"Reaction by": "Majibu kwa",
"Notify on emoji reactions": "Arifu kuhusu maitikio ya emoji"
}

View File

@ -493,5 +493,6 @@
"Known Web Crawlers": "已知的网络爬虫",
"Add to the calendar": "添加到日历",
"Content License": "内容许可",
"Reaction by": "反应由"
"Reaction by": "反应由",
"Notify on emoji reactions": "通知表情符号反应"
}

View File

@ -1867,7 +1867,8 @@ def _htmlEditProfileOptions(isAdmin: bool,
manuallyApprovesFollowers: str,
isBot: str, isGroup: str,
followDMs: str, removeTwitter: str,
notifyLikes: str, hideLikeButton: str,
notifyLikes: str, notifyReactions: str,
hideLikeButton: str,
translate: {}) -> str:
"""option checkboxes section of edit profile screen
"""
@ -1891,6 +1892,9 @@ def _htmlEditProfileOptions(isAdmin: bool,
editProfileForm += \
editCheckBox(translate['Notify when posts are liked'],
'notifyLikes', notifyLikes)
editProfileForm += \
editCheckBox(translate['Notify on emoji reactions'],
'notifyReactions', notifyReactions)
editProfileForm += \
editCheckBox(translate["Don't show the Like button"],
'hideLikeButton', hideLikeButton)
@ -2048,7 +2052,7 @@ def htmlEditProfile(cssCache: {}, translate: {}, baseDir: str, path: str,
displayNickname = nickname
isBot = isGroup = followDMs = removeTwitter = ''
notifyLikes = hideLikeButton = mediaInstanceStr = ''
notifyLikes = notifyReactions = hideLikeButton = mediaInstanceStr = ''
blogsInstanceStr = newsInstanceStr = movedTo = twitterStr = ''
bioStr = donateUrl = websiteUrl = emailAddress = PGPpubKey = ''
PGPfingerprint = xmppAddress = matrixAddress = ''
@ -2099,6 +2103,8 @@ def htmlEditProfile(cssCache: {}, translate: {}, baseDir: str, path: str,
removeTwitter = 'checked'
if os.path.isfile(accountDir + '/.notifyLikes'):
notifyLikes = 'checked'
if os.path.isfile(accountDir + '/.notifyReactions'):
notifyReactions = 'checked'
if os.path.isfile(accountDir + '/.hideLikeButton'):
hideLikeButton = 'checked'
@ -2196,7 +2202,8 @@ def htmlEditProfile(cssCache: {}, translate: {}, baseDir: str, path: str,
editProfileForm += \
_htmlEditProfileOptions(isAdmin, manuallyApprovesFollowers,
isBot, isGroup, followDMs, removeTwitter,
notifyLikes, hideLikeButton, translate)
notifyLikes, notifyReactions,
hideLikeButton, translate)
# Contact information
editProfileForm += \