Hello!
On one’s own user (profile) page, there’s are confusing “Message” and “Chat” buttons. On mobile it’s particulary prominent and some of my users (and myself) find it particularly confusing when visiting their user/profile page for the first time.
It appears that this was discussed years ago and a change was supposedly made for the Message button, but I still see it. Maybe this is a bug? Or maybe I have misunderstood the change that was made.
To be more user-friendly, I think it would make sense to remove these buttons from a user’s own user/profile page.
2 לייקים
כפתרונות עוקפים, ניתן להסתיר את הכפתורים הללו באמצעות CSS:
section.controls > ul > li > button.compose-pm, section.controls > ul > li.chat-button {
display: none !important;
}
ניתן להכניס את הקוד הזה תחת הלשונית ‘Mobile’ במסך ‘Edit CSS/HTML’ בנושא/רכיב חדש (סמן את התיבה ‘Show Advanced’).
2 לייקים
Much better! Thank for the CSS code – works like a charm and I can’t couldn’t have figure it out myself I set it for by desktop and mobile.
EDIT: Lol, spoke to soon. The CSS code hides the buttons on all user/profile pages and not just on one’s own page. I might go with it anyways
הממ… אולי יש דרך לעשות זאת. אני אבדוק.
לייק 1
@donaldsoncd נסה להוסיף את החלק הזה ללשונית ה-JS. זה יסתיר את הכפתורים רק בדפי המשתמש שלך. הכפתורים עדיין יופיעו בכרטיס המשתמש.
import { apiInitializer } from "discourse/lib/api";
export default apiInitializer((api) => {
api.onPageChange((url, title) => {
if (url.startsWith("/u/natedhaliwal")) {
const pmBtn = document.querySelector("button.compose-pm");
pmBtn.style.display = "none";
const chatBtn = document.querySelector("li.user-card-below-message-button.chat-button");
if (chatBtn.parentNode.className != "usercard-controls") {
chatBtn.style.display = "none";
}
}
});
});
זה קצת פריצה אבל עושה את העבודה.
אתה יכול להחליף את החלק /u/natedhaliwal ב-/u/<username>.
אם אתה רוצה להסיר לחלוטין את היכולת של מישהו לשלוח לך הודעות אישיות או הודעות צ’אט, תצטרך:
עבור אל discourse.example.com/my/preferences/users.
בטל את הסימון בתיבת הסימון Allow other users to send me personal messages and chat direct messages.
מקווה שכל זה עוזר!
chapoi
25 באוגוסט, 2025, 10:07am
8
Hey @donaldsoncd
Thanks for bringing that to our attention. I agree that rendering them on your own profile is a bit silly.
I’ve applied a change for that (PR ). They should be gone when you update.
Thanks!
4 לייקים