mirror of https://gitlab.com/bashrc2/epicyon
Snake case
parent
8b853014c5
commit
6f8944ed40
6
inbox.py
6
inbox.py
|
@ -18,7 +18,7 @@ from like import updateLikesCollection
|
|||
from reaction import updateReactionCollection
|
||||
from reaction import validEmojiContent
|
||||
from utils import domainPermitted
|
||||
from utils import isGroupAccount
|
||||
from utils import is_group_account
|
||||
from utils import isSystemAccount
|
||||
from utils import invalidCiphertext
|
||||
from utils import removeHtml
|
||||
|
@ -3986,7 +3986,7 @@ def _receiveFollowRequest(session, base_dir: str, http_prefix: str,
|
|||
|
||||
group_account = \
|
||||
hasGroupType(base_dir, message_json['actor'], person_cache)
|
||||
if group_account and isGroupAccount(base_dir, nickname, domain):
|
||||
if group_account and is_group_account(base_dir, nickname, domain):
|
||||
print('Group cannot follow a group')
|
||||
return False
|
||||
|
||||
|
@ -4033,7 +4033,7 @@ def _receiveFollowRequest(session, base_dir: str, http_prefix: str,
|
|||
print(approveHandle + ' / ' + message_json['actor'] +
|
||||
' is Group: ' + str(group_account))
|
||||
if group_account and \
|
||||
isGroupAccount(base_dir, nickname, domain):
|
||||
is_group_account(base_dir, nickname, domain):
|
||||
print('Group cannot follow a group')
|
||||
return False
|
||||
try:
|
||||
|
|
10
tests.py
10
tests.py
|
@ -57,7 +57,7 @@ from siteactive import siteIsActive
|
|||
from utils import get_sha_256
|
||||
from utils import dangerousSVG
|
||||
from utils import canReplyTo
|
||||
from utils import isGroupAccount
|
||||
from utils import is_group_account
|
||||
from utils import get_actor_languages_list
|
||||
from utils import get_category_types
|
||||
from utils import get_supported_languages
|
||||
|
@ -1557,7 +1557,7 @@ def testFollowBetweenServers(base_dir: str) -> None:
|
|||
aliceDomain +
|
||||
'/followingCalendar.txt').read()
|
||||
assert not isGroupActor(aliceDir, bobActor, alicePersonCache)
|
||||
assert not isGroupAccount(aliceDir, 'alice', aliceDomain)
|
||||
assert not is_group_account(aliceDir, 'alice', aliceDomain)
|
||||
|
||||
print('\n\n*********************************************************')
|
||||
print('Alice sends a message to Bob')
|
||||
|
@ -1774,7 +1774,7 @@ def testSharedItemsFederation(base_dir: str) -> None:
|
|||
aliceDomain +
|
||||
'/followingCalendar.txt').read()
|
||||
assert not isGroupActor(aliceDir, bobActor, alicePersonCache)
|
||||
assert not isGroupAccount(bobDir, 'bob', bobDomain)
|
||||
assert not is_group_account(bobDir, 'bob', bobDomain)
|
||||
|
||||
print('\n\n*********************************************************')
|
||||
print('Bob publishes some shared items')
|
||||
|
@ -2231,8 +2231,8 @@ def testGroupFollow(base_dir: str) -> None:
|
|||
print('Alice following.txt does not contain !testgroup@' +
|
||||
testgroupDomain + ':' + str(testgroupPort))
|
||||
assert isGroupActor(aliceDir, testgroupActor, alicePersonCache)
|
||||
assert not isGroupAccount(aliceDir, 'alice', aliceDomain)
|
||||
assert isGroupAccount(testgroupDir, 'testgroup', testgroupDomain)
|
||||
assert not is_group_account(aliceDir, 'alice', aliceDomain)
|
||||
assert is_group_account(testgroupDir, 'testgroup', testgroupDomain)
|
||||
assert '!testgroup' in followingStr
|
||||
assert testgroupHandle in open(aliceFollowingFilename).read()
|
||||
assert testgroupHandle in open(aliceFollowingCalendarFilename).read()
|
||||
|
|
8
utils.py
8
utils.py
|
@ -3032,13 +3032,13 @@ def isGroupActor(base_dir: str, actor: str, person_cache: {},
|
|||
return False
|
||||
|
||||
|
||||
def isGroupAccount(base_dir: str, nickname: str, domain: str) -> bool:
|
||||
def is_group_account(base_dir: str, nickname: str, domain: str) -> bool:
|
||||
"""Returns true if the given account is a group
|
||||
"""
|
||||
accountFilename = acct_dir(base_dir, nickname, domain) + '.json'
|
||||
if not os.path.isfile(accountFilename):
|
||||
account_filename = acct_dir(base_dir, nickname, domain) + '.json'
|
||||
if not os.path.isfile(account_filename):
|
||||
return False
|
||||
if '"type": "Group"' in open(accountFilename).read():
|
||||
if '"type": "Group"' in open(account_filename).read():
|
||||
return True
|
||||
return False
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ import os
|
|||
from pprint import pprint
|
||||
from webfinger import webfingerHandle
|
||||
from utils import getDisplayName
|
||||
from utils import isGroupAccount
|
||||
from utils import is_group_account
|
||||
from utils import has_object_dict
|
||||
from utils import getOccupationName
|
||||
from utils import get_locked_account
|
||||
|
@ -859,7 +859,7 @@ def htmlProfile(signing_priv_key_pem: str,
|
|||
deft = defaultTimeline
|
||||
isGroup = False
|
||||
followersStr = translate['Followers']
|
||||
if isGroupAccount(base_dir, nickname, domain):
|
||||
if is_group_account(base_dir, nickname, domain):
|
||||
isGroup = True
|
||||
followersStr = translate['Members']
|
||||
menuTimeline = \
|
||||
|
@ -2406,7 +2406,7 @@ def _individualFollowAsHtml(signing_priv_key_pem: str,
|
|||
elif b == 'unfollow':
|
||||
unfollowStr = 'Unfollow'
|
||||
if isGroup or \
|
||||
isGroupAccount(base_dir,
|
||||
is_group_account(base_dir,
|
||||
followUrlNickname, followUrlDomain):
|
||||
unfollowStr = 'Leave'
|
||||
buttonsStr += \
|
||||
|
|
Loading…
Reference in New Issue