Option to turn emoji reactions off

merge-requests/30/head
Bob Mottram 2021-11-17 14:25:24 +00:00
parent 6b76ab4754
commit edd62c1f1b
21 changed files with 94 additions and 21 deletions

View File

@ -5725,6 +5725,38 @@ class PubServer(BaseHTTPRequestHandler):
hideLikeButtonFile)
pass
# hide Reaction button
hideReactionButtonFile = \
acctDir(baseDir, nickname, domain) + \
'/.hideReactionButton'
notifyReactionsFilename = \
acctDir(baseDir, nickname, domain) + \
'/.notifyReactions'
hideReactionButtonActive = False
if fields.get('hideReactionButton'):
if fields['hideReactionButton'] == 'on':
hideReactionButtonActive = True
with open(hideReactionButtonFile, 'w+') as rFile:
rFile.write('\n')
# remove notify Reaction selection
if os.path.isfile(notifyReactionsFilename):
try:
os.remove(notifyReactionsFilename)
except BaseException:
print('EX: _profileUpdate ' +
'unable to delete ' +
notifyReactionsFilename)
pass
if not hideReactionButtonActive:
if os.path.isfile(hideReactionButtonFile):
try:
os.remove(hideReactionButtonFile)
except BaseException:
print('EX: _profileUpdate ' +
'unable to delete ' +
hideReactionButtonFile)
pass
# notify about new Likes
if onFinalWelcomeScreen:
# default setting from welcome screen
@ -5760,7 +5792,8 @@ class PubServer(BaseHTTPRequestHandler):
else:
notifyReactionsActive = False
if fields.get('notifyReactions'):
if fields['notifyReactions'] == 'on':
if fields['notifyReactions'] == 'on' and \
not hideReactionButtonActive:
notifyReactionsActive = True
with open(notifyReactionsFilename,
'w+') as rFile:

View File

@ -1263,9 +1263,15 @@ def _receiveReaction(recentPostsCache: {},
return False
if not os.path.isdir(baseDir + '/accounts/' + handle):
print('DEBUG: unknown recipient of emoji reaction - ' + handle)
if os.path.isfile(baseDir + '/accounts/' + handle +
'/.hideReactionButton'):
print('Emoji reaction rejected by ' + handle +
' due to their settings')
return True
# if this post in the outbox of the person?
handleName = handle.split('@')[0]
handleDom = handle.split('@')[1]
postReactionId = messageJson['object']
emojiContent = removeHtml(messageJson['content'])
if not emojiContent:

View File

@ -495,5 +495,6 @@
"Content License": "ترخيص المحتوى",
"Reaction by": "رد فعل",
"Notify on emoji reactions": "يخطر على ردود الفعل الرموز التعبيرية",
"Select reaction": "حدد رد الفعل"
"Select reaction": "حدد رد الفعل",
"Don't show the Reaction button": "لا تظهر زر رد الفعل"
}

View File

@ -495,5 +495,6 @@
"Content License": "Llicència de contingut",
"Reaction by": "Reacció de",
"Notify on emoji reactions": "Notificar sobre les reaccions dels emojis",
"Select reaction": "Seleccioneu la reacció"
"Select reaction": "Seleccioneu la reacció",
"Don't show the Reaction button": "No mostris el botó de reacció"
}

View File

@ -495,5 +495,6 @@
"Content License": "Trwydded Cynnwys",
"Reaction by": "Ymateb gan",
"Notify on emoji reactions": "Hysbysu ar ymatebion emoji",
"Select reaction": "Dewiswch adwaith"
"Select reaction": "Dewiswch adwaith",
"Don't show the Reaction button": "Peidiwch â dangos y botwm Adwaith"
}

View File

@ -495,5 +495,6 @@
"Content License": "Inhaltslizenz",
"Reaction by": "Reaktion von",
"Notify on emoji reactions": "Bei Emoji-Reaktionen benachrichtigen",
"Select reaction": "Reaktion auswählen"
"Select reaction": "Reaktion auswählen",
"Don't show the Reaction button": "Reaktionstaste nicht anzeigen"
}

View File

