Default moderation action

main
Bob Mottram 2020-12-09 23:30:15 +00:00
parent ee444946ef
commit b13be2f5b4
3 changed files with 40 additions and 23 deletions

View File

@ -8131,6 +8131,9 @@ class PubServer(BaseHTTPRequestHandler):
self.server.votingTimeMins) self.server.votingTimeMins)
fullWidthTimelineButtonHeader = \ fullWidthTimelineButtonHeader = \
self.server.fullWidthTimelineButtonHeader self.server.fullWidthTimelineButtonHeader
if '?' in nickname:
moderationActionStr = nickname.split('?')[1]
nickname = nickname.split('?')[0]
msg = \ msg = \
htmlModeration(self.server.cssCache, htmlModeration(self.server.cssCache,
self.server.defaultTimeline, self.server.defaultTimeline,
@ -8158,7 +8161,7 @@ class PubServer(BaseHTTPRequestHandler):
self.server.iconsAsButtons, self.server.iconsAsButtons,
self.server.rssIconAtTop, self.server.rssIconAtTop,
self.server.publishButtonAtTop, self.server.publishButtonAtTop,
authorized) authorized, moderationActionStr)
msg = msg.encode('utf-8') msg = msg.encode('utf-8')
self._set_headers('text/html', len(msg), self._set_headers('text/html', len(msg),
cookie, callingDomain) cookie, callingDomain)
@ -8181,6 +8184,8 @@ class PubServer(BaseHTTPRequestHandler):
if debug: if debug:
nickname = path.replace('/users/', '') nickname = path.replace('/users/', '')
nickname = nickname.replace('/moderation', '') nickname = nickname.replace('/moderation', '')
if '?' in nickname:
nickname = nickname.split('?')[0]
print('DEBUG: ' + nickname + print('DEBUG: ' + nickname +
' was not authorized to access ' + path) ' was not authorized to access ' + path)
if debug: if debug:
@ -11006,11 +11011,14 @@ class PubServer(BaseHTTPRequestHandler):
return return
blockDomain = self.path.split('/accountinfo?blockdomain=')[1] blockDomain = self.path.split('/accountinfo?blockdomain=')[1]
blockDomain = urllib.parse.unquote_plus(blockDomain.strip()) blockDomain = urllib.parse.unquote_plus(blockDomain.strip())
searchHandle = ''
if '?' in blockDomain:
searchHandle = '?' + blockDomain.split('?')[1]
blockDomain = blockDomain.split('?')[0]
addGlobalBlock(self.server.baseDir, nickname, blockDomain) addGlobalBlock(self.server.baseDir, nickname, blockDomain)
self.server.GETbusy = False self.server.GETbusy = False
# TODO this should go back to the account info screen self._redirect_headers('/users/' + nickname + '/moderation' +
self._redirect_headers('/users/' + nickname + '/moderation', searchHandle, cookie, callingDomain)
cookie, callingDomain)
return return
# unblock a domain from htmlAccountInfo # unblock a domain from htmlAccountInfo
@ -11024,11 +11032,14 @@ class PubServer(BaseHTTPRequestHandler):
return return
blockDomain = self.path.split('/accountinfo?unblockdomain=')[1] blockDomain = self.path.split('/accountinfo?unblockdomain=')[1]
blockDomain = urllib.parse.unquote_plus(blockDomain.strip()) blockDomain = urllib.parse.unquote_plus(blockDomain.strip())
searchHandle = ''
if '?' in blockDomain:
searchHandle = '?' + blockDomain.split('?')[1]
blockDomain = blockDomain.split('?')[0]
removeGlobalBlock(self.server.baseDir, nickname, blockDomain) removeGlobalBlock(self.server.baseDir, nickname, blockDomain)
self.server.GETbusy = False self.server.GETbusy = False
# TODO this should go back to the account info screen self._redirect_headers('/users/' + nickname + '/moderation' +
self._redirect_headers('/users/' + nickname + '/moderation', searchHandle, cookie, callingDomain)
cookie, callingDomain)
return return
# get the bookmarks timeline for a given person # get the bookmarks timeline for a given person

View File

