From 477f44158f229287cb30b9c95c37ec2c2f694b96 Mon Sep 17 00:00:00 2001 From: Vitor Mattos Date: Fri, 8 Apr 2022 07:37:30 -0300 Subject: [PATCH 1/2] Remove event to delete shares when user leave of room Fix integration tests Signed-off-by: Vitor Mattos --- lib/Share/RoomShareProvider.php | 22 ---------- .../features/sharing-2/hooks.feature | 40 +++++++++---------- 2 files changed, 20 insertions(+), 42 deletions(-) diff --git a/lib/Share/RoomShareProvider.php b/lib/Share/RoomShareProvider.php index 28747788440..28dbfef15f6 100644 --- a/lib/Share/RoomShareProvider.php +++ b/lib/Share/RoomShareProvider.php @@ -29,8 +29,6 @@ namespace OCA\Talk\Share; use OC\Files\Cache\Cache; -use OCA\Talk\Events\ParticipantEvent; -use OCA\Talk\Events\RemoveUserEvent; use OCA\Talk\Events\RoomEvent; use OCA\Talk\Exceptions\ParticipantNotFoundException; use OCA\Talk\Exceptions\RoomNotFoundException; @@ -106,26 +104,6 @@ public function __construct( } public static function register(IEventDispatcher $dispatcher): void { - $listener = static function (ParticipantEvent $event): void { - $room = $event->getRoom(); - - if ($event->getParticipant()->getAttendee()->getParticipantType() === Participant::USER_SELF_JOINED) { - /** @var self $roomShareProvider */ - $roomShareProvider = \OC::$server->get(self::class); - $roomShareProvider->deleteInRoom($room->getToken(), $event->getParticipant()->getAttendee()->getActorId()); - } - }; - $dispatcher->addListener(Room::EVENT_AFTER_ROOM_DISCONNECT, $listener); - - $listener = static function (RemoveUserEvent $event): void { - $room = $event->getRoom(); - - /** @var self $roomShareProvider */ - $roomShareProvider = \OC::$server->get(self::class); - $roomShareProvider->deleteInRoom($room->getToken(), $event->getUser()->getUID()); - }; - $dispatcher->addListener(Room::EVENT_AFTER_USER_REMOVE, $listener); - $listener = static function (RoomEvent $event): void { $room = $event->getRoom(); diff --git a/tests/integration/features/sharing-2/hooks.feature b/tests/integration/features/sharing-2/hooks.feature index 9bd9cbe15a6..08e490a5fa4 100644 --- a/tests/integration/features/sharing-2/hooks.feature +++ b/tests/integration/features/sharing-2/hooks.feature @@ -57,9 +57,9 @@ Feature: hooks And user "participant2" shares "welcome.txt" with room "group room" with OCS 100 When user "participant1" removes "participant2" from room "group room" with 200 (v4) Then user "participant1" gets last share - And the OCS status code should be "404" + And the OCS status code should be "100" And user "participant2" gets last share - And the OCS status code should be "404" + And the OCS status code should be "100" Scenario: remove herself from group room after sharing a file Given user "participant1" creates room "group room" (v4) @@ -69,9 +69,9 @@ Feature: hooks And user "participant2" shares "welcome.txt" with room "group room" with OCS 100 When user "participant2" removes themselves from room "group room" with 200 (v4) Then user "participant1" gets last share - And the OCS status code should be "404" + And the OCS status code should be "100" And user "participant2" gets last share - And the OCS status code should be "404" + And the OCS status code should be "100" Scenario: leave group room after sharing a file Given user "participant1" creates room "group room" (v4) @@ -145,9 +145,9 @@ Feature: hooks And user "participant2" shares "welcome.txt" with room "public room" with OCS 100 When user "participant2" leaves room "public room" with 200 (v4) Then user "participant1" gets last share - And the OCS status code should be "404" + And the OCS status code should be "100" And user "participant2" gets last share - And the OCS status code should be "404" + And the OCS status code should be "100" Scenario: remove sharer from group room with other shares after sharing a file Given user "participant1" creates room "group room" (v4) @@ -160,9 +160,9 @@ Feature: hooks And user "participant2" shares "welcome.txt" with room "group room" with OCS 100 When user "participant1" removes "participant2" from room "group room" with 200 (v4) Then user "participant1" gets last share - And the OCS status code should be "404" + And the OCS status code should be "100" And user "participant2" gets last share - And the OCS status code should be "404" + And the OCS status code should be "100" And user "participant1" gets all shares And the list of returned shares has 1 shares And share 0 is returned with @@ -191,9 +191,9 @@ Feature: hooks And user "participant3" accepts last share When user "participant1" removes "participant2" from room "group room" with 200 (v4) Then user "participant1" gets last share - And the OCS status code should be "404" + And the OCS status code should be "100" And user "participant1" gets all shares - And the list of returned shares has 0 shares + And the list of returned shares has 1 shares And user "participant2" gets last share And share is returned with | uid_owner | participant1 | @@ -209,7 +209,7 @@ Feature: hooks | share_with_displayname | participant3-displayname | | share_type | 0 | And user "participant2" gets all shares - And the list of returned shares has 0 shares + And the list of returned shares has 1 shares And user "participant3" gets last share And share is returned with | uid_owner | participant1 | @@ -455,9 +455,9 @@ Feature: hooks And user "participant2" removes "participant1" from room "group room" with 200 (v4) When user "participant2" adds user "participant1" to room "group room" with 200 (v4) Then user "participant1" gets all shares - And the list of returned shares has 0 shares + And the list of returned shares has 1 shares And user "participant2" gets all received shares - And the list of returned shares has 0 shares + And the list of returned shares has 1 shares Scenario: add sharer again to group room after sharing a file and the sharer removed herself from the room Given user "participant2" creates room "group room" (v4) @@ -468,9 +468,9 @@ Feature: hooks And user "participant1" removes themselves from room "group room" with 200 (v4) When user "participant2" adds user "participant1" to room "group room" with 200 (v4) Then user "participant1" gets all shares - And the list of returned shares has 0 shares + And the list of returned shares has 1 shares And user "participant2" gets all received shares - And the list of returned shares has 0 shares + And the list of returned shares has 1 shares Scenario: join public room again after sharing a file and the sharer left the room Given user "participant2" creates room "public room" (v4) @@ -481,9 +481,9 @@ Feature: hooks And user "participant1" leaves room "public room" with 200 (v4) When user "participant1" joins room "public room" with 200 (v4) Then user "participant1" gets all shares - And the list of returned shares has 0 shares + And the list of returned shares has 1 shares And user "participant2" gets all received shares - And the list of returned shares has 0 shares + And the list of returned shares has 1 shares @@ -498,9 +498,9 @@ Feature: hooks And user "participant1" removes "participant2" from room "group room" with 200 (v4) When user "participant1" adds user "participant2" to room "group room" with 200 (v4) Then user "participant1" gets last share - And the OCS status code should be "404" + And the OCS status code should be "100" And user "participant1" gets all shares - And the list of returned shares has 0 shares + And the list of returned shares has 1 shares And user "participant2" gets last share And share is returned with | uid_owner | participant1 | @@ -516,7 +516,7 @@ Feature: hooks | share_with_displayname | participant3-displayname | | share_type | 0 | And user "participant2" gets all shares - And the list of returned shares has 0 shares + And the list of returned shares has 1 shares And user "participant3" gets last share And share is returned with | uid_owner | participant1 | From f39321542f1ee91d314aea1ef4850f66c0fe1c0c Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Tue, 19 Apr 2022 13:16:54 +0200 Subject: [PATCH 2/2] Guests doesn't use stableX branches but another branching method Signed-off-by: Joas Schilling --- .drone.jsonnet | 2 +- .drone.yml | 54 +++++++++++++++++++++++++------------------------- 2 files changed, 28 insertions(+), 28 deletions(-) diff --git a/.drone.jsonnet b/.drone.jsonnet index 9b0730a836b..ce5bef9fcea 100644 --- a/.drone.jsonnet +++ b/.drone.jsonnet @@ -15,7 +15,7 @@ local Pipeline(test_set, database, services) = { environment: { APP_NAME: "spreed", CORE_BRANCH: "stable24", - GUESTS_BRANCH: "stable24", + GUESTS_BRANCH: "master", NOTIFICATIONS_BRANCH: "stable24", DATABASEHOST: database }, diff --git a/.drone.yml b/.drone.yml index 39c1e0bb365..2e0e8fee5f8 100644 --- a/.drone.yml +++ b/.drone.yml @@ -21,7 +21,7 @@ steps: APP_NAME: spreed CORE_BRANCH: stable24 DATABASEHOST: sqlite - GUESTS_BRANCH: stable24 + GUESTS_BRANCH: master NOTIFICATIONS_BRANCH: stable24 image: ghcr.io/nextcloud/continuous-integration-php8.0:latest name: integration-callapi @@ -54,7 +54,7 @@ steps: APP_NAME: spreed CORE_BRANCH: stable24 DATABASEHOST: sqlite - GUESTS_BRANCH: stable24 + GUESTS_BRANCH: master NOTIFICATIONS_BRANCH: stable24 image: ghcr.io/nextcloud/continuous-integration-php8.0:latest name: integration-chat @@ -87,7 +87,7 @@ steps: APP_NAME: spreed CORE_BRANCH: stable24 DATABASEHOST: sqlite - GUESTS_BRANCH: stable24 + GUESTS_BRANCH: master NOTIFICATIONS_BRANCH: stable24 image: ghcr.io/nextcloud/continuous-integration-php8.0:latest name: integration-command @@ -121,7 +121,7 @@ steps: APP_NAME: spreed CORE_BRANCH: stable24 DATABASEHOST: sqlite - GUESTS_BRANCH: stable24 + GUESTS_BRANCH: master NOTIFICATIONS_BRANCH: stable24 image: ghcr.io/nextcloud/continuous-integration-php8.0:latest name: integration-conversation @@ -155,7 +155,7 @@ steps: APP_NAME: spreed CORE_BRANCH: stable24 DATABASEHOST: sqlite - GUESTS_BRANCH: stable24 + GUESTS_BRANCH: master NOTIFICATIONS_BRANCH: stable24 image: ghcr.io/nextcloud/continuous-integration-php8.0:latest name: integration-conversation-2 @@ -188,7 +188,7 @@ steps: APP_NAME: spreed CORE_BRANCH: stable24 DATABASEHOST: sqlite - GUESTS_BRANCH: stable24 + GUESTS_BRANCH: master NOTIFICATIONS_BRANCH: stable24 image: ghcr.io/nextcloud/continuous-integration-php8.0:latest name: integration-federation @@ -221,7 +221,7 @@ steps: APP_NAME: spreed CORE_BRANCH: stable24 DATABASEHOST: sqlite - GUESTS_BRANCH: stable24 + GUESTS_BRANCH: master NOTIFICATIONS_BRANCH: stable24 image: ghcr.io/nextcloud/continuous-integration-php8.0:latest name: integration-reaction @@ -254,7 +254,7 @@ steps: APP_NAME: spreed CORE_BRANCH: stable24 DATABASEHOST: sqlite - GUESTS_BRANCH: stable24 + GUESTS_BRANCH: master NOTIFICATIONS_BRANCH: stable24 image: ghcr.io/nextcloud/continuous-integration-php8.0:latest name: integration-sharing @@ -287,7 +287,7 @@ steps: APP_NAME: spreed CORE_BRANCH: stable24 DATABASEHOST: sqlite - GUESTS_BRANCH: stable24 + GUESTS_BRANCH: master NOTIFICATIONS_BRANCH: stable24 image: ghcr.io/nextcloud/continuous-integration-php8.0:latest name: integration-sharing-2 @@ -334,7 +334,7 @@ steps: APP_NAME: spreed CORE_BRANCH: stable24 DATABASEHOST: mysql - GUESTS_BRANCH: stable24 + GUESTS_BRANCH: master NOTIFICATIONS_BRANCH: stable24 image: ghcr.io/nextcloud/continuous-integration-php8.0:latest name: integration-callapi @@ -382,7 +382,7 @@ steps: APP_NAME: spreed CORE_BRANCH: stable24 DATABASEHOST: mysql - GUESTS_BRANCH: stable24 + GUESTS_BRANCH: master NOTIFICATIONS_BRANCH: stable24 image: ghcr.io/nextcloud/continuous-integration-php8.0:latest name: integration-chat @@ -430,7 +430,7 @@ steps: APP_NAME: spreed CORE_BRANCH: stable24 DATABASEHOST: mysql - GUESTS_BRANCH: stable24 + GUESTS_BRANCH: master NOTIFICATIONS_BRANCH: stable24 image: ghcr.io/nextcloud/continuous-integration-php8.0:latest name: integration-command @@ -479,7 +479,7 @@ steps: APP_NAME: spreed CORE_BRANCH: stable24 DATABASEHOST: mysql - GUESTS_BRANCH: stable24 + GUESTS_BRANCH: master NOTIFICATIONS_BRANCH: stable24 image: ghcr.io/nextcloud/continuous-integration-php8.0:latest name: integration-conversation @@ -528,7 +528,7 @@ steps: APP_NAME: spreed CORE_BRANCH: stable24 DATABASEHOST: mysql - GUESTS_BRANCH: stable24 + GUESTS_BRANCH: master NOTIFICATIONS_BRANCH: stable24 image: ghcr.io/nextcloud/continuous-integration-php8.0:latest name: integration-conversation-2 @@ -576,7 +576,7 @@ steps: APP_NAME: spreed CORE_BRANCH: stable24 DATABASEHOST: mysql - GUESTS_BRANCH: stable24 + GUESTS_BRANCH: master NOTIFICATIONS_BRANCH: stable24 image: ghcr.io/nextcloud/continuous-integration-php8.0:latest name: integration-federation @@ -624,7 +624,7 @@ steps: APP_NAME: spreed CORE_BRANCH: stable24 DATABASEHOST: mysql - GUESTS_BRANCH: stable24 + GUESTS_BRANCH: master NOTIFICATIONS_BRANCH: stable24 image: ghcr.io/nextcloud/continuous-integration-php8.0:latest name: integration-reaction @@ -672,7 +672,7 @@ steps: APP_NAME: spreed CORE_BRANCH: stable24 DATABASEHOST: mysql - GUESTS_BRANCH: stable24 + GUESTS_BRANCH: master NOTIFICATIONS_BRANCH: stable24 image: ghcr.io/nextcloud/continuous-integration-php8.0:latest name: integration-sharing @@ -720,7 +720,7 @@ steps: APP_NAME: spreed CORE_BRANCH: stable24 DATABASEHOST: mysql - GUESTS_BRANCH: stable24 + GUESTS_BRANCH: master NOTIFICATIONS_BRANCH: stable24 image: ghcr.io/nextcloud/continuous-integration-php8.0:latest name: integration-sharing-2 @@ -763,7 +763,7 @@ steps: APP_NAME: spreed CORE_BRANCH: stable24 DATABASEHOST: pgsql - GUESTS_BRANCH: stable24 + GUESTS_BRANCH: master NOTIFICATIONS_BRANCH: stable24 image: ghcr.io/nextcloud/continuous-integration-php8.0:latest name: integration-callapi @@ -805,7 +805,7 @@ steps: APP_NAME: spreed CORE_BRANCH: stable24 DATABASEHOST: pgsql - GUESTS_BRANCH: stable24 + GUESTS_BRANCH: master NOTIFICATIONS_BRANCH: stable24 image: ghcr.io/nextcloud/continuous-integration-php8.0:latest name: integration-chat @@ -847,7 +847,7 @@ steps: APP_NAME: spreed CORE_BRANCH: stable24 DATABASEHOST: pgsql - GUESTS_BRANCH: stable24 + GUESTS_BRANCH: master NOTIFICATIONS_BRANCH: stable24 image: ghcr.io/nextcloud/continuous-integration-php8.0:latest name: integration-command @@ -890,7 +890,7 @@ steps: APP_NAME: spreed CORE_BRANCH: stable24 DATABASEHOST: pgsql - GUESTS_BRANCH: stable24 + GUESTS_BRANCH: master NOTIFICATIONS_BRANCH: stable24 image: ghcr.io/nextcloud/continuous-integration-php8.0:latest name: integration-conversation @@ -933,7 +933,7 @@ steps: APP_NAME: spreed CORE_BRANCH: stable24 DATABASEHOST: pgsql - GUESTS_BRANCH: stable24 + GUESTS_BRANCH: master NOTIFICATIONS_BRANCH: stable24 image: ghcr.io/nextcloud/continuous-integration-php8.0:latest name: integration-conversation-2 @@ -975,7 +975,7 @@ steps: APP_NAME: spreed CORE_BRANCH: stable24 DATABASEHOST: pgsql - GUESTS_BRANCH: stable24 + GUESTS_BRANCH: master NOTIFICATIONS_BRANCH: stable24 image: ghcr.io/nextcloud/continuous-integration-php8.0:latest name: integration-federation @@ -1017,7 +1017,7 @@ steps: APP_NAME: spreed CORE_BRANCH: stable24 DATABASEHOST: pgsql - GUESTS_BRANCH: stable24 + GUESTS_BRANCH: master NOTIFICATIONS_BRANCH: stable24 image: ghcr.io/nextcloud/continuous-integration-php8.0:latest name: integration-reaction @@ -1059,7 +1059,7 @@ steps: APP_NAME: spreed CORE_BRANCH: stable24 DATABASEHOST: pgsql - GUESTS_BRANCH: stable24 + GUESTS_BRANCH: master NOTIFICATIONS_BRANCH: stable24 image: ghcr.io/nextcloud/continuous-integration-php8.0:latest name: integration-sharing @@ -1101,7 +1101,7 @@ steps: APP_NAME: spreed CORE_BRANCH: stable24 DATABASEHOST: pgsql - GUESTS_BRANCH: stable24 + GUESTS_BRANCH: master NOTIFICATIONS_BRANCH: stable24 image: ghcr.io/nextcloud/continuous-integration-php8.0:latest name: integration-sharing-2