Set share id

merge-requests/30/head
Bob Mottram 2023-08-23 13:24:25 +01:00
parent d5d620a428
commit 4ca472ebc9
2 changed files with 6 additions and 1 deletions

View File

@ -2164,12 +2164,15 @@ def vf_proposal_from_id(base_dir: str, nickname: str, domain: str,
shares_filename = \
acct_dir(base_dir, nickname, domain) + '/' + shares_file_type + '.json'
if not os.path.isfile(shares_filename):
print('DEBUG: vf_proposal_from_id file not found ' + shares_filename)
return {}
shares_json = load_json(shares_filename)
if not shares_json:
print('DEBUG: vf_proposal_from_id file not loaded ' + shares_filename)
return {}
if not shares_json.get(share_id):
print('DEBUG: vf_proposal_from_id does not contain id ' + share_id)
return {}
if shares_file_type == 'shares':
share_type = 'Proposal'
@ -2179,6 +2182,7 @@ def vf_proposal_from_id(base_dir: str, nickname: str, domain: str,
share_type = 'Want'
publishes_direction = "receiver"
reciprocal_direction = "provider"
shares_json[share_id]['shareId'] = share_id
return vf_proposal_from_share(shares_json[share_id],
share_type,
publishes_direction,

View File

@ -587,7 +587,8 @@ def get_shares_collection(actor: str, page_number: int, items_per_page: int,
reciprocal_direction = "provider"
collection_name = nickname + "'s Wanted Items"
for _, shared_item in shares_json.items():
for share_id, shared_item in shares_json.items():
shared_item['shareId'] = share_id
offer_item = vf_proposal_from_share(shared_item,
share_type,
publishes_direction,