@ -31,7 +31,7 @@ def htmlModeration(cssCache: {}, defaultTimeline: str,
iconsAsButtons: bool, iconsAsButtons: bool,
rssIconAtTop: bool, rssIconAtTop: bool,
publishButtonAtTop: bool, publishButtonAtTop: bool,
authorized: bool) -> str: authorized: bool, moderationActionStr: str) -> str:
"""Show the moderation feed as html """Show the moderation feed as html
This is what you see when selecting the "mod" timeline This is what you see when selecting the "mod" timeline
""" """
@ -45,7 +45,7 @@ def htmlModeration(cssCache: {}, defaultTimeline: str,
newswire, False, False, positiveVoting, newswire, False, False, positiveVoting,
showPublishAsIcon, fullWidthTimelineButtonHeader, showPublishAsIcon, fullWidthTimelineButtonHeader,
iconsAsButtons, rssIconAtTop, publishButtonAtTop, iconsAsButtons, rssIconAtTop, publishButtonAtTop,
authorized) authorized, moderationActionStr)
def htmlAccountInfo(cssCache: {}, translate: {}, def htmlAccountInfo(cssCache: {}, translate: {},

View File

@ -58,7 +58,8 @@ def htmlTimeline(cssCache: {}, defaultTimeline: str,
iconsAsButtons: bool, iconsAsButtons: bool,
rssIconAtTop: bool, rssIconAtTop: bool,
publishButtonAtTop: bool, publishButtonAtTop: bool,
authorized: bool) -> str: authorized: bool,
moderationActionStr: str) -> str:
"""Show the timeline as html """Show the timeline as html
""" """
enableTimingLog = False enableTimingLog = False
@ -441,8 +442,13 @@ def htmlTimeline(cssCache: {}, defaultTimeline: str,
idx = 'Nickname or URL. Block using *@domain or nickname@domain' idx = 'Nickname or URL. Block using *@domain or nickname@domain'
tlStr += \ tlStr += \
' <b>' + translate[idx] + '</b><br>\n' ' <b>' + translate[idx] + '</b><br>\n'
tlStr += ' <input type="text" ' + \ if moderationActionStr:
'name="moderationAction" value="" autofocus><br>\n' tlStr += ' <input type="text" ' + \
'name="moderationAction" value="' + \
moderationActionStr + '" autofocus><br>\n'
else:
tlStr += ' <input type="text" ' + \
'name="moderationAction" value="" autofocus><br>\n'
tlStr += \ tlStr += \
' <input type="submit" title="' + \ ' <input type="submit" title="' + \
translate['Remove the above item'] + \ translate['Remove the above item'] + \
@ -726,7 +732,7 @@ def htmlShares(cssCache: {}, defaultTimeline: str,
positiveVoting, showPublishAsIcon, positiveVoting, showPublishAsIcon,
fullWidthTimelineButtonHeader, fullWidthTimelineButtonHeader,
iconsAsButtons, rssIconAtTop, publishButtonAtTop, iconsAsButtons, rssIconAtTop, publishButtonAtTop,
authorized) authorized, None)
def htmlInbox(cssCache: {}, defaultTimeline: str, def htmlInbox(cssCache: {}, defaultTimeline: str,
@ -763,7 +769,7 @@ def htmlInbox(cssCache: {}, defaultTimeline: str,
positiveVoting, showPublishAsIcon, positiveVoting, showPublishAsIcon,
fullWidthTimelineButtonHeader, fullWidthTimelineButtonHeader,
iconsAsButtons, rssIconAtTop, publishButtonAtTop, iconsAsButtons, rssIconAtTop, publishButtonAtTop,
authorized) authorized, None)
def htmlBookmarks(cssCache: {}, defaultTimeline: str, def htmlBookmarks(cssCache: {}, defaultTimeline: str,
@ -800,7 +806,7 @@ def htmlBookmarks(cssCache: {}, defaultTimeline: str,
positiveVoting, showPublishAsIcon, positiveVoting, showPublishAsIcon,
fullWidthTimelineButtonHeader, fullWidthTimelineButtonHeader,
iconsAsButtons, rssIconAtTop, publishButtonAtTop, iconsAsButtons, rssIconAtTop, publishButtonAtTop,
authorized) authorized, None)
def htmlEvents(cssCache: {}, defaultTimeline: str, def htmlEvents(cssCache: {}, defaultTimeline: str,
@ -837,7 +843,7 @@ def htmlEvents(cssCache: {}, defaultTimeline: str,
positiveVoting, showPublishAsIcon, positiveVoting, showPublishAsIcon,
fullWidthTimelineButtonHeader, fullWidthTimelineButtonHeader,
iconsAsButtons, rssIconAtTop, publishButtonAtTop, iconsAsButtons, rssIconAtTop, publishButtonAtTop,
authorized) authorized, None)
def htmlInboxDMs(cssCache: {}, defaultTimeline: str, def htmlInboxDMs(cssCache: {}, defaultTimeline: str,
@ -869,7 +875,7 @@ def htmlInboxDMs(cssCache: {}, defaultTimeline: str,
showPublishAsIcon, showPublishAsIcon,
fullWidthTimelineButtonHeader, fullWidthTimelineButtonHeader,
iconsAsButtons, rssIconAtTop, publishButtonAtTop, iconsAsButtons, rssIconAtTop, publishButtonAtTop,
authorized) authorized, None)
def htmlInboxReplies(cssCache: {}, defaultTimeline: str, def htmlInboxReplies(cssCache: {}, defaultTimeline: str,
@ -902,7 +908,7 @@ def htmlInboxReplies(cssCache: {}, defaultTimeline: str,
positiveVoting, showPublishAsIcon, positiveVoting, showPublishAsIcon,
fullWidthTimelineButtonHeader, fullWidthTimelineButtonHeader,
iconsAsButtons, rssIconAtTop, publishButtonAtTop, iconsAsButtons, rssIconAtTop, publishButtonAtTop,
authorized) authorized, None)
def htmlInboxMedia(cssCache: {}, defaultTimeline: str, def htmlInboxMedia(cssCache: {}, defaultTimeline: str,
@ -935,7 +941,7 @@ def htmlInboxMedia(cssCache: {}, defaultTimeline: str,
positiveVoting, showPublishAsIcon, positiveVoting, showPublishAsIcon,
fullWidthTimelineButtonHeader, fullWidthTimelineButtonHeader,
iconsAsButtons, rssIconAtTop, publishButtonAtTop, iconsAsButtons, rssIconAtTop, publishButtonAtTop,
authorized) authorized, None)
def htmlInboxBlogs(cssCache: {}, defaultTimeline: str, def htmlInboxBlogs(cssCache: {}, defaultTimeline: str,
@ -968,7 +974,7 @@ def htmlInboxBlogs(cssCache: {}, defaultTimeline: str,
positiveVoting, showPublishAsIcon, positiveVoting, showPublishAsIcon,
fullWidthTimelineButtonHeader, fullWidthTimelineButtonHeader,
iconsAsButtons, rssIconAtTop, publishButtonAtTop, iconsAsButtons, rssIconAtTop, publishButtonAtTop,
authorized) authorized, None)
def htmlInboxFeatures(cssCache: {}, defaultTimeline: str, def htmlInboxFeatures(cssCache: {}, defaultTimeline: str,
@ -1001,7 +1007,7 @@ def htmlInboxFeatures(cssCache: {}, defaultTimeline: str,
positiveVoting, showPublishAsIcon, positiveVoting, showPublishAsIcon,
fullWidthTimelineButtonHeader, fullWidthTimelineButtonHeader,
iconsAsButtons, rssIconAtTop, publishButtonAtTop, iconsAsButtons, rssIconAtTop, publishButtonAtTop,
authorized) authorized, None)
def htmlInboxNews(cssCache: {}, defaultTimeline: str, def htmlInboxNews(cssCache: {}, defaultTimeline: str,
@ -1034,7 +1040,7 @@ def htmlInboxNews(cssCache: {}, defaultTimeline: str,
positiveVoting, showPublishAsIcon, positiveVoting, showPublishAsIcon,
fullWidthTimelineButtonHeader, fullWidthTimelineButtonHeader,
iconsAsButtons, rssIconAtTop, publishButtonAtTop, iconsAsButtons, rssIconAtTop, publishButtonAtTop,
authorized) authorized, None)
def htmlOutbox(cssCache: {}, defaultTimeline: str, def htmlOutbox(cssCache: {}, defaultTimeline: str,
@ -1068,4 +1074,4 @@ def htmlOutbox(cssCache: {}, defaultTimeline: str,
newswire, False, False, positiveVoting, newswire, False, False, positiveVoting,
showPublishAsIcon, fullWidthTimelineButtonHeader, showPublishAsIcon, fullWidthTimelineButtonHeader,
iconsAsButtons, rssIconAtTop, publishButtonAtTop, iconsAsButtons, rssIconAtTop, publishButtonAtTop,
authorized) authorized, None)