From a2a90f6bd1bf72ffc0d1e60d7933d360f83b9dff Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sun, 3 Nov 2019 09:19:37 +0000 Subject: [PATCH] Show contact and remove buttons on shares timeline --- webinterface.py | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/webinterface.py b/webinterface.py index 5f3f234a..d04c5920 100644 --- a/webinterface.py +++ b/webinterface.py @@ -1154,7 +1154,7 @@ def htmlProfileSkills(translate: {},nickname: str,domain: str,skillsJson: {}) -> profileStr='
'+profileStr+'
' return profileStr -def htmlIndividualShare(actor: str,item: {},translate: {},showContact: bool) -> str: +def htmlIndividualShare(actor: str,item: {},translate: {},showContact: bool,removeButton: bool) -> str: """Returns an individual shared item as html """ profileStr='
' @@ -1169,6 +1169,8 @@ def htmlIndividualShare(actor: str,item: {},translate: {},showContact: bool) -> if showContact: contactActor=item['actor'] profileStr+='

' + if removeButton: + profileStr+=' ' profileStr+='

' return profileStr @@ -1177,7 +1179,7 @@ def htmlProfileShares(actor: str,translate: {},nickname: str,domain: str,sharesJ """ profileStr='' for item in sharesJson['orderedItems']: - profileStr+=htmlIndividualShare(actor,item,translate,False) + profileStr+=htmlIndividualShare(actor,item,translate,False,False) if len(profileStr)>0: profileStr='
'+profileStr+'
' return profileStr @@ -1198,8 +1200,10 @@ def sharesTimelineJson(actor: str,pageNumber: int,itemsPerPage: int, \ sharesJson=loadJson(sharesFilename) if not sharesJson: continue + owner=actor.split('/users/')[0]+handle.split('@')[0] ctr=0 for itemID,item in sharesJson.items(): + item['actor']=owner allSharesJson[str(item['published'])]=item ctr+=1 if ctr>=maxSharesPerAccount: @@ -1224,7 +1228,6 @@ def sharesTimelineJson(actor: str,pageNumber: int,itemsPerPage: int, \ if ctr'+translate['Page up']+'' for published,item in sharesJson.items(): - timelineStr+=htmlIndividualShare(actor,item,translate,True) + showContactButton=False + if item['actor']!=actor: + showContactButton=True + showRemoveButton=False + if item['actor']==actor: + showRemoveButton=True + timelineStr+=htmlIndividualShare(actor,item,translate,showContactButton,showRemoveButton) if not lastPage: timelineStr+='
'+translate['Page down']+'
'