Skip to content

A platform for community discussion. Free, open, simple.

FIX: Hide suggestion to send PMs when PMs are disabled for user (#26157)

Jan Cernik2d074ad4a5f5
diff --git a/app/assets/javascripts/discourse/app/routes/build-private-messages-route.js b/app/assets/javascripts/discourse/app/routes/build-private-messages-route.js
index 26ad188628b..34dd2daa4d4 100644
--- a/app/assets/javascripts/discourse/app/routes/build-private-messages-route.js
+++ b/app/assets/javascripts/discourse/app/routes/build-private-messages-route.js
@@ -107,12 +107,14 @@ export default (inboxType, path, filter) => {
emptyState() {
const title = I18n.t("user.no_messages_title");
- const body = htmlSafe(
- I18n.t("user.no_messages_body", {
- aboutUrl: getURL("/about"),
- icon: iconHTML("envelope"),
- })
- );
+ const body = this.currentUser?.can_send_private_messages
+ ? htmlSafe(
+ I18n.t("user.no_messages_body", {
+ aboutUrl: getURL("/about"),
+ icon: iconHTML("envelope"),
+ })
+ )
+ : "";
return { title, body };
},