diff --git a/packages/react/src/hooks/useFetchChatData.js b/packages/react/src/hooks/useFetchChatData.js
index 99c48aa1e..9eb04e9be 100644
--- a/packages/react/src/hooks/useFetchChatData.js
+++ b/packages/react/src/hooks/useFetchChatData.js
@@ -20,6 +20,9 @@ const useFetchChatData = (showRoles) => {
const isUserAuthenticated = useUserStore(
(state) => state.isUserAuthenticated
);
+ const setViewUserInfoPermissions = useUserStore(
+ (state) => state.setViewUserInfoPermissions
+ );
const getMessagesAndRoles = useCallback(
async (anonymousMode) => {
@@ -68,6 +71,9 @@ const useFetchChatData = (showRoles) => {
setMemberRoles(rolesObj);
}
+
+ const permissions = await RCInstance.permissionInfo();
+ setViewUserInfoPermissions(permissions.update[70]);
} catch (e) {
console.error(e);
}
diff --git a/packages/react/src/store/userStore.js b/packages/react/src/store/userStore.js
index d3c3aa24c..a19fef471 100644
--- a/packages/react/src/store/userStore.js
+++ b/packages/react/src/store/userStore.js
@@ -32,6 +32,9 @@ const useUserStore = create((set) => ({
userPinPermissions: {},
setUserPinPermissions: (userPinPermissions) =>
set((state) => ({ ...state, userPinPermissions })),
+ viewUserInfoPermissions: {},
+ setViewUserInfoPermissions: (viewUserInfoPermissions) =>
+ set((state) => ({ ...state, viewUserInfoPermissions })),
showCurrentUserInfo: false,
setShowCurrentUserInfo: (showCurrentUserInfo) =>
set(() => ({ showCurrentUserInfo })),
diff --git a/packages/react/src/views/UserInformation/UserInformation.js b/packages/react/src/views/UserInformation/UserInformation.js
index 78c93ee02..098608c84 100644
--- a/packages/react/src/views/UserInformation/UserInformation.js
+++ b/packages/react/src/views/UserInformation/UserInformation.js
@@ -28,9 +28,15 @@ const UserInformation = () => {
const [currentUserInfo, setCurrentUserInfo] = useState({});
const [isUserInfoFetched, setIsUserInfoFetched] = useState(false);
const currentUser = useUserStore((state) => state.currentUser);
- const authenticatedUserRoles = useUserStore((state) => state.roles);
+ const currentUserRoles = useUserStore((state) => state.roles);
+ const viewUserFullInfoRoles = useUserStore(
+ (state) => state.viewUserInfoPermissions.roles
+ );
const authenticatedUserId = useUserStore((state) => state.userId);
- const isAdmin = authenticatedUserRoles?.includes('admin');
+ const viewInfoRoles = new Set(viewUserFullInfoRoles);
+ const isAllowedToViewFullInfo = currentUserRoles.some((role) =>
+ viewInfoRoles.has(role)
+ );
const getUserAvatarUrl = (username) => {
const host = RCInstance.getHost();
return `${host}/avatar/${username}`;
@@ -96,6 +102,24 @@ const UserInformation = () => {
/>
{currentUserInfo?.username}
+ {currentUserInfo?.statusText && (
+
+ {currentUserInfo?.statusText}
+
+ )}
+ {currentUserInfo?.nickname && (
+
+ )}
{currentUserInfo?.roles?.length && (
{
))}
}
- isAdmin={isAdmin}
+ isAdmin={isAllowedToViewFullInfo}
authenticatedUserId={authenticatedUserId}
currentUserInfo={currentUserInfo}
/>
@@ -121,7 +145,7 @@ const UserInformation = () => {
@@ -132,17 +156,26 @@ const UserInformation = () => {
? 'Never'
: formatTimestamp(currentUserInfo.lastLogin)
}
- isAdmin={isAdmin}
+ isAdmin={isAllowedToViewFullInfo}
authenticatedUserId={authenticatedUserId}
currentUserInfo={currentUserInfo}
/>
+ {currentUserInfo?.bio && (
+
+ )}
(
@@ -158,14 +191,14 @@ const UserInformation = () => {
))}
- isAdmin={isAdmin}
+ isAdmin={isAllowedToViewFullInfo}
authenticatedUserId={authenticatedUserId}
currentUserInfo={currentUserInfo}
/>