diff --git a/daemon.py b/daemon.py
index 86cdfd30b..8672b118f 100644
--- a/daemon.py
+++ b/daemon.py
@@ -3671,6 +3671,7 @@ class PubServer(BaseHTTPRequestHandler):
if self.server.default_post_language.get(nickname):
default_post_language = \
self.server.default_post_language[nickname]
+ default_buy_site = ''
msg = \
html_new_post({}, False, self.server.translate,
base_dir,
@@ -3712,7 +3713,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.dogwhistles,
self.server.min_images_for_accounts,
None, None, default_post_language,
- self.server.buy_sites)
+ self.server.buy_sites,
+ default_buy_site)
if msg:
msg = msg.encode('utf-8')
msglen = len(msg)
@@ -3832,6 +3834,7 @@ class PubServer(BaseHTTPRequestHandler):
if self.server.default_post_language.get(nickname):
default_post_language = \
self.server.default_post_language[nickname]
+ default_buy_site = ''
msg = \
html_new_post({}, False, self.server.translate,
base_dir,
@@ -3872,7 +3875,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.dogwhistles,
self.server.min_images_for_accounts,
None, None, default_post_language,
- self.server.buy_sites)
+ self.server.buy_sites,
+ default_buy_site)
if msg:
msg = msg.encode('utf-8')
msglen = len(msg)
@@ -16268,7 +16272,7 @@ class PubServer(BaseHTTPRequestHandler):
nickname,
self.server.domain_full,
self.server.person_cache)
-
+ default_buy_site = ''
msg = \
html_new_post(edit_post_params, media_instance,
translate,
@@ -16313,7 +16317,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.min_images_for_accounts,
new_post_month, new_post_year,
default_post_language,
- self.server.buy_sites)
+ self.server.buy_sites,
+ default_buy_site)
if not msg:
print('Error replying to ' + in_reply_to_url)
self._404()
diff --git a/translations/ar.json b/translations/ar.json
index f95a25c0f..a905add84 100644
--- a/translations/ar.json
+++ b/translations/ar.json
@@ -610,5 +610,6 @@
"Registrations remaining": "التسجيلات المتبقية",
"Edit reminder": "تحرير التذكير",
"Purchase": "شراء",
- "Subscribe": "الإشتراك"
+ "Subscribe": "الإشتراك",
+ "Buy link": "رابط شراء"
}
diff --git a/translations/bn.json b/translations/bn.json
index 9f2285128..6f8c9a2fa 100644
--- a/translations/bn.json
+++ b/translations/bn.json
@@ -610,5 +610,6 @@
"Registrations remaining": "রেজিস্ট্রেশন বাকি",
"Edit reminder": "অনুস্মারক সম্পাদনা করুন",
"Purchase": "ক্রয়",
- "Subscribe": "সাবস্ক্রাইব"
+ "Subscribe": "সাবস্ক্রাইব",
+ "Buy link": "সংযোগ কেনা"
}
diff --git a/translations/ca.json b/translations/ca.json
index ec85663ca..7d2a1a673 100644
--- a/translations/ca.json
+++ b/translations/ca.json
@@ -610,5 +610,6 @@
"Registrations remaining": "Inscripcions restants",
"Edit reminder": "Edita el recordatori",
"Purchase": "Compra",
- "Subscribe": "Subscriu-te"
+ "Subscribe": "Subscriu-te",
+ "Buy link": "Enllaç de compra"
}
diff --git a/translations/cy.json b/translations/cy.json
index 0f611cf52..9b1c34612 100644
--- a/translations/cy.json
+++ b/translations/cy.json
@@ -610,5 +610,6 @@
"Registrations remaining": "Cofrestriadau ar ôl",
"Edit reminder": "Golygu nodyn atgoffa",
"Purchase": "Prynu",
- "Subscribe": "Tanysgrifio"
+ "Subscribe": "Tanysgrifio",
+ "Buy link": "Prynu dolen"
}
diff --git a/translations/de.json b/translations/de.json
index 77e57c285..e9381fe8f 100644
--- a/translations/de.json
+++ b/translations/de.json
@@ -610,5 +610,6 @@
"Registrations remaining": "Anmeldungen verbleiben",
"Edit reminder": "Erinnerung bearbeiten",
"Purchase": "Kaufen",
- "Subscribe": "Abonnieren"
+ "Subscribe": "Abonnieren",
+ "Buy link": "Link kaufen"
}
diff --git a/translations/el.json b/translations/el.json
index 6e37693d0..f52794045 100644
--- a/translations/el.json
+++ b/translations/el.json
@@ -610,5 +610,6 @@
"Registrations remaining": "Απομένουν οι εγγραφές",
"Edit reminder": "Επεξεργασία υπενθύμισης",
"Purchase": "Αγορά",
- "Subscribe": "Εγγραφείτε"
+ "Subscribe": "Εγγραφείτε",
+ "Buy link": "Σύνδεσμος αγοράς"
}
diff --git a/translations/en.json b/translations/en.json
index 406b6eac4..b609436cc 100644
--- a/translations/en.json
+++ b/translations/en.json
@@ -610,5 +610,6 @@
"Registrations remaining": "Registrations remaining",
"Edit reminder": "Edit reminder",
"Purchase": "Purchase",
- "Subscribe": "Subscribe"
+ "Subscribe": "Subscribe",
+ "Buy link": "Buy link"
}
diff --git a/translations/es.json b/translations/es.json
index 784058bac..ce6b671ed 100644
--- a/translations/es.json
+++ b/translations/es.json
@@ -610,5 +610,6 @@
"Registrations remaining": "Registros restantes",
"Edit reminder": "Editar recordatorio",
"Purchase": "Compra",
- "Subscribe": "Suscribir"
+ "Subscribe": "Suscribir",
+ "Buy link": "Enlace de compra"
}
diff --git a/translations/fa.json b/translations/fa.json
index c49d28e7e..36b442958 100644
--- a/translations/fa.json
+++ b/translations/fa.json
@@ -610,5 +610,6 @@
"Registrations remaining": "ثبت نام باقی مانده است",
"Edit reminder": "ویرایش یادآوری",
"Purchase": "خرید",
- "Subscribe": "اشتراک در"
+ "Subscribe": "اشتراک در",
+ "Buy link": "لینک خرید"
}
diff --git a/translations/fr.json b/translations/fr.json
index a6db94b3f..dff468ab6 100644
--- a/translations/fr.json
+++ b/translations/fr.json
@@ -610,5 +610,6 @@
"Registrations remaining": "Inscriptions restantes",
"Edit reminder": "Modifier le rappel",
"Purchase": "Acheter",
- "Subscribe": "S'abonner"
+ "Subscribe": "S'abonner",
+ "Buy link": "Acheter un lien"
}
diff --git a/translations/ga.json b/translations/ga.json
index 2daed5a2b..adde1a810 100644
--- a/translations/ga.json
+++ b/translations/ga.json
@@ -610,5 +610,6 @@
"Registrations remaining": "Clárúcháin fágtha",
"Edit reminder": "Cuir meabhrúchán in eagar",
"Purchase": "Ceannach",
- "Subscribe": "Liostáil"
+ "Subscribe": "Liostáil",
+ "Buy link": "Ceannaigh nasc"
}
diff --git a/translations/hi.json b/translations/hi.json
index c7b576c6c..4f0b54782 100644
--- a/translations/hi.json
+++ b/translations/hi.json
@@ -610,5 +610,6 @@
"Registrations remaining": "रजिस्ट्रेशन बाकी हैं",
"Edit reminder": "रिमाइंडर संपादित करें",
"Purchase": "खरीदना",
- "Subscribe": "सदस्यता लेने के"
+ "Subscribe": "सदस्यता लेने के",
+ "Buy link": "लिंक खरीदें"
}
diff --git a/translations/it.json b/translations/it.json
index a46ba260a..94b851b07 100644
--- a/translations/it.json
+++ b/translations/it.json
@@ -610,5 +610,6 @@
"Registrations remaining": "Iscrizioni rimanenti",
"Edit reminder": "Modifica promemoria",
"Purchase": "Acquistare",
- "Subscribe": "Sottoscrivi"
+ "Subscribe": "Sottoscrivi",
+ "Buy link": "Link per l'acquisto"
}
diff --git a/translations/ja.json b/translations/ja.json
index cf4698433..9dfa8a408 100644
--- a/translations/ja.json
+++ b/translations/ja.json
@@ -610,5 +610,6 @@
"Registrations remaining": "残りの登録数",
"Edit reminder": "リマインダーを編集",
"Purchase": "購入",
- "Subscribe": "申し込む"
+ "Subscribe": "申し込む",
+ "Buy link": "購入リンク"
}
diff --git a/translations/ko.json b/translations/ko.json
index 9533b6bd9..77ba773c2 100644
--- a/translations/ko.json
+++ b/translations/ko.json
@@ -610,5 +610,6 @@
"Registrations remaining": "남은 등록",
"Edit reminder": "알림 수정",
"Purchase": "구입",
- "Subscribe": "구독하다"
+ "Subscribe": "구독하다",
+ "Buy link": "구매 링크"
}
diff --git a/translations/ku.json b/translations/ku.json
index b01d66621..ac8e07cd7 100644
--- a/translations/ku.json
+++ b/translations/ku.json
@@ -610,5 +610,6 @@
"Registrations remaining": "Registrations maye",
"Edit reminder": "Bîranîna biguherîne",
"Purchase": "Kirrîn",
- "Subscribe": "Subscribe"
+ "Subscribe": "Subscribe",
+ "Buy link": "Girêdanê bikirin"
}
diff --git a/translations/nl.json b/translations/nl.json
index 790f303f6..61f2141a2 100644
--- a/translations/nl.json
+++ b/translations/nl.json
@@ -610,5 +610,6 @@
"Registrations remaining": "Resterende inschrijvingen",
"Edit reminder": "Herinnering bewerken",
"Purchase": "Aankoop",
- "Subscribe": "Abonneren"
+ "Subscribe": "Abonneren",
+ "Buy link": "koop link"
}
diff --git a/translations/oc.json b/translations/oc.json
index b1608f1a0..3b7eeb875 100644
--- a/translations/oc.json
+++ b/translations/oc.json
@@ -606,5 +606,6 @@
"Registrations remaining": "Registrations remaining",
"Edit reminder": "Edit reminder",
"Purchase": "Purchase",
- "Subscribe": "Subscribe"
+ "Subscribe": "Subscribe",
+ "Buy link": "Buy link"
}
diff --git a/translations/pl.json b/translations/pl.json
index b625c3cc4..aac582b80 100644
--- a/translations/pl.json
+++ b/translations/pl.json
@@ -610,5 +610,6 @@
"Registrations remaining": "Pozostały zapisy",
"Edit reminder": "Edytuj przypomnienie",
"Purchase": "Zakup",
- "Subscribe": "Subskrybuj"
+ "Subscribe": "Subskrybuj",
+ "Buy link": "Kup Link"
}
diff --git a/translations/pt.json b/translations/pt.json
index d467b80c6..c597c1e21 100644
--- a/translations/pt.json
+++ b/translations/pt.json
@@ -610,5 +610,6 @@
"Registrations remaining": "Inscrições restantes",
"Edit reminder": "Editar lembrete",
"Purchase": "Comprar",
- "Subscribe": "Se inscrever"
+ "Subscribe": "Se inscrever",
+ "Buy link": "Link de compra"
}
diff --git a/translations/ru.json b/translations/ru.json
index 721447c70..8254236b3 100644
--- a/translations/ru.json
+++ b/translations/ru.json
@@ -610,5 +610,6 @@
"Registrations remaining": "Осталось регистраций",
"Edit reminder": "Изменить напоминание",
"Purchase": "Покупка",
- "Subscribe": "Подписаться"
+ "Subscribe": "Подписаться",
+ "Buy link": "Купить ссылку"
}
diff --git a/translations/sw.json b/translations/sw.json
index 2f4f02c10..40f4e4097 100644
--- a/translations/sw.json
+++ b/translations/sw.json
@@ -610,5 +610,6 @@
"Registrations remaining": "Usajili uliosalia",
"Edit reminder": "Badilisha kikumbusho",
"Purchase": "Nunua",
- "Subscribe": "Jisajili"
+ "Subscribe": "Jisajili",
+ "Buy link": "Nunua kiungo"
}
diff --git a/translations/tr.json b/translations/tr.json
index db2e448d0..aba9288a9 100644
--- a/translations/tr.json
+++ b/translations/tr.json
@@ -610,5 +610,6 @@
"Registrations remaining": "kalan kayıtlar",
"Edit reminder": "Hatırlatıcıyı düzenle",
"Purchase": "Satın alma",
- "Subscribe": "Abone"
+ "Subscribe": "Abone",
+ "Buy link": "Bağlantı satın al"
}
diff --git a/translations/uk.json b/translations/uk.json
index d0d848bb8..030935be9 100644
--- a/translations/uk.json
+++ b/translations/uk.json
@@ -610,5 +610,6 @@
"Registrations remaining": "Залишилось реєстрацій",
"Edit reminder": "Редагувати нагадування",
"Purchase": "Купівля",
- "Subscribe": "Підпишіться"
+ "Subscribe": "Підпишіться",
+ "Buy link": "Купити посилання"
}
diff --git a/translations/yi.json b/translations/yi.json
index b9393777b..343c45346 100644
--- a/translations/yi.json
+++ b/translations/yi.json
@@ -610,5 +610,6 @@
"Registrations remaining": "רעדזשיסטריישאַנז רוען",
"Edit reminder": "רעדאַגירן דערמאָנונג",
"Purchase": "קויפן",
- "Subscribe": "אַבאָנירן"
+ "Subscribe": "אַבאָנירן",
+ "Buy link": "קויפן לינק"
}
diff --git a/translations/zh.json b/translations/zh.json
index 997c4c53f..742429670 100644
--- a/translations/zh.json
+++ b/translations/zh.json
@@ -610,5 +610,6 @@
"Registrations remaining": "剩余名额",
"Edit reminder": "编辑提醒",
"Purchase": "购买",
- "Subscribe": "订阅"
+ "Subscribe": "订阅",
+ "Buy link": "购买链接"
}
diff --git a/webapp_create_post.py b/webapp_create_post.py
index 0652a2ef7..8a7d602e9 100644
--- a/webapp_create_post.py
+++ b/webapp_create_post.py
@@ -24,6 +24,7 @@ from utils import get_currencies
from utils import get_category_types
from utils import get_account_timezone
from utils import get_supported_languages
+from webapp_utils import get_buy_links
from webapp_utils import html_following_data_list
from webapp_utils import html_common_emoji
from webapp_utils import begin_edit_section
@@ -240,7 +241,8 @@ def html_new_post(edit_post_params: {},
min_images_for_accounts: [],
default_month: int, default_year: int,
default_post_language: str,
- buy_sites: {}) -> str:
+ buy_sites: {},
+ default_buy_site: str) -> str:
"""New post screen
"""
# get the json if this is an edited post
@@ -257,6 +259,12 @@ def html_new_post(edit_post_params: {},
return ''
if not edited_post_json:
return ''
+ buy_links = \
+ get_buy_links(edited_post_json, translate, buy_sites)
+ if buy_links:
+ for _, buy_url in buy_links.items():
+ default_buy_site = buy_url
+ break
if edited_post_json['object'].get('conversation'):
conversation_id = edited_post_json['object']['conversation']
elif edited_post_json['object'].get('context'):
@@ -481,7 +489,6 @@ def html_new_post(edit_post_params: {},
' \n'
-
new_post_image_section += end_edit_section()
new_post_emoji_section = ''
@@ -768,6 +775,9 @@ def html_new_post(edit_post_params: {},
' \n'
replies_section += languages_dropdown
+ buy_link_str = '🛒 ' + translate['Buy link']
+ replies_section += edit_text_field(buy_link_str + ':', 'buySite',
+ default_buy_site, 'https://...')
replies_section += '\n'
date_and_location = \
diff --git a/webapp_post.py b/webapp_post.py
index 161bf2d55..98d172b7b 100644
--- a/webapp_post.py
+++ b/webapp_post.py
@@ -1844,19 +1844,21 @@ def _get_buy_footer(buy_links: {}, translate: {}) -> str:
if not buy_links:
return ''
icon_filename = 'buy.png'
- buy_title, buy_url = buy_links.items()[0]
- if buy_title:
- description = buy_title
- else:
- description = translate['Buy']
- buy_str = \
- ' ' + \
- '' + \
- '
\n'
-
+ description = ''
+ buy_str = ''
+ for buy_title, buy_url in buy_links.items():
+ if buy_title:
+ description = buy_title
+ else:
+ description = translate['Buy']
+ buy_str = \
+ ' ' + \
+ '' + \
+ '
\n'
+ break
return buy_str