Moderators can change newswire posting permission from person options

main
Bob Mottram 2020-10-14 10:35:14 +01:00
parent 660eea7c49
commit 48aff7b61e
18 changed files with 91 additions and 33 deletions

View File

@ -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,

View File

@ -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,

View File

@ -308,5 +308,6 @@
"Read more...": "اقرأ أكثر...",
"Edit News Post": "تحرير منشور الأخبار",
"A list of editor nicknames. One per line.": "قائمة بأسماء المحرر. واحد في كل سطر.",
"Site Editors": "محررو الموقع"
"Site Editors": "محررو الموقع",
"Allow news posts": "السماح بنشر الأخبار"
}

View File

@ -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"
}

View File

@ -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"
}

View File

@ -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"
}

View File

@ -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"
}

View File

@ -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"
}

View File

@ -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é"
}

View File

@ -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"
}

View File

@ -308,5 +308,6 @@
"Read more...": "अधिक पढ़ें...",
"Edit News Post": "समाचार पोस्ट संपादित करें",
"A list of editor nicknames. One per line.": "संपादक उपनामों की एक सूची। प्रति पंक्ति एक।",
"Site Editors": "साइट संपादकों"
"Site Editors": "साइट संपादकों",
"Allow news posts": "समाचार पोस्ट की अनुमति दें"
}

View File

@ -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"
}

View File

@ -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": "ニュース投稿を許可する"
}

View File

@ -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"
}

View File

@ -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"
}

View File

@ -308,5 +308,6 @@
"Read more...": "Подробнее...",
"Edit News Post": "Редактировать новость",
"A list of editor nicknames. One per line.": "Список ников редакторов. По одному на строку.",
"Site Editors": "Редакторы сайта"
"Site Editors": "Редакторы сайта",
"Allow news posts": "Разрешить публикации новостей"
}

View File

@ -308,5 +308,6 @@
"Read more...": "阅读更多...",
"Edit News Post": "编辑新闻帖子",
"A list of editor nicknames. One per line.": "编辑者昵称列表。 每行一个。",
"Site Editors": "网站编辑"
"Site Editors": "网站编辑",
"Allow news posts": "允许新闻发布"
}

View File

@ -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'] + '</button><br>\n'
# checkbox for receiving calendar events
if isFollowingActor(baseDir, nickname, domain, optionsActor):
if receivingCalendarEvents(baseDir, nickname, domain,
optionsNickname, optionsDomainFull):
optionsStr += \
checkboxStr = \
' <input type="checkbox" ' + \
'class="profilecheckbox" name="onCalendar" checked> ' + \
translate['Receive calendar events from this account'] + \
'\n <button type="submit" class="buttonsmall" ' + \
'name="submitOnCalendar">' + \
translate['Submit'] + '</button><br>\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 = \
' <input type="checkbox" ' + \
'class="profilecheckbox" name="onCalendar" checked> ' + \
translate['Receive calendar events from this account'] + \
'class="profilecheckbox" name="postsToNews" checked> ' + \
translate['Allow news posts'] + \
'\n <button type="submit" class="buttonsmall" ' + \
'name="submitOnCalendar">' + \
translate['Submit'] + '</button><br>\n'
else:
optionsStr += \
' <input type="checkbox" ' + \
'class="profilecheckbox" name="onCalendar"> ' + \
translate['Receive calendar events from this account'] + \
'\n <button type="submit" class="buttonsmall" ' + \
'name="submitOnCalendar">' + \
'name="submitPostToNews">' + \
translate['Submit'] + '</button><br>\n'
if os.path.isfile(newswireBlockedFilename):
checkboxStr = checkboxStr.replace(' checked>', '>')
optionsStr += checkboxStr
optionsStr += optionsLinkStr
optionsStr += \