diff --git a/daemon.py b/daemon.py index 9e0c73a05..4300d4d47 100644 --- a/daemon.py +++ b/daemon.py @@ -7116,6 +7116,20 @@ class PubServer(BaseHTTPRequestHandler): if not removeTwitterActive: if os.path.isfile(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 if fields.get('isBot'): if fields['isBot'] == 'on': diff --git a/inbox.py b/inbox.py index b11c62cc8..f5c2138b8 100644 --- a/inbox.py +++ b/inbox.py @@ -1847,8 +1847,10 @@ def likeNotify(baseDir: str, domain: str, onionDomain: str, return accountDir = baseDir + '/accounts/' + handle - if not os.path.isdir(accountDir): + notifyLikesEnabledFilename = accountDir + '/.notifyLikes' + if not os.path.isfile(notifyLikesEnabledFilename): return + likeFile = accountDir + '/.newLike' if os.path.isfile(likeFile): if '##sent##' not in open(likeFile).read(): diff --git a/translations/ar.json b/translations/ar.json index 14f9ced66..b6223d1d1 100644 --- a/translations/ar.json +++ b/translations/ar.json @@ -281,5 +281,6 @@ "Ticket URL": "عنوان URL للتذكرة", "Create a new event": "أنشئ حدثًا جديدًا", "Moderation policy or code of conduct": "سياسة الوسطية أو قواعد السلوك", - "Edit event": "تحرير الحدث" + "Edit event": "تحرير الحدث", + "Notify when posts are liked": "يخطر عندما يتم اعجاب المشاركات" } diff --git a/translations/ca.json b/translations/ca.json index e55e2c0e5..343576942 100644 --- a/translations/ca.json +++ b/translations/ca.json @@ -281,5 +281,6 @@ "Ticket URL": "URL de l'entrada", "Create a new event": "Creeu un esdeveniment nou", "Moderation policy or code of conduct": "Política de moderació o codi de conducta", - "Edit event": "Edita l’esdeveniment" + "Edit event": "Edita l’esdeveniment", + "Notify when posts are liked": "Notifiqueu-ho quan us agradin les publicacions" } diff --git a/translations/cy.json b/translations/cy.json index 7b93d64bf..631892be2 100644 --- a/translations/cy.json +++ b/translations/cy.json @@ -281,5 +281,6 @@ "Ticket URL": "URL y tocyn", "Create a new event": "Creu digwyddiad newydd", "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" } diff --git a/translations/de.json b/translations/de.json index 930c17b6a..99794eb22 100644 --- a/translations/de.json +++ b/translations/de.json @@ -281,5 +281,6 @@ "Ticket URL": "Ticket URL", "Create a new event": "Erstellen Sie ein neues Ereignis", "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" } diff --git a/translations/en.json b/translations/en.json index 8c0e8b6dc..2476be31e 100644 --- a/translations/en.json +++ b/translations/en.json @@ -281,5 +281,6 @@ "Ticket URL": "Ticket 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" + "Edit event": "Edit event", + "Notify when posts are liked": "Notify when posts are liked" } diff --git a/translations/es.json b/translations/es.json index 5edcc8859..a6969342a 100644 --- a/translations/es.json +++ b/translations/es.json @@ -281,5 +281,6 @@ "Ticket URL": "URL del ticket", "Create a new event": "Crea un nuevo evento", "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" } diff --git a/translations/fr.json b/translations/fr.json index ca67d4197..b113e888b 100644 --- a/translations/fr.json +++ b/translations/fr.json @@ -281,5 +281,6 @@ "Ticket URL": "URL du ticket", "Create a new event": "Créer un nouvel événement", "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" } diff --git a/translations/ga.json b/translations/ga.json index a746ae4d2..04ad6f2f3 100644 --- a/translations/ga.json +++ b/translations/ga.json @@ -281,5 +281,6 @@ "Ticket URL": "URL na dticéad", "Create a new event": "Cruthaigh imeacht nua", "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" } diff --git a/translations/hi.json b/translations/hi.json index ac11254a7..a8f984adb 100644 --- a/translations/hi.json +++ b/translations/hi.json @@ -281,5 +281,6 @@ "Ticket URL": "टिकट URL", "Create a new event": "एक नई घटना बनाएँ", "Moderation policy or code of conduct": "मॉडरेशन पॉलिसी या आचार संहिता", - "Edit event": "घटना संपादित करें" + "Edit event": "घटना संपादित करें", + "Notify when posts are liked": "पोस्ट पसंद आने पर सूचित करें" } diff --git a/translations/it.json b/translations/it.json index 72e8efe3a..35443ffa4 100644 --- a/translations/it.json +++ b/translations/it.json @@ -281,5 +281,6 @@ "Ticket URL": "URL del biglietto", "Create a new event": "Crea un nuovo evento", "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" } diff --git a/translations/ja.json b/translations/ja.json index 13fa27be8..a11bf5ea1 100644 --- a/translations/ja.json +++ b/translations/ja.json @@ -281,5 +281,6 @@ "Ticket URL": "チケットURL", "Create a new event": "新しいイベントを作成する", "Moderation policy or code of conduct": "モデレートポリシーまたは行動規範", - "Edit event": "イベントを編集" + "Edit event": "イベントを編集", + "Notify when posts are liked": "投稿が高く評価されたときに通知する" } diff --git a/translations/oc.json b/translations/oc.json index 3642f1171..2a020527c 100644 --- a/translations/oc.json +++ b/translations/oc.json @@ -277,5 +277,6 @@ "Ticket URL": "Ticket 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" + "Edit event": "Edit event", + "Notify when posts are liked": "Notify when posts are liked" } diff --git a/translations/pt.json b/translations/pt.json index 08fd34d55..27a0466bb 100644 --- a/translations/pt.json +++ b/translations/pt.json @@ -281,5 +281,6 @@ "Ticket URL": "URL do bilhete", "Create a new event": "Crie um novo evento", "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" } diff --git a/translations/ru.json b/translations/ru.json index 74456e435..2b5d61d44 100644 --- a/translations/ru.json +++ b/translations/ru.json @@ -281,5 +281,6 @@ "Ticket URL": "URL билета", "Create a new event": "Создать новое мероприятие", "Moderation policy or code of conduct": "Политика модерации или кодекс поведения", - "Edit event": "Изменить мероприятие" + "Edit event": "Изменить мероприятие", + "Notify when posts are liked": "Уведомлять, когда публикации нравятся" } diff --git a/translations/zh.json b/translations/zh.json index 52e93e6ef..3ce3f2d7d 100644 --- a/translations/zh.json +++ b/translations/zh.json @@ -281,5 +281,6 @@ "Ticket URL": "工单URL", "Create a new event": "建立新活动", "Moderation policy or code of conduct": "审核政策或行为准则", - "Edit event": "编辑活动" + "Edit event": "编辑活动", + "Notify when posts are liked": "通知喜欢的帖子" } diff --git a/webinterface.py b/webinterface.py index e71fd8ac4..a2e451b4d 100644 --- a/webinterface.py +++ b/webinterface.py @@ -1083,6 +1083,7 @@ def htmlEditProfile(translate: {}, baseDir: str, path: str, isGroup = '' followDMs = '' removeTwitter = '' + notifyLikes = '' mediaInstanceStr = '' displayNickname = nickname bioStr = '' @@ -1130,6 +1131,9 @@ def htmlEditProfile(translate: {}, baseDir: str, path: str, if os.path.isfile(baseDir + '/accounts/' + nickname + '@' + domain + '/.removeTwitter'): removeTwitter = 'checked' + if os.path.isfile(baseDir + '/accounts/' + + nickname + '@' + domain + '/.notifyLikes'): + notifyLikes = 'checked' mediaInstance = getConfigParam(baseDir, "mediaInstance") if mediaInstance: @@ -1465,6 +1469,10 @@ def htmlEditProfile(translate: {}, baseDir: str, path: str, ' ' + \ translate['This is a media instance'] + '
\n' + editProfileForm += \ + ' ' + \ + translate['Notify when posts are liked'] + '
\n' editProfileForm += \ '