Adding PR changes

pull/2170/head
warrickct 3 years ago
parent 0461454e27
commit 36ca2a767c

@ -466,10 +466,10 @@
"trimDatabase": "Trim Database",
"trimDatabaseDescription": "Reduces your message database size to your last 10,000 messages.",
"trimDatabaseConfirmationBody": "Are you sure you want to delete your $deleteAmount$ oldest received messages?",
"reportAsSpam": "REPORT AS SPAM",
"messageRequestPending": "Your message request is currently pending",
"messageRequestAccepted": "Your message request has been accepted",
"messageRequestAcceptedOurs": "You have accepted $name$'s message request",
"messageRequestAcceptedOursNoName": "You have accepted the message request",
"declineRequestMessage": "Are you sure you want to decline this message request?",
"respondingToRequestWarning": "Sending a message to this user will automatically accept their message request and reveal your Session ID."
}

@ -219,12 +219,6 @@ textarea {
& > *:hover:not(svg) {
filter: brightness(80%);
}
&.simple {
&.danger {
color: var(--color-destructive);
}
}
}
.session-label {
@ -232,9 +226,7 @@ textarea {
padding: $session-margin-sm;
width: 100%;
border-radius: 2px;
text-align: centere
;
text-align: center;
&.primary {
background-color: $session-color-primary;
}

@ -228,8 +228,7 @@ export class SessionConversation extends React.Component<Props, State> {
return <MessageView />;
}
const conversation = getConversationController().get(selectedConversation.id);
const isApproved = conversation.isApproved();
const isApproved = selectedConversation.isApproved;
const selectionMode = selectedMessages.length > 0;
const useMsgRequests =
window.lokiFeatureFlags.useMessageRequests &&
@ -243,9 +242,9 @@ export class SessionConversation extends React.Component<Props, State> {
cancelText: window.i18n('cancel'),
message: window.i18n('declineRequestMessage'),
onClickOk: async () => {
declineConversation(selectedConversation.id, false);
blockConvoById(selectedConversation.id);
forceSyncConfigurationNowIfNeeded();
await declineConversation(selectedConversation.id, false);
await blockConvoById(selectedConversation.id);
await forceSyncConfigurationNowIfNeeded();
},
onClickCancel: () => {
window.inboxStore?.dispatch(updateConfirmModal(null));
@ -282,7 +281,7 @@ export class SessionConversation extends React.Component<Props, State> {
<div className="conversation-messages">
{showMsgRequestUI && (
<ConversationRequestBanner>
<div className="conversation-request-banner__row">
<ConversationBannerRow>
<SessionButton
buttonColor={SessionButtonColor.Green}
buttonType={SessionButtonType.BrandOutline}
@ -295,14 +294,7 @@ export class SessionConversation extends React.Component<Props, State> {
text={window.i18n('decline')}
onClick={handleDeclineConversationRequest}
/>
</div>
{/*
Disabling for now until report as spam is added in
<SessionButton
buttonColor={SessionButtonColor.Danger}
buttonType={SessionButtonType.Simple}
text={window.i18n('reportAsSpam')}
/> */}
</ConversationBannerRow>
</ConversationRequestBanner>
)}
<SplitViewContainer
@ -578,6 +570,13 @@ const renderVideoPreview = async (contentType: string, file: File, fileName: str
}
};
const ConversationBannerRow = styled.div`
display: flex;
flex-direction: row;
gap: var(--margins-lg);
justify-content: center;
`;
const ConversationRequestTextBottom = styled.div`
display: flex;
flex-direction: row;

@ -424,6 +424,25 @@ class CompositionBoxInner extends React.Component<Props, State> {
return null;
}
const makeMessagePlaceHolderText = () => {
if (isApproved && !didApproveMe && isPrivate) {
return i18n('messageRequestPending');
}
if (isKickedFromGroup) {
return i18n('youGotKickedFromGroup');
}
if (left) {
return i18n('youLeftTheGroup');
}
if (isBlocked && isPrivate) {
return i18n('unblockToSend');
}
if (isBlocked && !isPrivate) {
return i18n('unblockGroupToSend');
}
return i18n('sendMessage');
};
const {
isKickedFromGroup,
left,
@ -432,19 +451,7 @@ class CompositionBoxInner extends React.Component<Props, State> {
didApproveMe,
isApproved,
} = this.props.selectedConversation;
const messagePlaceHolder =
// isApproved && !didApproveMe && isPrivate
isApproved && !didApproveMe && isPrivate
? i18n('messageRequestPending')
: isKickedFromGroup
? i18n('youGotKickedFromGroup')
: left
? i18n('youLeftTheGroup')
: isBlocked && isPrivate
? i18n('unblockToSend')
: isBlocked && !isPrivate
? i18n('unblockGroupToSend')
: i18n('sendMessage');
const messagePlaceHolder = makeMessagePlaceHolderText();
const { typingEnabled } = this.props;
return (

@ -1,25 +1,25 @@
import React from 'react';
import { useConversationUsername } from '../../../../hooks/useParamSelector';
import { PropsForMessageRequestResponse } from '../../../../models/messageType';
import { getConversationController } from '../../../../session/conversations';
import { UserUtils } from '../../../../session/utils';
import { Flex } from '../../../basic/Flex';
import { SpacerSM, Text } from '../../../basic/Text';
import { ReadableMessage } from './ReadableMessage';
export const MessageRequestResponse = (props: PropsForMessageRequestResponse) => {
const { messageId, isUnread, receivedAt, conversationId, source } = props;
const { messageId, isUnread, receivedAt, conversationId } = props;
let profileName = '';
if (conversationId) {
profileName =
getConversationController()
.get(conversationId)
.getProfileName() + '';
}
const msgText =
profileName && props.source === UserUtils.getOurPubKeyStrFromCache()
const profileName = useConversationUsername(conversationId);
const isFromSync = props.source === UserUtils.getOurPubKeyStrFromCache();
let msgText = '';
if (isFromSync) {
msgText = profileName
? window.i18n('messageRequestAcceptedOurs', [profileName])
: window.i18n('messageRequestAccepted');
: window.i18n('messageRequestAcceptedOursNoName');
} else {
msgText = window.i18n('messageRequestAccepted');
}
return (
<ReadableMessage

@ -732,8 +732,7 @@ export class ConversationModel extends Backbone.Model<ConversationAttributes> {
}
public async sendMessageRequestResponse(isApproved: boolean) {
const publicKey = fromHexToArray(getOurPubKeyStrFromCache());
// const msgRequestResponseParams:
const publicKey = getOurPubKeyStrFromCache();
const timestamp = Date.now();
const messageRequestResponseParams = {
@ -745,21 +744,11 @@ export class ConversationModel extends Backbone.Model<ConversationAttributes> {
const messageRequestResponse = new MessageRequestResponse(messageRequestResponseParams);
if (this.isPrivate()) {
// 1-1 conversations
const pubkeyForSending = new PubKey(this.id);
await getMessageQueue()
.sendToPubKey(pubkeyForSending, messageRequestResponse)
.catch(window?.log?.error);
}
// TODO: may be removable as group invites are implied to be friends.
// else if (this.isClosedGroup()) {
// // group conversations
// await getMessageQueue()
// .sendToGroup(messageRequestResponse, undefined, new PubKey(this.id))
// .catch(window?.log?.error);
// }
console.warn('Sent message request response', isApproved);
}
public async sendMessage(msg: SendMessageType) {

@ -574,8 +574,6 @@ async function handleMessageRequestResponse(
conversationToApprove.updateLastMessage();
}
// await forceSyncConfigurationNowIfNeeded();
await removeFromCache(envelope);
}

@ -1,9 +1,10 @@
import { SignalService } from '../../../../protobuf';
import { fromHexToArray } from '../../../utils/String';
import { ContentMessage } from '../ContentMessage';
import { MessageParams } from '../Message';
interface MessageRequestResponseParams extends MessageParams {
publicKey: Uint8Array;
publicKey: string;
isApproved: boolean;
}
@ -17,7 +18,7 @@ export class MessageRequestResponse extends ContentMessage {
publicKey: params.publicKey,
isApproved: params.isApproved,
} as MessageRequestResponseParams);
this.publicKey = params.publicKey;
this.publicKey = fromHexToArray(params.publicKey);
this.isApproved = params.isApproved;
}

@ -22,7 +22,6 @@ import { OpenGroupRequestCommonType } from '../apis/open_group_api/opengroupV2/A
import { OpenGroupVisibleMessage } from '../messages/outgoing/visibleMessage/OpenGroupVisibleMessage';
import { UnsendMessage } from '../messages/outgoing/controlMessage/UnsendMessage';
import { CallMessage } from '../messages/outgoing/controlMessage/CallMessage';
import { MessageRequestResponse } from '../messages/outgoing/controlMessage/MessageRequestResponse';
type ClosedGroupMessageType =
| ClosedGroupVisibleMessage
@ -33,8 +32,7 @@ type ClosedGroupMessageType =
| ExpirationTimerUpdateMessage
| ClosedGroupEncryptionPairMessage
| UnsendMessage
| ClosedGroupEncryptionPairRequestMessage
| MessageRequestResponse;
| ClosedGroupEncryptionPairRequestMessage;
// ClosedGroupEncryptionPairReplyMessage must be sent to a user pubkey. Not a group.

@ -57,7 +57,7 @@ const darkButtonGreen = accentDarkTheme;
const darkModalBackground = '#101011';
const grey67 = '#434343';
const darkMessageRequestBannerBackground = '#2c2c2c';
const darkMessageRequestBannerBackground = darkConversationItemHasUnread;
const darkMessageRequestBannerIconBackground = grey67;
const darkMessageRequestBannerUnreadBackground = grey67;
const darkMessageRequestBannerIcon = '#adadad';
@ -208,9 +208,9 @@ const lightBackgroundPrimary = '#272726';
const lightButtonGreen = '#272726';
const lightModalBackground = '#fcfcfc';
const lightMessageRequestBannerBackground = '#f0f0f0';
const lightMessageRequestBannerBackground = lightColorQuoteBottomBarBg;
const lightMessageRequestBannerIconBackground = '#585858';
const lightMessageRequestBannerUnreadBackground = '#dfdfdf';
const lightMessageRequestBannerUnreadBackground = lightColorClickableHovered;
const lightMessageRequestBannerIcon = white;
export const switchHtmlToLightTheme = () => {

@ -437,7 +437,6 @@ const _getConversationRequests = (
const pushToMessageRequests =
isMessageRequestEnabled && window?.lokiFeatureFlags?.useMessageRequests;
return _.filter(sortedConversations, conversation => {
console.warn({ conversation });
return (
pushToMessageRequests &&
!conversation.isApproved &&

@ -465,10 +465,10 @@ export type LocalizerKeys =
| 'trimDatabase'
| 'trimDatabaseDescription'
| 'trimDatabaseConfirmationBody'
| 'reportAsSpam'
| 'respondingToRequestWarning'
| 'messageRequestPending'
| 'messageRequestAccepted'
| 'messageRequestAcceptedOurs'
| 'messageRequestAcceptedOursNoName'
| 'declineRequestMessage'
| 'reportIssue';

Loading…
Cancel
Save