Bookmarked mute button

merge-requests/6/head
Bob Mottram 2019-12-01 15:28:23 +00:00
parent 37f2ae5776
commit 087712addd
2 changed files with 16 additions and 4 deletions

View File

@ -2117,6 +2117,12 @@ class PubServer(BaseHTTPRequestHandler):
muteUrl=self.path.split('?mute=')[1]
if '?' in muteUrl:
muteUrl=muteUrl.split('?')[0]
timelineBookmark=''
if '?bm=' in self.path:
timelineBookmark=self.path.split('?bm=')[1]
if '?' in timelineBookmark:
timelineBookmark=timelineBookmark.split('?')[0]
timelineBookmark='#'+timelineBookmark
timelineStr=self.server.defaultTimeline
if '?tl=' in self.path:
timelineStr=self.path.split('?tl=')[1]
@ -2129,7 +2135,7 @@ class PubServer(BaseHTTPRequestHandler):
mutePost(self.server.baseDir,nickname,self.server.domain, \
muteUrl,self.server.recentPostsCache)
self.server.GETbusy=False
self._redirect_headers(actor+'/'+timelineStr,cookie)
self._redirect_headers(actor+'/'+timelineStr+timelineBookmark,cookie)
return
# unmute a post from the web interface icon
@ -2144,6 +2150,12 @@ class PubServer(BaseHTTPRequestHandler):
muteUrl=self.path.split('?unmute=')[1]
if '?' in muteUrl:
muteUrl=muteUrl.split('?')[0]
timelineBookmark=''
if '?bm=' in self.path:
timelineBookmark=self.path.split('?bm=')[1]
if '?' in timelineBookmark:
timelineBookmark=timelineBookmark.split('?')[0]
timelineBookmark='#'+timelineBookmark
timelineStr=self.server.defaultTimeline
if '?tl=' in self.path:
timelineStr=self.path.split('?tl=')[1]
@ -2156,7 +2168,7 @@ class PubServer(BaseHTTPRequestHandler):
unmutePost(self.server.baseDir,nickname,self.server.domain, \
muteUrl,self.server.recentPostsCache)
self.server.GETbusy=False
self._redirect_headers(actor+'/'+timelineStr,cookie)
self._redirect_headers(actor+'/'+timelineStr+timelineBookmark,cookie)
return
# reply from the web interface icon

View File

@ -2267,10 +2267,10 @@ def individualPostAsHtml(recentPostsCache: {},maxRecentPosts: int, \
deleteStr+='<img loading="lazy" alt="'+translate['Delete this post']+'" title="'+translate['Delete this post']+'" src="/'+iconsDir+'/delete.png"/></a>'
else:
if not isMuted:
muteStr='<a href="/users/'+nickname+'?mute='+postJsonObject['object']['id']+pageNumberParam+'" title="'+translate['Mute this post']+'">'
muteStr='<a href="/users/'+nickname+'?mute='+postJsonObject['object']['id']+pageNumberParam+'?bm='+timelinePostBookmark+'" title="'+translate['Mute this post']+'">'
muteStr+='<img loading="lazy" alt="'+translate['Mute this post']+'" title="'+translate['Mute this post']+'" src="/'+iconsDir+'/mute.png"/></a>'
else:
muteStr='<a href="/users/'+nickname+'?unmute='+postJsonObject['object']['id']+pageNumberParam+'" title="'+translate['Undo mute']+'">'
muteStr='<a href="/users/'+nickname+'?unmute='+postJsonObject['object']['id']+pageNumberParam+'?bm='+timelinePostBookmark+'" title="'+translate['Undo mute']+'">'
muteStr+='<img loading="lazy" alt="'+translate['Undo mute']+'" title="'+translate['Undo mute']+'" src="/'+iconsDir+'/mute.png"/></a>'
replyAvatarImageInPost=''