2020-11-09 22:44:03 +00:00
|
|
|
__filename__ = "webapp_person_options.py"
|
|
|
|
__author__ = "Bob Mottram"
|
|
|
|
__license__ = "AGPL3+"
|
2021-01-26 10:07:42 +00:00
|
|
|
__version__ = "1.2.0"
|
2020-11-09 22:44:03 +00:00
|
|
|
__maintainer__ = "Bob Mottram"
|
2021-09-10 16:14:50 +00:00
|
|
|
__email__ = "bob@libreserver.org"
|
2020-11-09 22:44:03 +00:00
|
|
|
__status__ = "Production"
|
2021-06-15 15:08:12 +00:00
|
|
|
__module_group__ = "Web Interface"
|
2020-11-09 22:44:03 +00:00
|
|
|
|
|
|
|
import os
|
|
|
|
from shutil import copyfile
|
2021-12-29 21:55:09 +00:00
|
|
|
from petnames import get_pet_name
|
|
|
|
from person import is_person_snoozed
|
2021-12-28 19:33:29 +00:00
|
|
|
from posts import is_moderator
|
2021-12-26 12:45:03 +00:00
|
|
|
from utils import get_full_domain
|
2021-12-26 14:08:58 +00:00
|
|
|
from utils import get_config_param
|
2021-12-26 12:54:51 +00:00
|
|
|
from utils import is_dormant
|
2021-12-27 15:43:22 +00:00
|
|
|
from utils import remove_html
|
2021-12-27 19:05:25 +00:00
|
|
|
from utils import get_domain_from_actor
|
2021-12-27 22:19:18 +00:00
|
|
|
from utils import get_nickname_from_actor
|
2021-12-26 12:07:40 +00:00
|
|
|
from utils import is_featured_writer
|
2021-12-26 12:02:29 +00:00
|
|
|
from utils import acct_dir
|
2021-12-29 21:55:09 +00:00
|
|
|
from blocking import is_blocked
|
|
|
|
from follow import is_follower_of_person
|
2021-12-28 20:32:11 +00:00
|
|
|
from follow import is_following_actor
|
2021-12-29 21:55:09 +00:00
|
|
|
from followingCalendar import receiving_calendar_events
|
|
|
|
from notifyOnPost import notify_when_person_posts
|
|
|
|
from webapp_utils import html_header_with_external_style
|
|
|
|
from webapp_utils import html_footer
|
|
|
|
from webapp_utils import get_broken_link_substitute
|
|
|
|
from webapp_utils import html_keyboard_navigation
|
2020-11-09 22:44:03 +00:00
|
|
|
|
|
|
|
|
2021-12-29 21:55:09 +00:00
|
|
|
def html_person_options(defaultTimeline: str,
|
|
|
|
css_cache: {}, translate: {}, base_dir: str,
|
|
|
|
domain: str, domain_full: str,
|
|
|
|
originPathStr: str,
|
|
|
|
optionsActor: str,
|
|
|
|
optionsProfileUrl: str,
|
|
|
|
optionsLink: str,
|
|
|
|
pageNumber: int,
|
|
|
|
donateUrl: str,
|
|
|
|
webAddress: str,
|
|
|
|
xmppAddress: str,
|
|
|
|
matrixAddress: str,
|
|
|
|
ssbAddress: str,
|
|
|
|
blogAddress: str,
|
|
|
|
toxAddress: str,
|
|
|
|
briarAddress: str,
|
|
|
|
jamiAddress: str,
|
2021-12-30 20:48:38 +00:00
|
|
|
cwtch_address: str,
|
2021-12-29 21:55:09 +00:00
|
|
|
EnigmaPubKey: str,
|
|
|
|
PGPpubKey: str,
|
|
|
|
PGPfingerprint: str,
|
|
|
|
emailAddress: str,
|
|
|
|
dormant_months: int,
|
|
|
|
backToPath: str,
|
|
|
|
lockedAccount: bool,
|
|
|
|
movedTo: str,
|
|
|
|
alsoKnownAs: [],
|
|
|
|
text_mode_banner: str,
|
|
|
|
news_instance: bool,
|
|
|
|
authorized: bool,
|
|
|
|
accessKeys: {},
|
|
|
|
isGroup: bool) -> str:
|
2020-11-09 22:44:03 +00:00
|
|
|
"""Show options for a person: view/follow/block/report
|
|
|
|
"""
|
2021-12-27 19:05:25 +00:00
|
|
|
optionsDomain, optionsPort = get_domain_from_actor(optionsActor)
|
2021-12-26 12:45:03 +00:00
|
|
|
optionsDomainFull = get_full_domain(optionsDomain, optionsPort)
|
2020-11-09 22:44:03 +00:00
|
|
|
|
2021-12-25 16:17:53 +00:00
|
|
|
if os.path.isfile(base_dir + '/accounts/options-background-custom.jpg'):
|
|
|
|
if not os.path.isfile(base_dir + '/accounts/options-background.jpg'):
|
|
|
|
copyfile(base_dir + '/accounts/options-background.jpg',
|
|
|
|
base_dir + '/accounts/options-background.jpg')
|
2020-11-09 22:44:03 +00:00
|
|
|
|
2020-12-13 12:57:57 +00:00
|
|
|
dormant = False
|
2020-11-09 22:44:03 +00:00
|
|
|
followStr = 'Follow'
|
2021-09-21 18:20:20 +00:00
|
|
|
if isGroup:
|
|
|
|
followStr = 'Join'
|
2020-11-09 22:44:03 +00:00
|
|
|
blockStr = 'Block'
|
|
|
|
nickname = None
|
|
|
|
optionsNickname = None
|
2021-01-02 11:37:24 +00:00
|
|
|
followsYou = False
|
2020-11-09 22:44:03 +00:00
|
|
|
if originPathStr.startswith('/users/'):
|
|
|
|
nickname = originPathStr.split('/users/')[1]
|
|
|
|
if '/' in nickname:
|
|
|
|
nickname = nickname.split('/')[0]
|
|
|
|
if '?' in nickname:
|
|
|
|
nickname = nickname.split('?')[0]
|
2021-12-27 19:05:25 +00:00
|
|
|
followerDomain, followerPort = get_domain_from_actor(optionsActor)
|
2021-12-28 20:32:11 +00:00
|
|
|
if is_following_actor(base_dir, nickname, domain, optionsActor):
|
2020-11-09 22:44:03 +00:00
|
|
|
followStr = 'Unfollow'
|
2021-09-21 18:20:20 +00:00
|
|
|
if isGroup:
|
|
|
|
followStr = 'Leave'
|
2020-12-13 12:57:57 +00:00
|
|
|
dormant = \
|
2021-12-26 12:54:51 +00:00
|
|
|
is_dormant(base_dir, nickname, domain, optionsActor,
|
|
|
|
dormant_months)
|
2020-11-09 22:44:03 +00:00
|
|
|
|
2021-12-27 22:19:18 +00:00
|
|
|
optionsNickname = get_nickname_from_actor(optionsActor)
|
2021-12-26 12:45:03 +00:00
|
|
|
optionsDomainFull = get_full_domain(optionsDomain, optionsPort)
|
2021-01-02 11:37:24 +00:00
|
|
|
followsYou = \
|
2021-12-29 21:55:09 +00:00
|
|
|
is_follower_of_person(base_dir,
|
|
|
|
nickname, domain,
|
|
|
|
optionsNickname, optionsDomainFull)
|
|
|
|
if is_blocked(base_dir, nickname, domain,
|
|
|
|
optionsNickname, optionsDomainFull):
|
2020-11-09 22:44:03 +00:00
|
|
|
blockStr = 'Block'
|
|
|
|
|
|
|
|
optionsLinkStr = ''
|
|
|
|
if optionsLink:
|
|
|
|
optionsLinkStr = \
|
|
|
|
' <input type="hidden" name="postUrl" value="' + \
|
|
|
|
optionsLink + '">\n'
|
2021-12-25 16:17:53 +00:00
|
|
|
cssFilename = base_dir + '/epicyon-options.css'
|
|
|
|
if os.path.isfile(base_dir + '/options.css'):
|
|
|
|
cssFilename = base_dir + '/options.css'
|
2020-11-09 22:44:03 +00:00
|
|
|
|
|
|
|
# To snooze, or not to snooze? That is the question
|
|
|
|
snoozeButtonStr = 'Snooze'
|
|
|
|
if nickname:
|
2021-12-29 21:55:09 +00:00
|
|
|
if is_person_snoozed(base_dir, nickname, domain, optionsActor):
|
2020-11-09 22:44:03 +00:00
|
|
|
snoozeButtonStr = 'Unsnooze'
|
|
|
|
|
|
|
|
donateStr = ''
|
|
|
|
if donateUrl:
|
|
|
|
donateStr = \
|
|
|
|
' <a href="' + donateUrl + \
|
2021-02-12 19:30:22 +00:00
|
|
|
' tabindex="-1""><button class="button" name="submitDonate">' + \
|
2020-11-09 22:44:03 +00:00
|
|
|
translate['Donate'] + '</button></a>\n'
|
|
|
|
|
2021-01-11 19:46:21 +00:00
|
|
|
instanceTitle = \
|
2021-12-26 14:08:58 +00:00
|
|
|
get_config_param(base_dir, 'instanceTitle')
|
2021-12-29 21:55:09 +00:00
|
|
|
optionsStr = \
|
|
|
|
html_header_with_external_style(cssFilename, instanceTitle, None)
|
|
|
|
optionsStr += html_keyboard_navigation(text_mode_banner, {}, {})
|
2020-11-09 22:44:03 +00:00
|
|
|
optionsStr += '<br><br>\n'
|
|
|
|
optionsStr += '<div class="options">\n'
|
|
|
|
optionsStr += ' <div class="optionsAvatar">\n'
|
|
|
|
optionsStr += ' <center>\n'
|
|
|
|
optionsStr += ' <a href="' + optionsActor + '">\n'
|
|
|
|
optionsStr += ' <img loading="lazy" src="' + optionsProfileUrl + \
|
2021-12-29 21:55:09 +00:00
|
|
|
'" alt="" ' + get_broken_link_substitute() + '/></a>\n'
|
2021-12-27 22:19:18 +00:00
|
|
|
handle = get_nickname_from_actor(optionsActor) + '@' + optionsDomain
|
2020-12-13 12:57:57 +00:00
|
|
|
handleShown = handle
|
2021-01-02 11:06:08 +00:00
|
|
|
if lockedAccount:
|
|
|
|
handleShown += '🔒'
|
2021-01-12 11:08:54 +00:00
|
|
|
if movedTo:
|
|
|
|
handleShown += ' ⌂'
|
2020-12-13 12:57:57 +00:00
|
|
|
if dormant:
|
2020-12-13 13:43:09 +00:00
|
|
|
handleShown += ' 💤'
|
2020-11-09 22:44:03 +00:00
|
|
|
optionsStr += \
|
|
|
|
' <p class="optionsText">' + translate['Options for'] + \
|
2020-12-13 12:57:57 +00:00
|
|
|
' @' + handleShown + '</p>\n'
|
2021-01-02 11:37:24 +00:00
|
|
|
if followsYou:
|
|
|
|
optionsStr += \
|
|
|
|
' <p class="optionsText">' + translate['Follows you'] + '</p>\n'
|
2021-01-12 11:08:54 +00:00
|
|
|
if movedTo:
|
2021-12-27 22:19:18 +00:00
|
|
|
newNickname = get_nickname_from_actor(movedTo)
|
2021-12-27 19:05:25 +00:00
|
|
|
newDomain, newPort = get_domain_from_actor(movedTo)
|
2021-01-12 11:08:54 +00:00
|
|
|
if newNickname and newDomain:
|
|
|
|
newHandle = newNickname + '@' + newDomain
|
|
|
|
optionsStr += \
|
|
|
|
' <p class="optionsText">' + \
|
|
|
|
translate['New account'] + \
|
2021-01-12 13:18:08 +00:00
|
|
|
': <a href="' + movedTo + '">@' + newHandle + '</a></p>\n'
|
2021-01-22 20:35:14 +00:00
|
|
|
elif alsoKnownAs:
|
2021-01-23 10:03:50 +00:00
|
|
|
otherAccountsHtml = \
|
2021-01-22 20:35:14 +00:00
|
|
|
' <p class="optionsText">' + \
|
|
|
|
translate['Other accounts'] + ': '
|
|
|
|
|
2021-01-23 10:03:50 +00:00
|
|
|
ctr = 0
|
2021-01-22 20:35:14 +00:00
|
|
|
if isinstance(alsoKnownAs, list):
|
|
|
|
for altActor in alsoKnownAs:
|
2021-01-23 10:03:50 +00:00
|
|
|
if altActor == optionsActor:
|
|
|
|
continue
|
2021-01-22 20:35:14 +00:00
|
|
|
if ctr > 0:
|
2021-01-23 10:03:50 +00:00
|
|
|
otherAccountsHtml += ' '
|
2021-01-22 20:35:14 +00:00
|
|
|
ctr += 1
|
2021-12-27 19:05:25 +00:00
|
|
|
altDomain, altPort = get_domain_from_actor(altActor)
|
2021-01-23 10:03:50 +00:00
|
|
|
otherAccountsHtml += \
|
2021-01-22 20:35:14 +00:00
|
|
|
'<a href="' + altActor + '">' + altDomain + '</a>'
|
|
|
|
elif isinstance(alsoKnownAs, str):
|
2021-01-23 10:03:50 +00:00
|
|
|
if alsoKnownAs != optionsActor:
|
|
|
|
ctr += 1
|
2021-12-27 19:05:25 +00:00
|
|
|
altDomain, altPort = get_domain_from_actor(alsoKnownAs)
|
2021-01-23 10:03:50 +00:00
|
|
|
otherAccountsHtml += \
|
|
|
|
'<a href="' + alsoKnownAs + '">' + altDomain + '</a>'
|
|
|
|
otherAccountsHtml += '</p>\n'
|
|
|
|
if ctr > 0:
|
|
|
|
optionsStr += otherAccountsHtml
|
2020-11-09 22:44:03 +00:00
|
|
|
if emailAddress:
|
|
|
|
optionsStr += \
|
|
|
|
'<p class="imText">' + translate['Email'] + \
|
|
|
|
': <a href="mailto:' + \
|
2021-12-27 15:43:22 +00:00
|
|
|
emailAddress + '">' + remove_html(emailAddress) + '</a></p>\n'
|
2020-11-09 22:44:03 +00:00
|
|
|
if xmppAddress:
|
|
|
|
optionsStr += \
|
|
|
|
'<p class="imText">' + translate['XMPP'] + \
|
2021-12-27 15:43:22 +00:00
|
|
|
': <a href="xmpp:' + remove_html(xmppAddress) + '">' + \
|
2020-11-09 22:44:03 +00:00
|
|
|
xmppAddress + '</a></p>\n'
|
|
|
|
if matrixAddress:
|
|
|
|
optionsStr += \
|
|
|
|
'<p class="imText">' + translate['Matrix'] + ': ' + \
|
2021-12-27 15:43:22 +00:00
|
|
|
remove_html(matrixAddress) + '</p>\n'
|
2020-11-09 22:44:03 +00:00
|
|
|
if ssbAddress:
|
|
|
|
optionsStr += \
|
2021-12-27 15:43:22 +00:00
|
|
|
'<p class="imText">SSB: ' + remove_html(ssbAddress) + '</p>\n'
|
2020-11-09 22:44:03 +00:00
|
|
|
if blogAddress:
|
|
|
|
optionsStr += \
|
2020-12-12 15:36:44 +00:00
|
|
|
'<p class="imText">Blog: <a href="' + \
|
2021-12-27 15:43:22 +00:00
|
|
|
remove_html(blogAddress) + '">' + \
|
|
|
|
remove_html(blogAddress) + '</a></p>\n'
|
2020-11-09 22:44:03 +00:00
|
|
|
if toxAddress:
|
|
|
|
optionsStr += \
|
2021-12-27 15:43:22 +00:00
|
|
|
'<p class="imText">Tox: ' + remove_html(toxAddress) + '</p>\n'
|
2020-12-24 16:48:03 +00:00
|
|
|
if briarAddress:
|
2020-12-24 17:11:18 +00:00
|
|
|
if briarAddress.startswith('briar://'):
|
|
|
|
optionsStr += \
|
|
|
|
'<p class="imText">' + \
|
2021-12-27 15:43:22 +00:00
|
|
|
remove_html(briarAddress) + '</p>\n'
|
2020-12-24 17:11:18 +00:00
|
|
|
else:
|
|
|
|
optionsStr += \
|
|
|
|
'<p class="imText">briar://' + \
|
2021-12-27 15:43:22 +00:00
|
|
|
remove_html(briarAddress) + '</p>\n'
|
2020-11-29 12:50:41 +00:00
|
|
|
if jamiAddress:
|
|
|
|
optionsStr += \
|
2021-12-27 15:43:22 +00:00
|
|
|
'<p class="imText">Jami: ' + remove_html(jamiAddress) + '</p>\n'
|
2021-12-30 20:48:38 +00:00
|
|
|
if cwtch_address:
|
2021-06-27 11:48:03 +00:00
|
|
|
optionsStr += \
|
2021-12-30 20:48:38 +00:00
|
|
|
'<p class="imText">Cwtch: ' + remove_html(cwtch_address) + '</p>\n'
|
2021-12-11 10:53:38 +00:00
|
|
|
if EnigmaPubKey:
|
|
|
|
optionsStr += \
|
2021-12-27 15:43:22 +00:00
|
|
|
'<p class="imText">Enigma: ' + remove_html(EnigmaPubKey) + '</p>\n'
|
2020-11-09 22:44:03 +00:00
|
|
|
if PGPfingerprint:
|
|
|
|
optionsStr += '<p class="pgp">PGP: ' + \
|
2021-12-27 15:43:22 +00:00
|
|
|
remove_html(PGPfingerprint).replace('\n', '<br>') + '</p>\n'
|
2020-11-09 22:44:03 +00:00
|
|
|
if PGPpubKey:
|
|
|
|
optionsStr += '<p class="pgp">' + \
|
2021-12-27 15:43:22 +00:00
|
|
|
remove_html(PGPpubKey).replace('\n', '<br>') + '</p>\n'
|
2020-11-09 22:44:03 +00:00
|
|
|
optionsStr += ' <form method="POST" action="' + \
|
|
|
|
originPathStr + '/personoptions">\n'
|
|
|
|
optionsStr += ' <input type="hidden" name="pageNumber" value="' + \
|
|
|
|
str(pageNumber) + '">\n'
|
|
|
|
optionsStr += ' <input type="hidden" name="actor" value="' + \
|
|
|
|
optionsActor + '">\n'
|
|
|
|
optionsStr += ' <input type="hidden" name="avatarUrl" value="' + \
|
|
|
|
optionsProfileUrl + '">\n'
|
2021-02-23 17:29:22 +00:00
|
|
|
if authorized:
|
2021-02-23 17:51:48 +00:00
|
|
|
if originPathStr == '/users/' + nickname:
|
|
|
|
if optionsNickname:
|
2021-06-30 13:01:51 +00:00
|
|
|
# handle = optionsNickname + '@' + optionsDomainFull
|
2021-12-29 21:55:09 +00:00
|
|
|
petname = get_pet_name(base_dir, nickname, domain, handle)
|
2021-02-23 17:51:48 +00:00
|
|
|
optionsStr += \
|
|
|
|
' ' + translate['Petname'] + ': \n' + \
|
|
|
|
' <input type="text" name="optionpetname" value="' + \
|
2021-04-23 12:04:42 +00:00
|
|
|
petname + '" ' + \
|
|
|
|
'accesskey="' + accessKeys['enterPetname'] + '">\n' \
|
2021-02-23 17:51:48 +00:00
|
|
|
' <button type="submit" class="buttonsmall" ' + \
|
|
|
|
'name="submitPetname">' + \
|
|
|
|
translate['Submit'] + '</button><br>\n'
|
2020-11-09 22:44:03 +00:00
|
|
|
|
2021-07-06 20:38:08 +00:00
|
|
|
# Notify when a post arrives from this person
|
2021-12-28 20:32:11 +00:00
|
|
|
if is_following_actor(base_dir, nickname, domain, optionsActor):
|
2021-07-06 20:38:08 +00:00
|
|
|
checkboxStr = \
|
|
|
|
' <input type="checkbox" class="profilecheckbox" ' + \
|
|
|
|
'name="notifyOnPost" checked> 🔔' + \
|
|
|
|
translate['Notify me when this account posts'] + \
|
|
|
|
'\n <button type="submit" class="buttonsmall" ' + \
|
|
|
|
'name="submitNotifyOnPost">' + \
|
|
|
|
translate['Submit'] + '</button><br>\n'
|
2021-12-29 21:55:09 +00:00
|
|
|
if not notify_when_person_posts(base_dir, nickname, domain,
|
|
|
|
optionsNickname,
|
|
|
|
optionsDomainFull):
|
2021-07-06 20:38:08 +00:00
|
|
|
checkboxStr = checkboxStr.replace(' checked>', '>')
|
|
|
|
optionsStr += checkboxStr
|
|
|
|
|
2021-02-23 17:29:22 +00:00
|
|
|
checkboxStr = \
|
|
|
|
' <input type="checkbox" ' + \
|
2021-02-23 17:51:48 +00:00
|
|
|
'class="profilecheckbox" name="onCalendar" checked> ' + \
|
|
|
|
translate['Receive calendar events from this account'] + \
|
2021-02-23 17:29:22 +00:00
|
|
|
'\n <button type="submit" class="buttonsmall" ' + \
|
2021-02-23 17:51:48 +00:00
|
|
|
'name="submitOnCalendar">' + \
|
2021-02-23 17:29:22 +00:00
|
|
|
translate['Submit'] + '</button><br>\n'
|
2021-12-29 21:55:09 +00:00
|
|
|
if not receiving_calendar_events(base_dir, nickname, domain,
|
|
|
|
optionsNickname,
|
|
|
|
optionsDomainFull):
|
2021-02-23 17:29:22 +00:00
|
|
|
checkboxStr = checkboxStr.replace(' checked>', '>')
|
|
|
|
optionsStr += checkboxStr
|
2020-12-17 14:25:00 +00:00
|
|
|
|
2021-02-23 17:51:48 +00:00
|
|
|
# checkbox for permission to post to newswire
|
|
|
|
newswirePostsPermitted = False
|
2021-12-26 10:00:46 +00:00
|
|
|
if optionsDomainFull == domain_full:
|
2021-12-26 14:08:58 +00:00
|
|
|
adminNickname = get_config_param(base_dir, 'admin')
|
2021-02-23 17:51:48 +00:00
|
|
|
if (nickname == adminNickname or
|
2021-12-28 19:33:29 +00:00
|
|
|
(is_moderator(base_dir, nickname) and
|
|
|
|
not is_moderator(base_dir, optionsNickname))):
|
2021-02-23 17:51:48 +00:00
|
|
|
newswireBlockedFilename = \
|
2021-12-25 16:17:53 +00:00
|
|
|
base_dir + '/accounts/' + \
|
2021-02-23 17:51:48 +00:00
|
|
|
optionsNickname + '@' + optionsDomain + '/.nonewswire'
|
|
|
|
checkboxStr = \
|
|
|
|
' <input type="checkbox" ' + \
|
|
|
|
'class="profilecheckbox" ' + \
|
|
|
|
'name="postsToNews" checked> ' + \
|
|
|
|
translate['Allow news posts'] + \
|
|
|
|
'\n <button type="submit" class="buttonsmall" ' + \
|
|
|
|
'name="submitPostToNews">' + \
|
|
|
|
translate['Submit'] + '</button><br>\n'
|
|
|
|
if os.path.isfile(newswireBlockedFilename):
|
|
|
|
checkboxStr = checkboxStr.replace(' checked>', '>')
|
|
|
|
else:
|
|
|
|
newswirePostsPermitted = True
|
|
|
|
optionsStr += checkboxStr
|
2021-02-13 11:37:02 +00:00
|
|
|
|
2021-02-23 17:51:48 +00:00
|
|
|
# whether blogs created by this account are moderated on
|
|
|
|
# the newswire
|
|
|
|
if newswirePostsPermitted:
|
|
|
|
moderatedFilename = \
|
2021-12-25 16:17:53 +00:00
|
|
|
base_dir + '/accounts/' + \
|
2021-02-23 17:51:48 +00:00
|
|
|
optionsNickname + '@' + \
|
|
|
|
optionsDomain + '/.newswiremoderated'
|
2021-02-23 17:29:22 +00:00
|
|
|
checkboxStr = \
|
|
|
|
' <input type="checkbox" ' + \
|
2021-02-23 17:51:48 +00:00
|
|
|
'class="profilecheckbox" name="modNewsPosts" checked> ' + \
|
|
|
|
translate['News posts are moderated'] + \
|
2021-02-23 17:29:22 +00:00
|
|
|
'\n <button type="submit" class="buttonsmall" ' + \
|
2021-02-23 17:51:48 +00:00
|
|
|
'name="submitModNewsPosts">' + \
|
2021-02-23 17:29:22 +00:00
|
|
|
translate['Submit'] + '</button><br>\n'
|
2021-02-23 17:51:48 +00:00
|
|
|
if not os.path.isfile(moderatedFilename):
|
2021-02-23 17:29:22 +00:00
|
|
|
checkboxStr = checkboxStr.replace(' checked>', '>')
|
|
|
|
optionsStr += checkboxStr
|
|
|
|
|
2021-02-23 17:51:48 +00:00
|
|
|
# checkbox for permission to post to featured articles
|
2021-12-26 10:00:46 +00:00
|
|
|
if news_instance and optionsDomainFull == domain_full:
|
2021-12-26 14:08:58 +00:00
|
|
|
adminNickname = get_config_param(base_dir, 'admin')
|
2021-02-23 17:51:48 +00:00
|
|
|
if (nickname == adminNickname or
|
2021-12-28 19:33:29 +00:00
|
|
|
(is_moderator(base_dir, nickname) and
|
|
|
|
not is_moderator(base_dir, optionsNickname))):
|
2021-02-23 17:51:48 +00:00
|
|
|
checkboxStr = \
|
|
|
|
' <input type="checkbox" ' + \
|
|
|
|
'class="profilecheckbox" ' + \
|
|
|
|
'name="postsToFeatures" checked> ' + \
|
|
|
|
translate['Featured writer'] + \
|
|
|
|
'\n <button type="submit" class="buttonsmall" ' + \
|
|
|
|
'name="submitPostToFeatures">' + \
|
|
|
|
translate['Submit'] + '</button><br>\n'
|
2021-12-26 12:07:40 +00:00
|
|
|
if not is_featured_writer(base_dir, optionsNickname,
|
|
|
|
optionsDomain):
|
2021-02-23 17:51:48 +00:00
|
|
|
checkboxStr = checkboxStr.replace(' checked>', '>')
|
|
|
|
optionsStr += checkboxStr
|
|
|
|
|
2020-11-09 22:44:03 +00:00
|
|
|
optionsStr += optionsLinkStr
|
2020-11-10 20:40:19 +00:00
|
|
|
backPath = '/'
|
|
|
|
if nickname:
|
2020-11-10 20:44:38 +00:00
|
|
|
backPath = '/users/' + nickname + '/' + defaultTimeline
|
2020-12-20 13:54:54 +00:00
|
|
|
if 'moderation' in backToPath:
|
|
|
|
backPath = '/users/' + nickname + '/moderation'
|
2021-02-23 17:59:56 +00:00
|
|
|
if authorized and originPathStr == '/users/' + nickname:
|
2021-02-23 17:58:52 +00:00
|
|
|
optionsStr += \
|
|
|
|
' <a href="' + backPath + '"><button type="button" ' + \
|
2021-04-23 12:04:42 +00:00
|
|
|
'class="buttonIcon" name="submitBack" ' + \
|
|
|
|
'accesskey="' + accessKeys['menuTimeline'] + '">' + \
|
|
|
|
translate['Go Back'] + '</button></a>\n'
|
2021-02-23 17:58:52 +00:00
|
|
|
else:
|
|
|
|
optionsStr += \
|
|
|
|
' <a href="' + originPathStr + '"><button type="button" ' + \
|
2021-04-23 12:04:42 +00:00
|
|
|
'class="buttonIcon" name="submitBack" accesskey="' + \
|
|
|
|
accessKeys['menuTimeline'] + '">' + translate['Go Back'] + \
|
2021-02-23 17:58:52 +00:00
|
|
|
'</button></a>\n'
|
2021-02-23 17:29:22 +00:00
|
|
|
if authorized:
|
|
|
|
optionsStr += \
|
2021-04-23 12:04:42 +00:00
|
|
|
' <button type="submit" class="button" ' + \
|
|
|
|
'name="submitView" accesskey="' + \
|
|
|
|
accessKeys['viewButton'] + '">' + \
|
2021-02-23 17:29:22 +00:00
|
|
|
translate['View'] + '</button>\n'
|
2020-11-09 22:44:03 +00:00
|
|
|
optionsStr += donateStr
|
2021-02-23 17:29:22 +00:00
|
|
|
if authorized:
|
|
|
|
optionsStr += \
|
|
|
|
' <button type="submit" class="button" name="submit' + \
|
2021-04-23 12:04:42 +00:00
|
|
|
followStr + '" accesskey="' + accessKeys['followButton'] + '">' + \
|
|
|
|
translate[followStr] + '</button>\n'
|
2021-02-23 17:29:22 +00:00
|
|
|
optionsStr += \
|
|
|
|
' <button type="submit" class="button" name="submit' + \
|
2021-04-23 12:04:42 +00:00
|
|
|
blockStr + '" accesskey="' + accessKeys['blockButton'] + '">' + \
|
|
|
|
translate[blockStr] + '</button>\n'
|
2021-02-23 17:29:22 +00:00
|
|
|
optionsStr += \
|
2021-04-23 12:04:42 +00:00
|
|
|
' <button type="submit" class="button" name="submitDM" ' + \
|
|
|
|
'accesskey="' + accessKeys['menuDM'] + '">' + \
|
2021-02-23 17:29:22 +00:00
|
|
|
translate['DM'] + '</button>\n'
|
|
|
|
optionsStr += \
|
|
|
|
' <button type="submit" class="button" name="submit' + \
|
2021-04-23 12:04:42 +00:00
|
|
|
snoozeButtonStr + '" accesskey="' + \
|
|
|
|
accessKeys['snoozeButton'] + '">' + translate[snoozeButtonStr] + \
|
2021-02-23 17:29:22 +00:00
|
|
|
'</button>\n'
|
2020-12-16 18:04:32 +00:00
|
|
|
optionsStr += \
|
2020-12-16 18:24:04 +00:00
|
|
|
' <button type="submit" class="button" ' + \
|
2021-04-23 12:04:42 +00:00
|
|
|
'name="submitReport" accesskey="' + \
|
|
|
|
accessKeys['reportButton'] + '">' + \
|
|
|
|
translate['Report'] + '</button>\n'
|
2020-11-09 22:44:03 +00:00
|
|
|
|
2021-12-28 19:33:29 +00:00
|
|
|
if is_moderator(base_dir, nickname):
|
2021-02-23 17:29:22 +00:00
|
|
|
optionsStr += \
|
|
|
|
' <button type="submit" class="button" ' + \
|
2021-04-23 12:04:42 +00:00
|
|
|
'name="submitPersonInfo" accesskey="' + \
|
|
|
|
accessKeys['infoButton'] + '">' + \
|
2021-02-23 17:29:22 +00:00
|
|
|
translate['Info'] + '</button>\n'
|
2020-11-09 22:44:03 +00:00
|
|
|
|
2021-02-23 17:29:22 +00:00
|
|
|
personNotes = ''
|
2021-02-23 17:45:53 +00:00
|
|
|
if originPathStr == '/users/' + nickname:
|
2021-02-23 17:35:26 +00:00
|
|
|
personNotesFilename = \
|
2021-12-26 12:02:29 +00:00
|
|
|
acct_dir(base_dir, nickname, domain) + \
|
2021-02-23 17:35:26 +00:00
|
|
|
'/notes/' + handle + '.txt'
|
|
|
|
if os.path.isfile(personNotesFilename):
|
|
|
|
with open(personNotesFilename, 'r') as fp:
|
|
|
|
personNotes = fp.read()
|
2021-02-23 17:29:22 +00:00
|
|
|
|
|
|
|
optionsStr += \
|
|
|
|
' <br><br>' + translate['Notes'] + ': \n'
|
|
|
|
optionsStr += ' <button type="submit" class="buttonsmall" ' + \
|
|
|
|
'name="submitPersonNotes">' + \
|
|
|
|
translate['Submit'] + '</button><br>\n'
|
|
|
|
optionsStr += \
|
|
|
|
' <textarea id="message" ' + \
|
2021-04-23 12:04:42 +00:00
|
|
|
'name="optionnotes" style="height:400px" spellcheck="true" ' + \
|
|
|
|
'accesskey="' + accessKeys['enterNotes'] + '">' + \
|
2021-02-23 17:29:22 +00:00
|
|
|
personNotes + '</textarea>\n'
|
2020-11-09 22:44:03 +00:00
|
|
|
|
2021-07-06 10:00:19 +00:00
|
|
|
optionsStr += \
|
|
|
|
' </form>\n' + \
|
|
|
|
'</center>\n' + \
|
|
|
|
'</div>\n' + \
|
|
|
|
'</div>\n'
|
2021-12-29 21:55:09 +00:00
|
|
|
optionsStr += html_footer()
|
2020-11-09 22:44:03 +00:00
|
|
|
return optionsStr
|