Skip to content
This repository was archived by the owner on Jun 16, 2023. It is now read-only.

Commit 76891c5

Browse files
profile youself fix
1 parent 86df3a5 commit 76891c5

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

src/app/molecules/people-selector/PeopleSelector.jsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { blurOnBubbling } from '../../atoms/button/script';
1010
import Text from '../../atoms/text/Text';
1111
import Avatar from '../../atoms/avatar/Avatar';
1212
import { getUserStatus, updateUserStatusIcon, getPresence } from '../../../util/onlineStatus';
13+
import initMatrix from '../../../client/initMatrix';
1314

1415
function PeopleSelector({
1516
avatarSrc, name, color, peopleRole, onClick, user, disableStatus
@@ -48,11 +49,19 @@ function PeopleSelector({
4849
if (user) {
4950

5051
// Update Status Profile
51-
const updateProfileStatus = (mEvent, tinyUser) => {
52+
const updateProfileStatus = (mEvent, tinyData) => {
5253
if (statusRef && statusRef.current) {
5354

5455
// Get Status
56+
const mx = initMatrix.matrixClient;
5557
const status = statusRef.current;
58+
const tinyUser = tinyData;
59+
60+
// Is You
61+
if (tinyUser.userId === mx.getUserId()) {
62+
const yourData = mx.getAccountData('pony.house.profile')?.getContent() ?? {};
63+
tinyUser.presenceStatusMsg = JSON.stringify(yourData);
64+
}
5665

5766
// Update Status Icon
5867
getCustomStatus(updateUserStatusIcon(status, tinyUser));

src/app/organisms/profile-viewer/ProfileViewer.jsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,12 +369,19 @@ function ProfileViewer() {
369369
if (user) {
370370

371371
// Update Status Profile
372-
const updateProfileStatus = (mEvent, tinyUser) => {
372+
const updateProfileStatus = (mEvent, tinyData) => {
373373
if (statusRef && statusRef.current) {
374374

375375
// Get Status
376+
const tinyUser = tinyData;
376377
const status = statusRef.current;
377378

379+
// Is You
380+
if (tinyUser.userId === mx.getUserId()) {
381+
const yourData = mx.getAccountData('pony.house.profile')?.getContent() ?? {};
382+
tinyUser.presenceStatusMsg = JSON.stringify(yourData);
383+
}
384+
378385
// Update Status Icon
379386
const content = updateUserStatusIcon(status, tinyUser);
380387
if (content && content.presenceStatusMsg) {

0 commit comments

Comments
 (0)