Skip to content

Commit

Permalink
TW-1312: Hide event state join room from room creator
Browse files Browse the repository at this point in the history
  • Loading branch information
nqhhdev authored and hoangdat committed Jan 12, 2024
1 parent c4013ef commit cbb26c6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/pages/chat/events/message/message.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import 'package:fluffychat/pages/chat/events/verification_request_content.dart';
import 'package:fluffychat/pages/chat/sticky_timstamp_widget.dart';
import 'package:fluffychat/utils/date_time_extension.dart';
import 'package:fluffychat/utils/matrix_sdk_extensions/event_extension.dart';
import 'package:fluffychat/utils/matrix_sdk_extensions/filtered_timeline_extension.dart';
import 'package:fluffychat/utils/responsive/responsive_utils.dart';
import 'package:fluffychat/widgets/avatar/avatar.dart';
import 'package:fluffychat/widgets/swipeable.dart';
Expand Down Expand Up @@ -90,6 +91,9 @@ class Message extends StatelessWidget {
if (event.type.startsWith('m.call.')) {
return const SizedBox();
}
if (event.isJoinedByRoomCreator()) {
return const SizedBox();
}
return StateMessage(event);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,4 +93,11 @@ extension IsStateExtension on Event {
bool isActivateEndToEndEncryption() {
return type == EventTypes.Encryption;
}

bool isJoinedByRoomCreator() {
return type == EventTypes.RoomMember &&
content['membership'] == 'join' &&
stateKey == senderId &&
senderId == room.getState(EventTypes.RoomCreate)?.senderId;
}
}

0 comments on commit cbb26c6

Please sign in to comment.