Skip to content

Commit

Permalink
ref(settings): remove changeLocalDisplayName action
Browse files Browse the repository at this point in the history
  • Loading branch information
hristoterezov committed Apr 22, 2024
1 parent e3ab6c9 commit 88b6cdf
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 30 deletions.
4 changes: 2 additions & 2 deletions modules/API/API.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ import {
import { LOCAL_PARTICIPANT_DEFAULT_ID } from '../../react/features/base/participants/constants';
import {
getLocalParticipant,
getNormalizedDisplayName,
getParticipantById,
getScreenshareParticipantIds,
getVirtualScreenshareParticipantByOwnerId,
Expand Down Expand Up @@ -105,7 +106,6 @@ import { startAudioScreenShareFlow, startScreenShareFlow } from '../../react/fea
import { isScreenAudioSupported } from '../../react/features/screen-share/functions';
import { toggleScreenshotCaptureSummary } from '../../react/features/screenshot-capture/actions';
import { isScreenshotCaptureEnabled } from '../../react/features/screenshot-capture/functions';
import { changeLocalDisplayName } from '../../react/features/settings/actions.web';
import SettingsDialog from '../../react/features/settings/components/web/SettingsDialog';
import { SETTINGS_TABS } from '../../react/features/settings/constants';
import { playSharedVideo, stopSharedVideo } from '../../react/features/shared-video/actions.any';
Expand Down Expand Up @@ -201,7 +201,7 @@ function initCommands() {
},
'display-name': displayName => {
sendAnalytics(createApiEvent('display.name.changed'));
APP.store.dispatch(changeLocalDisplayName(displayName));
APP.store.dispatch(updateSettings({ displayName: getNormalizedDisplayName(displayName) }));
},
'local-subject': localSubject => {
sendAnalytics(createApiEvent('local.subject.changed'));
Expand Down
13 changes: 0 additions & 13 deletions react/features/settings/actions.native.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,3 @@ export function openLogoutDialog() {
}));
};
}

/**
* Changes the display name for the local user.
*
* @param {string} _nickname - The new display name.
* @returns {Function}
*/
export function changeLocalDisplayName(_nickname = '') {
// not used on mobile.
return (_dispatch: IStore['dispatch'], _getState: IStore['getState']) => {
// no-op action.
};
}
16 changes: 1 addition & 15 deletions react/features/settings/actions.web.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ export function submitProfileTab(newState: any) {
const currentState = getProfileTabProps(getState());

if (newState.displayName !== currentState.displayName) {
dispatch(changeLocalDisplayName(newState.displayName));
dispatch(updateSettings({ displayName: getNormalizedDisplayName(newState.displayName) }));
}

if (newState.email !== currentState.email) {
Expand All @@ -201,20 +201,6 @@ export function submitProfileTab(newState: any) {
};
}

/**
* Changes the display name for the local user.
*
* @param {string} nickname - The new display name.
* @returns {Function}
*/
export function changeLocalDisplayName(nickname = '') {
return (dispatch: IStore['dispatch']) => {
const formattedNickname = getNormalizedDisplayName(nickname);

dispatch(updateSettings({ displayName: formattedNickname }));
};
}

/**
* Submits the settings from the "Sounds" tab of the settings dialog.
*
Expand Down

4 comments on commit 88b6cdf

@ignaciogros
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Hristo,
Is there any alternative to the changeLocalDisplayName action?
I need the user name to be the value typed in the login form (user name), and I used to change it right after logging in, but I can't do that after updating Jitsi.
Thank you!

@hristoterezov
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The alternative is:

dispatch(updateSettings({ displayName: getNormalizedDisplayName(displayName) }));

@ignaciogros
Copy link

@ignaciogros ignaciogros commented on 88b6cdf May 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Solved. Thank you.

@ignaciogros
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just in case anybody needs that:

I added the "changeLocalDisplayName" method in conference.js/app.bundle.min.js so you can change the userName with APP.conference.changeLocalDisplayName("name"); as in previous versions. Example:

    changeLocalDisplayName(userName = '') {
        const formattedUserName = String(userName).trim();
        
        APP.store.dispatch(updateSettings({
            displayName: formattedUserName
        }));

    }

Please sign in to comment.