Skip to content
This repository has been archived by the owner on Dec 12, 2022. It is now read-only.

Commit

Permalink
MXKEventFormatter: Change how the kick reason is displayed
Browse files Browse the repository at this point in the history
It fixes "kick reason should displayed like the webclient" (element-hq/element-ios#549)
  • Loading branch information
manuroe committed Sep 8, 2016
1 parent 6ddfa2c commit 4a218b5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@
"notice_room_unban" = "%@ unbanned %@";
"notice_room_ban" = "%@ banned %@";
"notice_room_withdraw" = "%@ withdrew %@'s invitation";
"notice_room_reason" = ". Reason: %@";
"notice_avatar_url_changed" = "%@ changed their avatar";
"notice_display_name_set" = "%@ set their display name to %@";
"notice_display_name_changed_from" = "%@ changed their display name from %@ to %@";
Expand Down
9 changes: 7 additions & 2 deletions MatrixKit/Utils/MXKEventFormatter.m
Original file line number Diff line number Diff line change
Expand Up @@ -541,13 +541,18 @@ - (NSAttributedString *)attributedStringFromEvent:(MXEvent *)event withRoomState
if ([prevMembership isEqualToString:@"invite"])
{
displayText = [NSString stringWithFormat:[NSBundle mxk_localizedStringForKey:@"notice_room_withdraw"], senderDisplayName, targetDisplayName];
if (event.content[@"reason"])
{
displayText = [displayText stringByAppendingString:[NSString stringWithFormat:[NSBundle mxk_localizedStringForKey:@"notice_room_reason"], event.content[@"reason"]]];
}

}
else if ([prevMembership isEqualToString:@"join"])
{
displayText = [NSString stringWithFormat:[NSBundle mxk_localizedStringForKey:@"notice_room_kick"], senderDisplayName, targetDisplayName];
if (event.content[@"reason"])
{
displayText = [NSString stringWithFormat:@"%@: %@", displayText, event.content[@"reason"]];
displayText = [displayText stringByAppendingString:[NSString stringWithFormat:[NSBundle mxk_localizedStringForKey:@"notice_room_reason"], event.content[@"reason"]]];
}
}
else if ([prevMembership isEqualToString:@"ban"])
Expand All @@ -561,7 +566,7 @@ - (NSAttributedString *)attributedStringFromEvent:(MXEvent *)event withRoomState
displayText = [NSString stringWithFormat:[NSBundle mxk_localizedStringForKey:@"notice_room_ban"], senderDisplayName, targetDisplayName];
if (event.content[@"reason"])
{
displayText = [NSString stringWithFormat:@"%@: %@", displayText, event.content[@"reason"]];
displayText = [displayText stringByAppendingString:[NSString stringWithFormat:[NSBundle mxk_localizedStringForKey:@"notice_room_reason"], event.content[@"reason"]]];
}
}

Expand Down

0 comments on commit 4a218b5

Please sign in to comment.