Checkbox for displaying shared item on profile

merge-requests/30/head
Bob Mottram 2023-08-22 19:23:25 +01:00
parent b1b8215464
commit f2656973d3
30 changed files with 68 additions and 37 deletions

View File

@ -22433,10 +22433,10 @@ class PubServer(BaseHTTPRequestHandler):
else: else:
print('Adding wanted item') print('Adding wanted item')
shares_file_type = 'wanted' shares_file_type = 'wanted'
on_profile = False share_on_profile = False
if fields.get('onProfile'): if fields.get('shareOnProfile'):
if fields['onProfile'] == 'on': if fields['shareOnProfile'] == 'on':
on_profile = True share_on_profile = True
add_share(self.server.base_dir, add_share(self.server.base_dir,
self.server.http_prefix, self.server.http_prefix,
nickname, nickname,
@ -22454,9 +22454,9 @@ class PubServer(BaseHTTPRequestHandler):
self.server.translate, shares_file_type, self.server.translate, shares_file_type,
self.server.low_bandwidth, self.server.low_bandwidth,
self.server.content_license_url, self.server.content_license_url,
on_profile) share_on_profile)
if post_type == 'newshare': if post_type == 'newshare':
# add onProfile items to the actor attachments # add shareOnProfile items to the actor attachments
# https://codeberg.org/fediverse/fep/src/branch/main/fep/0837/fep-0837.md # https://codeberg.org/fediverse/fep/src/branch/main/fep/0837/fep-0837.md
actor = \ actor = \
self._get_instance_url(calling_domain) + \ self._get_instance_url(calling_domain) + \

View File

@ -314,7 +314,7 @@ def add_share(base_dir: str,
price: str, currency: str, price: str, currency: str,
system_language: str, translate: {}, system_language: str, translate: {},
shares_file_type: str, low_bandwidth: bool, shares_file_type: str, low_bandwidth: bool,
content_license_url: str, on_profile: bool) -> None: content_license_url: str, share_on_profile: bool) -> None:
"""Adds a new share """Adds a new share
""" """
if is_filtered_globally(base_dir, if is_filtered_globally(base_dir,
@ -394,7 +394,7 @@ def add_share(base_dir: str,
"expire": duration_sec, "expire": duration_sec,
"itemPrice": price, "itemPrice": price,
"itemCurrency": currency, "itemCurrency": currency,
"onProfile": on_profile "shareOnProfile": share_on_profile
} }
save_json(shares_json, shares_filename) save_json(shares_json, shares_filename)
@ -1929,7 +1929,7 @@ def _dfc_to_shares_format(catalog_json: {},
"expire": expiry_time_sec, "expire": expiry_time_sec,
"itemPrice": item['DFC:price'].split(' ')[0], "itemPrice": item['DFC:price'].split(' ')[0],
"itemCurrency": item['DFC:price'].split(' ')[1], "itemCurrency": item['DFC:price'].split(' ')[1],
"onProfile": False "shareOnProfile": False
} }
return shares_json return shares_json
@ -2181,7 +2181,7 @@ def add_shares_to_actor(base_dir: str,
for share_id, shared_item in shares_json.items(): for share_id, shared_item in shares_json.items():
if ctr >= max_shares_on_profile: if ctr >= max_shares_on_profile:
break break
if not shared_item.get('onProfile'): if not shared_item.get('shareOnProfile'):
continue continue
if not shared_item.get('shareId'): if not shared_item.get('shareId'):
continue continue

View File

@ -631,5 +631,6 @@
"Chat": "محادثة", "Chat": "محادثة",
"Chat link": "رابط الدردشة", "Chat link": "رابط الدردشة",
"Clear Cache": "مسح ذاكرة التخزين المؤقت", "Clear Cache": "مسح ذاكرة التخزين المؤقت",
"Block military instances": "منع الحالات العسكرية" "Block military instances": "منع الحالات العسكرية",
"Display on your public profile": "عرض على ملفك الشخصي العام"
} }

View File

@ -631,5 +631,6 @@
"Chat": "চ্যাট", "Chat": "চ্যাট",
"Chat link": "চ্যাট লিঙ্ক", "Chat link": "চ্যাট লিঙ্ক",
"Clear Cache": "ক্যাশে সাফ করুন", "Clear Cache": "ক্যাশে সাফ করুন",
"Block military instances": "সামরিক দৃষ্টান্ত ব্লক করুন" "Block military instances": "সামরিক দৃষ্টান্ত ব্লক করুন",
"Display on your public profile": "আপনার পাবলিক প্রোফাইলে প্রদর্শন করুন"
} }

