changeset 4172:0e48181d50ab

Plugin XEP-0277: Add metadata to prevent adding random suffixes to generated user-friendly IDs.
author Goffi <goffi@goffi.org>
date Tue, 05 Dec 2023 13:10:21 +0100
parents da7d360a87be
children 7df6ba11bdae
files libervia/backend/plugins/plugin_xep_0277.py
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libervia/backend/plugins/plugin_xep_0277.py	Mon Dec 04 17:51:28 2023 +0100
+++ b/libervia/backend/plugins/plugin_xep_0277.py	Tue Dec 05 13:10:21 2023 +0100
@@ -992,7 +992,10 @@
             or data.get('content_rich')
             or ''
         )
-        return f"{id_base}-{token_urlsafe(3)}"
+        if not data.get("user_friendly_id_suffix", True):
+            return id_base
+        else:
+            return f"{id_base}-{token_urlsafe(3)}"
 
     def _mb_send(self, service, node, data, profile_key):
         service = jid.JID(service) if service else None