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

View File

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

View File

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