View File

@ -631,5 +631,6 @@
"Chat": "Xatejar", "Chat": "Xatejar",
"Chat link": "Enllaç de xat", "Chat link": "Enllaç de xat",
"Clear Cache": "Netejar memòria cau", "Clear Cache": "Netejar memòria cau",
"Block military instances": "Bloquejar instàncies militars" "Block military instances": "Bloquejar instàncies militars",
"Display on your public profile": "Mostra al teu perfil públic"
} }

View File

@ -631,5 +631,6 @@
"Chat": "Sgwrsio", "Chat": "Sgwrsio",
"Chat link": "Dolen sgwrs", "Chat link": "Dolen sgwrs",
"Clear Cache": "Clirio Cache", "Clear Cache": "Clirio Cache",
"Block military instances": "Rhwystro achosion milwrol" "Block military instances": "Rhwystro achosion milwrol",
"Display on your public profile": "Arddangos ar eich proffil cyhoeddus"
} }

View File

@ -631,5 +631,6 @@
"Chat": "Plaudern", "Chat": "Plaudern",
"Chat link": "Chat-Link", "Chat link": "Chat-Link",
"Clear Cache": "Cache leeren", "Clear Cache": "Cache leeren",
"Block military instances": "Militärische Instanzen blockieren" "Block military instances": "Militärische Instanzen blockieren",
"Display on your public profile": "Anzeige in Ihrem öffentlichen Profil"
} }

View File

@ -631,5 +631,6 @@
"Chat": "Κουβέντα", "Chat": "Κουβέντα",
"Chat link": "Σύνδεσμος συνομιλίας", "Chat link": "Σύνδεσμος συνομιλίας",
"Clear Cache": "Εκκαθάριση προσωρινής μνήμης", "Clear Cache": "Εκκαθάριση προσωρινής μνήμης",
"Block military instances": "Αποκλεισμός στρατιωτικών περιπτώσεων" "Block military instances": "Αποκλεισμός στρατιωτικών περιπτώσεων",
"Display on your public profile": "Εμφάνιση στο δημόσιο προφίλ σας"
} }

View File

@ -631,5 +631,6 @@
"Chat": "Chat", "Chat": "Chat",
"Chat link": "Chat link", "Chat link": "Chat link",
"Clear Cache": "Clear Cache", "Clear Cache": "Clear Cache",
"Block military instances": "Block military instances" "Block military instances": "Block military instances",
"Display on your public profile": "Display on your public profile"
} }

View File

@ -631,5 +631,6 @@
"Chat": "Charlar", "Chat": "Charlar",
"Chat link": "Enlace de chat", "Chat link": "Enlace de chat",
"Clear Cache": "Limpiar cache", "Clear Cache": "Limpiar cache",
"Block military instances": "Bloquear instancias militares" "Block military instances": "Bloquear instancias militares",
"Display on your public profile": "Mostrar en su perfil público"
} }

View File

@ -631,5 +631,6 @@
"Chat": "چت کنید", "Chat": "چت کنید",
"Chat link": "لینک چت", "Chat link": "لینک چت",
"Clear Cache": "پاک کردن حافظه پنهان", "Clear Cache": "پاک کردن حافظه پنهان",
"Block military instances": "موارد نظامی را مسدود کنید" "Block military instances": "موارد نظامی را مسدود کنید",
"Display on your public profile": "نمایش در نمایه عمومی شما"
} }

View File

@ -631,5 +631,6 @@
"Chat": "Discuter", "Chat": "Discuter",
"Chat link": "Lien de discussion", "Chat link": "Lien de discussion",
"Clear Cache": "Vider le cache", "Clear Cache": "Vider le cache",
"Block military instances": "Bloquer les instances militaires" "Block military instances": "Bloquer les instances militaires",
"Display on your public profile": "Afficher sur votre profil public"
} }

View File

@ -631,5 +631,6 @@
"Chat": "Comhrá", "Chat": "Comhrá",
"Chat link": "Nasc comhrá", "Chat link": "Nasc comhrá",
"Clear Cache": "Glan Taisce", "Clear Cache": "Glan Taisce",
"Block military instances": "Bloc cásanna míleata" "Block military instances": "Bloc cásanna míleata",
"Display on your public profile": "Taispeáin ar do phróifíl phoiblí"
} }

