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

View File

@ -19,7 +19,7 @@ from random import randint
from utils import get_base_content_from_post
from utils import has_object_dict
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 removeHtml
from utils import getNicknameFromActor
@ -241,7 +241,7 @@ def _newDesktopNotifications(actor: str, inboxJson: {},
continue
if not _postIsToYou(actor, post_json_object):
continue
if isDM(post_json_object):
if is_dm(post_json_object):
if not DMdone:
if not _hasReadPost(actor, post_json_object['id'], 'dm'):
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 _postIsToYou(yourActor, post_json_object):
if isDM(post_json_object):
if is_dm(post_json_object):
_markPostAsRead(yourActor, post_json_object['id'], 'dm')
else:
_markPostAsRead(yourActor, post_json_object['id'], 'replies')
@ -1076,7 +1076,7 @@ def _desktopShowBox(indent: str,
system_language)
content = _textOnlyContent(contentStr)
if boxName != 'dm':
if isDM(post_json_object):
if is_dm(post_json_object):
content = '📧' + content
if not contentWarning:
if is_pgp_encrypted(content):

View File

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

View File

@ -12,7 +12,7 @@ import html
import random
import urllib.parse
from utils import removeIdEnding
from utils import isDM
from utils import is_dm
from utils import is_reply
from utils import camelCaseSplit
from utils import getDomainFromActor
@ -453,7 +453,7 @@ def _postToSpeakerJson(base_dir: str, http_prefix: str,
imageDescription += \
img['name'] + '. '
isDirect = isDM(post_json_object)
isDirect = is_dm(post_json_object)
actor = local_actor_url(http_prefix, nickname, domain_full)
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')
def isDM(post_json_object: {}) -> bool:
def is_dm(post_json_object: {}) -> bool:
"""Returns true if the given post is a DM
"""
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 updateAnnounceCollection
from utils import is_pgp_encrypted
from utils import isDM
from utils import is_dm
from utils import rejectPostId
from utils import isRecentPost
from utils import get_config_param
@ -435,7 +435,7 @@ def _getReplyIconHtml(base_dir: str, nickname: str, domain: str,
conversationStr + \
'" title="' + replyToThisPostStr + '">\n'
else:
if isDM(post_json_object):
if is_dm(post_json_object):
replyStr += \
' ' + \
'<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
showRepeatIcon = showRepeats
isPublicRepeat = False
postIsDM = isDM(post_json_object)
postIsDM = is_dm(post_json_object)
if showRepeats:
if postIsDM:
showRepeatIcon = False