A few Delete For Everyone fixes

Co-authored-by: Sidney Keese <sidney@carbonfive.com>
This commit is contained in:
Chris Svenningsen 2020-10-08 15:26:57 -07:00 committed by Josh Perez
parent 0122cfd22a
commit 492bb283ee
2 changed files with 11 additions and 7 deletions

View File

@ -959,7 +959,7 @@
"description": "Text shown in the confirmation dialog for deleting a message locally"
},
"deleteForEveryoneWarning": {
"message": "This message will be permanently deleted for everyone in the conversation. Members will be able to see that you deleted a message.",
"message": "This message will be deleted for everyone in the conversation if theyre on a recent version of Signal. They will be able to see that you deleted a message.",
"description": "Text shown in the confirmation dialog for deleting a message for everyone"
},
"deleteThisMessage": {

View File

@ -237,8 +237,6 @@ export class Message extends React.PureComponent<Props, State> {
public constructor(props: Props) {
super(props);
const { canDeleteForEveryone } = props;
this.wideMl = window.matchMedia('(min-width: 926px)');
this.wideMl.addEventListener('change', this.handleWideMlChange);
@ -256,14 +254,20 @@ export class Message extends React.PureComponent<Props, State> {
isWide: this.wideMl.matches,
containerWidth: 0,
canDeleteForEveryone,
canDeleteForEveryone: props.canDeleteForEveryone,
};
}
public static getDerivedStateFromProps(props: Props, state: State): State {
const newState = {
...state,
canDeleteForEveryone:
props.canDeleteForEveryone && state.canDeleteForEveryone,
};
if (!props.isSelected) {
return {
...state,
...newState,
isSelected: false,
prevSelectedCounter: 0,
};
@ -274,13 +278,13 @@ export class Message extends React.PureComponent<Props, State> {
props.isSelectedCounter !== state.prevSelectedCounter
) {
return {
...state,
...newState,
isSelected: props.isSelected,
prevSelectedCounter: props.isSelectedCounter,
};
}
return state;
return newState;
}
public handleWideMlChange = (event: MediaQueryListEvent): void => {