View File

@ -631,5 +631,6 @@
"Chat": "לְשׂוֹחֵחַ", "Chat": "לְשׂוֹחֵחַ",
"Chat link": "קישור לצ'אט", "Chat link": "קישור לצ'אט",
"Clear Cache": "נקה מטמון", "Clear Cache": "נקה מטמון",
"Block military instances": "חסום מקרים צבאיים" "Block military instances": "חסום מקרים צבאיים",
"Display on your public profile": "הצג בפרופיל הציבורי שלך"
} }

View File

@ -631,5 +631,6 @@
"Chat": "बात करना", "Chat": "बात करना",
"Chat link": "चैट लिंक", "Chat link": "चैट लिंक",
"Clear Cache": "कैश को साफ़ करें", "Clear Cache": "कैश को साफ़ करें",
"Block military instances": "सैन्य उदाहरणों को ब्लॉक करें" "Block military instances": "सैन्य उदाहरणों को ब्लॉक करें",
"Display on your public profile": "अपनी सार्वजनिक प्रोफ़ाइल पर प्रदर्शित करें"
} }

View File

@ -631,5 +631,6 @@
"Chat": "Chiacchierata", "Chat": "Chiacchierata",
"Chat link": "Collegamento alla chat", "Chat link": "Collegamento alla chat",
"Clear Cache": "Cancella cache", "Clear Cache": "Cancella cache",
"Block military instances": "Blocca istanze militari" "Block military instances": "Blocca istanze militari",
"Display on your public profile": "Visualizza sul tuo profilo pubblico"
} }

View File

@ -631,5 +631,6 @@
"Chat": "チャット", "Chat": "チャット",
"Chat link": "チャットリンク", "Chat link": "チャットリンク",
"Clear Cache": "キャッシュの消去", "Clear Cache": "キャッシュの消去",
"Block military instances": "軍事インスタンスをブロックする" "Block military instances": "軍事インスタンスをブロックする",
"Display on your public profile": "公開プロフィールに表示する"
} }

View File

@ -631,5 +631,6 @@
"Chat": "채팅", "Chat": "채팅",
"Chat link": "채팅 링크", "Chat link": "채팅 링크",
"Clear Cache": "캐시 지우기", "Clear Cache": "캐시 지우기",
"Block military instances": "군사 인스턴스 차단" "Block military instances": "군사 인스턴스 차단",
"Display on your public profile": "공개 프로필에 표시"
} }

View File

@ -631,5 +631,6 @@
"Chat": "Galgalkirin", "Chat": "Galgalkirin",
"Chat link": "Lînka chatê", "Chat link": "Lînka chatê",
"Clear Cache": "Cache paqij bike", "Clear Cache": "Cache paqij bike",
"Block military instances": "Mînakên leşkerî asteng bikin" "Block military instances": "Mînakên leşkerî asteng bikin",
"Display on your public profile": "Li ser profîla xweya giştî nîşan bidin"
} }

View File

@ -631,5 +631,6 @@
"Chat": "Chatten", "Chat": "Chatten",
"Chat link": "Chat-link", "Chat link": "Chat-link",
"Clear Cache": "Cache wissen", "Clear Cache": "Cache wissen",
"Block military instances": "Blokkeer militaire instanties" "Block military instances": "Blokkeer militaire instanties",
"Display on your public profile": "Weergave op uw openbare profiel"
} }

View File

@ -627,5 +627,6 @@
"Chat": "Chat", "Chat": "Chat",
"Chat link": "Chat link", "Chat link": "Chat link",
"Clear Cache": "Clear Cache", "Clear Cache": "Clear Cache",
"Block military instances": "Block military instances" "Block military instances": "Block military instances",
"Display on your public profile": "Display on your public profile"
} }

View File

@ -631,5 +631,6 @@
"Chat": "Czat", "Chat": "Czat",
"Chat link": "Link do czatu", "Chat link": "Link do czatu",
"Clear Cache": "Wyczyść pamięć podręczną", "Clear Cache": "Wyczyść pamięć podręczną",
"Block military instances": "Blokuj instancje wojskowe" "Block military instances": "Blokuj instancje wojskowe",
"Display on your public profile": "Wyświetlaj na swoim profilu publicznym"
} }

View File

