Snake case

merge-requests/30/head
Bob Mottram 2021-12-26 20:12:18 +00:00
parent df168c656d
commit 2c88fb0f42
6 changed files with 30 additions and 30 deletions

View File

@ -248,7 +248,7 @@ from utils import get_new_post_endpoints
from utils import has_actor from utils import has_actor
from utils import setReplyIntervalHours from utils import setReplyIntervalHours
from utils import canReplyTo from utils import canReplyTo
from utils import isDM from utils import is_dm
from utils import replace_users_with_at from utils import replace_users_with_at
from utils import local_actor_url from utils import local_actor_url
from utils import is_float from utils import is_float
@ -7750,7 +7750,7 @@ class PubServer(BaseHTTPRequestHandler):
manuallyApproveFollowers = \ manuallyApproveFollowers = \
followerApprovalActive(base_dir, followerApprovalActive(base_dir,
self.postToNickname, domain) self.postToNickname, domain)
showRepeats = not isDM(announceJson) showRepeats = not is_dm(announceJson)
individualPostAsHtml(self.server.signing_priv_key_pem, False, individualPostAsHtml(self.server.signing_priv_key_pem, False,
self.server.recent_posts_cache, self.server.recent_posts_cache,
self.server.max_recent_posts, self.server.max_recent_posts,
@ -8211,7 +8211,7 @@ class PubServer(BaseHTTPRequestHandler):
manuallyApproveFollowers = \ manuallyApproveFollowers = \
followerApprovalActive(base_dir, followerApprovalActive(base_dir,
self.postToNickname, domain) self.postToNickname, domain)
showRepeats = not isDM(likedPostJson) showRepeats = not is_dm(likedPostJson)
individualPostAsHtml(self.server.signing_priv_key_pem, False, individualPostAsHtml(self.server.signing_priv_key_pem, False,
self.server.recent_posts_cache, self.server.recent_posts_cache,
self.server.max_recent_posts, self.server.max_recent_posts,
@ -8366,7 +8366,7 @@ class PubServer(BaseHTTPRequestHandler):
manuallyApproveFollowers = \ manuallyApproveFollowers = \
followerApprovalActive(base_dir, followerApprovalActive(base_dir,
self.postToNickname, domain) self.postToNickname, domain)
showRepeats = not isDM(likedPostJson) showRepeats = not is_dm(likedPostJson)
individualPostAsHtml(self.server.signing_priv_key_pem, False, individualPostAsHtml(self.server.signing_priv_key_pem, False,
self.server.recent_posts_cache, self.server.recent_posts_cache,
self.server.max_recent_posts, self.server.max_recent_posts,
@ -8549,7 +8549,7 @@ class PubServer(BaseHTTPRequestHandler):
manuallyApproveFollowers = \ manuallyApproveFollowers = \
followerApprovalActive(base_dir, followerApprovalActive(base_dir,
self.postToNickname, domain) self.postToNickname, domain)
showRepeats = not isDM(reactionPostJson) showRepeats = not is_dm(reactionPostJson)
individualPostAsHtml(self.server.signing_priv_key_pem, False, individualPostAsHtml(self.server.signing_priv_key_pem, False,
self.server.recent_posts_cache, self.server.recent_posts_cache,
self.server.max_recent_posts, self.server.max_recent_posts,
@ -8722,7 +8722,7 @@ class PubServer(BaseHTTPRequestHandler):
manuallyApproveFollowers = \ manuallyApproveFollowers = \
followerApprovalActive(base_dir, followerApprovalActive(base_dir,
self.postToNickname, domain) self.postToNickname, domain)
showRepeats = not isDM(reactionPostJson) showRepeats = not is_dm(reactionPostJson)
individualPostAsHtml(self.server.signing_priv_key_pem, False, individualPostAsHtml(self.server.signing_priv_key_pem, False,
self.server.recent_posts_cache, self.server.recent_posts_cache,
self.server.max_recent_posts, self.server.max_recent_posts,
@ -8942,7 +8942,7 @@ class PubServer(BaseHTTPRequestHandler):
manuallyApproveFollowers = \ manuallyApproveFollowers = \
followerApprovalActive(base_dir, followerApprovalActive(base_dir,
self.postToNickname, domain) self.postToNickname, domain)
showRepeats = not isDM(bookmarkPostJson) showRepeats = not is_dm(bookmarkPostJson)
individualPostAsHtml(self.server.signing_priv_key_pem, False, individualPostAsHtml(self.server.signing_priv_key_pem, False,
self.server.recent_posts_cache, self.server.recent_posts_cache,
self.server.max_recent_posts, self.server.max_recent_posts,
@ -9070,7 +9070,7 @@ class PubServer(BaseHTTPRequestHandler):
manuallyApproveFollowers = \ manuallyApproveFollowers = \
followerApprovalActive(base_dir, followerApprovalActive(base_dir,
self.postToNickname, domain) self.postToNickname, domain)
showRepeats = not isDM(bookmarkPostJson) showRepeats = not is_dm(bookmarkPostJson)
individualPostAsHtml(self.server.signing_priv_key_pem, False, individualPostAsHtml(self.server.signing_priv_key_pem, False,
self.server.recent_posts_cache, self.server.recent_posts_cache,
self.server.max_recent_posts, self.server.max_recent_posts,
@ -9265,7 +9265,7 @@ class PubServer(BaseHTTPRequestHandler):
manuallyApproveFollowers = \ manuallyApproveFollowers = \
followerApprovalActive(base_dir, followerApprovalActive(base_dir,
nickname, domain) nickname, domain)
showRepeats = not isDM(mutePostJson) showRepeats = not is_dm(mutePostJson)
showPublicOnly = False showPublicOnly = False
storeToCache = True storeToCache = True
useCacheOnly = False useCacheOnly = False
@ -9375,7 +9375,7 @@ class PubServer(BaseHTTPRequestHandler):
showIndividualPostIcons = True showIndividualPostIcons = True
manuallyApproveFollowers = \ manuallyApproveFollowers = \
followerApprovalActive(base_dir, nickname, domain) followerApprovalActive(base_dir, nickname, domain)
showRepeats = not isDM(mutePostJson) showRepeats = not is_dm(mutePostJson)
showPublicOnly = False showPublicOnly = False
storeToCache = True storeToCache = True
useCacheOnly = False useCacheOnly = False

View File

@ -19,7 +19,7 @@ from random import randint
from utils import get_base_content_from_post from utils import get_base_content_from_post
from utils import has_object_dict from utils import has_object_dict
from utils import get_full_domain from utils import get_full_domain
from utils import isDM from utils import is_dm
from utils import load_translations_from_file from utils import load_translations_from_file
from utils import removeHtml from utils import removeHtml
from utils import getNicknameFromActor from utils import getNicknameFromActor
@ -241,7 +241,7 @@ def _newDesktopNotifications(actor: str, inboxJson: {},
continue continue
if not _postIsToYou(actor, post_json_object): if not _postIsToYou(actor, post_json_object):
continue continue
if isDM(post_json_object): if is_dm(post_json_object):
if not DMdone: if not DMdone:
if not _hasReadPost(actor, post_json_object['id'], 'dm'): if not _hasReadPost(actor, post_json_object['id'], 'dm'):
changed = False changed = False
@ -790,7 +790,7 @@ def _readLocalBoxPost(session, nickname: str, domain: str,
# if the post is addressed to you then mark it as read # if the post is addressed to you then mark it as read
if _postIsToYou(yourActor, post_json_object): if _postIsToYou(yourActor, post_json_object):
if isDM(post_json_object): if is_dm(post_json_object):
_markPostAsRead(yourActor, post_json_object['id'], 'dm') _markPostAsRead(yourActor, post_json_object['id'], 'dm')
else: else:
_markPostAsRead(yourActor, post_json_object['id'], 'replies') _markPostAsRead(yourActor, post_json_object['id'], 'replies')
@ -1076,7 +1076,7 @@ def _desktopShowBox(indent: str,
system_language) system_language)
content = _textOnlyContent(contentStr) content = _textOnlyContent(contentStr)
if boxName != 'dm': if boxName != 'dm':
if isDM(post_json_object): if is_dm(post_json_object):
content = '📧' + content content = '📧' + content
if not contentWarning: if not contentWarning:
if is_pgp_encrypted(content): if is_pgp_encrypted(content):

View File

@ -89,7 +89,7 @@ from filters import isFiltered
from utils import updateAnnounceCollection from utils import updateAnnounceCollection
from utils import undoAnnounceCollectionEntry from utils import undoAnnounceCollectionEntry
from utils import dangerousMarkup from utils import dangerousMarkup
from utils import isDM from utils import is_dm
from utils import is_reply from utils import is_reply
from utils import has_actor from utils import has_actor
from httpsig import messageContentDigest from httpsig import messageContentDigest
@ -302,7 +302,7 @@ def _inboxStorePostToHtmlCache(recent_posts_cache: {}, max_recent_posts: int,
if boxname != 'outbox': if boxname != 'outbox':
boxname = 'inbox' boxname = 'inbox'
notDM = not isDM(post_json_object) notDM = not is_dm(post_json_object)
yt_replace_domain = get_config_param(base_dir, 'youtubedomain') yt_replace_domain = get_config_param(base_dir, 'youtubedomain')
twitter_replacement_domain = get_config_param(base_dir, 'twitterdomain') twitter_replacement_domain = get_config_param(base_dir, 'twitterdomain')
individualPostAsHtml(signing_priv_key_pem, individualPostAsHtml(signing_priv_key_pem,
@ -1093,7 +1093,7 @@ def _receiveLike(recent_posts_cache: {},
showIndividualPostIcons = True showIndividualPostIcons = True
manuallyApproveFollowers = \ manuallyApproveFollowers = \
followerApprovalActive(base_dir, handleName, domain) followerApprovalActive(base_dir, handleName, domain)
notDM = not isDM(likedPostJson) notDM = not is_dm(likedPostJson)
individualPostAsHtml(signing_priv_key_pem, False, individualPostAsHtml(signing_priv_key_pem, False,
recent_posts_cache, max_recent_posts, recent_posts_cache, max_recent_posts,
translate, pageNumber, base_dir, translate, pageNumber, base_dir,
@ -1204,7 +1204,7 @@ def _receiveUndoLike(recent_posts_cache: {},
showIndividualPostIcons = True showIndividualPostIcons = True
manuallyApproveFollowers = \ manuallyApproveFollowers = \
followerApprovalActive(base_dir, handleName, domain) followerApprovalActive(base_dir, handleName, domain)
notDM = not isDM(likedPostJson) notDM = not is_dm(likedPostJson)
individualPostAsHtml(signing_priv_key_pem, False, individualPostAsHtml(signing_priv_key_pem, False,
recent_posts_cache, max_recent_posts, recent_posts_cache, max_recent_posts,
translate, pageNumber, base_dir, translate, pageNumber, base_dir,
@ -1352,7 +1352,7 @@ def _receiveReaction(recent_posts_cache: {},
showIndividualPostIcons = True showIndividualPostIcons = True
manuallyApproveFollowers = \ manuallyApproveFollowers = \
followerApprovalActive(base_dir, handleName, domain) followerApprovalActive(base_dir, handleName, domain)
notDM = not isDM(reactionPostJson) notDM = not is_dm(reactionPostJson)
individualPostAsHtml(signing_priv_key_pem, False, individualPostAsHtml(signing_priv_key_pem, False,
recent_posts_cache, max_recent_posts, recent_posts_cache, max_recent_posts,
translate, pageNumber, base_dir, translate, pageNumber, base_dir,
@ -1482,7 +1482,7 @@ def _receiveUndoReaction(recent_posts_cache: {},
showIndividualPostIcons = True showIndividualPostIcons = True
manuallyApproveFollowers = \ manuallyApproveFollowers = \
followerApprovalActive(base_dir, handleName, domain) followerApprovalActive(base_dir, handleName, domain)
notDM = not isDM(reactionPostJson) notDM = not is_dm(reactionPostJson)
individualPostAsHtml(signing_priv_key_pem, False, individualPostAsHtml(signing_priv_key_pem, False,
recent_posts_cache, max_recent_posts, recent_posts_cache, max_recent_posts,
translate, pageNumber, base_dir, translate, pageNumber, base_dir,
@ -1592,7 +1592,7 @@ def _receiveBookmark(recent_posts_cache: {},
showIndividualPostIcons = True showIndividualPostIcons = True
manuallyApproveFollowers = \ manuallyApproveFollowers = \
followerApprovalActive(base_dir, nickname, domain) followerApprovalActive(base_dir, nickname, domain)
notDM = not isDM(bookmarkedPostJson) notDM = not is_dm(bookmarkedPostJson)
individualPostAsHtml(signing_priv_key_pem, False, individualPostAsHtml(signing_priv_key_pem, False,
recent_posts_cache, max_recent_posts, recent_posts_cache, max_recent_posts,
translate, pageNumber, base_dir, translate, pageNumber, base_dir,
@ -1705,7 +1705,7 @@ def _receiveUndoBookmark(recent_posts_cache: {},
showIndividualPostIcons = True showIndividualPostIcons = True
manuallyApproveFollowers = \ manuallyApproveFollowers = \
followerApprovalActive(base_dir, nickname, domain) followerApprovalActive(base_dir, nickname, domain)
notDM = not isDM(bookmarkedPostJson) notDM = not is_dm(bookmarkedPostJson)
individualPostAsHtml(signing_priv_key_pem, False, individualPostAsHtml(signing_priv_key_pem, False,
recent_posts_cache, max_recent_posts, recent_posts_cache, max_recent_posts,
translate, pageNumber, base_dir, translate, pageNumber, base_dir,
@ -3027,7 +3027,7 @@ def _receiveQuestionVote(base_dir: str, nickname: str, domain: str,
showIndividualPostIcons = True showIndividualPostIcons = True
manuallyApproveFollowers = \ manuallyApproveFollowers = \
followerApprovalActive(base_dir, nickname, domain) followerApprovalActive(base_dir, nickname, domain)
notDM = not isDM(questionJson) notDM = not is_dm(questionJson)
individualPostAsHtml(signing_priv_key_pem, False, individualPostAsHtml(signing_priv_key_pem, False,
recent_posts_cache, max_recent_posts, recent_posts_cache, max_recent_posts,
translate, pageNumber, base_dir, translate, pageNumber, base_dir,
@ -3480,7 +3480,7 @@ def _inboxAfterInitial(recent_posts_cache: {}, max_recent_posts: int,
if not isGroup: if not isGroup:
# create a DM notification file if needed # create a DM notification file if needed
postIsDM = isDM(post_json_object) postIsDM = is_dm(post_json_object)
if postIsDM: if postIsDM:
if not _isValidDM(base_dir, nickname, domain, port, if not _isValidDM(base_dir, nickname, domain, port,
post_json_object, updateIndexList, post_json_object, updateIndexList,

View File

@ -12,7 +12,7 @@ import html
import random import random
import urllib.parse import urllib.parse
from utils import removeIdEnding from utils import removeIdEnding
from utils import isDM from utils import is_dm
from utils import is_reply from utils import is_reply
from utils import camelCaseSplit from utils import camelCaseSplit
from utils import getDomainFromActor from utils import getDomainFromActor
@ -453,7 +453,7 @@ def _postToSpeakerJson(base_dir: str, http_prefix: str,
imageDescription += \ imageDescription += \
img['name'] + '. ' img['name'] + '. '
isDirect = isDM(post_json_object) isDirect = is_dm(post_json_object)
actor = local_actor_url(http_prefix, nickname, domain_full) actor = local_actor_url(http_prefix, nickname, domain_full)
replyToYou = is_reply(post_json_object, actor) replyToYou = is_reply(post_json_object, actor)

View File

@ -2586,7 +2586,7 @@ def rejectPostId(base_dir: str, nickname: str, domain: str,
rejectFile.write('\n') rejectFile.write('\n')
def isDM(post_json_object: {}) -> bool: def is_dm(post_json_object: {}) -> bool:
"""Returns true if the given post is a DM """Returns true if the given post is a DM
""" """
if post_json_object['type'] != 'Create': if post_json_object['type'] != 'Create':

View File

@ -31,7 +31,7 @@ from utils import get_content_from_post
from utils import has_object_dict from utils import has_object_dict
from utils import updateAnnounceCollection from utils import updateAnnounceCollection
from utils import is_pgp_encrypted from utils import is_pgp_encrypted
from utils import isDM from utils import is_dm
from utils import rejectPostId from utils import rejectPostId
from utils import isRecentPost from utils import isRecentPost
from utils import get_config_param from utils import get_config_param
@ -435,7 +435,7 @@ def _getReplyIconHtml(base_dir: str, nickname: str, domain: str,
conversationStr + \ conversationStr + \
'" title="' + replyToThisPostStr + '">\n' '" title="' + replyToThisPostStr + '">\n'
else: else:
if isDM(post_json_object): if is_dm(post_json_object):
replyStr += \ replyStr += \
' ' + \ ' ' + \
'<a class="imageAnchor" href="/users/' + nickname + \ '<a class="imageAnchor" href="/users/' + nickname + \
@ -1480,7 +1480,7 @@ def individualPostAsHtml(signing_priv_key_pem: str,
# If this is the inbox timeline then don't show the repeat icon on any DMs # If this is the inbox timeline then don't show the repeat icon on any DMs
showRepeatIcon = showRepeats showRepeatIcon = showRepeats
isPublicRepeat = False isPublicRepeat = False
postIsDM = isDM(post_json_object) postIsDM = is_dm(post_json_object)
if showRepeats: if showRepeats:
if postIsDM: if postIsDM:
showRepeatIcon = False showRepeatIcon = False