mirror of https://gitlab.com/bashrc2/epicyon
Only apply to public posts
parent
11f9572457
commit
652394a739
16
daemon.py
16
daemon.py
|
@ -69,6 +69,7 @@ from person import canRemovePost
|
|||
from person import personSnooze
|
||||
from person import personUnsnooze
|
||||
from posts import pinPost
|
||||
from posts import unpinPost
|
||||
from posts import isModerator
|
||||
from posts import mutePost
|
||||
from posts import unmutePost
|
||||
|
@ -12226,12 +12227,17 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
else:
|
||||
privateEvent = True
|
||||
|
||||
if not fields.get('pinToProfile'):
|
||||
pinToProfile = False
|
||||
else:
|
||||
pinToProfile = True
|
||||
|
||||
if postType == 'newpost':
|
||||
if not fields.get('pinToProfile'):
|
||||
pinToProfile = False
|
||||
else:
|
||||
pinToProfile = True
|
||||
# is the post message empty?
|
||||
if not fields['message']:
|
||||
# remove the pinned content from profile screen
|
||||
unpinPost(self.server.baseDir,
|
||||
nickname, self.server.domain)
|
||||
|
||||
messageJson = \
|
||||
createPublicPost(self.server.baseDir,
|
||||
nickname,
|
||||
|
|
9
posts.py
9
posts.py
|
@ -1285,6 +1285,15 @@ def pinPost(baseDir: str, nickname: str, domain: str,
|
|||
pinFile.close()
|
||||
|
||||
|
||||
def unpinPost(baseDir: str, nickname: str, domain: str) -> None:
|
||||
"""Removes pinned content for then given account
|
||||
"""
|
||||
accountDir = baseDir + '/accounts/' + nickname + '@' + domain
|
||||
pinnedFilename = accountDir + '/pinToProfile.txt'
|
||||
if os.path.isfile(pinnedFilename):
|
||||
os.remove(pinnedFilename)
|
||||
|
||||
|
||||
def createPublicPost(baseDir: str,
|
||||
nickname: str, domain: str, port: int, httpPrefix: str,
|
||||
content: str, followersOnly: bool, saveToFile: bool,
|
||||
|
|
Loading…
Reference in New Issue