@ -495,5 +495,6 @@
"Content License": "Content License",
"Reaction by": "Reaction by",
"Notify on emoji reactions": "Notify on emoji reactions",
"Select reaction": "Select reaction"
"Select reaction": "Select reaction",
"Don't show the Reaction button": "Don't show the Reaction button"
}

View File

@ -495,5 +495,6 @@
"Content License": "Licencia de contenido",
"Reaction by": "Reacción de",
"Notify on emoji reactions": "Notificar sobre reacciones emoji",
"Select reaction": "Seleccionar reacción"
"Select reaction": "Seleccionar reacción",
"Don't show the Reaction button": "No mostrar el botón de reacción"
}

View File

@ -495,5 +495,6 @@
"Content License": "Licence de contenu",
"Reaction by": "Réaction par",
"Notify on emoji reactions": "Avertir sur les réactions emoji",
"Select reaction": "Sélectionnez la réaction"
"Select reaction": "Sélectionnez la réaction",
"Don't show the Reaction button": "Ne pas afficher le bouton Réaction"
}

View File

@ -495,5 +495,6 @@
"Content License": "Ceadúnas Ábhar",
"Reaction by": "Imoibriú le",
"Notify on emoji reactions": "Fógra a thabhairt faoi imoibrithe emoji",
"Select reaction": "Roghnaigh imoibriú"
"Select reaction": "Roghnaigh imoibriú",
"Don't show the Reaction button": "Ná taispeáin an cnaipe Imoibriú"
}

View File

@ -495,5 +495,6 @@
"Content License": "सामग्री लाइसेंस",
"Reaction by": "द्वारा प्रतिक्रिया",
"Notify on emoji reactions": "इमोजी प्रतिक्रियाओं पर सूचित करें",
"Select reaction": "प्रतिक्रिया का चयन करें"
"Select reaction": "प्रतिक्रिया का चयन करें",
"Don't show the Reaction button": "प्रतिक्रिया बटन न दिखाएं"
}

View File

@ -495,5 +495,6 @@
"Content License": "Licenza sui contenuti",
"Reaction by": "Reazione di",
"Notify on emoji reactions": "Notifica sulle reazioni emoji",
"Select reaction": "Seleziona reazione"
"Select reaction": "Seleziona reazione",
"Don't show the Reaction button": "Non mostrare il pulsante Reazione"
}

View File

@ -495,5 +495,6 @@
"Content License": "コンテンツライセンス",
"Reaction by": "による反応",
"Notify on emoji reactions": "絵文字の反応を通知する",
"Select reaction": "反応を選択"
"Select reaction": "反応を選択",
"Don't show the Reaction button": "反応ボタンを表示しない"
}

View File

@ -495,5 +495,6 @@
"Content License": "Naverok License de",
"Reaction by": "Reaction by",
"Notify on emoji reactions": "Li ser reaksiyonên emoji agahdar bikin",
"Select reaction": "Reaksiyonê hilbijêrin"
"Select reaction": "Reaksiyonê hilbijêrin",
"Don't show the Reaction button": "Bişkoka Reaksiyonê nîşan nede"
}

View File

@ -491,5 +491,6 @@
"Content License": "Content License",
"Reaction by": "Reaction by",
"Notify on emoji reactions": "Notify on emoji reactions",
"Select reaction": "Select reaction"
"Select reaction": "Select reaction",
"Don't show the Reaction button": "Don't show the Reaction button"
}

View File

@ -495,5 +495,6 @@
"Content License": "Licença de Conteúdo",
"Reaction by": "Reazione di",
"Notify on emoji reactions": "Notificar sobre reações de emoji",
"Select reaction": "Selecione a reação"
"Select reaction": "Selecione a reação",
"Don't show the Reaction button": "Não mostrar o botão de reação"
}

View File

@ -495,5 +495,6 @@
"Content License": "Лицензия на содержание",
"Reaction by": "Реакция со стороны",
"Notify on emoji reactions": "Уведомлять о реакции на смайлики",
"Select reaction": "Выберите реакцию"
"Select reaction": "Выберите реакцию",
"Don't show the Reaction button": "Не показывать кнопку реакции"
}

View File

