@@ -210,9 +210,17 @@ final _channelAvoidedCharsRegex = RegExp(r'[`>*&[\]]|\$\$');
210210String _channelFallbackMarkdownLink (ZulipStream channel, {
211211 required PerAccountStore store,
212212}) {
213+ // Like Zulip web, we use a relative URL here, unlike [quoteAndReply] which
214+ // uses an absolute URL. There'd be little benefit to an absolute URL here
215+ // because this isn't a likely flow when a user wants something to copy-paste
216+ // elsewhere: this flow normally produces `#**…**` syntax, which wouldn't work
217+ // for that at all. And conversely, it's nice to keep reasonably short the
218+ // markup that we put into the text box and which the user sees. Discussion:
219+ // https://chat.zulip.org/#narrow/channel/101-design/topic/.22quote.20message.22.20uses.20absolute.20URL.20instead.20of.20realm-relative/near/2325588
220+ final relativeLink = '#${narrowLinkFragment (store , ChannelNarrow (channel .streamId ))}' ;
221+
213222 final text = '#${channel .name .replaceAllMapped (_channelAvoidedCharsRegex ,
214223 (match ) => _channelAvoidedCharsReplacements [match [0 ]]!)}' ;
215- final relativeLink = '#${narrowLinkFragment (store , ChannelNarrow (channel .streamId ))}' ;
216224 return inlineLink (text.toString (), relativeLink);
217225}
218226
@@ -250,6 +258,8 @@ String inlineLink(String visibleText, String destination) {
250258}
251259
252260/// What we show while fetching the target message's raw Markdown.
261+ ///
262+ /// Like [quoteAndReply] , but the message content is replaced with a placeholder.
253263String quoteAndReplyPlaceholder (
254264 ZulipLocalizations zulipLocalizations,
255265 PerAccountStore store, {
@@ -271,13 +281,23 @@ String quoteAndReplyPlaceholder(
271281/// ```quote
272282/// message content
273283/// ```
284+ ///
285+ /// See also:
286+ /// * [quoteAndReplyPlaceholder] .
274287String quoteAndReply (PerAccountStore store, {
275288 required Message message,
276289 required String rawContent,
277290}) {
291+ // Just like the Zulip web app, we use an absolute URL in these "said" links,
292+ // not relative. That's (a) harmless even if the realm later moves, because
293+ // the server turns such links into relative URLs in the message HTML anyway;
294+ // and (b) helpful in case the user copy-pastes this outside of Zulip,
295+ // including to a different Zulip realm, instead of sending the message here.
296+ // Discussion: https://chat.zulip.org/#narrow/channel/101-design/topic/.22quote.20message.22.20uses.20absolute.20URL.20instead.20of.20realm-relative/near/2322862
278297 final url = narrowLink (store,
279298 SendableNarrow .ofMessage (message, selfUserId: store.selfUserId),
280299 nearMessageId: message.id);
300+
281301 // Could ask userMentionFromMessage to omit the |<id> part unless the mention
282302 // is ambiguous… but that would mean a linear scan through all users,
283303 // and the extra noise won't much matter with the already probably-long
0 commit comments