Updating enabled cw lists

main
Bob Mottram 2021-10-21 20:45:39 +01:00
parent 2ad58b798e
commit 88c4b14ca3
2 changed files with 28 additions and 27 deletions

View File

@ -5696,9 +5696,7 @@ class PubServer(BaseHTTPRequestHandler):
except BaseException:
pass
# save blocked user agents
# This is admin lebel and global to the instance
if path.startswith('/users/' + adminNickname + '/'):
if isModerator(self.server.baseDir, nickname):
# set selected content warning lists
newListsEnabled = ''
for name, item in self.server.CWlists.items():
@ -5715,6 +5713,7 @@ class PubServer(BaseHTTPRequestHandler):
"listsEnabled",
newListsEnabled)
# save blocked user agents
userAgentsBlocked = []
if fields.get('userAgentsBlockedStr'):
userAgentsBlockedStr = \

View File

@ -34,6 +34,7 @@ from person import personBoxJson
from person import getActorJson
from person import getPersonAvatarUrl
from webfinger import webfingerHandle
from posts import isModerator
from posts import parseUserFeed
from posts import getPersonBox
from posts import isCreateInsideAnnounce
@ -1667,31 +1668,32 @@ def _htmlEditProfileFiltering(baseDir: str, nickname: str, domain: str,
'style="height:200px" spellcheck="false">' + \
allowedInstancesStr + '</textarea>\n'
userAgentsBlockedStr = ''
for ua in userAgentsBlocked:
if userAgentsBlockedStr:
userAgentsBlockedStr += '\n'
userAgentsBlockedStr += ua
editProfileForm += \
editTextArea(translate['Blocked User Agents'],
'userAgentsBlockedStr', userAgentsBlockedStr,
200, '', False)
CWlistsStr = ''
for name, item in CWlists.items():
variableName = getCWlistVariable(name)
listIsEnabled = False
if listsEnabled:
if name in listsEnabled:
listIsEnabled = True
if translate.get(name):
name = translate[name]
CWlistsStr += editCheckBox(name, variableName, listIsEnabled)
if CWlistsStr:
idx = 'Add content warnings for the following sites'
if isModerator(baseDir, nickname):
userAgentsBlockedStr = ''
for ua in userAgentsBlocked:
if userAgentsBlockedStr:
userAgentsBlockedStr += '\n'
userAgentsBlockedStr += ua
editProfileForm += \
'<label class="labels">' + translate[idx] + ':</label>\n' + \
'<br>' + CWlistsStr
editTextArea(translate['Blocked User Agents'],
'userAgentsBlockedStr', userAgentsBlockedStr,
200, '', False)
CWlistsStr = ''
for name, item in CWlists.items():
variableName = getCWlistVariable(name)
listIsEnabled = False
if listsEnabled:
if name in listsEnabled:
listIsEnabled = True
if translate.get(name):
name = translate[name]
CWlistsStr += editCheckBox(name, variableName, listIsEnabled)
if CWlistsStr:
idx = 'Add content warnings for the following sites'
editProfileForm += \
'<label class="labels">' + translate[idx] + ':</label>\n' + \
'<br>' + CWlistsStr
editProfileForm += endEditSection()
return editProfileForm