Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

lib-markdown: Support relative links to `/#drafts` and `/#scheduled`.

David Rosa4626a405892d
diff --git a/zerver/lib/markdown/help_relative_links.py b/zerver/lib/markdown/help_relative_links.py
index 80cce453fbc..6109c89ad1e 100644
--- a/zerver/lib/markdown/help_relative_links.py
+++ b/zerver/lib/markdown/help_relative_links.py
@@ -66,9 +66,32 @@ def stream_handle_match(key: str) -> str:
return stream_instructions_no_link
+draft_instructions = """
+1. Click on <i class="fa fa-pencil"></i> **Drafts** in the left sidebar.
+"""
+
+scheduled_instructions = """
+1. Click on <i class="fa fa-calendar"></i> **Scheduled messages** in the left
+ sidebar. If you do not see this link, you have no scheduled messages.
+"""
+
+message_info = {
+ "drafts": ["Drafts", "/#drafts", draft_instructions],
+ "scheduled": ["Scheduled messages", "/#scheduled", scheduled_instructions],
+}
+
+
+def message_handle_match(key: str) -> str:
+ if relative_help_links:
+ return f"1. Go to [{message_info[key][0]}]({message_info[key][1]})."
+ else:
+ return message_info[key][2]
+
+
LINK_TYPE_HANDLERS = {
"gear": gear_handle_match,
"stream": stream_handle_match,
+ "message": message_handle_match,
}