Fix: Avatar preview does not update when same file is selected repeatedly (#8288)

* Fix: Avatar preview does not update when same file is selected repeatedly

Co-authored-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
Janne Mareike Koschinski 2022-04-12 14:21:17 +02:00 committed by GitHub
parent 7600182a35
commit dbcb56f75e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 48 additions and 3 deletions

View file

@ -31,6 +31,7 @@ import { RoomNotifState } from '../../../../../RoomNotifs';
import defaultDispatcher from "../../../../../dispatcher/dispatcher";
import { Action } from "../../../../../dispatcher/actions";
import { UserTab } from "../../../dialogs/UserTab";
import { chromeFileInputFix } from "../../../../../utils/BrowserWorkarounds";
interface IProps {
roomId: string;
@ -77,7 +78,7 @@ export default class NotificationsSettingsTab extends React.Component<IProps, IS
this.soundUpload.current.click();
};
private onSoundUploadChanged = (e: React.ChangeEvent<HTMLInputElement>): Promise<void> => {
private onSoundUploadChanged = (e: React.ChangeEvent<HTMLInputElement>): void => {
if (!e.target.files || !e.target.files.length) {
this.setState({
uploadedFile: null,
@ -254,7 +255,14 @@ export default class NotificationsSettingsTab extends React.Component<IProps, IS
<h3>{ _t("Set a new custom sound") }</h3>
<div className="mx_SettingsFlag">
<form autoComplete="off" noValidate={true}>
<input ref={this.soundUpload} className="mx_NotificationSound_soundUpload" type="file" onChange={this.onSoundUploadChanged} accept="audio/*" />
<input
ref={this.soundUpload}
className="mx_NotificationSound_soundUpload"
type="file"
onClick={chromeFileInputFix}
onChange={this.onSoundUploadChanged}
accept="audio/*"
/>
</form>
{ currentUploadedFile }