Turn off dropdown on new post screen under some single-purpose conditions

main
Bob Mottram 2021-02-05 12:14:54 +00:00
parent 12b7ab6503
commit 178fb27b5b
3 changed files with 28 additions and 12 deletions

View File

@ -2078,7 +2078,8 @@ class PubServer(BaseHTTPRequestHandler):
domainFull, domainFull,
self.server.defaultTimeline, self.server.defaultTimeline,
self.server.newswire, self.server.newswire,
self.server.themeName).encode('utf-8') self.server.themeName,
True).encode('utf-8')
msglen = len(msg) msglen = len(msg)
self._set_headers('text/html', msglen, self._set_headers('text/html', msglen,
cookie, callingDomain) cookie, callingDomain)
@ -2176,7 +2177,8 @@ class PubServer(BaseHTTPRequestHandler):
domainFull, domainFull,
self.server.defaultTimeline, self.server.defaultTimeline,
self.server.newswire, self.server.newswire,
self.server.themeName).encode('utf-8') self.server.themeName,
True).encode('utf-8')
msglen = len(msg) msglen = len(msg)
self._set_headers('text/html', msglen, self._set_headers('text/html', msglen,
cookie, callingDomain) cookie, callingDomain)
@ -9711,7 +9713,8 @@ class PubServer(BaseHTTPRequestHandler):
inReplyToUrl: str, replyToList: [], inReplyToUrl: str, replyToList: [],
shareDescription: str, replyPageNumber: int, shareDescription: str, replyPageNumber: int,
domain: str, domainFull: str, domain: str, domainFull: str,
GETstartTime, GETtimings: {}, cookie) -> bool: GETstartTime, GETtimings: {}, cookie,
noDropDown: bool) -> bool:
"""Shows the new post screen """Shows the new post screen
""" """
isNewPostEndpoint = False isNewPostEndpoint = False
@ -9740,7 +9743,8 @@ class PubServer(BaseHTTPRequestHandler):
domainFull, domainFull,
self.server.defaultTimeline, self.server.defaultTimeline,
self.server.newswire, self.server.newswire,
self.server.themeName).encode('utf-8') self.server.themeName,
noDropDown).encode('utf-8')
if not msg: if not msg:
print('Error replying to ' + inReplyToUrl) print('Error replying to ' + inReplyToUrl)
self._404() self._404()
@ -9983,6 +9987,12 @@ class PubServer(BaseHTTPRequestHandler):
if self.path.startswith('/@'): if self.path.startswith('/@'):
self.path = self.path.replace('/@', '/users/') self.path = self.path.replace('/@', '/users/')
# turn off dropdowns on new post screen
noDropDown = False
if self.path.endswith('?nodropdown'):
noDropDown = True
self.path = self.path.replace('?nodropdown', '')
# redirect music to #nowplaying list # redirect music to #nowplaying list
if self.path == '/music' or self.path == '/nowplaying': if self.path == '/music' or self.path == '/nowplaying':
self.path = '/tags/nowplaying' self.path = '/tags/nowplaying'
@ -11556,7 +11566,7 @@ class PubServer(BaseHTTPRequestHandler):
self.server.domain, self.server.domain,
self.server.domainFull, self.server.domainFull,
GETstartTime, GETtimings, GETstartTime, GETtimings,
cookie): cookie, noDropDown):
return return
self._benchmarkGETtimings(GETstartTime, GETtimings, self._benchmarkGETtimings(GETstartTime, GETtimings,

View File

@ -68,7 +68,7 @@ def getRightColumnContent(baseDir: str, nickname: str, domainFull: str,
titleStr = translate['Publish a news article'] titleStr = translate['Publish a news article']
publishButtonStr = \ publishButtonStr = \
' <a href="' + \ ' <a href="' + \
'/users/' + nickname + '/newblog" ' + \ '/users/' + nickname + '/newblog?nodropdown" ' + \
'title="' + titleStr + '">' + \ 'title="' + titleStr + '">' + \
'<button class="publishbtn">' + \ '<button class="publishbtn">' + \
translate['Publish'] + '</button></a>\n' translate['Publish'] + '</button></a>\n'
@ -167,7 +167,7 @@ def getRightColumnContent(baseDir: str, nickname: str, domainFull: str,
titleStr = translate['Publish a news article'] titleStr = translate['Publish a news article']
htmlStr += \ htmlStr += \
' <a href="' + \ ' <a href="' + \
'/users/' + nickname + '/newblog">' + \ '/users/' + nickname + '/newblog?nodropdown">' + \
'<img class="' + editImageClass + \ '<img class="' + editImageClass + \
'" loading="lazy" alt="' + \ '" loading="lazy" alt="' + \
titleStr + '" title="' + \ titleStr + '" title="' + \

View File

@ -71,7 +71,8 @@ def _htmlNewPostDropDown(scopeIcon: str, scopeDescription: str,
dropdownDMSuffix: str, dropdownDMSuffix: str,
dropdownReminderSuffix: str, dropdownReminderSuffix: str,
dropdownEventSuffix: str, dropdownEventSuffix: str,
dropdownReportSuffix: str) -> str: dropdownReportSuffix: str,
noDropDown: bool) -> str:
"""Returns the html for a drop down list of new post types """Returns the html for a drop down list of new post types
""" """
dropDownContent = '<nav><div class="newPostDropdown">\n' dropDownContent = '<nav><div class="newPostDropdown">\n'
@ -82,8 +83,12 @@ def _htmlNewPostDropDown(scopeIcon: str, scopeDescription: str,
dropDownContent += ' <img loading="lazy" alt="" title="" src="/' + \ dropDownContent += ' <img loading="lazy" alt="" title="" src="/' + \
'icons/' + scopeIcon + '"/><b>' + \ 'icons/' + scopeIcon + '"/><b>' + \
scopeDescription + '</b></label>\n' scopeDescription + '</b></label>\n'
dropDownContent += ' <ul>\n'
if noDropDown:
dropDownContent += '</div></nav>\n'
return dropDownContent
dropDownContent += ' <ul>\n'
if showPublicOnDropdown: if showPublicOnDropdown:
dropDownContent += \ dropDownContent += \
'<li><a href="' + pathBase + dropdownNewPostSuffix + \ '<li><a href="' + pathBase + dropdownNewPostSuffix + \
@ -156,8 +161,8 @@ def _htmlNewPostDropDown(scopeIcon: str, scopeDescription: str,
'icons/scope_question.png"/><b>' + \ 'icons/scope_question.png"/><b>' + \
translate['Question'] + '</b><br>' + \ translate['Question'] + '</b><br>' + \
translate['Ask a question'] + '</a></li>\n' translate['Ask a question'] + '</a></li>\n'
dropDownContent += ' </ul>\n' dropDownContent += ' </ul>\n'
dropDownContent += '</div></nav>\n' dropDownContent += '</div></nav>\n'
return dropDownContent return dropDownContent
@ -171,7 +176,7 @@ def htmlNewPost(cssCache: {}, mediaInstance: bool, translate: {},
nickname: str, domain: str, nickname: str, domain: str,
domainFull: str, domainFull: str,
defaultTimeline: str, newswire: {}, defaultTimeline: str, newswire: {},
theme: str) -> str: theme: str, noDropDown: bool) -> str:
"""New post screen """New post screen
""" """
replyStr = '' replyStr = ''
@ -641,7 +646,8 @@ def htmlNewPost(cssCache: {}, mediaInstance: bool, translate: {},
dropdownDMSuffix, dropdownDMSuffix,
dropdownReminderSuffix, dropdownReminderSuffix,
dropdownEventSuffix, dropdownEventSuffix,
dropdownReportSuffix) dropdownReportSuffix,
noDropDown)
else: else:
if not shareDescription: if not shareDescription:
# reporting a post to moderator # reporting a post to moderator