Optionally notify when posts are liked

merge-requests/30/head
Bob Mottram 2020-08-27 10:19:32 +01:00
parent 0fce258068
commit 8ff510e791
18 changed files with 55 additions and 16 deletions

View File

@ -7116,6 +7116,20 @@ class PubServer(BaseHTTPRequestHandler):
if not removeTwitterActive: if not removeTwitterActive:
if os.path.isfile(removeTwitterFilename): if os.path.isfile(removeTwitterFilename):
os.remove(removeTwitterFilename) os.remove(removeTwitterFilename)
# notify about new Likes
notifyLikesFilename = \
self.server.baseDir + '/accounts/' + \
nickname + '@' + self.server.domain + \
'/.notifyLikes'
notifyLikesActive = False
if fields.get('notifyLikes'):
if fields['notifyLikes'] == 'on':
notifyLikesActive = True
with open(notifyLikesFilename, "w") as rFile:
rFile.write('\n')
if not notifyLikesActive:
if os.path.isfile(notifyLikesFilename):
os.remove(notifyLikesFilename)
# 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

@ -1847,8 +1847,10 @@ def likeNotify(baseDir: str, domain: str, onionDomain: str,
return return
accountDir = baseDir + '/accounts/' + handle accountDir = baseDir + '/accounts/' + handle
if not os.path.isdir(accountDir): notifyLikesEnabledFilename = accountDir + '/.notifyLikes'
if not os.path.isfile(notifyLikesEnabledFilename):
return return
likeFile = accountDir + '/.newLike' likeFile = accountDir + '/.newLike'
if os.path.isfile(likeFile): if os.path.isfile(likeFile):
if '##sent##' not in open(likeFile).read(): if '##sent##' not in open(likeFile).read():

View File

@ -281,5 +281,6 @@
"Ticket URL": "عنوان URL للتذكرة", "Ticket URL": "عنوان URL للتذكرة",
"Create a new event": "أنشئ حدثًا جديدًا", "Create a new event": "أنشئ حدثًا جديدًا",
"Moderation policy or code of conduct": "سياسة الوسطية أو قواعد السلوك", "Moderation policy or code of conduct": "سياسة الوسطية أو قواعد السلوك",
"Edit event": "تحرير الحدث" "Edit event": "تحرير الحدث",
"Notify when posts are liked": "يخطر عندما يتم اعجاب المشاركات"
} }

View File

@ -281,5 +281,6 @@
"Ticket URL": "URL de l'entrada", "Ticket URL": "URL de l'entrada",
"Create a new event": "Creeu un esdeveniment nou", "Create a new event": "Creeu un esdeveniment nou",
"Moderation policy or code of conduct": "Política de moderació o codi de conducta", "Moderation policy or code of conduct": "Política de moderació o codi de conducta",
"Edit event": "Edita lesdeveniment" "Edit event": "Edita lesdeveniment",
"Notify when posts are liked": "Notifiqueu-ho quan us agradin les publicacions"
} }

View File

@ -281,5 +281,6 @@
"Ticket URL": "URL y tocyn", "Ticket URL": "URL y tocyn",
"Create a new event": "Creu digwyddiad newydd", "Create a new event": "Creu digwyddiad newydd",
"Moderation policy or code of conduct": "Polisi cymedroli neu god ymddygiad", "Moderation policy or code of conduct": "Polisi cymedroli neu god ymddygiad",
"Edit event": "Golygu digwyddiad" "Edit event": "Golygu digwyddiad",
"Notify when posts are liked": "Hysbysu pryd mae swyddi'n cael eu hoffi"
} }

View File

@ -281,5 +281,6 @@
"Ticket URL": "Ticket URL", "Ticket URL": "Ticket URL",
"Create a new event": "Erstellen Sie ein neues Ereignis", "Create a new event": "Erstellen Sie ein neues Ereignis",
"Moderation policy or code of conduct": "Moderationsrichtlinie oder Verhaltenskodex", "Moderation policy or code of conduct": "Moderationsrichtlinie oder Verhaltenskodex",
"Edit event": "Ereignis bearbeiten" "Edit event": "Ereignis bearbeiten",
"Notify when posts are liked": "Benachrichtigen, wenn Beiträge gefallen"
} }

