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

This commit is contained in:
warrickct 2022-02-22 09:48:39 +11:00
parent 8dfd748ce0
commit 9bbac225ad
4 changed files with 25 additions and 14 deletions

View File

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

View File

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

View File

@ -1380,9 +1380,29 @@ export class ConversationModel extends Backbone.Model<ConversationAttributes> {
}
const conversationId = this.id;
let friendRequestText;
if (!this.isApproved()) {
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)
@ -1433,10 +1453,10 @@ export class ConversationModel extends Backbone.Model<ConversationAttributes> {
conversationId,
iconUrl,
isExpiringMessage,
message: message.getNotificationText(),
message: friendRequestText ? friendRequestText : message.getNotificationText(),
messageId,
messageSentAt,
title: convo.getTitle(),
title: friendRequestText ? '' : convo.getTitle(),
});
}

View File

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