@ -495,5 +495,6 @@
"Content License": "Leseni ya Maudhui",
"Reaction by": "Majibu kwa",
"Notify on emoji reactions": "Arifu kuhusu maitikio ya emoji",
"Select reaction": "Chagua majibu"
"Select reaction": "Chagua majibu",
"Don't show the Reaction button": "Usionyeshe kitufe cha Majibu"
}

View File

@ -495,5 +495,6 @@
"Content License": "内容许可",
"Reaction by": "反应由",
"Notify on emoji reactions": "通知表情符号反应",
"Select reaction": "选择反应"
"Select reaction": "选择反应",
"Don't show the Reaction button": "不显示“反应”按钮"
}

View File

@ -704,6 +704,7 @@ def _getBookmarkIconHtml(nickname: str, domainFull: str,
def _getReactionIconHtml(nickname: str, domainFull: str,
postJsonObject: {},
isModerationPost: bool,
showReactionButton: bool,
translate: {},
enableTimingLog: bool,
postStartTime, boxName: str,
@ -713,7 +714,7 @@ def _getReactionIconHtml(nickname: str, domainFull: str,
"""
reactionStr = ''
if isModerationPost:
if not showReactionButton or isModerationPost:
return reactionStr
reactionIcon = 'reaction.png'
@ -1660,6 +1661,13 @@ def individualPostAsHtml(signingPrivateKeyPem: str,
if os.path.isfile(hideLikeButtonFile):
showLikeButton = False
# whether to show a reaction button
hideReactionButtonFile = \
acctDir(baseDir, nickname, domain) + '/.hideReactionButton'
showReactionButton = True
if os.path.isfile(hideReactionButtonFile):
showReactionButton = False
likeJsonObject = postJsonObject
if announceJsonObject:
likeJsonObject = announceJsonObject
@ -1691,6 +1699,7 @@ def individualPostAsHtml(signingPrivateKeyPem: str,
_getReactionIconHtml(nickname, domainFull,
postJsonObject,
isModerationPost,
showReactionButton,
translate,
enableTimingLog,
postStartTime, boxName,

View File

@ -1869,6 +1869,7 @@ def _htmlEditProfileOptions(isAdmin: bool,
followDMs: str, removeTwitter: str,
notifyLikes: str, notifyReactions: str,
hideLikeButton: str,
hideReactionButton: str,
translate: {}) -> str:
"""option checkboxes section of edit profile screen
"""
@ -1898,6 +1899,9 @@ def _htmlEditProfileOptions(isAdmin: bool,
editProfileForm += \
editCheckBox(translate["Don't show the Like button"],
'hideLikeButton', hideLikeButton)
editProfileForm += \
editCheckBox(translate["Don't show the Reaction button"],
'hideReactionButton', hideReactionButton)
editProfileForm += ' </div>\n'
return editProfileForm
@ -2052,7 +2056,8 @@ def htmlEditProfile(cssCache: {}, translate: {}, baseDir: str, path: str,
displayNickname = nickname
isBot = isGroup = followDMs = removeTwitter = ''
notifyLikes = notifyReactions = hideLikeButton = mediaInstanceStr = ''
notifyLikes = notifyReactions = ''
hideLikeButton = hideReactionButton = mediaInstanceStr = ''
blogsInstanceStr = newsInstanceStr = movedTo = twitterStr = ''
bioStr = donateUrl = websiteUrl = emailAddress = PGPpubKey = ''
PGPfingerprint = xmppAddress = matrixAddress = ''
@ -2107,6 +2112,8 @@ def htmlEditProfile(cssCache: {}, translate: {}, baseDir: str, path: str,
notifyReactions = 'checked'
if os.path.isfile(accountDir + '/.hideLikeButton'):
hideLikeButton = 'checked'
if os.path.isfile(accountDir + '/.hideReactionButton'):
hideReactionButton = 'checked'
mediaInstance = getConfigParam(baseDir, "mediaInstance")
if mediaInstance:
@ -2203,7 +2210,8 @@ def htmlEditProfile(cssCache: {}, translate: {}, baseDir: str, path: str,
_htmlEditProfileOptions(isAdmin, manuallyApprovesFollowers,
isBot, isGroup, followDMs, removeTwitter,
notifyLikes, notifyReactions,
hideLikeButton, translate)
hideLikeButton, hideReactionButton,
translate)
# Contact information
editProfileForm += \