mirror of https://gitlab.com/bashrc2/epicyon
Pinned posts
parent
e77897644d
commit
09b9ec8851
13
daemon.py
13
daemon.py
|
@ -68,6 +68,7 @@ from person import removeAccount
|
|||
from person import canRemovePost
|
||||
from person import personSnooze
|
||||
from person import personUnsnooze
|
||||
from posts import pinPost
|
||||
from posts import isModerator
|
||||
from posts import mutePost
|
||||
from posts import unmutePost
|
||||
|
@ -12219,11 +12220,17 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
commentsEnabled = False
|
||||
else:
|
||||
commentsEnabled = True
|
||||
|
||||
if not fields.get('privateEvent'):
|
||||
privateEvent = False
|
||||
else:
|
||||
privateEvent = True
|
||||
|
||||
if not fields.get('pinToProfile'):
|
||||
pinToProfile = False
|
||||
else:
|
||||
pinToProfile = True
|
||||
|
||||
if postType == 'newpost':
|
||||
messageJson = \
|
||||
createPublicPost(self.server.baseDir,
|
||||
|
@ -12242,7 +12249,11 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
if messageJson:
|
||||
if fields['schedulePost']:
|
||||
return 1
|
||||
|
||||
if pinToProfile:
|
||||
pinPost(self.server.baseDir,
|
||||
nickname, self.server.domain,
|
||||
messageJson['object']['content'])
|
||||
return 1
|
||||
if self._postToOutbox(messageJson, __version__, nickname):
|
||||
populateReplies(self.server.baseDir,
|
||||
self.server.httpPrefix,
|
||||
|
|
12
posts.py
12
posts.py
|
@ -1273,6 +1273,18 @@ def _postIsAddressedToFollowers(baseDir: str,
|
|||
return addressedToFollowers
|
||||
|
||||
|
||||
def pinPost(baseDir: str, nickname: str, domain: str,
|
||||
pinnedContent: str) -> None:
|
||||
"""Pins the given post Id to the profile of then given account
|
||||
"""
|
||||
accountDir = baseDir + '/accounts/' + nickname + '@' + domain
|
||||
pinnedFilename = accountDir + '/pinToProfile.txt'
|
||||
pinFile = open(pinnedFilename, "w+")
|
||||
if pinFile:
|
||||
pinFile.write(pinnedContent)
|
||||
pinFile.close()
|
||||
|
||||
|
||||
def createPublicPost(baseDir: str,
|
||||
nickname: str, domain: str, port: int, httpPrefix: str,
|
||||
content: str, followersOnly: bool, saveToFile: bool,
|
||||
|
|
|
@ -360,5 +360,6 @@
|
|||
"New account": "حساب جديد",
|
||||
"Moved to new account address": "انتقل إلى عنوان الحساب الجديد",
|
||||
"Yet another Epicyon Instance": "مثال آخر Epicyon",
|
||||
"Other accounts": "حسابات أخرى"
|
||||
"Other accounts": "حسابات أخرى",
|
||||
"Pin this post to your profile.": "تثبيت هذه الوظيفة في ملف التعريف الخاص بك."
|
||||
}
|
||||
|
|
|
@ -360,5 +360,6 @@
|
|||
"New account": "Compte nou",
|
||||
"Moved to new account address": "S'ha mogut a l'adreça del compte nova",
|
||||
"Yet another Epicyon Instance": "Encara una altra instància Epicyon",
|
||||
"Other accounts": "Altres comptes"
|
||||
"Other accounts": "Altres comptes",
|
||||
"Pin this post to your profile.": "Fixa aquesta publicació al teu perfil."
|
||||
}
|
||||
|
|
|
@ -360,5 +360,6 @@
|
|||
"New account": "Cyfrif newydd",
|
||||
"Moved to new account address": "Wedi'i symud i gyfeiriad cyfrif newydd",
|
||||
"Yet another Epicyon Instance": "Digwyddiad Epicyon arall",
|
||||
"Other accounts": "Cyfrifon eraill"
|
||||
"Other accounts": "Cyfrifon eraill",
|
||||
"Pin this post to your profile.": "Piniwch y post hwn i'ch proffil."
|
||||
}
|
||||
|
|
|
@ -360,5 +360,6 @@
|
|||
"New account": "Neues Konto",
|
||||
"Moved to new account address": "An neue Kontoadresse verschoben",
|
||||
"Yet another Epicyon Instance": "Noch eine Epicyon-Instanz",
|
||||
"Other accounts": "Andere Konten"
|
||||
"Other accounts": "Andere Konten",
|
||||
"Pin this post to your profile.": "Pin diesen Beitrag zu Ihrem Profil."
|
||||
}
|
||||
|
|
|
@ -360,5 +360,6 @@
|
|||
"New account": "New account",
|
||||
"Moved to new account address": "Moved to new account address",
|
||||
"Yet another Epicyon Instance": "Yet another Epicyon Instance",
|
||||
"Other accounts": "Other accounts"
|
||||
"Other accounts": "Other accounts",
|
||||
"Pin this post to your profile.": "Pin this post to your profile."
|
||||
}
|
||||
|
|
|
@ -360,5 +360,6 @@
|
|||
"New account": "Nueva cuenta",
|
||||
"Moved to new account address": "Movido a la nueva dirección de la cuenta",
|
||||
"Yet another Epicyon Instance": "Otra instancia más de Epicyon",
|
||||
"Other accounts": "Otras cuentas"
|
||||
"Other accounts": "Otras cuentas",
|
||||
"Pin this post to your profile.": "Fija esta publicación a tu perfil."
|
||||
}
|
||||
|
|
|
@ -360,5 +360,6 @@
|
|||
"New account": "Nouveau compte",
|
||||
"Moved to new account address": "Déplacé vers une nouvelle adresse de compte",
|
||||
"Yet another Epicyon Instance": "Encore une autre instance Epicyon",
|
||||
"Other accounts": "Autres comptes"
|
||||
"Other accounts": "Autres comptes",
|
||||
"Pin this post to your profile.": "Épinglez ce message à votre profil."
|
||||
}
|
||||
|
|
|
@ -360,5 +360,6 @@
|
|||
"New account": "Cuntas nua",
|
||||
"Moved to new account address": "Ar athraíodh a ionad go seoladh cuntas nua",
|
||||
"Yet another Epicyon Instance": "Institiúid Epicyon eile fós",
|
||||
"Other accounts": "Cuntais eile"
|
||||
"Other accounts": "Cuntais eile",
|
||||
"Pin this post to your profile.": "Bioráin an post seo le do phróifíl."
|
||||
}
|
||||
|
|
|
@ -360,5 +360,6 @@
|
|||
"New account": "नया खाता",
|
||||
"Moved to new account address": "नए खाते के पते पर ले जाया गया",
|
||||
"Yet another Epicyon Instance": "फिर भी एक और एपिकॉन उदाहरण",
|
||||
"Other accounts": "अन्य खाते"
|
||||
"Other accounts": "अन्य खाते",
|
||||
"Pin this post to your profile.": "इस पोस्ट को अपनी प्रोफाइल पर पिन करें।"
|
||||
}
|
||||
|
|
|
@ -360,5 +360,6 @@
|
|||
"New account": "Nuovo account",
|
||||
"Moved to new account address": "Spostato al nuovo indirizzo dell'account",
|
||||
"Yet another Epicyon Instance": "Ancora un'altra istanza di Epicyon",
|
||||
"Other accounts": "Altri account"
|
||||
"Other accounts": "Altri account",
|
||||
"Pin this post to your profile.": "Metti questo post sul tuo profilo."
|
||||
}
|
||||
|
|
|
@ -360,5 +360,6 @@
|
|||
"New account": "新しいアカウント",
|
||||
"Moved to new account address": "新しいアカウントアドレスに移動しました",
|
||||
"Yet another Epicyon Instance": "さらに別のエピキオンインスタンス",
|
||||
"Other accounts": "その他のアカウント"
|
||||
"Other accounts": "その他のアカウント",
|
||||
"Pin this post to your profile.": "この投稿をプロフィールに固定します。"
|
||||
}
|
||||
|
|
|
@ -356,5 +356,6 @@
|
|||
"New account": "New account",
|
||||
"Moved to new account address": "Moved to new account address",
|
||||
"Yet another Epicyon Instance": "Yet another Epicyon Instance",
|
||||
"Other accounts": "Other accounts"
|
||||
"Other accounts": "Other accounts",
|
||||
"Pin this post to your profile.": "Pin this post to your profile."
|
||||
}
|
||||
|
|
|
@ -360,5 +360,6 @@
|
|||
"New account": "Nova conta",
|
||||
"Moved to new account address": "Movido para o novo endereço da conta",
|
||||
"Yet another Epicyon Instance": "Mais uma instância do Epicyon",
|
||||
"Other accounts": "Outras contas"
|
||||
"Other accounts": "Outras contas",
|
||||
"Pin this post to your profile.": "Fixar esta postagem em seu perfil."
|
||||
}
|
||||
|
|
|
@ -360,5 +360,6 @@
|
|||
"New account": "Новый аккаунт",
|
||||
"Moved to new account address": "Перемещен на новый адрес учетной записи",
|
||||
"Yet another Epicyon Instance": "Еще один экземпляр Эпикиона",
|
||||
"Other accounts": "Другие аккаунты"
|
||||
"Other accounts": "Другие аккаунты",
|
||||
"Pin this post to your profile.": "Закрепите это сообщение в своем профиле."
|
||||
}
|
||||
|
|
|
@ -360,5 +360,6 @@
|
|||
"New account": "新账户",
|
||||
"Moved to new account address": "移至新帐户地址",
|
||||
"Yet another Epicyon Instance": "另一个Epicyon实例",
|
||||
"Other accounts": "其他账户"
|
||||
"Other accounts": "其他账户",
|
||||
"Pin this post to your profile.": "将此帖子固定到您的个人资料。"
|
||||
}
|
||||
|
|
|
@ -485,6 +485,12 @@ def htmlNewPost(cssCache: {}, mediaInstance: bool, translate: {},
|
|||
'name="commentsEnabled" checked><label class="labels"> ' + \
|
||||
translate['Allow replies.'] + '</label></p>\n'
|
||||
|
||||
if endpoint == 'newpost':
|
||||
dateAndLocation += \
|
||||
'<p><input type="checkbox" class="profilecheckbox" ' + \
|
||||
'name="pinToProfile" checked><label class="labels"> ' + \
|
||||
translate['Pin this post to your profile.'] + '</label></p>\n'
|
||||
|
||||
if not inReplyTo and endpoint != 'newevent':
|
||||
dateAndLocation += \
|
||||
'<p><input type="checkbox" class="profilecheckbox" ' + \
|
||||
|
|
|
@ -313,7 +313,8 @@ def _getProfileHeader(baseDir: str, httpPrefix: str,
|
|||
profileDescriptionShort: str,
|
||||
loginButton: str, avatarUrl: str,
|
||||
theme: str, movedTo: str,
|
||||
alsoKnownAs: []) -> str:
|
||||
alsoKnownAs: [],
|
||||
pinnedContent) -> str:
|
||||
"""The header of the profile screen, containing background
|
||||
image and avatar
|
||||
"""
|
||||
|
@ -377,6 +378,8 @@ def _getProfileHeader(baseDir: str, httpPrefix: str,
|
|||
htmlStr += loginButton
|
||||
htmlStr += ' </figcaption>\n'
|
||||
htmlStr += ' </figure>\n\n'
|
||||
if pinnedContent:
|
||||
htmlStr += pinnedContent
|
||||
return htmlStr
|
||||
|
||||
|
||||
|
@ -679,6 +682,15 @@ def htmlProfile(rssIconAtTop: bool,
|
|||
alsoKnownAs = profileJson['alsoKnownAs']
|
||||
|
||||
avatarUrl = profileJson['icon']['url']
|
||||
|
||||
# get pinned post content
|
||||
accountDir = baseDir + '/accounts/' + nickname + '@' + domain
|
||||
pinnedFilename = accountDir + '/pinToProfile.txt'
|
||||
pinnedContent = None
|
||||
if os.path.isfile(pinnedFilename):
|
||||
with open(pinnedFilename, 'r') as pinFile:
|
||||
pinnedContent = pinFile.read()
|
||||
|
||||
profileHeaderStr = \
|
||||
_getProfileHeader(baseDir, httpPrefix,
|
||||
nickname, domain,
|
||||
|
@ -687,7 +699,8 @@ def htmlProfile(rssIconAtTop: bool,
|
|||
avatarDescription,
|
||||
profileDescriptionShort,
|
||||
loginButton, avatarUrl, theme,
|
||||
movedTo, alsoKnownAs)
|
||||
movedTo, alsoKnownAs,
|
||||
pinnedContent)
|
||||
|
||||
profileStr = profileHeaderStr + donateSection
|
||||
profileStr += '<div class="container" id="buttonheader">\n'
|
||||
|
|
Loading…
Reference in New Issue