Skip to content

Conversation

@Florian14
Copy link
Contributor

@Florian14 Florian14 commented Jan 5, 2023

Type of change

  • Feature
  • Bugfix
  • Technical
  • Other :

Content

Sometimes, Voice Broadcasts were shown as live in the room list by error due to redaction on state events.
In this PR, the most recent state event is taken like in the room timeline to display the correct voice broadcast state. Event redactions are correctly handled.

Motivation and context

Fix #7832

Screenshots / GIFs

Tests

  • Start a live voice broadcast
  • Pause and Resume the broadcast
  • Delete the voice broadcast

Tested devices

  • Physical
  • Emulator
  • OS version(s):

Checklist

@ElementBot
Copy link

Warnings
⚠️

Please add a changelog. See instructions here

Generated by 🚫 dangerJS against 9ca6a44

@Florian14 Florian14 marked this pull request as ready for review January 6, 2023 13:59
@Florian14 Florian14 force-pushed the bugfix/fre/unexpected_live_vb_room_list branch from c1f2573 to fb7388d Compare January 6, 2023 14:01
@ElementBot
Copy link

Warnings
⚠️ Please add a reviewer to your PR.

Generated by 🚫 dangerJS against fb7388d

1 similar comment
@ElementBot
Copy link

Warnings
⚠️ Please add a reviewer to your PR.

Generated by 🚫 dangerJS against fb7388d

@Florian14 Florian14 force-pushed the bugfix/fre/unexpected_live_vb_room_list branch from fb7388d to 21ca7c2 Compare January 9, 2023 08:14
@Florian14 Florian14 requested review from a team and mnaturel and removed request for a team January 9, 2023 08:14
Copy link
Contributor

@mnaturel mnaturel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have added comments about small improvements in code that could be done.

When testing with web, I achieved to reproduce the issue but I don't know if it is normal/expected. Here is how I reproduced:

  • Go into the room list in Android.
  • From web, start a live broadcast in a room.
  • In Android, see the indicator for the room.
  • In Web, pause and resume the live.
  • In Web move the floating window of the live to be able to reach the option menu for the live broacast message in the timeline.
  • From the context menu, remove the corresponding message.
  • In Android, it says a broadcast is live even if it has been deleted.

// Given
val aVoiceBroadcast = VoiceBroadcast(A_VOICE_BROADCAST_ID, A_ROOM_ID)
val aListOfTimelineEvents = listOf<TimelineEvent>(
mockk(relaxed = true) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we could introduce a private method like givenAVoiceBroadcastEvent(eventId: String, isRedacted: Boolean, timestamp: Long) to be reused accross tests. It will make the tests faster to read.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done 493fa7a

class FakeRoom(
private val fakeLocationSharingService: FakeLocationSharingService = FakeLocationSharingService(),
private val fakeSendService: FakeSendService = FakeSendService(),
private val fakeTimelineService: FakeTimelineService = FakeTimelineService(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Normally there is no need to make the fakes public. You could mock the call in your tests without using the "fake" components like this:

fakeSession.roomService()
                .getRoom(A_ROOM_ID)
                .timelineService()
                .getTimelineEventsRelatedTo(any(), any())

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed 2df9480

@giomfo giomfo added the A-Voice Broadcast Broadcast-style voice messages label Jan 10, 2023
@Florian14 Florian14 force-pushed the bugfix/fre/unexpected_live_vb_room_list branch from 21ca7c2 to 6b60b0a Compare January 11, 2023 16:32
@ElementBot
Copy link

Warnings
⚠️ Please add a reviewer to your PR.

Generated by 🚫 dangerJS against 6b60b0a

@ElementBot
Copy link

Fails
🚫

vector/src/test/java/im/vector/app/features/voicebroadcast/usecase/GetVoiceBroadcastStateEventUseCaseTest.kt#L127 - Needless blank line(s)

Generated by 🚫 dangerJS against 6b60b0a

@Florian14
Copy link
Contributor Author

I have added comments about small improvements in code that could be done.

When testing with web, I achieved to reproduce the issue but I don't know if it is normal/expected. Here is how I reproduced:

* Go into the room list in Android.

* From web, start a live broadcast in a room.

* In Android, see the indicator for the room.

* In Web, pause and resume the live.

* In Web move the floating window of the live to be able to reach the option menu for the live broacast message in the timeline.

* From the context menu, remove the corresponding message.

* In Android, it says a broadcast is live even if it has been deleted.

@mnaturel Thanks for your good test, I mainly fixed your issue but it will be totally fixed when implementing the MSC3912 because when you delete the started event, the related events are not redacted for the moment.

In your test, the latest event in the room summary is the resume event, when you delete the tile, only the started event is redacted, it does not update the room summary and does not refresh the room list. What I did is relying on the started event instead, it does not trigger a refresh of the room list but if you restart the app or if there is another change in the room summary, the room list will be refreshed and the event will be correctly shown as redacted. Also, if there are some messages after the voice broadcast state events, there is no issue because the latest event is not the voice broadcast.

@Florian14 Florian14 force-pushed the bugfix/fre/unexpected_live_vb_room_list branch from 6b60b0a to f62f661 Compare January 11, 2023 16:56
@ElementBot
Copy link

Warnings
⚠️ Please add a reviewer to your PR.

Generated by 🚫 dangerJS against f62f661

@sonarqubecloud
Copy link

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

71.7% 71.7% Coverage
0.0% 0.0% Duplication

Copy link
Contributor

@mnaturel mnaturel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the updates and the explanation. LGTM!

@Florian14 Florian14 merged commit b1d2581 into develop Jan 12, 2023
@Florian14 Florian14 deleted the bugfix/fre/unexpected_live_vb_room_list branch January 12, 2023 09:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Voice Broadcast Broadcast-style voice messages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unexpected live voice broadcast

5 participants