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

View File

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

View File

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