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) notifyLikesFilename)
pass 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 # this account is a bot
if fields.get('isBot'): if fields.get('isBot'):
if fields['isBot'] == 'on': if fields['isBot'] == 'on':

View File

@ -2460,7 +2460,7 @@ def _reactionNotify(baseDir: str, domain: str, onionDomain: str,
accountDir = baseDir + '/accounts/' + handle accountDir = baseDir + '/accounts/' + handle
# are reaction notifications enabled? # are reaction notifications enabled?
notifyReactionEnabledFilename = accountDir + '/.notifyReaction' notifyReactionEnabledFilename = accountDir + '/.notifyReactions'
if not os.path.isfile(notifyReactionEnabledFilename): if not os.path.isfile(notifyReactionEnabledFilename):
return return
@ -2479,8 +2479,8 @@ def _reactionNotify(baseDir: str, domain: str, onionDomain: str,
reactionHandle = actor reactionHandle = actor
if reactionHandle != handle: if reactionHandle != handle:
reactionStr = \ reactionStr = \
reactionHandle + ' ' + url + '?reactionBy=' + actor + \ reactionHandle + ' ' + url + '?reactBy=' + actor + \
';emoji=' + emojiContent ';emoj=' + emojiContent
prevReactionFile = accountDir + '/.prevReaction' prevReactionFile = accountDir + '/.prevReaction'
# was there a previous reaction notification? # was there a previous reaction notification?
if os.path.isfile(prevReactionFile): 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: with open(notifyLikesFilename, 'w+') as nFile:
nFile.write('\n') 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') theme = getConfigParam(baseDir, 'theme')
if not theme: if not theme:
theme = 'default' theme = 'default'

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": "رد فعل",
"Notify on emoji reactions": "يخطر على ردود الفعل الرموز التعبيرية"
} }

View File

@ -493,5 +493,6 @@
"Known Web Crawlers": "Exploradors web coneguts", "Known Web Crawlers": "Exploradors web coneguts",
"Add to the calendar": "Afegeix al calendari", "Add to the calendar": "Afegeix al calendari",
"Content License": "Llicència de contingut", "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", "Known Web Crawlers": "Crawlers Gwe Hysbys",
"Add to the calendar": "Ychwanegwch at y calendr", "Add to the calendar": "Ychwanegwch at y calendr",
"Content License": "Trwydded Cynnwys", "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", "Known Web Crawlers": "Bekannte Web-Crawler",
"Add to the calendar": "Zum Kalender hinzufügen", "Add to the calendar": "Zum Kalender hinzufügen",
"Content License": "Inhaltslizenz", "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", "Known Web Crawlers": "Known Web Crawlers",
"Add to the calendar": "Add to the calendar", "Add to the calendar": "Add to the calendar",
"Content License": "Content License", "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", "Known Web Crawlers": "Rastreadores web conocidos",
"Add to the calendar": "Agregar al calendario", "Add to the calendar": "Agregar al calendario",
"Content License": "Licencia de contenido", "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", "Known Web Crawlers": "Crawlers Web connus",
"Add to the calendar": "Ajouter au calendrier", "Add to the calendar": "Ajouter au calendrier",
"Content License": "Licence de contenu", "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", "Known Web Crawlers": "Crawlers Gréasáin Aitheanta",
"Add to the calendar": "Cuir leis an bhféilire", "Add to the calendar": "Cuir leis an bhféilire",
"Content License": "Ceadúnas Ábhar", "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": "ज्ञात वेब क्रॉलर", "Known Web Crawlers": "ज्ञात वेब क्रॉलर",
"Add to the calendar": "कैलेंडर में जोड़ें", "Add to the calendar": "कैलेंडर में जोड़ें",
"Content License": "सामग्री लाइसेंस", "Content License": "सामग्री लाइसेंस",
"Reaction by": "द्वारा प्रतिक्रिया" "Reaction by": "द्वारा प्रतिक्रिया",
"Notify on emoji reactions": "इमोजी प्रतिक्रियाओं पर सूचित करें"
} }

View File

@ -493,5 +493,6 @@
"Known Web Crawlers": "Crawler Web conosciuti", "Known Web Crawlers": "Crawler Web conosciuti",
"Add to the calendar": "Aggiungi al calendario", "Add to the calendar": "Aggiungi al calendario",
"Content License": "Licenza sui contenuti", "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クローラー", "Known Web Crawlers": "既知のWebクローラー",
"Add to the calendar": "カレンダーに追加", "Add to the calendar": "カレンダーに追加",
"Content License": "コンテンツライセンス", "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î", "Known Web Crawlers": "Crawlerên Webê yên naskirî",
"Add to the calendar": "Di salnameyê de zêde bike", "Add to the calendar": "Di salnameyê de zêde bike",
"Content License": "Naverok License de", "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", "Known Web Crawlers": "Known Web Crawlers",
"Add to the calendar": "Add to the calendar", "Add to the calendar": "Add to the calendar",
"Content License": "Content License", "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", "Known Web Crawlers": "Rastreadores da Web conhecidos",
"Add to the calendar": "Adicionar ao calendário", "Add to the calendar": "Adicionar ao calendário",
"Content License": "Licença de Conteúdo", "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": "Известные веб-сканеры", "Known Web Crawlers": "Известные веб-сканеры",
"Add to the calendar": "Добавить в календарь", "Add to the calendar": "Добавить в календарь",
"Content License": "Лицензия на содержание", "Content License": "Лицензия на содержание",
"Reaction by": "Реакция со стороны" "Reaction by": "Реакция со стороны",
"Notify on emoji reactions": "Уведомлять о реакции на смайлики"
} }

View File

@ -493,5 +493,6 @@
"Known Web Crawlers": "Watambaji Wavuti Wanaojulikana", "Known Web Crawlers": "Watambaji Wavuti Wanaojulikana",
"Add to the calendar": "Ongeza kwenye kalenda", "Add to the calendar": "Ongeza kwenye kalenda",
"Content License": "Leseni ya Maudhui", "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": "已知的网络爬虫", "Known Web Crawlers": "已知的网络爬虫",
"Add to the calendar": "添加到日历", "Add to the calendar": "添加到日历",
"Content License": "内容许可", "Content License": "内容许可",
"Reaction by": "反应由" "Reaction by": "反应由",
"Notify on emoji reactions": "通知表情符号反应"
} }

View File

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