View File

@ -281,5 +281,6 @@
"Ticket URL": "Ticket URL", "Ticket URL": "Ticket URL",
"Create a new event": "Create a new event", "Create a new event": "Create a new event",
"Moderation policy or code of conduct": "Moderation policy or code of conduct", "Moderation policy or code of conduct": "Moderation policy or code of conduct",
"Edit event": "Edit event" "Edit event": "Edit event",
"Notify when posts are liked": "Notify when posts are liked"
} }

View File

@ -281,5 +281,6 @@
"Ticket URL": "URL del ticket", "Ticket URL": "URL del ticket",
"Create a new event": "Crea un nuevo evento", "Create a new event": "Crea un nuevo evento",
"Moderation policy or code of conduct": "Política de moderación o código de conducta", "Moderation policy or code of conduct": "Política de moderación o código de conducta",
"Edit event": "Editar evento" "Edit event": "Editar evento",
"Notify when posts are liked": "Notificar cuando les gusten las publicaciones"
} }

View File

@ -281,5 +281,6 @@
"Ticket URL": "URL du ticket", "Ticket URL": "URL du ticket",
"Create a new event": "Créer un nouvel événement", "Create a new event": "Créer un nouvel événement",
"Moderation policy or code of conduct": "Politique de modération ou code de conduite", "Moderation policy or code of conduct": "Politique de modération ou code de conduite",
"Edit event": "Modifier l'événement" "Edit event": "Modifier l'événement",
"Notify when posts are liked": "Notifier lorsque les messages sont aimés"
} }

View File

@ -281,5 +281,6 @@
"Ticket URL": "URL na dticéad", "Ticket URL": "URL na dticéad",
"Create a new event": "Cruthaigh imeacht nua", "Create a new event": "Cruthaigh imeacht nua",
"Moderation policy or code of conduct": "Beartas modhnóireachta nó cód iompair", "Moderation policy or code of conduct": "Beartas modhnóireachta nó cód iompair",
"Edit event": "Cuir imeacht in eagar" "Edit event": "Cuir imeacht in eagar",
"Notify when posts are liked": "Cuir in iúl cathain is maith poist"
} }

View File

@ -281,5 +281,6 @@
"Ticket URL": "टिकट URL", "Ticket URL": "टिकट URL",
"Create a new event": "एक नई घटना बनाएँ", "Create a new event": "एक नई घटना बनाएँ",
"Moderation policy or code of conduct": "मॉडरेशन पॉलिसी या आचार संहिता", "Moderation policy or code of conduct": "मॉडरेशन पॉलिसी या आचार संहिता",
"Edit event": "घटना संपादित करें" "Edit event": "घटना संपादित करें",
"Notify when posts are liked": "पोस्ट पसंद आने पर सूचित करें"
} }

View File

@ -281,5 +281,6 @@
"Ticket URL": "URL del biglietto", "Ticket URL": "URL del biglietto",
"Create a new event": "Crea un nuovo evento", "Create a new event": "Crea un nuovo evento",
"Moderation policy or code of conduct": "Politica di moderazione o codice di condotta", "Moderation policy or code of conduct": "Politica di moderazione o codice di condotta",
"Edit event": "Modifica evento" "Edit event": "Modifica evento",
"Notify when posts are liked": "Avvisa quando i post sono piaciuti"
} }

View File

@ -281,5 +281,6 @@
"Ticket URL": "チケットURL", "Ticket URL": "チケットURL",
"Create a new event": "新しいイベントを作成する", "Create a new event": "新しいイベントを作成する",
"Moderation policy or code of conduct": "モデレートポリシーまたは行動規範", "Moderation policy or code of conduct": "モデレートポリシーまたは行動規範",
"Edit event": "イベントを編集" "Edit event": "イベントを編集",
"Notify when posts are liked": "投稿が高く評価されたときに通知する"
} }

