mirror of https://gitlab.com/bashrc2/epicyon
Snake case
parent
47b844152e
commit
49ebb6c88c
6
inbox.py
6
inbox.py
|
@ -25,7 +25,7 @@ from utils import remove_html
|
||||||
from utils import fileLastModified
|
from utils import fileLastModified
|
||||||
from utils import has_object_string
|
from utils import has_object_string
|
||||||
from utils import has_object_string_object
|
from utils import has_object_string_object
|
||||||
from utils import getReplyIntervalHours
|
from utils import get_reply_interval_hours
|
||||||
from utils import canReplyTo
|
from utils import canReplyTo
|
||||||
from utils import get_user_paths
|
from utils import get_user_paths
|
||||||
from utils import get_base_content_from_post
|
from utils import get_base_content_from_post
|
||||||
|
@ -3111,8 +3111,8 @@ def _createReplyNotificationFile(base_dir: str, nickname: str, domain: str,
|
||||||
# check if the reply is within the allowed time period
|
# check if the reply is within the allowed time period
|
||||||
# after publication
|
# after publication
|
||||||
replyIntervalHours = \
|
replyIntervalHours = \
|
||||||
getReplyIntervalHours(base_dir, nickname, domain,
|
get_reply_interval_hours(base_dir, nickname, domain,
|
||||||
default_reply_interval_hrs)
|
default_reply_interval_hrs)
|
||||||
if canReplyTo(base_dir, nickname, domain, inReplyTo,
|
if canReplyTo(base_dir, nickname, domain, inReplyTo,
|
||||||
replyIntervalHours):
|
replyIntervalHours):
|
||||||
actUrl = local_actor_url(http_prefix, nickname, domain)
|
actUrl = local_actor_url(http_prefix, nickname, domain)
|
||||||
|
|
34
utils.py
34
utils.py
|
@ -1367,7 +1367,7 @@ def locate_post(base_dir: str, nickname: str, domain: str,
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
def _getPublishedDate(post_json_object: {}) -> str:
|
def _get_published_date(post_json_object: {}) -> str:
|
||||||
"""Returns the published date on the given post
|
"""Returns the published date on the given post
|
||||||
"""
|
"""
|
||||||
published = None
|
published = None
|
||||||
|
@ -1383,19 +1383,19 @@ def _getPublishedDate(post_json_object: {}) -> str:
|
||||||
return published
|
return published
|
||||||
|
|
||||||
|
|
||||||
def getReplyIntervalHours(base_dir: str, nickname: str, domain: str,
|
def get_reply_interval_hours(base_dir: str, nickname: str, domain: str,
|
||||||
default_reply_interval_hrs: int) -> int:
|
default_reply_interval_hrs: int) -> int:
|
||||||
"""Returns the reply interval for the given account.
|
"""Returns the reply interval for the given account.
|
||||||
The reply interval is the number of hours after a post being made
|
The reply interval is the number of hours after a post being made
|
||||||
during which replies are allowed
|
during which replies are allowed
|
||||||
"""
|
"""
|
||||||
replyIntervalFilename = \
|
reply_interval_filename = \
|
||||||
acct_dir(base_dir, nickname, domain) + '/.replyIntervalHours'
|
acct_dir(base_dir, nickname, domain) + '/.replyIntervalHours'
|
||||||
if os.path.isfile(replyIntervalFilename):
|
if os.path.isfile(reply_interval_filename):
|
||||||
with open(replyIntervalFilename, 'r') as fp:
|
with open(reply_interval_filename, 'r') as interval_file:
|
||||||
hoursStr = fp.read()
|
hours_str = interval_file.read()
|
||||||
if hoursStr.isdigit():
|
if hours_str.isdigit():
|
||||||
return int(hoursStr)
|
return int(hours_str)
|
||||||
return default_reply_interval_hrs
|
return default_reply_interval_hrs
|
||||||
|
|
||||||
|
|
||||||
|
@ -1405,17 +1405,17 @@ def setReplyIntervalHours(base_dir: str, nickname: str, domain: str,
|
||||||
The reply interval is the number of hours after a post being made
|
The reply interval is the number of hours after a post being made
|
||||||
during which replies are allowed
|
during which replies are allowed
|
||||||
"""
|
"""
|
||||||
replyIntervalFilename = \
|
reply_interval_filename = \
|
||||||
acct_dir(base_dir, nickname, domain) + '/.replyIntervalHours'
|
acct_dir(base_dir, nickname, domain) + '/.replyIntervalHours'
|
||||||
with open(replyIntervalFilename, 'w+') as fp:
|
with open(reply_interval_filename, 'w+') as interval_file:
|
||||||
try:
|
try:
|
||||||
fp.write(str(replyIntervalHours))
|
interval_file.write(str(replyIntervalHours))
|
||||||
return True
|
return True
|
||||||
except BaseException:
|
except OSError:
|
||||||
print('EX: setReplyIntervalHours unable to save reply interval ' +
|
print('EX: setReplyIntervalHours ' +
|
||||||
str(replyIntervalFilename) + ' ' +
|
'unable to save reply interval ' +
|
||||||
|
str(reply_interval_filename) + ' ' +
|
||||||
str(replyIntervalHours))
|
str(replyIntervalHours))
|
||||||
pass
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
@ -1436,7 +1436,7 @@ def canReplyTo(base_dir: str, nickname: str, domain: str,
|
||||||
post_json_object = load_json(post_filename)
|
post_json_object = load_json(post_filename)
|
||||||
if not post_json_object:
|
if not post_json_object:
|
||||||
return False
|
return False
|
||||||
published = _getPublishedDate(post_json_object)
|
published = _get_published_date(post_json_object)
|
||||||
if not published:
|
if not published:
|
||||||
return False
|
return False
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -28,7 +28,7 @@ from utils import get_image_formats
|
||||||
from utils import acct_dir
|
from utils import acct_dir
|
||||||
from utils import get_supported_languages
|
from utils import get_supported_languages
|
||||||
from utils import local_actor_url
|
from utils import local_actor_url
|
||||||
from utils import getReplyIntervalHours
|
from utils import get_reply_interval_hours
|
||||||
from languages import getActorLanguages
|
from languages import getActorLanguages
|
||||||
from skills import getSkills
|
from skills import getSkills
|
||||||
from theme import getThemesList
|
from theme import getThemesList
|
||||||
|
@ -2302,8 +2302,8 @@ def htmlEditProfile(cssCache: {}, translate: {}, base_dir: str, path: str,
|
||||||
editProfileForm += systemMonitorStr
|
editProfileForm += systemMonitorStr
|
||||||
|
|
||||||
# Filtering and blocking section
|
# Filtering and blocking section
|
||||||
replyIntervalHours = getReplyIntervalHours(base_dir, nickname, domain,
|
replyIntervalHours = get_reply_interval_hours(base_dir, nickname, domain,
|
||||||
default_reply_interval_hrs)
|
default_reply_interval_hrs)
|
||||||
editProfileForm += \
|
editProfileForm += \
|
||||||
_htmlEditProfileFiltering(base_dir, nickname, domain,
|
_htmlEditProfileFiltering(base_dir, nickname, domain,
|
||||||
user_agents_blocked, translate,
|
user_agents_blocked, translate,
|
||||||
|
|
Loading…
Reference in New Issue