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 = '' profileStr = ''
for item in sharesJson['orderedItems']: 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: if len(profileStr) > 0:
profileStr = '<div class="share-title">' + profileStr + '</div>\n' profileStr = '<div class="share-title">' + profileStr + '</div>\n'
return profileStr return profileStr

View File

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

View File

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