mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-21 00:52:43 +02:00
MESSENGER-5290 mark more federated user status events
This commit is contained in:
@@ -619,6 +619,9 @@ static NSString *const kRepliedTextPattern = @"<mx-reply>.*<blockquote>.*<br>(.*
|
||||
// Prepare targeted member display name
|
||||
NSString *targetDisplayName = event.stateKey;
|
||||
|
||||
// bwi #5290 federated user get additional status text
|
||||
NSString *displayName = [self formattedJoinEvent:targetDisplayName room:[mxSession roomWithRoomId:event.roomId] userId:event.sender];
|
||||
|
||||
// Retrieve content displayname
|
||||
NSString *contentDisplayname;
|
||||
MXJSONModelSetString(contentDisplayname, event.content[@"displayname"]);
|
||||
@@ -657,7 +660,8 @@ static NSString *const kRepliedTextPattern = @"<mx-reply>.*<blockquote>.*<br>(.*
|
||||
// The targeted member display name (if any) is available in content
|
||||
if (isEventSenderMyUser)
|
||||
{
|
||||
displayText = [VectorL10n noticeRoomInviteByYou:targetDisplayName];
|
||||
// bwi #5290 federated user get additional status text
|
||||
displayText = [VectorL10n noticeRoomInviteByYou:displayName];
|
||||
}
|
||||
else if ([targetDisplayName isEqualToString:mxSession.myUserId])
|
||||
{
|
||||
@@ -670,7 +674,8 @@ static NSString *const kRepliedTextPattern = @"<mx-reply>.*<blockquote>.*<br>(.*
|
||||
targetDisplayName = contentDisplayname;
|
||||
}
|
||||
|
||||
displayText = [VectorL10n noticeRoomInvite:senderDisplayName :targetDisplayName];
|
||||
// bwi #5290 federated user get additional status text
|
||||
displayText = [VectorL10n noticeRoomInvite:senderDisplayName :displayName];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -694,9 +699,8 @@ static NSString *const kRepliedTextPattern = @"<mx-reply>.*<blockquote>.*<br>(.*
|
||||
{
|
||||
targetDisplayName = contentDisplayname;
|
||||
}
|
||||
|
||||
// bwi #5290 federated user get additional status text
|
||||
displayText = [self formattedJoinEvent: [VectorL10n noticeRoomJoin:targetDisplayName] room:[mxSession roomWithRoomId:event.roomId] userId:event.sender];
|
||||
displayText = [VectorL10n noticeRoomJoin:displayName];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -730,7 +734,8 @@ static NSString *const kRepliedTextPattern = @"<mx-reply>.*<blockquote>.*<br>(.*
|
||||
}
|
||||
else
|
||||
{
|
||||
displayText = [VectorL10n noticeRoomReject:targetDisplayName];
|
||||
// bwi #5290 federated user get additional status text
|
||||
displayText = [VectorL10n noticeRoomReject:displayName];
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -742,7 +747,7 @@ static NSString *const kRepliedTextPattern = @"<mx-reply>.*<blockquote>.*<br>(.*
|
||||
else
|
||||
{
|
||||
// bwi #5290 federated user get additional status text
|
||||
displayText = [self formattedJoinEvent: [BWIL10n noticeRoomLeave:targetDisplayName] room:[mxSession roomWithRoomId:event.roomId] userId:event.sender];
|
||||
displayText = [BWIL10n noticeRoomLeave:displayName];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -753,11 +758,13 @@ static NSString *const kRepliedTextPattern = @"<mx-reply>.*<blockquote>.*<br>(.*
|
||||
{
|
||||
if (isEventSenderMyUser)
|
||||
{
|
||||
displayText = [VectorL10n noticeRoomWithdrawByYou:targetDisplayName];
|
||||
// bwi #5290 federated user get additional status text
|
||||
displayText = [VectorL10n noticeRoomWithdrawByYou:displayName];
|
||||
}
|
||||
else
|
||||
{
|
||||
displayText = [VectorL10n noticeRoomWithdraw:senderDisplayName :targetDisplayName];
|
||||
// bwi #5290 federated user get additional status text
|
||||
displayText = [VectorL10n noticeRoomWithdraw:senderDisplayName :displayName];
|
||||
}
|
||||
if (event.content[@"reason"])
|
||||
{
|
||||
@@ -769,11 +776,13 @@ static NSString *const kRepliedTextPattern = @"<mx-reply>.*<blockquote>.*<br>(.*
|
||||
{
|
||||
if (isEventSenderMyUser)
|
||||
{
|
||||
displayText = [VectorL10n noticeRoomKickByYou:targetDisplayName];
|
||||
// bwi #5290 federated user get additional status text
|
||||
displayText = [VectorL10n noticeRoomKickByYou:displayName];
|
||||
}
|
||||
else
|
||||
{
|
||||
displayText = [VectorL10n noticeRoomKick:senderDisplayName :targetDisplayName];
|
||||
// bwi #5290 federated user get additional status text
|
||||
displayText = [VectorL10n noticeRoomKick:senderDisplayName :displayName];
|
||||
}
|
||||
|
||||
// add reason if exists
|
||||
@@ -786,11 +795,13 @@ static NSString *const kRepliedTextPattern = @"<mx-reply>.*<blockquote>.*<br>(.*
|
||||
{
|
||||
if (isEventSenderMyUser)
|
||||
{
|
||||
displayText = [VectorL10n noticeRoomUnbanByYou:targetDisplayName];
|
||||
// bwi #5290 federated user get additional status text
|
||||
displayText = [VectorL10n noticeRoomUnbanByYou:displayName];
|
||||
}
|
||||
else
|
||||
{
|
||||
displayText = [VectorL10n noticeRoomUnban:senderDisplayName :targetDisplayName];
|
||||
// bwi #5290 federated user get additional status text
|
||||
displayText = [VectorL10n noticeRoomUnban:senderDisplayName :displayName];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -805,11 +816,13 @@ static NSString *const kRepliedTextPattern = @"<mx-reply>.*<blockquote>.*<br>(.*
|
||||
|
||||
if (isEventSenderMyUser)
|
||||
{
|
||||
displayText = [VectorL10n noticeRoomBanByYou:targetDisplayName];
|
||||
// bwi #5290 federated user get additional status text
|
||||
displayText = [VectorL10n noticeRoomBanByYou:displayName];
|
||||
}
|
||||
else
|
||||
{
|
||||
displayText = [VectorL10n noticeRoomBan:senderDisplayName :targetDisplayName];
|
||||
// bwi #5290 federated user get additional status text
|
||||
displayText = [VectorL10n noticeRoomBan:senderDisplayName :displayName];
|
||||
}
|
||||
if (event.content[@"reason"])
|
||||
{
|
||||
@@ -2498,18 +2511,26 @@ static NSString *const kRepliedTextPattern = @"<mx-reply>.*<blockquote>.*<br>(.*
|
||||
|
||||
#pragma mark - federation
|
||||
// bwi #5290 federated user get additional status text
|
||||
- (NSString *)formattedJoinEvent:(NSString *)localizedString room:(MXRoom *)room userId:(NSString *)userId {
|
||||
- (NSString *)formattedJoinEvent:(NSString *)displayName room:(MXRoom *)room userId:(NSString *)userId {
|
||||
|
||||
if ( BWIBuildSettings.shared.isFederationEnabled && [room isRoomMemberFederated:userId]) {
|
||||
// if ( BWIBuildSettings.shared.isFederationEnabled && [room isRoomMemberFederated:userId]) {
|
||||
NSArray *memberUserIdComponents = [userId componentsSeparatedByString:@":"];
|
||||
|
||||
if (memberUserIdComponents.count == 2) {
|
||||
NSString *component = [memberUserIdComponents lastObject];
|
||||
return [localizedString stringByAppendingFormat:@" (%@)", component];
|
||||
|
||||
// remove subdomains
|
||||
NSArray *domainComponents = [userId componentsSeparatedByString:@"."];
|
||||
|
||||
if (domainComponents.count >= 2) {
|
||||
return [NSString stringWithFormat:@"%@ (%@.%@)", displayName, domainComponents[domainComponents.count-2], domainComponents[domainComponents.count-1]];
|
||||
} else {
|
||||
return [NSString stringWithFormat:@"%@ (%@)", displayName, component];
|
||||
}
|
||||
}
|
||||
}
|
||||
// }
|
||||
|
||||
return localizedString;
|
||||
return displayName;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
Reference in New Issue
Block a user