diff --git a/daemon.py b/daemon.py
index 06630263..1d3327b1 100644
--- a/daemon.py
+++ b/daemon.py
@@ -1688,7 +1688,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.POSTbusy = False
return
- # person on calendar checkbox on person option screen
+ # person options screen, on calendar checkbox
+ # See htmlPersonOptions
if '&submitOnCalendar=' in optionsConfirmParams:
onCalendar = None
if 'onCalendar=' in optionsConfirmParams:
@@ -1714,6 +1715,32 @@ class PubServer(BaseHTTPRequestHandler):
self.server.POSTbusy = False
return
+ # person options screen, permission to post to newswire
+ # See htmlPersonOptions
+ if '&submitPostToNews=' in optionsConfirmParams:
+ postsToNews = None
+ if 'postsToNews=' in optionsConfirmParams:
+ postsToNews = optionsConfirmParams.split('postsToNews=')[1]
+ if '&' in postsToNews:
+ postsToNews = postsToNews.split('&')[0]
+ newswireBlockedFilename = \
+ self.server.baseDir + '/accounts/' + \
+ optionsNickname + '@' + optionsDomain + '/.nonewswire'
+ if postsToNews == 'on':
+ if os.path.isfile(newswireBlockedFilename):
+ os.remove(newswireBlockedFilename)
+ else:
+ noNewswireFile = open(newswireBlockedFilename, "w+")
+ if noNewswireFile:
+ noNewswireFile.write('\n')
+ noNewswireFile.close()
+ self._redirect_headers(usersPath + '/' +
+ self.server.defaultTimeline +
+ '?page='+str(pageNumber), cookie,
+ callingDomain)
+ self.server.POSTbusy = False
+ return
+
# block person button on person option screen
if '&submitBlock=' in optionsConfirmParams:
if debug:
@@ -4446,6 +4473,7 @@ class PubServer(BaseHTTPRequestHandler):
PGPfingerprint = getPGPfingerprint(actorJson)
msg = htmlPersonOptions(self.server.translate,
baseDir, domain,
+ domainFull,
originPathStr,
optionsActor,
optionsProfileUrl,
diff --git a/posts.py b/posts.py
index fa3a4a3c..cd85388d 100644
--- a/posts.py
+++ b/posts.py
@@ -3531,8 +3531,9 @@ def rejectAnnounce(announceFilename: str):
"""
if not os.path.isfile(announceFilename + '.reject'):
rejectAnnounceFile = open(announceFilename + '.reject', "w+")
- rejectAnnounceFile.write('\n')
- rejectAnnounceFile.close()
+ if rejectAnnounceFile:
+ rejectAnnounceFile.write('\n')
+ rejectAnnounceFile.close()
def downloadAnnounce(session, baseDir: str, httpPrefix: str,
diff --git a/translations/ar.json b/translations/ar.json
index ca37a994..6d6e1ca2 100644
--- a/translations/ar.json
+++ b/translations/ar.json
@@ -308,5 +308,6 @@
"Read more...": "اقرأ أكثر...",
"Edit News Post": "تحرير منشور الأخبار",
"A list of editor nicknames. One per line.": "قائمة بأسماء المحرر. واحد في كل سطر.",
- "Site Editors": "محررو الموقع"
+ "Site Editors": "محررو الموقع",
+ "Allow news posts": "السماح بنشر الأخبار"
}
diff --git a/translations/ca.json b/translations/ca.json
index 78a90aff..33a3ee79 100644
--- a/translations/ca.json
+++ b/translations/ca.json
@@ -308,5 +308,6 @@
"Read more...": "Llegeix més...",
"Edit News Post": "Edita la publicació de notícies",
"A list of editor nicknames. One per line.": "Una llista de sobrenoms de l'editor. Un per línia.",
- "Site Editors": "Editors de llocs"
+ "Site Editors": "Editors de llocs",
+ "Allow news posts": "Permet publicacions de notícies"
}
diff --git a/translations/cy.json b/translations/cy.json
index a68b2456..d3ff8d09 100644
--- a/translations/cy.json
+++ b/translations/cy.json
@@ -308,5 +308,6 @@
"Read more...": "Darllen mwy...",
"Edit News Post": "Golygu News News",
"A list of editor nicknames. One per line.": "Rhestr o lysenwau golygydd. Un i bob llinell.",
- "Site Editors": "Golygyddion Safle"
+ "Site Editors": "Golygyddion Safle",
+ "Allow news posts": "Caniatáu swyddi newyddion"
}
diff --git a/translations/de.json b/translations/de.json
index 06bdd7e9..1129a9d1 100644
--- a/translations/de.json
+++ b/translations/de.json
@@ -308,5 +308,6 @@
"Read more...": "Weiterlesen...",
"Edit News Post": "Nachrichtenbeitrag bearbeiten",
"A list of editor nicknames. One per line.": "Eine Liste der Editor-Spitznamen. Eine pro Zeile.",
- "Site Editors": "Site-Editoren"
+ "Site Editors": "Site-Editoren",
+ "Allow news posts": "Nachrichtenbeiträge zulassen"
}
diff --git a/translations/en.json b/translations/en.json
index 9a10f674..de4893ba 100644
--- a/translations/en.json
+++ b/translations/en.json
@@ -308,5 +308,6 @@
"Read more...": "Read more...",
"Edit News Post": "Edit News Post",
"A list of editor nicknames. One per line.": "A list of editor nicknames. One per line.",
- "Site Editors": "Site Editors"
+ "Site Editors": "Site Editors",
+ "Allow news posts": "Allow news posts"
}
diff --git a/translations/es.json b/translations/es.json
index 6970b49b..f8c4d357 100644
--- a/translations/es.json
+++ b/translations/es.json
@@ -308,5 +308,6 @@
"Read more...": "Lee mas...",
"Edit News Post": "Editar publicación de noticias",
"A list of editor nicknames. One per line.": "Una lista de apodos de los editores. Uno por línea.",
- "Site Editors": "Editores del sitio"
+ "Site Editors": "Editores del sitio",
+ "Allow news posts": "Permitir publicaciones de noticias"
}
diff --git a/translations/fr.json b/translations/fr.json
index 65d77012..f9fdf312 100644
--- a/translations/fr.json
+++ b/translations/fr.json
@@ -308,5 +308,6 @@
"Read more...": "Lire la suite...",
"Edit News Post": "Modifier l'article d'actualité",
"A list of editor nicknames. One per line.": "Une liste de surnoms d'éditeur. Un par ligne.",
- "Site Editors": "Éditeurs du site"
+ "Site Editors": "Éditeurs du site",
+ "Allow news posts": "Autoriser les articles d'actualité"
}
diff --git a/translations/ga.json b/translations/ga.json
index d97ad267..56d3d52b 100644
--- a/translations/ga.json
+++ b/translations/ga.json
@@ -308,5 +308,6 @@
"Read more...": "Leigh Nios mo...",
"Edit News Post": "Cuir News Post in eagar",
"A list of editor nicknames. One per line.": "Liosta leasainmneacha eagarthóra. Ceann in aghaidh na líne.",
- "Site Editors": "Eagarthóirí Suímh"
+ "Site Editors": "Eagarthóirí Suímh",
+ "Allow news posts": "Ceadaigh poist nuachta"
}
diff --git a/translations/hi.json b/translations/hi.json
index f1ed564b..900ca3a0 100644
--- a/translations/hi.json
+++ b/translations/hi.json
@@ -308,5 +308,6 @@
"Read more...": "अधिक पढ़ें...",
"Edit News Post": "समाचार पोस्ट संपादित करें",
"A list of editor nicknames. One per line.": "संपादक उपनामों की एक सूची। प्रति पंक्ति एक।",
- "Site Editors": "साइट संपादकों"
+ "Site Editors": "साइट संपादकों",
+ "Allow news posts": "समाचार पोस्ट की अनुमति दें"
}
diff --git a/translations/it.json b/translations/it.json
index d01e1fd4..7ca28454 100644
--- a/translations/it.json
+++ b/translations/it.json
@@ -308,5 +308,6 @@
"Read more...": "Leggi di più...",
"Edit News Post": "Modifica post di notizie",
"A list of editor nicknames. One per line.": "Un elenco di soprannomi dell'editor. Uno per riga.",
- "Site Editors": "Editori del sito"
+ "Site Editors": "Editori del sito",
+ "Allow news posts": "Consenti post di notizie"
}
diff --git a/translations/ja.json b/translations/ja.json
index 1867a618..499ae2cb 100644
--- a/translations/ja.json
+++ b/translations/ja.json
@@ -308,5 +308,6 @@
"Read more...": "続きを読む...",
"Edit News Post": "ニュース投稿を編集する",
"A list of editor nicknames. One per line.": "編集者のニックネームのリスト。 1行に1つ。",
- "Site Editors": "サイト編集者"
+ "Site Editors": "サイト編集者",
+ "Allow news posts": "ニュース投稿を許可する"
}
diff --git a/translations/oc.json b/translations/oc.json
index 5f54ec75..9f2745a3 100644
--- a/translations/oc.json
+++ b/translations/oc.json
@@ -304,5 +304,6 @@
"Read more...": "Read more...",
"Edit News Post": "Edit News Post",
"A list of editor nicknames. One per line.": "A list of editor nicknames. One per line.",
- "Site Editors": "Site Editors"
+ "Site Editors": "Site Editors",
+ "Allow news posts": "Allow news posts"
}
diff --git a/translations/pt.json b/translations/pt.json
index 78832177..09643260 100644
--- a/translations/pt.json
+++ b/translations/pt.json
@@ -308,5 +308,6 @@
"Read more...": "Consulte Mais informação...",
"Edit News Post": "Editar Postagem de Notícias",
"A list of editor nicknames. One per line.": "Uma lista de apelidos de editores. Um por linha.",
- "Site Editors": "Editores do site"
+ "Site Editors": "Editores do site",
+ "Allow news posts": "Permitir postagens de notícias"
}
diff --git a/translations/ru.json b/translations/ru.json
index 798d51b1..a9d7e7a8 100644
--- a/translations/ru.json
+++ b/translations/ru.json
@@ -308,5 +308,6 @@
"Read more...": "Подробнее...",
"Edit News Post": "Редактировать новость",
"A list of editor nicknames. One per line.": "Список ников редакторов. По одному на строку.",
- "Site Editors": "Редакторы сайта"
+ "Site Editors": "Редакторы сайта",
+ "Allow news posts": "Разрешить публикации новостей"
}
diff --git a/translations/zh.json b/translations/zh.json
index ffd2dd28..7e6297e4 100644
--- a/translations/zh.json
+++ b/translations/zh.json
@@ -308,5 +308,6 @@
"Read more...": "阅读更多...",
"Edit News Post": "编辑新闻帖子",
"A list of editor nicknames. One per line.": "编辑者昵称列表。 每行一个。",
- "Site Editors": "网站编辑"
+ "Site Editors": "网站编辑",
+ "Allow news posts": "允许新闻发布"
}
diff --git a/webinterface.py b/webinterface.py
index bb3b7c4b..5891dda3 100644
--- a/webinterface.py
+++ b/webinterface.py
@@ -7275,7 +7275,8 @@ def htmlUnfollowConfirm(translate: {}, baseDir: str,
def htmlPersonOptions(translate: {}, baseDir: str,
- domain: str, originPathStr: str,
+ domain: str, domainFull: str,
+ originPathStr: str,
optionsActor: str,
optionsProfileUrl: str,
optionsLink: str,
@@ -7413,24 +7414,37 @@ def htmlPersonOptions(translate: {}, baseDir: str,
'name="submitPetname">' + \
translate['Submit'] + '
\n'
+ # checkbox for receiving calendar events
if isFollowingActor(baseDir, nickname, domain, optionsActor):
- if receivingCalendarEvents(baseDir, nickname, domain,
- optionsNickname, optionsDomainFull):
- optionsStr += \
+ checkboxStr = \
+ ' ' + \
+ translate['Receive calendar events from this account'] + \
+ '\n
\n'
+ if not receivingCalendarEvents(baseDir, nickname, domain,
+ optionsNickname, optionsDomainFull):
+ checkboxStr = checkboxStr.replace(' checked>', '>')
+ optionsStr += checkboxStr
+
+ # checkbox for permission to post to newswire
+ if optionsDomainFull == domainFull:
+ if isModerator(baseDir, nickname) and \
+ not isModerator(baseDir, optionsNickname):
+ newswireBlockedFilename = \
+ baseDir + '/accounts/' + \
+ optionsNickname + '@' + optionsDomain + '/.nonewswire'
+ checkboxStr = \
' ' + \
- translate['Receive calendar events from this account'] + \
+ 'class="profilecheckbox" name="postsToNews" checked> ' + \
+ translate['Allow news posts'] + \
'\n
\n'
- else:
- optionsStr += \
- ' ' + \
- translate['Receive calendar events from this account'] + \
- '\n
\n'
+ if os.path.isfile(newswireBlockedFilename):
+ checkboxStr = checkboxStr.replace(' checked>', '>')
+ optionsStr += checkboxStr
optionsStr += optionsLinkStr
optionsStr += \