make redux store update on block/unblock

pull/1250/head
Audric Ackermann 5 years ago
parent edc34649a4
commit 8d544a9d87
No known key found for this signature in database
GPG Key ID: 999F434D76324AD4

@ -250,7 +250,7 @@
? BlockedNumberController.block(this.id) ? BlockedNumberController.block(this.id)
: BlockedNumberController.blockGroup(this.id); : BlockedNumberController.blockGroup(this.id);
await promise; await promise;
this.trigger('change'); this.trigger('change', this);
this.messageCollection.forEach(m => m.trigger('change')); this.messageCollection.forEach(m => m.trigger('change'));
this.updateTextInputState(); this.updateTextInputState();
}, },
@ -262,7 +262,7 @@
? BlockedNumberController.unblock(this.id) ? BlockedNumberController.unblock(this.id)
: BlockedNumberController.unblockGroup(this.id); : BlockedNumberController.unblockGroup(this.id);
await promise; await promise;
this.trigger('change'); this.trigger('change', this);
this.messageCollection.forEach(m => m.trigger('change')); this.messageCollection.forEach(m => m.trigger('change'));
this.updateTextInputState(); this.updateTextInputState();
}, },

@ -11,7 +11,6 @@ import { ContactName } from './conversation/ContactName';
import { TypingAnimation } from './conversation/TypingAnimation'; import { TypingAnimation } from './conversation/TypingAnimation';
import { Colors, LocalizerType } from '../types/Util'; import { Colors, LocalizerType } from '../types/Util';
import { SessionButton, SessionButtonColor } from './session/SessionButton';
export type PropsData = { export type PropsData = {
id: string; id: string;
@ -181,11 +180,11 @@ export class ConversationListItem extends React.PureComponent<Props> {
{!isPublic && !isRss && !isMe ? ( {!isPublic && !isRss && !isMe ? (
<MenuItem onClick={blockHandler}>{blockTitle}</MenuItem> <MenuItem onClick={blockHandler}>{blockTitle}</MenuItem>
) : null} ) : null}
{!isPublic && !isRss && !isMe ? ( {/* {!isPublic && !isRss && !isMe ? (
<MenuItem onClick={onChangeNickname}> <MenuItem onClick={onChangeNickname}>
{i18n('changeNickname')} {i18n('changeNickname')}
</MenuItem> </MenuItem>
) : null} ) : null} */}
{!isPublic && !isRss && !isMe && hasNickname ? ( {!isPublic && !isRss && !isMe && hasNickname ? (
<MenuItem onClick={onClearNickname}>{i18n('clearNickname')}</MenuItem> <MenuItem onClick={onClearNickname}>{i18n('clearNickname')}</MenuItem>
) : null} ) : null}

@ -54,6 +54,7 @@ export type ConversationType = {
isTyping: boolean; isTyping: boolean;
isSecondary?: boolean; isSecondary?: boolean;
primaryDevice: string; primaryDevice: string;
isBlocked: boolean;
}; };
export type ConversationLookupType = { export type ConversationLookupType = {
[key: string]: ConversationType; [key: string]: ConversationType;

@ -11,6 +11,7 @@ import {
import { getIntl, getRegionCode, getUserNumber } from './user'; import { getIntl, getRegionCode, getUserNumber } from './user';
import { PropsData as ConversationListItemPropsType } from '../../components/ConversationListItem'; import { PropsData as ConversationListItemPropsType } from '../../components/ConversationListItem';
import { BlockedNumberController } from '../../util';
export const getConversations = (state: StateType): ConversationsStateType => export const getConversations = (state: StateType): ConversationsStateType =>
state.conversations; state.conversations;
@ -119,6 +120,16 @@ export const _getLeftPaneLists = (
isSelected: true, isSelected: true,
}; };
} }
const isBlocked =
BlockedNumberController.isBlocked(conversation.primaryDevice) ||
BlockedNumberController.isGroupBlocked(conversation.id);
if (isBlocked) {
conversation = {
...conversation,
isBlocked: true,
};
}
// Add Open Group to list as soon as the name has been set // Add Open Group to list as soon as the name has been set
if ( if (

Loading…
Cancel
Save