@ -631,5 +631,6 @@
"Chat": "Bater papo", "Chat": "Bater papo",
"Chat link": "Link de bate-papo", "Chat link": "Link de bate-papo",
"Clear Cache": "Limpar cache", "Clear Cache": "Limpar cache",
"Block military instances": "Bloquear instâncias militares" "Block military instances": "Bloquear instâncias militares",
"Display on your public profile": "Exibir em seu perfil público"
} }

View File

@ -631,5 +631,6 @@
"Chat": "Чат", "Chat": "Чат",
"Chat link": "Ссылка на чат", "Chat link": "Ссылка на чат",
"Clear Cache": "Очистить кэш", "Clear Cache": "Очистить кэш",
"Block military instances": "Блокировать военные инстансы" "Block military instances": "Блокировать военные инстансы",
"Display on your public profile": "Отобразить в своем общедоступном профиле"
} }

View File

@ -631,5 +631,6 @@
"Chat": "Soga", "Chat": "Soga",
"Chat link": "Kiungo cha gumzo", "Chat link": "Kiungo cha gumzo",
"Clear Cache": "Futa Cache", "Clear Cache": "Futa Cache",
"Block military instances": "Zuia matukio ya kijeshi" "Block military instances": "Zuia matukio ya kijeshi",
"Display on your public profile": "Onyesha kwenye wasifu wako wa umma"
} }

View File

@ -631,5 +631,6 @@
"Chat": "Sohbet", "Chat": "Sohbet",
"Chat link": "Sohbet bağlantısı", "Chat link": "Sohbet bağlantısı",
"Clear Cache": "Önbelleği Temizle", "Clear Cache": "Önbelleği Temizle",
"Block military instances": "Askeri örnekleri engelle" "Block military instances": "Askeri örnekleri engelle",
"Display on your public profile": "Herkese açık profilinizde görüntüleyin"
} }

View File

@ -631,5 +631,6 @@
"Chat": "Чат", "Chat": "Чат",
"Chat link": "Посилання на чат", "Chat link": "Посилання на чат",
"Clear Cache": "Очистити кеш", "Clear Cache": "Очистити кеш",
"Block military instances": "Блокувати військові інстанції" "Block military instances": "Блокувати військові інстанції",
"Display on your public profile": "Відображати у своєму публічному профілі"
} }

View File

@ -631,5 +631,6 @@
"Chat": "שמועסן", "Chat": "שמועסן",
"Chat link": "שמועס לינק", "Chat link": "שמועס לינק",
"Clear Cache": "קלאָר קאַש", "Clear Cache": "קלאָר קאַש",
"Block military instances": "פאַרשפּאַרן מיליטעריש ינסטאַנסיז" "Block military instances": "פאַרשפּאַרן מיליטעריש ינסטאַנסיז",
"Display on your public profile": "ווייַז אויף דיין עפנטלעך פּראָפיל"
} }

View File

@ -631,5 +631,6 @@
"Chat": "聊天", "Chat": "聊天",
"Chat link": "聊天链接", "Chat link": "聊天链接",
"Clear Cache": "קלאָר קאַש", "Clear Cache": "קלאָר קאַש",
"Block military instances": "阻止军事实例" "Block military instances": "阻止军事实例",
"Display on your public profile": "显示在您的公开个人资料上"
} }

View File

@ -24,6 +24,7 @@ from utils import get_currencies
from utils import get_category_types from utils import get_category_types
from utils import get_account_timezone from utils import get_account_timezone
from utils import get_supported_languages from utils import get_supported_languages
from webapp_utils import edit_check_box
from webapp_utils import get_buy_links from webapp_utils import get_buy_links
from webapp_utils import html_following_data_list from webapp_utils import html_following_data_list
from webapp_utils import html_common_emoji from webapp_utils import html_common_emoji
@ -627,6 +628,9 @@ def html_new_post(edit_post_params: {},
extra_fields += \ extra_fields += \
edit_number_field(translate['Duration of listing in days'], edit_number_field(translate['Duration of listing in days'],
'duration', 14, 1, 365, 1) 'duration', 14, 1, 365, 1)
extra_fields += \
edit_check_box(translate['Display on your public profile'],
'shareOnProfile', False)
extra_fields += '</div>\n' extra_fields += '</div>\n'
extra_fields += '<div class="container">\n' extra_fields += '<div class="container">\n'
city_or_loc_str = translate['City or location of the shared item'] city_or_loc_str = translate['City or location of the shared item']