Remove prevention of sending more than one message for an unapproved conversation.

pull/2222/head
warrickct 4 years ago
parent 8dfd748ce0
commit 9bbac225ad

@ -475,5 +475,6 @@
"noMessageRequestsPending": "No pending message requests", "noMessageRequestsPending": "No pending message requests",
"noMediaUntilApproved": "You cannot send attachments until the conversation is approved", "noMediaUntilApproved": "You cannot send attachments until the conversation is approved",
"mustBeApproved": "This conversation must be accepted to use this feature", "mustBeApproved": "This conversation must be accepted to use this feature",
"youHaveANewFriendRequest": "You have a new friend request",
"openMessageRequestInboxDescription": "View your Message Request inbox" "openMessageRequestInboxDescription": "View your Message Request inbox"
} }

@ -405,9 +405,6 @@ class CompositionBoxInner extends React.Component<Props, State> {
} }
const makeMessagePlaceHolderText = () => { const makeMessagePlaceHolderText = () => {
if (isApproved && !didApproveMe && isPrivate) {
return i18n('messageRequestPending');
}
if (isKickedFromGroup) { if (isKickedFromGroup) {
return i18n('youGotKickedFromGroup'); return i18n('youGotKickedFromGroup');
} }
@ -808,14 +805,6 @@ class CompositionBoxInner extends React.Component<Props, State> {
ToastUtils.pushUnblockToSend(); ToastUtils.pushUnblockToSend();
return; return;
} }
if (
selectedConversation.isApproved &&
!selectedConversation.didApproveMe &&
selectedConversation.isPrivate
) {
ToastUtils.pushMessageRequestPending();
return;
}
if (selectedConversation.isBlocked && !selectedConversation.isPrivate) { if (selectedConversation.isBlocked && !selectedConversation.isPrivate) {
ToastUtils.pushUnblockToSendGroup(); ToastUtils.pushUnblockToSendGroup();
return; return;

@ -1380,9 +1380,29 @@ export class ConversationModel extends Backbone.Model<ConversationAttributes> {
} }
const conversationId = this.id; const conversationId = this.id;
let friendRequestText;
if (!this.isApproved()) { if (!this.isApproved()) {
window?.log?.info('notification cancelled for unapproved convo', this.idForLogging()); window?.log?.info('notification cancelled for unapproved convo', this.idForLogging());
return; const showRequestNotification =
getConversationController()
.getConversations()
.filter(conversation => {
return (
!conversation.isApproved() &&
!conversation.isBlocked() &&
conversation.isPrivate() &&
!conversation.isMe()
);
}).length === 1;
if (showRequestNotification) {
friendRequestText = window.i18n('youHaveANewFriendRequest');
} else {
window?.log?.info(
'notification cancelled for as pending requests already exist',
this.idForLogging()
);
return;
}
} }
// make sure the notifications are not muted for this convo (and not the source convo) // make sure the notifications are not muted for this convo (and not the source convo)
@ -1433,10 +1453,10 @@ export class ConversationModel extends Backbone.Model<ConversationAttributes> {
conversationId, conversationId,
iconUrl, iconUrl,
isExpiringMessage, isExpiringMessage,
message: message.getNotificationText(), message: friendRequestText ? friendRequestText : message.getNotificationText(),
messageId, messageId,
messageSentAt, messageSentAt,
title: convo.getTitle(), title: friendRequestText ? '' : convo.getTitle(),
}); });
} }

@ -478,4 +478,5 @@ export type LocalizerKeys =
| 'noMessageRequestsPending' | 'noMessageRequestsPending'
| 'noMediaUntilApproved' | 'noMediaUntilApproved'
| 'mustBeApproved' | 'mustBeApproved'
| 'youHaveANewFriendRequest'
| 'reportIssue'; | 'reportIssue';

Loading…
Cancel
Save