mirror of
https://github.com/oxen-io/session-desktop.git
synced 2023-12-14 02:12:57 +01:00
Addressing PR comments
This commit is contained in:
parent
2d664a2df7
commit
726418887c
|
@ -377,15 +377,13 @@ const ConversationListItem = (props: Props) => {
|
|||
<SessionButton
|
||||
onClick={handleConversationBlock}
|
||||
buttonColor={SessionButtonColor.Danger}
|
||||
text={window.i18n('block')}
|
||||
>
|
||||
Block
|
||||
</SessionButton>
|
||||
text={window.i18n('blockUser')}
|
||||
/>
|
||||
<SessionButton
|
||||
buttonColor={SessionButtonColor.Green}
|
||||
onClick={handleConversationAccept}
|
||||
text={window.i18n('accept')}
|
||||
></SessionButton>
|
||||
/>
|
||||
</Flex>
|
||||
) : null}
|
||||
</div>
|
||||
|
|
|
@ -221,6 +221,33 @@ export class LeftPaneMessageSection extends React.Component<Props, State> {
|
|||
this.handleToggleOverlay(SessionClosableOverlayType.MessageRequests);
|
||||
}
|
||||
|
||||
/**
|
||||
* Blocks all message request conversations and synchronizes across linked devices
|
||||
* @returns void
|
||||
*/
|
||||
private async handleBlockAllRequestsClick() {
|
||||
// block all convo requests. Force sync if there were changes.
|
||||
window?.log?.info('Blocking all conversations');
|
||||
const { conversationRequests } = this.props;
|
||||
let syncRequired = false;
|
||||
|
||||
if (!conversationRequests) {
|
||||
window?.log?.info('No conversation requests to block.');
|
||||
return;
|
||||
}
|
||||
|
||||
await Promise.all(
|
||||
conversationRequests.map(async convo => {
|
||||
await BlockedNumberController.block(convo.id);
|
||||
syncRequired = true;
|
||||
})
|
||||
);
|
||||
|
||||
if (syncRequired) {
|
||||
await forceSyncConfigurationNowIfNeeded();
|
||||
}
|
||||
}
|
||||
|
||||
private renderClosableOverlay() {
|
||||
const { searchTerm, searchResults } = this.props;
|
||||
const { loading, overlay } = this.state;
|
||||
|
@ -278,28 +305,7 @@ export class LeftPaneMessageSection extends React.Component<Props, State> {
|
|||
onCloseClick={() => {
|
||||
this.handleToggleOverlay(undefined);
|
||||
}}
|
||||
onButtonClick={async () => {
|
||||
// block all convo requests. Force sync if there were changes.
|
||||
window?.log?.info('Blocking all conversations');
|
||||
const { conversationRequests } = this.props;
|
||||
let syncRequired = false;
|
||||
|
||||
if (!conversationRequests) {
|
||||
window?.log?.info('No conversation requests to block.');
|
||||
return;
|
||||
}
|
||||
|
||||
await Promise.all(
|
||||
conversationRequests.map(async convo => {
|
||||
await BlockedNumberController.block(convo.id);
|
||||
syncRequired = true;
|
||||
})
|
||||
);
|
||||
|
||||
if (syncRequired) {
|
||||
await forceSyncConfigurationNowIfNeeded();
|
||||
}
|
||||
}}
|
||||
onButtonClick={this.handleBlockAllRequestsClick}
|
||||
searchTerm={searchTerm}
|
||||
searchResults={searchResults}
|
||||
showSpinner={loading}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import _ from 'lodash';
|
||||
import { createOrUpdateItem } from '../data/data';
|
||||
import { createOrUpdateItem, getItemById, hasSyncedInitialConfigurationItem } from '../data/data';
|
||||
import { ConversationTypeEnum } from '../models/conversation';
|
||||
import {
|
||||
joinOpenGroupV2WithUIEvents,
|
||||
|
@ -59,6 +59,18 @@ async function handleGroupsAndContactsFromConfigMessage(
|
|||
value: true,
|
||||
});
|
||||
|
||||
const didWeHandleAConfigurationMessageAlready =
|
||||
(await getItemById(hasSyncedInitialConfigurationItem))?.value || false;
|
||||
if (didWeHandleAConfigurationMessageAlready) {
|
||||
window?.log?.info(
|
||||
'Dropping configuration groups change as we already handled one... Only handling contacts '
|
||||
);
|
||||
if (configMessage.contacts?.length) {
|
||||
await Promise.all(configMessage.contacts.map(async c => handleContactReceived(c, envelope)));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
const numberClosedGroup = configMessage.closedGroups?.length || 0;
|
||||
|
||||
window?.log?.info(
|
||||
|
|
|
@ -266,12 +266,6 @@ export class ConversationController {
|
|||
return Array.from(this.conversations.models);
|
||||
}
|
||||
|
||||
public getConversationRequests(): Array<ConversationModel> {
|
||||
return Array.from(this.conversations.models).filter(
|
||||
conversation => conversation.isApproved() && !conversation.isBlocked
|
||||
);
|
||||
}
|
||||
|
||||
public unsafeDelete(convo: ConversationModel) {
|
||||
this.conversations.remove(convo);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue