mirror of
https://github.com/zulip/zulip.git
synced 2025-10-27 10:03:56 +00:00
markdown: Include text & url in topic_links parameter of our API.
The linkifier code now includes both the shortened text and the expanded URL, sorted by the order of the occurrence in a topic. This list is passed back in the `topic_links` parameter of the /messages and the /events APIs. topic_links earlier vs now: earlier: ['https://www.google.com', 'https://github.com/zulip/zulip/32'] now: [{'url': 'https://www.google.com', 'text': 'https://www.google/com}, {'url': 'https://github.com/zulip/zulip/32', 'text': '#32'}] Similarly, the topic_links local echo logic in the frontend now returns back an object. Fixes: #17109.
This commit is contained in:
committed by
Tim Abbott
parent
de1660e407
commit
e12f682e2e
@@ -337,6 +337,13 @@ muted_topics_event = event_dict_type(
|
||||
)
|
||||
check_muted_topics = make_checker(muted_topics_event)
|
||||
|
||||
_check_topic_links = DictType(
|
||||
required_keys=[
|
||||
("text", str),
|
||||
("url", str),
|
||||
]
|
||||
)
|
||||
|
||||
message_fields = [
|
||||
("avatar_url", OptionalType(str)),
|
||||
("client", str),
|
||||
@@ -353,7 +360,7 @@ message_fields = [
|
||||
("sender_id", int),
|
||||
("stream_id", int),
|
||||
(TOPIC_NAME, str),
|
||||
(TOPIC_LINKS, ListType(str)),
|
||||
(TOPIC_LINKS, ListType(_check_topic_links)),
|
||||
("submessages", ListType(dict)),
|
||||
("timestamp", int),
|
||||
("type", str),
|
||||
@@ -1380,7 +1387,7 @@ update_message_topic_fields = [
|
||||
),
|
||||
("stream_id", int),
|
||||
("stream_name", str),
|
||||
(TOPIC_LINKS, ListType(str)),
|
||||
(TOPIC_LINKS, ListType(_check_topic_links)),
|
||||
(TOPIC_NAME, str),
|
||||
]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user