No remove button on federated shared items

merge-requests/20/merge
Bob Mottram 2021-07-28 21:58:30 +01:00
parent 7b0c9bc03d
commit d4704e08eb
2 changed files with 18 additions and 4 deletions

View File

@ -913,6 +913,11 @@ def _htmlSharesTimeline(translate: {}, pageNumber: int, itemsPerPage: int,
sharedItemsFederatedDomains)
domainFull = getFullDomain(domain, port)
actor = httpPrefix + '://' + domainFull + '/users/' + nickname
adminNickname = getConfigParam(baseDir, 'admin')
adminActor = ''
if adminNickname:
adminActor = \
httpPrefix + '://' + domainFull + '/users/' + adminNickname
timelineStr = ''
if pageNumber > 1:
@ -927,13 +932,22 @@ def _htmlSharesTimeline(translate: {}, pageNumber: int, itemsPerPage: int,
separatorStr = htmlPostSeparator(baseDir, None)
ctr = 0
isAdminAccount = False
if adminActor and actor == adminActor:
isAdminAccount = True
isModeratorAccount = False
if isModerator(baseDir, nickname):
isModeratorAccount = True
for published, item in sharesJson.items():
showContactButton = False
if item['actor'] != actor:
showContactButton = True
showRemoveButton = False
if item['actor'] == actor:
showRemoveButton = True
if '___' + domain in item['shareId']:
if item['actor'] == actor or isAdminAccount or isModeratorAccount:
showRemoveButton = True
timelineStr += \
htmlIndividualShare(domain, item['shareId'],
actor, item, translate,

View File

@ -1256,7 +1256,7 @@ def editTextArea(label: str, name: str, value: str = "",
def htmlSearchResultShare(baseDir: str, sharedItem: {}, translate: {},
httpPrefix: str, domainFull: str,
contactNickname: str, name: str,
contactNickname: str, itemID: str,
actor: str) -> str:
"""Returns the html for an individual shared item
"""
@ -1316,7 +1316,7 @@ def htmlSearchResultShare(baseDir: str, sharedItem: {}, translate: {},
if showRemoveButton:
sharedItemsForm += \
' <a href="' + actor + '?rmshare=' + \
name + '"><button class="button">' + \
itemID + '"><button class="button">' + \
translate['Remove'] + '</button></a>\n'
sharedItemsForm += '</p></div>\n'
return sharedItemsForm