From bb634975957095ea1beeb6a9a085ccb02f0fa453 Mon Sep 17 00:00:00 2001 From: Julien Veyssier Date: Thu, 12 Sep 2024 14:50:42 +0200 Subject: [PATCH] attempt to fix tests Signed-off-by: Julien Veyssier --- .github/workflows/integration-test.yml | 13 ++++++++----- lib/Controller/ConfigController.php | 3 +++ src/components/PersonalSettings.vue | 2 ++ 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index 59d6d1a..b6cd463 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -32,7 +32,7 @@ jobs: fail-fast: false matrix: php-versions: [ '8.1' ] - server-versions: [ 'master', 'stable29', 'stable28' ] + server-versions: [ 'stable30', 'stable29', 'stable28' ] name: Integration test @@ -42,7 +42,7 @@ jobs: with: path: server repository: nextcloud/server - ref: + ref: ${{ matrix.server-versions }} - name: Checkout app uses: actions/checkout@v3 @@ -81,6 +81,8 @@ jobs: working-directory: server/ env: DROPBOX_CONFIG: ${{ secrets.DROPBOX_CONFIG }} + OAUTH_CLIENT_ID: ${{ secrets.OAUTH_CLIENT_ID }} + OAUTH_CLIENT_SECRET: ${{ secrets.OAUTH_CLIENT_SECRET }} run: | echo $DROPBOX_CONFIG > config.json sudo apt install jq sqlite3 @@ -88,12 +90,14 @@ jobs: sqlite3 data/owncloud.db "INSERT INTO oc_preferences ( userid, appid, configkey, configvalue) VALUES ('admin', 'integration_dropbox', 'token', $(cat config.json | jq '.config.token'));" sqlite3 data/owncloud.db "INSERT INTO oc_preferences ( userid, appid, configkey, configvalue) VALUES ('admin', 'integration_dropbox', 'refresh_token', $(cat config.json | jq '.config.refresh_token'));" sqlite3 data/owncloud.db "INSERT INTO oc_preferences ( userid, appid, configkey, configvalue) VALUES ('admin', 'integration_dropbox', 'importing_dropbox', '1');" + sqlite3 data/owncloud.db "INSERT INTO oc_appconfig ( appid, configkey, configvalue) VALUES ('integration_dropbox', 'client_id', '$OAUTH_CLIENT_ID');" + sqlite3 data/owncloud.db "INSERT INTO oc_appconfig ( appid, configkey, configvalue) VALUES ('integration_dropbox', 'client_secret', '$OAUTH_CLIENT_SECRET');" - name: Run import working-directory: server/ run: | php occ integration_dropbox:start-import admin - for run in {1..10}; do php cron.php; done + for run in {1..10}; do php cron.php; sleep 5; done - name: Check import result working-directory: server/ @@ -108,10 +112,9 @@ jobs: EOM diff result.expected.txt result.txt cat > du-sh.expected.txt <<- EOM - 1.5G data/admin/files/Dropbox import/ + 1.6G data/admin/files/Dropbox import/ EOM du -sh data/admin/files/Dropbox\ import/ | diff du-sh.expected.txt - - - name: Show log on failure working-directory: server/ diff --git a/lib/Controller/ConfigController.php b/lib/Controller/ConfigController.php index 9a96904..b62bf6b 100644 --- a/lib/Controller/ConfigController.php +++ b/lib/Controller/ConfigController.php @@ -123,6 +123,9 @@ public function submitAccessCode(string $code = ''): DataResponse { if (isset($result['email'])) { $this->config->setUserValue($this->userId, Application::APP_ID, 'email', $result['email']); $data['email'] = $result['email']; + } elseif (isset($info['email'])) { + $this->config->setUserValue($this->userId, Application::APP_ID, 'email', $info['email']); + $data['email'] = $info['email']; } if (isset($info['name'], $info['name']['display_name'])) { $this->config->setUserValue($this->userId, Application::APP_ID, 'user_name', $info['name']['display_name']); diff --git a/src/components/PersonalSettings.vue b/src/components/PersonalSettings.vue index 4218a4f..ff02cdf 100644 --- a/src/components/PersonalSettings.vue +++ b/src/components/PersonalSettings.vue @@ -205,6 +205,8 @@ export default { methods: { onLogoutClick() { this.state.user_name = '' + this.state.email = null + this.state.account_id = null this.saveOptions({ user_name: this.state.user_name }) }, onAccessCodeInput() {