diff --git a/daemon.py b/daemon.py index ed95905df..b6d963648 100644 --- a/daemon.py +++ b/daemon.py @@ -139,6 +139,7 @@ from blog import htmlBlogView from blog import htmlBlogPage from blog import htmlBlogPost from blog import htmlEditBlog +from webapp_utils import setMinimal from webapp_utils import isMinimal from webapp_utils import getAvatarImageUrl from webapp_utils import htmlHashtagBlocked @@ -364,21 +365,6 @@ class PubServer(BaseHTTPRequestHandler): str(client_address)) pass - def _setMinimal(self, nickname: str, minimal: bool) -> None: - """Sets whether an account should display minimal buttons - """ - accountDir = self.server.baseDir + '/accounts/' + \ - nickname + '@' + self.server.domain - if not os.path.isdir(accountDir): - return - minimalFilename = accountDir + '/.notminimal' - minimalFileExists = os.path.isfile(minimalFilename) - if minimal and minimalFileExists: - os.remove(minimalFilename) - elif not minimal and not minimalFileExists: - with open(minimalFilename, 'w+') as fp: - fp.write('\n') - def _sendReplyToQuestion(self, nickname: str, messageId: str, answer: str) -> None: """Sends a reply to a question @@ -12033,7 +12019,8 @@ class PubServer(BaseHTTPRequestHandler): nickname = nickname.split('/')[0] notMin = not isMinimal(self.server.baseDir, self.server.domain, nickname) - self._setMinimal(nickname, notMin) + setMinimal(self.server.baseDir, + self.server.domain, nickname, notMin) if not (self.server.mediaInstance or self.server.blogsInstance): self.path = '/users/' + nickname + '/inbox' diff --git a/webapp_utils.py b/webapp_utils.py index 1881dedb1..10c006106 100644 --- a/webapp_utils.py +++ b/webapp_utils.py @@ -1372,3 +1372,19 @@ def isMinimal(baseDir: str, domain: str, nickname: str) -> bool: if os.path.isfile(minimalFilename): return False return True + + +def setMinimal(baseDir: str, domain: str, nickname: str, + minimal: bool) -> None: + """Sets whether an account should display minimal buttons + """ + accountDir = baseDir + '/accounts/' + nickname + '@' + domain + if not os.path.isdir(accountDir): + return + minimalFilename = accountDir + '/.notminimal' + minimalFileExists = os.path.isfile(minimalFilename) + if minimal and minimalFileExists: + os.remove(minimalFilename) + elif not minimal and not minimalFileExists: + with open(minimalFilename, 'w+') as fp: + fp.write('\n')