From 9cf917907de2155292450943c3b399f50981240f Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Tue, 27 Jul 2021 23:29:40 +0100 Subject: [PATCH] Don't show remove button for federated shares --- webapp_profile.py | 3 ++- webapp_timeline.py | 10 ++++++---- webapp_utils.py | 2 ++ 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/webapp_profile.py b/webapp_profile.py index 48dc77bd1..30a66a0d2 100644 --- a/webapp_profile.py +++ b/webapp_profile.py @@ -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 = '
' + profileStr + '
\n' return profileStr diff --git a/webapp_timeline.py b/webapp_timeline.py index 18ba0da1c..b05120f23 100644 --- a/webapp_timeline.py +++ b/webapp_timeline.py @@ -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 + '">\n' - if removeButton: + if removeButton and domain in shareId: profileStr += \ - ' \n' profileStr += '\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 diff --git a/webapp_utils.py b/webapp_utils.py index 8573c8a15..0f1a2da73 100644 --- a/webapp_utils.py +++ b/webapp_utils.py @@ -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: