Deprecate event posts

merge-requests/30/head
Bob Mottram 2021-07-24 11:13:40 +01:00
parent 234f7c1efc
commit d70badb76b
1 changed files with 22 additions and 137 deletions

View File

@ -11,7 +11,6 @@ import os
from utils import isPublicPostFromUrl from utils import isPublicPostFromUrl
from utils import getNicknameFromActor from utils import getNicknameFromActor
from utils import getDomainFromActor from utils import getDomainFromActor
from utils import getImageFormats
from utils import getMediaFormats from utils import getMediaFormats
from utils import getConfigParam from utils import getConfigParam
from utils import acctDir from utils import acctDir
@ -273,7 +272,6 @@ def htmlNewPost(cssCache: {}, mediaInstance: bool, translate: {},
pathBase = path.replace('/newreport', '').replace('/newpost', '') pathBase = path.replace('/newreport', '').replace('/newpost', '')
pathBase = pathBase.replace('/newblog', '').replace('/newshare', '') pathBase = pathBase.replace('/newblog', '').replace('/newshare', '')
pathBase = pathBase.replace('/newunlisted', '') pathBase = pathBase.replace('/newunlisted', '')
pathBase = pathBase.replace('/newevent', '')
pathBase = pathBase.replace('/newreminder', '') pathBase = pathBase.replace('/newreminder', '')
pathBase = pathBase.replace('/newfollowers', '').replace('/newdm', '') pathBase = pathBase.replace('/newfollowers', '').replace('/newdm', '')
@ -281,15 +279,6 @@ def htmlNewPost(cssCache: {}, mediaInstance: bool, translate: {},
newPostImageSection += \ newPostImageSection += \
editTextField(translate['Image description'], 'imageDescription', '') editTextField(translate['Image description'], 'imageDescription', '')
if path.endswith('/newevent'):
newPostImageSection += \
' <label class="labels">' + \
translate['Banner image'] + '</label>\n'
newPostImageSection += \
' <input type="file" id="attachpic" name="attachpic"'
newPostImageSection += \
' accept="' + getImageFormats() + '">\n'
else:
newPostImageSection += \ newPostImageSection += \
' <input type="file" id="attachpic" name="attachpic"' ' <input type="file" id="attachpic" name="attachpic"'
newPostImageSection += \ newPostImageSection += \
@ -334,12 +323,6 @@ def htmlNewPost(cssCache: {}, mediaInstance: bool, translate: {},
scopeIcon = 'scope_reminder.png' scopeIcon = 'scope_reminder.png'
scopeDescription = translate['Reminder'] scopeDescription = translate['Reminder']
endpoint = 'newreminder' endpoint = 'newreminder'
elif path.endswith('/newevent'):
scopeIcon = 'scope_event.png'
scopeDescription = translate['Event']
endpoint = 'newevent'
placeholderSubject = translate['Event name']
placeholderMessage = translate['Describe the event'] + '...'
elif path.endswith('/newreport'): elif path.endswith('/newreport'):
scopeIcon = 'scope_report.png' scopeIcon = 'scope_report.png'
scopeDescription = translate['Report'] scopeDescription = translate['Report']
@ -417,66 +400,8 @@ def htmlNewPost(cssCache: {}, mediaInstance: bool, translate: {},
if endpoint != 'newshare' and \ if endpoint != 'newshare' and \
endpoint != 'newreport' and \ endpoint != 'newreport' and \
endpoint != 'newquestion': endpoint != 'newquestion':
dateAndLocation = '<div class="container">\n' dateAndLocation = \
'<div class="container">\n' + \
if endpoint == 'newevent':
# event status
dateAndLocation += '<label class="labels">' + \
translate['Status of the event'] + ':</label><br>\n'
dateAndLocation += '<input type="radio" id="tentative" ' + \
'name="eventStatus" value="tentative">\n'
dateAndLocation += '<label class="labels" for="tentative">' + \
translate['Tentative'] + '</label><br>\n'
dateAndLocation += '<input type="radio" id="confirmed" ' + \
'name="eventStatus" value="confirmed" checked>\n'
dateAndLocation += '<label class="labels" for="confirmed">' + \
translate['Confirmed'] + '</label><br>\n'
dateAndLocation += '<input type="radio" id="cancelled" ' + \
'name="eventStatus" value="cancelled">\n'
dateAndLocation += '<label class="labels" for="cancelled">' + \
translate['Cancelled'] + '</label><br>\n'
dateAndLocation += '</div>\n'
dateAndLocation += '<div class="container">\n'
# maximum attendees
dateAndLocation += '<label class="labels" ' + \
'for="maximumAttendeeCapacity">' + \
translate['Maximum attendees'] + ':</label>\n'
dateAndLocation += '<input type="number" ' + \
'id="maximumAttendeeCapacity" ' + \
'name="maximumAttendeeCapacity" min="1" max="999999" ' + \
'value="100">\n'
dateAndLocation += '</div>\n'
dateAndLocation += '<div class="container">\n'
# event joining options
dateAndLocation += '<label class="labels">' + \
translate['Joining'] + ':</label><br>\n'
dateAndLocation += '<input type="radio" id="free" ' + \
'name="joinMode" value="free" checked>\n'
dateAndLocation += '<label class="labels" for="free">' + \
translate['Anyone can join'] + '</label><br>\n'
dateAndLocation += '<input type="radio" id="restricted" ' + \
'name="joinMode" value="restricted">\n'
dateAndLocation += '<label class="labels" for="female">' + \
translate['Apply to join'] + '</label><br>\n'
dateAndLocation += '<input type="radio" id="invite" ' + \
'name="joinMode" value="invite">\n'
dateAndLocation += '<label class="labels" for="other">' + \
translate['Invitation only'] + '</label>\n'
dateAndLocation += '</div>\n'
dateAndLocation += '<div class="container">\n'
# Event posts don't allow replies - they're just an announcement.
# They also have a few more checkboxes
dateAndLocation += \
'<p><input type="checkbox" class="profilecheckbox" ' + \
'name="privateEvent"><label class="labels"> ' + \
translate['This is a private event.'] + '</label></p>\n'
dateAndLocation += \
'<p><input type="checkbox" class="profilecheckbox" ' + \
'name="anonymousParticipationEnabled">' + \
'<label class="labels"> ' + \
translate['Allow anonymous participation.'] + '</label></p>\n'
else:
dateAndLocation += \
'<p><input type="checkbox" class="profilecheckbox" ' + \ '<p><input type="checkbox" class="profilecheckbox" ' + \
'name="commentsEnabled" checked><label class="labels"> ' + \ 'name="commentsEnabled" checked><label class="labels"> ' + \
translate['Allow replies.'] + '</label></p>\n' translate['Allow replies.'] + '</label></p>\n'
@ -487,13 +412,12 @@ def htmlNewPost(cssCache: {}, mediaInstance: bool, translate: {},
'name="pinToProfile"><label class="labels"> ' + \ 'name="pinToProfile"><label class="labels"> ' + \
translate['Pin this post to your profile.'] + '</label></p>\n' translate['Pin this post to your profile.'] + '</label></p>\n'
if not inReplyTo and endpoint != 'newevent': if not inReplyTo:
dateAndLocation += \ dateAndLocation += \
'<p><input type="checkbox" class="profilecheckbox" ' + \ '<p><input type="checkbox" class="profilecheckbox" ' + \
'name="schedulePost"><label class="labels"> ' + \ 'name="schedulePost"><label class="labels"> ' + \
translate['This is a scheduled post.'] + '</label></p>\n' translate['This is a scheduled post.'] + '</label></p>\n'
if endpoint != 'newevent':
dateAndLocation += \ dateAndLocation += \
'<p><img loading="lazy" alt="" title="" ' + \ '<p><img loading="lazy" alt="" title="" ' + \
'class="emojicalendar" src="/' + \ 'class="emojicalendar" src="/' + \
@ -506,45 +430,7 @@ def htmlNewPost(cssCache: {}, mediaInstance: bool, translate: {},
translate['Time'] + ':' translate['Time'] + ':'
dateAndLocation += \ dateAndLocation += \
'<input type="time" name="eventTime"></label></p>\n' '<input type="time" name="eventTime"></label></p>\n'
else:
dateAndLocation += '</div>\n'
dateAndLocation += '<div class="container">\n'
dateAndLocation += \
'<p><img loading="lazy" alt="" title="" ' + \
'class="emojicalendar" src="/' + \
'icons/calendar.png"/>\n'
# select start time for the event
dateAndLocation += '<label class="labels">' + \
translate['Start Date'] + ': </label>\n'
dateAndLocation += '<input type="date" name="eventDate">\n'
dateAndLocation += '<label class="labelsright">' + \
translate['Time'] + ':'
dateAndLocation += \
'<input type="time" name="eventTime"></label></p>\n'
# select end time for the event
dateAndLocation += \
'<br><img loading="lazy" alt="" title="" ' + \
'class="emojicalendar" src="/' + \
'icons/calendar.png"/>\n'
dateAndLocation += '<label class="labels">' + \
translate['End Date'] + ': </label>\n'
dateAndLocation += '<input type="date" name="endDate">\n'
dateAndLocation += '<label class="labelsright">' + \
translate['Time'] + ':'
dateAndLocation += \
'<input type="time" name="endTime"></label>\n'
if endpoint == 'newevent':
dateAndLocation += '</div>\n'
dateAndLocation += '<div class="container">\n'
dateAndLocation += '<br><label class="labels">' + \
translate['Moderation policy or code of conduct'] + \
': </label>\n'
dateAndLocation += \
' <textarea id="message" ' + \
'name="repliesModerationOption" style="height:' + \
str(messageBoxHeight) + 'px" spellcheck="true" ' + \
'autocomplete="on"></textarea>\n'
dateAndLocation += '</div>\n' dateAndLocation += '</div>\n'
dateAndLocation += '<div class="container">\n' dateAndLocation += '<div class="container">\n'
dateAndLocation += \ dateAndLocation += \
@ -588,7 +474,6 @@ def htmlNewPost(cssCache: {}, mediaInstance: bool, translate: {},
dropdownUnlistedSuffix = '/newunlisted' dropdownUnlistedSuffix = '/newunlisted'
dropdownFollowersSuffix = '/newfollowers' dropdownFollowersSuffix = '/newfollowers'
dropdownDMSuffix = '/newdm' dropdownDMSuffix = '/newdm'
dropdownEventSuffix = '/newevent'
dropdownReminderSuffix = '/newreminder' dropdownReminderSuffix = '/newreminder'
dropdownReportSuffix = '/newreport' dropdownReportSuffix = '/newreport'
if inReplyTo or mentions: if inReplyTo or mentions: