mirror of https://gitlab.com/bashrc2/epicyon
Checkbox for enabling newswire moderation of local blog posts
parent
69d4dc28f4
commit
6391d6aafa
33
daemon.py
33
daemon.py
|
@ -1811,6 +1811,39 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
self.server.POSTbusy = False
|
self.server.POSTbusy = False
|
||||||
return
|
return
|
||||||
|
|
||||||
|
# person options screen, permission to post to newswire
|
||||||
|
# See htmlPersonOptions
|
||||||
|
if '&submitModNewsPosts=' in optionsConfirmParams:
|
||||||
|
adminNickname = getConfigParam(self.server.baseDir, 'admin')
|
||||||
|
if (chooserNickname != optionsNickname and
|
||||||
|
(chooserNickname == adminNickname or
|
||||||
|
(isModerator(self.server.baseDir, chooserNickname) and
|
||||||
|
not isModerator(self.server.baseDir, optionsNickname)))):
|
||||||
|
modPostsToNews = None
|
||||||
|
if 'modNewsPosts=' in optionsConfirmParams:
|
||||||
|
modPostsToNews = \
|
||||||
|
optionsConfirmParams.split('modNewsPosts=')[1]
|
||||||
|
if '&' in modPostsToNews:
|
||||||
|
modPostsToNews = modPostsToNews.split('&')[0]
|
||||||
|
accountDir = self.server.baseDir + '/accounts/' + \
|
||||||
|
optionsNickname + '@' + optionsDomain
|
||||||
|
newswireModFilename = accountDir + '/.newswiremoderated'
|
||||||
|
if modPostsToNews != 'on':
|
||||||
|
if os.path.isfile(newswireModFilename):
|
||||||
|
os.remove(newswireModFilename)
|
||||||
|
else:
|
||||||
|
if os.path.isdir(accountDir):
|
||||||
|
modNewswireFile = open(newswireModFilename, "w+")
|
||||||
|
if modNewswireFile:
|
||||||
|
modNewswireFile.write('\n')
|
||||||
|
modNewswireFile.close()
|
||||||
|
self._redirect_headers(usersPath + '/' +
|
||||||
|
self.server.defaultTimeline +
|
||||||
|
'?page='+str(pageNumber), cookie,
|
||||||
|
callingDomain)
|
||||||
|
self.server.POSTbusy = False
|
||||||
|
return
|
||||||
|
|
||||||
# person options screen, block button
|
# person options screen, block button
|
||||||
# See htmlPersonOptions
|
# See htmlPersonOptions
|
||||||
if '&submitBlock=' in optionsConfirmParams:
|
if '&submitBlock=' in optionsConfirmParams:
|
||||||
|
|
|
@ -183,6 +183,7 @@ def htmlPersonOptions(defaultTimeline: str,
|
||||||
optionsStr += checkboxStr
|
optionsStr += checkboxStr
|
||||||
|
|
||||||
# checkbox for permission to post to newswire
|
# checkbox for permission to post to newswire
|
||||||
|
newswirePostsPermitted = False
|
||||||
if optionsDomainFull == domainFull:
|
if optionsDomainFull == domainFull:
|
||||||
adminNickname = getConfigParam(baseDir, 'admin')
|
adminNickname = getConfigParam(baseDir, 'admin')
|
||||||
if (nickname == adminNickname or
|
if (nickname == adminNickname or
|
||||||
|
@ -200,8 +201,26 @@ def htmlPersonOptions(defaultTimeline: str,
|
||||||
translate['Submit'] + '</button><br>\n'
|
translate['Submit'] + '</button><br>\n'
|
||||||
if os.path.isfile(newswireBlockedFilename):
|
if os.path.isfile(newswireBlockedFilename):
|
||||||
checkboxStr = checkboxStr.replace(' checked>', '>')
|
checkboxStr = checkboxStr.replace(' checked>', '>')
|
||||||
|
else:
|
||||||
|
newswirePostsPermitted = True
|
||||||
optionsStr += checkboxStr
|
optionsStr += checkboxStr
|
||||||
|
|
||||||
|
# whether blogs created by this account are moderated on the newswire
|
||||||
|
if newswirePostsPermitted:
|
||||||
|
moderatedFilename = \
|
||||||
|
baseDir + '/accounts/' + \
|
||||||
|
optionsNickname + '@' + optionsDomain + '/.newswiremoderated'
|
||||||
|
checkboxStr = \
|
||||||
|
' <input type="checkbox" ' + \
|
||||||
|
'class="profilecheckbox" name="modNewsPosts" checked> ' + \
|
||||||
|
translate['News posts are moderated'] + \
|
||||||
|
'\n <button type="submit" class="buttonsmall" ' + \
|
||||||
|
'name="submitModNewsPosts">' + \
|
||||||
|
translate['Submit'] + '</button><br>\n'
|
||||||
|
if not os.path.isfile(moderatedFilename):
|
||||||
|
checkboxStr = checkboxStr.replace(' checked>', '>')
|
||||||
|
optionsStr += checkboxStr
|
||||||
|
|
||||||
optionsStr += optionsLinkStr
|
optionsStr += optionsLinkStr
|
||||||
backPath = '/'
|
backPath = '/'
|
||||||
if nickname:
|
if nickname:
|
||||||
|
|
Loading…
Reference in New Issue