Edit filtered words for newswire

merge-requests/8/head
Bob Mottram 2020-10-17 21:12:49 +01:00
parent 651f2b41e4
commit 996499a223
2 changed files with 27 additions and 0 deletions

View File

@ -2973,6 +2973,17 @@ class PubServer(BaseHTTPRequestHandler):
if os.path.isfile(newswireFilename):
os.remove(newswireFilename)
# save filtered words list for the newswire
filterNewswireFilename = \
baseDir + '/accounts/' + \
'news@' + domain + '/filters.txt'
if fields.get('filteredWordsNewswire'):
with open(filterNewswireFilename, 'w+') as filterfile:
filterfile.write(fields['filteredWordsNewswire'])
else:
if os.path.isfile(filterNewswireFilename):
os.remove(filterNewswireFilename)
newswireTrustedFilename = baseDir + '/accounts/newswiretrusted.txt'
if fields.get('trustedNewswire'):
newswireTrusted = fields['trustedNewswire']

View File

@ -1345,6 +1345,22 @@ def htmlEditNewswire(translate: {}, baseDir: str, path: str,
' <textarea id="message" name="editedNewswire" ' + \
'style="height:500px">' + newswireStr + '</textarea>'
filterStr = ''
filterFilename = \
baseDir + '/accounts/news@' + domain + '/filters.txt'
if os.path.isfile(filterFilename):
with open(filterFilename, 'r') as filterfile:
filterStr = filterfile.read()
editNewswireForm += \
' <br><b><label class="labels">' + \
translate['Filtered words'] + '</label></b>\n'
editNewswireForm += ' <br><label class="labels">' + \
translate['One per line'] + '</label>\n'
editNewswireForm += ' <textarea id="message" ' + \
'name="filteredWordsNewswire" style="height:200px">' + \
filterStr + '</textarea>\n'
editNewswireForm += \
'</div>'