From 9e9b59819cbb8104e6926296ea680e945ef66f6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Commaille?= Date: Fri, 20 Dec 2024 10:49:59 +0100 Subject: [PATCH] chore: Fix links to rich reply fallback section Since they were remove in Matrix 1.13, the section was removed and the information is now in an info box. --- crates/ruma-events/src/room/message.rs | 12 ++++++------ crates/ruma-events/src/room/message/sanitize.rs | 4 ++-- crates/ruma-html/src/helpers.rs | 12 ++++++------ crates/ruma-html/src/html/matrix.rs | 2 +- crates/ruma-html/src/sanitizer_config.rs | 4 ++-- 5 files changed, 17 insertions(+), 17 deletions(-) diff --git a/crates/ruma-events/src/room/message.rs b/crates/ruma-events/src/room/message.rs index 432ad57d..10ffbddb 100644 --- a/crates/ruma-events/src/room/message.rs +++ b/crates/ruma-events/src/room/message.rs @@ -296,13 +296,13 @@ impl RoomMessageEventContent { /// If this message contains HTML, this removes the [tags and attributes] that are not listed in /// the Matrix specification. /// - /// It can also optionally remove the [rich reply fallback] from the plain text and HTML + /// It can also optionally remove the [rich reply] fallback from the plain text and HTML /// message. /// /// This method is only effective on text, notice and emote messages. /// /// [tags and attributes]: https://spec.matrix.org/latest/client-server-api/#mroommessage-msgtypes - /// [rich reply fallback]: https://spec.matrix.org/latest/client-server-api/#fallbacks-for-rich-replies + /// [rich reply]: https://spec.matrix.org/latest/client-server-api/#rich-replies #[cfg(feature = "html")] pub fn sanitize( &mut self, @@ -587,14 +587,14 @@ impl MessageType { /// If this message contains HTML, this removes the [tags and attributes] that are not listed in /// the Matrix specification. /// - /// It can also optionally remove the [rich reply fallback] from the plain text and HTML + /// It can also optionally remove the [rich reply] fallback from the plain text and HTML /// message. Note that you should be sure that the message is a reply, as there is no way to /// differentiate plain text reply fallbacks and markdown quotes. /// /// This method is only effective on text, notice and emote messages. /// /// [tags and attributes]: https://spec.matrix.org/latest/client-server-api/#mroommessage-msgtypes - /// [rich reply fallback]: https://spec.matrix.org/latest/client-server-api/#fallbacks-for-rich-replies + /// [rich reply]: https://spec.matrix.org/latest/client-server-api/#rich-replies #[cfg(feature = "html")] pub fn sanitize( &mut self, @@ -773,12 +773,12 @@ impl FormattedBody { /// /// This removes any [tags and attributes] that are not listed in the Matrix specification. /// - /// It can also optionally remove the [rich reply fallback]. + /// It can also optionally remove the [rich reply] fallback. /// /// Returns the sanitized HTML if the format is `MessageFormat::Html`. /// /// [tags and attributes]: https://spec.matrix.org/latest/client-server-api/#mroommessage-msgtypes - /// [rich reply fallback]: https://spec.matrix.org/latest/client-server-api/#fallbacks-for-rich-replies + /// [rich reply]: https://spec.matrix.org/latest/client-server-api/#rich-replies #[cfg(feature = "html")] pub fn sanitize_html( &mut self, diff --git a/crates/ruma-events/src/room/message/sanitize.rs b/crates/ruma-events/src/room/message/sanitize.rs index 5a571da8..71711f8f 100644 --- a/crates/ruma-events/src/room/message/sanitize.rs +++ b/crates/ruma-events/src/room/message/sanitize.rs @@ -1,8 +1,8 @@ //! Convenience methods and types to sanitize text messages. -/// Remove the [rich reply fallback] of the given plain text string. +/// Remove the [rich reply] fallback of the given plain text string. /// -/// [rich reply fallback]: https://spec.matrix.org/latest/client-server-api/#fallbacks-for-rich-replies +/// [rich reply]: https://spec.matrix.org/latest/client-server-api/#rich-replies pub fn remove_plain_reply_fallback(mut s: &str) -> &str { // A reply fallback must begin with a mention of the original sender between `<` and `>`, and // emotes add `*` as a prefix. If there is no newline, removing the detected fallback would diff --git a/crates/ruma-html/src/helpers.rs b/crates/ruma-html/src/helpers.rs index b56b6987..e3a2844b 100644 --- a/crates/ruma-html/src/helpers.rs +++ b/crates/ruma-html/src/helpers.rs @@ -6,10 +6,10 @@ use crate::{Html, HtmlSanitizerMode, SanitizerConfig}; /// /// This removes the [tags and attributes] that are not listed in the Matrix specification. /// -/// It can also optionally remove the [rich reply fallback]. +/// It can also optionally remove the [rich reply] fallback. /// /// [tags and attributes]: https://spec.matrix.org/latest/client-server-api/#mroommessage-msgtypes -/// [rich reply fallback]: https://spec.matrix.org/latest/client-server-api/#fallbacks-for-rich-replies +/// [rich reply]: https://spec.matrix.org/latest/client-server-api/#rich-replies pub fn sanitize_html( s: &str, mode: HtmlSanitizerMode, @@ -27,9 +27,9 @@ pub fn sanitize_html( sanitize_inner(s, &config) } -/// Whether to remove the [rich reply fallback] while sanitizing. +/// Whether to remove the [rich reply] fallback while sanitizing. /// -/// [rich reply fallback]: https://spec.matrix.org/latest/client-server-api/#fallbacks-for-rich-replies +/// [rich reply]: https://spec.matrix.org/latest/client-server-api/#rich-replies #[derive(Clone, Copy, Debug, PartialEq, Eq)] #[allow(clippy::exhaustive_enums)] pub enum RemoveReplyFallback { @@ -40,12 +40,12 @@ pub enum RemoveReplyFallback { No, } -/// Remove the [rich reply fallback] of the given HTML string. +/// Remove the [rich reply] fallback of the given HTML string. /// /// Due to the fact that the HTML is parsed, note that malformed HTML and comments will be stripped /// from the output. /// -/// [rich reply fallback]: https://spec.matrix.org/latest/client-server-api/#fallbacks-for-rich-replies +/// [rich reply]: https://spec.matrix.org/latest/client-server-api/#rich-replies pub fn remove_html_reply_fallback(s: &str) -> String { let config = SanitizerConfig::new().remove_reply_fallback(); sanitize_inner(s, &config) diff --git a/crates/ruma-html/src/html/matrix.rs b/crates/ruma-html/src/html/matrix.rs index 10d62df9..ea6f87bf 100644 --- a/crates/ruma-html/src/html/matrix.rs +++ b/crates/ruma-html/src/html/matrix.rs @@ -216,7 +216,7 @@ pub enum MatrixElement { /// [`mx-reply`], a Matrix rich reply fallback element. /// - /// [`mx-reply`]: https://spec.matrix.org/latest/client-server-api/#fallbacks-for-rich-replies + /// [`mx-reply`]: https://spec.matrix.org/latest/client-server-api/#rich-replies MatrixReply, /// An HTML element that is not in the suggested list. diff --git a/crates/ruma-html/src/sanitizer_config.rs b/crates/ruma-html/src/sanitizer_config.rs index 2e57cbf3..a6bd5fc2 100644 --- a/crates/ruma-html/src/sanitizer_config.rs +++ b/crates/ruma-html/src/sanitizer_config.rs @@ -176,7 +176,7 @@ impl SanitizerConfig { self } - /// Remove the [rich reply fallback]. + /// Remove the [rich reply] fallback. /// /// Calling this allows to remove the `mx-reply` element in addition to the list of elements to /// remove. @@ -184,7 +184,7 @@ impl SanitizerConfig { /// Removing elements has a higher priority than ignoring or allowing. So if this settings is /// set, `mx-reply` will always be removed. /// - /// [rich reply fallback]: https://spec.matrix.org/latest/client-server-api/#fallbacks-for-rich-replies + /// [rich reply]: https://spec.matrix.org/latest/client-server-api/#rich-replies pub fn remove_reply_fallback(mut self) -> Self { self.remove_reply_fallback = true; self