diff --git a/src/app/commoncomponents/CallMessageDelegate.qml b/src/app/commoncomponents/CallMessageDelegate.qml index 79dbb0c01bab306d9b5da31f43d436551fe21264..f60c1af23f5edf0e871f9dcb6c68d1e25cec3ff7 100644 --- a/src/app/commoncomponents/CallMessageDelegate.qml +++ b/src/app/commoncomponents/CallMessageDelegate.qml @@ -26,8 +26,10 @@ import net.jami.Constants 1.1 SBSMessageBase { id: root + property var confId: ConfId + property var currentCallId: CurrentCall.id component JoinCallButton: MaterialButton { - visible: root.isActive + visible: root.isActive && root.currentCallId !== root.confId toolTipText: JamiStrings.joinCall color: JamiTheme.blackColor background.opacity: hovered ? 0.2 : 0.1 @@ -56,7 +58,7 @@ SBSMessageBase { enabled: root.isActive function onActiveCallsChanged() { - root.isActive = LRCInstance.indexOfActiveCall(ConfId, ActionUri, DeviceId) !== -1; + root.isActive = LRCInstance.indexOfActiveCall(root.confId, ActionUri, DeviceId) !== -1; if (root.isActive) { bubble.mask.border.color = CurrentConversation.color; bubble.mask.border.width = 1.5; @@ -65,8 +67,8 @@ SBSMessageBase { } } - property bool isActive: LRCInstance.indexOfActiveCall(ConfId, ActionUri, DeviceId) !== -1 - visible: isActive || ConfId === "" || Duration > 0 + property bool isActive: LRCInstance.indexOfActiveCall(root.confId, ActionUri, DeviceId) !== -1 + visible: isActive || root.confId === "" || Duration > 0 property var baseColor: JamiTheme.messageInBgColor @@ -113,12 +115,13 @@ SBSMessageBase { TextEdit { id: callLabel + objectName: "callLabel" topPadding: 8 bottomPadding: 8 Layout.fillWidth: true - Layout.rightMargin: root.isActive ? 0 : root.timeWidth + 16 + Layout.rightMargin: root.isActive && root.currentCallId !== root.confId ? 0 : root.timeWidth + 16 Layout.leftMargin: root.isActive ? 10 : -5 /* spacing is 10 and we want 5px with icon */ text: { @@ -139,20 +142,22 @@ SBSMessageBase { JoinCallButton { id: joinCallInAudio + objectName: "joinCallInAudio" Layout.topMargin: 4 Layout.bottomMargin: 4 text: JamiStrings.joinInAudio - onClicked: MessagesAdapter.joinCall(ActionUri, DeviceId, ConfId, true) + onClicked: MessagesAdapter.joinCall(ActionUri, DeviceId, root.confId, true) } JoinCallButton { id: joinCallInVideo + objectName: "joinCallInVideo" text: JamiStrings.joinInVideo Layout.topMargin: 4 Layout.bottomMargin: 4 - onClicked: MessagesAdapter.joinCall(ActionUri, DeviceId, ConfId) + onClicked: MessagesAdapter.joinCall(ActionUri, DeviceId, root.confId) Layout.rightMargin: 4 } } @@ -165,7 +170,7 @@ SBSMessageBase { } } Component.onCompleted: { - bubble.timestampItem.visible = !root.isActive; + bubble.timestampItem.visible = !root.isActive || root.currentCallId === root.confId; opacity = 1; } } diff --git a/tests/qml/src/tst_CallMessageDelegate.qml b/tests/qml/src/tst_CallMessageDelegate.qml index a7b022b75d5958a1aa80f5a4e21fa2c453142998..e7caacda50f755a94a4610ad4d2f1eb8646ee6c7 100644 --- a/tests/qml/src/tst_CallMessageDelegate.qml +++ b/tests/qml/src/tst_CallMessageDelegate.qml @@ -43,5 +43,24 @@ TestWrapper { compare(replyButton.visible, false) } } + + TestCase { + name: "Check button visibility for swarm call" + function test_checkOptionButtonsVisibility() { + uut.isActive = true + uut.currentCallId = "foo" + uut.confId = "foo" + var callLabel = findChild(uut, "callLabel") + var joinCallInAudio = findChild(uut, "joinCallInAudio") + var joinCallInVideo = findChild(uut, "joinCallInVideo") + compare(callLabel.visible, true) + compare(joinCallInAudio.visible, false) + compare(joinCallInVideo.visible, false) + uut.confId = "bar" + compare(callLabel.visible, true) + compare(joinCallInAudio.visible, true) + compare(joinCallInVideo.visible, true) + } + } } }