Merge pull request #5809 from vector-im/andy/5807_ignore_from_invite

Ignore the sender of a room invite without needing to join the room first
This commit is contained in:
Anderas
2022-03-14 13:13:37 +00:00
committed by GitHub
4 changed files with 63 additions and 6 deletions
+2
View File
@@ -497,6 +497,7 @@ Tap the + to start adding people.";
"room_preview_unlinked_email_warning" = "This invitation was sent to %@, which is not associated with this account. You may wish to login with a different account, or add this email to your account.";
"room_preview_try_join_an_unknown_room" = "You are trying to access %@. Would you like to join in order to participate in the discussion?";
"room_preview_try_join_an_unknown_room_default" = "a room";
"room_preview_decline_invitation_options" = "Do you want to decline the invitation or ignore this user?";
// Settings
"settings_title" = "Settings";
@@ -2032,6 +2033,7 @@ Tap the + to start adding people.";
"end_call" = "End Call";
"resume_call" = "Resume";
"ignore" = "Ignore";
"ignore_user" = "Ignore User";
"unignore" = "Unignore";
// Events formatter
+8
View File
@@ -2127,6 +2127,10 @@ public class VectorL10n: NSObject {
public static var ignore: String {
return VectorL10n.tr("Vector", "ignore")
}
/// Ignore User
public static var ignoreUser: String {
return VectorL10n.tr("Vector", "ignore_user")
}
/// Take photo
public static var imagePickerActionCamera: String {
return VectorL10n.tr("Vector", "image_picker_action_camera")
@@ -5323,6 +5327,10 @@ public class VectorL10n: NSObject {
public static var roomPredecessorLink: String {
return VectorL10n.tr("Vector", "room_predecessor_link")
}
/// Do you want to decline the invitation or ignore this user?
public static var roomPreviewDeclineInvitationOptions: String {
return VectorL10n.tr("Vector", "room_preview_decline_invitation_options")
}
/// You have been invited to join this room by %@
public static func roomPreviewInvitationFormat(_ p1: String) -> String {
return VectorL10n.tr("Vector", "room_preview_invitation_format", p1)
+52 -6
View File
@@ -4979,10 +4979,32 @@ const NSTimeInterval kResizeComposerAnimationDuration = .05;
}
else if (tappedView == previewHeader.leftButton)
{
[self declineRoomInvitation];
[self presentDeclineOptionsFromView:tappedView];
}
}
- (void)presentDeclineOptionsFromView:(UIView *)view
{
UIAlertController *actionSheet = [UIAlertController alertControllerWithTitle:[VectorL10n roomPreviewDeclineInvitationOptions]
message:nil
preferredStyle:UIAlertControllerStyleActionSheet];
[actionSheet addAction:[UIAlertAction actionWithTitle:[VectorL10n decline]
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * _Nonnull action) {
[self declineRoomInvitation];
}]];
[actionSheet addAction:[UIAlertAction actionWithTitle:[VectorL10n ignoreUser]
style:UIAlertActionStyleDestructive
handler:^(UIAlertAction * _Nonnull action) {
[self ignoreInviteSender];
}]];
[actionSheet addAction:[UIAlertAction actionWithTitle:[VectorL10n cancel]
style:UIAlertActionStyleCancel
handler:nil]];
actionSheet.popoverPresentationController.sourceView = view;
[self presentViewController:actionSheet animated:YES completion:nil];
}
- (void)declineRoomInvitation
{
// 'Decline' button has been pressed
@@ -4993,16 +5015,15 @@ const NSTimeInterval kResizeComposerAnimationDuration = .05;
else
{
[self startActivityIndicator];
MXWeakify(self);
[self.roomDataSource.room leave:^{
MXStrongifyAndReturnIfNil(self);
[self stopActivityIndicator];
// We remove the current view controller.
// Pop to homes view controller
[[AppDelegate theDelegate] restoreInitialDisplay:^{}];
[self popToHomeViewController];
} failure:^(NSError *error) {
MXStrongifyAndReturnIfNil(self);
[self stopActivityIndicator];
MXLogDebug(@"[RoomVC] Failed to reject an invited room (%@) failed", self.roomDataSource.room.roomId);
@@ -5011,6 +5032,31 @@ const NSTimeInterval kResizeComposerAnimationDuration = .05;
}
}
- (void)ignoreInviteSender
{
[self startActivityIndicator];
MXWeakify(self);
[self.roomDataSource.room ignoreInviteSender:^{
MXStrongifyAndReturnIfNil(self);
[self stopActivityIndicator];
[self popToHomeViewController];
} failure:^(NSError *error) {
MXStrongifyAndReturnIfNil(self);
[self stopActivityIndicator];
MXLogDebug(@"[RoomVC] Failed to ignore inviter in room (%@)", self.roomDataSource.room.roomId);
}];
}
- (void)popToHomeViewController
{
// We remove the current view controller.
// Pop to homes view controller
[[AppDelegate theDelegate] restoreInitialDisplay:^{}];
}
#pragma mark - Typing management
- (void)removeTypingNotificationsListener
+1
View File
@@ -0,0 +1 @@
Room: Ignore the sender of a room invite without needing to join the room first