View File

@ -277,5 +277,6 @@
"Ticket URL": "Ticket URL", "Ticket URL": "Ticket URL",
"Create a new event": "Create a new event", "Create a new event": "Create a new event",
"Moderation policy or code of conduct": "Moderation policy or code of conduct", "Moderation policy or code of conduct": "Moderation policy or code of conduct",
"Edit event": "Edit event" "Edit event": "Edit event",
"Notify when posts are liked": "Notify when posts are liked"
} }

View File

@ -281,5 +281,6 @@
"Ticket URL": "URL do bilhete", "Ticket URL": "URL do bilhete",
"Create a new event": "Crie um novo evento", "Create a new event": "Crie um novo evento",
"Moderation policy or code of conduct": "Política de moderação ou código de conduta", "Moderation policy or code of conduct": "Política de moderação ou código de conduta",
"Edit event": "Editar evento" "Edit event": "Editar evento",
"Notify when posts are liked": "Notificar quando as postagens forem curtidas"
} }

View File

@ -281,5 +281,6 @@
"Ticket URL": "URL билета", "Ticket URL": "URL билета",
"Create a new event": "Создать новое мероприятие", "Create a new event": "Создать новое мероприятие",
"Moderation policy or code of conduct": "Политика модерации или кодекс поведения", "Moderation policy or code of conduct": "Политика модерации или кодекс поведения",
"Edit event": "Изменить мероприятие" "Edit event": "Изменить мероприятие",
"Notify when posts are liked": "Уведомлять, когда публикации нравятся"
} }

View File

@ -281,5 +281,6 @@
"Ticket URL": "工单URL", "Ticket URL": "工单URL",
"Create a new event": "建立新活动", "Create a new event": "建立新活动",
"Moderation policy or code of conduct": "审核政策或行为准则", "Moderation policy or code of conduct": "审核政策或行为准则",
"Edit event": "编辑活动" "Edit event": "编辑活动",
"Notify when posts are liked": "通知喜欢的帖子"
} }

View File

@ -1083,6 +1083,7 @@ def htmlEditProfile(translate: {}, baseDir: str, path: str,
isGroup = '' isGroup = ''
followDMs = '' followDMs = ''
removeTwitter = '' removeTwitter = ''
notifyLikes = ''
mediaInstanceStr = '' mediaInstanceStr = ''
displayNickname = nickname displayNickname = nickname
bioStr = '' bioStr = ''
@ -1130,6 +1131,9 @@ def htmlEditProfile(translate: {}, baseDir: str, path: str,
if os.path.isfile(baseDir + '/accounts/' + if os.path.isfile(baseDir + '/accounts/' +
nickname + '@' + domain + '/.removeTwitter'): nickname + '@' + domain + '/.removeTwitter'):
removeTwitter = 'checked' removeTwitter = 'checked'
if os.path.isfile(baseDir + '/accounts/' +
nickname + '@' + domain + '/.notifyLikes'):
notifyLikes = 'checked'
mediaInstance = getConfigParam(baseDir, "mediaInstance") mediaInstance = getConfigParam(baseDir, "mediaInstance")
if mediaInstance: if mediaInstance:
@ -1465,6 +1469,10 @@ def htmlEditProfile(translate: {}, baseDir: str, path: str,
' <input type="checkbox" class="profilecheckbox" ' + \ ' <input type="checkbox" class="profilecheckbox" ' + \
'name="mediaInstance" ' + mediaInstanceStr + '> ' + \ 'name="mediaInstance" ' + mediaInstanceStr + '> ' + \
translate['This is a media instance'] + '<br>\n' translate['This is a media instance'] + '<br>\n'
editProfileForm += \
' <input type="checkbox" class="profilecheckbox" ' + \
'name="notifyLikes" ' + notifyLikes + '> ' + \
translate['Notify when posts are liked'] + '<br>\n'
editProfileForm += \ editProfileForm += \
' <br><b><label class="labels">' + \ ' <br><b><label class="labels">' + \