diff --git a/daemon.py b/daemon.py
index 7b5decf7a..40091882c 100644
--- a/daemon.py
+++ b/daemon.py
@@ -20822,7 +20822,56 @@ class PubServer(BaseHTTPRequestHandler):
if fields['schedulePost']:
return 1
print('DEBUG: new reminder to ' +
- str(message_json['object']['to']))
+ str(message_json['object']['to']) + ' ' +
+ str(edited_postid))
+ if edited_postid:
+ recent_posts_cache = self.server.recent_posts_cache
+ allow_local_network_access = \
+ self.server.allow_local_network_access
+ signing_priv_key_pem = \
+ self.server.signing_priv_key_pem
+ twitter_replacement_domain = \
+ self.server.twitter_replacement_domain
+ show_published_date_only = \
+ self.server.show_published_date_only
+ min_images_for_accounts = \
+ self.server.min_images_for_accounts
+ peertube_instances = \
+ self.server.peertube_instances
+ self._update_edited_post(self.server.base_dir,
+ nickname, self.server.domain,
+ message_json,
+ edited_published,
+ edited_postid,
+ recent_posts_cache,
+ 'dm',
+ self.server.max_mentions,
+ self.server.max_emoji,
+ allow_local_network_access,
+ self.server.debug,
+ self.server.system_language,
+ self.server.http_prefix,
+ self.server.domain_full,
+ self.server.person_cache,
+ signing_priv_key_pem,
+ self.server.max_recent_posts,
+ self.server.translate,
+ curr_session,
+ self.server.cached_webfingers,
+ self.server.port,
+ self.server.allow_deletion,
+ self.server.yt_replace_domain,
+ twitter_replacement_domain,
+ show_published_date_only,
+ peertube_instances,
+ self.server.theme_name,
+ self.server.max_like_count,
+ self.server.cw_lists,
+ self.server.dogwhistles,
+ min_images_for_accounts,
+ self.server.max_hashtags)
+ print('DEBUG: sending edited reminder post ' +
+ str(message_json))
if self._post_to_outbox(message_json,
self.server.project_version,
nickname,
diff --git a/happening.py b/happening.py
index cf8975220..6c15f41c4 100644
--- a/happening.py
+++ b/happening.py
@@ -176,7 +176,7 @@ def save_event_post(base_dir: str, handle: str, post_id: str,
with open(calendar_filename, 'a+', encoding='utf-8') as calendar_file:
calendar_file.write(post_id + '\n')
except OSError:
- print('EX: unable to append ' + calendar_filename)
+ print('EX: unable to append to calendar ' + calendar_filename)
# create a file which will trigger a notification that
# a new event has been added
@@ -332,7 +332,8 @@ def get_todays_events(base_dir: str, nickname: str, domain: str,
for post_id in calendar_post_ids:
calendar_file.write(post_id + '\n')
except OSError:
- print('EX: unable to write ' + calendar_filename)
+ print('EX: unable to recreate events file 1 ' +
+ calendar_filename)
return events
@@ -656,7 +657,8 @@ def get_this_weeks_events(base_dir: str, nickname: str, domain: str) -> {}:
for post_id in calendar_post_ids:
calendar_file.write(post_id + '\n')
except OSError:
- print('EX: unable to write ' + calendar_filename)
+ print('EX: unable to recreate events file 2 ' +
+ calendar_filename)
return events
@@ -738,7 +740,8 @@ def get_calendar_events(base_dir: str, nickname: str, domain: str,
for post_id in calendar_post_ids:
calendar_file.write(post_id + '\n')
except OSError:
- print('EX: unable to write ' + calendar_filename)
+ print('EX: unable to recreate events file 3 ' +
+ calendar_filename)
return events
@@ -768,7 +771,8 @@ def remove_calendar_event(base_dir: str, nickname: str, domain: str,
if message_id not in line:
fp_cal.write(line)
except OSError:
- print('EX: unable to write ' + calendar_filename)
+ print('EX: unable to remove calendar event ' +
+ calendar_filename)
def _dav_decode_token(token: str) -> (int, int, str):
diff --git a/inbox.py b/inbox.py
index 56cd360b9..56f22cff6 100644
--- a/inbox.py
+++ b/inbox.py
@@ -1262,7 +1262,7 @@ def receive_edit_to_post(recent_posts_cache: {}, message_json: {},
message_id = remove_id_ending(message_json['object']['id'])
if '#' in message_id:
message_id = message_id.split('#', 1)[0]
- # find the post which was edited
+ # find the original post which was edited
post_filename = locate_post(base_dir, nickname, domain, message_id)
if not post_filename:
print('EDITPOST: ' + message_id + ' has already expired')
@@ -1276,7 +1276,7 @@ def receive_edit_to_post(recent_posts_cache: {}, message_json: {},
print('EDITPOST: contains invalid content' + str(message_json))
return False
- # load the json for the post
+ # load the json for the original post
post_json_object = load_json(post_filename, 1)
if not post_json_object:
return False
@@ -1319,6 +1319,12 @@ def receive_edit_to_post(recent_posts_cache: {}, message_json: {},
# Change Update to Create
message_json['type'] = 'Create'
save_json(message_json, post_filename)
+ # if the post has been saved both within the outbox and inbox
+ # (eg. edited reminder)
+ if '/outbox/' in post_filename:
+ inbox_post_filename = post_filename.replace('/outbox/', '/inbox/')
+ if os.path.isfile(inbox_post_filename):
+ save_json(message_json, inbox_post_filename)
# ensure that the cached post is removed if it exists, so
# that it then will be recreated
cached_post_filename = \
@@ -1347,7 +1353,7 @@ def receive_edit_to_post(recent_posts_cache: {}, message_json: {},
mitm = True
bold_reading = False
bold_reading_filename = \
- base_dir + '/accounts/' + nickname + '@' + domain + '/.boldReading'
+ acct_dir(base_dir, nickname, domain) + '/.boldReading'
if os.path.isfile(bold_reading_filename):
bold_reading = True
timezone = get_account_timezone(base_dir, nickname, domain)
diff --git a/posts.py b/posts.py
index 11c8eaf12..851d0dbc7 100644
--- a/posts.py
+++ b/posts.py
@@ -940,6 +940,29 @@ def save_post_to_box(base_dir: str, http_prefix: str, post_id: str,
filename = box_dir + '/' + post_id.replace('/', '#') + '.json'
save_json(post_json_object, filename)
+ # if this is an outbox post with a duplicate in the inbox then save to both
+ # This happens for edited posts
+ if '/outbox/' in filename:
+ inbox_filename = filename.replace('/outbox/', '/inbox/')
+ if os.path.isfile(inbox_filename):
+ save_json(post_json_object, inbox_filename)
+ base_filename = \
+ filename.replace('/outbox/',
+ '/postcache/').replace('.json', '')
+ ssml_filename = base_filename + '.ssml'
+ if os.path.isfile(ssml_filename):
+ try:
+ os.remove(ssml_filename)
+ except OSError:
+ print('EX: save_post_to_box unable to delete ssml file ' +
+ ssml_filename)
+ html_filename = base_filename + '.html'
+ if os.path.isfile(html_filename):
+ try:
+ os.remove(html_filename)
+ except OSError:
+ print('EX: save_post_to_box unable to delete html file ' +
+ html_filename)
return filename
diff --git a/translations/ar.json b/translations/ar.json
index e240570f7..e6f0b1bf4 100644
--- a/translations/ar.json
+++ b/translations/ar.json
@@ -607,5 +607,6 @@
"Move": "يتحرك",
"Inactive": "غير نشط",
"Registrations open": "التسجيلات مفتوحة",
- "Registrations remaining": "التسجيلات المتبقية"
+ "Registrations remaining": "التسجيلات المتبقية",
+ "Edit reminder": "تحرير التذكير"
}
diff --git a/translations/bn.json b/translations/bn.json
index 1a9772804..79ed7eb6b 100644
--- a/translations/bn.json
+++ b/translations/bn.json
@@ -607,5 +607,6 @@
"Move": "সরান",
"Inactive": "নিষ্ক্রিয়",
"Registrations open": "রেজিস্ট্রেশন খোলা",
- "Registrations remaining": "রেজিস্ট্রেশন বাকি"
+ "Registrations remaining": "রেজিস্ট্রেশন বাকি",
+ "Edit reminder": "অনুস্মারক সম্পাদনা করুন"
}
diff --git a/translations/ca.json b/translations/ca.json
index 9dca70e65..f50f95ef1 100644
--- a/translations/ca.json
+++ b/translations/ca.json
@@ -607,5 +607,6 @@
"Move": "Moure's",
"Inactive": "Inactiu",
"Registrations open": "Inscripcions obertes",
- "Registrations remaining": "Inscripcions restants"
+ "Registrations remaining": "Inscripcions restants",
+ "Edit reminder": "Edita el recordatori"
}
diff --git a/translations/cy.json b/translations/cy.json
index 0516e7563..50814b105 100644
--- a/translations/cy.json
+++ b/translations/cy.json
@@ -607,5 +607,6 @@
"Move": "Symud",
"Inactive": "Anactif",
"Registrations open": "Cofrestriadau yn agor",
- "Registrations remaining": "Cofrestriadau ar ôl"
+ "Registrations remaining": "Cofrestriadau ar ôl",
+ "Edit reminder": "Golygu nodyn atgoffa"
}
diff --git a/translations/de.json b/translations/de.json
index 8a07e02f7..5631c951f 100644
--- a/translations/de.json
+++ b/translations/de.json
@@ -607,5 +607,6 @@
"Move": "Bewegen",
"Inactive": "Inaktiv",
"Registrations open": "Anmeldungen geöffnet",
- "Registrations remaining": "Anmeldungen verbleiben"
+ "Registrations remaining": "Anmeldungen verbleiben",
+ "Edit reminder": "Erinnerung bearbeiten"
}
diff --git a/translations/el.json b/translations/el.json
index 06d4e4fdc..fb4822846 100644
--- a/translations/el.json
+++ b/translations/el.json
@@ -607,5 +607,6 @@
"Move": "Κίνηση",
"Inactive": "Αδρανής",
"Registrations open": "Οι εγγραφές ανοίγουν",
- "Registrations remaining": "Απομένουν οι εγγραφές"
+ "Registrations remaining": "Απομένουν οι εγγραφές",
+ "Edit reminder": "Επεξεργασία υπενθύμισης"
}
diff --git a/translations/en.json b/translations/en.json
index a1bceba74..337d25c2d 100644
--- a/translations/en.json
+++ b/translations/en.json
@@ -607,5 +607,6 @@
"Move": "Move",
"Inactive": "Inactive",
"Registrations open": "Registrations open",
- "Registrations remaining": "Registrations remaining"
+ "Registrations remaining": "Registrations remaining",
+ "Edit reminder": "Edit reminder"
}
diff --git a/translations/es.json b/translations/es.json
index 2cc8e06d8..6b439ff94 100644
--- a/translations/es.json
+++ b/translations/es.json
@@ -607,5 +607,6 @@
"Move": "Muevete",
"Inactive": "Αδρανής",
"Registrations open": "Inscripciones abiertas",
- "Registrations remaining": "Registros restantes"
+ "Registrations remaining": "Registros restantes",
+ "Edit reminder": "Editar recordatorio"
}
diff --git a/translations/fa.json b/translations/fa.json
index fc6ce8468..194c8622a 100644
--- a/translations/fa.json
+++ b/translations/fa.json
@@ -607,5 +607,6 @@
"Move": "حرکت",
"Inactive": "غیر فعال",
"Registrations open": "ثبت نام ها باز شد",
- "Registrations remaining": "ثبت نام باقی مانده است"
+ "Registrations remaining": "ثبت نام باقی مانده است",
+ "Edit reminder": "ویرایش یادآوری"
}
diff --git a/translations/fr.json b/translations/fr.json
index d625db86b..fbac9eea5 100644
--- a/translations/fr.json
+++ b/translations/fr.json
@@ -607,5 +607,6 @@
"Move": "Déplacer",
"Inactive": "Inactive",
"Registrations open": "Inscriptions ouvertes",
- "Registrations remaining": "Inscriptions restantes"
+ "Registrations remaining": "Inscriptions restantes",
+ "Edit reminder": "Modifier le rappel"
}
diff --git a/translations/ga.json b/translations/ga.json
index ee5e43284..c6f6d7cc9 100644
--- a/translations/ga.json
+++ b/translations/ga.json
@@ -607,5 +607,6 @@
"Move": "Bog",
"Inactive": "Neamhghníomhach",
"Registrations open": "Clárúcháin oscailte",
- "Registrations remaining": "Clárúcháin fágtha"
+ "Registrations remaining": "Clárúcháin fágtha",
+ "Edit reminder": "Cuir meabhrúchán in eagar"
}
diff --git a/translations/hi.json b/translations/hi.json
index 76f72e755..2a26bcaf3 100644
--- a/translations/hi.json
+++ b/translations/hi.json
@@ -607,5 +607,6 @@
"Move": "कदम",
"Inactive": "निष्क्रिय",
"Registrations open": "पंजीकरण खुले हैं",
- "Registrations remaining": "रजिस्ट्रेशन बाकी हैं"
+ "Registrations remaining": "रजिस्ट्रेशन बाकी हैं",
+ "Edit reminder": "रिमाइंडर संपादित करें"
}
diff --git a/translations/it.json b/translations/it.json
index 89cd34aa0..a54ef111d 100644
--- a/translations/it.json
+++ b/translations/it.json
@@ -607,5 +607,6 @@
"Move": "Spostare",
"Inactive": "Non attivo",
"Registrations open": "Aperte le iscrizioni",
- "Registrations remaining": "Iscrizioni rimanenti"
+ "Registrations remaining": "Iscrizioni rimanenti",
+ "Edit reminder": "Modifica promemoria"
}
diff --git a/translations/ja.json b/translations/ja.json
index 0e8224a5b..4405a2120 100644
--- a/translations/ja.json
+++ b/translations/ja.json
@@ -607,5 +607,6 @@
"Move": "動く",
"Inactive": "非活性",
"Registrations open": "登録開始",
- "Registrations remaining": "残りの登録数"
+ "Registrations remaining": "残りの登録数",
+ "Edit reminder": "リマインダーを編集"
}
diff --git a/translations/ko.json b/translations/ko.json
index e63ac5f0d..85e69ecba 100644
--- a/translations/ko.json
+++ b/translations/ko.json
@@ -607,5 +607,6 @@
"Move": "이동하다",
"Inactive": "비활성",
"Registrations open": "등록 시작",
- "Registrations remaining": "남은 등록"
+ "Registrations remaining": "남은 등록",
+ "Edit reminder": "알림 수정"
}
diff --git a/translations/ku.json b/translations/ku.json
index 5b73c44da..a147f1d91 100644
--- a/translations/ku.json
+++ b/translations/ku.json
@@ -607,5 +607,6 @@
"Move": "Barkirin",
"Inactive": "Bêkar",
"Registrations open": "Qeydkirin vedibin",
- "Registrations remaining": "Registrations maye"
+ "Registrations remaining": "Registrations maye",
+ "Edit reminder": "Bîranîna biguherîne"
}
diff --git a/translations/nl.json b/translations/nl.json
index c2890ad58..95d6beb0e 100644
--- a/translations/nl.json
+++ b/translations/nl.json
@@ -607,5 +607,6 @@
"Move": "Beweging",
"Inactive": "Inactief",
"Registrations open": "Inschrijvingen geopend",
- "Registrations remaining": "Resterende inschrijvingen"
+ "Registrations remaining": "Resterende inschrijvingen",
+ "Edit reminder": "Herinnering bewerken"
}
diff --git a/translations/oc.json b/translations/oc.json
index b2ba8cece..3c5b2af14 100644
--- a/translations/oc.json
+++ b/translations/oc.json
@@ -603,5 +603,6 @@
"Move": "Move",
"Inactive": "Inactive",
"Registrations open": "Registrations open",
- "Registrations remaining": "Registrations remaining"
+ "Registrations remaining": "Registrations remaining",
+ "Edit reminder": "Edit reminder"
}
diff --git a/translations/pl.json b/translations/pl.json
index 0154417f9..149362ada 100644
--- a/translations/pl.json
+++ b/translations/pl.json
@@ -607,5 +607,6 @@
"Move": "Przenosić",
"Inactive": "Nieaktywny",
"Registrations open": "Rejestracje otwarte",
- "Registrations remaining": "Pozostały zapisy"
+ "Registrations remaining": "Pozostały zapisy",
+ "Edit reminder": "Edytuj przypomnienie"
}
diff --git a/translations/pt.json b/translations/pt.json
index 1a778d6e0..c36dfdffb 100644
--- a/translations/pt.json
+++ b/translations/pt.json
@@ -607,5 +607,6 @@
"Move": "Jogada",
"Inactive": "Inativa",
"Registrations open": "inscrições abertas",
- "Registrations remaining": "Inscrições restantes"
+ "Registrations remaining": "Inscrições restantes",
+ "Edit reminder": "Editar lembrete"
}
diff --git a/translations/ru.json b/translations/ru.json
index 02557eb56..88acfa275 100644
--- a/translations/ru.json
+++ b/translations/ru.json
@@ -607,5 +607,6 @@
"Move": "Шаг",
"Inactive": "Неактивный",
"Registrations open": "Регистрация открыта",
- "Registrations remaining": "Осталось регистраций"
+ "Registrations remaining": "Осталось регистраций",
+ "Edit reminder": "Изменить напоминание"
}
diff --git a/translations/sw.json b/translations/sw.json
index d0fd6ffc3..fe23bbd7b 100644
--- a/translations/sw.json
+++ b/translations/sw.json
@@ -607,5 +607,6 @@
"Move": "Sogeza",
"Inactive": "Isiyotumika",
"Registrations open": "Usajili umefunguliwa",
- "Registrations remaining": "Usajili uliosalia"
+ "Registrations remaining": "Usajili uliosalia",
+ "Edit reminder": "Badilisha kikumbusho"
}
diff --git a/translations/tr.json b/translations/tr.json
index 24ed67324..15b82c164 100644
--- a/translations/tr.json
+++ b/translations/tr.json
@@ -607,5 +607,6 @@
"Move": "Hareket",
"Inactive": "etkin değil",
"Registrations open": "kayıtlar açık",
- "Registrations remaining": "kalan kayıtlar"
+ "Registrations remaining": "kalan kayıtlar",
+ "Edit reminder": "Hatırlatıcıyı düzenle"
}
diff --git a/translations/uk.json b/translations/uk.json
index 179a1bebc..260ff5905 100644
--- a/translations/uk.json
+++ b/translations/uk.json
@@ -607,5 +607,6 @@
"Move": "рухатися",
"Inactive": "Неактивний",
"Registrations open": "Реєстрація відкрита",
- "Registrations remaining": "Залишилось реєстрацій"
+ "Registrations remaining": "Залишилось реєстрацій",
+ "Edit reminder": "Редагувати нагадування"
}
diff --git a/translations/yi.json b/translations/yi.json
index 92026a097..89f674704 100644
--- a/translations/yi.json
+++ b/translations/yi.json
@@ -607,5 +607,6 @@
"Move": "מאַך",
"Inactive": "ינאַקטיוו",
"Registrations open": "רעדזשיסטריישאַנז עפענען",
- "Registrations remaining": "רעדזשיסטריישאַנז רוען"
+ "Registrations remaining": "רעדזשיסטריישאַנז רוען",
+ "Edit reminder": "רעדאַגירן דערמאָנונג"
}
diff --git a/translations/zh.json b/translations/zh.json
index 77f5ed50c..90b76161d 100644
--- a/translations/zh.json
+++ b/translations/zh.json
@@ -607,5 +607,6 @@
"Move": "移动",
"Inactive": "无效",
"Registrations open": "注册开放",
- "Registrations remaining": "剩余名额"
+ "Registrations remaining": "剩余名额",
+ "Edit reminder": "编辑提醒"
}
diff --git a/utils.py b/utils.py
index 8eb0eb085..4d78cfe69 100644
--- a/utils.py
+++ b/utils.py
@@ -2046,6 +2046,28 @@ def is_dm(post_json_object: {}) -> bool:
return True
+def is_reminder(post_json_object: {}) -> bool:
+ """Returns true if the given post is a reminder
+ """
+ if not is_dm(post_json_object):
+ return False
+ if not post_json_object['object'].get('to'):
+ return False
+ if not post_json_object['object'].get('attributedTo'):
+ return False
+ if not post_json_object['object'].get('tag'):
+ return False
+ if len(post_json_object['object']['to']) != 1:
+ return False
+ if post_json_object['object']['to'][0] != \
+ post_json_object['object']['attributedTo']:
+ return False
+ for tag in post_json_object['object']['tag']:
+ if tag['type'] == 'Event':
+ return True
+ return False
+
+
def _is_remote_dm(domain_full: str, post_json_object: {}) -> bool:
"""Is the given post a DM from a different domain?
"""
diff --git a/webapp_post.py b/webapp_post.py
index f29f80ab1..720588964 100644
--- a/webapp_post.py
+++ b/webapp_post.py
@@ -40,6 +40,7 @@ from utils import has_object_dict
from utils import update_announce_collection
from utils import is_pgp_encrypted
from utils import is_dm
+from utils import is_reminder
from utils import is_chat_message
from utils import reject_post_id
from utils import is_recent_post
@@ -612,6 +613,21 @@ def _get_edit_icon_html(base_dir: str, nickname: str, domain_full: str,
'
\n'
+ elif is_reminder(post_json_object):
+ # Edit a reminder
+ edit_post_str = 'Edit reminder'
+ if translate.get(edit_post_str):
+ edit_post_str = translate[edit_post_str]
+ edit_str += \
+ ' ' + \
+ '' + \
+ '
\n'
elif is_dm(post_json_object):
# Edit a DM
edit_post_str = 'Edit post'
diff --git a/webapp_utils.py b/webapp_utils.py
index 24b1ea0ed..45afec2f2 100644
--- a/webapp_utils.py
+++ b/webapp_utils.py
@@ -113,8 +113,6 @@ def csv_following_list(following_filename: str,
for following_address in following_list:
if not following_address:
continue
- if following_list_csv:
- following_list_csv += '\n'
following_nickname = \
get_nickname_from_actor(following_address)
@@ -139,9 +137,11 @@ def csv_following_list(following_filename: str,
person_notes = person_notes.replace('"', "'")
person_notes = person_notes.replace('\n', '
')
person_notes = person_notes.replace(' ', ' ')
+ if not following_list_csv:
+ following_list_csv = \
+ 'Account address,Show boosts,' + \
+ 'Notify on new posts,Languages,Notes\n'
following_list_csv += \
- 'Account address,Show boosts,' + \
- 'Notify on new posts,Languages,Notes\n' + \
following_address + ',' + \
str(announce_is_allowed).lower() + ',' + \
notify_on_new + ',' + \