diff --git a/daemon.py b/daemon.py index 4300d4d4..5b9eef9c 100644 --- a/daemon.py +++ b/daemon.py @@ -7116,14 +7116,32 @@ class PubServer(BaseHTTPRequestHandler): if not removeTwitterActive: if os.path.isfile(removeTwitterFilename): os.remove(removeTwitterFilename) - # notify about new Likes + # hide Like button + hideLikeButtonFile = \ + self.server.baseDir + '/accounts/' + \ + nickname + '@' + self.server.domain + \ + '/.hideLikeButton' notifyLikesFilename = \ self.server.baseDir + '/accounts/' + \ nickname + '@' + self.server.domain + \ '/.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 if fields.get('notifyLikes'): - if fields['notifyLikes'] == 'on': + if fields['notifyLikes'] == 'on' and \ + not hideLikeButtonActive: notifyLikesActive = True with open(notifyLikesFilename, "w") as rFile: rFile.write('\n') diff --git a/webinterface.py b/webinterface.py index a2e451b4..225afa29 100644 --- a/webinterface.py +++ b/webinterface.py @@ -1084,6 +1084,7 @@ def htmlEditProfile(translate: {}, baseDir: str, path: str, followDMs = '' removeTwitter = '' notifyLikes = '' + hideLikeButton = '' mediaInstanceStr = '' displayNickname = nickname bioStr = '' @@ -1134,6 +1135,9 @@ def htmlEditProfile(translate: {}, baseDir: str, path: str, if os.path.isfile(baseDir + '/accounts/' + nickname + '@' + domain + '/.notifyLikes'): notifyLikes = 'checked' + if os.path.isfile(baseDir + '/accounts/' + + nickname + '@' + domain + '/.hideLikeButton'): + hideLikeButton = 'checked' mediaInstance = getConfigParam(baseDir, "mediaInstance") if mediaInstance: @@ -1473,6 +1477,10 @@ def htmlEditProfile(translate: {}, baseDir: str, path: str, ' ' + \ translate['Notify when posts are liked'] + '
\n' + editProfileForm += \ + ' ' + \ + translate["Don't show the Like button"] + '
\n' editProfileForm += \ '