forked from indymedia/epicyon
Option to not show like button
parent
cabdc9c3c5
commit
3200305024
22
daemon.py
22
daemon.py
|
@ -7116,14 +7116,32 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
if not removeTwitterActive:
|
if not removeTwitterActive:
|
||||||
if os.path.isfile(removeTwitterFilename):
|
if os.path.isfile(removeTwitterFilename):
|
||||||
os.remove(removeTwitterFilename)
|
os.remove(removeTwitterFilename)
|
||||||
# notify about new Likes
|
# hide Like button
|
||||||
|
hideLikeButtonFile = \
|
||||||
|
self.server.baseDir + '/accounts/' + \
|
||||||
|
nickname + '@' + self.server.domain + \
|
||||||
|
'/.hideLikeButton'
|
||||||
notifyLikesFilename = \
|
notifyLikesFilename = \
|
||||||
self.server.baseDir + '/accounts/' + \
|
self.server.baseDir + '/accounts/' + \
|
||||||
nickname + '@' + self.server.domain + \
|
nickname + '@' + self.server.domain + \
|
||||||
'/.notifyLikes'
|
'/.notifyLikes'
|
||||||
|
hideLikeButtonActive = False
|
||||||
|
if fields.get('hideLikeButton'):
|
||||||
|
if fields['hideLikeButton'] == 'on':
|
||||||
|
hideLikeButtonActive = True
|
||||||
|
with open(hideLikeButtonFile, "w") as rFile:
|
||||||
|
rFile.write('\n')
|
||||||
|
# remove notify likes selection
|
||||||
|
if os.path.isfile(notifyLikesFilename):
|
||||||
|
os.remove(notifyLikesFilename)
|
||||||
|
if not hideLikeButtonActive:
|
||||||
|
if os.path.isfile(hideLikeButtonFile):
|
||||||
|
os.remove(hideLikeButtonFile)
|
||||||
|
# notify about new Likes
|
||||||
notifyLikesActive = False
|
notifyLikesActive = False
|
||||||
if fields.get('notifyLikes'):
|
if fields.get('notifyLikes'):
|
||||||
if fields['notifyLikes'] == 'on':
|
if fields['notifyLikes'] == 'on' and \
|
||||||
|
not hideLikeButtonActive:
|
||||||
notifyLikesActive = True
|
notifyLikesActive = True
|
||||||
with open(notifyLikesFilename, "w") as rFile:
|
with open(notifyLikesFilename, "w") as rFile:
|
||||||
rFile.write('\n')
|
rFile.write('\n')
|
||||||
|
|
|
@ -1084,6 +1084,7 @@ def htmlEditProfile(translate: {}, baseDir: str, path: str,
|
||||||
followDMs = ''
|
followDMs = ''
|
||||||
removeTwitter = ''
|
removeTwitter = ''
|
||||||
notifyLikes = ''
|
notifyLikes = ''
|
||||||
|
hideLikeButton = ''
|
||||||
mediaInstanceStr = ''
|
mediaInstanceStr = ''
|
||||||
displayNickname = nickname
|
displayNickname = nickname
|
||||||
bioStr = ''
|
bioStr = ''
|
||||||
|
@ -1134,6 +1135,9 @@ def htmlEditProfile(translate: {}, baseDir: str, path: str,
|
||||||
if os.path.isfile(baseDir + '/accounts/' +
|
if os.path.isfile(baseDir + '/accounts/' +
|
||||||
nickname + '@' + domain + '/.notifyLikes'):
|
nickname + '@' + domain + '/.notifyLikes'):
|
||||||
notifyLikes = 'checked'
|
notifyLikes = 'checked'
|
||||||
|
if os.path.isfile(baseDir + '/accounts/' +
|
||||||
|
nickname + '@' + domain + '/.hideLikeButton'):
|
||||||
|
hideLikeButton = 'checked'
|
||||||
|
|
||||||
mediaInstance = getConfigParam(baseDir, "mediaInstance")
|
mediaInstance = getConfigParam(baseDir, "mediaInstance")
|
||||||
if mediaInstance:
|
if mediaInstance:
|
||||||
|
@ -1473,6 +1477,10 @@ def htmlEditProfile(translate: {}, baseDir: str, path: str,
|
||||||
' <input type="checkbox" class="profilecheckbox" ' + \
|
' <input type="checkbox" class="profilecheckbox" ' + \
|
||||||
'name="notifyLikes" ' + notifyLikes + '> ' + \
|
'name="notifyLikes" ' + notifyLikes + '> ' + \
|
||||||
translate['Notify when posts are liked'] + '<br>\n'
|
translate['Notify when posts are liked'] + '<br>\n'
|
||||||
|
editProfileForm += \
|
||||||
|
' <input type="checkbox" class="profilecheckbox" ' + \
|
||||||
|
'name="hideLikeButton" ' + hideLikeButton + '> ' + \
|
||||||
|
translate["Don't show the Like button"] + '<br>\n'
|
||||||
|
|
||||||
editProfileForm += \
|
editProfileForm += \
|
||||||
' <br><b><label class="labels">' + \
|
' <br><b><label class="labels">' + \
|
||||||
|
@ -4083,8 +4091,15 @@ def individualPostAsHtml(recentPostsCache: {}, maxRecentPosts: int,
|
||||||
'" alt="' + translate['Repeat this post'] + \
|
'" alt="' + translate['Repeat this post'] + \
|
||||||
' |" src="/' + iconsDir + '/' + announceIcon + '"/></a>\n'
|
' |" src="/' + iconsDir + '/' + announceIcon + '"/></a>\n'
|
||||||
|
|
||||||
|
# whether to show a like button
|
||||||
|
hideLikeButtonFile = \
|
||||||
|
baseDir + '/accounts/' + nickname + '@' + domain + '/.hideLikeButton'
|
||||||
|
showLikeButton = True
|
||||||
|
if os.path.isfile(hideLikeButtonFile):
|
||||||
|
showLikeButton = False
|
||||||
|
|
||||||
likeStr = ''
|
likeStr = ''
|
||||||
if not isModerationPost:
|
if not isModerationPost and showLikeButton:
|
||||||
likeIcon = 'like_inactive.png'
|
likeIcon = 'like_inactive.png'
|
||||||
likeLink = 'like'
|
likeLink = 'like'
|
||||||
likeTitle = translate['Like this post']
|
likeTitle = translate['Like this post']
|
||||||
|
|
Loading…
Reference in New Issue