mirror of
https://github.com/oxen-io/session-desktop.git
synced 2023-12-14 02:12:57 +01:00
feat: desktop now supports avatar being removed via sync configuration message
disabled buttons while loading
This commit is contained in:
parent
84d3d5b1b4
commit
b59f1bf445
|
@ -79,6 +79,7 @@ export const DisplayPictureModal = (props: DisplayPictureModalProps) => {
|
|||
setNewAvatarObjectUrl(null);
|
||||
setOldAvatarPath(null);
|
||||
setLoading(false);
|
||||
closeDialog();
|
||||
};
|
||||
|
||||
return (
|
||||
|
@ -115,14 +116,14 @@ export const DisplayPictureModal = (props: DisplayPictureModalProps) => {
|
|||
text={window.i18n('upload')}
|
||||
buttonType={SessionButtonType.Simple}
|
||||
onClick={handleUpload}
|
||||
disabled={_newAvatarObjectUrl === newAvatarObjectUrl}
|
||||
disabled={loading || _newAvatarObjectUrl === newAvatarObjectUrl}
|
||||
/>
|
||||
<SessionButton
|
||||
text={window.i18n('remove')}
|
||||
buttonColor={SessionButtonColor.Danger}
|
||||
buttonType={SessionButtonType.Simple}
|
||||
onClick={handleRemove}
|
||||
disabled={!oldAvatarPath}
|
||||
disabled={loading || !oldAvatarPath}
|
||||
/>
|
||||
</div>
|
||||
</SessionWrapperModal>
|
||||
|
|
|
@ -490,23 +490,23 @@ export async function uploadOurAvatar(newAvatarDecrypted?: ArrayBuffer) {
|
|||
/**
|
||||
* This function can be used for clearing our avatar.
|
||||
*/
|
||||
export async function clearOurAvatar() {
|
||||
export async function clearOurAvatar(commit: boolean = true) {
|
||||
const ourConvo = getConversationController().get(UserUtils.getOurPubKeyStrFromCache());
|
||||
if (!ourConvo) {
|
||||
window.log.warn('ourConvo not found... This is not a valid case');
|
||||
return;
|
||||
}
|
||||
|
||||
// TODO check if defined first
|
||||
ourConvo.set('avatarPointer', undefined);
|
||||
ourConvo.set('avatarInProfile', undefined);
|
||||
ourConvo.set('profileKey', undefined);
|
||||
|
||||
await ourConvo.commit();
|
||||
await setLastProfileUpdateTimestamp(Date.now());
|
||||
await SyncUtils.forceSyncConfigurationNowIfNeeded(true);
|
||||
|
||||
// TODO send messages to opengroups to clear avatar from there
|
||||
if (commit) {
|
||||
await ourConvo.commit();
|
||||
await SyncUtils.forceSyncConfigurationNowIfNeeded(true);
|
||||
}
|
||||
}
|
||||
|
||||
export async function replyToMessage(messageId: string) {
|
||||
|
|
Loading…
Reference in a new issue