diff --git a/epicyon.py b/epicyon.py
index 98eb0aeda..9ebae1240 100644
--- a/epicyon.py
+++ b/epicyon.py
@@ -2101,6 +2101,7 @@ def _command_options() -> None:
argb.eventCategory = ''
print('Sending post to ' + argb.sendto)
+ labels_str: str = ''
send_post_via_server(signing_priv_key_pem, __version__,
base_dir, session, argb.nickname, argb.password,
domain, port,
@@ -2118,7 +2119,8 @@ def _command_options() -> None:
argb.media_license_url, argb.media_creator,
argb.eventDate, argb.eventTime, argb.eventEndTime,
argb.eventCategory,
- argb.eventLocation, translate, argb.buyUrl,
+ argb.eventLocation, translate,
+ labels_str, argb.buyUrl,
argb.chatUrl, auto_cw_cache, argb.debug,
reply_to, reply_to, argb.conversationId,
argb.convthreadId, subject, searchable_by,
@@ -4013,6 +4015,7 @@ def _command_options() -> None:
low_bandwidth: bool = False
languages_understood = [argb.language]
translate = {}
+ labels_str: str = ''
buy_url: str = ''
chat_url: str = ''
auto_cw_cache = {}
@@ -4038,7 +4041,8 @@ def _command_options() -> None:
convthread_id,
low_bandwidth, argb.content_license_url,
argb.media_license_url, argb.media_creator,
- languages_understood, translate, buy_url, chat_url,
+ languages_understood, translate,
+ labels_str, buy_url, chat_url,
auto_cw_cache, searchable_by, curr_session, debug)
create_public_post(base_dir, nickname, domain, port, http_prefix,
"Zoiks!!!",
@@ -4058,7 +4062,8 @@ def _command_options() -> None:
convthread_id,
low_bandwidth, argb.content_license_url,
argb.media_license_url, argb.media_creator,
- languages_understood, translate, buy_url, chat_url,
+ languages_understood, translate,
+ labels_str, buy_url, chat_url,
auto_cw_cache, searchable_by, curr_session, debug)
create_public_post(base_dir, nickname, domain, port, http_prefix,
"Hey scoob we need like a hundred more #milkshakes",
@@ -4078,7 +4083,8 @@ def _command_options() -> None:
convthread_id,
low_bandwidth, argb.content_license_url,
argb.media_license_url, argb.media_creator,
- languages_understood, translate, buy_url, chat_url,
+ languages_understood, translate,
+ labels_str, buy_url, chat_url,
auto_cw_cache, searchable_by, curr_session, debug)
create_public_post(base_dir, nickname, domain, port, http_prefix,
"Getting kinda spooky around here",
@@ -4098,7 +4104,8 @@ def _command_options() -> None:
convthread_id,
low_bandwidth, argb.content_license_url,
argb.media_license_url, argb.media_creator,
- languages_understood, translate, buy_url, chat_url,
+ languages_understood, translate,
+ labels_str, buy_url, chat_url,
auto_cw_cache, searchable_by, curr_session, debug)
create_public_post(base_dir, nickname, domain, port, http_prefix,
"And they would have gotten away with it too" +
@@ -4119,7 +4126,8 @@ def _command_options() -> None:
convthread_id,
low_bandwidth, argb.content_license_url,
argb.media_license_url, argb.media_creator,
- languages_understood, translate, buy_url, chat_url,
+ languages_understood, translate,
+ labels_str, buy_url, chat_url,
auto_cw_cache, searchable_by, curr_session, debug)
create_public_post(base_dir, nickname, domain, port, http_prefix,
"man these centralized sites are like the worst!",
@@ -4139,7 +4147,8 @@ def _command_options() -> None:
convthread_id,
low_bandwidth, argb.content_license_url,
argb.media_license_url, argb.media_creator,
- languages_understood, translate, buy_url, chat_url,
+ languages_understood, translate,
+ labels_str, buy_url, chat_url,
auto_cw_cache, searchable_by, curr_session, debug)
create_public_post(base_dir, nickname, domain, port, http_prefix,
"another mystery solved #test",
@@ -4159,7 +4168,8 @@ def _command_options() -> None:
convthread_id,
low_bandwidth, argb.content_license_url,
argb.media_license_url, argb.media_creator,
- languages_understood, translate, buy_url, chat_url,
+ languages_understood, translate,
+ labels_str, buy_url, chat_url,
auto_cw_cache, searchable_by, curr_session, debug)
create_public_post(base_dir, nickname, domain, port, http_prefix,
"let's go bowling",
@@ -4179,7 +4189,8 @@ def _command_options() -> None:
convthread_id,
low_bandwidth, argb.content_license_url,
argb.media_license_url, argb.media_creator,
- languages_understood, translate, buy_url, chat_url,
+ languages_understood, translate,
+ labels_str, buy_url, chat_url,
auto_cw_cache, searchable_by, curr_session, debug)
domain_full = domain + ':' + str(port)
clear_follows(base_dir, nickname, domain, 'following.txt')
diff --git a/src/content_labels.py b/src/content_labels.py
index ac21d8f5b..da040c4c9 100644
--- a/src/content_labels.py
+++ b/src/content_labels.py
@@ -145,3 +145,36 @@ def set_actor_content_labels(actor_json: {}, labels: str) -> None:
'value': labels
}
actor_json['attachment'].append(labels_dict)
+
+
+def set_post_content_labels(post_json_object: {}, labels: str) -> None:
+ """Sets a string containing comma separated content labels
+ within the given post
+ """
+ if not labels:
+ return
+
+ labels = remove_html(labels)
+
+ obj = post_json_object
+ if has_object_dict(post_json_object):
+ obj = post_json_object['object']
+
+ if 'tag' not in obj:
+ obj['tag'] = []
+
+ for tag_dict in obj['tag']:
+ if 'name' not in tag_dict:
+ continue
+ if not isinstance(tag_dict['name'], str):
+ continue
+ if tag_dict['name'] == 'Labels':
+ tag_dict['value'] = labels
+ return
+
+ labels_dict = {
+ 'type': 'PropertyValue',
+ 'name': 'Labels',
+ 'value': labels
+ }
+ obj['attachment'].append(labels_dict)
diff --git a/src/daemon_post_question.py b/src/daemon_post_question.py
index ecff8dce5..4eb2e01b2 100644
--- a/src/daemon_post_question.py
+++ b/src/daemon_post_question.py
@@ -231,6 +231,7 @@ def _send_reply_to_question(self, base_dir: str,
location = None
conversation_id = None
convthread_id = None
+ labels_str: str = ''
buy_url: str = ''
chat_url: str = ''
city = get_spoofed_city(city_name, base_dir, nickname, domain)
@@ -269,7 +270,7 @@ def _send_reply_to_question(self, base_dir: str,
dm_license_url,
content_license_url, '',
languages_understood, False,
- translate, buy_url,
+ translate, labels_str, buy_url,
chat_url,
auto_cw_cache, curr_session)
if message_json:
diff --git a/src/daemon_post_receive.py b/src/daemon_post_receive.py
index 26ccc4f49..2b943f3f2 100644
--- a/src/daemon_post_receive.py
+++ b/src/daemon_post_receive.py
@@ -90,6 +90,7 @@ def _receive_new_post_process_newpost(self, fields: {},
attachment_media_type: str,
low_bandwidth: bool,
translate: {},
+ labels_str: str,
buy_url: str,
chat_url: str,
auto_cw_cache: {},
@@ -203,8 +204,8 @@ def _receive_new_post_process_newpost(self, fields: {},
content_license_url,
media_license_url, media_creator,
languages_understood,
- translate, buy_url,
- chat_url,
+ translate, labels_str,
+ buy_url, chat_url,
auto_cw_cache,
fields['searchableByDropdown'],
curr_session, debug)
@@ -294,6 +295,7 @@ def _receive_new_post_process_newblog(self, fields: {},
filename: str,
attachment_media_type: str,
low_bandwidth: bool,
+ labels_str: str,
buy_url: str, chat_url: str,
project_version: str, curr_session,
proxy_type: str, max_replies: int,
@@ -386,7 +388,7 @@ def _receive_new_post_process_newblog(self, fields: {},
content_license_url,
media_license_url, media_creator,
languages_understood,
- translate, buy_url, chat_url,
+ translate, labels_str, buy_url, chat_url,
fields['searchableByDropdown'],
curr_session, debug)
if message_json:
@@ -543,7 +545,9 @@ def _receive_new_post_process_newunlisted(self, fields: {},
filename: str,
attachment_media_type: str,
low_bandwidth: bool,
- translate: {}, buy_url: str,
+ translate: {},
+ labels_str: str,
+ buy_url: str,
chat_url: str,
auto_cw_cache: {},
edited_postid: str,
@@ -642,7 +646,7 @@ def _receive_new_post_process_newunlisted(self, fields: {},
content_license_url,
media_license_url, media_creator,
languages_understood,
- translate, buy_url,
+ translate, labels_str, buy_url,
chat_url,
auto_cw_cache, curr_session, debug)
if message_json:
@@ -720,6 +724,7 @@ def _receive_new_post_process_newfollowers(self, fields: {},
attachment_media_type: str,
low_bandwidth: bool,
translate: {},
+ labels_str: str,
buy_url: str, chat_url: str,
auto_cw_cache: {},
edited_postid: str,
@@ -825,7 +830,7 @@ def _receive_new_post_process_newfollowers(self, fields: {},
media_license_url,
media_creator,
languages_understood,
- translate,
+ translate, labels_str,
buy_url, chat_url,
auto_cw_cache,
fields['searchableByDropdown'],
@@ -906,7 +911,7 @@ def _receive_new_post_process_newdm(self, fields: {},
attachment_media_type: str,
low_bandwidth: bool,
dm_license_url: str,
- translate: {},
+ translate: {}, labels_str: str,
buy_url: str, chat_url: str,
auto_cw_cache: {},
edited_postid: str,
@@ -1021,7 +1026,7 @@ def _receive_new_post_process_newdm(self, fields: {},
media_creator,
languages_understood,
reply_is_chat,
- translate,
+ translate, labels_str,
buy_url, chat_url,
auto_cw_cache, curr_session)
if message_json:
@@ -1101,6 +1106,7 @@ def _receive_new_post_process_newreminder(self, fields: {}, nickname: str,
low_bandwidth: bool,
dm_license_url: str,
translate: {},
+ labels_str: str,
buy_url: str, chat_url: str,
auto_cw_cache: {},
edited_postid: str,
@@ -1198,6 +1204,7 @@ def _receive_new_post_process_newreminder(self, fields: {}, nickname: str,
media_creator,
languages_understood,
False, translate,
+ labels_str,
buy_url, chat_url,
auto_cw_cache, curr_session)
if message_json:
@@ -1451,7 +1458,9 @@ def _receive_new_post_process_newreading(self, fields: {},
filename: str,
attachment_media_type: str,
low_bandwidth: bool,
- translate: {}, buy_url: str,
+ translate: {},
+ labels_str: str,
+ buy_url: str,
chat_url: str,
auto_cw_cache: {},
edited_published: str,
@@ -1569,7 +1578,7 @@ def _receive_new_post_process_newreading(self, fields: {},
content_license_url,
media_license_url, media_creator,
languages_understood,
- translate, buy_url,
+ translate, labels_str, buy_url,
chat_url,
auto_cw_cache,
fields['searchableByDropdown'],
@@ -2160,6 +2169,10 @@ def _receive_new_post_process(self, post_type: str, path: str, headers: {},
'EX: unable to write ditherImage ' +
dither_filename)
+ labels_str: str = ''
+ if fields.get('postContentLabels'):
+ labels_str = fields['postContentLabels']
+
buy_url: str = ''
if fields.get('buyUrl'):
buy_url = fields['buyUrl']
@@ -2183,6 +2196,7 @@ def _receive_new_post_process(self, post_type: str, path: str, headers: {},
attachment_media_type,
low_bandwidth,
translate,
+ labels_str,
buy_url,
chat_url,
auto_cw_cache,
@@ -2234,7 +2248,7 @@ def _receive_new_post_process(self, post_type: str, path: str, headers: {},
apply_dithering,
filename,
attachment_media_type,
- low_bandwidth,
+ low_bandwidth, labels_str,
buy_url, chat_url,
project_version, curr_session,
proxy_type, max_replies, debug)
@@ -2267,7 +2281,7 @@ def _receive_new_post_process(self, post_type: str, path: str, headers: {},
filename,
attachment_media_type,
low_bandwidth,
- translate, buy_url,
+ translate, labels_str, buy_url,
chat_url,
auto_cw_cache,
edited_postid,
@@ -2318,7 +2332,7 @@ def _receive_new_post_process(self, post_type: str, path: str, headers: {},
filename,
attachment_media_type,
low_bandwidth,
- translate,
+ translate, labels_str,
buy_url, chat_url,
auto_cw_cache,
edited_postid,
@@ -2368,7 +2382,7 @@ def _receive_new_post_process(self, post_type: str, path: str, headers: {},
attachment_media_type,
low_bandwidth,
dm_license_url,
- translate,
+ translate, labels_str,
buy_url, chat_url,
auto_cw_cache,
edited_postid,
@@ -2418,7 +2432,7 @@ def _receive_new_post_process(self, post_type: str, path: str, headers: {},
attachment_media_type,
low_bandwidth,
dm_license_url,
- translate,
+ translate, labels_str,
buy_url, chat_url,
auto_cw_cache,
edited_postid,
@@ -2496,8 +2510,8 @@ def _receive_new_post_process(self, post_type: str, path: str, headers: {},
filename,
attachment_media_type,
low_bandwidth,
- translate, buy_url,
- chat_url,
+ translate, labels_str,
+ buy_url, chat_url,
auto_cw_cache,
edited_published,
edited_postid,
diff --git a/src/desktop_client.py b/src/desktop_client.py
index 202a3610a..e57ab6f23 100644
--- a/src/desktop_client.py
+++ b/src/desktop_client.py
@@ -566,6 +566,7 @@ def _desktop_reply_to_post(session, post_id: str,
event_end_time = None
event_category: str = ''
location = None
+ labels_str: str = ''
buy_url: str = ''
chat_url: str = ''
video_transcript = None
@@ -588,7 +589,8 @@ def _desktop_reply_to_post(session, post_id: str,
media_license_url, media_creator,
event_date, event_time, event_end_time,
event_category, location,
- translate, buy_url, chat_url, auto_cw_cache,
+ translate, labels_str, buy_url,
+ chat_url, auto_cw_cache,
debug, post_id, post_id,
conversation_id, convthread_id, subject,
searchable_by, mitm_servers) == 0:
@@ -657,6 +659,7 @@ def _desktop_new_post(session,
event_end_time = None
event_category: str = ''
location = None
+ labels_str: str = ''
buy_url: str = ''
chat_url: str = ''
video_transcript = None
@@ -678,7 +681,8 @@ def _desktop_new_post(session,
media_license_url, media_creator,
event_date, event_time, event_end_time,
event_category, location,
- translate, buy_url, chat_url, auto_cw_cache,
+ translate, labels_str, buy_url,
+ chat_url, auto_cw_cache,
debug, None, None,
conversation_id, convthread_id, subject,
searchable_by, mitm_servers) == 0:
@@ -1501,6 +1505,7 @@ def _desktop_new_dm_base(session, to_handle: str,
event_end_time = None
event_category: str = ''
location = None
+ labels_str: str = ''
buy_url: str = ''
chat_url: str = ''
video_transcript = None
@@ -1524,7 +1529,8 @@ def _desktop_new_dm_base(session, to_handle: str,
media_license_url, media_creator,
event_date, event_time, event_end_time,
event_category, location,
- translate, buy_url, chat_url, auto_cw_cache,
+ translate, labels_str, buy_url,
+ chat_url, auto_cw_cache,
debug, None, None,
conversation_id, convthread_id, subject,
searchable_by, mitm_servers) == 0:
diff --git a/src/inbox.py b/src/inbox.py
index 037b34832..d9aad1be7 100644
--- a/src/inbox.py
+++ b/src/inbox.py
@@ -1461,6 +1461,7 @@ def _bounce_dm(sender_post_id: str, session, http_prefix: str,
conversation_id = None
convthread_id = None
low_bandwidth: bool = False
+ labels_str: str = ''
buy_url: str = ''
chat_url: str = ''
auto_cw_cache = {}
@@ -1481,7 +1482,7 @@ def _bounce_dm(sender_post_id: str, session, http_prefix: str,
low_bandwidth, dm_license_url,
dm_license_url, '',
languages_understood, bounce_is_chat,
- translate, buy_url, chat_url,
+ translate, labels_str, buy_url, chat_url,
auto_cw_cache, session)
if not post_json_object:
print('WARN: unable to create bounce message to ' + sending_handle)
diff --git a/src/newsdaemon.py b/src/newsdaemon.py
index 1cfdd5229..d4fb470ca 100644
--- a/src/newsdaemon.py
+++ b/src/newsdaemon.py
@@ -646,6 +646,7 @@ def _convert_rss_to_activitypub(base_dir: str, http_prefix: str,
conversation_id = None
convthread_id = None
languages_understood = [system_language]
+ labels_str = ''
buy_url = ''
chat_url = ''
blog = create_news_post(base_dir,
@@ -659,6 +660,7 @@ def _convert_rss_to_activitypub(base_dir: str, http_prefix: str,
content_license_url,
media_license_url, media_creator,
languages_understood, translate,
+ labels_str,
buy_url, chat_url, session, debug)
if not blog:
continue
diff --git a/src/posts.py b/src/posts.py
index cd8ffbfff..73faef650 100644
--- a/src/posts.py
+++ b/src/posts.py
@@ -155,6 +155,7 @@ from src.data import move_file
from src.data import is_a_file
from src.data import is_a_dir
from src.data import makedir
+from src.content_labels import set_post_content_labels
def convert_post_content_to_html(message_json: {}) -> None:
@@ -1249,6 +1250,7 @@ def _create_post_s2s(base_dir: str, nickname: str, domain: str, port: int,
conversation_id: str, convthread_id: str,
low_bandwidth: bool, content_license_url: str,
media_license_url: str, media_creator: str,
+ labels_str: str,
buy_url: str, chat_url: str, translate: {},
searchable_by: [],
automatic_quote_approval: str,
@@ -1418,6 +1420,7 @@ def _create_post_s2s(base_dir: str, nickname: str, domain: str, port: int,
_attach_post_license(new_post['object'], content_license_url)
_attach_buy_link(new_post['object'], buy_url, translate)
_attach_chat_link(new_post['object'], chat_url)
+ set_post_content_labels(new_post, labels_str)
return new_post
@@ -1435,7 +1438,8 @@ def _create_post_c2s(base_dir: str, nickname: str, domain: str, port: int,
conversation_id: str, convthread_id: str,
low_bandwidth: str,
content_license_url: str, media_license_url: str,
- media_creator: str, buy_url: str, chat_url: str,
+ media_creator: str, labels_str: str,
+ buy_url: str, chat_url: str,
translate: {}, searchable_by: [],
automatic_quote_approval: str,
session, debug: bool) -> {}:
@@ -1593,6 +1597,7 @@ def _create_post_c2s(base_dir: str, nickname: str, domain: str, port: int,
_attach_post_license(new_post, content_license_url)
_attach_buy_link(new_post, buy_url, translate)
_attach_chat_link(new_post, chat_url)
+ set_post_content_labels(new_post, labels_str)
return new_post
@@ -1849,7 +1854,7 @@ def create_post_base(base_dir: str,
low_bandwidth: bool, content_license_url: str,
media_license_url: str, media_creator: str,
languages_understood: [], translate: {},
- buy_url: str, chat_url: str,
+ labels_str: str, buy_url: str, chat_url: str,
auto_cw_cache: {},
searchable_by: [],
session,
@@ -2041,7 +2046,7 @@ def create_post_base(base_dir: str,
in_reply_to_atom_uri, system_language,
conversation_id, convthread_id, low_bandwidth,
content_license_url, media_license_url,
- media_creator, buy_url, chat_url,
+ media_creator, labels_str, buy_url, chat_url,
translate, searchable_by_list,
automatic_quote_approval,
session, debug)
@@ -2060,7 +2065,7 @@ def create_post_base(base_dir: str,
in_reply_to_atom_uri, system_language,
conversation_id, convthread_id, low_bandwidth,
content_license_url, media_license_url,
- media_creator, buy_url, chat_url,
+ media_creator, labels_str, buy_url, chat_url,
translate, searchable_by_list,
automatic_quote_approval,
session, debug)
@@ -2316,6 +2321,7 @@ def create_public_post(base_dir: str,
low_bandwidth: bool, content_license_url: str,
media_license_url: str, media_creator: str,
languages_understood: [], translate: {},
+ labels_str: str,
buy_url: str, chat_url: str,
auto_cw_cache: {},
searchable_by: [],
@@ -2357,7 +2363,8 @@ def create_public_post(base_dir: str,
conversation_id, convthread_id, low_bandwidth,
content_license_url,
media_license_url, media_creator,
- languages_understood, translate, buy_url,
+ languages_understood, translate,
+ labels_str, buy_url,
chat_url, auto_cw_cache, searchable_by,
session, automatic_quote_approval, debug)
@@ -2382,6 +2389,7 @@ def create_reading_post(base_dir: str,
low_bandwidth: bool, content_license_url: str,
media_license_url: str, media_creator: str,
languages_understood: [], translate: {},
+ labels_str: str,
buy_url: str, chat_url: str,
auto_cw_cache: {},
searchable_by: [], session, debug: bool) -> {}:
@@ -2426,6 +2434,7 @@ def create_reading_post(base_dir: str,
content_license_url,
media_license_url, media_creator,
languages_understood, translate,
+ labels_str,
buy_url, chat_url, auto_cw_cache,
searchable_by, session, debug)
if post_json_object:
@@ -2487,6 +2496,7 @@ def create_blog_post(base_dir: str,
low_bandwidth: bool, content_license_url: str,
media_license_url: str, media_creator: str,
languages_understood: [], translate: {},
+ labels_str: str,
buy_url: str, chat_url: str,
searchable_by: [], session, debug: bool) -> {}:
auto_cw_cache = {}
@@ -2506,7 +2516,8 @@ def create_blog_post(base_dir: str,
conversation_id, convthread_id,
low_bandwidth, content_license_url,
media_license_url, media_creator,
- languages_understood, translate, buy_url, chat_url,
+ languages_understood, translate,
+ labels_str, buy_url, chat_url,
auto_cw_cache, searchable_by, session, debug)
url_str = get_url_from_post(blog_json['object']['url'])
obj_url = remove_html(url_str)
@@ -2528,7 +2539,7 @@ def create_news_post(base_dir: str,
low_bandwidth: bool, content_license_url: str,
media_license_url: str, media_creator: str,
languages_understood: [], translate: {},
- buy_url: str, chat_url: str, session,
+ labels_str: str, buy_url: str, chat_url: str, session,
debug: bool) -> {}:
auto_cw_cache = {}
client_to_server: bool = False
@@ -2556,7 +2567,8 @@ def create_news_post(base_dir: str,
conversation_id, convthread_id,
low_bandwidth, content_license_url,
media_license_url, media_creator,
- languages_understood, translate, buy_url, chat_url,
+ languages_understood, translate,
+ labels_str, buy_url, chat_url,
auto_cw_cache, searchable_by, session, debug)
blog['object']['type'] = 'Article'
return blog
@@ -2582,6 +2594,7 @@ def create_question_post(base_dir: str,
"""
domain_full = get_full_domain(domain, port)
local_actor = local_actor_url(http_prefix, nickname, domain_full)
+ labels_str = ''
buy_url = ''
chat_url = ''
is_moderation_report: bool = False
@@ -2617,7 +2630,8 @@ def create_question_post(base_dir: str,
conversation_id, convthread_id, low_bandwidth,
content_license_url,
media_license_url, media_creator,
- languages_understood, translate, buy_url,
+ languages_understood, translate,
+ labels_str, buy_url,
chat_url, auto_cw_cache, searchable_by,
session, automatic_quote_approval, debug)
message_json['object']['type'] = 'Question'
@@ -2659,6 +2673,7 @@ def create_unlisted_post(base_dir: str,
low_bandwidth: bool, content_license_url: str,
media_license_url: str, media_creator: str,
languages_understood: [], translate: {},
+ labels_str: str,
buy_url: str, chat_url: str,
auto_cw_cache: {}, session, debug: bool) -> {}:
"""Unlisted post. This has the #Public and followers links inverted.
@@ -2699,6 +2714,7 @@ def create_unlisted_post(base_dir: str,
content_license_url,
media_license_url, media_creator,
languages_understood, translate,
+ labels_str,
buy_url, chat_url, auto_cw_cache,
searchable_by, session,
automatic_quote_approval, debug)
@@ -2723,7 +2739,7 @@ def create_followers_only_post(base_dir: str,
low_bandwidth: bool, content_license_url: str,
media_license_url: str, media_creator: str,
languages_understood: [],
- translate: {}, buy_url: str,
+ translate: {}, labels_str: str, buy_url: str,
chat_url: str,
auto_cw_cache: {},
searchable_by: [], session,
@@ -2761,6 +2777,7 @@ def create_followers_only_post(base_dir: str,
content_license_url,
media_license_url, media_creator,
languages_understood, translate,
+ labels_str,
buy_url, chat_url, auto_cw_cache,
searchable_by, session,
automatic_quote_approval, debug)
@@ -2824,6 +2841,7 @@ def create_direct_message_post(base_dir: str,
media_license_url: str, media_creator: str,
languages_understood: [],
dm_is_chat: bool, translate: {},
+ labels_str: str,
buy_url: str, chat_url: str,
auto_cw_cache: {}, session) -> {}:
"""Direct Message post
@@ -2869,7 +2887,8 @@ def create_direct_message_post(base_dir: str,
conversation_id, convthread_id, low_bandwidth,
content_license_url,
media_license_url, media_creator,
- languages_understood, translate, buy_url, chat_url,
+ languages_understood, translate,
+ labels_str, buy_url, chat_url,
auto_cw_cache, searchable_by, session,
automatic_quote_approval, debug)
# mentioned recipients go into To rather than Cc
@@ -2964,6 +2983,7 @@ def create_report_post(base_dir: str,
post_to = moderators_list
post_cc = None
post_json_object = None
+ labels_str = ''
buy_url = ''
chat_url = ''
is_moderation_report = True
@@ -3015,6 +3035,7 @@ def create_report_post(base_dir: str,
content_license_url,
media_license_url, media_creator,
languages_understood, translate,
+ labels_str,
buy_url, chat_url, auto_cw_cache,
searchable_by, session,
automatic_quote_approval, debug)
@@ -3218,7 +3239,8 @@ def send_post(signing_priv_key_pem: str, project_version: str,
shared_item_federation_tokens: {},
low_bandwidth: bool, content_license_url: str,
media_license_url: str, media_creator: str,
- translate: {}, buy_url: str, chat_url: str,
+ translate: {}, labels_str: str,
+ buy_url: str, chat_url: str,
auto_cw_cache: {},
debug: bool, in_reply_to: str,
in_reply_to_atom_uri: str, subject: str,
@@ -3315,7 +3337,7 @@ def send_post(signing_priv_key_pem: str, project_version: str,
content_license_url,
media_license_url, media_creator,
languages_understood,
- translate, buy_url, chat_url,
+ translate, labels_str, buy_url, chat_url,
auto_cw_cache, searchable_by, session,
automatic_quote_approval, debug)
diff --git a/src/sendC2S.py b/src/sendC2S.py
index dedcfe9b0..aada2daa2 100644
--- a/src/sendC2S.py
+++ b/src/sendC2S.py
@@ -40,6 +40,7 @@ def send_post_via_server(signing_priv_key_pem: str, project_version: str,
event_date: str, event_time: str, event_end_time: str,
event_category: str,
location: str, translate: {},
+ labels_str: str,
buy_url: str, chat_url: str, auto_cw_cache: {},
debug: bool, in_reply_to: str,
in_reply_to_atom_uri: str,
@@ -151,7 +152,8 @@ def send_post_via_server(signing_priv_key_pem: str, project_version: str,
content_license_url,
media_license_url, media_creator,
languages_understood,
- translate, buy_url, chat_url, auto_cw_cache,
+ translate, labels_str, buy_url,
+ chat_url, auto_cw_cache,
searchable_by, session,
automatic_quote_approval, debug)
diff --git a/src/tests.py b/src/tests.py
index c6c7944be..dc7261a15 100644
--- a/src/tests.py
+++ b/src/tests.py
@@ -861,6 +861,7 @@ def create_server_alice(path: str, domain: str, port: int,
media_license_url: str = \
'https://creativecommons.org/licenses/by-nc/4.0'
media_creator: str = 'Mr Blobby'
+ labels_str: str = ''
buy_url: str = ''
chat_url: str = ''
auto_cw_cache: dict = {}
@@ -887,7 +888,8 @@ def create_server_alice(path: str, domain: str, port: int,
convthread_id,
low_bandwidth, content_license_url,
media_license_url, media_creator,
- languages_understood, translate, buy_url, chat_url,
+ languages_understood, translate,
+ labels_str, buy_url, chat_url,
auto_cw_cache, searchable_by, session, debug)
create_public_post(path, nickname, domain, port, http_prefix,
"Curiouser and curiouser!",
@@ -908,7 +910,8 @@ def create_server_alice(path: str, domain: str, port: int,
convthread_id,
low_bandwidth, content_license_url,
media_license_url, media_creator,
- languages_understood, translate, buy_url, chat_url,
+ languages_understood, translate,
+ labels_str, buy_url, chat_url,
auto_cw_cache, searchable_by, session, debug)
create_public_post(path, nickname, domain, port, http_prefix,
"In the gardens of memory, in the palace " +
@@ -930,7 +933,8 @@ def create_server_alice(path: str, domain: str, port: int,
convthread_id,
low_bandwidth, content_license_url,
media_license_url, media_creator,
- languages_understood, translate, buy_url, chat_url,
+ languages_understood, translate,
+ labels_str, buy_url, chat_url,
auto_cw_cache, searchable_by, session, debug)
regenerate_index_for_box(path, nickname, domain, 'outbox')
global TEST_SERVER_ALICE_RUNNING
@@ -1074,6 +1078,7 @@ def create_server_bob(path: str, domain: str, port: int,
'https://creativecommons.org/licenses/by-nc/4.0'
media_creator: str = 'Hamster'
translate: dict = {}
+ labels_str: str = ''
buy_url: str = ''
chat_url: str = ''
auto_cw_cache: dict = {}
@@ -1100,7 +1105,8 @@ def create_server_bob(path: str, domain: str, port: int,
convthread_id,
low_bandwidth, content_license_url,
media_license_url, media_creator,
- languages_understood, translate, buy_url, chat_url,
+ languages_understood, translate,
+ labels_str, buy_url, chat_url,
auto_cw_cache, searchable_by, session, debug)
create_public_post(path, nickname, domain, port, http_prefix,
"One of the things I've realised is that " +
@@ -1122,7 +1128,8 @@ def create_server_bob(path: str, domain: str, port: int,
convthread_id,
low_bandwidth, content_license_url,
media_license_url, media_creator,
- languages_understood, translate, buy_url, chat_url,
+ languages_understood, translate,
+ labels_str, buy_url, chat_url,
auto_cw_cache, searchable_by, session, debug)
create_public_post(path, nickname, domain, port, http_prefix,
"Quantum physics is a bit of a passion of mine",
@@ -1143,7 +1150,8 @@ def create_server_bob(path: str, domain: str, port: int,
convthread_id,
low_bandwidth, content_license_url,
media_license_url, media_creator,
- languages_understood, translate, buy_url, chat_url,
+ languages_understood, translate,
+ labels_str, buy_url, chat_url,
auto_cw_cache, searchable_by, session, debug)
regenerate_index_for_box(path, nickname, domain, 'outbox')
global TEST_SERVER_BOB_RUNNING
@@ -1567,6 +1575,7 @@ def test_post_message_between_servers(base_dir: str) -> None:
low_bandwidth: bool = False
signing_priv_key_pem = None
translate: dict = {}
+ labels_str = ''
buy_url: str = ''
chat_url: str = ''
auto_cw_cache: dict = {}
@@ -1591,7 +1600,8 @@ def test_post_message_between_servers(base_dir: str) -> None:
alice_shared_items_federated_domains,
alice_shared_item_federation_tokens, low_bandwidth,
content_license_url, media_license_url, media_creator,
- translate, buy_url, chat_url, auto_cw_cache, True,
+ translate, labels_str, buy_url,
+ chat_url, auto_cw_cache, True,
in_reply_to, in_reply_to_atom_uri, subject,
searchable_by, mitm_servers)
print('send_result: ' + str(send_result))
@@ -1974,6 +1984,7 @@ def test_follow_between_servers(base_dir: str) -> None:
low_bandwidth: bool = False
signing_priv_key_pem = None
translate: dict = {}
+ labels_str: str = ''
buy_url: str = ''
chat_url: str = ''
video_transcript = None
@@ -2000,7 +2011,8 @@ def test_follow_between_servers(base_dir: str) -> None:
alice_shared_items_federated_domains,
alice_shared_item_federation_tokens, low_bandwidth,
content_license_url, media_license_url, media_creator,
- translate, buy_url, chat_url, auto_cw_cache, True,
+ translate, labels_str, buy_url,
+ chat_url, auto_cw_cache, True,
in_reply_to, in_reply_to_atom_uri, subject,
searchable_by, mitm_servers)
print('send_result: ' + str(send_result))
@@ -2401,6 +2413,7 @@ def test_shared_items_federation(base_dir: str) -> None:
low_bandwidth: bool = False
signing_priv_key_pem = None
translate: dict = {}
+ labels_str: str = ''
buy_url: str = ''
chat_url: str = ''
video_transcript = None
@@ -2427,7 +2440,8 @@ def test_shared_items_federation(base_dir: str) -> None:
alice_shared_items_federated_domains,
alice_shared_item_federation_tokens, low_bandwidth,
content_license_url, media_license_url, media_creator,
- translate, buy_url, chat_url, auto_cw_cache, True,
+ translate, labels_str, buy_url,
+ chat_url, auto_cw_cache, True,
in_reply_to, in_reply_to_atom_uri, subject,
searchable_by, mitm_servers)
print('send_result: ' + str(send_result))
@@ -2862,6 +2876,7 @@ def test_group_follow(base_dir: str) -> None:
if os.path.isfile(os.path.join(outbox_path, name))])
translate = {}
+ labels_str = ''
buy_url = ''
chat_url = ''
video_transcript = None
@@ -2888,7 +2903,8 @@ def test_group_follow(base_dir: str) -> None:
alice_shared_items_federated_domains,
alice_shared_item_federation_tokens, low_bandwidth,
content_license_url, media_license_url, media_creator,
- translate, buy_url, chat_url, auto_cw_cache, True,
+ translate, labels_str, buy_url,
+ chat_url, auto_cw_cache, True,
in_reply_to, in_reply_to_atom_uri, subject,
searchable_by, mitm_servers)
print('send_result: ' + str(send_result))
@@ -3288,6 +3304,7 @@ def _test_create_person_account(base_dir: str):
"(yawn)\n\n...then it's not really independent.\n\n" + \
"Politicians will threaten to withdraw funding if you do " + \
"anything which challenges middle class sensibilities or incomes."
+ labels_str: str = ''
buy_url: str = ''
chat_url: str = ''
auto_cw_cache: dict = {}
@@ -3310,7 +3327,8 @@ def _test_create_person_account(base_dir: str):
convthread_id,
low_bandwidth, content_license_url,
media_license_url, media_creator,
- languages_understood, translate, buy_url, chat_url,
+ languages_understood, translate,
+ labels_str, buy_url, chat_url,
auto_cw_cache, searchable_by, session, debug)
assert test_post_json
assert test_post_json.get('object')
@@ -3341,7 +3359,8 @@ def _test_create_person_account(base_dir: str):
convthread_id,
low_bandwidth, content_license_url,
media_license_url, media_creator,
- languages_understood, translate, buy_url, chat_url,
+ languages_understood, translate,
+ labels_str, buy_url, chat_url,
auto_cw_cache, searchable_by, session, debug)
assert test_post_json
assert test_post_json.get('object')
@@ -3549,6 +3568,7 @@ def test_client_to_server(base_dir: str):
event_category = ''
location = "Kinshasa"
translate = {}
+ labels_str = ''
buy_url = ''
chat_url = ''
video_transcript = None
@@ -3573,7 +3593,8 @@ def test_client_to_server(base_dir: str):
media_license_url, media_creator,
event_date, event_time, event_end_time,
event_category, location,
- translate, buy_url, chat_url, auto_cw_cache,
+ translate, labels_str, buy_url,
+ chat_url, auto_cw_cache,
True, None, None, conversation_id, convthread_id,
None, searchable_by, mitm_servers)
print('send_result: ' + str(send_result))
@@ -5456,6 +5477,7 @@ def _test_reply_to_public_post(base_dir: str) -> None:
'https://creativecommons.org/licenses/by-nc/4.0'
media_creator: str = 'Skeletor'
translate: dict = {}
+ labels_str: str = ''
buy_url: str = ''
chat_url: str = ''
auto_cw_cache: dict = {}
@@ -5480,7 +5502,8 @@ def _test_reply_to_public_post(base_dir: str) -> None:
convthread_id,
low_bandwidth, content_license_url,
media_license_url, media_creator,
- languages_understood, translate, buy_url, chat_url,
+ languages_understood, translate,
+ labels_str, buy_url, chat_url,
auto_cw_cache, searchable_by, session, debug)
# print(str(reply))
expected_str = \
@@ -6571,6 +6594,7 @@ def _test_links_within_post(base_dir: str) -> None:
'https://creativecommons.org/licenses/by-nc/4.0'
media_creator: str = 'Dr No'
translate: dict = {}
+ labels_str: str = ''
buy_url: str = ''
chat_url: str = ''
auto_cw_cache: dict = {}
@@ -6595,7 +6619,8 @@ def _test_links_within_post(base_dir: str) -> None:
convthread_id,
low_bandwidth, content_license_url,
media_license_url, media_creator,
- languages_understood, translate, buy_url, chat_url,
+ languages_understood, translate,
+ labels_str, buy_url, chat_url,
auto_cw_cache, searchable_by, session, debug)
expected_str = \
@@ -6653,7 +6678,8 @@ def _test_links_within_post(base_dir: str) -> None:
convthread_id,
low_bandwidth, content_license_url,
media_license_url, media_creator,
- languages_understood, translate, buy_url, chat_url,
+ languages_understood, translate,
+ labels_str, buy_url, chat_url,
auto_cw_cache, searchable_by, session, debug)
assert post_json_object['object']['content'] == content
assert post_json_object['object']['contentMap'][system_language] == content
@@ -6680,7 +6706,8 @@ def _test_links_within_post(base_dir: str) -> None:
convthread_id,
low_bandwidth, content_license_url,
media_license_url, media_creator,
- languages_understood, translate, buy_url, chat_url,
+ languages_understood, translate,
+ labels_str, buy_url, chat_url,
auto_cw_cache, searchable_by, session, debug)
if post_json_object['object']['content'] != content:
print('content1: ' + post_json_object['object']['content'])
@@ -7783,6 +7810,7 @@ def _test_can_replyto(base_dir: str) -> None:
'https://creativecommons.org/licenses/by-nc/4.0'
media_creator: str = 'The Penguin'
translate: dict = {}
+ labels_str: str = ''
buy_url: str = ''
chat_url: str = ''
auto_cw_cache: dict = {}
@@ -7807,7 +7835,8 @@ def _test_can_replyto(base_dir: str) -> None:
convthread_id,
low_bandwidth, content_license_url,
media_license_url, media_creator,
- languages_understood, translate, buy_url, chat_url,
+ languages_understood, translate,
+ labels_str, buy_url, chat_url,
auto_cw_cache, searchable_by, session, debug)
# set the date on the post
curr_date_str = "2021-09-08T20:45:00Z"
diff --git a/src/webapp_create_post.py b/src/webapp_create_post.py
index 12e5f1681..31f807e7c 100644
--- a/src/webapp_create_post.py
+++ b/src/webapp_create_post.py
@@ -1041,11 +1041,19 @@ def html_new_post(edit_post_params: {},
replies_section += \
searchable_by_dropdown + '\n'
+ # content labels
+ labels_str = translate['Content labels']
+ replies_section += \
+ '
\n' + edit_text_field(labels_str, 'postContentLabels',
+ '', '1, 2, 3...')
+
# buy link
buy_link_str = translate['Buy link']
replies_section += \
'
\n' + edit_text_field(buy_link_str, 'buyUrl',
default_buy_site, 'https://...')
+
+ # chat link
chat_link_str = '💬 ' + translate['Chat link']
replies_section += \
'
\n' + edit_text_field(chat_link_str, 'chatUrl',