Don't show remove button for federated shares

merge-requests/30/head
Bob Mottram 2021-07-27 23:29:40 +01:00
parent b8d3ad28ac
commit 9cf917907d
3 changed files with 10 additions and 5 deletions

View File

@ -1013,7 +1013,8 @@ def _htmlProfileShares(actor: str, translate: {},
"""
profileStr = ''
for item in sharesJson['orderedItems']:
profileStr += htmlIndividualShare(actor, item, translate, False, False)
profileStr += htmlIndividualShare(domain, item['shareId'],
actor, item, translate, False, False)
if len(profileStr) > 0:
profileStr = '<div class="share-title">' + profileStr + '</div>\n'
return profileStr

View File

@ -813,7 +813,8 @@ def htmlTimeline(cssCache: {}, defaultTimeline: str,
return tlStr
def htmlIndividualShare(actor: str, item: {}, translate: {},
def htmlIndividualShare(domain: str, shareId: str,
actor: str, item: {}, translate: {},
showContact: bool, removeButton: bool) -> str:
"""Returns an individual shared item as html
"""
@ -854,9 +855,9 @@ def htmlIndividualShare(actor: str, item: {}, translate: {},
'?replydm=sharedesc:' + sharedesc + \
'?mention=' + contactActor + '"><button class="button">' + \
translate['Contact'] + '</button></a>\n'
if removeButton:
if removeButton and domain in shareId:
profileStr += \
' <a href="' + actor + '?rmshare=' + sharedesc + \
' <a href="' + actor + '?rmshare=' + shareId + \
'"><button class="button">' + \
translate['Remove'] + '</button></a>\n'
profileStr += '</div>\n'
@ -898,7 +899,8 @@ def _htmlSharesTimeline(translate: {}, pageNumber: int, itemsPerPage: int,
if item['actor'] == actor:
showRemoveButton = True
timelineStr += \
htmlIndividualShare(actor, item, translate,
htmlIndividualShare(domain, item['shareId'],
actor, item, translate,
showContactButton, showRemoveButton)
timelineStr += separatorStr
ctr += 1

View File

@ -357,6 +357,7 @@ def sharesTimelineJson(actor: str, pageNumber: int, itemsPerPage: int,
for itemID, item in sharesJson.items():
# assign owner to the item
item['actor'] = owner
item['shareId'] = itemID
allSharesJson[str(item['published'])] = item
ctr += 1
if ctr >= maxSharesPerAccount:
@ -387,6 +388,7 @@ def sharesTimelineJson(actor: str, pageNumber: int, itemsPerPage: int,
shareActor = shareActor.replace('___', '://')
shareActor = shareActor.replace('--', '/')
item['actor'] = shareActor
item['shareId'] = itemID
allSharesJson[str(item['published'])] = item
ctr += 1
if ctr >= maxSharesPerAccount: