mirror of https://gitlab.com/bashrc2/epicyon
Attachment rather than tag
parent
a9491491e7
commit
dd299c636e
2
posts.py
2
posts.py
|
@ -1105,6 +1105,8 @@ def _attach_buy_link(post_json_object: {},
|
||||||
buy_str = 'Buy'
|
buy_str = 'Buy'
|
||||||
if translate.get(buy_str):
|
if translate.get(buy_str):
|
||||||
buy_str = translate[buy_str]
|
buy_str = translate[buy_str]
|
||||||
|
if 'attachment' not in post_json_object:
|
||||||
|
post_json_object['attachment'] = []
|
||||||
post_json_object['attachment'].append({
|
post_json_object['attachment'].append({
|
||||||
"type": "Link",
|
"type": "Link",
|
||||||
"name": buy_str,
|
"name": buy_str,
|
||||||
|
|
|
@ -2508,10 +2508,11 @@ def individual_post_as_html(signing_priv_key_pem: str,
|
||||||
|
|
||||||
# html for the buy icon
|
# html for the buy icon
|
||||||
buy_str = ''
|
buy_str = ''
|
||||||
if post_json_object['object'].get('tag'):
|
if 'attachment' not in post_json_object['object']:
|
||||||
if not is_patch:
|
post_json_object['object']['attachment'] = []
|
||||||
buy_links = get_buy_links(post_json_object, translate, buy_sites)
|
if not is_patch:
|
||||||
buy_str = _get_buy_footer(buy_links, translate)
|
buy_links = get_buy_links(post_json_object, translate, buy_sites)
|
||||||
|
buy_str = _get_buy_footer(buy_links, translate)
|
||||||
|
|
||||||
new_footer_str = \
|
new_footer_str = \
|
||||||
_get_footer_with_icons(show_icons,
|
_get_footer_with_icons(show_icons,
|
||||||
|
|
|
@ -2085,9 +2085,9 @@ def html_following_dropdown(base_dir: str, nickname: str,
|
||||||
def get_buy_links(post_json_object: str, translate: {}, buy_sites: {}) -> {}:
|
def get_buy_links(post_json_object: str, translate: {}, buy_sites: {}) -> {}:
|
||||||
"""Returns any links to buy something from an external site
|
"""Returns any links to buy something from an external site
|
||||||
"""
|
"""
|
||||||
if not post_json_object['object'].get('tag'):
|
if not post_json_object['object'].get('attachment'):
|
||||||
return {}
|
return {}
|
||||||
if not isinstance(post_json_object['object']['tag'], list):
|
if not isinstance(post_json_object['object']['attachment'], list):
|
||||||
return {}
|
return {}
|
||||||
links = {}
|
links = {}
|
||||||
buy_strings = []
|
buy_strings = []
|
||||||
|
@ -2095,7 +2095,7 @@ def get_buy_links(post_json_object: str, translate: {}, buy_sites: {}) -> {}:
|
||||||
if translate.get(buy_str):
|
if translate.get(buy_str):
|
||||||
buy_str = translate[buy_str]
|
buy_str = translate[buy_str]
|
||||||
buy_strings += buy_str.lower()
|
buy_strings += buy_str.lower()
|
||||||
for item in post_json_object['object']['tag']:
|
for item in post_json_object['object']['attachment']:
|
||||||
if not isinstance(item, dict):
|
if not isinstance(item, dict):
|
||||||
continue
|
continue
|
||||||
if not item.get('name'):
|
if not item.get('name'):
|
||||||
|
|
Loading…
Reference in New Issue