diff --git a/.github/workflows/artifacts.yml b/.github/workflows/artifacts.yml index 44b59b7548..a05b348972 100644 --- a/.github/workflows/artifacts.yml +++ b/.github/workflows/artifacts.yml @@ -4,15 +4,12 @@ on: workflows: ["Mattermost Build"] types: - completed + jobs: upload-s3: name: cd/Upload artifacts to S3 runs-on: ubuntu-22.04 - env: - REPO_NAME: ${{ github.event.repository.name }} - if: > - github.event.workflow_run.event == 'pull_request' && - github.event.workflow_run.conclusion == 'success' + if: github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success' steps: - name: cd/Configure AWS uses: aws-actions/configure-aws-credentials@07c2f971bac433df982ccc261983ae443861db49 # v1-node16 @@ -28,89 +25,50 @@ jobs: workflow_conclusion: success name: server-dist-artifact path: server/dist - # Get Branch name from calling workflow - # Search for the string "pull" and replace it with "PR" in branch-name - - name: cd/Get branch name - run: echo "BRANCH_NAME=$(echo ${{ github.event.workflow_run.head_branch }} | sed 's/^pull\//PR-/g')" >> $GITHUB_ENV - name: cd/Upload artifacts to S3 + env: + REPO_NAME: ${{ github.event.repository.name }} + COMMIT_SHA: ${{ github.event.workflow_run.head_sha }} run: | - aws s3 cp server/dist/ s3://pr-builds.mattermost.com/$REPO_NAME/$BRANCH_NAME/ --acl public-read --cache-control "no-cache" --recursive --no-progress - aws s3 cp server/dist/ s3://pr-builds.mattermost.com/$REPO_NAME/commit/${{ github.sha }}/ --acl public-read --cache-control "no-cache" --recursive --no-progress + aws s3 cp server/dist/ s3://pr-builds.mattermost.com/$REPO_NAME/commit/$COMMIT_SHA/ --acl public-read --cache-control "no-cache" --recursive --no-progress + build-docker: name: cd/Build and push docker image needs: upload-s3 - env: - REPO_NAME: ${{ github.event.repository.name }} runs-on: ubuntu-22.04 - if: > - github.event.workflow_run.event == 'pull_request' && - github.event.workflow_run.conclusion == 'success' + if: github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success' steps: - - name: cd/Login to Docker Hub - uses: docker/login-action@3da7dc6e2b31f99ef2cb9fb4c50fb0971e0d0139 # v2.1.0 - with: - username: ${{ secrets.DOCKERHUB_DEV_USERNAME }} - password: ${{ secrets.DOCKERHUB_DEV_TOKEN }} - - name: cd/Download artifacts - uses: dawidd6/action-download-artifact@0c49384d39ceb023b8040f480a25596fd6cf441b # v2.26.0 - with: - workflow: ${{ github.event.workflow_run.workflow_id }} - run_id: ${{ github.event.workflow_run.id }} - workflow_conclusion: success - name: server-build-artifact - path: server/build/ - - name: cd/Setup Docker Buildx - uses: docker/setup-buildx-action@11e8a2e2910826a92412015c515187a2d6750279 # v2.4 - - name: cd/Docker build and push - env: - DOCKER_CLI_EXPERIMENTAL: enabled - run: | - export TAG=$(echo "${{ github.event.pull_request.head.sha || github.sha }}" | cut -c1-7) - cd server/build - export DOCKER_CLI_EXPERIMENTAL=enabled - export MM_PACKAGE=https://pr-builds.mattermost.com/$REPO_NAME/commit/${{ github.sha }}/mattermost-team-linux-amd64.tar.gz - docker buildx build --push --build-arg MM_PACKAGE=$MM_PACKAGE -t mattermostdevelopment/mm-te-test:${TAG} . - # Temporary uploading also to mattermost/mm-te-test:${TAG} except mattermostdevelopment/mm-te-test:${TAG} - # Context: https://community.mattermost.com/private-core/pl/3jzzxzfiji8hx833ewyuthzkjh - build-docker-temp: - name: cd/Build and push docker image - needs: upload-s3 - env: - REPO_NAME: ${{ github.event.repository.name }} - runs-on: ubuntu-22.04 - if: > - github.event.workflow_run.event == 'pull_request' && - github.event.workflow_run.conclusion == 'success' - steps: - - name: cd/Login to Docker Hub - uses: docker/login-action@3da7dc6e2b31f99ef2cb9fb4c50fb0971e0d0139 # v2.1.0 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - name: cd/Download artifacts - uses: dawidd6/action-download-artifact@0c49384d39ceb023b8040f480a25596fd6cf441b # v2.26.0 - with: - workflow: ${{ github.event.workflow_run.workflow_id }} - run_id: ${{ github.event.workflow_run.id }} - workflow_conclusion: success - name: server-build-artifact - path: server/build/ - - name: cd/Setup Docker Buildx - uses: docker/setup-buildx-action@11e8a2e2910826a92412015c515187a2d6750279 # v2.4 - - name: cd/Docker build and push - env: - DOCKER_CLI_EXPERIMENTAL: enabled - run: | - export TAG=$(echo "${{ github.event.pull_request.head.sha || github.sha }}" | cut -c1-7) - cd server/build - export DOCKER_CLI_EXPERIMENTAL=enabled - export MM_PACKAGE=https://pr-builds.mattermost.com/$REPO_NAME/commit/${{ github.sha }}/mattermost-team-linux-amd64.tar.gz - docker buildx build --push --build-arg MM_PACKAGE=$MM_PACKAGE -t mattermost/mm-te-test:${TAG} . + - name: cd/Login to Docker Hub + uses: docker/login-action@3da7dc6e2b31f99ef2cb9fb4c50fb0971e0d0139 # v2.1.0 + with: + username: ${{ secrets.DOCKERHUB_DEV_USERNAME }} + password: ${{ secrets.DOCKERHUB_DEV_TOKEN }} + - name: cd/Download artifacts + uses: dawidd6/action-download-artifact@0c49384d39ceb023b8040f480a25596fd6cf441b # v2.26.0 + with: + workflow: ${{ github.event.workflow_run.workflow_id }} + run_id: ${{ github.event.workflow_run.id }} + workflow_conclusion: success + name: server-build-artifact + path: server/build/ + - name: cd/Setup Docker Buildx + uses: docker/setup-buildx-action@11e8a2e2910826a92412015c515187a2d6750279 # v2.4 + - name: cd/Docker build and push + env: + DOCKER_CLI_EXPERIMENTAL: enabled + REPO_NAME: ${{ github.event.repository.name }} + COMMIT_SHA: ${{ github.event.workflow_run.head_sha }} + run: | + export TAG=$(echo "${{ github.event.pull_request.head.sha || github.event.workflow_run.head_sha }}" | cut -c1-7) + cd server/build + export DOCKER_CLI_EXPERIMENTAL=enabled + export MM_PACKAGE=https://pr-builds.mattermost.com/$REPO_NAME/commit/$COMMIT_SHA/mattermost-team-linux-amd64.tar.gz + docker buildx build --push --build-arg MM_PACKAGE=$MM_PACKAGE -t mattermostdevelopment/mm-te-test:${TAG} . + sentry: name: Send build info to sentry if: > - github.event.workflow_run.event == 'pull_request' && - github.event.workflow_run.conclusion == 'success' + github.event.workflow_run.event == 'push' runs-on: ubuntu-22.04 env: SENTRY_AUTH_TOKEN: ${{ secrets.MM_SERVER_SENTRY_AUTH_TOKEN }} diff --git a/.github/workflows/channels-ci.yml b/.github/workflows/channels-ci.yml index d6a1a6258c..f89ee722a9 100644 --- a/.github/workflows/channels-ci.yml +++ b/.github/workflows/channels-ci.yml @@ -7,7 +7,7 @@ on: - mono-repo* concurrency: group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: ${{ !contains( github.ref , 'heads/ref/master') }} + cancel-in-progress: ${{ github.ref != 'refs/heads/master' }} defaults: run: shell: bash @@ -83,6 +83,16 @@ jobs: npm run mmjstool -- i18n clean-empty --webapp-dir ./src --mobile-dir /tmp/fake-mobile-dir --check npm run mmjstool -- i18n check-empty-src --webapp-dir ./src --mobile-dir /tmp/fake-mobile-dir rm -rf tmp + - name: ci/lint-boards + working-directory: webapp/boards + run: | + npm run i18n-extract + git --no-pager diff --exit-code i18n/en.json || (echo "Please run \"cd webapp/boards && npm run i18n-extract\" and commit the changes in webapp/boards/i18n/en.json." && exit 1) + - name: ci/lint-playbooks + working-directory: webapp/playbooks + run: | + npm run i18n-extract + git --no-pager diff --exit-code i18n/en.json || (echo "Please run \"cd webapp/playbooks && npm run i18n-extract\" and commit the changes in webapp/playbooks/i18n/en.json." && exit 1) check-types: runs-on: ubuntu-22.04 defaults: diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 24ec4e83a1..8197f9a20f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,7 +11,7 @@ env: go-version: "1.19.5" concurrency: group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: ${{ !contains( github.ref , 'heads/ref/master') }} + cancel-in-progress: ${{ github.ref != 'refs/heads/master' }} jobs: check-mocks: name: Check mocks @@ -26,6 +26,7 @@ jobs: uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0 with: go-version: ${{ env.go-version }} + cache-dependency-path: server/go.sum - name: Generate mocks run: make mocks - name: Check mocks @@ -43,6 +44,7 @@ jobs: uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0 with: go-version: ${{ env.go-version }} + cache-dependency-path: server/go.sum - name: Run go mod tidy run: make modules-tidy - name: Check modules @@ -60,13 +62,14 @@ jobs: uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0 with: go-version: ${{ env.go-version }} + cache-dependency-path: server/go.sum - name: Run make-gen-serialized run: make gen-serialized - name: Check serialized run: if [[ -n $(git status --porcelain) ]]; then echo "Please update the serialized files using 'make gen-serialized'"; exit 1; fi check-mattermost-vet: name: Check style - runs-on: ubuntu-latest-8-cores + runs-on: ubuntu-22.04 defaults: run: working-directory: server @@ -77,6 +80,7 @@ jobs: uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0 with: go-version: ${{ env.go-version }} + cache-dependency-path: server/go.sum - name: Reset config run: make config-reset - name: Run plugin-checker @@ -106,6 +110,7 @@ jobs: uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0 with: go-version: ${{ env.go-version }} + cache-dependency-path: server/go.sum - name: Checkout mattermost-api-reference run: | cd .. @@ -128,6 +133,7 @@ jobs: uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0 with: go-version: ${{ env.go-version }} + cache-dependency-path: server/go.sum - name: Generate work templates run: make generate-worktemplates - name: Check generated work templates @@ -160,6 +166,7 @@ jobs: uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0 with: go-version: ${{ env.go-version }} + cache-dependency-path: server/go.sum - name: Generate store layers run: make store-layers - name: Check generated code @@ -177,6 +184,7 @@ jobs: uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0 with: go-version: ${{ env.go-version }} + cache-dependency-path: server/go.sum - name: Generate app layers run: make app-layers - name: Check generated code @@ -216,6 +224,7 @@ jobs: uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0 with: go-version: ${{ env.go-version }} + cache-dependency-path: server/go.sum - name: Build run: | make config-reset diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index a554f95b31..597302f900 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -2,7 +2,7 @@ name: "CodeQL" concurrency: group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: ${{ !contains( github.ref , 'heads/ref/master') }} + cancel-in-progress: ${{ github.ref != 'refs/heads/master' }} on: pull_request: diff --git a/.github/workflows/e2e-tests-ci.yml b/.github/workflows/e2e-tests-ci.yml index d620d69555..89c7cbfeed 100644 --- a/.github/workflows/e2e-tests-ci.yml +++ b/.github/workflows/e2e-tests-ci.yml @@ -7,7 +7,7 @@ on: - mono-repo* concurrency: group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: ${{ !contains( github.ref , 'heads/ref/master') }} + cancel-in-progress: ${{ github.ref != 'refs/heads/master' }} defaults: run: shell: bash diff --git a/.github/workflows/esrupgrade-common.yml b/.github/workflows/esrupgrade-common.yml new file mode 100644 index 0000000000..b0cac7d6d2 --- /dev/null +++ b/.github/workflows/esrupgrade-common.yml @@ -0,0 +1,159 @@ +name: ESR Upgrade +on: + workflow_call: + inputs: + db-dump-url: + required: true + type: string + initial-version: + required: true + type: string + final-version: + required: true + type: string +env: + COMPOSE_PROJECT_NAME: ghactions + BUILD_IMAGE: mattermost/mattermost-enterprise-edition:${{ inputs.final-version }} + MYSQL_CONN_ARGS: -h localhost -P 3306 --protocol=tcp -ummuser -pmostest mattermost_test + DUMP_SERVER_NAME: esr.${{ inputs.initial-version }}-${{ inputs.final-version }}.dump.server.sql + DUMP_SCRIPT_NAME: esr.${{ inputs.initial-version }}-${{ inputs.final-version }}.dump.script.sql + MIGRATION_SCRIPT: esr.${{ inputs.initial-version }}-${{ inputs.final-version }}.mysql.up.sql + CLEANUP_SCRIPT: esr.${{ inputs.initial-version }}-${{ inputs.final-version }}.mysql.cleanup.sql + PREPROCESS_SCRIPT: esr.common.mysql.preprocess.sql + DIFF_NAME: esr.${{ inputs.initial-version }}-${{ inputs.final-version }}.diff +jobs: + esr-upgrade-server: + runs-on: ubuntu-latest-8-cores + timeout-minutes: 30 + steps: + - name: Checkout mattermost-server + uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0 + - name: Run docker compose + run: | + cd server/build + docker-compose --no-ansi run --rm start_dependencies + cat ../tests/test-data.ldif | docker-compose --no-ansi exec -T openldap bash -c 'ldapadd -x -D "cn=admin,dc=mm,dc=test,dc=com" -w mostest'; + docker-compose --no-ansi exec -T minio sh -c 'mkdir -p /data/mattermost-test'; + docker-compose --no-ansi ps + - name: Wait for docker compose + run: | + until docker network inspect ghactions_mm-test; do echo "Waiting for Docker Compose Network..."; sleep 1; done; + docker run --net ghactions_mm-test appropriate/curl:latest sh -c "until curl --max-time 5 --output - http://mysql:3306; do echo waiting for mysql; sleep 5; done;" + docker run --net ghactions_mm-test appropriate/curl:latest sh -c "until curl --max-time 5 --output - http://elasticsearch:9200; do echo waiting for elasticsearch; sleep 5; done;" + - name: Initialize the database with the source DB dump + run: | + curl ${{ inputs.db-dump-url }} | zcat | docker exec -i ghactions_mysql_1 mysql -AN $MYSQL_CONN_ARGS + - name: Common preprocessing of the DB dump + run: | + cd server/scripts/esrupgrades + docker exec -i ghactions_mysql_1 mysql -AN $MYSQL_CONN_ARGS < $PREPROCESS_SCRIPT + - name: Pull EE image + run: | + docker pull $BUILD_IMAGE + - name: Run migration through server + run: | + mkdir -p client/plugins + cd server/build + # Run the server in the background to trigger the migrations + docker run --name mmserver \ + --net ghactions_mm-test \ + --ulimit nofile=8096:8096 \ + --env-file=dotenv/test.env \ + --env MM_SQLSETTINGS_DRIVERNAME="mysql" \ + --env MM_SQLSETTINGS_DATASOURCE="mmuser:mostest@tcp(mysql:3306)/mattermost_test?charset=utf8mb4,utf8&multiStatements=true" \ + -v ~/work/mattermost-server:/mattermost-server \ + -w /mattermost-server/mattermost-server \ + $BUILD_IMAGE & + # In parallel, wait for the migrations to finish. + # To verify this, we check that the server has finished the startup job through the log line "Server is listening on" + until docker logs mmserver | grep "Server is listening on"; do\ + echo "Waiting for migrations to finish..."; \ + sleep 1; \ + done; + # Make sure to stop the server. Also, redirect output to null; + # otherwise, the name of the container gets written to the console, which is weird + docker stop mmserver > /dev/null + - name: Cleanup DB + run : | + cd server/scripts/esrupgrades + docker exec -i ghactions_mysql_1 mysql -AN $MYSQL_CONN_ARGS < $CLEANUP_SCRIPT + - name: Dump upgraded database + run: | + # Use --skip-opt to have each INSERT into one line. + # Use --set-gtid-purged=OFF to suppress GTID-related statements. + docker exec -i ghactions_mysql_1 mysqldump \ + --skip-opt --set-gtid-purged=OFF \ + $MYSQL_CONN_ARGS > $DUMP_SERVER_NAME + - name: Cleanup dump and compress + run: | + # We skip the very last line, which simply contains the date of the dump + head -n -1 ${DUMP_SERVER_NAME} | gzip > ${DUMP_SERVER_NAME}.gz + - name: Upload dump + uses: actions/upload-artifact@v3 + with: + name: upgraded-dump-server + path: ${{ env.DUMP_SERVER_NAME }}.gz + esr-upgrade-script: + runs-on: ubuntu-latest-8-cores + timeout-minutes: 30 + steps: + - name: Checkout mattermost-server + uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0 + - name: Run docker compose + run: | + cd server/build + docker-compose --no-ansi run --rm start_dependencies + cat ../tests/test-data.ldif | docker-compose --no-ansi exec -T openldap bash -c 'ldapadd -x -D "cn=admin,dc=mm,dc=test,dc=com" -w mostest'; + docker-compose --no-ansi exec -T minio sh -c 'mkdir -p /data/mattermost-test'; + docker-compose --no-ansi ps + - name: Wait for docker compose + run: | + until docker network inspect ghactions_mm-test; do echo "Waiting for Docker Compose Network..."; sleep 1; done; + docker run --net ghactions_mm-test appropriate/curl:latest sh -c "until curl --max-time 5 --output - http://mysql:3306; do echo waiting for mysql; sleep 5; done;" + docker run --net ghactions_mm-test appropriate/curl:latest sh -c "until curl --max-time 5 --output - http://elasticsearch:9200; do echo waiting for elasticsearch; sleep 5; done;" + - name: Initialize the database with the source DB dump + run: | + curl ${{ inputs.db-dump-url }} | zcat | docker exec -i ghactions_mysql_1 mysql -AN $MYSQL_CONN_ARGS + - name: Preprocess the DB dump + run: | + cd server/scripts/esrupgrades + docker exec -i ghactions_mysql_1 mysql -AN $MYSQL_CONN_ARGS < $PREPROCESS_SCRIPT + - name: Run migration through script + run : | + cd server/scripts/esrupgrades + docker exec -i ghactions_mysql_1 mysql -AN $MYSQL_CONN_ARGS < $MIGRATION_SCRIPT + - name: Cleanup DB + run : | + cd server/scripts/esrupgrades + docker exec -i ghactions_mysql_1 mysql -AN $MYSQL_CONN_ARGS < $CLEANUP_SCRIPT + - name: Dump upgraded database + run: | + docker exec -i ghactions_mysql_1 mysqldump --skip-opt --set-gtid-purged=OFF $MYSQL_CONN_ARGS > $DUMP_SCRIPT_NAME + - name: Cleanup dump and compress + run: | + # We skip the very last line, which simply contains the date of the dump + head -n -1 ${DUMP_SCRIPT_NAME} | gzip > ${DUMP_SCRIPT_NAME}.gz + - name: Upload dump + uses: actions/upload-artifact@v3 + with: + name: upgraded-dump-script + path: ${{ env.DUMP_SCRIPT_NAME }}.gz + esr-upgrade-diff: + runs-on: ubuntu-latest-8-cores + needs: + - esr-upgrade-server + - esr-upgrade-script + steps: + - name: Retrieve dumps + uses: actions/download-artifact@v3 + - name: Diff dumps + run: | + gzip -d upgraded-dump-server/${DUMP_SERVER_NAME}.gz + gzip -d upgraded-dump-script/${DUMP_SCRIPT_NAME}.gz + diff upgraded-dump-server/$DUMP_SERVER_NAME upgraded-dump-script/$DUMP_SCRIPT_NAME > $DIFF_NAME + - name: Upload diff + if: failure() # Upload the diff only if the previous step failed; i.e., if the diff is non-empty + uses: actions/upload-artifact@v3 + with: + name: dumps-diff + path: ${{ env.DIFF_NAME }} diff --git a/.github/workflows/esrupgrade.yml b/.github/workflows/esrupgrade.yml new file mode 100644 index 0000000000..71624f826a --- /dev/null +++ b/.github/workflows/esrupgrade.yml @@ -0,0 +1,33 @@ +name: ESR Upgrade +on: + pull_request: + paths: + - 'server/scripts/esrupgrades/*' + - '.github/workflows/esr*' + push: + branches: + - master + - cloud + - release-* +jobs: + esr-upgrade-5_37-7_8: + name: Run ESR upgrade script from 5.37 to 7.8 + uses: ./.github/workflows/esrupgrade-common.yml + with: + db-dump-url: https://lt-public-data.s3.amazonaws.com/47K_537_mysql_collationfixed.sql.gz + initial-version: 5.37 + final-version: 7.8 + esr-upgrade-5_37-6_3: + name: Run ESR upgrade script from 5.37 to 6.3 + uses: ./.github/workflows/esrupgrade-common.yml + with: + db-dump-url: https://lt-public-data.s3.amazonaws.com/47K_537_mysql_collationfixed.sql.gz + initial-version: 5.37 + final-version: 6.3 + esr-upgrade-6_3-7_8: + name: Run ESR upgrade script from 6.3 to 7.8 + uses: ./.github/workflows/esrupgrade-common.yml + with: + db-dump-url: https://lt-public-data.s3.amazonaws.com/47K_63_mysql.sql.gz + initial-version: 6.3 + final-version: 7.8 diff --git a/.github/workflows/scorecards-analysis.yml b/.github/workflows/scorecards-analysis.yml index 01522a547c..685c9a4ebf 100644 --- a/.github/workflows/scorecards-analysis.yml +++ b/.github/workflows/scorecards-analysis.yml @@ -7,7 +7,7 @@ on: concurrency: group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: ${{ !contains( github.ref , 'heads/ref/master') }} + cancel-in-progress: ${{ github.ref != 'refs/heads/master' }} # Declare default permissions as read only. permissions: read-all diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 88e55d0168..ed18b802f0 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -23,6 +23,7 @@ jobs: uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0 with: go-version: ${{ env.go-version }} + cache-dependency-path: server/go.sum - name: Run docker compose run: | cd server/build diff --git a/CODEOWNERS b/CODEOWNERS index b0bd218122..4ef5c97c43 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -5,3 +5,6 @@ /webapp/package-lock.json @mattermost/web-platform /webapp/platform/*/package.json @mattermost/web-platform /webapp/scripts @mattermost/web-platform +/server/channels/db/migrations @mattermost/server-platform +/server/boards/services/store/sqlstore/migrations @mattermost/server-platform +/server/playbooks/server/sqlstore/migrations @mattermost/server-platform diff --git a/e2e-tests/cypress/package-lock.json b/e2e-tests/cypress/package-lock.json index a639b718bd..ca9cde2d9a 100644 --- a/e2e-tests/cypress/package-lock.json +++ b/e2e-tests/cypress/package-lock.json @@ -12,7 +12,6 @@ "@babel/eslint-parser": "7.19.1", "@babel/eslint-plugin": "7.19.1", "@cypress/request": "2.88.11", - "@cypress/skip-test": "2.6.1", "@mattermost/types": "7.4.0", "@testing-library/cypress": "9.0.0", "@types/async": "3.2.16", @@ -2250,12 +2249,6 @@ "uuid": "dist/bin/uuid" } }, - "node_modules/@cypress/skip-test": { - "version": "2.6.1", - "resolved": "https://registry.npmjs.org/@cypress/skip-test/-/skip-test-2.6.1.tgz", - "integrity": "sha512-X+ibefBiuOmC5gKG91wRIT0/OqXeETYvu7zXktjZ3yLeO186Y8ia0K7/gQUpAwuUi28DuqMd1+7tBQVtPkzbPA==", - "dev": true - }, "node_modules/@cypress/xvfb": { "version": "1.2.4", "resolved": "https://registry.npmjs.org/@cypress/xvfb/-/xvfb-1.2.4.tgz", @@ -19062,12 +19055,6 @@ } } }, - "@cypress/skip-test": { - "version": "2.6.1", - "resolved": "https://registry.npmjs.org/@cypress/skip-test/-/skip-test-2.6.1.tgz", - "integrity": "sha512-X+ibefBiuOmC5gKG91wRIT0/OqXeETYvu7zXktjZ3yLeO186Y8ia0K7/gQUpAwuUi28DuqMd1+7tBQVtPkzbPA==", - "dev": true - }, "@cypress/xvfb": { "version": "1.2.4", "resolved": "https://registry.npmjs.org/@cypress/xvfb/-/xvfb-1.2.4.tgz", diff --git a/e2e-tests/cypress/package.json b/e2e-tests/cypress/package.json index ada4a1ffec..a6c85ce248 100644 --- a/e2e-tests/cypress/package.json +++ b/e2e-tests/cypress/package.json @@ -3,7 +3,6 @@ "@babel/eslint-parser": "7.19.1", "@babel/eslint-plugin": "7.19.1", "@cypress/request": "2.88.11", - "@cypress/skip-test": "2.6.1", "@mattermost/types": "7.4.0", "@testing-library/cypress": "9.0.0", "@types/async": "3.2.16", diff --git a/e2e-tests/cypress/tests/integration/boards/create_board_spec.ts b/e2e-tests/cypress/tests/integration/boards/create_board_spec.ts index 17ed47c57b..0d0e0b2ad8 100644 --- a/e2e-tests/cypress/tests/integration/boards/create_board_spec.ts +++ b/e2e-tests/cypress/tests/integration/boards/create_board_spec.ts @@ -98,6 +98,72 @@ describe('Create and delete board / card', () => { cy.findByText('for testing purposes only').should('be.visible'); }); + it('MM-T4276 Set up Board emoji', () => { + cy.visit('/boards'); + + // # Create an empty board and change tile to Testing + cy.findByText('Create an empty board').should('exist').click({force: true}); + cy.get('.BoardComponent').should('exist'); + + // # Change Title + cy.findByPlaceholderText('Untitled board').should('be.visible').wait(timeouts.HALF_SEC); + + // * Assert that the title is changed to "testing" + cy.findByPlaceholderText('Untitled board'). + clear(). + type('Testing'). + type('{enter}'). + should('have.value', 'Testing'); + + // # "Add icon" and "Show description" options appear + cy.findByText('Add icon').should('exist'); + cy.findByText('show description').should('exist'); + + // # Click on "Add icon" + cy.findByText('Add icon').should('exist').click({force: true}); + + // * Assert that a random emoji is selected and added at the beginning of the board title + cy.get('.IconSelector').should('exist'); + + // # Click on the emoji next to the board title + cy.get('.IconSelector .MenuWrapper').should('exist').click({force: true}); + + // * Assert that Dropdown menu with 3 options appears + cy.findByText('Random').should('exist'); + cy.findByText('Pick icon').should('exist'); + cy.findByText('Remove icon').should('exist'); + + // # Hover your mouse over the "Pick Icon" option + cy.findByText('Pick icon').trigger('mouseover'); + + // * Assert that emoji picker menu appears + cy.get('.IconSelector .menu-contents').should('exist'); + + // # Click on the emoji from the picker + cy.get('.EmojiPicker').should('exist').and('be.visible').within(() => { + // # Click on the emoji + cy.get("[aria-label='😀, grinning']").should('exist'); + cy.get("[aria-label='😀, grinning']").eq(0).click({force: true}); + }); + + // * Assert that Selected emoji is now displayed next to the board title + cy.get('.IconSelector span').contains('😀'); + + // # Click on the emoji next to the board title + cy.get('.IconSelector .MenuWrapper').should('exist').click({force: true}); + + // * Assert that Dropdown menu with 3 options appears + cy.findByText('Random').should('exist'); + cy.findByText('Pick icon').should('exist'); + cy.findByText('Remove icon').should('exist'); + + // # Click "Remove icon" + cy.findByText('Remove icon').click({force: true}); + + // * Assert that Icon next to the board title is removed + cy.get('.IconSelector').should('not.exist'); + }); + it('MM-T5397 Can create and delete a board and a card', () => { // Visit a page and create new empty board cy.visit('/boards'); diff --git a/e2e-tests/cypress/tests/integration/channels/accessibility/accessibility_post_spec.js b/e2e-tests/cypress/tests/integration/channels/accessibility/accessibility_post_spec.js index 4496aa9ff8..3ecf92ca94 100644 --- a/e2e-tests/cypress/tests/integration/channels/accessibility/accessibility_post_spec.js +++ b/e2e-tests/cypress/tests/integration/channels/accessibility/accessibility_post_spec.js @@ -18,7 +18,6 @@ describe('Verify Accessibility Support in Post', () => { let otherUser; let testTeam; let testChannel; - let emojiPickerEnabled; before(() => { cy.apiInitSetup().then(({team, channel, user}) => { @@ -33,10 +32,6 @@ describe('Verify Accessibility Support in Post', () => { cy.apiAddUserToChannel(testChannel.id, otherUser.id); }); }); - - cy.apiGetConfig().then(({config}) => { - emojiPickerEnabled = config.ServiceSettings.EnableEmojiPicker; - }); }); }); @@ -179,17 +174,10 @@ describe('Verify Accessibility Support in Post', () => { cy.get(`#CENTER_time_${postId}`).should('be.focused'); cy.focused().tab(); - // eslint-disable-next-line no-negated-condition - if (!emojiPickerEnabled) { - // * Verify focus is on the actions button - cy.get(`#CENTER_button_${postId}`).should('be.focused').and('have.attr', 'aria-label', 'more'); + for (let i = 0; i < 3; i++) { + // * Verify focus is on the reactions button + cy.get(`#recent_reaction_${i}`).should('have.class', 'emoticon--post-menu').and('have.attr', 'aria-label'); cy.focused().tab(); - } else { - for (let i = 0; i < 3; i++) { - // * Verify focus is on the reactions button - cy.get(`#recent_reaction_${i}`).should('have.class', 'emoticon--post-menu').and('have.attr', 'aria-label'); - cy.focused().tab(); - } } // * Verify focus is on the reactions button @@ -200,15 +188,17 @@ describe('Verify Accessibility Support in Post', () => { cy.get(`#CENTER_flagIcon_${postId}`).should('be.focused').and('have.attr', 'aria-label', 'save'); cy.focused().tab(); + // * Verify focus is on message actions button + cy.get(`#CENTER_actions_button_${postId}`).should('be.focused').and('have.attr', 'aria-label', 'actions'); + cy.focused().tab(); + // * Verify focus is on the comment button cy.get(`#CENTER_commentIcon_${postId}`).should('be.focused').and('have.attr', 'aria-label', 'reply'); cy.focused().tab(); - if (emojiPickerEnabled) { - // * Verify focus is on the more button - cy.get(`#CENTER_button_${postId}`).should('be.focused').and('have.attr', 'aria-label', 'More'); - cy.focused().tab(); - } + // * Verify focus is on the more button + cy.get(`#CENTER_button_${postId}`).should('be.focused').and('have.attr', 'aria-label', 'more'); + cy.focused().tab(); // * Verify focus is on the post text cy.get(`#postMessageText_${postId}`).should('be.focused').and('have.attr', 'aria-readonly', 'true'); @@ -244,11 +234,13 @@ describe('Verify Accessibility Support in Post', () => { cy.get(`#rhsPostMessageText_${postId}`).should('be.focused').and('have.attr', 'aria-readonly', 'true'); cy.focused().tab({shift: true}); - if (emojiPickerEnabled) { - // * Verify focus is on the actions button - cy.get(`#RHS_COMMENT_button_${postId}`).should('be.focused').and('have.attr', 'aria-label', 'More'); - cy.focused().tab({shift: true}); - } + // * Verify focus is on the more button + cy.get(`#RHS_COMMENT_button_${postId}`).should('be.focused').and('have.attr', 'aria-label', 'more'); + cy.focused().tab({shift: true}); + + // * Verify focus is on message actions button + cy.get(`#RHS_COMMENT_actions_button_${postId}`).should('be.focused').and('have.attr', 'aria-label', 'actions'); + cy.focused().tab({shift: true}); // * Verify focus is on the save icon cy.get(`#RHS_COMMENT_flagIcon_${postId}`).should('be.focused').and('have.attr', 'aria-label', 'save'); @@ -258,15 +250,9 @@ describe('Verify Accessibility Support in Post', () => { cy.get(`#RHS_COMMENT_reaction_${postId}`).should('be.focused').and('have.attr', 'aria-label', 'add reaction'); cy.focused().tab({shift: true}); - // eslint-disable-next-line no-negated-condition - if (!emojiPickerEnabled) { - // * Verify focus is on the actions button - cy.get(`#RHS_COMMENT_button_${postId}`).should('be.focused').and('have.attr', 'aria-label', 'more'); - cy.focused().tab({shift: true}); - } else { - cy.get('#recent_reaction_0').should('have.class', 'emoticon--post-menu').and('have.attr', 'aria-label'); - cy.focused().tab({shift: true}); - } + // * Verify focus is on most recent action + cy.get('#recent_reaction_0').should('have.class', 'emoticon--post-menu').and('have.attr', 'aria-label'); + cy.focused().tab({shift: true}); // * Verify focus is on the time cy.get(`#RHS_COMMENT_time_${postId}`).should('be.focused'); diff --git a/e2e-tests/cypress/tests/integration/channels/bot_accounts/tags_spec.js b/e2e-tests/cypress/tests/integration/channels/bot_accounts/tags_spec.js index efc7b5d2d4..691f359e28 100644 --- a/e2e-tests/cypress/tests/integration/channels/bot_accounts/tags_spec.js +++ b/e2e-tests/cypress/tests/integration/channels/bot_accounts/tags_spec.js @@ -11,6 +11,7 @@ // Group: @channels @bot_accounts import {createBotPatch} from '../../../support/api/bots'; +import * as TIMEOUTS from '../../../fixtures/timeouts'; describe('Bot tags', () => { let me; @@ -48,8 +49,8 @@ describe('Bot tags', () => { await client.pinPost(postId); cy.visit(`/${team.name}/channels/${channel.name}`); - cy.clickPostDotMenu(postId); - cy.get(`#CENTER_flagIcon_${postId}`).click(); + cy.get(`#post_${postId}`).trigger('mouseover', {force: true}); + cy.wait(TIMEOUTS.HALF_SEC).get(`#CENTER_flagIcon_${postId}`).click(); }); }); }); diff --git a/e2e-tests/cypress/tests/integration/channels/channel/archived_channels_1_spec.js b/e2e-tests/cypress/tests/integration/channels/channel/archived_channels_1_spec.js index 1880dafb8a..d62984cca0 100644 --- a/e2e-tests/cypress/tests/integration/channels/channel/archived_channels_1_spec.js +++ b/e2e-tests/cypress/tests/integration/channels/channel/archived_channels_1_spec.js @@ -15,7 +15,10 @@ import {getRandomId} from '../../../utils'; describe('Leave an archived channel', () => { let testTeam; let offTopicUrl; - + const channelType = { + public: 'Channel Type: Public', + archived: 'Channel Type: Archived', + }; before(() => { cy.apiUpdateConfig({ TeamSettings: { @@ -97,7 +100,7 @@ describe('Leave an archived channel', () => { // # More channels modal opens cy.get('#moreChannelsModal').should('be.visible').within(() => { // # Click on dropdown - cy.findByText('Show: Public Channels').should('be.visible').click(); + cy.findByText(channelType.public).should('be.visible').click(); // # Click archived channels cy.findByText('Archived Channels').click(); @@ -145,7 +148,7 @@ describe('Leave an archived channel', () => { // # More channels modal opens cy.get('.more-modal').should('be.visible').within(() => { // # Public channel list opens by default - cy.findByText('Show: Public Channels').should('be.visible').click(); + cy.findByText(channelType.public).should('be.visible').click(); // # Click on archived channels cy.findByText('Archived Channels').click(); @@ -198,7 +201,7 @@ describe('Leave an archived channel', () => { // # More channels modal opens cy.get('.more-modal').should('be.visible').within(() => { // # Public channels are shown by default - cy.findByText('Show: Public Channels').should('be.visible').click(); + cy.findByText(channelType.public).should('be.visible').click(); // # Go to archived channels cy.findByText('Archived Channels').click(); @@ -252,7 +255,7 @@ describe('Leave an archived channel', () => { // # More channels modal opens cy.get('.more-modal').should('be.visible').within(() => { // # Show public channels is visible by default - cy.findByText('Show: Public Channels').should('be.visible').click(); + cy.findByText(channelType.public).should('be.visible').click(); // # Go to archived channels cy.findByText('Archived Channels').click(); @@ -286,7 +289,7 @@ describe('Leave an archived channel', () => { // # More channels modal opens and lands on public channels cy.get('#moreChannelsModal').should('be.visible').within(() => { - cy.findByText('Show: Public Channels').should('be.visible').click(); + cy.findByText(channelType.public).should('be.visible').click(); // # Go to archived channels cy.findByText('Archived Channels').click(); diff --git a/e2e-tests/cypress/tests/integration/channels/channel/more_channels_spec.js b/e2e-tests/cypress/tests/integration/channels/channel/more_channels_spec.js index 95e31a75d4..d7fd550e37 100644 --- a/e2e-tests/cypress/tests/integration/channels/channel/more_channels_spec.js +++ b/e2e-tests/cypress/tests/integration/channels/channel/more_channels_spec.js @@ -14,6 +14,11 @@ import * as TIMEOUTS from '../../../fixtures/timeouts'; import {createPrivateChannel} from '../enterprise/elasticsearch_autocomplete/helpers'; +const channelType = { + public: 'Channel Type: Public', + archived: 'Channel Type: Archived', +}; + describe('Channels', () => { let testUser; let otherUser; @@ -65,7 +70,7 @@ describe('Channels', () => { cy.get('#moreChannelsModal').should('be.visible').within(() => { // * Dropdown should be visible, defaulting to "Public Channels" - cy.get('#channelsMoreDropdown').should('be.visible').and('contain', 'Show: Public Channels').wait(TIMEOUTS.HALF_SEC); + cy.get('#channelsMoreDropdown').should('be.visible').and('contain', channelType.public).wait(TIMEOUTS.HALF_SEC); cy.get('#searchChannelsTextbox').should('be.visible').type(testChannel.display_name).wait(TIMEOUTS.HALF_SEC); cy.get('#moreChannelsList').should('be.visible').children().should('have.length', 1).within(() => { @@ -113,7 +118,7 @@ describe('Channels', () => { cy.findByText('Archived Channels').should('be.visible').click(); // * Channel test should be visible as an archived channel in the list - cy.wrap(el).should('contain', 'Show: Archived Channels'); + cy.wrap(el).should('contain', channelType.archived); }); cy.get('#searchChannelsTextbox').should('be.visible').type(testChannel.display_name).wait(TIMEOUTS.HALF_SEC); @@ -196,7 +201,7 @@ describe('Channels', () => { // * Dropdown should be visible, defaulting to "Public Channels" cy.get('#channelsMoreDropdown').should('be.visible').within((el) => { - cy.wrap(el).should('contain', 'Show: Public Channels'); + cy.wrap(el).should('contain', channelType.public); }); // * Users should be able to type and search @@ -207,12 +212,12 @@ describe('Channels', () => { cy.get('#moreChannelsModal').should('be.visible').within(() => { // * Users should be able to switch to "Archived Channels" list - cy.get('#channelsMoreDropdown').should('be.visible').and('contain', 'Show: Public Channels').click().within((el) => { + cy.get('#channelsMoreDropdown').should('be.visible').and('contain', channelType.public).click().within((el) => { // # Click on archived channels item cy.findByText('Archived Channels').should('be.visible').click(); // * Modal should show the archived channels list - cy.wrap(el).should('contain', 'Show: Archived Channels'); + cy.wrap(el).should('contain', channelType.archived); }).wait(TIMEOUTS.HALF_SEC); cy.get('#searchChannelsTextbox').clear(); cy.get('#moreChannelsList').should('be.visible').children().should('have.length', 2); @@ -250,7 +255,7 @@ function verifyMoreChannelsModal(isEnabled) { // * Verify that the more channels modal is open and with or without option to view archived channels cy.get('#moreChannelsModal').should('be.visible').within(() => { if (isEnabled) { - cy.get('#channelsMoreDropdown').should('be.visible').and('have.text', 'Show: Public Channels'); + cy.get('#channelsMoreDropdown').should('be.visible').and('have.text', channelType.public); } else { cy.get('#channelsMoreDropdown').should('not.exist'); } diff --git a/e2e-tests/cypress/tests/integration/channels/enterprise/cloud/billing/yearly_subscription_spec.js b/e2e-tests/cypress/tests/integration/channels/enterprise/cloud/billing/yearly_subscription_spec.js index 0eacc1350c..3c4b443381 100644 --- a/e2e-tests/cypress/tests/integration/channels/enterprise/cloud/billing/yearly_subscription_spec.js +++ b/e2e-tests/cypress/tests/integration/channels/enterprise/cloud/billing/yearly_subscription_spec.js @@ -142,7 +142,7 @@ describe('System Console - Subscriptions section', () => { cy.get('.RHS').find('button').should('be.enabled'); // # Change the user seats field to a value smaller than the current number of users - const lessThanUserCount = count - 5; + const lessThanUserCount = 1; cy.get('#input_UserSeats').clear().type(lessThanUserCount); // * Ensure that the yearly, monthly, and yearly saving prices match the new user seats value entered diff --git a/e2e-tests/cypress/tests/integration/channels/insights/insights_spec.ts b/e2e-tests/cypress/tests/integration/channels/insights/insights_spec.ts new file mode 100644 index 0000000000..9d3de5d6d1 --- /dev/null +++ b/e2e-tests/cypress/tests/integration/channels/insights/insights_spec.ts @@ -0,0 +1,48 @@ +// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. +// See LICENSE.txt for license information. + +// *************************************************************** +// - [#] indicates a test step (e.g. # Go to a page) +// - [*] indicates an assertion (e.g. * Check the title) +// - Use element ID when selecting an element. Create one if none. +// *************************************************************** +// Stage: @prod + +describe('Insights', () => { + let teamA; + + before(() => { + cy.shouldHaveFeatureFlag('InsightsEnabled', true); + + cy.apiInitSetup().then(({team}) => { + teamA = team; + }); + }); + it('Check all the cards exist', () => { + cy.apiAdminLogin(); + + // # Go to the Insights view + cy.visit(`/${teamA.name}/activity-and-insights`); + + // * Check top channels exists + cy.get('.top-channels-card').should('exist'); + + // * Check top threads exists + cy.get('.top-threads-card').should('exist'); + + // * Check top boards exists because product mode is enabled + cy.get('.top-boards-card').should('exist'); + + // * Check top reactions exists + cy.get('.top-reactions-card').should('exist'); + + // * Check top dms exists + cy.get('.top-dms-card').should('exist'); + + // * Check least active channels exists + cy.get('.least-active-channels-card').should('exist'); + + // * Check top playbooks exists because product mode is enabled + cy.get('.top-playbooks-card').should('exist'); + }); +}); diff --git a/e2e-tests/cypress/tests/integration/channels/integrations/incoming_webhook/edit_incoming_webhook_spec.js b/e2e-tests/cypress/tests/integration/channels/integrations/incoming_webhook/edit_incoming_webhook_spec.js index 0da9132a9c..3e75213606 100644 --- a/e2e-tests/cypress/tests/integration/channels/integrations/incoming_webhook/edit_incoming_webhook_spec.js +++ b/e2e-tests/cypress/tests/integration/channels/integrations/incoming_webhook/edit_incoming_webhook_spec.js @@ -69,6 +69,12 @@ describe('Incoming webhook', () => { cy.getLastPost().within(() => { cy.findByRole('link', {name: 'Testing Integration Attachments', hidden: true}); + }); + + // # Scroll to the bottom of the posts + cy.get('.post-list__dynamic').scrollTo('bottom'); + + cy.getLastPost().within(() => { cy.get('.attachment__image').should('be.visible'); cy.get(':nth-child(2) > thead > tr > .attachment-field__caption').should('have.text', 'Area'); cy.get(':nth-child(3) > thead > tr > :nth-child(1)').should('have.text', 'Iteration'); diff --git a/e2e-tests/cypress/tests/integration/channels/keyboard_shortcuts/ctrl_cmd_shift_slash/react_to_center_spec.js b/e2e-tests/cypress/tests/integration/channels/keyboard_shortcuts/ctrl_cmd_shift_slash/react_to_center_spec.js index c75dd0200b..4c16ed5ef4 100644 --- a/e2e-tests/cypress/tests/integration/channels/keyboard_shortcuts/ctrl_cmd_shift_slash/react_to_center_spec.js +++ b/e2e-tests/cypress/tests/integration/channels/keyboard_shortcuts/ctrl_cmd_shift_slash/react_to_center_spec.js @@ -191,7 +191,9 @@ describe('Keyboard shortcut CTRL/CMD+Shift+\\ for adding reaction to last messag Cypress._.times(3, () => { doReactToLastMessageShortcut('CENTER'); cy.get('#emojiPicker').should('exist'); - cy.get('body').click(); + + // # Click anywhere to close emoji picker + cy.get('#channelHeaderInfo').click(); cy.get('#emojiPicker').should('not.exist'); }); diff --git a/e2e-tests/cypress/tests/integration/channels/menus/status_dropdown_spec.js b/e2e-tests/cypress/tests/integration/channels/menus/status_dropdown_spec.js index 23119436ce..3d75ff6399 100644 --- a/e2e-tests/cypress/tests/integration/channels/menus/status_dropdown_spec.js +++ b/e2e-tests/cypress/tests/integration/channels/menus/status_dropdown_spec.js @@ -15,7 +15,7 @@ import theme from '../../../fixtures/theme.json'; describe('Status dropdown menu', () => { const statusTestCases = [ - {text: 'Online', className: 'icon-check', profileClassName: 'icon-check-circle'}, + {text: 'Online', className: 'icon-check-circle', profileClassName: 'icon-check-circle'}, {text: 'Away', className: 'icon-clock'}, {text: 'Do Not Disturb', className: 'icon-minus-circle'}, {text: 'Offline', className: 'icon-circle-outline'}, diff --git a/e2e-tests/cypress/tests/integration/channels/messaging/edit_message_spec.js b/e2e-tests/cypress/tests/integration/channels/messaging/edit_message_spec.js index 0bf2363650..1aad5036be 100644 --- a/e2e-tests/cypress/tests/integration/channels/messaging/edit_message_spec.js +++ b/e2e-tests/cypress/tests/integration/channels/messaging/edit_message_spec.js @@ -145,4 +145,42 @@ describe('Edit Message', () => { cy.get(postText).should('have.text', `${secondMessage} Another new message Edited`); }); }); + + it('MM-T5416 should discard any changes made after cancelling the edit and opening the edit textbox again should display the original message', () => { + const message = 'World!'; + cy.postMessage(message); + + // * Verify message is sent and not pending + cy.getLastPostId().then((postId) => { + const postText = `#postMessageText_${postId}`; + cy.get(postText).should('have.text', message); + + // # Open edit textbox + cy.uiGetPostTextBox().type('{uparrow}'); + + // * Edit Post Input should appear, and edit the post + cy.get('#edit_textbox').should('be.visible'); + + // * Press the escape key to cancel + cy.get('#edit_textbox').should('have.text', message).type(' Another new message{esc}'); + cy.get('#edit_textbox').should('not.exist'); + + // * Check that the message wasn't edited + cy.get(postText).should('have.text', message); + }); + + cy.getLastPostId().then((postId) => { + const postText = `#postMessageText_${postId}`; + cy.get(postText).should('have.text', message); + + // # Open edit textbox again + cy.uiGetPostTextBox().type('{uparrow}'); + + // * Edit Post Input should appear, and edit the post + cy.get('#edit_textbox').should('be.visible'); + + // * Opening the edit textbox again after previously cancelling the edit should contain the original message. + cy.get('#edit_textbox').should('have.text', message); + }); + }); }); diff --git a/e2e-tests/cypress/tests/integration/playbooks/channels/app_bar_spec.js b/e2e-tests/cypress/tests/integration/playbooks/channels/app_bar_spec.js index 3e201afde8..d24a0858cf 100644 --- a/e2e-tests/cypress/tests/integration/playbooks/channels/app_bar_spec.js +++ b/e2e-tests/cypress/tests/integration/playbooks/channels/app_bar_spec.js @@ -9,71 +9,45 @@ // Stage: @prod // Group: @playbooks -import {onlyOn} from '@cypress/skip-test'; - describe('channels > App Bar', {testIsolation: true}, () => { let testTeam; let testUser; - let testPlaybook; - let appBarEnabled; before(() => { cy.apiInitSetup().then(({team, user}) => { testTeam = team; testUser = user; - - // # Login as testUser - cy.apiLogin(testUser); - - // # Create a playbook - cy.apiCreateTestPlaybook({ - teamId: testTeam.id, - title: 'Playbook', - userId: testUser.id, - }).then((playbook) => { - testPlaybook = playbook; - - // # Start a playbook run - cy.apiRunPlaybook({ - teamId: testTeam.id, - playbookId: testPlaybook.id, - playbookRunName: 'Playbook Run', - ownerUserId: testUser.id, - }); - }); - - cy.apiGetConfig(true).then(({config}) => { - appBarEnabled = config.EnableAppBar === 'true'; - }); }); }); beforeEach(() => { - // # Size the viewport to show the RHS without covering posts. - cy.viewport('macbook-13'); - - // # Login as testUser - cy.apiLogin(testUser); + cy.apiAdminLogin(); }); describe('App Bar disabled', () => { it('should not show the Playbook App Bar icon', () => { - onlyOn(!appBarEnabled); + cy.apiUpdateConfig({ExperimentalSettings: {EnableAppBar: false}}); + + // # Login as testUser + cy.apiLogin(testUser); // # Navigate directly to a non-playbook run channel cy.visit(`/${testTeam.name}/channels/town-square`); // * Verify App Bar icon is not showing - cy.get('#channel_view').within(() => { - cy.getPlaybooksAppBarIcon().should('not.exist'); - }); + cy.get('.app-bar').should('not.exist'); }); }); describe('App Bar enabled', () => { - it('should show the Playbook App Bar icon', () => { - onlyOn(appBarEnabled); + beforeEach(() => { + cy.apiUpdateConfig({ExperimentalSettings: {EnableAppBar: true}}); + // # Login as testUser + cy.apiLogin(testUser); + }); + + it('should show the Playbook App Bar icon', () => { // # Navigate directly to a non-playbook run channel cy.visit(`/${testTeam.name}/channels/town-square`); @@ -82,8 +56,6 @@ describe('channels > App Bar', {testIsolation: true}, () => { }); it('should show "Playbooks" tooltip for Playbook App Bar icon', () => { - onlyOn(appBarEnabled); - // # Navigate directly to a non-playbook run channel cy.visit(`/${testTeam.name}/channels/town-square`); diff --git a/e2e-tests/cypress/tests/integration/playbooks/channels/channel_header_spec.js b/e2e-tests/cypress/tests/integration/playbooks/channels/channel_header_spec.js index 546447ed0b..4b3abd6556 100644 --- a/e2e-tests/cypress/tests/integration/playbooks/channels/channel_header_spec.js +++ b/e2e-tests/cypress/tests/integration/playbooks/channels/channel_header_spec.js @@ -9,14 +9,11 @@ // Stage: @prod // Group: @playbooks -import {onlyOn} from '@cypress/skip-test'; - describe('channels > channel header', {testIsolation: true}, () => { let testTeam; let testUser; let testPlaybook; let testPlaybookRun; - let appBarEnabled; before(() => { cy.apiInitSetup().then(({team, user}) => { @@ -44,24 +41,16 @@ describe('channels > channel header', {testIsolation: true}, () => { testPlaybookRun = run; }); }); - - cy.apiGetConfig(true).then(({config}) => { - appBarEnabled = config.EnableAppBar === 'true'; - }); }); }); - beforeEach(() => { - // # Size the viewport to show the RHS without covering posts. - cy.viewport('macbook-13'); - - // # Login as testUser - cy.apiLogin(testUser); - }); - describe('App Bar enabled', () => { it('webapp should hide the Playbook channel header button', () => { - onlyOn(appBarEnabled); + cy.apiAdminLogin(); + cy.apiUpdateConfig({ExperimentalSettings: {EnableAppBar: true}}); + + // # Login as testUser + cy.apiLogin(testUser); // # Navigate directly to a non-playbook run channel cy.visit(`/${testTeam.name}/channels/town-square`); @@ -74,9 +63,15 @@ describe('channels > channel header', {testIsolation: true}, () => { }); describe('App Bar disabled', () => { - it('webapp should show the Playbook channel header button', () => { - onlyOn(!appBarEnabled); + beforeEach(() => { + cy.apiAdminLogin(); + cy.apiUpdateConfig({ExperimentalSettings: {EnableAppBar: false}}); + // # Login as testUser + cy.apiLogin(testUser); + }); + + it('webapp should show the Playbook channel header button', () => { // # Navigate directly to a non-playbook run channel cy.visit(`/${testTeam.name}/channels/town-square`); @@ -87,8 +82,6 @@ describe('channels > channel header', {testIsolation: true}, () => { }); it('tooltip text should show "Playbooks" for Playbook channel header button', () => { - onlyOn(!appBarEnabled); - // # Navigate directly to a non-playbook run channel cy.visit(`/${testTeam.name}/channels/town-square`); @@ -103,6 +96,11 @@ describe('channels > channel header', {testIsolation: true}, () => { }); describe('description text', () => { + beforeEach(() => { + // # Login as testUser + cy.apiLogin(testUser); + }); + it('should contain a link to the playbook', () => { // # Navigate directly to a playbook run channel cy.visit(`/${testTeam.name}/channels/playbook-run`); @@ -112,6 +110,7 @@ describe('channels > channel header', {testIsolation: true}, () => { expect(href).to.equals(`/playbooks/playbooks/${testPlaybook.id}`); }); }); + it('should contain a link to the overview page', () => { // # Navigate directly to a playbook run channel cy.visit(`/${testTeam.name}/channels/playbook-run`); diff --git a/e2e-tests/cypress/tests/integration/playbooks/channels/rhs/status_update_spec.js b/e2e-tests/cypress/tests/integration/playbooks/channels/rhs/status_update_spec.js index 59f2a7811d..63bf6c8583 100644 --- a/e2e-tests/cypress/tests/integration/playbooks/channels/rhs/status_update_spec.js +++ b/e2e-tests/cypress/tests/integration/playbooks/channels/rhs/status_update_spec.js @@ -82,7 +82,7 @@ describe('channels > rhs > status update', {testIsolation: true}, () => { }); }); - it.skip('description link navigates to run overview', () => { + it('description link navigates to run overview', () => { // # Run the `/playbook update` slash command. cy.uiPostMessageQuickly('/playbook update'); diff --git a/e2e-tests/cypress/tests/integration/playbooks/lhs_spec.js b/e2e-tests/cypress/tests/integration/playbooks/lhs_spec.js index 63fa4d0bc4..1a74d96bf8 100644 --- a/e2e-tests/cypress/tests/integration/playbooks/lhs_spec.js +++ b/e2e-tests/cypress/tests/integration/playbooks/lhs_spec.js @@ -153,7 +153,7 @@ describe('lhs', {testIsolation: true}, () => { cy.findByTestId('dropdownmenu').should('be.visible'); }); - it.skip('can copy link', () => { + it('can copy link', () => { // # Visit the playbook run cy.visit(`/playbooks/runs/${playbookRun.id}`); stubClipboard().as('clipboard'); @@ -295,7 +295,7 @@ describe('lhs', {testIsolation: true}, () => { }); }); - it.skip('leave run, when on rdp of the same run', () => { + it('leave run, when on rdp of the same run', () => { // # Click on leave menu item getRunDropdownItemByText('Runs', playbookRun.name, 'Leave and unfollow run').click(); diff --git a/e2e-tests/cypress/tests/integration/playbooks/playbooks/edit_metrics_spec.js b/e2e-tests/cypress/tests/integration/playbooks/playbooks/edit_metrics_spec.js index 8f0c1feacd..0180c42a73 100644 --- a/e2e-tests/cypress/tests/integration/playbooks/playbooks/edit_metrics_spec.js +++ b/e2e-tests/cypress/tests/integration/playbooks/playbooks/edit_metrics_spec.js @@ -290,7 +290,7 @@ describe('playbooks > edit_metrics', {testIsolation: true}, () => { }); describe('delete metric', () => { - it.skip('verifies when clicking delete button; saved metrics have different confirmation text; deleted metrics are deleted', () => { + it('verifies when clicking delete button; saved metrics have different confirmation text; deleted metrics are deleted', () => { // # Visit the selected playbook cy.visit(`/playbooks/playbooks/${testPlaybook.id}`); diff --git a/e2e-tests/cypress/tests/integration/playbooks/runs/permissions_spec.js b/e2e-tests/cypress/tests/integration/playbooks/runs/permissions_spec.js index 4797d85fba..594487de28 100644 --- a/e2e-tests/cypress/tests/integration/playbooks/runs/permissions_spec.js +++ b/e2e-tests/cypress/tests/integration/playbooks/runs/permissions_spec.js @@ -160,9 +160,7 @@ describe('runs > permissions', {testIsolation: true}, () => { }); describe('should be visible', () => { - // XXX: Skipping this test, since public playbooks currently have no members. This will - // likely change in the future, so keeping the skeleton. - it.skip('to playbook members', () => { + it('to playbook members', () => { assertRunIsVisible(run, playbookMember); }); @@ -242,9 +240,7 @@ describe('runs > permissions', {testIsolation: true}, () => { }); describe('should be visible', () => { - // XXX: Skipping this test, since public playbooks currently have no members. This will - // likely change in the future. - it.skip('to playbook members', () => { + it('to playbook members', () => { assertRunIsVisible(run, playbookMember); }); @@ -332,10 +328,9 @@ describe('runs > permissions', {testIsolation: true}, () => { assertRunIsVisible(run, runParticipant); }); - // Skipping this test, since followers cannot follow a run with a private channel from - // a private playbook. (But leaving it for clarity in the code.) - it.skip('to run followers', () => { - assertRunIsVisible(run, runFollower); + // Followers cannot follow a run with a private channel from a private playbook + it('to run followers', () => { + assertRunIsNotVisible(run, runFollower); }); it('to admins in the team', () => { @@ -414,10 +409,9 @@ describe('runs > permissions', {testIsolation: true}, () => { assertRunIsVisible(run, runParticipant); }); - // Skipping this test, since followers cannot follow a run with a private channel from - // a private playbook. (But leaving it for clarity in the code.) - it.skip('to run followers', () => { - assertRunIsVisible(run, runFollower); + // Followers cannot follow a run with a private channel from a private playbook + it('to run followers', () => { + assertRunIsNotVisible(run, runFollower); }); it('to admins in the team', () => { diff --git a/e2e-tests/cypress/tests/integration/playbooks/runs/rdp_main_header_spec.js b/e2e-tests/cypress/tests/integration/playbooks/runs/rdp_main_header_spec.js index 4bb14ed9ad..e12771883b 100644 --- a/e2e-tests/cypress/tests/integration/playbooks/runs/rdp_main_header_spec.js +++ b/e2e-tests/cypress/tests/integration/playbooks/runs/rdp_main_header_spec.js @@ -692,7 +692,7 @@ describe('runs > run details page > header', {testIsolation: true}, () => { }); }); - describe.skip('Join action disabled', () => { + describe('Join action disabled', () => { beforeEach(() => { cy.apiLogin(testUser); diff --git a/e2e-tests/cypress/tests/integration/playbooks/runs/rdp_main_statusupdate_spec.js b/e2e-tests/cypress/tests/integration/playbooks/runs/rdp_main_statusupdate_spec.js index 973c7fab7d..fddc55378b 100644 --- a/e2e-tests/cypress/tests/integration/playbooks/runs/rdp_main_statusupdate_spec.js +++ b/e2e-tests/cypress/tests/integration/playbooks/runs/rdp_main_statusupdate_spec.js @@ -267,7 +267,7 @@ describe('runs > run details page > status update', {testIsolation: true}, () => }); }); - it.skip('requests an update and confirm', () => { + it('requests an update and confirm', () => { // # Click on request update cy.findByTestId('run-statusupdate-section'). should('be.visible'). @@ -281,11 +281,11 @@ describe('runs > run details page > status update', {testIsolation: true}, () => cy.visit(`${testTeam.name}/channels/${playbookRunChannelName}`); // * Assert that message has been sent - cy.getLastPost().contains(`${testUser.username} requested a status update for ${testPublicPlaybook.name}.`); + cy.getLastPost().contains(`${testViewerUser.username} requested a status update for ${testRun.name}.`); }); }); - it.skip('requests an update and cancel', () => { + it('requests an update and cancel', () => { // # Click request update cy.findByTestId('run-statusupdate-section'). should('be.visible'). diff --git a/e2e-tests/cypress/tests/support/api/role.js b/e2e-tests/cypress/tests/support/api/role.js index 6a8eed7082..d53862b72d 100644 --- a/e2e-tests/cypress/tests/support/api/role.js +++ b/e2e-tests/cypress/tests/support/api/role.js @@ -10,14 +10,14 @@ import xor from 'lodash.xor'; export const defaultRolesPermissions = { channel_admin: 'use_channel_mentions remove_reaction manage_public_channel_members use_group_mentions manage_channel_roles manage_private_channel_members add_reaction read_public_channel_groups create_post read_private_channel_groups', - channel_guest: 'upload_file edit_post create_post use_channel_mentions use_slash_commands read_channel add_reaction remove_reaction', - channel_user: 'manage_private_channel_members read_public_channel_groups delete_post read_private_channel_groups use_group_mentions manage_private_channel_properties delete_public_channel use_slash_commands add_reaction manage_public_channel_properties edit_post upload_file use_channel_mentions get_public_link read_channel delete_private_channel manage_public_channel_members create_post remove_reaction', + channel_guest: 'upload_file edit_post create_post use_channel_mentions read_channel add_reaction remove_reaction', + channel_user: 'manage_private_channel_members read_public_channel_groups delete_post read_private_channel_groups use_group_mentions manage_private_channel_properties delete_public_channel add_reaction manage_public_channel_properties edit_post upload_file use_channel_mentions get_public_link read_channel delete_private_channel manage_public_channel_members create_post remove_reaction', custom_group_user: '', playbook_admin: 'playbook_private_manage_properties playbook_public_make_private playbook_public_manage_members playbook_public_manage_roles playbook_public_manage_properties playbook_private_manage_members playbook_private_manage_roles', playbook_member: 'playbook_public_view playbook_public_manage_members playbook_public_manage_properties playbook_private_view playbook_private_manage_members playbook_private_manage_properties run_create', run_admin: 'run_manage_properties run_manage_members', run_member: 'run_view', - system_admin: 'sysconsole_write_environment_elasticsearch playbook_public_manage_properties sysconsole_write_authentication_ldap run_view manage_jobs manage_roles playbook_public_create manage_public_channel_properties sysconsole_read_plugins delete_post purge_elasticsearch_indexes sysconsole_read_integrations_bot_accounts read_data_retention_job manage_private_channel_members create_elasticsearch_post_indexing_job sysconsole_read_authentication_guest_access create_elasticsearch_post_aggregation_job join_public_teams sysconsole_read_site_public_links add_saml_idp_cert sysconsole_write_site_announcement_banner sysconsole_write_site_notices sysconsole_read_experimental_feature_flags sysconsole_read_site_users_and_teams manage_slash_commands sysconsole_read_authentication_ldap read_channel sysconsole_write_authentication_password list_users_without_team sysconsole_read_authentication_email add_saml_public_cert playbook_private_create promote_guest sysconsole_read_user_management_system_roles manage_public_channel_members create_data_retention_job add_saml_private_cert sysconsole_write_user_management_users sysconsole_read_compliance_compliance_monitoring playbook_public_manage_members sysconsole_write_environment_database sysconsole_write_user_management_teams playbook_private_manage_roles read_public_channel sysconsole_write_plugins sysconsole_read_authentication_openid sysconsole_write_user_management_groups sysconsole_write_site_file_sharing_and_downloads playbook_private_manage_properties sysconsole_read_site_customization join_public_channels add_user_to_team restore_custom_group download_compliance_export_result sysconsole_write_user_management_system_roles sysconsole_write_environment_session_lengths create_custom_group manage_private_channel_properties create_post_public remove_ldap_private_cert sysconsole_write_site_public_links import_team sysconsole_read_environment_developer sysconsole_read_environment_database sysconsole_read_environment_web_server use_channel_mentions view_team remove_others_reactions sysconsole_read_environment_session_lengths sysconsole_write_integrations_bot_accounts playbook_public_view use_group_mentions sysconsole_write_environment_web_server add_ldap_private_cert read_public_channel_groups invite_guest sysconsole_read_environment_smtp create_post sysconsole_read_about_edition_and_license sysconsole_read_authentication_signup sysconsole_read_authentication_saml sysconsole_read_environment_file_storage sysconsole_write_experimental_feature_flags sysconsole_write_site_localization sysconsole_write_environment_rate_limiting sysconsole_read_environment_rate_limiting sysconsole_read_products_boards get_saml_cert_status sysconsole_read_environment_high_availability manage_secure_connections read_compliance_export_job sysconsole_write_compliance_custom_terms_of_service read_user_access_token edit_post sysconsole_write_environment_logging sysconsole_read_environment_push_notification_server sysconsole_write_site_customization read_other_users_teams read_elasticsearch_post_aggregation_job sysconsole_write_compliance_data_retention_policy sysconsole_read_user_management_permissions sysconsole_read_site_emoji sysconsole_read_compliance_data_retention_policy read_license_information sysconsole_read_experimental_features read_deleted_posts sysconsole_read_environment_logging sysconsole_read_reporting_site_statistics test_elasticsearch sysconsole_read_site_posts add_reaction sysconsole_write_authentication_signup manage_outgoing_webhooks create_post_ephemeral sysconsole_read_environment_image_proxy invite_user manage_others_outgoing_webhooks create_user_access_token sysconsole_write_environment_image_proxy sysconsole_write_products_boards read_elasticsearch_post_indexing_job purge_bleve_indexes sysconsole_write_environment_performance_monitoring sysconsole_write_authentication_guest_access sysconsole_read_compliance_custom_terms_of_service edit_others_posts sysconsole_write_billing get_saml_metadata_from_idp sysconsole_write_authentication_saml create_post_bleve_indexes_job invalidate_caches sysconsole_write_experimental_bleve view_members manage_others_bots run_create join_private_teams convert_private_channel_to_public read_audits assign_bot read_jobs remove_user_from_team revoke_user_access_token manage_team sysconsole_read_reporting_server_logs get_public_link manage_others_slash_commands manage_system delete_public_channel read_private_channel_groups sysconsole_read_authentication_mfa delete_emojis list_private_teams create_emojis sysconsole_read_billing sysconsole_write_site_emoji invalidate_email_invite sysconsole_write_environment_file_storage sysconsole_write_compliance_compliance_monitoring remove_saml_public_cert sysconsole_read_compliance_compliance_export sysconsole_read_site_localization use_slash_commands manage_team_roles list_public_teams get_logs sysconsole_write_integrations_integration_management sysconsole_read_integrations_cors manage_oauth delete_others_emojis sysconsole_write_integrations_gif manage_incoming_webhooks sysconsole_write_authentication_email create_private_channel playbook_private_make_public manage_bots add_ldap_public_cert remove_ldap_public_cert sysconsole_write_site_notifications sysconsole_write_environment_developer playbook_private_manage_members sysconsole_read_user_management_teams edit_custom_group remove_reaction playbook_public_manage_roles sysconsole_write_reporting_server_logs read_others_bots sysconsole_write_site_posts sysconsole_read_site_notifications sysconsole_read_authentication_password playbook_private_view manage_system_wide_oauth get_analytics list_team_channels sysconsole_write_user_management_channels delete_private_channel manage_custom_group_members test_s3 create_ldap_sync_job sysconsole_read_integrations_integration_management test_site_url recycle_database_connections sysconsole_read_site_announcement_banner test_email manage_shared_channels read_bots sysconsole_write_environment_smtp sysconsole_read_experimental_bleve sysconsole_write_environment_push_notification_server sysconsole_write_user_management_permissions sysconsole_read_environment_elasticsearch sysconsole_write_reporting_site_statistics sysconsole_write_site_users_and_teams demote_to_guest create_team test_ldap remove_saml_idp_cert delete_others_posts edit_other_users sysconsole_write_reporting_team_statistics sysconsole_read_integrations_gif sysconsole_read_site_notices sysconsole_write_about_edition_and_license manage_others_incoming_webhooks run_manage_members create_bot sysconsole_write_authentication_mfa sysconsole_read_user_management_users assign_system_admin_role sysconsole_write_experimental_features edit_brand create_group_channel sysconsole_write_authentication_openid create_direct_channel manage_license_information reload_config manage_channel_roles sysconsole_read_user_management_groups create_compliance_export_job read_ldap_sync_job upload_file sysconsole_read_site_file_sharing_and_downloads delete_custom_group sysconsole_read_user_management_channels sysconsole_write_compliance_compliance_export remove_saml_private_cert sysconsole_read_environment_performance_monitoring create_public_channel sysconsole_write_integrations_cors sysconsole_write_environment_high_availability playbook_public_make_private run_manage_properties sysconsole_read_reporting_team_statistics convert_public_channel_to_private', + system_admin: 'sysconsole_write_environment_elasticsearch playbook_public_manage_properties sysconsole_write_authentication_ldap run_view manage_jobs manage_roles playbook_public_create manage_public_channel_properties sysconsole_read_plugins delete_post purge_elasticsearch_indexes sysconsole_read_integrations_bot_accounts read_data_retention_job manage_private_channel_members create_elasticsearch_post_indexing_job sysconsole_read_authentication_guest_access create_elasticsearch_post_aggregation_job join_public_teams sysconsole_read_site_public_links add_saml_idp_cert sysconsole_write_site_announcement_banner sysconsole_write_site_notices sysconsole_read_experimental_feature_flags sysconsole_read_site_users_and_teams manage_slash_commands sysconsole_read_authentication_ldap read_channel sysconsole_write_authentication_password list_users_without_team sysconsole_read_authentication_email add_saml_public_cert playbook_private_create promote_guest sysconsole_read_user_management_system_roles manage_public_channel_members create_data_retention_job add_saml_private_cert sysconsole_write_user_management_users sysconsole_read_compliance_compliance_monitoring playbook_public_manage_members sysconsole_write_environment_database sysconsole_write_user_management_teams playbook_private_manage_roles read_public_channel sysconsole_write_plugins sysconsole_read_authentication_openid sysconsole_write_user_management_groups sysconsole_write_site_file_sharing_and_downloads playbook_private_manage_properties sysconsole_read_site_customization join_public_channels add_user_to_team restore_custom_group download_compliance_export_result sysconsole_write_user_management_system_roles sysconsole_write_environment_session_lengths create_custom_group manage_private_channel_properties create_post_public remove_ldap_private_cert sysconsole_write_site_public_links import_team sysconsole_read_environment_developer sysconsole_read_environment_database sysconsole_read_environment_web_server use_channel_mentions view_team remove_others_reactions sysconsole_read_environment_session_lengths sysconsole_write_integrations_bot_accounts playbook_public_view use_group_mentions sysconsole_write_environment_web_server add_ldap_private_cert read_public_channel_groups invite_guest sysconsole_read_environment_smtp create_post sysconsole_read_about_edition_and_license sysconsole_read_authentication_signup sysconsole_read_authentication_saml sysconsole_read_environment_file_storage sysconsole_write_experimental_feature_flags sysconsole_write_site_localization sysconsole_write_environment_rate_limiting sysconsole_read_environment_rate_limiting sysconsole_read_products_boards get_saml_cert_status sysconsole_read_environment_high_availability manage_secure_connections read_compliance_export_job sysconsole_write_compliance_custom_terms_of_service read_user_access_token edit_post sysconsole_write_environment_logging sysconsole_read_environment_push_notification_server sysconsole_write_site_customization read_other_users_teams read_elasticsearch_post_aggregation_job sysconsole_write_compliance_data_retention_policy sysconsole_read_user_management_permissions sysconsole_read_site_emoji sysconsole_read_compliance_data_retention_policy read_license_information sysconsole_read_experimental_features read_deleted_posts sysconsole_read_environment_logging sysconsole_read_reporting_site_statistics test_elasticsearch sysconsole_read_site_posts add_reaction sysconsole_write_authentication_signup manage_outgoing_webhooks create_post_ephemeral sysconsole_read_environment_image_proxy invite_user manage_others_outgoing_webhooks create_user_access_token sysconsole_write_environment_image_proxy sysconsole_write_products_boards read_elasticsearch_post_indexing_job purge_bleve_indexes sysconsole_write_environment_performance_monitoring sysconsole_write_authentication_guest_access sysconsole_read_compliance_custom_terms_of_service edit_others_posts sysconsole_write_billing get_saml_metadata_from_idp sysconsole_write_authentication_saml create_post_bleve_indexes_job invalidate_caches sysconsole_write_experimental_bleve view_members manage_others_bots run_create join_private_teams convert_private_channel_to_public read_audits assign_bot read_jobs remove_user_from_team revoke_user_access_token manage_team sysconsole_read_reporting_server_logs get_public_link manage_others_slash_commands manage_system delete_public_channel read_private_channel_groups sysconsole_read_authentication_mfa delete_emojis list_private_teams create_emojis sysconsole_read_billing sysconsole_write_site_emoji invalidate_email_invite sysconsole_write_environment_file_storage sysconsole_write_compliance_compliance_monitoring remove_saml_public_cert sysconsole_read_compliance_compliance_export sysconsole_read_site_localization manage_team_roles list_public_teams get_logs sysconsole_write_integrations_integration_management sysconsole_read_integrations_cors manage_oauth delete_others_emojis sysconsole_write_integrations_gif manage_incoming_webhooks sysconsole_write_authentication_email create_private_channel playbook_private_make_public manage_bots add_ldap_public_cert remove_ldap_public_cert sysconsole_write_site_notifications sysconsole_write_environment_developer playbook_private_manage_members sysconsole_read_user_management_teams edit_custom_group remove_reaction playbook_public_manage_roles sysconsole_write_reporting_server_logs read_others_bots sysconsole_write_site_posts sysconsole_read_site_notifications sysconsole_read_authentication_password playbook_private_view manage_system_wide_oauth get_analytics list_team_channels sysconsole_write_user_management_channels delete_private_channel manage_custom_group_members test_s3 create_ldap_sync_job sysconsole_read_integrations_integration_management test_site_url recycle_database_connections sysconsole_read_site_announcement_banner test_email manage_shared_channels read_bots sysconsole_write_environment_smtp sysconsole_read_experimental_bleve sysconsole_write_environment_push_notification_server sysconsole_write_user_management_permissions sysconsole_read_environment_elasticsearch sysconsole_write_reporting_site_statistics sysconsole_write_site_users_and_teams demote_to_guest create_team test_ldap remove_saml_idp_cert delete_others_posts edit_other_users sysconsole_write_reporting_team_statistics sysconsole_read_integrations_gif sysconsole_read_site_notices sysconsole_write_about_edition_and_license manage_others_incoming_webhooks run_manage_members create_bot sysconsole_write_authentication_mfa sysconsole_read_user_management_users assign_system_admin_role sysconsole_write_experimental_features edit_brand create_group_channel sysconsole_write_authentication_openid create_direct_channel manage_license_information reload_config manage_channel_roles sysconsole_read_user_management_groups create_compliance_export_job read_ldap_sync_job upload_file sysconsole_read_site_file_sharing_and_downloads delete_custom_group sysconsole_read_user_management_channels sysconsole_write_compliance_compliance_export remove_saml_private_cert sysconsole_read_environment_performance_monitoring create_public_channel sysconsole_write_integrations_cors sysconsole_write_environment_high_availability playbook_public_make_private run_manage_properties sysconsole_read_reporting_team_statistics convert_public_channel_to_private', system_custom_group_admin: 'create_custom_group edit_custom_group delete_custom_group restore_custom_group manage_custom_group_members', system_guest: 'create_group_channel create_direct_channel', system_manager: ' sysconsole_read_site_announcement_banner manage_private_channel_properties edit_brand read_private_channel_groups manage_private_channel_members manage_team_roles sysconsole_write_environment_session_lengths sysconsole_read_site_emoji sysconsole_write_environment_developer sysconsole_read_user_management_groups sysconsole_write_user_management_groups sysconsole_write_environment_rate_limiting delete_private_channel sysconsole_read_environment_performance_monitoring sysconsole_read_environment_rate_limiting sysconsole_write_user_management_teams sysconsole_write_integrations_integration_management sysconsole_write_site_public_links sysconsole_read_authentication_ldap sysconsole_write_integrations_cors reload_config sysconsole_write_user_management_channels sysconsole_read_environment_high_availability sysconsole_read_site_users_and_teams sysconsole_read_user_management_teams sysconsole_write_site_users_and_teams sysconsole_read_site_customization sysconsole_write_environment_high_availability sysconsole_read_integrations_bot_accounts sysconsole_read_authentication_guest_access sysconsole_read_site_public_links read_elasticsearch_post_indexing_job sysconsole_read_user_management_channels sysconsole_read_reporting_team_statistics invalidate_caches sysconsole_read_authentication_signup read_elasticsearch_post_aggregation_job sysconsole_write_environment_smtp manage_public_channel_members list_public_teams add_user_to_team sysconsole_read_environment_web_server sysconsole_read_site_localization get_logs sysconsole_write_site_posts sysconsole_write_integrations_bot_accounts sysconsole_write_user_management_permissions sysconsole_read_environment_elasticsearch sysconsole_read_environment_smtp list_private_teams read_public_channel_groups sysconsole_write_environment_file_storage sysconsole_write_integrations_gif manage_public_channel_properties sysconsole_write_environment_performance_monitoring sysconsole_write_site_notifications sysconsole_read_site_notifications sysconsole_read_environment_image_proxy sysconsole_write_site_announcement_banner sysconsole_write_site_emoji test_site_url sysconsole_read_integrations_gif sysconsole_write_environment_logging convert_public_channel_to_private get_analytics sysconsole_read_user_management_permissions sysconsole_write_environment_image_proxy test_elasticsearch recycle_database_connections sysconsole_write_site_localization sysconsole_read_reporting_server_logs create_elasticsearch_post_indexing_job sysconsole_read_reporting_site_statistics test_ldap delete_public_channel sysconsole_write_environment_push_notification_server read_license_information sysconsole_write_products_boards sysconsole_read_about_edition_and_license convert_private_channel_to_public sysconsole_read_integrations_integration_management create_elasticsearch_post_aggregation_job purge_elasticsearch_indexes sysconsole_read_environment_database join_public_teams sysconsole_read_authentication_email sysconsole_read_environment_push_notification_server view_team read_channel sysconsole_read_authentication_password read_ldap_sync_job sysconsole_read_integrations_cors sysconsole_read_environment_logging manage_team sysconsole_read_authentication_openid read_public_channel sysconsole_write_environment_elasticsearch sysconsole_read_plugins manage_channel_roles remove_user_from_team test_email sysconsole_write_site_file_sharing_and_downloads test_s3 sysconsole_read_site_file_sharing_and_downloads sysconsole_read_site_notices sysconsole_read_environment_file_storage join_private_teams sysconsole_read_products_boards sysconsole_read_environment_session_lengths sysconsole_write_environment_database sysconsole_read_authentication_saml sysconsole_read_authentication_mfa sysconsole_write_site_notices sysconsole_write_environment_web_server sysconsole_read_site_posts sysconsole_read_environment_developer sysconsole_write_site_customization', diff --git a/e2e-tests/playwright/README.md b/e2e-tests/playwright/README.md index 25dd2c9d68..0a2a005243 100644 --- a/e2e-tests/playwright/README.md +++ b/e2e-tests/playwright/README.md @@ -2,8 +2,21 @@ #### 1. Start local server in a separate terminal. +``` +# Typically run the local server with: +cd server && make run + +# Or build and distribute webapp including channels, boards and playbooks +# so that their product URLs do not rely on Webpack dev server. +# Especially important when running test inside the Playwright's docker container. +cd webapp && make dist +cd server && make run-server +``` + #### 2. Install dependencies and run the test. +Note: If you're using Node.js version 18 and above, you may need to set `NODE_OPTIONS='--no-experimental-fetch'`. + ``` # Install npm packages npm i @@ -32,14 +45,16 @@ npm run test Change to root directory, run docker container ``` -docker run -it --rm -v "$(pwd):/mattermost/" --ipc=host mcr.microsoft.com/playwright:v1.30.0-focal /bin/bash +docker run -it --rm -v "$(pwd):/mattermost/" --ipc=host mcr.microsoft.com/playwright:v1.32.0-focal /bin/bash ``` #### 2. Inside the docker container ``` +export NODE_OPTIONS='--no-experimental-fetch' export PW_BASE_URL=http://host.docker.internal:8065 -cd mattermost/e2e/playwright +export PW_HEADLESS=true +cd mattermost/e2e-tests/playwright # Install npm packages. Use "npm ci" to match the automated environment npm ci diff --git a/e2e-tests/playwright/package-lock.json b/e2e-tests/playwright/package-lock.json index ef9a9a8578..ef8f199c95 100644 --- a/e2e-tests/playwright/package-lock.json +++ b/e2e-tests/playwright/package-lock.json @@ -6,30 +6,31 @@ "packages": { "": { "dependencies": { - "@percy/cli": "1.18.0", + "@percy/cli": "1.23.0", "@percy/playwright": "1.0.4", - "@playwright/test": "1.30.0", + "@playwright/test": "1.32.3", "async-wait-until": "2.0.12", "chalk": "4.1.2", - "deepmerge": "4.3.0", + "deepmerge": "4.3.1", "dotenv": "16.0.3", "form-data": "4.0.0", "isomorphic-unfetch": "4.0.2", "uuid": "9.0.0" }, "devDependencies": { - "@types/uuid": "9.0.0", - "@typescript-eslint/eslint-plugin": "5.51.0", - "@typescript-eslint/parser": "5.51.0", - "eslint": "8.34.0", - "prettier": "2.8.4", - "typescript": "4.9.5" + "@types/uuid": "9.0.1", + "@typescript-eslint/eslint-plugin": "5.59.0", + "@typescript-eslint/parser": "5.59.0", + "cross-env": "7.0.3", + "eslint": "8.38.0", + "prettier": "2.8.7", + "typescript": "5.0.4" } }, "node_modules/@babel/code-frame": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.18.6.tgz", - "integrity": "sha512-TDCmlK5eOvH+eH7cdAFlNXeVJqWIQ7gW9tY1GJIpUtFb6CmjVyq2VM3u71bOyR8CRihcCgMUYoDNyLXao3+70Q==", + "version": "7.21.4", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.21.4.tgz", + "integrity": "sha512-LYvhNKfwWSPpocw8GI7gpK2nq3HSDuEPC/uSYaALSJu9xjsalaaYFOq0Pwt5KmVqwEbZlDu81aLXwBOmD/Fv9g==", "dependencies": { "@babel/highlight": "^7.18.6" }, @@ -58,17 +59,6 @@ "node": ">=6.9.0" } }, - "node_modules/@babel/highlight/node_modules/ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dependencies": { - "color-convert": "^1.9.0" - }, - "engines": { - "node": ">=4" - } - }, "node_modules/@babel/highlight/node_modules/chalk": { "version": "2.4.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", @@ -82,47 +72,39 @@ "node": ">=4" } }, - "node_modules/@babel/highlight/node_modules/color-convert": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", - "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "node_modules/@eslint-community/eslint-utils": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz", + "integrity": "sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA==", + "dev": true, "dependencies": { - "color-name": "1.1.3" - } - }, - "node_modules/@babel/highlight/node_modules/color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==" - }, - "node_modules/@babel/highlight/node_modules/has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", - "engines": { - "node": ">=4" - } - }, - "node_modules/@babel/highlight/node_modules/supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "dependencies": { - "has-flag": "^3.0.0" + "eslint-visitor-keys": "^3.3.0" }, "engines": { - "node": ">=4" + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "peerDependencies": { + "eslint": "^6.0.0 || ^7.0.0 || >=8.0.0" + } + }, + "node_modules/@eslint-community/regexpp": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.5.0.tgz", + "integrity": "sha512-vITaYzIcNmjn5tF5uxcZ/ft7/RXGrMUIS9HalWckEOF6ESiwXKoMzAQf2UW0aVd6rnOeExTJVd5hmWXucBKGXQ==", + "dev": true, + "engines": { + "node": "^12.0.0 || ^14.0.0 || >=16.0.0" } }, "node_modules/@eslint/eslintrc": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.4.1.tgz", - "integrity": "sha512-XXrH9Uarn0stsyldqDYq8r++mROmWRI1xKMXa640Bb//SY1+ECYX6VzT6Lcx5frD0V30XieqJ0oX9I2Xj5aoMA==", + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.0.2.tgz", + "integrity": "sha512-3W4f5tDUra+pA+FzgugqL2pRimUTDJWKr7BINqOpkZrC0uYI0NIc0/JFgBROCU07HR6GieA5m3/rsPIhDmCXTQ==", "dev": true, "dependencies": { "ajv": "^6.12.4", "debug": "^4.3.2", - "espree": "^9.4.0", + "espree": "^9.5.1", "globals": "^13.19.0", "ignore": "^5.2.0", "import-fresh": "^3.2.1", @@ -159,6 +141,15 @@ "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", "dev": true }, + "node_modules/@eslint/js": { + "version": "8.38.0", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.38.0.tgz", + "integrity": "sha512-IoD2MfUnOV58ghIHCiil01PcohxjbYR/qCxsoC+xNgUwh1EY8jOOrYmu3d3a71+tJJ23uscEV4X2HJWMsPJu4g==", + "dev": true, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + } + }, "node_modules/@humanwhocodes/config-array": { "version": "0.11.8", "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.8.tgz", @@ -225,19 +216,19 @@ } }, "node_modules/@percy/cli": { - "version": "1.18.0", - "resolved": "https://registry.npmjs.org/@percy/cli/-/cli-1.18.0.tgz", - "integrity": "sha512-yfvVh2uwTqMGxn2wF/RCvGVsyfXkeKOt05Cil4s8PRSBQ94iDY872lMJ3al0gSq0y4GLAH9CO7ZVt3uqD2tlBg==", + "version": "1.23.0", + "resolved": "https://registry.npmjs.org/@percy/cli/-/cli-1.23.0.tgz", + "integrity": "sha512-3S+QUWdeJq6ZUWoRNLuX+wdJx8civJdrSmYG9WS2CP9auJNbuA+13xQnB5AkkWUvHEcC/yXzZpi5NAjoW86jgw==", "dependencies": { - "@percy/cli-app": "1.18.0", - "@percy/cli-build": "1.18.0", - "@percy/cli-command": "1.18.0", - "@percy/cli-config": "1.18.0", - "@percy/cli-exec": "1.18.0", - "@percy/cli-snapshot": "1.18.0", - "@percy/cli-upload": "1.18.0", - "@percy/client": "1.18.0", - "@percy/logger": "1.18.0" + "@percy/cli-app": "1.23.0", + "@percy/cli-build": "1.23.0", + "@percy/cli-command": "1.23.0", + "@percy/cli-config": "1.23.0", + "@percy/cli-exec": "1.23.0", + "@percy/cli-snapshot": "1.23.0", + "@percy/cli-upload": "1.23.0", + "@percy/client": "1.23.0", + "@percy/logger": "1.23.0" }, "bin": { "percy": "bin/run.cjs" @@ -247,36 +238,36 @@ } }, "node_modules/@percy/cli-app": { - "version": "1.18.0", - "resolved": "https://registry.npmjs.org/@percy/cli-app/-/cli-app-1.18.0.tgz", - "integrity": "sha512-EAqD61ivuCwfl6PacXW9Wx9kTRvMPCBlQnxmrhx7jJG5tIp418p4XB3zkFOAirUa/LOdwNIVaPCHJyVAcJ1V5Q==", + "version": "1.23.0", + "resolved": "https://registry.npmjs.org/@percy/cli-app/-/cli-app-1.23.0.tgz", + "integrity": "sha512-2L5chuBFp016LlkB7BihGtm0XJFCZEDNIcOFchsK7l2REBUkxVeM6hNQ89uuP2F9eKXwWKqtDEIYCzdzW0hfIQ==", "dependencies": { - "@percy/cli-command": "1.18.0", - "@percy/cli-exec": "1.18.0" + "@percy/cli-command": "1.23.0", + "@percy/cli-exec": "1.23.0" }, "engines": { "node": ">=14" } }, "node_modules/@percy/cli-build": { - "version": "1.18.0", - "resolved": "https://registry.npmjs.org/@percy/cli-build/-/cli-build-1.18.0.tgz", - "integrity": "sha512-FuYWjXx4Wy0v27GpwxGX5qDq4xcLzlStbABNCp4H5RrNrLa1jkcViOKXTSurdjHYWlHHFWJUbk39D4g3ZRXOAA==", + "version": "1.23.0", + "resolved": "https://registry.npmjs.org/@percy/cli-build/-/cli-build-1.23.0.tgz", + "integrity": "sha512-qIhfU/UtPl181Dw2kR8klEYLUlA5C8GE0M9781vz7D0W3LriccaLLLo1wBp4q4bo83uvUBvNJhq9/S4T38kPEQ==", "dependencies": { - "@percy/cli-command": "1.18.0" + "@percy/cli-command": "1.23.0" }, "engines": { "node": ">=14" } }, "node_modules/@percy/cli-command": { - "version": "1.18.0", - "resolved": "https://registry.npmjs.org/@percy/cli-command/-/cli-command-1.18.0.tgz", - "integrity": "sha512-2dHJalp83IygD/FqXCFNND22z7f4r5uZxqr5GAyiJ0STkQYitTgwkUp+4IRdfK1zmi+A2dbyYU0xV9txEW5v8g==", + "version": "1.23.0", + "resolved": "https://registry.npmjs.org/@percy/cli-command/-/cli-command-1.23.0.tgz", + "integrity": "sha512-tXj5vv2BQMBmn3ZL2YNqYYrmJLyYnBqwyJkecY2BwXQsKAIv3qBgTzr1d5+LxTOi5ArjFCHAgk2w4ohy6h6t4w==", "dependencies": { - "@percy/config": "1.18.0", - "@percy/core": "1.18.0", - "@percy/logger": "1.18.0" + "@percy/config": "1.23.0", + "@percy/core": "1.23.0", + "@percy/logger": "1.23.0" }, "bin": { "percy-cli-readme": "bin/readme.js" @@ -286,22 +277,22 @@ } }, "node_modules/@percy/cli-config": { - "version": "1.18.0", - "resolved": "https://registry.npmjs.org/@percy/cli-config/-/cli-config-1.18.0.tgz", - "integrity": "sha512-N5I7av5SGO5n0YC61wbqVniNxFwAQFFubKyGyGaVlQkmKyRuYCmDMHlPdSv3zyvVD1ZJCvtDzi/VqQGDubEieg==", + "version": "1.23.0", + "resolved": "https://registry.npmjs.org/@percy/cli-config/-/cli-config-1.23.0.tgz", + "integrity": "sha512-tI4c4MhU41rx9n7fYZrpn4gaOD9dA6PnefP397v7smqEWh7MJ+cxI/nyKU0/9G2wGjMhYACaLoR4BiCWOQZAkw==", "dependencies": { - "@percy/cli-command": "1.18.0" + "@percy/cli-command": "1.23.0" }, "engines": { "node": ">=14" } }, "node_modules/@percy/cli-exec": { - "version": "1.18.0", - "resolved": "https://registry.npmjs.org/@percy/cli-exec/-/cli-exec-1.18.0.tgz", - "integrity": "sha512-4y+XIsYS5KypJmTtGKyKFU4GZ6902dCcEMJNDc69grSsco9N2lBG2gsvChCrCA2gDT8nUvKng9z9KF2OiMvF3w==", + "version": "1.23.0", + "resolved": "https://registry.npmjs.org/@percy/cli-exec/-/cli-exec-1.23.0.tgz", + "integrity": "sha512-ecxnMWxUlVx0EswGraHgN4LvWbXeUZQZUxJ9wYmMSgDEaKfEiEZ5WTLSKzQAxyfw2SjoQ3cHRZbKh4qMlCgbAg==", "dependencies": { - "@percy/cli-command": "1.18.0", + "@percy/cli-command": "1.23.0", "cross-spawn": "^7.0.3", "which": "^2.0.2" }, @@ -310,11 +301,11 @@ } }, "node_modules/@percy/cli-snapshot": { - "version": "1.18.0", - "resolved": "https://registry.npmjs.org/@percy/cli-snapshot/-/cli-snapshot-1.18.0.tgz", - "integrity": "sha512-3a7HqJU/wCT7fKraYw6S4cs8KrlUZ0MbDV9/dEbFh9nSfz0BLQjcK+kL8OzjxM+bVwZ6pf62FJl44nVLpXqrGw==", + "version": "1.23.0", + "resolved": "https://registry.npmjs.org/@percy/cli-snapshot/-/cli-snapshot-1.23.0.tgz", + "integrity": "sha512-QOrUfyPCnjfIAcUBjNlO299NRPDxofcYQUCBYZE3CtemsNFtygFt0yPnZCwWmt0voSpnPl1Izc6/FA3wYUfuBQ==", "dependencies": { - "@percy/cli-command": "1.18.0", + "@percy/cli-command": "1.23.0", "yaml": "^2.0.0" }, "engines": { @@ -322,11 +313,11 @@ } }, "node_modules/@percy/cli-upload": { - "version": "1.18.0", - "resolved": "https://registry.npmjs.org/@percy/cli-upload/-/cli-upload-1.18.0.tgz", - "integrity": "sha512-JSRoE0aTnBH1HGNGmDJxGNkNIGor7H8pv6lO8AUiwCwQ55EHgLqtWlhwq+2AHz7QOiGD8aOHQTwJk6GcCIIa3A==", + "version": "1.23.0", + "resolved": "https://registry.npmjs.org/@percy/cli-upload/-/cli-upload-1.23.0.tgz", + "integrity": "sha512-faRHjzaUf21RK9Ra051gKUl4HmMNPZxUKSZNmdG0yP+tc5KxU9cXkmEeCKGH7LOcVs0IfyRX0vv58YEZ6GsIRw==", "dependencies": { - "@percy/cli-command": "1.18.0", + "@percy/cli-command": "1.23.0", "fast-glob": "^3.2.11", "image-size": "^1.0.0" }, @@ -335,23 +326,23 @@ } }, "node_modules/@percy/client": { - "version": "1.18.0", - "resolved": "https://registry.npmjs.org/@percy/client/-/client-1.18.0.tgz", - "integrity": "sha512-onuVIpB6TPNjEhLlPsyhJYXTY2xdv3iNx4bj8Yfk751vQ33US2z4FEWDQKIEvHJGcFT7NEIHXFT3bYcFDmREdQ==", + "version": "1.23.0", + "resolved": "https://registry.npmjs.org/@percy/client/-/client-1.23.0.tgz", + "integrity": "sha512-m0qNCrlfh6Pf0t2GfoeShuK7r2GeRk5rWVjIbdnDigvmtL0G+HJM1gvysLOxzKFHkZ1cLBfM1SnH1Yn6RM/6qQ==", "dependencies": { - "@percy/env": "1.18.0", - "@percy/logger": "1.18.0" + "@percy/env": "1.23.0", + "@percy/logger": "1.23.0" }, "engines": { "node": ">=14" } }, "node_modules/@percy/config": { - "version": "1.18.0", - "resolved": "https://registry.npmjs.org/@percy/config/-/config-1.18.0.tgz", - "integrity": "sha512-bjAiZuhORij3vxeolVjpf7ZU1Sjqv2Y9CgsBthoIu20f5o0a10w6JGgPkDjT3NaAIZDXgbxVsrWovlslbRC57w==", + "version": "1.23.0", + "resolved": "https://registry.npmjs.org/@percy/config/-/config-1.23.0.tgz", + "integrity": "sha512-giPIdNLcG1Qg0dkc/VDOkTzI4szzM4QAoJfMLEP0UYPkIU2Y0Xc8NH5GN3DEiudRJge72iGfeah6GugxmXmKXw==", "dependencies": { - "@percy/logger": "1.18.0", + "@percy/logger": "1.23.0", "ajv": "^8.6.2", "cosmiconfig": "^7.0.0", "yaml": "^2.0.0" @@ -361,15 +352,15 @@ } }, "node_modules/@percy/core": { - "version": "1.18.0", - "resolved": "https://registry.npmjs.org/@percy/core/-/core-1.18.0.tgz", - "integrity": "sha512-9d8mkE6bfp0nRxhnGgC8N2KBG+MRiCxfvmZGfKENEoSY8NTTjJ5LqF+ol1JRwQ+uTABPZgy9XItWLINrS3yC1Q==", + "version": "1.23.0", + "resolved": "https://registry.npmjs.org/@percy/core/-/core-1.23.0.tgz", + "integrity": "sha512-/BNHdvbD7r1p3k3HWgxYLBo2L2Ye9RDcmTuA6en2xUYaagf+0vfcAK8iyBvVm6ir2ZjAsMW0PGRa7OIfetvHHg==", "hasInstallScript": true, "dependencies": { - "@percy/client": "1.18.0", - "@percy/config": "1.18.0", - "@percy/dom": "1.18.0", - "@percy/logger": "1.18.0", + "@percy/client": "1.23.0", + "@percy/config": "1.23.0", + "@percy/dom": "1.23.0", + "@percy/logger": "1.23.0", "content-disposition": "^0.5.4", "cross-spawn": "^7.0.3", "extract-zip": "^2.0.1", @@ -385,22 +376,22 @@ } }, "node_modules/@percy/dom": { - "version": "1.18.0", - "resolved": "https://registry.npmjs.org/@percy/dom/-/dom-1.18.0.tgz", - "integrity": "sha512-FoaUgmdCaymSVV/5UQsDwPlZYpSymViODiGJxEJnfESKB4L5aNWQTL3QefFOAI67Q9lUIezW7oueLPsH2XlCNg==" + "version": "1.23.0", + "resolved": "https://registry.npmjs.org/@percy/dom/-/dom-1.23.0.tgz", + "integrity": "sha512-68q3ceCWsWpUFyF/pnELSCTdbTAibGVyNwp+iZCFd/914sUhERYrrX8AqCgkCDerOzCwAQZQDe2Nv3jaB+d0ng==" }, "node_modules/@percy/env": { - "version": "1.18.0", - "resolved": "https://registry.npmjs.org/@percy/env/-/env-1.18.0.tgz", - "integrity": "sha512-b+RTDPst4yKk67EQMjGeBIjfAkqZy2jUXgW3SKaNCyCOzI+16IXJ1gJSrniv29TpxgqDa1y3OUyWTPkmuDVi2A==", + "version": "1.23.0", + "resolved": "https://registry.npmjs.org/@percy/env/-/env-1.23.0.tgz", + "integrity": "sha512-oKvJBC/Zhfwp2QpFBpfHeAVuGhgaPeI7S4H2/68XT30pInfVJzaCjD/8ySAELGyMWmgHc51s+k09DZCo3C3Gyg==", "engines": { "node": ">=14" } }, "node_modules/@percy/logger": { - "version": "1.18.0", - "resolved": "https://registry.npmjs.org/@percy/logger/-/logger-1.18.0.tgz", - "integrity": "sha512-ZC9OqaTVPjnndcSfbQaU0NcquC0J4KZFx7hEDznukXNsLIK4WSLiEK1QS+tGxAkIKZilHmVc/vv9q3lMvlQDaQ==", + "version": "1.23.0", + "resolved": "https://registry.npmjs.org/@percy/logger/-/logger-1.23.0.tgz", + "integrity": "sha512-kNtdKQ9Kou/RcWgDoSK+ofOVqOzuzyHBNsK+I92XNh8HHO6ow08Cmw+LtZbDxmj3uq7nXG9Nhgj4ZqSgdk7J6Q==", "engines": { "node": ">=14" } @@ -428,18 +419,21 @@ } }, "node_modules/@playwright/test": { - "version": "1.30.0", - "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.30.0.tgz", - "integrity": "sha512-SVxkQw1xvn/Wk/EvBnqWIq6NLo1AppwbYOjNLmyU0R1RoQ3rLEBtmjTnElcnz8VEtn11fptj1ECxK0tgURhajw==", + "version": "1.32.3", + "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.32.3.tgz", + "integrity": "sha512-BvWNvK0RfBriindxhLVabi8BRe3X0J9EVjKlcmhxjg4giWBD/xleLcg2dz7Tx0agu28rczjNIPQWznwzDwVsZQ==", "dependencies": { "@types/node": "*", - "playwright-core": "1.30.0" + "playwright-core": "1.32.3" }, "bin": { "playwright": "cli.js" }, "engines": { "node": ">=14" + }, + "optionalDependencies": { + "fsevents": "2.3.2" } }, "node_modules/@types/json-schema": { @@ -465,9 +459,9 @@ "dev": true }, "node_modules/@types/uuid": { - "version": "9.0.0", - "resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-9.0.0.tgz", - "integrity": "sha512-kr90f+ERiQtKWMz5rP32ltJ/BtULDI5RVO0uavn1HQUOwjx0R1h0rnDYNL0CepF1zL5bSY6FISAfd9tOdDhU5Q==", + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-9.0.1.tgz", + "integrity": "sha512-rFT3ak0/2trgvp4yYZo5iKFEPsET7vKydKF+VRCxlQ9bpheehyAJH89dAkaLEq/j/RZXJIqcgsmPJKUP1Z28HA==", "dev": true }, "node_modules/@types/yauzl": { @@ -480,19 +474,19 @@ } }, "node_modules/@typescript-eslint/eslint-plugin": { - "version": "5.51.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.51.0.tgz", - "integrity": "sha512-wcAwhEWm1RgNd7dxD/o+nnLW8oH+6RK1OGnmbmkj/GGoDPV1WWMVP0FXYQBivKHdwM1pwii3bt//RC62EriIUQ==", + "version": "5.59.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.59.0.tgz", + "integrity": "sha512-p0QgrEyrxAWBecR56gyn3wkG15TJdI//eetInP3zYRewDh0XS+DhB3VUAd3QqvziFsfaQIoIuZMxZRB7vXYaYw==", "dev": true, "dependencies": { - "@typescript-eslint/scope-manager": "5.51.0", - "@typescript-eslint/type-utils": "5.51.0", - "@typescript-eslint/utils": "5.51.0", + "@eslint-community/regexpp": "^4.4.0", + "@typescript-eslint/scope-manager": "5.59.0", + "@typescript-eslint/type-utils": "5.59.0", + "@typescript-eslint/utils": "5.59.0", "debug": "^4.3.4", "grapheme-splitter": "^1.0.4", "ignore": "^5.2.0", "natural-compare-lite": "^1.4.0", - "regexpp": "^3.2.0", "semver": "^7.3.7", "tsutils": "^3.21.0" }, @@ -514,14 +508,14 @@ } }, "node_modules/@typescript-eslint/parser": { - "version": "5.51.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.51.0.tgz", - "integrity": "sha512-fEV0R9gGmfpDeRzJXn+fGQKcl0inIeYobmmUWijZh9zA7bxJ8clPhV9up2ZQzATxAiFAECqPQyMDB4o4B81AaA==", + "version": "5.59.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.59.0.tgz", + "integrity": "sha512-qK9TZ70eJtjojSUMrrEwA9ZDQ4N0e/AuoOIgXuNBorXYcBDk397D2r5MIe1B3cok/oCtdNC5j+lUUpVB+Dpb+w==", "dev": true, "dependencies": { - "@typescript-eslint/scope-manager": "5.51.0", - "@typescript-eslint/types": "5.51.0", - "@typescript-eslint/typescript-estree": "5.51.0", + "@typescript-eslint/scope-manager": "5.59.0", + "@typescript-eslint/types": "5.59.0", + "@typescript-eslint/typescript-estree": "5.59.0", "debug": "^4.3.4" }, "engines": { @@ -541,13 +535,13 @@ } }, "node_modules/@typescript-eslint/scope-manager": { - "version": "5.51.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.51.0.tgz", - "integrity": "sha512-gNpxRdlx5qw3yaHA0SFuTjW4rxeYhpHxt491PEcKF8Z6zpq0kMhe0Tolxt0qjlojS+/wArSDlj/LtE69xUJphQ==", + "version": "5.59.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.59.0.tgz", + "integrity": "sha512-tsoldKaMh7izN6BvkK6zRMINj4Z2d6gGhO2UsI8zGZY3XhLq1DndP3Ycjhi1JwdwPRwtLMW4EFPgpuKhbCGOvQ==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.51.0", - "@typescript-eslint/visitor-keys": "5.51.0" + "@typescript-eslint/types": "5.59.0", + "@typescript-eslint/visitor-keys": "5.59.0" }, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -558,13 +552,13 @@ } }, "node_modules/@typescript-eslint/type-utils": { - "version": "5.51.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.51.0.tgz", - "integrity": "sha512-QHC5KKyfV8sNSyHqfNa0UbTbJ6caB8uhcx2hYcWVvJAZYJRBo5HyyZfzMdRx8nvS+GyMg56fugMzzWnojREuQQ==", + "version": "5.59.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.59.0.tgz", + "integrity": "sha512-d/B6VSWnZwu70kcKQSCqjcXpVH+7ABKH8P1KNn4K7j5PXXuycZTPXF44Nui0TEm6rbWGi8kc78xRgOC4n7xFgA==", "dev": true, "dependencies": { - "@typescript-eslint/typescript-estree": "5.51.0", - "@typescript-eslint/utils": "5.51.0", + "@typescript-eslint/typescript-estree": "5.59.0", + "@typescript-eslint/utils": "5.59.0", "debug": "^4.3.4", "tsutils": "^3.21.0" }, @@ -585,9 +579,9 @@ } }, "node_modules/@typescript-eslint/types": { - "version": "5.51.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.51.0.tgz", - "integrity": "sha512-SqOn0ANn/v6hFn0kjvLwiDi4AzR++CBZz0NV5AnusT2/3y32jdc0G4woXPWHCumWtUXZKPAS27/9vziSsC9jnw==", + "version": "5.59.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.59.0.tgz", + "integrity": "sha512-yR2h1NotF23xFFYKHZs17QJnB51J/s+ud4PYU4MqdZbzeNxpgUr05+dNeCN/bb6raslHvGdd6BFCkVhpPk/ZeA==", "dev": true, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -598,13 +592,13 @@ } }, "node_modules/@typescript-eslint/typescript-estree": { - "version": "5.51.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.51.0.tgz", - "integrity": "sha512-TSkNupHvNRkoH9FMA3w7TazVFcBPveAAmb7Sz+kArY6sLT86PA5Vx80cKlYmd8m3Ha2SwofM1KwraF24lM9FvA==", + "version": "5.59.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.59.0.tgz", + "integrity": "sha512-sUNnktjmI8DyGzPdZ8dRwW741zopGxltGs/SAPgGL/AAgDpiLsCFLcMNSpbfXfmnNeHmK9h3wGmCkGRGAoUZAg==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.51.0", - "@typescript-eslint/visitor-keys": "5.51.0", + "@typescript-eslint/types": "5.59.0", + "@typescript-eslint/visitor-keys": "5.59.0", "debug": "^4.3.4", "globby": "^11.1.0", "is-glob": "^4.0.3", @@ -625,18 +619,18 @@ } }, "node_modules/@typescript-eslint/utils": { - "version": "5.51.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.51.0.tgz", - "integrity": "sha512-76qs+5KWcaatmwtwsDJvBk4H76RJQBFe+Gext0EfJdC3Vd2kpY2Pf//OHHzHp84Ciw0/rYoGTDnIAr3uWhhJYw==", + "version": "5.59.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.59.0.tgz", + "integrity": "sha512-GGLFd+86drlHSvPgN/el6dRQNYYGOvRSDVydsUaQluwIW3HvbXuxyuD5JETvBt/9qGYe+lOrDk6gRrWOHb/FvA==", "dev": true, "dependencies": { + "@eslint-community/eslint-utils": "^4.2.0", "@types/json-schema": "^7.0.9", "@types/semver": "^7.3.12", - "@typescript-eslint/scope-manager": "5.51.0", - "@typescript-eslint/types": "5.51.0", - "@typescript-eslint/typescript-estree": "5.51.0", + "@typescript-eslint/scope-manager": "5.59.0", + "@typescript-eslint/types": "5.59.0", + "@typescript-eslint/typescript-estree": "5.59.0", "eslint-scope": "^5.1.1", - "eslint-utils": "^3.0.0", "semver": "^7.3.7" }, "engines": { @@ -651,12 +645,12 @@ } }, "node_modules/@typescript-eslint/visitor-keys": { - "version": "5.51.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.51.0.tgz", - "integrity": "sha512-Oh2+eTdjHjOFjKA27sxESlA87YPSOJafGCR0md5oeMdh1ZcCfAGCIOL216uTBAkAIptvLIfKQhl7lHxMJet4GQ==", + "version": "5.59.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.59.0.tgz", + "integrity": "sha512-qZ3iXxQhanchCeaExlKPV3gDQFxMUmU35xfd5eCXB6+kUw1TUAbIy2n7QIrwz9s98DQLzNWyHp61fY0da4ZcbA==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.51.0", + "@typescript-eslint/types": "5.59.0", "eslint-visitor-keys": "^3.3.0" }, "engines": { @@ -713,17 +707,14 @@ } }, "node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", "dependencies": { - "color-convert": "^2.0.1" + "color-convert": "^1.9.0" }, "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" + "node": ">=4" } }, "node_modules/argparse": { @@ -811,7 +802,21 @@ "url": "https://github.com/chalk/chalk?sponsor=1" } }, - "node_modules/color-convert": { + "node_modules/chalk/node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/chalk/node_modules/color-convert": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", @@ -822,11 +827,43 @@ "node": ">=7.0.0" } }, - "node_modules/color-name": { + "node_modules/chalk/node_modules/color-name": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" }, + "node_modules/chalk/node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "engines": { + "node": ">=8" + } + }, + "node_modules/chalk/node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dependencies": { + "color-name": "1.1.3" + } + }, + "node_modules/color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==" + }, "node_modules/combined-stream": { "version": "1.0.8", "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", @@ -877,6 +914,24 @@ "node": ">= 6" } }, + "node_modules/cross-env": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-env/-/cross-env-7.0.3.tgz", + "integrity": "sha512-+/HKd6EgcQCJGh2PSjZuUitQBQynKor4wrFbRg4DtAgS1aWO+gU52xpH7M9ScGgXSYmAVS9bIJ8EzuaGw0oNAw==", + "dev": true, + "dependencies": { + "cross-spawn": "^7.0.1" + }, + "bin": { + "cross-env": "src/bin/cross-env.js", + "cross-env-shell": "src/bin/cross-env-shell.js" + }, + "engines": { + "node": ">=10.14", + "npm": ">=6", + "yarn": ">=1" + } + }, "node_modules/cross-spawn": { "version": "7.0.3", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", @@ -918,9 +973,9 @@ "dev": true }, "node_modules/deepmerge": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.3.0.tgz", - "integrity": "sha512-z2wJZXrmeHdvYJp/Ux55wIjqo81G5Bp4c+oELTW+7ar6SogWHajt5a9gO3s3IDaGSAXjDk0vlQKN3rms8ab3og==", + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.3.1.tgz", + "integrity": "sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A==", "engines": { "node": ">=0.10.0" } @@ -990,12 +1045,15 @@ } }, "node_modules/eslint": { - "version": "8.34.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.34.0.tgz", - "integrity": "sha512-1Z8iFsucw+7kSqXNZVslXS8Ioa4u2KM7GPwuKtkTFAqZ/cHMcEaR+1+Br0wLlot49cNxIiZk5wp8EAbPcYZxTg==", + "version": "8.38.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.38.0.tgz", + "integrity": "sha512-pIdsD2jwlUGf/U38Jv97t8lq6HpaU/G9NKbYmpWpZGw3LdTNhZLbJePqxOXGB5+JEKfOPU/XLxYxFh03nr1KTg==", "dev": true, "dependencies": { - "@eslint/eslintrc": "^1.4.1", + "@eslint-community/eslint-utils": "^4.2.0", + "@eslint-community/regexpp": "^4.4.0", + "@eslint/eslintrc": "^2.0.2", + "@eslint/js": "8.38.0", "@humanwhocodes/config-array": "^0.11.8", "@humanwhocodes/module-importer": "^1.0.1", "@nodelib/fs.walk": "^1.2.8", @@ -1006,10 +1064,9 @@ "doctrine": "^3.0.0", "escape-string-regexp": "^4.0.0", "eslint-scope": "^7.1.1", - "eslint-utils": "^3.0.0", - "eslint-visitor-keys": "^3.3.0", - "espree": "^9.4.0", - "esquery": "^1.4.0", + "eslint-visitor-keys": "^3.4.0", + "espree": "^9.5.1", + "esquery": "^1.4.2", "esutils": "^2.0.2", "fast-deep-equal": "^3.1.3", "file-entry-cache": "^6.0.1", @@ -1030,7 +1087,6 @@ "minimatch": "^3.1.2", "natural-compare": "^1.4.0", "optionator": "^0.9.1", - "regexpp": "^3.2.0", "strip-ansi": "^6.0.1", "strip-json-comments": "^3.1.0", "text-table": "^0.2.0" @@ -1067,40 +1123,16 @@ "node": ">=4.0" } }, - "node_modules/eslint-utils": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-3.0.0.tgz", - "integrity": "sha512-uuQC43IGctw68pJA1RgbQS8/NP7rch6Cwd4j3ZBtgo4/8Flj4eGE7ZYSZRN3iq5pVUv6GPdW5Z1RFleo84uLDA==", - "dev": true, - "dependencies": { - "eslint-visitor-keys": "^2.0.0" - }, - "engines": { - "node": "^10.0.0 || ^12.0.0 || >= 14.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/mysticatea" - }, - "peerDependencies": { - "eslint": ">=5" - } - }, - "node_modules/eslint-utils/node_modules/eslint-visitor-keys": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz", - "integrity": "sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw==", - "dev": true, - "engines": { - "node": ">=10" - } - }, "node_modules/eslint-visitor-keys": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.3.0.tgz", - "integrity": "sha512-mQ+suqKJVyeuwGYHAdjMFqjCyfl8+Ldnxuyp3ldiMBFKkvytrXUZWaiPCEav8qDHKty44bD+qV1IP4T+w+xXRA==", + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.0.tgz", + "integrity": "sha512-HPpKPUBQcAsZOsHAFwTtIKcYlCje62XB7SEAcxjtmW6TD1WVpkS6i6/hOVtTZIl4zGj/mBqpFVGvaDneik+VoQ==", "dev": true, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" } }, "node_modules/eslint/node_modules/ajv": { @@ -1151,14 +1183,14 @@ "dev": true }, "node_modules/espree": { - "version": "9.4.1", - "resolved": "https://registry.npmjs.org/espree/-/espree-9.4.1.tgz", - "integrity": "sha512-XwctdmTO6SIvCzd9810yyNzIrOrqNYV9Koizx4C/mRhf9uq0o4yHoCEU/670pOxOL/MSraektvSAji79kX90Vg==", + "version": "9.5.1", + "resolved": "https://registry.npmjs.org/espree/-/espree-9.5.1.tgz", + "integrity": "sha512-5yxtHSZXRSW5pvv3hAlXM5+/Oswi1AUFqBmbibKb5s6bp3rGIDkyXU6xCoyuuLhijr4SFwPrXRoZjz0AZDN9tg==", "dev": true, "dependencies": { "acorn": "^8.8.0", "acorn-jsx": "^5.3.2", - "eslint-visitor-keys": "^3.3.0" + "eslint-visitor-keys": "^3.4.0" }, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -1168,9 +1200,9 @@ } }, "node_modules/esquery": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.4.0.tgz", - "integrity": "sha512-cCDispWt5vHHtwMY2YrAQ4ibFkAL8RbH5YGBnZBc90MolvvfkkQcJro/aZiAQUlQ3qgrYS6D6v8Gc5G5CQsc9w==", + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.5.0.tgz", + "integrity": "sha512-YQLXUplAwJgCydQ78IMJywZCceoqk1oH01OERdSAJc/7U2AylwjhSCLDEtqwg811idIS/9fIU5GjG73IgjKMVg==", "dev": true, "dependencies": { "estraverse": "^5.1.0" @@ -1396,6 +1428,19 @@ "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" }, + "node_modules/fsevents": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", + "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", + "hasInstallScript": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, "node_modules/get-stream": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz", @@ -1483,11 +1528,11 @@ "dev": true }, "node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", "engines": { - "node": ">=8" + "node": ">=4" } }, "node_modules/ignore": { @@ -1927,9 +1972,9 @@ } }, "node_modules/playwright-core": { - "version": "1.30.0", - "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.30.0.tgz", - "integrity": "sha512-7AnRmTCf+GVYhHbLJsGUtskWTE33SwMZkybJ0v6rqR1boxq2x36U7p1vDRV7HO2IwTZgmycracLxPEJI49wu4g==", + "version": "1.32.3", + "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.32.3.tgz", + "integrity": "sha512-SB+cdrnu74ZIn5Ogh/8278ngEh9NEEV0vR4sJFmK04h2iZpybfbqBY0bX6+BLYWVdV12JLLI+JEFtSnYgR+mWg==", "bin": { "playwright": "cli.js" }, @@ -1947,9 +1992,9 @@ } }, "node_modules/prettier": { - "version": "2.8.4", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.4.tgz", - "integrity": "sha512-vIS4Rlc2FNh0BySk3Wkd6xmwxB0FpOndW5fisM5H8hsZSxU2VWVB5CWIkIjWvrHjIhxk2g3bfMKM87zNTrZddw==", + "version": "2.8.7", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.7.tgz", + "integrity": "sha512-yPngTo3aXUUmyuTjeTUT75txrf+aMh9FiD7q9ZE/i6r0bPb22g4FsE6Y338PQX1bmfy08i9QQCB7/rcUAVntfw==", "dev": true, "bin": { "prettier": "bin-prettier.js" @@ -2005,18 +2050,6 @@ } ] }, - "node_modules/regexpp": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-3.2.0.tgz", - "integrity": "sha512-pq2bWo9mVD43nbts2wGv17XLiNLya+GklZ8kaDLV2Z08gDCsGpnKn9BFMepvWuHCbyVvY7J5o5+BVvoQbmlJLg==", - "dev": true, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/mysticatea" - } - }, "node_modules/require-from-string": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", @@ -2183,14 +2216,14 @@ } }, "node_modules/supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", "dependencies": { - "has-flag": "^4.0.0" + "has-flag": "^3.0.0" }, "engines": { - "node": ">=8" + "node": ">=4" } }, "node_modules/text-table": { @@ -2256,16 +2289,16 @@ } }, "node_modules/typescript": { - "version": "4.9.5", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz", - "integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==", + "version": "5.0.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.0.4.tgz", + "integrity": "sha512-cW9T5W9xY37cc+jfEnaUvX91foxtHkza3Nw3wkoF4sSlKn0MONdkdEndig/qPBWXNkmplh3NzayQzCiHM4/hqw==", "dev": true, "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" }, "engines": { - "node": ">=4.2.0" + "node": ">=12.20" } }, "node_modules/unfetch": { @@ -2326,9 +2359,9 @@ "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" }, "node_modules/ws": { - "version": "8.12.0", - "resolved": "https://registry.npmjs.org/ws/-/ws-8.12.0.tgz", - "integrity": "sha512-kU62emKIdKVeEIOIKVegvqpXMSTAMLJozpHZaJNDYqBjzlSYXQGviYwN1osDLJ9av68qHd4a2oSjd7yD4pacig==", + "version": "8.13.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.13.0.tgz", + "integrity": "sha512-x9vcZYTrFPC7aSIbj7sRCYo7L/Xb8Iy+pW0ng0wt2vCJv7M9HOMy0UoN3rr+IFC7hb7vXoqS+P9ktyLLLhO+LA==", "engines": { "node": ">=10.0.0" }, @@ -2377,9 +2410,9 @@ }, "dependencies": { "@babel/code-frame": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.18.6.tgz", - "integrity": "sha512-TDCmlK5eOvH+eH7cdAFlNXeVJqWIQ7gW9tY1GJIpUtFb6CmjVyq2VM3u71bOyR8CRihcCgMUYoDNyLXao3+70Q==", + "version": "7.21.4", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.21.4.tgz", + "integrity": "sha512-LYvhNKfwWSPpocw8GI7gpK2nq3HSDuEPC/uSYaALSJu9xjsalaaYFOq0Pwt5KmVqwEbZlDu81aLXwBOmD/Fv9g==", "requires": { "@babel/highlight": "^7.18.6" } @@ -2399,14 +2432,6 @@ "js-tokens": "^4.0.0" }, "dependencies": { - "ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "requires": { - "color-convert": "^1.9.0" - } - }, "chalk": { "version": "2.4.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", @@ -2416,44 +2441,33 @@ "escape-string-regexp": "^1.0.5", "supports-color": "^5.3.0" } - }, - "color-convert": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", - "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", - "requires": { - "color-name": "1.1.3" - } - }, - "color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==" - }, - "has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==" - }, - "supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "requires": { - "has-flag": "^3.0.0" - } } } }, + "@eslint-community/eslint-utils": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz", + "integrity": "sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA==", + "dev": true, + "requires": { + "eslint-visitor-keys": "^3.3.0" + } + }, + "@eslint-community/regexpp": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.5.0.tgz", + "integrity": "sha512-vITaYzIcNmjn5tF5uxcZ/ft7/RXGrMUIS9HalWckEOF6ESiwXKoMzAQf2UW0aVd6rnOeExTJVd5hmWXucBKGXQ==", + "dev": true + }, "@eslint/eslintrc": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.4.1.tgz", - "integrity": "sha512-XXrH9Uarn0stsyldqDYq8r++mROmWRI1xKMXa640Bb//SY1+ECYX6VzT6Lcx5frD0V30XieqJ0oX9I2Xj5aoMA==", + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.0.2.tgz", + "integrity": "sha512-3W4f5tDUra+pA+FzgugqL2pRimUTDJWKr7BINqOpkZrC0uYI0NIc0/JFgBROCU07HR6GieA5m3/rsPIhDmCXTQ==", "dev": true, "requires": { "ajv": "^6.12.4", "debug": "^4.3.2", - "espree": "^9.4.0", + "espree": "^9.5.1", "globals": "^13.19.0", "ignore": "^5.2.0", "import-fresh": "^3.2.1", @@ -2482,6 +2496,12 @@ } } }, + "@eslint/js": { + "version": "8.38.0", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.38.0.tgz", + "integrity": "sha512-IoD2MfUnOV58ghIHCiil01PcohxjbYR/qCxsoC+xNgUwh1EY8jOOrYmu3d3a71+tJJ23uscEV4X2HJWMsPJu4g==", + "dev": true + }, "@humanwhocodes/config-array": { "version": "0.11.8", "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.8.tgz", @@ -2529,114 +2549,114 @@ } }, "@percy/cli": { - "version": "1.18.0", - "resolved": "https://registry.npmjs.org/@percy/cli/-/cli-1.18.0.tgz", - "integrity": "sha512-yfvVh2uwTqMGxn2wF/RCvGVsyfXkeKOt05Cil4s8PRSBQ94iDY872lMJ3al0gSq0y4GLAH9CO7ZVt3uqD2tlBg==", + "version": "1.23.0", + "resolved": "https://registry.npmjs.org/@percy/cli/-/cli-1.23.0.tgz", + "integrity": "sha512-3S+QUWdeJq6ZUWoRNLuX+wdJx8civJdrSmYG9WS2CP9auJNbuA+13xQnB5AkkWUvHEcC/yXzZpi5NAjoW86jgw==", "requires": { - "@percy/cli-app": "1.18.0", - "@percy/cli-build": "1.18.0", - "@percy/cli-command": "1.18.0", - "@percy/cli-config": "1.18.0", - "@percy/cli-exec": "1.18.0", - "@percy/cli-snapshot": "1.18.0", - "@percy/cli-upload": "1.18.0", - "@percy/client": "1.18.0", - "@percy/logger": "1.18.0" + "@percy/cli-app": "1.23.0", + "@percy/cli-build": "1.23.0", + "@percy/cli-command": "1.23.0", + "@percy/cli-config": "1.23.0", + "@percy/cli-exec": "1.23.0", + "@percy/cli-snapshot": "1.23.0", + "@percy/cli-upload": "1.23.0", + "@percy/client": "1.23.0", + "@percy/logger": "1.23.0" } }, "@percy/cli-app": { - "version": "1.18.0", - "resolved": "https://registry.npmjs.org/@percy/cli-app/-/cli-app-1.18.0.tgz", - "integrity": "sha512-EAqD61ivuCwfl6PacXW9Wx9kTRvMPCBlQnxmrhx7jJG5tIp418p4XB3zkFOAirUa/LOdwNIVaPCHJyVAcJ1V5Q==", + "version": "1.23.0", + "resolved": "https://registry.npmjs.org/@percy/cli-app/-/cli-app-1.23.0.tgz", + "integrity": "sha512-2L5chuBFp016LlkB7BihGtm0XJFCZEDNIcOFchsK7l2REBUkxVeM6hNQ89uuP2F9eKXwWKqtDEIYCzdzW0hfIQ==", "requires": { - "@percy/cli-command": "1.18.0", - "@percy/cli-exec": "1.18.0" + "@percy/cli-command": "1.23.0", + "@percy/cli-exec": "1.23.0" } }, "@percy/cli-build": { - "version": "1.18.0", - "resolved": "https://registry.npmjs.org/@percy/cli-build/-/cli-build-1.18.0.tgz", - "integrity": "sha512-FuYWjXx4Wy0v27GpwxGX5qDq4xcLzlStbABNCp4H5RrNrLa1jkcViOKXTSurdjHYWlHHFWJUbk39D4g3ZRXOAA==", + "version": "1.23.0", + "resolved": "https://registry.npmjs.org/@percy/cli-build/-/cli-build-1.23.0.tgz", + "integrity": "sha512-qIhfU/UtPl181Dw2kR8klEYLUlA5C8GE0M9781vz7D0W3LriccaLLLo1wBp4q4bo83uvUBvNJhq9/S4T38kPEQ==", "requires": { - "@percy/cli-command": "1.18.0" + "@percy/cli-command": "1.23.0" } }, "@percy/cli-command": { - "version": "1.18.0", - "resolved": "https://registry.npmjs.org/@percy/cli-command/-/cli-command-1.18.0.tgz", - "integrity": "sha512-2dHJalp83IygD/FqXCFNND22z7f4r5uZxqr5GAyiJ0STkQYitTgwkUp+4IRdfK1zmi+A2dbyYU0xV9txEW5v8g==", + "version": "1.23.0", + "resolved": "https://registry.npmjs.org/@percy/cli-command/-/cli-command-1.23.0.tgz", + "integrity": "sha512-tXj5vv2BQMBmn3ZL2YNqYYrmJLyYnBqwyJkecY2BwXQsKAIv3qBgTzr1d5+LxTOi5ArjFCHAgk2w4ohy6h6t4w==", "requires": { - "@percy/config": "1.18.0", - "@percy/core": "1.18.0", - "@percy/logger": "1.18.0" + "@percy/config": "1.23.0", + "@percy/core": "1.23.0", + "@percy/logger": "1.23.0" } }, "@percy/cli-config": { - "version": "1.18.0", - "resolved": "https://registry.npmjs.org/@percy/cli-config/-/cli-config-1.18.0.tgz", - "integrity": "sha512-N5I7av5SGO5n0YC61wbqVniNxFwAQFFubKyGyGaVlQkmKyRuYCmDMHlPdSv3zyvVD1ZJCvtDzi/VqQGDubEieg==", + "version": "1.23.0", + "resolved": "https://registry.npmjs.org/@percy/cli-config/-/cli-config-1.23.0.tgz", + "integrity": "sha512-tI4c4MhU41rx9n7fYZrpn4gaOD9dA6PnefP397v7smqEWh7MJ+cxI/nyKU0/9G2wGjMhYACaLoR4BiCWOQZAkw==", "requires": { - "@percy/cli-command": "1.18.0" + "@percy/cli-command": "1.23.0" } }, "@percy/cli-exec": { - "version": "1.18.0", - "resolved": "https://registry.npmjs.org/@percy/cli-exec/-/cli-exec-1.18.0.tgz", - "integrity": "sha512-4y+XIsYS5KypJmTtGKyKFU4GZ6902dCcEMJNDc69grSsco9N2lBG2gsvChCrCA2gDT8nUvKng9z9KF2OiMvF3w==", + "version": "1.23.0", + "resolved": "https://registry.npmjs.org/@percy/cli-exec/-/cli-exec-1.23.0.tgz", + "integrity": "sha512-ecxnMWxUlVx0EswGraHgN4LvWbXeUZQZUxJ9wYmMSgDEaKfEiEZ5WTLSKzQAxyfw2SjoQ3cHRZbKh4qMlCgbAg==", "requires": { - "@percy/cli-command": "1.18.0", + "@percy/cli-command": "1.23.0", "cross-spawn": "^7.0.3", "which": "^2.0.2" } }, "@percy/cli-snapshot": { - "version": "1.18.0", - "resolved": "https://registry.npmjs.org/@percy/cli-snapshot/-/cli-snapshot-1.18.0.tgz", - "integrity": "sha512-3a7HqJU/wCT7fKraYw6S4cs8KrlUZ0MbDV9/dEbFh9nSfz0BLQjcK+kL8OzjxM+bVwZ6pf62FJl44nVLpXqrGw==", + "version": "1.23.0", + "resolved": "https://registry.npmjs.org/@percy/cli-snapshot/-/cli-snapshot-1.23.0.tgz", + "integrity": "sha512-QOrUfyPCnjfIAcUBjNlO299NRPDxofcYQUCBYZE3CtemsNFtygFt0yPnZCwWmt0voSpnPl1Izc6/FA3wYUfuBQ==", "requires": { - "@percy/cli-command": "1.18.0", + "@percy/cli-command": "1.23.0", "yaml": "^2.0.0" } }, "@percy/cli-upload": { - "version": "1.18.0", - "resolved": "https://registry.npmjs.org/@percy/cli-upload/-/cli-upload-1.18.0.tgz", - "integrity": "sha512-JSRoE0aTnBH1HGNGmDJxGNkNIGor7H8pv6lO8AUiwCwQ55EHgLqtWlhwq+2AHz7QOiGD8aOHQTwJk6GcCIIa3A==", + "version": "1.23.0", + "resolved": "https://registry.npmjs.org/@percy/cli-upload/-/cli-upload-1.23.0.tgz", + "integrity": "sha512-faRHjzaUf21RK9Ra051gKUl4HmMNPZxUKSZNmdG0yP+tc5KxU9cXkmEeCKGH7LOcVs0IfyRX0vv58YEZ6GsIRw==", "requires": { - "@percy/cli-command": "1.18.0", + "@percy/cli-command": "1.23.0", "fast-glob": "^3.2.11", "image-size": "^1.0.0" } }, "@percy/client": { - "version": "1.18.0", - "resolved": "https://registry.npmjs.org/@percy/client/-/client-1.18.0.tgz", - "integrity": "sha512-onuVIpB6TPNjEhLlPsyhJYXTY2xdv3iNx4bj8Yfk751vQ33US2z4FEWDQKIEvHJGcFT7NEIHXFT3bYcFDmREdQ==", + "version": "1.23.0", + "resolved": "https://registry.npmjs.org/@percy/client/-/client-1.23.0.tgz", + "integrity": "sha512-m0qNCrlfh6Pf0t2GfoeShuK7r2GeRk5rWVjIbdnDigvmtL0G+HJM1gvysLOxzKFHkZ1cLBfM1SnH1Yn6RM/6qQ==", "requires": { - "@percy/env": "1.18.0", - "@percy/logger": "1.18.0" + "@percy/env": "1.23.0", + "@percy/logger": "1.23.0" } }, "@percy/config": { - "version": "1.18.0", - "resolved": "https://registry.npmjs.org/@percy/config/-/config-1.18.0.tgz", - "integrity": "sha512-bjAiZuhORij3vxeolVjpf7ZU1Sjqv2Y9CgsBthoIu20f5o0a10w6JGgPkDjT3NaAIZDXgbxVsrWovlslbRC57w==", + "version": "1.23.0", + "resolved": "https://registry.npmjs.org/@percy/config/-/config-1.23.0.tgz", + "integrity": "sha512-giPIdNLcG1Qg0dkc/VDOkTzI4szzM4QAoJfMLEP0UYPkIU2Y0Xc8NH5GN3DEiudRJge72iGfeah6GugxmXmKXw==", "requires": { - "@percy/logger": "1.18.0", + "@percy/logger": "1.23.0", "ajv": "^8.6.2", "cosmiconfig": "^7.0.0", "yaml": "^2.0.0" } }, "@percy/core": { - "version": "1.18.0", - "resolved": "https://registry.npmjs.org/@percy/core/-/core-1.18.0.tgz", - "integrity": "sha512-9d8mkE6bfp0nRxhnGgC8N2KBG+MRiCxfvmZGfKENEoSY8NTTjJ5LqF+ol1JRwQ+uTABPZgy9XItWLINrS3yC1Q==", + "version": "1.23.0", + "resolved": "https://registry.npmjs.org/@percy/core/-/core-1.23.0.tgz", + "integrity": "sha512-/BNHdvbD7r1p3k3HWgxYLBo2L2Ye9RDcmTuA6en2xUYaagf+0vfcAK8iyBvVm6ir2ZjAsMW0PGRa7OIfetvHHg==", "requires": { - "@percy/client": "1.18.0", - "@percy/config": "1.18.0", - "@percy/dom": "1.18.0", - "@percy/logger": "1.18.0", + "@percy/client": "1.23.0", + "@percy/config": "1.23.0", + "@percy/dom": "1.23.0", + "@percy/logger": "1.23.0", "content-disposition": "^0.5.4", "cross-spawn": "^7.0.3", "extract-zip": "^2.0.1", @@ -2649,19 +2669,19 @@ } }, "@percy/dom": { - "version": "1.18.0", - "resolved": "https://registry.npmjs.org/@percy/dom/-/dom-1.18.0.tgz", - "integrity": "sha512-FoaUgmdCaymSVV/5UQsDwPlZYpSymViODiGJxEJnfESKB4L5aNWQTL3QefFOAI67Q9lUIezW7oueLPsH2XlCNg==" + "version": "1.23.0", + "resolved": "https://registry.npmjs.org/@percy/dom/-/dom-1.23.0.tgz", + "integrity": "sha512-68q3ceCWsWpUFyF/pnELSCTdbTAibGVyNwp+iZCFd/914sUhERYrrX8AqCgkCDerOzCwAQZQDe2Nv3jaB+d0ng==" }, "@percy/env": { - "version": "1.18.0", - "resolved": "https://registry.npmjs.org/@percy/env/-/env-1.18.0.tgz", - "integrity": "sha512-b+RTDPst4yKk67EQMjGeBIjfAkqZy2jUXgW3SKaNCyCOzI+16IXJ1gJSrniv29TpxgqDa1y3OUyWTPkmuDVi2A==" + "version": "1.23.0", + "resolved": "https://registry.npmjs.org/@percy/env/-/env-1.23.0.tgz", + "integrity": "sha512-oKvJBC/Zhfwp2QpFBpfHeAVuGhgaPeI7S4H2/68XT30pInfVJzaCjD/8ySAELGyMWmgHc51s+k09DZCo3C3Gyg==" }, "@percy/logger": { - "version": "1.18.0", - "resolved": "https://registry.npmjs.org/@percy/logger/-/logger-1.18.0.tgz", - "integrity": "sha512-ZC9OqaTVPjnndcSfbQaU0NcquC0J4KZFx7hEDznukXNsLIK4WSLiEK1QS+tGxAkIKZilHmVc/vv9q3lMvlQDaQ==" + "version": "1.23.0", + "resolved": "https://registry.npmjs.org/@percy/logger/-/logger-1.23.0.tgz", + "integrity": "sha512-kNtdKQ9Kou/RcWgDoSK+ofOVqOzuzyHBNsK+I92XNh8HHO6ow08Cmw+LtZbDxmj3uq7nXG9Nhgj4ZqSgdk7J6Q==" }, "@percy/playwright": { "version": "1.0.4", @@ -2677,12 +2697,13 @@ "integrity": "sha512-4cSkWqpu7uK9zzeVwtMWrgGbP34GUlvZsWdEEt98ep6ZECQA+iGB75pOpIVwcsHKXtkDRE6fgugtxNXs5uHpMg==" }, "@playwright/test": { - "version": "1.30.0", - "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.30.0.tgz", - "integrity": "sha512-SVxkQw1xvn/Wk/EvBnqWIq6NLo1AppwbYOjNLmyU0R1RoQ3rLEBtmjTnElcnz8VEtn11fptj1ECxK0tgURhajw==", + "version": "1.32.3", + "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.32.3.tgz", + "integrity": "sha512-BvWNvK0RfBriindxhLVabi8BRe3X0J9EVjKlcmhxjg4giWBD/xleLcg2dz7Tx0agu28rczjNIPQWznwzDwVsZQ==", "requires": { "@types/node": "*", - "playwright-core": "1.30.0" + "fsevents": "2.3.2", + "playwright-core": "1.32.3" } }, "@types/json-schema": { @@ -2708,9 +2729,9 @@ "dev": true }, "@types/uuid": { - "version": "9.0.0", - "resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-9.0.0.tgz", - "integrity": "sha512-kr90f+ERiQtKWMz5rP32ltJ/BtULDI5RVO0uavn1HQUOwjx0R1h0rnDYNL0CepF1zL5bSY6FISAfd9tOdDhU5Q==", + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-9.0.1.tgz", + "integrity": "sha512-rFT3ak0/2trgvp4yYZo5iKFEPsET7vKydKF+VRCxlQ9bpheehyAJH89dAkaLEq/j/RZXJIqcgsmPJKUP1Z28HA==", "dev": true }, "@types/yauzl": { @@ -2723,71 +2744,71 @@ } }, "@typescript-eslint/eslint-plugin": { - "version": "5.51.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.51.0.tgz", - "integrity": "sha512-wcAwhEWm1RgNd7dxD/o+nnLW8oH+6RK1OGnmbmkj/GGoDPV1WWMVP0FXYQBivKHdwM1pwii3bt//RC62EriIUQ==", + "version": "5.59.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.59.0.tgz", + "integrity": "sha512-p0QgrEyrxAWBecR56gyn3wkG15TJdI//eetInP3zYRewDh0XS+DhB3VUAd3QqvziFsfaQIoIuZMxZRB7vXYaYw==", "dev": true, "requires": { - "@typescript-eslint/scope-manager": "5.51.0", - "@typescript-eslint/type-utils": "5.51.0", - "@typescript-eslint/utils": "5.51.0", + "@eslint-community/regexpp": "^4.4.0", + "@typescript-eslint/scope-manager": "5.59.0", + "@typescript-eslint/type-utils": "5.59.0", + "@typescript-eslint/utils": "5.59.0", "debug": "^4.3.4", "grapheme-splitter": "^1.0.4", "ignore": "^5.2.0", "natural-compare-lite": "^1.4.0", - "regexpp": "^3.2.0", "semver": "^7.3.7", "tsutils": "^3.21.0" } }, "@typescript-eslint/parser": { - "version": "5.51.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.51.0.tgz", - "integrity": "sha512-fEV0R9gGmfpDeRzJXn+fGQKcl0inIeYobmmUWijZh9zA7bxJ8clPhV9up2ZQzATxAiFAECqPQyMDB4o4B81AaA==", + "version": "5.59.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.59.0.tgz", + "integrity": "sha512-qK9TZ70eJtjojSUMrrEwA9ZDQ4N0e/AuoOIgXuNBorXYcBDk397D2r5MIe1B3cok/oCtdNC5j+lUUpVB+Dpb+w==", "dev": true, "requires": { - "@typescript-eslint/scope-manager": "5.51.0", - "@typescript-eslint/types": "5.51.0", - "@typescript-eslint/typescript-estree": "5.51.0", + "@typescript-eslint/scope-manager": "5.59.0", + "@typescript-eslint/types": "5.59.0", + "@typescript-eslint/typescript-estree": "5.59.0", "debug": "^4.3.4" } }, "@typescript-eslint/scope-manager": { - "version": "5.51.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.51.0.tgz", - "integrity": "sha512-gNpxRdlx5qw3yaHA0SFuTjW4rxeYhpHxt491PEcKF8Z6zpq0kMhe0Tolxt0qjlojS+/wArSDlj/LtE69xUJphQ==", + "version": "5.59.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.59.0.tgz", + "integrity": "sha512-tsoldKaMh7izN6BvkK6zRMINj4Z2d6gGhO2UsI8zGZY3XhLq1DndP3Ycjhi1JwdwPRwtLMW4EFPgpuKhbCGOvQ==", "dev": true, "requires": { - "@typescript-eslint/types": "5.51.0", - "@typescript-eslint/visitor-keys": "5.51.0" + "@typescript-eslint/types": "5.59.0", + "@typescript-eslint/visitor-keys": "5.59.0" } }, "@typescript-eslint/type-utils": { - "version": "5.51.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.51.0.tgz", - "integrity": "sha512-QHC5KKyfV8sNSyHqfNa0UbTbJ6caB8uhcx2hYcWVvJAZYJRBo5HyyZfzMdRx8nvS+GyMg56fugMzzWnojREuQQ==", + "version": "5.59.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.59.0.tgz", + "integrity": "sha512-d/B6VSWnZwu70kcKQSCqjcXpVH+7ABKH8P1KNn4K7j5PXXuycZTPXF44Nui0TEm6rbWGi8kc78xRgOC4n7xFgA==", "dev": true, "requires": { - "@typescript-eslint/typescript-estree": "5.51.0", - "@typescript-eslint/utils": "5.51.0", + "@typescript-eslint/typescript-estree": "5.59.0", + "@typescript-eslint/utils": "5.59.0", "debug": "^4.3.4", "tsutils": "^3.21.0" } }, "@typescript-eslint/types": { - "version": "5.51.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.51.0.tgz", - "integrity": "sha512-SqOn0ANn/v6hFn0kjvLwiDi4AzR++CBZz0NV5AnusT2/3y32jdc0G4woXPWHCumWtUXZKPAS27/9vziSsC9jnw==", + "version": "5.59.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.59.0.tgz", + "integrity": "sha512-yR2h1NotF23xFFYKHZs17QJnB51J/s+ud4PYU4MqdZbzeNxpgUr05+dNeCN/bb6raslHvGdd6BFCkVhpPk/ZeA==", "dev": true }, "@typescript-eslint/typescript-estree": { - "version": "5.51.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.51.0.tgz", - "integrity": "sha512-TSkNupHvNRkoH9FMA3w7TazVFcBPveAAmb7Sz+kArY6sLT86PA5Vx80cKlYmd8m3Ha2SwofM1KwraF24lM9FvA==", + "version": "5.59.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.59.0.tgz", + "integrity": "sha512-sUNnktjmI8DyGzPdZ8dRwW741zopGxltGs/SAPgGL/AAgDpiLsCFLcMNSpbfXfmnNeHmK9h3wGmCkGRGAoUZAg==", "dev": true, "requires": { - "@typescript-eslint/types": "5.51.0", - "@typescript-eslint/visitor-keys": "5.51.0", + "@typescript-eslint/types": "5.59.0", + "@typescript-eslint/visitor-keys": "5.59.0", "debug": "^4.3.4", "globby": "^11.1.0", "is-glob": "^4.0.3", @@ -2796,28 +2817,28 @@ } }, "@typescript-eslint/utils": { - "version": "5.51.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.51.0.tgz", - "integrity": "sha512-76qs+5KWcaatmwtwsDJvBk4H76RJQBFe+Gext0EfJdC3Vd2kpY2Pf//OHHzHp84Ciw0/rYoGTDnIAr3uWhhJYw==", + "version": "5.59.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.59.0.tgz", + "integrity": "sha512-GGLFd+86drlHSvPgN/el6dRQNYYGOvRSDVydsUaQluwIW3HvbXuxyuD5JETvBt/9qGYe+lOrDk6gRrWOHb/FvA==", "dev": true, "requires": { + "@eslint-community/eslint-utils": "^4.2.0", "@types/json-schema": "^7.0.9", "@types/semver": "^7.3.12", - "@typescript-eslint/scope-manager": "5.51.0", - "@typescript-eslint/types": "5.51.0", - "@typescript-eslint/typescript-estree": "5.51.0", + "@typescript-eslint/scope-manager": "5.59.0", + "@typescript-eslint/types": "5.59.0", + "@typescript-eslint/typescript-estree": "5.59.0", "eslint-scope": "^5.1.1", - "eslint-utils": "^3.0.0", "semver": "^7.3.7" } }, "@typescript-eslint/visitor-keys": { - "version": "5.51.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.51.0.tgz", - "integrity": "sha512-Oh2+eTdjHjOFjKA27sxESlA87YPSOJafGCR0md5oeMdh1ZcCfAGCIOL216uTBAkAIptvLIfKQhl7lHxMJet4GQ==", + "version": "5.59.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.59.0.tgz", + "integrity": "sha512-qZ3iXxQhanchCeaExlKPV3gDQFxMUmU35xfd5eCXB6+kUw1TUAbIy2n7QIrwz9s98DQLzNWyHp61fY0da4ZcbA==", "dev": true, "requires": { - "@typescript-eslint/types": "5.51.0", + "@typescript-eslint/types": "5.59.0", "eslint-visitor-keys": "^3.3.0" } }, @@ -2852,11 +2873,11 @@ "dev": true }, "ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", "requires": { - "color-convert": "^2.0.1" + "color-convert": "^1.9.0" } }, "argparse": { @@ -2920,20 +2941,56 @@ "requires": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" + }, + "dependencies": { + "ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "requires": { + "color-convert": "^2.0.1" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==" + }, + "supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "requires": { + "has-flag": "^4.0.0" + } + } } }, "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", "requires": { - "color-name": "~1.1.4" + "color-name": "1.1.3" } }, "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==" }, "combined-stream": { "version": "1.0.8", @@ -2975,6 +3032,15 @@ } } }, + "cross-env": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-env/-/cross-env-7.0.3.tgz", + "integrity": "sha512-+/HKd6EgcQCJGh2PSjZuUitQBQynKor4wrFbRg4DtAgS1aWO+gU52xpH7M9ScGgXSYmAVS9bIJ8EzuaGw0oNAw==", + "dev": true, + "requires": { + "cross-spawn": "^7.0.1" + } + }, "cross-spawn": { "version": "7.0.3", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", @@ -3007,9 +3073,9 @@ "dev": true }, "deepmerge": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.3.0.tgz", - "integrity": "sha512-z2wJZXrmeHdvYJp/Ux55wIjqo81G5Bp4c+oELTW+7ar6SogWHajt5a9gO3s3IDaGSAXjDk0vlQKN3rms8ab3og==" + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.3.1.tgz", + "integrity": "sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A==" }, "delayed-stream": { "version": "1.0.0", @@ -3061,12 +3127,15 @@ "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==" }, "eslint": { - "version": "8.34.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.34.0.tgz", - "integrity": "sha512-1Z8iFsucw+7kSqXNZVslXS8Ioa4u2KM7GPwuKtkTFAqZ/cHMcEaR+1+Br0wLlot49cNxIiZk5wp8EAbPcYZxTg==", + "version": "8.38.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.38.0.tgz", + "integrity": "sha512-pIdsD2jwlUGf/U38Jv97t8lq6HpaU/G9NKbYmpWpZGw3LdTNhZLbJePqxOXGB5+JEKfOPU/XLxYxFh03nr1KTg==", "dev": true, "requires": { - "@eslint/eslintrc": "^1.4.1", + "@eslint-community/eslint-utils": "^4.2.0", + "@eslint-community/regexpp": "^4.4.0", + "@eslint/eslintrc": "^2.0.2", + "@eslint/js": "8.38.0", "@humanwhocodes/config-array": "^0.11.8", "@humanwhocodes/module-importer": "^1.0.1", "@nodelib/fs.walk": "^1.2.8", @@ -3077,10 +3146,9 @@ "doctrine": "^3.0.0", "escape-string-regexp": "^4.0.0", "eslint-scope": "^7.1.1", - "eslint-utils": "^3.0.0", - "eslint-visitor-keys": "^3.3.0", - "espree": "^9.4.0", - "esquery": "^1.4.0", + "eslint-visitor-keys": "^3.4.0", + "espree": "^9.5.1", + "esquery": "^1.4.2", "esutils": "^2.0.2", "fast-deep-equal": "^3.1.3", "file-entry-cache": "^6.0.1", @@ -3101,7 +3169,6 @@ "minimatch": "^3.1.2", "natural-compare": "^1.4.0", "optionator": "^0.9.1", - "regexpp": "^3.2.0", "strip-ansi": "^6.0.1", "strip-json-comments": "^3.1.0", "text-table": "^0.2.0" @@ -3161,44 +3228,27 @@ } } }, - "eslint-utils": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-3.0.0.tgz", - "integrity": "sha512-uuQC43IGctw68pJA1RgbQS8/NP7rch6Cwd4j3ZBtgo4/8Flj4eGE7ZYSZRN3iq5pVUv6GPdW5Z1RFleo84uLDA==", - "dev": true, - "requires": { - "eslint-visitor-keys": "^2.0.0" - }, - "dependencies": { - "eslint-visitor-keys": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz", - "integrity": "sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw==", - "dev": true - } - } - }, "eslint-visitor-keys": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.3.0.tgz", - "integrity": "sha512-mQ+suqKJVyeuwGYHAdjMFqjCyfl8+Ldnxuyp3ldiMBFKkvytrXUZWaiPCEav8qDHKty44bD+qV1IP4T+w+xXRA==", + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.0.tgz", + "integrity": "sha512-HPpKPUBQcAsZOsHAFwTtIKcYlCje62XB7SEAcxjtmW6TD1WVpkS6i6/hOVtTZIl4zGj/mBqpFVGvaDneik+VoQ==", "dev": true }, "espree": { - "version": "9.4.1", - "resolved": "https://registry.npmjs.org/espree/-/espree-9.4.1.tgz", - "integrity": "sha512-XwctdmTO6SIvCzd9810yyNzIrOrqNYV9Koizx4C/mRhf9uq0o4yHoCEU/670pOxOL/MSraektvSAji79kX90Vg==", + "version": "9.5.1", + "resolved": "https://registry.npmjs.org/espree/-/espree-9.5.1.tgz", + "integrity": "sha512-5yxtHSZXRSW5pvv3hAlXM5+/Oswi1AUFqBmbibKb5s6bp3rGIDkyXU6xCoyuuLhijr4SFwPrXRoZjz0AZDN9tg==", "dev": true, "requires": { "acorn": "^8.8.0", "acorn-jsx": "^5.3.2", - "eslint-visitor-keys": "^3.3.0" + "eslint-visitor-keys": "^3.4.0" } }, "esquery": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.4.0.tgz", - "integrity": "sha512-cCDispWt5vHHtwMY2YrAQ4ibFkAL8RbH5YGBnZBc90MolvvfkkQcJro/aZiAQUlQ3qgrYS6D6v8Gc5G5CQsc9w==", + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.5.0.tgz", + "integrity": "sha512-YQLXUplAwJgCydQ78IMJywZCceoqk1oH01OERdSAJc/7U2AylwjhSCLDEtqwg811idIS/9fIU5GjG73IgjKMVg==", "dev": true, "requires": { "estraverse": "^5.1.0" @@ -3366,6 +3416,12 @@ "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" }, + "fsevents": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", + "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", + "optional": true + }, "get-stream": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz", @@ -3426,9 +3482,9 @@ "dev": true }, "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==" + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==" }, "ignore": { "version": "5.2.0", @@ -3747,9 +3803,9 @@ "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==" }, "playwright-core": { - "version": "1.30.0", - "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.30.0.tgz", - "integrity": "sha512-7AnRmTCf+GVYhHbLJsGUtskWTE33SwMZkybJ0v6rqR1boxq2x36U7p1vDRV7HO2IwTZgmycracLxPEJI49wu4g==" + "version": "1.32.3", + "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.32.3.tgz", + "integrity": "sha512-SB+cdrnu74ZIn5Ogh/8278ngEh9NEEV0vR4sJFmK04h2iZpybfbqBY0bX6+BLYWVdV12JLLI+JEFtSnYgR+mWg==" }, "prelude-ls": { "version": "1.2.1", @@ -3758,9 +3814,9 @@ "dev": true }, "prettier": { - "version": "2.8.4", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.4.tgz", - "integrity": "sha512-vIS4Rlc2FNh0BySk3Wkd6xmwxB0FpOndW5fisM5H8hsZSxU2VWVB5CWIkIjWvrHjIhxk2g3bfMKM87zNTrZddw==", + "version": "2.8.7", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.7.tgz", + "integrity": "sha512-yPngTo3aXUUmyuTjeTUT75txrf+aMh9FiD7q9ZE/i6r0bPb22g4FsE6Y338PQX1bmfy08i9QQCB7/rcUAVntfw==", "dev": true }, "pump": { @@ -3790,12 +3846,6 @@ "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==" }, - "regexpp": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-3.2.0.tgz", - "integrity": "sha512-pq2bWo9mVD43nbts2wGv17XLiNLya+GklZ8kaDLV2Z08gDCsGpnKn9BFMepvWuHCbyVvY7J5o5+BVvoQbmlJLg==", - "dev": true - }, "require-from-string": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", @@ -3893,11 +3943,11 @@ "dev": true }, "supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", "requires": { - "has-flag": "^4.0.0" + "has-flag": "^3.0.0" } }, "text-table": { @@ -3945,9 +3995,9 @@ "dev": true }, "typescript": { - "version": "4.9.5", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz", - "integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==", + "version": "5.0.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.0.4.tgz", + "integrity": "sha512-cW9T5W9xY37cc+jfEnaUvX91foxtHkza3Nw3wkoF4sSlKn0MONdkdEndig/qPBWXNkmplh3NzayQzCiHM4/hqw==", "dev": true }, "unfetch": { @@ -3993,9 +4043,9 @@ "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" }, "ws": { - "version": "8.12.0", - "resolved": "https://registry.npmjs.org/ws/-/ws-8.12.0.tgz", - "integrity": "sha512-kU62emKIdKVeEIOIKVegvqpXMSTAMLJozpHZaJNDYqBjzlSYXQGviYwN1osDLJ9av68qHd4a2oSjd7yD4pacig==", + "version": "8.13.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.13.0.tgz", + "integrity": "sha512-x9vcZYTrFPC7aSIbj7sRCYo7L/Xb8Iy+pW0ng0wt2vCJv7M9HOMy0UoN3rr+IFC7hb7vXoqS+P9ktyLLLhO+LA==", "requires": {} }, "yaml": { diff --git a/e2e-tests/playwright/package.json b/e2e-tests/playwright/package.json index 8ee95ffa63..e2e7ecf1ee 100644 --- a/e2e-tests/playwright/package.json +++ b/e2e-tests/playwright/package.json @@ -1,33 +1,35 @@ { "scripts": { - "test": "PW_SNAPSHOT_ENABLE=true playwright test", - "percy": "PERCY_TOKEN=$PERCY_TOKEN PW_PERCY_ENABLE=true percy exec -- playwright test --project=chrome --project=iphone --project=ipad", + "test": "cross-env PW_SNAPSHOT_ENABLE=true playwright test", + "percy": "cross-env PERCY_TOKEN=$PERCY_TOKEN PW_PERCY_ENABLE=true percy exec -- playwright test --project=chrome --project=iphone --project=ipad", "tsc": "tsc -b", "lint": "eslint . --ext .js,.ts", "prettier": "prettier --write .", "check": "npm run tsc && npm run lint && npm run prettier", - "codegen": "playwright codegen $PW_BASE_URL", - "test-slomo": "PW_SNAPSHOT_ENABLE=true PW_HEADLESS=false PW_SLOWMO=1000 playwright test", + "codegen": "cross-env playwright codegen $PW_BASE_URL", + "playwright-ui": "playwright test --ui", + "test-slomo": "cross-env PW_SNAPSHOT_ENABLE=true PW_SLOWMO=1000 playwright test", "show-report": "npx playwright show-report" }, "dependencies": { - "@percy/cli": "1.18.0", + "@percy/cli": "1.23.0", "@percy/playwright": "1.0.4", - "@playwright/test": "1.30.0", + "@playwright/test": "1.32.3", "async-wait-until": "2.0.12", "chalk": "4.1.2", - "deepmerge": "4.3.0", + "deepmerge": "4.3.1", "dotenv": "16.0.3", "form-data": "4.0.0", "isomorphic-unfetch": "4.0.2", "uuid": "9.0.0" }, "devDependencies": { - "@types/uuid": "9.0.0", - "@typescript-eslint/eslint-plugin": "5.51.0", - "@typescript-eslint/parser": "5.51.0", - "eslint": "8.34.0", - "prettier": "2.8.4", - "typescript": "4.9.5" + "@types/uuid": "9.0.1", + "@typescript-eslint/eslint-plugin": "5.59.0", + "@typescript-eslint/parser": "5.59.0", + "cross-env": "7.0.3", + "eslint": "8.38.0", + "prettier": "2.8.7", + "typescript": "5.0.4" } } diff --git a/e2e-tests/playwright/playwright.config.ts b/e2e-tests/playwright/playwright.config.ts index a014c9cb3b..56fcbd2c30 100644 --- a/e2e-tests/playwright/playwright.config.ts +++ b/e2e-tests/playwright/playwright.config.ts @@ -6,7 +6,7 @@ import {defineConfig, devices} from '@playwright/test'; import {duration} from '@e2e-support/util'; import testConfig from '@e2e-test.config'; -const defaultOutputFolder = 'playwright-report'; +const defaultOutputFolder = './playwright-report'; export default defineConfig({ globalSetup: require.resolve('./global_setup'), diff --git a/e2e-tests/playwright/sample.env b/e2e-tests/playwright/sample.env index d474d199e6..73ffe19981 100644 --- a/e2e-tests/playwright/sample.env +++ b/e2e-tests/playwright/sample.env @@ -35,7 +35,7 @@ # - Default to "false" if not set. # 12. PW_HEADLESS -# - Default to "true" if not set. Set to false to run test in head mode. +# - Default to "false" or headless mode if not set. Set to true to run test in headed mode. # 13. PW_SLOWMO # - Default to "0" if not set which means normal test speed run. Slows down Playwright operations by the specified amount of milliseconds. Useful so that you can see what is going on. diff --git a/e2e-tests/playwright/support/browser_context.ts b/e2e-tests/playwright/support/browser_context.ts index 59badf9a9c..3aead7e46e 100644 --- a/e2e-tests/playwright/support/browser_context.ts +++ b/e2e-tests/playwright/support/browser_context.ts @@ -3,16 +3,18 @@ import {writeFile} from 'node:fs/promises'; -import {request, Browser} from '@playwright/test'; +import {request, Browser, BrowserContext} from '@playwright/test'; import {UserProfile} from '@mattermost/types/users'; import testConfig from '@e2e-test.config'; export class TestBrowser { readonly browser: Browser; + context: BrowserContext | null; constructor(browser: Browser) { this.browser = browser; + this.context = null; } async login(user: UserProfile | null) { @@ -27,8 +29,16 @@ export class TestBrowser { const context = await this.browser.newContext(options); const page = await context.newPage(); + this.context = context; + return {context, page}; } + + async close() { + if (this.context) { + await this.context.close(); + } + } } export async function loginByAPI(loginId: string, password: string, token = '', ldapOnly = false) { diff --git a/e2e-tests/playwright/support/server/channel.ts b/e2e-tests/playwright/support/server/channel.ts index a217f8f1fe..44293f341f 100644 --- a/e2e-tests/playwright/support/server/channel.ts +++ b/e2e-tests/playwright/support/server/channel.ts @@ -4,25 +4,32 @@ import {getRandomId} from '@e2e-support/util'; import {Channel, ChannelType} from '@mattermost/types/channels'; -export function createRandomChannel( - teamId: string, - name: string, - displayName: string, - type: ChannelType = 'O', - purpose = '', - header = '', - unique = true -): Channel { - const randomSuffix = getRandomId(); +type ChannelInput = { + teamId: string; + name: string; + displayName: string; + type?: ChannelType; + purpose?: string; + header?: string; + unique?: boolean; +}; +export function createRandomChannel(channelInput: ChannelInput): Channel { const channel = { - team_id: teamId, - name: unique ? `${name}-${randomSuffix}` : name, - display_name: unique ? `${displayName} ${randomSuffix}` : displayName, - type, - purpose, - header, + team_id: channelInput.teamId, + name: channelInput.name, + display_name: channelInput.displayName, + type: channelInput.type || 'O', + purpose: channelInput.type || '', + header: channelInput.type || '', }; + if (channelInput.unique) { + const randomSuffix = getRandomId(); + + channel.name = `${channelInput.name}-${randomSuffix}`; + channel.display_name = `${channelInput.displayName} ${randomSuffix}`; + } + return channel as Channel; } diff --git a/e2e-tests/playwright/support/server/client.ts b/e2e-tests/playwright/support/server/client.ts index 703275e0d7..6a41218e23 100644 --- a/e2e-tests/playwright/support/server/client.ts +++ b/e2e-tests/playwright/support/server/client.ts @@ -1,7 +1,7 @@ // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. -// This is based on "packages/client/src/client4.ts". Modified for node client. +// This is based on "webapp/platform/client/src/client4.ts". Modified for node client. // Update should be made in comparison with the base Client4. import fs from 'node:fs'; @@ -134,7 +134,7 @@ export default class Client extends Client4 { // ***************************************************************************** // Boards client - // based on https://github.com/mattermost/focalboard/blob/main/webapp/src/octoClient.ts + // based on "webapp/boards/src/octoClient.ts" // ***************************************************************************** async patchUserConfig(userID: string, patch: UserConfigPatch): Promise { diff --git a/e2e-tests/playwright/support/server/default_config.ts b/e2e-tests/playwright/support/server/default_config.ts index a82775d783..211ec381ba 100644 --- a/e2e-tests/playwright/support/server/default_config.ts +++ b/e2e-tests/playwright/support/server/default_config.ts @@ -170,7 +170,6 @@ const defaultServerConfig: AdminConfig = { EnableCustomGroups: true, SelfHostedPurchase: true, AllowSyncedDrafts: true, - SelfHostedExpansion: false, }, TeamSettings: { SiteName: 'Mattermost', @@ -319,7 +318,6 @@ const defaultServerConfig: AdminConfig = { LoginButtonColor: '#0000', LoginButtonBorderColor: '#2389D7', LoginButtonTextColor: '#2389D7', - EnableInactivityEmail: true, }, RateLimitSettings: { Enable: false, @@ -532,7 +530,8 @@ const defaultServerConfig: AdminConfig = { EnableSharedChannels: false, EnableRemoteClusterService: false, EnableAppBar: false, - PatchPluginsReactDOM: false, + DisableRefetchingOnBrowserFocus: false, + DelayChannelAutocomplete: false, }, AnalyticsSettings: { MaxUsersForStatistics: 2500, @@ -622,12 +621,6 @@ const defaultServerConfig: AdminConfig = { 'com.mattermost.nps': { Enable: true, }, - focalboard: { - Enable: true, - }, - playbooks: { - Enable: true, - }, }, EnableMarketplace: true, EnableRemoteMarketplace: true, @@ -671,13 +664,11 @@ const defaultServerConfig: AdminConfig = { BoardsFeatureFlags: '', BoardsDataRetention: false, NormalizeLdapDNs: false, - EnableInactivityCheckJob: true, - UseCaseOnboarding: true, GraphQL: false, InsightsEnabled: true, CommandPalette: false, SendWelcomePost: true, - WorkTemplate: false, + WorkTemplate: true, PostPriority: true, WysiwygEditor: false, PeopleProduct: false, @@ -686,7 +677,9 @@ const defaultServerConfig: AdminConfig = { ThreadsEverywhere: false, GlobalDrafts: true, OnboardingTourTips: true, + DeprecateCloudFree: false, AppsSidebarCategory: false, + CloudReverseTrial: false, }, ImportSettings: { Directory: './import', diff --git a/e2e-tests/playwright/support/server/init.ts b/e2e-tests/playwright/support/server/init.ts index c8527ea318..4f33bafb80 100644 --- a/e2e-tests/playwright/support/server/init.ts +++ b/e2e-tests/playwright/support/server/init.ts @@ -3,7 +3,9 @@ import path from 'node:path'; import {expect} from '@playwright/test'; +import chalk from 'chalk'; +import {ClientError} from '@mattermost/client/client4'; import {PreferenceType} from '@mattermost/types/preferences'; import testConfig from '@e2e-test.config'; @@ -77,10 +79,21 @@ export async function initSetup({ offTopicUrl: getUrl(team.name, 'off-topic'), townSquareUrl: getUrl(team.name, 'town-square'), }; - } catch (err) { + } catch (error) { // log an error for debugging // eslint-disable-next-line no-console - console.log(err); + const err = error as ClientError; + if (err.message === 'Could not parse multipart form.') { + // eslint-disable-next-line no-console + console.log(chalk.yellow(`node version: ${process.version}\nNODE_OPTIONS: ${process.env.NODE_OPTIONS}`)); + + // eslint-disable-next-line no-console + console.log( + chalk.green( + `This failed due to the experimental fetch support in Node.js starting v18.0.0.\nYou may set environment variable: "export NODE_OPTIONS='--no-experimental-fetch'", then try again.'` + ) + ); + } expect(err, 'Should not throw an error').toBeFalsy(); throw err; } diff --git a/e2e-tests/playwright/support/test_fixture.ts b/e2e-tests/playwright/support/test_fixture.ts index d35435dd7c..428d75c081 100644 --- a/e2e-tests/playwright/support/test_fixture.ts +++ b/e2e-tests/playwright/support/test_fixture.ts @@ -1,8 +1,9 @@ -import {test as base, Browser} from '@playwright/test'; +import {test as base, Browser, ViewportSize} from '@playwright/test'; import {TestBrowser} from './browser_context'; import {shouldHaveCallsEnabled, shouldHaveFeatureFlag, shouldSkipInSmallScreen, shouldRunInLinux} from './flag'; import {initSetup, getAdminClient} from './server'; +import {isSmallScreen} from './util'; import {hideDynamicChannelsContent, waitForAnimationEnd, waitUntil} from './test_action'; import {pages} from './ui/pages'; import {matchSnapshot} from './visual'; @@ -15,9 +16,10 @@ type ExtendedFixtures = { }; export const test = base.extend({ - pw: async ({browser}, use) => { - const pw = new PlaywrightExtended(browser); + pw: async ({browser, viewport}, use) => { + const pw = new PlaywrightExtended(browser, viewport); await use(pw); + await pw.testBrowser.close(); }, // eslint-disable-next-line no-empty-pattern pages: async ({}, use) => { @@ -47,10 +49,13 @@ class PlaywrightExtended { // ./ui/pages readonly pages; + // ./util + readonly isSmallScreen; + // ./visual readonly matchSnapshot; - constructor(browser: Browser) { + constructor(browser: Browser, viewport: ViewportSize | null) { // ./browser_context this.testBrowser = new TestBrowser(browser); @@ -72,6 +77,9 @@ class PlaywrightExtended { // ./ui/pages this.pages = pages; + // ./util + this.isSmallScreen = () => isSmallScreen(viewport); + // ./visual this.matchSnapshot = matchSnapshot; } diff --git a/e2e-tests/playwright/support/ui/components/channels/find_channels_modal.ts b/e2e-tests/playwright/support/ui/components/channels/find_channels_modal.ts new file mode 100644 index 0000000000..cab7d6d810 --- /dev/null +++ b/e2e-tests/playwright/support/ui/components/channels/find_channels_modal.ts @@ -0,0 +1,23 @@ +// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. +// See LICENSE.txt for license information. + +import {expect, Locator} from '@playwright/test'; + +export default class FindChannelsModal { + readonly container: Locator; + readonly input; + readonly searchList; + + constructor(container: Locator) { + this.container = container; + + this.input = container.getByRole('textbox', {name: 'quick switch input'}); + this.searchList = container.locator('.suggestion-list__item'); + } + + async toBeVisible() { + await expect(this.container).toBeVisible(); + } +} + +export {FindChannelsModal}; diff --git a/e2e-tests/playwright/support/ui/components/channels/header_mobile.ts b/e2e-tests/playwright/support/ui/components/channels/header_mobile.ts new file mode 100644 index 0000000000..a687220abf --- /dev/null +++ b/e2e-tests/playwright/support/ui/components/channels/header_mobile.ts @@ -0,0 +1,22 @@ +// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. +// See LICENSE.txt for license information. + +import {expect, Locator} from '@playwright/test'; + +export default class ChannelsHeaderMobile { + readonly container: Locator; + + constructor(container: Locator) { + this.container = container; + } + + async toggleSidebar() { + await this.container.getByRole('button', {name: 'Toggle sidebar Menu Icon'}).click(); + } + + async toBeVisible() { + await expect(this.container).toBeVisible(); + } +} + +export {ChannelsHeaderMobile}; diff --git a/e2e-tests/playwright/support/ui/components/channels/post_create.ts b/e2e-tests/playwright/support/ui/components/channels/post_create.ts index 2a8be0ec6d..912fcad80e 100644 --- a/e2e-tests/playwright/support/ui/components/channels/post_create.ts +++ b/e2e-tests/playwright/support/ui/components/channels/post_create.ts @@ -9,6 +9,7 @@ export default class ChannelsPostCreate { readonly input; readonly attachmentButton; readonly emojiButton; + readonly sendButton: Locator; constructor(container: Locator) { this.container = container; @@ -16,12 +17,17 @@ export default class ChannelsPostCreate { this.input = container.getByTestId('post_textbox'); this.attachmentButton = container.getByLabel('attachment'); this.emojiButton = container.getByLabel('select an emoji'); + this.sendButton = container.getByTestId('SendMessageButton'); } async postMessage(message: string) { await this.input.fill(message); } + async sendMessage() { + await this.sendButton.click(); + } + async toBeVisible() { await expect(this.container).toBeVisible(); await expect(this.input).toBeVisible(); diff --git a/e2e-tests/playwright/support/ui/components/channels/sidebar_left.ts b/e2e-tests/playwright/support/ui/components/channels/sidebar_left.ts new file mode 100644 index 0000000000..ba75fa009d --- /dev/null +++ b/e2e-tests/playwright/support/ui/components/channels/sidebar_left.ts @@ -0,0 +1,21 @@ +// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. +// See LICENSE.txt for license information. + +import {expect, Locator} from '@playwright/test'; + +export default class ChannelsSidebarLeft { + readonly container: Locator; + readonly findChannelButton; + + constructor(container: Locator) { + this.container = container; + + this.findChannelButton = container.getByRole('button', {name: 'Find Channels'}); + } + + async toBeVisible() { + await expect(this.container).toBeVisible(); + } +} + +export {ChannelsSidebarLeft}; diff --git a/e2e-tests/playwright/support/ui/components/global_header.ts b/e2e-tests/playwright/support/ui/components/global_header.ts index ccd1d48ee4..8ab49d6307 100644 --- a/e2e-tests/playwright/support/ui/components/global_header.ts +++ b/e2e-tests/playwright/support/ui/components/global_header.ts @@ -16,7 +16,7 @@ export default class GlobalHeader { async switchProduct(name: string) { await this.productSwitchMenu.click(); - await this.container.getByRole('link', {name: ` ${name}`}).click(); + await this.container.getByRole('link', {name}).click(); } async toBeVisible(name: string) { diff --git a/e2e-tests/playwright/support/ui/components/index.ts b/e2e-tests/playwright/support/ui/components/index.ts index 019e4be325..4aba6c2cd9 100644 --- a/e2e-tests/playwright/support/ui/components/index.ts +++ b/e2e-tests/playwright/support/ui/components/index.ts @@ -3,19 +3,25 @@ import {BoardsSidebar} from './boards/sidebar'; import {ChannelsHeader} from './channels/header'; +import {ChannelsHeaderMobile} from './channels/header_mobile'; import {ChannelsAppBar} from './channels/app_bar'; import {ChannelsPostCreate} from './channels/post_create'; import {ChannelsPost} from './channels/post'; +import {ChannelsSidebarLeft} from './channels/sidebar_left'; import {ChannelsSidebarRight} from './channels/sidebar_right'; +import {FindChannelsModal} from './channels/find_channels_modal'; import {GlobalHeader} from './global_header'; const components = { BoardsSidebar, ChannelsAppBar, ChannelsHeader, + ChannelsHeaderMobile, ChannelsPostCreate, ChannelsPost, + ChannelsSidebarLeft, ChannelsSidebarRight, + FindChannelsModal, GlobalHeader, }; @@ -24,8 +30,11 @@ export { BoardsSidebar, ChannelsAppBar, ChannelsHeader, + ChannelsHeaderMobile, ChannelsPostCreate, ChannelsPost, + ChannelsSidebarLeft, ChannelsSidebarRight, + FindChannelsModal, GlobalHeader, }; diff --git a/e2e-tests/playwright/support/ui/pages/channels.ts b/e2e-tests/playwright/support/ui/pages/channels.ts index 948cb673c5..542f9a822d 100644 --- a/e2e-tests/playwright/support/ui/pages/channels.ts +++ b/e2e-tests/playwright/support/ui/pages/channels.ts @@ -11,17 +11,23 @@ export default class ChannelsPage { readonly channels = 'Channels'; readonly page: Page; readonly postCreate; + readonly findChannelsModal; readonly globalHeader; readonly header; + readonly headerMobile; readonly appBar; + readonly sidebarLeft; readonly sidebarRight; constructor(page: Page) { this.page = page; this.postCreate = new components.ChannelsPostCreate(page.locator('#post-create')); + this.findChannelsModal = new components.FindChannelsModal(page.getByRole('dialog', {name: 'Find Channels'})); this.globalHeader = new components.GlobalHeader(page.locator('#global-header')); this.header = new components.ChannelsHeader(page.locator('.channel-header')); + this.headerMobile = new components.ChannelsHeaderMobile(page.locator('.navbar')); this.appBar = new components.ChannelsAppBar(page.locator('.app-bar')); + this.sidebarLeft = new components.ChannelsSidebarLeft(page.locator('#SidebarContainer')); this.sidebarRight = new components.ChannelsSidebarRight(page.locator('#sidebar-right')); } @@ -49,6 +55,10 @@ export default class ChannelsPage { await this.postCreate.postMessage(message); } + async sendMessage() { + await this.postCreate.sendMessage(); + } + async getFirstPost() { await this.page.getByTestId('postView').first().waitFor(); const post = await this.page.getByTestId('postView').first(); diff --git a/e2e-tests/playwright/test.config.ts b/e2e-tests/playwright/test.config.ts index 5a370a541e..e0f8eb9055 100644 --- a/e2e-tests/playwright/test.config.ts +++ b/e2e-tests/playwright/test.config.ts @@ -55,7 +55,7 @@ const config: TestConfig = { // CI isCI: !!process.env.CI, // Playwright - headless: parseBool(process.env.PW_HEADLESS, false), + headless: parseBool(process.env.PW_HEADLESS, true), slowMo: parseNumber(process.env.PW_SLOWMO, 0), workers: parseNumber(process.env.PW_WORKERS, 1), // Visual tests diff --git a/e2e-tests/playwright/tests/functional/channels/search/find_channels.spec.ts b/e2e-tests/playwright/tests/functional/channels/search/find_channels.spec.ts new file mode 100644 index 0000000000..542b457892 --- /dev/null +++ b/e2e-tests/playwright/tests/functional/channels/search/find_channels.spec.ts @@ -0,0 +1,61 @@ +// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. +// See LICENSE.txt for license information. + +import {expect, test} from '@e2e-support/test_fixture'; +import {createRandomChannel} from '@e2e-support/server'; + +test('MM-T5424 Find channel search returns only 50 results when there are more than 50 channels with similar names', async ({ + pw, + pages, +}) => { + const {adminClient, user, team} = await pw.initSetup(); + + const commonName = 'test_channel'; + + // # Create more than 50 channels with similar names + const channelsRes = []; + for (let i = 0; i < 100; i++) { + let suffix = i.toString(); + if (i < 10) { + suffix = `0${i}`; + } + const channel = createRandomChannel({ + teamId: team.id, + name: `${commonName}_${suffix}`, + displayName: `Test Channel ${suffix}`, + }); + channelsRes.push(adminClient.createChannel(channel)); + } + await Promise.all(channelsRes); + + // # Log in a user in new browser context + const {page} = await pw.testBrowser.login(user); + + // # Visit a default channel page + const channelsPage = new pages.ChannelsPage(page); + await channelsPage.goto(); + await channelsPage.toBeVisible(); + + // # Click on "Find channel" and type "test_channel" + if (pw.isSmallScreen()) { + await channelsPage.headerMobile.toggleSidebar(); + } + await channelsPage.sidebarLeft.findChannelButton.click(); + + await channelsPage.findChannelsModal.toBeVisible(); + await channelsPage.findChannelsModal.input.fill(commonName); + + const limitCount = 50; + + // # Only 50 results for similar name should be displayed. + await expect(channelsPage.findChannelsModal.searchList).toHaveCount(limitCount); + + for (let i = 0; i < limitCount; i++) { + let suffix = i.toString(); + if (i < 10) { + suffix = `0${i}`; + } + + await expect(channelsPage.findChannelsModal.container.getByTestId(`${commonName}_${suffix}`)).toBeVisible(); + } +}); diff --git a/e2e-tests/playwright/tests/visual/boards/board_template.spec.ts-snapshots/board-template-chrome-linux.png b/e2e-tests/playwright/tests/visual/boards/board_template.spec.ts-snapshots/board-template-chrome-linux.png index f15014aaa4..987b4d5b8d 100644 Binary files a/e2e-tests/playwright/tests/visual/boards/board_template.spec.ts-snapshots/board-template-chrome-linux.png and b/e2e-tests/playwright/tests/visual/boards/board_template.spec.ts-snapshots/board-template-chrome-linux.png differ diff --git a/e2e-tests/playwright/tests/visual/boards/board_template.spec.ts-snapshots/board-template-firefox-linux.png b/e2e-tests/playwright/tests/visual/boards/board_template.spec.ts-snapshots/board-template-firefox-linux.png index 1d5b1fb577..424d77357e 100644 Binary files a/e2e-tests/playwright/tests/visual/boards/board_template.spec.ts-snapshots/board-template-firefox-linux.png and b/e2e-tests/playwright/tests/visual/boards/board_template.spec.ts-snapshots/board-template-firefox-linux.png differ diff --git a/e2e-tests/playwright/tests/visual/boards/board_template.spec.ts-snapshots/board-template-ipad-linux.png b/e2e-tests/playwright/tests/visual/boards/board_template.spec.ts-snapshots/board-template-ipad-linux.png index 35c5fcff0d..2017d565c4 100644 Binary files a/e2e-tests/playwright/tests/visual/boards/board_template.spec.ts-snapshots/board-template-ipad-linux.png and b/e2e-tests/playwright/tests/visual/boards/board_template.spec.ts-snapshots/board-template-ipad-linux.png differ diff --git a/e2e-tests/playwright/tests/visual/boards/view_untitled_board.spec.ts-snapshots/view-untitled-board-chrome-linux.png b/e2e-tests/playwright/tests/visual/boards/view_untitled_board.spec.ts-snapshots/view-untitled-board-chrome-linux.png index 44d4bd469d..6ecbc24470 100644 Binary files a/e2e-tests/playwright/tests/visual/boards/view_untitled_board.spec.ts-snapshots/view-untitled-board-chrome-linux.png and b/e2e-tests/playwright/tests/visual/boards/view_untitled_board.spec.ts-snapshots/view-untitled-board-chrome-linux.png differ diff --git a/e2e-tests/playwright/tests/visual/boards/view_untitled_board.spec.ts-snapshots/view-untitled-board-firefox-linux.png b/e2e-tests/playwright/tests/visual/boards/view_untitled_board.spec.ts-snapshots/view-untitled-board-firefox-linux.png index e0e4610033..0b93b4be18 100644 Binary files a/e2e-tests/playwright/tests/visual/boards/view_untitled_board.spec.ts-snapshots/view-untitled-board-firefox-linux.png and b/e2e-tests/playwright/tests/visual/boards/view_untitled_board.spec.ts-snapshots/view-untitled-board-firefox-linux.png differ diff --git a/e2e-tests/playwright/tests/visual/boards/view_untitled_board.spec.ts-snapshots/view-untitled-board-ipad-linux.png b/e2e-tests/playwright/tests/visual/boards/view_untitled_board.spec.ts-snapshots/view-untitled-board-ipad-linux.png index e3811169f4..4f4ae9d5f5 100644 Binary files a/e2e-tests/playwright/tests/visual/boards/view_untitled_board.spec.ts-snapshots/view-untitled-board-ipad-linux.png and b/e2e-tests/playwright/tests/visual/boards/view_untitled_board.spec.ts-snapshots/view-untitled-board-ipad-linux.png differ diff --git a/e2e-tests/playwright/tests/visual/channels/intro_channel.spec.ts b/e2e-tests/playwright/tests/visual/channels/intro_channel.spec.ts index 53c1b74e11..86fd10ef54 100644 --- a/e2e-tests/playwright/tests/visual/channels/intro_channel.spec.ts +++ b/e2e-tests/playwright/tests/visual/channels/intro_channel.spec.ts @@ -2,7 +2,6 @@ // See LICENSE.txt for license information. import {expect, test} from '@e2e-support/test_fixture'; -import {isSmallScreen} from '@e2e-support/util'; test('Intro to channel as regular user', async ({pw, pages, browserName, viewport}, testInfo) => { // Create and sign in a new user @@ -23,7 +22,7 @@ test('Intro to channel as regular user', async ({pw, pages, browserName, viewpor // await wait(duration.one_sec); // Wait for Playbooks icon to be loaded in App bar, except in iphone - if (!isSmallScreen(viewport)) { + if (!pw.isSmallScreen()) { await expect(channelsPage.appBar.playbooksIcon).toBeVisible(); } diff --git a/e2e-tests/playwright/tests/visual/channels/intro_channel.spec.ts-snapshots/intro-to-channel-as-regular-user-chrome-linux.png b/e2e-tests/playwright/tests/visual/channels/intro_channel.spec.ts-snapshots/intro-to-channel-as-regular-user-chrome-linux.png index 405a365a7b..2c70317f10 100644 Binary files a/e2e-tests/playwright/tests/visual/channels/intro_channel.spec.ts-snapshots/intro-to-channel-as-regular-user-chrome-linux.png and b/e2e-tests/playwright/tests/visual/channels/intro_channel.spec.ts-snapshots/intro-to-channel-as-regular-user-chrome-linux.png differ diff --git a/e2e-tests/playwright/tests/visual/channels/intro_channel.spec.ts-snapshots/intro-to-channel-as-regular-user-firefox-linux.png b/e2e-tests/playwright/tests/visual/channels/intro_channel.spec.ts-snapshots/intro-to-channel-as-regular-user-firefox-linux.png index ae5154ee58..09c9d93521 100644 Binary files a/e2e-tests/playwright/tests/visual/channels/intro_channel.spec.ts-snapshots/intro-to-channel-as-regular-user-firefox-linux.png and b/e2e-tests/playwright/tests/visual/channels/intro_channel.spec.ts-snapshots/intro-to-channel-as-regular-user-firefox-linux.png differ diff --git a/e2e-tests/playwright/tests/visual/channels/intro_channel.spec.ts-snapshots/intro-to-channel-as-regular-user-ipad-linux.png b/e2e-tests/playwright/tests/visual/channels/intro_channel.spec.ts-snapshots/intro-to-channel-as-regular-user-ipad-linux.png index 574b0d8db9..0989472047 100644 Binary files a/e2e-tests/playwright/tests/visual/channels/intro_channel.spec.ts-snapshots/intro-to-channel-as-regular-user-ipad-linux.png and b/e2e-tests/playwright/tests/visual/channels/intro_channel.spec.ts-snapshots/intro-to-channel-as-regular-user-ipad-linux.png differ diff --git a/e2e-tests/playwright/tests/visual/channels/intro_channel.spec.ts-snapshots/intro-to-channel-as-regular-user-iphone-linux.png b/e2e-tests/playwright/tests/visual/channels/intro_channel.spec.ts-snapshots/intro-to-channel-as-regular-user-iphone-linux.png index 81636cb5b6..1898570494 100644 Binary files a/e2e-tests/playwright/tests/visual/channels/intro_channel.spec.ts-snapshots/intro-to-channel-as-regular-user-iphone-linux.png and b/e2e-tests/playwright/tests/visual/channels/intro_channel.spec.ts-snapshots/intro-to-channel-as-regular-user-iphone-linux.png differ diff --git a/e2e-tests/playwright/tests/visual/common/landing_page.spec.ts-snapshots/landing-login-chrome-linux.png b/e2e-tests/playwright/tests/visual/common/landing_page.spec.ts-snapshots/landing-login-chrome-linux.png index 6ef5a343f5..de92fef79e 100644 Binary files a/e2e-tests/playwright/tests/visual/common/landing_page.spec.ts-snapshots/landing-login-chrome-linux.png and b/e2e-tests/playwright/tests/visual/common/landing_page.spec.ts-snapshots/landing-login-chrome-linux.png differ diff --git a/e2e-tests/playwright/tests/visual/common/landing_page.spec.ts-snapshots/landing-login-firefox-linux.png b/e2e-tests/playwright/tests/visual/common/landing_page.spec.ts-snapshots/landing-login-firefox-linux.png index 2b1cacedfa..132a2ac892 100644 Binary files a/e2e-tests/playwright/tests/visual/common/landing_page.spec.ts-snapshots/landing-login-firefox-linux.png and b/e2e-tests/playwright/tests/visual/common/landing_page.spec.ts-snapshots/landing-login-firefox-linux.png differ diff --git a/e2e-tests/playwright/tests/visual/common/landing_page.spec.ts-snapshots/landing-login-ipad-linux.png b/e2e-tests/playwright/tests/visual/common/landing_page.spec.ts-snapshots/landing-login-ipad-linux.png index c48169a658..b4457abe98 100644 Binary files a/e2e-tests/playwright/tests/visual/common/landing_page.spec.ts-snapshots/landing-login-ipad-linux.png and b/e2e-tests/playwright/tests/visual/common/landing_page.spec.ts-snapshots/landing-login-ipad-linux.png differ diff --git a/e2e-tests/playwright/tests/visual/common/landing_page.spec.ts-snapshots/landing-login-iphone-linux.png b/e2e-tests/playwright/tests/visual/common/landing_page.spec.ts-snapshots/landing-login-iphone-linux.png index 23c4291d87..ea323eb8a7 100644 Binary files a/e2e-tests/playwright/tests/visual/common/landing_page.spec.ts-snapshots/landing-login-iphone-linux.png and b/e2e-tests/playwright/tests/visual/common/landing_page.spec.ts-snapshots/landing-login-iphone-linux.png differ diff --git a/e2e-tests/playwright/tests/visual/common/login.spec.ts-snapshots/login-chrome-linux.png b/e2e-tests/playwright/tests/visual/common/login.spec.ts-snapshots/login-chrome-linux.png index 1a15106d6b..676fde4484 100644 Binary files a/e2e-tests/playwright/tests/visual/common/login.spec.ts-snapshots/login-chrome-linux.png and b/e2e-tests/playwright/tests/visual/common/login.spec.ts-snapshots/login-chrome-linux.png differ diff --git a/e2e-tests/playwright/tests/visual/common/login.spec.ts-snapshots/login-error-chrome-linux.png b/e2e-tests/playwright/tests/visual/common/login.spec.ts-snapshots/login-error-chrome-linux.png index f4866a6429..b9d2760e30 100644 Binary files a/e2e-tests/playwright/tests/visual/common/login.spec.ts-snapshots/login-error-chrome-linux.png and b/e2e-tests/playwright/tests/visual/common/login.spec.ts-snapshots/login-error-chrome-linux.png differ diff --git a/e2e-tests/playwright/tests/visual/common/login.spec.ts-snapshots/login-error-firefox-linux.png b/e2e-tests/playwright/tests/visual/common/login.spec.ts-snapshots/login-error-firefox-linux.png index 61702e85cb..4a3168df92 100644 Binary files a/e2e-tests/playwright/tests/visual/common/login.spec.ts-snapshots/login-error-firefox-linux.png and b/e2e-tests/playwright/tests/visual/common/login.spec.ts-snapshots/login-error-firefox-linux.png differ diff --git a/e2e-tests/playwright/tests/visual/common/login.spec.ts-snapshots/login-error-ipad-linux.png b/e2e-tests/playwright/tests/visual/common/login.spec.ts-snapshots/login-error-ipad-linux.png index 55725177f5..1538d5f2a1 100644 Binary files a/e2e-tests/playwright/tests/visual/common/login.spec.ts-snapshots/login-error-ipad-linux.png and b/e2e-tests/playwright/tests/visual/common/login.spec.ts-snapshots/login-error-ipad-linux.png differ diff --git a/e2e-tests/playwright/tests/visual/common/login.spec.ts-snapshots/login-error-iphone-linux.png b/e2e-tests/playwright/tests/visual/common/login.spec.ts-snapshots/login-error-iphone-linux.png index 0309a4aa23..1e1cc4aafc 100644 Binary files a/e2e-tests/playwright/tests/visual/common/login.spec.ts-snapshots/login-error-iphone-linux.png and b/e2e-tests/playwright/tests/visual/common/login.spec.ts-snapshots/login-error-iphone-linux.png differ diff --git a/e2e-tests/playwright/tests/visual/common/login.spec.ts-snapshots/login-firefox-linux.png b/e2e-tests/playwright/tests/visual/common/login.spec.ts-snapshots/login-firefox-linux.png index 432cceab4e..9e13bff69f 100644 Binary files a/e2e-tests/playwright/tests/visual/common/login.spec.ts-snapshots/login-firefox-linux.png and b/e2e-tests/playwright/tests/visual/common/login.spec.ts-snapshots/login-firefox-linux.png differ diff --git a/e2e-tests/playwright/tests/visual/common/login.spec.ts-snapshots/login-ipad-linux.png b/e2e-tests/playwright/tests/visual/common/login.spec.ts-snapshots/login-ipad-linux.png index c130b58464..b44f478019 100644 Binary files a/e2e-tests/playwright/tests/visual/common/login.spec.ts-snapshots/login-ipad-linux.png and b/e2e-tests/playwright/tests/visual/common/login.spec.ts-snapshots/login-ipad-linux.png differ diff --git a/e2e-tests/playwright/tests/visual/common/login.spec.ts-snapshots/login-iphone-linux.png b/e2e-tests/playwright/tests/visual/common/login.spec.ts-snapshots/login-iphone-linux.png index daf2286100..8b050c34a7 100644 Binary files a/e2e-tests/playwright/tests/visual/common/login.spec.ts-snapshots/login-iphone-linux.png and b/e2e-tests/playwright/tests/visual/common/login.spec.ts-snapshots/login-iphone-linux.png differ diff --git a/e2e-tests/playwright/tests/visual/common/signup_email.spec.ts-snapshots/signup-email-chrome-linux.png b/e2e-tests/playwright/tests/visual/common/signup_email.spec.ts-snapshots/signup-email-chrome-linux.png index 145f87b10a..c76d7b5ba6 100644 Binary files a/e2e-tests/playwright/tests/visual/common/signup_email.spec.ts-snapshots/signup-email-chrome-linux.png and b/e2e-tests/playwright/tests/visual/common/signup_email.spec.ts-snapshots/signup-email-chrome-linux.png differ diff --git a/e2e-tests/playwright/tests/visual/common/signup_email.spec.ts-snapshots/signup-email-error-chrome-linux.png b/e2e-tests/playwright/tests/visual/common/signup_email.spec.ts-snapshots/signup-email-error-chrome-linux.png index 9214c70187..29fd43ace6 100644 Binary files a/e2e-tests/playwright/tests/visual/common/signup_email.spec.ts-snapshots/signup-email-error-chrome-linux.png and b/e2e-tests/playwright/tests/visual/common/signup_email.spec.ts-snapshots/signup-email-error-chrome-linux.png differ diff --git a/e2e-tests/playwright/tests/visual/common/signup_email.spec.ts-snapshots/signup-email-error-firefox-linux.png b/e2e-tests/playwright/tests/visual/common/signup_email.spec.ts-snapshots/signup-email-error-firefox-linux.png index 247584f634..d57364459d 100644 Binary files a/e2e-tests/playwright/tests/visual/common/signup_email.spec.ts-snapshots/signup-email-error-firefox-linux.png and b/e2e-tests/playwright/tests/visual/common/signup_email.spec.ts-snapshots/signup-email-error-firefox-linux.png differ diff --git a/e2e-tests/playwright/tests/visual/common/signup_email.spec.ts-snapshots/signup-email-error-ipad-linux.png b/e2e-tests/playwright/tests/visual/common/signup_email.spec.ts-snapshots/signup-email-error-ipad-linux.png index 8b0049c5b3..65f5f5499e 100644 Binary files a/e2e-tests/playwright/tests/visual/common/signup_email.spec.ts-snapshots/signup-email-error-ipad-linux.png and b/e2e-tests/playwright/tests/visual/common/signup_email.spec.ts-snapshots/signup-email-error-ipad-linux.png differ diff --git a/e2e-tests/playwright/tests/visual/common/signup_email.spec.ts-snapshots/signup-email-error-iphone-linux.png b/e2e-tests/playwright/tests/visual/common/signup_email.spec.ts-snapshots/signup-email-error-iphone-linux.png index d4c6f7ab48..30627d5d8d 100644 Binary files a/e2e-tests/playwright/tests/visual/common/signup_email.spec.ts-snapshots/signup-email-error-iphone-linux.png and b/e2e-tests/playwright/tests/visual/common/signup_email.spec.ts-snapshots/signup-email-error-iphone-linux.png differ diff --git a/e2e-tests/playwright/tests/visual/common/signup_email.spec.ts-snapshots/signup-email-firefox-linux.png b/e2e-tests/playwright/tests/visual/common/signup_email.spec.ts-snapshots/signup-email-firefox-linux.png index 2994527038..9f255fded9 100644 Binary files a/e2e-tests/playwright/tests/visual/common/signup_email.spec.ts-snapshots/signup-email-firefox-linux.png and b/e2e-tests/playwright/tests/visual/common/signup_email.spec.ts-snapshots/signup-email-firefox-linux.png differ diff --git a/e2e-tests/playwright/tests/visual/common/signup_email.spec.ts-snapshots/signup-email-ipad-linux.png b/e2e-tests/playwright/tests/visual/common/signup_email.spec.ts-snapshots/signup-email-ipad-linux.png index f50f71dfb3..4303ec2f29 100644 Binary files a/e2e-tests/playwright/tests/visual/common/signup_email.spec.ts-snapshots/signup-email-ipad-linux.png and b/e2e-tests/playwright/tests/visual/common/signup_email.spec.ts-snapshots/signup-email-ipad-linux.png differ diff --git a/e2e-tests/playwright/tests/visual/common/signup_email.spec.ts-snapshots/signup-email-iphone-linux.png b/e2e-tests/playwright/tests/visual/common/signup_email.spec.ts-snapshots/signup-email-iphone-linux.png index 372c5b3662..588495a8b8 100644 Binary files a/e2e-tests/playwright/tests/visual/common/signup_email.spec.ts-snapshots/signup-email-iphone-linux.png and b/e2e-tests/playwright/tests/visual/common/signup_email.spec.ts-snapshots/signup-email-iphone-linux.png differ diff --git a/server/Makefile b/server/Makefile index 3271d4d4b9..00590e7bb3 100644 --- a/server/Makefile +++ b/server/Makefile @@ -1,4 +1,4 @@ -.PHONY: build package run stop run-client run-server run-haserver stop-haserver stop-client stop-server restart restart-server restart-client restart-haserver start-docker clean-dist clean nuke check-style check-client-style check-server-style check-unit-tests test dist run-client-tests setup-run-client-tests cleanup-run-client-tests test-client build-linux build-osx build-windows package-prep package-linux package-osx package-windows internal-test-web-client vet run-server-for-web-client-tests diff-config prepackaged-plugins prepackaged-binaries test-server test-server-ee test-server-quick test-server-race new-migration migrations-extract +.PHONY: build package run stop run-client run-server run-haserver stop-haserver stop-client stop-server restart restart-server restart-client restart-haserver start-docker update-docker clean-dist clean nuke check-style check-client-style check-server-style check-unit-tests test dist run-client-tests setup-run-client-tests cleanup-run-client-tests test-client build-linux build-osx build-windows package-prep package-linux package-osx package-windows internal-test-web-client vet run-server-for-web-client-tests diff-config prepackaged-plugins prepackaged-binaries test-server test-server-ee test-server-quick test-server-race new-migration migrations-extract ROOT := $(dir $(abspath $(lastword $(MAKEFILE_LIST)))) @@ -102,11 +102,11 @@ GOFLAGS ?= $(GOFLAGS:) export GOBIN ?= $(PWD)/bin GO=go DELVE=dlv -LDFLAGS += -X "github.com/mattermost/mattermost-server/v6/model.BuildNumber=$(BUILD_NUMBER)" -LDFLAGS += -X "github.com/mattermost/mattermost-server/v6/model.BuildDate=$(BUILD_DATE)" -LDFLAGS += -X "github.com/mattermost/mattermost-server/v6/model.BuildHash=$(BUILD_HASH)" -LDFLAGS += -X "github.com/mattermost/mattermost-server/v6/model.BuildHashEnterprise=$(BUILD_HASH_ENTERPRISE)" -LDFLAGS += -X "github.com/mattermost/mattermost-server/v6/model.BuildEnterpriseReady=$(BUILD_ENTERPRISE_READY)" +LDFLAGS += -X "github.com/mattermost/mattermost-server/server/v8/model.BuildNumber=$(BUILD_NUMBER)" +LDFLAGS += -X "github.com/mattermost/mattermost-server/server/v8/model.BuildDate=$(BUILD_DATE)" +LDFLAGS += -X "github.com/mattermost/mattermost-server/server/v8/model.BuildHash=$(BUILD_HASH)" +LDFLAGS += -X "github.com/mattermost/mattermost-server/server/v8/model.BuildHashEnterprise=$(BUILD_HASH_ENTERPRISE)" +LDFLAGS += -X "github.com/mattermost/mattermost-server/server/v8/model.BuildEnterpriseReady=$(BUILD_ENTERPRISE_READY)" GO_MAJOR_VERSION = $(shell $(GO) version | cut -c 14- | cut -d' ' -f1 | cut -d'.' -f1) GO_MINOR_VERSION = $(shell $(GO) version | cut -c 14- | cut -d' ' -f1 | cut -d'.' -f2) @@ -132,21 +132,22 @@ DIST_PATH_WIN=$(DIST_ROOT)/windows/mattermost TESTS=. # Packages lists -TE_PACKAGES=$(shell $(GO) list ./... | grep -vE 'v6/server/playbooks|v6/server/boards') -BOARDS_PACKAGES=$(shell $(GO) list ./... | grep -E 'v6/server/boards') -PLAYBOOKS_PACKAGES=$(shell $(GO) list ./... | grep -E 'v6/server/playbooks') +TE_PACKAGES=$(shell $(GO) list ./... | grep -vE 'server/v8/playbooks|server/v8/boards') +BOARDS_PACKAGES=$(shell $(GO) list ./... | grep -E 'server/v8/boards') +PLAYBOOKS_PACKAGES=$(shell $(GO) list ./... | grep -E 'server/v8/playbooks') +SUITE_PACKAGES=$(shell $(GO) list ./...) TEMPLATES_DIR=templates # Plugins Packages PLUGIN_PACKAGES ?= mattermost-plugin-antivirus-v0.1.2 -PLUGIN_PACKAGES += mattermost-plugin-autolink-v1.2.2 +PLUGIN_PACKAGES += mattermost-plugin-autolink-v1.4.0 PLUGIN_PACKAGES += mattermost-plugin-aws-SNS-v1.2.0 PLUGIN_PACKAGES += mattermost-plugin-calls-v0.15.1 PLUGIN_PACKAGES += mattermost-plugin-channel-export-v1.0.0 PLUGIN_PACKAGES += mattermost-plugin-confluence-v1.3.0 PLUGIN_PACKAGES += mattermost-plugin-custom-attributes-v1.3.1 -PLUGIN_PACKAGES += mattermost-plugin-github-v2.1.4 +PLUGIN_PACKAGES += mattermost-plugin-github-v2.1.5 PLUGIN_PACKAGES += mattermost-plugin-gitlab-v1.6.0 PLUGIN_PACKAGES += mattermost-plugin-jenkins-v1.1.0 PLUGIN_PACKAGES += mattermost-plugin-jira-v3.2.2 @@ -155,7 +156,7 @@ PLUGIN_PACKAGES += mattermost-plugin-nps-v1.3.1 PLUGIN_PACKAGES += mattermost-plugin-todo-v0.6.1 PLUGIN_PACKAGES += mattermost-plugin-welcomebot-v1.2.0 PLUGIN_PACKAGES += mattermost-plugin-zoom-v1.6.0 -PLUGIN_PACKAGES += mattermost-plugin-apps-v1.2.0 +PLUGIN_PACKAGES += mattermost-plugin-apps-v1.2.1 # Prepares the enterprise build if exists. The IGNORE stuff is a hack to get the Makefile to execute the commands outside a target ifeq ($(BUILD_ENTERPRISE_READY),true) @@ -189,7 +190,7 @@ endif include config.mk include build/*.mk -LDFLAGS += -X "github.com/mattermost/mattermost-server/v6/model.MockCWS=$(MM_ENABLE_CWS_MOCK)" +LDFLAGS += -X "github.com/mattermost/mattermost-server/server/v8/model.MockCWS=$(MM_ENABLE_CWS_MOCK)" RUN_IN_BACKGROUND ?= ifeq ($(RUN_SERVER_IN_BACKGROUND),true) @@ -239,6 +240,11 @@ else endif endif +update-docker: stop-docker ## Updates the docker containers for local development. + @echo Updating docker containers + + $(GO) run ./build/docker-compose-generator/main.go $(ENABLED_DOCKER_SERVICES) | docker-compose -f docker-compose.makefile.yml -f /dev/stdin $(DOCKER_COMPOSE_OVERRIDE) up --no-start + run-haserver: ifeq ($(BUILD_ENTERPRISE_READY),true) @echo Starting mattermost in an HA topology '(3 node cluster)' @@ -270,7 +276,7 @@ else endif plugin-checker: - $(GO) run $(GOFLAGS) ../plugin/checker + $(GO) run $(GOFLAGS) ./plugin/checker prepackaged-plugins: ## Populate the prepackaged-plugins directory @echo Downloading prepackaged plugins @@ -289,7 +295,7 @@ endif golangci-lint: ## Run golangci-lint on codebase @# Keep the version in sync with the command in .circleci/config.yml - $(GO) install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.50.1 + $(GO) install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.52.2 @echo Running golangci-lint $(GOBIN)/golangci-lint run ./... @@ -349,9 +355,9 @@ ldap-mocks: ## Creates mock files for ldap. plugin-mocks: ## Creates mock files for plugins. $(GO) install github.com/vektra/mockery/v2/...@v2.23.2 - $(GOBIN)/mockery --dir ../plugin --name API --output ../plugin/plugintest --outpkg plugintest --case underscore --note 'Regenerate this file using `make plugin-mocks`.' - $(GOBIN)/mockery --dir ../plugin --name Hooks --output ../plugin/plugintest --outpkg plugintest --case underscore --note 'Regenerate this file using `make plugin-mocks`.' - $(GOBIN)/mockery --dir ../plugin --name Driver --output ../plugin/plugintest --outpkg plugintest --case underscore --note 'Regenerate this file using `make plugin-mocks`.' + $(GOBIN)/mockery --dir ./plugin --name API --output ./plugin/plugintest --outpkg plugintest --case underscore --note 'Regenerate this file using `make plugin-mocks`.' + $(GOBIN)/mockery --dir ./plugin --name Hooks --output ./plugin/plugintest --outpkg plugintest --case underscore --note 'Regenerate this file using `make plugin-mocks`.' + $(GOBIN)/mockery --dir ./plugin --name Driver --output ./plugin/plugintest --outpkg plugintest --case underscore --note 'Regenerate this file using `make plugin-mocks`.' einterfaces-mocks: ## Creates mock files for einterfaces. $(GO) install github.com/vektra/mockery/v2/...@v2.23.2 @@ -380,7 +386,7 @@ platform-mocks: ## Creates mocks for platform interfaces. $(GOBIN)/mockery --dir channels/app/platform --name SuiteIFace --output channels/app/platform/mocks --note 'Regenerate this file using `make platform-mocks`.' pluginapi: ## Generates api and hooks glue code for plugins - $(GO) generate $(GOFLAGS) ../plugin + $(GO) generate $(GOFLAGS) ./plugin mocks: store-mocks telemetry-mocks filestore-mocks ldap-mocks plugin-mocks einterfaces-mocks searchengine-mocks sharedchannel-mocks misc-mocks email-mocks platform-mocks @@ -412,7 +418,7 @@ go-junit-report: test-compile: ## Compile tests. @echo COMPILE TESTS - for package in $(TE_PACKAGES) $(BOARDS_PACKAGES) $(PLAYBOOKS_PACKAGES) $(EE_PACKAGES); do \ + for package in $(SUITE_PACKAGES) $(EE_PACKAGES); do \ $(GO) test $(GOFLAGS) -c $$package; \ done @@ -450,9 +456,9 @@ else endif test-server-race: test-server-pre - MM_DISABLE_PLAYBOOKS=true MM_DISABLE_BOARDS=true ./scripts/test.sh "$(GO)" "-race $(GOFLAGS)" "$(TE_PACKAGES) $(EE_PACKAGES)" "$(TESTS)" "$(TESTFLAGS)" "$(GOBIN)" "90m" "atomic" - MM_DISABLE_PLAYBOOKS=true MM_DISABLE_BOARDS=false ./scripts/test.sh "$(GO)" "-race $(GOFLAGS)" "$(BOARDS_PACKAGES)" "$(TESTS)" "$(TESTFLAGS)" "$(GOBIN)" "90m" "atomic" - MM_DISABLE_PLAYBOOKS=false MM_DISABLE_BOARDS=true ./scripts/test.sh "$(GO)" "-race $(GOFLAGS)" "$(PLAYBOOKS_PACKAGES)" "$(TESTS)" "$(TESTFLAGS)" "$(GOBIN)" "90m" "atomic" + ./scripts/test.sh "$(GO)" "-race $(GOFLAGS)" "$(TE_PACKAGES) $(EE_PACKAGES)" "$(TESTS)" "$(TESTFLAGS)" "$(GOBIN)" "90m" "atomic" + ./scripts/test.sh "$(GO)" "-race $(GOFLAGS)" "$(BOARDS_PACKAGES)" "$(TESTS)" "$(TESTFLAGS)" "$(GOBIN)" "90m" "atomic" + ./scripts/test.sh "$(GO)" "-race $(GOFLAGS)" "$(PLAYBOOKS_PACKAGES)" "$(TESTS)" "$(TESTFLAGS)" "$(GOBIN)" "90m" "atomic" ifneq ($(IS_CI),true) ifneq ($(MM_NO_DOCKER),true) ifneq ($(TEMP_DOCKER_SERVICES),) @@ -463,9 +469,7 @@ ifneq ($(IS_CI),true) endif test-server: test-server-pre - MM_DISABLE_PLAYBOOKS=true MM_DISABLE_BOARDS=true ./scripts/test.sh "$(GO)" "$(GOFLAGS)" "$(TE_PACKAGES) $(EE_PACKAGES)" "$(TESTS)" "$(TESTFLAGS)" "$(GOBIN)" "45m" "count" - MM_DISABLE_PLAYBOOKS=true MM_DISABLE_BOARDS=false ./scripts/test.sh "$(GO)" "$(GOFLAGS)" "$(BOARDS_PACKAGES)" "$(TESTS)" "$(TESTFLAGS)" "$(GOBIN)" "45m" "count" - MM_DISABLE_PLAYBOOKS=false MM_DISABLE_BOARDS=true ./scripts/test.sh "$(GO)" "$(GOFLAGS)" "$(PLAYBOOKS_PACKAGES)" "$(TESTS)" "$(TESTFLAGS)" "$(GOBIN)" "45m" "count" + ./scripts/test.sh "$(GO)" "$(GOFLAGS)" "$(SUITE_PACKAGES) $(EE_PACKAGES)" "$(TESTS)" "$(TESTFLAGS)" "$(GOBIN)" "90m" "count" ifneq ($(IS_CI),true) ifneq ($(MM_NO_DOCKER),true) ifneq ($(TEMP_DOCKER_SERVICES),) @@ -477,19 +481,15 @@ endif test-server-ee: check-prereqs-enterprise start-docker go-junit-report do-cover-file ## Runs EE tests. @echo Running only EE tests - MM_DISABLE_PLAYBOOKS=true MM_DISABLE_BOARDS=true ./scripts/test.sh "$(GO)" "$(GOFLAGS)" "$(EE_PACKAGES)" "$(TESTS)" "$(TESTFLAGS)" "$(GOBIN)" "20m" "count" + ./scripts/test.sh "$(GO)" "$(GOFLAGS)" "$(EE_PACKAGES)" "$(TESTS)" "$(TESTFLAGS)" "$(GOBIN)" "20m" "count" test-server-quick: check-prereqs-enterprise ## Runs only quick tests. ifeq ($(BUILD_ENTERPRISE_READY),true) @echo Running all tests - MM_DISABLE_PLAYBOOKS=true MM_DISABLE_BOARDS=true $(GO) test $(GOFLAGS) -short $(TE_PACKAGES) $(EE_PACKAGES) - MM_DISABLE_PLAYBOOKS=true MM_DISABLE_BOARDS=false $(GO) test $(GOFLAGS) -short $(BOARDS_PACKAGES) - MM_DISABLE_PLAYBOOKS=false MM_DISABLE_BOARDS=true $(GO) test $(GOFLAGS) -short $(PLAYBOOKS_PACKAGES) + $(GO) test $(GOFLAGS) -short $(SUITE_PACKAGES) $(EE_PACKAGES) else @echo Running only TE tests - MM_DISABLE_PLAYBOOKS=true MM_DISABLE_BOARDS=true $(GO) test $(GOFLAGS) -short $(TE_PACKAGES) - MM_DISABLE_PLAYBOOKS=true MM_DISABLE_BOARDS=false $(GO) test $(GOFLAGS) -short $(BOARDS_PACKAGES) - MM_DISABLE_PLAYBOOKS=false MM_DISABLE_BOARDS=true $(GO) test $(GOFLAGS) -short $(PLAYBOOKS_PACKAGES) + $(GO) test $(GOFLAGS) -short $(SUITE_PACKAGES) endif internal-test-web-client: ## Runs web client tests. @@ -552,20 +552,20 @@ run-server: setup-go-work prepackaged-binaries validate-go-version start-docker debug-server: start-docker ## Compile and start server using delve. mkdir -p $(BUILD_WEBAPP_DIR)/channels/dist/files $(DELVE) debug $(PLATFORM_FILES) --build-flags="-ldflags '\ - -X github.com/mattermost/mattermost-server/v6/model.BuildNumber=$(BUILD_NUMBER)\ - -X \"github.com/mattermost/mattermost-server/v6/model.BuildDate=$(BUILD_DATE)\"\ - -X github.com/mattermost/mattermost-server/v6/model.BuildHash=$(BUILD_HASH)\ - -X github.com/mattermost/mattermost-server/v6/model.BuildHashEnterprise=$(BUILD_HASH_ENTERPRISE)\ - -X github.com/mattermost/mattermost-server/v6/model.BuildEnterpriseReady=$(BUILD_ENTERPRISE_READY)'" + -X github.com/mattermost/mattermost-server/server/v8/model.BuildNumber=$(BUILD_NUMBER)\ + -X \"github.com/mattermost/mattermost-server/server/v8/model.BuildDate=$(BUILD_DATE)\"\ + -X github.com/mattermost/mattermost-server/server/v8/model.BuildHash=$(BUILD_HASH)\ + -X github.com/mattermost/mattermost-server/server/v8/model.BuildHashEnterprise=$(BUILD_HASH_ENTERPRISE)\ + -X github.com/mattermost/mattermost-server/server/v8/model.BuildEnterpriseReady=$(BUILD_ENTERPRISE_READY)'" debug-server-headless: start-docker ## Debug server from within an IDE like VSCode or IntelliJ. mkdir -p $(BUILD_WEBAPP_DIR)/channels/dist/files $(DELVE) debug --headless --listen=:2345 --api-version=2 --accept-multiclient $(PLATFORM_FILES) --build-flags="-ldflags '\ - -X github.com/mattermost/mattermost-server/v6/model.BuildNumber=$(BUILD_NUMBER)\ - -X \"github.com/mattermost/mattermost-server/v6/model.BuildDate=$(BUILD_DATE)\"\ - -X github.com/mattermost/mattermost-server/v6/model.BuildHash=$(BUILD_HASH)\ - -X github.com/mattermost/mattermost-server/v6/model.BuildHashEnterprise=$(BUILD_HASH_ENTERPRISE)\ - -X github.com/mattermost/mattermost-server/v6/model.BuildEnterpriseReady=$(BUILD_ENTERPRISE_READY)'" + -X github.com/mattermost/mattermost-server/server/v8/model.BuildNumber=$(BUILD_NUMBER)\ + -X \"github.com/mattermost/mattermost-server/server/v8/model.BuildDate=$(BUILD_DATE)\"\ + -X github.com/mattermost/mattermost-server/server/v8/model.BuildHash=$(BUILD_HASH)\ + -X github.com/mattermost/mattermost-server/server/v8/model.BuildHashEnterprise=$(BUILD_HASH_ENTERPRISE)\ + -X github.com/mattermost/mattermost-server/server/v8/model.BuildEnterpriseReady=$(BUILD_ENTERPRISE_READY)'" run-cli: start-docker ## Runs CLI. @echo Running mattermost for development @@ -733,18 +733,18 @@ gen-serialized: ## Generates serialization methods for hot structs # would be to temporarily move all the structs to the same file, # but that involves a lot of manual work. $(GO) install github.com/tinylib/msgp@v1.1.6 - $(GOBIN)/msgp -file=../model/session.go -tests=false -o=../model/session_serial_gen.go + $(GOBIN)/msgp -file=./model/session.go -tests=false -o=./model/session_serial_gen.go @echo "$$LICENSE_HEADER" > tmp.go - @cat ../model/session_serial_gen.go >> tmp.go - @mv tmp.go ../model/session_serial_gen.go - $(GOBIN)/msgp -file=../model/user.go -tests=false -o=../model/user_serial_gen.go + @cat ./model/session_serial_gen.go >> tmp.go + @mv tmp.go ./model/session_serial_gen.go + $(GOBIN)/msgp -file=./model/user.go -tests=false -o=./model/user_serial_gen.go @echo "$$LICENSE_HEADER" > tmp.go - @cat ../model/user_serial_gen.go >> tmp.go - @mv tmp.go ../model/user_serial_gen.go - $(GOBIN)/msgp -file=../model/team_member.go -tests=false -o=../model/team_member_serial_gen.go + @cat ./model/user_serial_gen.go >> tmp.go + @mv tmp.go ./model/user_serial_gen.go + $(GOBIN)/msgp -file=./model/team_member.go -tests=false -o=./model/team_member_serial_gen.go @echo "$$LICENSE_HEADER" > tmp.go - @cat ../model/team_member_serial_gen.go >> tmp.go - @mv tmp.go ../model/team_member_serial_gen.go + @cat ./model/team_member_serial_gen.go >> tmp.go + @mv tmp.go ./model/team_member_serial_gen.go todo: ## Display TODO and FIXME items in the source code. @! ag --ignore Makefile --ignore-dir runtime '(TODO|XXX|FIXME|"FIX ME")[: ]+' diff --git a/server/boards/api/admin.go b/server/boards/api/admin.go index 1c9acd73cc..cc2a277654 100644 --- a/server/boards/api/admin.go +++ b/server/boards/api/admin.go @@ -11,10 +11,10 @@ import ( "github.com/gorilla/mux" - "github.com/mattermost/mattermost-server/v6/server/boards/model" - "github.com/mattermost/mattermost-server/v6/server/boards/services/audit" + "github.com/mattermost/mattermost-server/server/v8/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/services/audit" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) type AdminSetPasswordData struct { diff --git a/server/boards/api/api.go b/server/boards/api/api.go index 063dd8fcbc..b800c84604 100644 --- a/server/boards/api/api.go +++ b/server/boards/api/api.go @@ -12,12 +12,12 @@ import ( "github.com/gorilla/mux" - "github.com/mattermost/mattermost-server/v6/server/boards/app" - "github.com/mattermost/mattermost-server/v6/server/boards/model" - "github.com/mattermost/mattermost-server/v6/server/boards/services/audit" - "github.com/mattermost/mattermost-server/v6/server/boards/services/permissions" + "github.com/mattermost/mattermost-server/server/v8/boards/app" + "github.com/mattermost/mattermost-server/server/v8/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/services/audit" + "github.com/mattermost/mattermost-server/server/v8/boards/services/permissions" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) const ( diff --git a/server/boards/api/api_test.go b/server/boards/api/api_test.go index c8038799c1..4a31e36127 100644 --- a/server/boards/api/api_test.go +++ b/server/boards/api/api_test.go @@ -13,8 +13,8 @@ import ( "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/server/boards/model" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/boards/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) func TestErrorResponse(t *testing.T) { diff --git a/server/boards/api/archive.go b/server/boards/api/archive.go index a8ec09d9b5..58377d9cd2 100644 --- a/server/boards/api/archive.go +++ b/server/boards/api/archive.go @@ -10,11 +10,11 @@ import ( "github.com/gorilla/mux" - "github.com/mattermost/mattermost-server/v6/server/boards/model" - "github.com/mattermost/mattermost-server/v6/server/boards/services/audit" + "github.com/mattermost/mattermost-server/server/v8/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/services/audit" - mm_model "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + mm_model "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) const ( diff --git a/server/boards/api/audit.go b/server/boards/api/audit.go index 017b840638..766e166f58 100644 --- a/server/boards/api/audit.go +++ b/server/boards/api/audit.go @@ -6,8 +6,8 @@ package api import ( "net/http" - "github.com/mattermost/mattermost-server/v6/server/boards/model" - "github.com/mattermost/mattermost-server/v6/server/boards/services/audit" + "github.com/mattermost/mattermost-server/server/v8/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/services/audit" ) // makeAuditRecord creates an audit record pre-populated with data from the request. diff --git a/server/boards/api/auth.go b/server/boards/api/auth.go index 3d01179db1..fb54d95d16 100644 --- a/server/boards/api/auth.go +++ b/server/boards/api/auth.go @@ -13,12 +13,12 @@ import ( "github.com/gorilla/mux" - "github.com/mattermost/mattermost-server/v6/server/boards/model" - "github.com/mattermost/mattermost-server/v6/server/boards/services/audit" - "github.com/mattermost/mattermost-server/v6/server/boards/services/auth" - "github.com/mattermost/mattermost-server/v6/server/boards/utils" + "github.com/mattermost/mattermost-server/server/v8/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/services/audit" + "github.com/mattermost/mattermost-server/server/v8/boards/services/auth" + "github.com/mattermost/mattermost-server/server/v8/boards/utils" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) func (a *API) registerAuthRoutes(r *mux.Router) { diff --git a/server/boards/api/blocks.go b/server/boards/api/blocks.go index 312e3cd37e..49add99fef 100644 --- a/server/boards/api/blocks.go +++ b/server/boards/api/blocks.go @@ -12,10 +12,10 @@ import ( "github.com/gorilla/mux" - "github.com/mattermost/mattermost-server/v6/server/boards/model" - "github.com/mattermost/mattermost-server/v6/server/boards/services/audit" + "github.com/mattermost/mattermost-server/server/v8/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/services/audit" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) func (a *API) registerBlocksRoutes(r *mux.Router) { @@ -72,7 +72,6 @@ func (a *API) handleGetBlocks(w http.ResponseWriter, r *http.Request) { query := r.URL.Query() parentID := query.Get("parent_id") blockType := query.Get("type") - all := query.Get("all") blockID := query.Get("block_id") boardID := mux.Vars(r)["boardID"] @@ -122,18 +121,11 @@ func (a *API) handleGetBlocks(w http.ResponseWriter, r *http.Request) { auditRec.AddMeta("boardID", boardID) auditRec.AddMeta("parentID", parentID) auditRec.AddMeta("blockType", blockType) - auditRec.AddMeta("all", all) auditRec.AddMeta("blockID", blockID) var blocks []*model.Block var block *model.Block switch { - case all != "": - blocks, err = a.app.GetBlocksForBoard(boardID) - if err != nil { - a.errorResponse(w, r, err) - return - } case blockID != "": block, err = a.app.GetBlockByID(blockID) if err != nil { @@ -148,7 +140,12 @@ func (a *API) handleGetBlocks(w http.ResponseWriter, r *http.Request) { blocks = append(blocks, block) default: - blocks, err = a.app.GetBlocks(boardID, parentID, blockType) + opts := model.QueryBlocksOptions{ + BoardID: boardID, + ParentID: parentID, + BlockType: model.BlockType(blockType), + } + blocks, err = a.app.GetBlocks(opts) if err != nil { a.errorResponse(w, r, err) return @@ -307,7 +304,7 @@ func (a *API) handlePostBlocks(w http.ResponseWriter, r *http.Request) { // this query param exists when creating template from board, or board from template sourceBoardID := r.URL.Query().Get("sourceBoardID") if sourceBoardID != "" { - if updateFileIDsErr := a.app.CopyCardFiles(sourceBoardID, blocks); updateFileIDsErr != nil { + if updateFileIDsErr := a.app.CopyAndUpdateCardFiles(sourceBoardID, userID, blocks, false); updateFileIDsErr != nil { a.errorResponse(w, r, updateFileIDsErr) return } diff --git a/server/boards/api/boards.go b/server/boards/api/boards.go index 038c62a35c..ee90a715fb 100644 --- a/server/boards/api/boards.go +++ b/server/boards/api/boards.go @@ -10,10 +10,10 @@ import ( "github.com/gorilla/mux" - "github.com/mattermost/mattermost-server/v6/server/boards/model" - "github.com/mattermost/mattermost-server/v6/server/boards/services/audit" + "github.com/mattermost/mattermost-server/server/v8/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/services/audit" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) func (a *API) registerBoardsRoutes(r *mux.Router) { diff --git a/server/boards/api/boards_and_blocks.go b/server/boards/api/boards_and_blocks.go index 2ff5d6e4ca..acd1155227 100644 --- a/server/boards/api/boards_and_blocks.go +++ b/server/boards/api/boards_and_blocks.go @@ -11,10 +11,10 @@ import ( "github.com/gorilla/mux" - "github.com/mattermost/mattermost-server/v6/server/boards/model" - "github.com/mattermost/mattermost-server/v6/server/boards/services/audit" + "github.com/mattermost/mattermost-server/server/v8/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/services/audit" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) func (a *API) registerBoardsAndBlocksRoutes(r *mux.Router) { diff --git a/server/boards/api/cards.go b/server/boards/api/cards.go index 98f74657c4..51da96cda2 100644 --- a/server/boards/api/cards.go +++ b/server/boards/api/cards.go @@ -12,10 +12,10 @@ import ( "github.com/gorilla/mux" - "github.com/mattermost/mattermost-server/v6/server/boards/model" - "github.com/mattermost/mattermost-server/v6/server/boards/services/audit" + "github.com/mattermost/mattermost-server/server/v8/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/services/audit" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) const ( diff --git a/server/boards/api/categories.go b/server/boards/api/categories.go index 6d21b7ed52..ef269e98ae 100644 --- a/server/boards/api/categories.go +++ b/server/boards/api/categories.go @@ -11,8 +11,8 @@ import ( "github.com/gorilla/mux" - "github.com/mattermost/mattermost-server/v6/server/boards/model" - "github.com/mattermost/mattermost-server/v6/server/boards/services/audit" + "github.com/mattermost/mattermost-server/server/v8/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/services/audit" ) func (a *API) registerCategoriesRoutes(r *mux.Router) { diff --git a/server/boards/api/channels.go b/server/boards/api/channels.go index 171db8ed72..e59aba7fc2 100644 --- a/server/boards/api/channels.go +++ b/server/boards/api/channels.go @@ -10,11 +10,11 @@ import ( "github.com/gorilla/mux" - "github.com/mattermost/mattermost-server/v6/server/boards/model" - "github.com/mattermost/mattermost-server/v6/server/boards/services/audit" + "github.com/mattermost/mattermost-server/server/v8/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/services/audit" - mm_model "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + mm_model "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) func (a *API) registerChannelsRoutes(r *mux.Router) { diff --git a/server/boards/api/compliance.go b/server/boards/api/compliance.go index 1c6db61bce..ac79bbf9a0 100644 --- a/server/boards/api/compliance.go +++ b/server/boards/api/compliance.go @@ -11,10 +11,10 @@ import ( "github.com/gorilla/mux" - "github.com/mattermost/mattermost-server/v6/server/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/model" - mm_model "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + mm_model "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) const ( diff --git a/server/boards/api/content_blocks.go b/server/boards/api/content_blocks.go index d595958deb..18a1fd3663 100644 --- a/server/boards/api/content_blocks.go +++ b/server/boards/api/content_blocks.go @@ -8,8 +8,8 @@ import ( "github.com/gorilla/mux" - "github.com/mattermost/mattermost-server/v6/server/boards/model" - "github.com/mattermost/mattermost-server/v6/server/boards/services/audit" + "github.com/mattermost/mattermost-server/server/v8/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/services/audit" ) func (a *API) registerContentBlocksRoutes(r *mux.Router) { diff --git a/server/boards/api/files.go b/server/boards/api/files.go index 4a7eb5e6e7..482fa0a622 100644 --- a/server/boards/api/files.go +++ b/server/boards/api/files.go @@ -11,17 +11,17 @@ import ( "strings" "time" - "github.com/mattermost/mattermost-server/v6/server/boards/app" + "github.com/mattermost/mattermost-server/server/v8/boards/app" "github.com/gorilla/mux" - "github.com/mattermost/mattermost-server/v6/server/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/model" - mm_model "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/boards/services/audit" + "github.com/mattermost/mattermost-server/server/v8/boards/services/audit" + mm_model "github.com/mattermost/mattermost-server/server/v8/model" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/web" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/web" ) // FileUploadResponse is the response to a file upload @@ -312,7 +312,7 @@ func (a *API) handleUploadFile(w http.ResponseWriter, r *http.Request) { auditRec.AddMeta("teamID", board.TeamID) auditRec.AddMeta("filename", handle.Filename) - fileID, err := a.app.SaveFile(file, board.TeamID, boardID, handle.Filename) + fileID, err := a.app.SaveFile(file, board.TeamID, boardID, handle.Filename, board.IsTemplate) if err != nil { a.errorResponse(w, r, err) return diff --git a/server/boards/api/insights.go b/server/boards/api/insights.go index 1553d13d8a..839b7c31c8 100644 --- a/server/boards/api/insights.go +++ b/server/boards/api/insights.go @@ -12,10 +12,10 @@ import ( "github.com/gorilla/mux" - "github.com/mattermost/mattermost-server/v6/server/boards/model" - "github.com/mattermost/mattermost-server/v6/server/boards/services/audit" + "github.com/mattermost/mattermost-server/server/v8/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/services/audit" - mm_model "github.com/mattermost/mattermost-server/v6/model" + mm_model "github.com/mattermost/mattermost-server/server/v8/model" ) func (a *API) registerInsightsRoutes(r *mux.Router) { diff --git a/server/boards/api/limits.go b/server/boards/api/limits.go index 650505b6c0..bf08184990 100644 --- a/server/boards/api/limits.go +++ b/server/boards/api/limits.go @@ -9,7 +9,7 @@ import ( "github.com/gorilla/mux" - "github.com/mattermost/mattermost-server/v6/server/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/model" ) func (a *API) registerLimitsRoutes(r *mux.Router) { diff --git a/server/boards/api/members.go b/server/boards/api/members.go index 5aa0165075..353fb750b7 100644 --- a/server/boards/api/members.go +++ b/server/boards/api/members.go @@ -10,9 +10,9 @@ import ( "github.com/gorilla/mux" - "github.com/mattermost/mattermost-server/v6/server/boards/model" - "github.com/mattermost/mattermost-server/v6/server/boards/services/audit" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/services/audit" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) func (a *API) registerMembersRoutes(r *mux.Router) { diff --git a/server/boards/api/onboarding.go b/server/boards/api/onboarding.go index 48016f073e..4e96e9ecc6 100644 --- a/server/boards/api/onboarding.go +++ b/server/boards/api/onboarding.go @@ -9,7 +9,7 @@ import ( "github.com/gorilla/mux" - "github.com/mattermost/mattermost-server/v6/server/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/model" ) func (a *API) registerOnboardingRoutes(r *mux.Router) { diff --git a/server/boards/api/search.go b/server/boards/api/search.go index d617acc559..ee5f052591 100644 --- a/server/boards/api/search.go +++ b/server/boards/api/search.go @@ -9,10 +9,10 @@ import ( "github.com/gorilla/mux" - "github.com/mattermost/mattermost-server/v6/server/boards/model" - "github.com/mattermost/mattermost-server/v6/server/boards/services/audit" + "github.com/mattermost/mattermost-server/server/v8/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/services/audit" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) func (a *API) registerSearchRoutes(r *mux.Router) { diff --git a/server/boards/api/sharing.go b/server/boards/api/sharing.go index 32cb30c22e..42bc405b81 100644 --- a/server/boards/api/sharing.go +++ b/server/boards/api/sharing.go @@ -11,10 +11,10 @@ import ( "github.com/gorilla/mux" - "github.com/mattermost/mattermost-server/v6/server/boards/model" - "github.com/mattermost/mattermost-server/v6/server/boards/services/audit" + "github.com/mattermost/mattermost-server/server/v8/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/services/audit" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) var ErrTurningOnSharing = errors.New("turning on sharing for board failed, see log for details") diff --git a/server/boards/api/statistics.go b/server/boards/api/statistics.go index ec019e4d29..b73cc6e801 100644 --- a/server/boards/api/statistics.go +++ b/server/boards/api/statistics.go @@ -9,8 +9,8 @@ import ( "github.com/gorilla/mux" - mm_model "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/model" + mm_model "github.com/mattermost/mattermost-server/server/v8/model" ) func (a *API) registerStatisticsRoutes(r *mux.Router) { diff --git a/server/boards/api/subscriptions.go b/server/boards/api/subscriptions.go index 8ac1a59b9a..e8542334cd 100644 --- a/server/boards/api/subscriptions.go +++ b/server/boards/api/subscriptions.go @@ -11,10 +11,10 @@ import ( "github.com/gorilla/mux" - "github.com/mattermost/mattermost-server/v6/server/boards/model" - "github.com/mattermost/mattermost-server/v6/server/boards/services/audit" + "github.com/mattermost/mattermost-server/server/v8/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/services/audit" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) func (a *API) registerSubscriptionsRoutes(r *mux.Router) { diff --git a/server/boards/api/system_test.go b/server/boards/api/system_test.go index 5b43b776e1..660db2f853 100644 --- a/server/boards/api/system_test.go +++ b/server/boards/api/system_test.go @@ -10,9 +10,9 @@ import ( "runtime" "testing" - "github.com/mattermost/mattermost-server/v6/server/boards/app" - "github.com/mattermost/mattermost-server/v6/server/boards/model" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/boards/app" + "github.com/mattermost/mattermost-server/server/v8/boards/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) func TestHello(t *testing.T) { diff --git a/server/boards/api/teams.go b/server/boards/api/teams.go index 640fbdff5a..9a93ec1dd7 100644 --- a/server/boards/api/teams.go +++ b/server/boards/api/teams.go @@ -10,9 +10,9 @@ import ( "github.com/gorilla/mux" - "github.com/mattermost/mattermost-server/v6/server/boards/model" - "github.com/mattermost/mattermost-server/v6/server/boards/services/audit" - "github.com/mattermost/mattermost-server/v6/server/boards/utils" + "github.com/mattermost/mattermost-server/server/v8/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/services/audit" + "github.com/mattermost/mattermost-server/server/v8/boards/utils" ) func (a *API) registerTeamsRoutes(r *mux.Router) { diff --git a/server/boards/api/templates.go b/server/boards/api/templates.go index 8ed915336e..ad3212e068 100644 --- a/server/boards/api/templates.go +++ b/server/boards/api/templates.go @@ -9,10 +9,10 @@ import ( "github.com/gorilla/mux" - "github.com/mattermost/mattermost-server/v6/server/boards/model" - "github.com/mattermost/mattermost-server/v6/server/boards/services/audit" + "github.com/mattermost/mattermost-server/server/v8/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/services/audit" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) func (a *API) registerTemplatesRoutes(r *mux.Router) { diff --git a/server/boards/api/users.go b/server/boards/api/users.go index 3e1876b8bf..26e824afca 100644 --- a/server/boards/api/users.go +++ b/server/boards/api/users.go @@ -10,9 +10,9 @@ import ( "github.com/gorilla/mux" - "github.com/mattermost/mattermost-server/v6/server/boards/model" - "github.com/mattermost/mattermost-server/v6/server/boards/services/audit" - "github.com/mattermost/mattermost-server/v6/server/boards/utils" + "github.com/mattermost/mattermost-server/server/v8/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/services/audit" + "github.com/mattermost/mattermost-server/server/v8/boards/utils" ) func (a *API) registerUsersRoutes(r *mux.Router) { diff --git a/server/boards/app/app.go b/server/boards/app/app.go index b7a93adcf3..1e7ba4caea 100644 --- a/server/boards/app/app.go +++ b/server/boards/app/app.go @@ -8,19 +8,19 @@ import ( "sync" "time" - "github.com/mattermost/mattermost-server/v6/server/boards/auth" - "github.com/mattermost/mattermost-server/v6/server/boards/services/config" - "github.com/mattermost/mattermost-server/v6/server/boards/services/metrics" - "github.com/mattermost/mattermost-server/v6/server/boards/services/notify" - "github.com/mattermost/mattermost-server/v6/server/boards/services/permissions" - "github.com/mattermost/mattermost-server/v6/server/boards/services/store" - "github.com/mattermost/mattermost-server/v6/server/boards/services/webhook" - "github.com/mattermost/mattermost-server/v6/server/boards/utils" - "github.com/mattermost/mattermost-server/v6/server/boards/ws" + "github.com/mattermost/mattermost-server/server/v8/boards/auth" + "github.com/mattermost/mattermost-server/server/v8/boards/services/config" + "github.com/mattermost/mattermost-server/server/v8/boards/services/metrics" + "github.com/mattermost/mattermost-server/server/v8/boards/services/notify" + "github.com/mattermost/mattermost-server/server/v8/boards/services/permissions" + "github.com/mattermost/mattermost-server/server/v8/boards/services/store" + "github.com/mattermost/mattermost-server/server/v8/boards/services/webhook" + "github.com/mattermost/mattermost-server/server/v8/boards/utils" + "github.com/mattermost/mattermost-server/server/v8/boards/ws" - mm_model "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/filestore" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + mm_model "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/filestore" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) const ( diff --git a/server/boards/app/app_test.go b/server/boards/app/app_test.go index e24dfd3b48..a938dfd1df 100644 --- a/server/boards/app/app_test.go +++ b/server/boards/app/app_test.go @@ -8,7 +8,7 @@ import ( "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/server/boards/services/config" + "github.com/mattermost/mattermost-server/server/v8/boards/services/config" ) func TestSetConfig(t *testing.T) { diff --git a/server/boards/app/auth.go b/server/boards/app/auth.go index 6648c2f164..e05efa6747 100644 --- a/server/boards/app/auth.go +++ b/server/boards/app/auth.go @@ -4,11 +4,11 @@ package app import ( - "github.com/mattermost/mattermost-server/v6/server/boards/model" - "github.com/mattermost/mattermost-server/v6/server/boards/services/auth" - "github.com/mattermost/mattermost-server/v6/server/boards/utils" + "github.com/mattermost/mattermost-server/server/v8/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/services/auth" + "github.com/mattermost/mattermost-server/server/v8/boards/utils" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" "github.com/pkg/errors" ) diff --git a/server/boards/app/auth_test.go b/server/boards/app/auth_test.go index 7e2d40db79..6f3093139a 100644 --- a/server/boards/app/auth_test.go +++ b/server/boards/app/auth_test.go @@ -10,9 +10,9 @@ import ( "github.com/pkg/errors" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/server/boards/model" - "github.com/mattermost/mattermost-server/v6/server/boards/services/auth" - "github.com/mattermost/mattermost-server/v6/server/boards/utils" + "github.com/mattermost/mattermost-server/server/v8/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/services/auth" + "github.com/mattermost/mattermost-server/server/v8/boards/utils" ) var mockUser = &model.User{ diff --git a/server/boards/app/blocks.go b/server/boards/app/blocks.go index 0e736212c9..136bf736fe 100644 --- a/server/boards/app/blocks.go +++ b/server/boards/app/blocks.go @@ -7,31 +7,20 @@ import ( "errors" "fmt" "path/filepath" - "strings" - "github.com/mattermost/mattermost-server/v6/server/boards/model" - "github.com/mattermost/mattermost-server/v6/server/boards/services/notify" - "github.com/mattermost/mattermost-server/v6/server/boards/utils" + "github.com/mattermost/mattermost-server/server/v8/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/services/notify" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) var ErrBlocksFromMultipleBoards = errors.New("the block set contain blocks from multiple boards") -func (a *App) GetBlocks(boardID, parentID string, blockType string) ([]*model.Block, error) { - if boardID == "" { +func (a *App) GetBlocks(opts model.QueryBlocksOptions) ([]*model.Block, error) { + if opts.BoardID == "" { return []*model.Block{}, nil } - - if blockType != "" && parentID != "" { - return a.store.GetBlocksWithParentAndType(boardID, parentID, blockType) - } - - if blockType != "" { - return a.store.GetBlocksWithType(boardID, blockType) - } - - return a.store.GetBlocksWithParent(boardID, parentID) + return a.store.GetBlocks(opts) } func (a *App) DuplicateBlock(boardID string, blockID string, userID string, asTemplate bool) ([]*model.Block, error) { @@ -48,6 +37,11 @@ func (a *App) DuplicateBlock(boardID string, blockID string, userID string, asTe return nil, err } + err = a.CopyAndUpdateCardFiles(boardID, userID, blocks, asTemplate) + if err != nil { + return nil, err + } + a.blockChangeNotifier.Enqueue(func() error { for _, block := range blocks { a.wsAdapter.BroadcastBlockChange(board.TeamID, block) @@ -295,95 +289,6 @@ func (a *App) InsertBlocksAndNotify(blocks []*model.Block, modifiedByID string, return blocks, nil } -func (a *App) CopyCardFiles(sourceBoardID string, copiedBlocks []*model.Block) error { - // Images attached in cards have a path comprising the card's board ID. - // When we create a template from this board, we need to copy the files - // with the new board ID in path. - // Not doing so causing images in templates (and boards created from this - // template) to fail to load. - - // look up ID of source sourceBoard, which may be different than the blocks. - sourceBoard, err := a.GetBoard(sourceBoardID) - if err != nil || sourceBoard == nil { - return fmt.Errorf("cannot fetch source board %s for CopyCardFiles: %w", sourceBoardID, err) - } - - var destTeamID string - var destBoardID string - - for i := range copiedBlocks { - block := copiedBlocks[i] - fileName := "" - isOk := false - - switch block.Type { - case model.TypeImage: - fileName, isOk = block.Fields["fileId"].(string) - if !isOk || fileName == "" { - continue - } - case model.TypeAttachment: - fileName, isOk = block.Fields["attachmentId"].(string) - if !isOk || fileName == "" { - continue - } - default: - continue - } - - // create unique filename in case we are copying cards within the same board. - ext := filepath.Ext(fileName) - destFilename := utils.NewID(utils.IDTypeNone) + ext - - if destBoardID == "" || block.BoardID != destBoardID { - destBoardID = block.BoardID - destBoard, err := a.GetBoard(destBoardID) - if err != nil { - return fmt.Errorf("cannot fetch destination board %s for CopyCardFiles: %w", sourceBoardID, err) - } - destTeamID = destBoard.TeamID - } - - sourceFilePath := filepath.Join(sourceBoard.TeamID, sourceBoard.ID, fileName) - destinationFilePath := filepath.Join(destTeamID, block.BoardID, destFilename) - - a.logger.Debug( - "Copying card file", - mlog.String("sourceFilePath", sourceFilePath), - mlog.String("destinationFilePath", destinationFilePath), - ) - - if err := a.filesBackend.CopyFile(sourceFilePath, destinationFilePath); err != nil { - a.logger.Error( - "CopyCardFiles failed to copy file", - mlog.String("sourceFilePath", sourceFilePath), - mlog.String("destinationFilePath", destinationFilePath), - mlog.Err(err), - ) - } - if block.Type == model.TypeAttachment { - block.Fields["attachmentId"] = destFilename - parts := strings.Split(fileName, ".") - fileInfoID := parts[0][1:] - fileInfo, err := a.store.GetFileInfo(fileInfoID) - if err != nil { - return fmt.Errorf("CopyCardFiles: cannot retrieve original fileinfo: %w", err) - } - newParts := strings.Split(destFilename, ".") - newFileID := newParts[0][1:] - fileInfo.Id = newFileID - err = a.store.SaveFileInfo(fileInfo) - if err != nil { - return fmt.Errorf("CopyCardFiles: cannot create fileinfo: %w", err) - } - } else { - block.Fields["fileId"] = destFilename - } - } - - return nil -} - func (a *App) GetBlockByID(blockID string) (*model.Block, error) { return a.store.GetBlock(blockID) } @@ -514,10 +419,6 @@ func (a *App) GetBlockCountsByType() (map[string]int64, error) { return a.store.GetBlockCountsByType() } -func (a *App) GetBlocksForBoard(boardID string) ([]*model.Block, error) { - return a.store.GetBlocksForBoard(boardID) -} - func (a *App) notifyBlockChanged(action notify.Action, block *model.Block, oldBlock *model.Block, modifiedByID string) { // don't notify if notifications service disabled, or block change is generated via system user. if a.notifications == nil || modifiedByID == model.SystemUserID { diff --git a/server/boards/app/blocks_test.go b/server/boards/app/blocks_test.go index 9e4f53c2f9..e19ebdae66 100644 --- a/server/boards/app/blocks_test.go +++ b/server/boards/app/blocks_test.go @@ -12,9 +12,9 @@ import ( "github.com/golang/mock/gomock" "github.com/stretchr/testify/require" - mm_model "github.com/mattermost/mattermost-server/v6/model" + mm_model "github.com/mattermost/mattermost-server/server/v8/model" - "github.com/mattermost/mattermost-server/v6/server/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/model" ) type blockError struct { @@ -207,10 +207,17 @@ func TestIsWithinViewsLimit(t *testing.T) { Views: mm_model.NewInt(2), }, } + + opts := model.QueryBlocksOptions{ + BoardID: "board_id", + ParentID: "parent_id", + BlockType: model.BlockType("view"), + } + th.Store.EXPECT().GetCloudLimits().Return(cloudLimit, nil) th.Store.EXPECT().GetUsedCardsCount().Return(1, nil) th.Store.EXPECT().GetCardLimitTimestamp().Return(int64(1), nil) - th.Store.EXPECT().GetBlocksWithParentAndType("board_id", "parent_id", "view").Return([]*model.Block{{}}, nil) + th.Store.EXPECT().GetBlocks(opts).Return([]*model.Block{{}}, nil) withinLimits, err := th.App.isWithinViewsLimit("board_id", &model.Block{ParentID: "parent_id"}) assert.NoError(t, err) @@ -225,10 +232,17 @@ func TestIsWithinViewsLimit(t *testing.T) { Views: mm_model.NewInt(1), }, } + + opts := model.QueryBlocksOptions{ + BoardID: "board_id", + ParentID: "parent_id", + BlockType: model.BlockType("view"), + } + th.Store.EXPECT().GetCloudLimits().Return(cloudLimit, nil) th.Store.EXPECT().GetUsedCardsCount().Return(1, nil) th.Store.EXPECT().GetCardLimitTimestamp().Return(int64(1), nil) - th.Store.EXPECT().GetBlocksWithParentAndType("board_id", "parent_id", "view").Return([]*model.Block{{}}, nil) + th.Store.EXPECT().GetBlocks(opts).Return([]*model.Block{{}}, nil) withinLimits, err := th.App.isWithinViewsLimit("board_id", &model.Block{ParentID: "parent_id"}) assert.NoError(t, err) @@ -243,10 +257,17 @@ func TestIsWithinViewsLimit(t *testing.T) { Views: mm_model.NewInt(2), }, } + + opts := model.QueryBlocksOptions{ + BoardID: "board_id", + ParentID: "parent_id", + BlockType: model.BlockType("view"), + } + th.Store.EXPECT().GetCloudLimits().Return(cloudLimit, nil) th.Store.EXPECT().GetUsedCardsCount().Return(1, nil) th.Store.EXPECT().GetCardLimitTimestamp().Return(int64(1), nil) - th.Store.EXPECT().GetBlocksWithParentAndType("board_id", "parent_id", "view").Return([]*model.Block{{}, {}, {}}, nil) + th.Store.EXPECT().GetBlocks(opts).Return([]*model.Block{{}, {}, {}}, nil) withinLimits, err := th.App.isWithinViewsLimit("board_id", &model.Block{ParentID: "parent_id"}) assert.NoError(t, err) @@ -261,10 +282,17 @@ func TestIsWithinViewsLimit(t *testing.T) { Views: mm_model.NewInt(2), }, } + + opts := model.QueryBlocksOptions{ + BoardID: "board_id", + ParentID: "parent_id", + BlockType: model.BlockType("view"), + } + th.Store.EXPECT().GetCloudLimits().Return(cloudLimit, nil) th.Store.EXPECT().GetUsedCardsCount().Return(1, nil) th.Store.EXPECT().GetCardLimitTimestamp().Return(int64(1), nil) - th.Store.EXPECT().GetBlocksWithParentAndType("board_id", "parent_id", "view").Return([]*model.Block{}, nil) + th.Store.EXPECT().GetBlocks(opts).Return([]*model.Block{}, nil) withinLimits, err := th.App.isWithinViewsLimit("board_id", &model.Block{ParentID: "parent_id"}) assert.NoError(t, err) @@ -333,10 +361,17 @@ func TestInsertBlocks(t *testing.T) { Views: mm_model.NewInt(2), }, } + + opts := model.QueryBlocksOptions{ + BoardID: "test-board-id", + ParentID: "parent_id", + BlockType: model.BlockType("view"), + } + th.Store.EXPECT().GetCloudLimits().Return(cloudLimit, nil) th.Store.EXPECT().GetUsedCardsCount().Return(1, nil) th.Store.EXPECT().GetCardLimitTimestamp().Return(int64(1), nil) - th.Store.EXPECT().GetBlocksWithParentAndType("test-board-id", "parent_id", "view").Return([]*model.Block{{}}, nil) + th.Store.EXPECT().GetBlocks(opts).Return([]*model.Block{{}}, nil) _, err := th.App.InsertBlocks([]*model.Block{block}, "user-id-1") require.NoError(t, err) @@ -365,10 +400,17 @@ func TestInsertBlocks(t *testing.T) { Views: mm_model.NewInt(2), }, } + + opts := model.QueryBlocksOptions{ + BoardID: "test-board-id", + ParentID: "parent_id", + BlockType: model.BlockType("view"), + } + th.Store.EXPECT().GetCloudLimits().Return(cloudLimit, nil) th.Store.EXPECT().GetUsedCardsCount().Return(1, nil) th.Store.EXPECT().GetCardLimitTimestamp().Return(int64(1), nil) - th.Store.EXPECT().GetBlocksWithParentAndType("test-board-id", "parent_id", "view").Return([]*model.Block{{}, {}}, nil) + th.Store.EXPECT().GetBlocks(opts).Return([]*model.Block{{}, {}}, nil) _, err := th.App.InsertBlocks([]*model.Block{block}, "user-id-1") require.Error(t, err) @@ -406,10 +448,17 @@ func TestInsertBlocks(t *testing.T) { Views: mm_model.NewInt(2), }, } + + opts := model.QueryBlocksOptions{ + BoardID: "test-board-id", + ParentID: "parent_id", + BlockType: model.BlockType("view"), + } + th.Store.EXPECT().GetCloudLimits().Return(cloudLimit, nil).Times(2) th.Store.EXPECT().GetUsedCardsCount().Return(1, nil).Times(2) th.Store.EXPECT().GetCardLimitTimestamp().Return(int64(1), nil).Times(2) - th.Store.EXPECT().GetBlocksWithParentAndType("test-board-id", "parent_id", "view").Return([]*model.Block{{}}, nil).Times(2) + th.Store.EXPECT().GetBlocks(opts).Return([]*model.Block{{}}, nil).Times(2) _, err := th.App.InsertBlocks([]*model.Block{view1, view2}, "user-id-1") require.Error(t, err) diff --git a/server/boards/app/boards.go b/server/boards/app/boards.go index b383164e76..1f7fc8c026 100644 --- a/server/boards/app/boards.go +++ b/server/boards/app/boards.go @@ -7,11 +7,11 @@ import ( "errors" "fmt" - "github.com/mattermost/mattermost-server/v6/server/boards/model" - "github.com/mattermost/mattermost-server/v6/server/boards/services/notify" - "github.com/mattermost/mattermost-server/v6/server/boards/utils" + "github.com/mattermost/mattermost-server/server/v8/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/services/notify" + "github.com/mattermost/mattermost-server/server/v8/boards/utils" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) var ( @@ -184,8 +184,13 @@ func (a *App) DuplicateBoard(boardID, userID, toTeam string, asTemplate bool) (* } // copy any file attachments from the duplicated blocks. - if err = a.CopyCardFiles(boardID, bab.Blocks); err != nil { - a.logger.Error("Could not copy files while duplicating board", mlog.String("BoardID", boardID), mlog.Err(err)) + err = a.CopyAndUpdateCardFiles(boardID, userID, bab.Blocks, asTemplate) + if err != nil { + dbab := model.NewDeleteBoardsAndBlocksFromBabs(bab) + if err = a.store.DeleteBoardsAndBlocks(dbab, userID); err != nil { + a.logger.Error("Cannot delete board after duplication error when updating block's file info", mlog.String("boardID", bab.Boards[0].ID), mlog.Err(err)) + } + return nil, nil, fmt.Errorf("could not patch file IDs while duplicating board %s: %w", boardID, err) } if !asTemplate { @@ -196,44 +201,6 @@ func (a *App) DuplicateBoard(boardID, userID, toTeam string, asTemplate bool) (* } } - // bab.Blocks now has updated file ids for any blocks containing files. We need to store them. - blockIDs := make([]string, 0) - blockPatches := make([]model.BlockPatch, 0) - - for _, block := range bab.Blocks { - fieldName := "" - if block.Type == model.TypeImage { - fieldName = "fileId" - } else if block.Type == model.TypeAttachment { - fieldName = "attachmentId" - } - if fieldName != "" { - if fieldID, ok := block.Fields[fieldName]; ok { - blockIDs = append(blockIDs, block.ID) - blockPatches = append(blockPatches, model.BlockPatch{ - UpdatedFields: map[string]interface{}{ - fieldName: fieldID, - }, - }) - } - } - } - a.logger.Debug("Duplicate boards patching file IDs", mlog.Int("count", len(blockIDs))) - - if len(blockIDs) != 0 { - patches := &model.BlockPatchBatch{ - BlockIDs: blockIDs, - BlockPatches: blockPatches, - } - if err = a.store.PatchBlocks(patches, userID); err != nil { - dbab := model.NewDeleteBoardsAndBlocksFromBabs(bab) - if err = a.store.DeleteBoardsAndBlocks(dbab, userID); err != nil { - a.logger.Error("Cannot delete board after duplication error when updating block's file info", mlog.String("boardID", bab.Boards[0].ID), mlog.Err(err)) - } - return nil, nil, fmt.Errorf("could not patch file IDs while duplicating board %s: %w", boardID, err) - } - } - a.blockChangeNotifier.Enqueue(func() error { teamID := "" for _, board := range bab.Boards { diff --git a/server/boards/app/boards_and_blocks.go b/server/boards/app/boards_and_blocks.go index 8a37e980aa..d16188a759 100644 --- a/server/boards/app/boards_and_blocks.go +++ b/server/boards/app/boards_and_blocks.go @@ -4,10 +4,10 @@ package app import ( - "github.com/mattermost/mattermost-server/v6/server/boards/model" - "github.com/mattermost/mattermost-server/v6/server/boards/services/notify" + "github.com/mattermost/mattermost-server/server/v8/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/services/notify" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) func (a *App) CreateBoardsAndBlocks(bab *model.BoardsAndBlocks, userID string, addMember bool) (*model.BoardsAndBlocks, error) { diff --git a/server/boards/app/boards_test.go b/server/boards/app/boards_test.go index 9ea4c4b59d..be672c418d 100644 --- a/server/boards/app/boards_test.go +++ b/server/boards/app/boards_test.go @@ -6,14 +6,14 @@ package app import ( "testing" - "github.com/mattermost/mattermost-server/v6/server/boards/utils" + "github.com/mattermost/mattermost-server/server/v8/boards/utils" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/server/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/model" ) func TestAddMemberToBoard(t *testing.T) { diff --git a/server/boards/app/cards.go b/server/boards/app/cards.go index 23b6c97b77..dea4ed88c7 100644 --- a/server/boards/app/cards.go +++ b/server/boards/app/cards.go @@ -6,8 +6,8 @@ package app import ( "fmt" - "github.com/mattermost/mattermost-server/v6/server/boards/model" - "github.com/mattermost/mattermost-server/v6/server/boards/utils" + "github.com/mattermost/mattermost-server/server/v8/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/utils" ) func (a *App) CreateCard(card *model.Card, boardID string, userID string, disableNotify bool) (*model.Card, error) { diff --git a/server/boards/app/cards_test.go b/server/boards/app/cards_test.go index 81a52fbae4..d1d4b76059 100644 --- a/server/boards/app/cards_test.go +++ b/server/boards/app/cards_test.go @@ -12,8 +12,8 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/server/boards/model" - "github.com/mattermost/mattermost-server/v6/server/boards/utils" + "github.com/mattermost/mattermost-server/server/v8/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/utils" ) func TestCreateCard(t *testing.T) { diff --git a/server/boards/app/category.go b/server/boards/app/category.go index 486b7811d8..ce48580d42 100644 --- a/server/boards/app/category.go +++ b/server/boards/app/category.go @@ -7,8 +7,8 @@ import ( "errors" "fmt" - "github.com/mattermost/mattermost-server/v6/server/boards/model" - "github.com/mattermost/mattermost-server/v6/server/boards/utils" + "github.com/mattermost/mattermost-server/server/v8/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/utils" ) var errCategoryNotFound = errors.New("category ID specified in input does not exist for user") diff --git a/server/boards/app/category_boards.go b/server/boards/app/category_boards.go index 264f48b56c..eb142dea7e 100644 --- a/server/boards/app/category_boards.go +++ b/server/boards/app/category_boards.go @@ -7,7 +7,7 @@ import ( "errors" "fmt" - "github.com/mattermost/mattermost-server/v6/server/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/model" ) const defaultCategoryBoards = "Boards" diff --git a/server/boards/app/category_boards_test.go b/server/boards/app/category_boards_test.go index 93b56df8c6..a158e62292 100644 --- a/server/boards/app/category_boards_test.go +++ b/server/boards/app/category_boards_test.go @@ -6,11 +6,11 @@ package app import ( "testing" - "github.com/mattermost/mattermost-server/v6/server/boards/utils" + "github.com/mattermost/mattermost-server/server/v8/boards/utils" "github.com/stretchr/testify/assert" - "github.com/mattermost/mattermost-server/v6/server/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/model" ) func TestGetUserCategoryBoards(t *testing.T) { diff --git a/server/boards/app/category_test.go b/server/boards/app/category_test.go index 3b31e674b1..63e250d2bf 100644 --- a/server/boards/app/category_test.go +++ b/server/boards/app/category_test.go @@ -8,8 +8,8 @@ import ( "github.com/stretchr/testify/assert" - "github.com/mattermost/mattermost-server/v6/server/boards/model" - "github.com/mattermost/mattermost-server/v6/server/boards/utils" + "github.com/mattermost/mattermost-server/server/v8/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/utils" ) func TestCreateCategory(t *testing.T) { diff --git a/server/boards/app/clientConfig.go b/server/boards/app/clientConfig.go index 7b806d3fde..5814cbc806 100644 --- a/server/boards/app/clientConfig.go +++ b/server/boards/app/clientConfig.go @@ -4,7 +4,7 @@ package app import ( - "github.com/mattermost/mattermost-server/v6/server/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/model" ) func (a *App) GetClientConfig() *model.ClientConfig { diff --git a/server/boards/app/clientConfig_test.go b/server/boards/app/clientConfig_test.go index 3d43f4c9b1..6ec12fb50d 100644 --- a/server/boards/app/clientConfig_test.go +++ b/server/boards/app/clientConfig_test.go @@ -8,7 +8,7 @@ import ( "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/server/boards/services/config" + "github.com/mattermost/mattermost-server/server/v8/boards/services/config" ) func TestGetClientConfig(t *testing.T) { diff --git a/server/boards/app/cloud.go b/server/boards/app/cloud.go index 4dc1b3af5f..8667856706 100644 --- a/server/boards/app/cloud.go +++ b/server/boards/app/cloud.go @@ -7,12 +7,12 @@ import ( "errors" "fmt" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" - mm_model "github.com/mattermost/mattermost-server/v6/model" + mm_model "github.com/mattermost/mattermost-server/server/v8/model" - "github.com/mattermost/mattermost-server/v6/server/boards/model" - "github.com/mattermost/mattermost-server/v6/server/boards/utils" + "github.com/mattermost/mattermost-server/server/v8/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/utils" ) var ErrNilPluginAPI = errors.New("server not running in plugin mode") diff --git a/server/boards/app/cloud_test.go b/server/boards/app/cloud_test.go index ee3b2d1cfb..5c0b7f7357 100644 --- a/server/boards/app/cloud_test.go +++ b/server/boards/app/cloud_test.go @@ -12,10 +12,10 @@ import ( "github.com/golang/mock/gomock" "github.com/stretchr/testify/require" - mm_model "github.com/mattermost/mattermost-server/v6/model" + mm_model "github.com/mattermost/mattermost-server/server/v8/model" - "github.com/mattermost/mattermost-server/v6/server/boards/model" - mockservicesapi "github.com/mattermost/mattermost-server/v6/server/boards/model/mocks" + "github.com/mattermost/mattermost-server/server/v8/boards/model" + mockservicesapi "github.com/mattermost/mattermost-server/server/v8/boards/model/mocks" ) func TestIsCloud(t *testing.T) { diff --git a/server/boards/app/compliance.go b/server/boards/app/compliance.go index 205fca182c..f84c647bc4 100644 --- a/server/boards/app/compliance.go +++ b/server/boards/app/compliance.go @@ -3,7 +3,7 @@ package app -import "github.com/mattermost/mattermost-server/v6/server/boards/model" +import "github.com/mattermost/mattermost-server/server/v8/boards/model" func (a *App) GetBoardsForCompliance(opts model.QueryBoardsForComplianceOptions) ([]*model.Board, bool, error) { return a.store.GetBoardsForCompliance(opts) diff --git a/server/boards/app/content_blocks.go b/server/boards/app/content_blocks.go index fc6e77c6ca..b5711bb9bf 100644 --- a/server/boards/app/content_blocks.go +++ b/server/boards/app/content_blocks.go @@ -8,7 +8,7 @@ import ( "github.com/pkg/errors" - "github.com/mattermost/mattermost-server/v6/server/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/model" ) func (a *App) MoveContentBlock(block *model.Block, dstBlock *model.Block, where string, userID string) error { diff --git a/server/boards/app/content_blocks_test.go b/server/boards/app/content_blocks_test.go index ce603e363b..8447eb3311 100644 --- a/server/boards/app/content_blocks_test.go +++ b/server/boards/app/content_blocks_test.go @@ -11,7 +11,7 @@ import ( "github.com/pkg/errors" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/server/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/model" ) type contentOrderMatcher struct { diff --git a/server/boards/app/export.go b/server/boards/app/export.go index 4f717be041..d8a03d78a8 100644 --- a/server/boards/app/export.go +++ b/server/boards/app/export.go @@ -11,9 +11,9 @@ import ( "github.com/wiggin77/merror" - "github.com/mattermost/mattermost-server/v6/server/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/model" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) var ( @@ -86,7 +86,7 @@ func (a *App) writeArchiveBoard(zw *zip.Writer, board model.Board, opt model.Exp var files []string // write the board's blocks // TODO: paginate this - blocks, err := a.GetBlocksForBoard(board.ID) + blocks, err := a.GetBlocks(model.QueryBlocksOptions{BoardID: board.ID}) if err != nil { return err } @@ -95,10 +95,10 @@ func (a *App) writeArchiveBoard(zw *zip.Writer, board model.Board, opt model.Exp if err = a.writeArchiveBlockLine(w, block); err != nil { return err } - if block.Type == model.TypeImage { - filename, err2 := extractImageFilename(block) + if block.Type == model.TypeImage || block.Type == model.TypeAttachment { + filename, err2 := extractFilename(block) if err2 != nil { - return err + return err2 } files = append(files, filename) } @@ -208,7 +208,10 @@ func (a *App) writeArchiveFile(zw *zip.Writer, filename string, boardID string, return err } - src, err := a.GetFileReader(opt.TeamID, boardID, filename) + _, fileReader, err := a.GetFile(opt.TeamID, boardID, filename) + if err != nil && !model.IsErrNotFound(err) { + return err + } if err != nil { // just log this; image file is missing but we'll still export an equivalent board a.logger.Error("image file missing for export", @@ -218,9 +221,9 @@ func (a *App) writeArchiveFile(zw *zip.Writer, filename string, boardID string, ) return nil } - defer src.Close() + defer fileReader.Close() - _, err = io.Copy(dest, src) + _, err = io.Copy(dest, fileReader) return err } @@ -239,10 +242,13 @@ func (a *App) getBoardsForArchive(boardIDs []string) ([]model.Board, error) { return boards, nil } -func extractImageFilename(imageBlock *model.Block) (string, error) { - f, ok := imageBlock.Fields["fileId"] +func extractFilename(block *model.Block) (string, error) { + f, ok := block.Fields["fileId"] if !ok { - return "", model.ErrInvalidImageBlock + f, ok = block.Fields["attachmentId"] + if !ok { + return "", model.ErrInvalidImageBlock + } } filename, ok := f.(string) diff --git a/server/boards/app/files.go b/server/boards/app/files.go index 97f3eda25c..0212a5176f 100644 --- a/server/boards/app/files.go +++ b/server/boards/app/files.go @@ -10,20 +10,18 @@ import ( "path/filepath" "strings" - mm_model "github.com/mattermost/mattermost-server/v6/model" + mm_model "github.com/mattermost/mattermost-server/server/v8/model" - "github.com/mattermost/mattermost-server/v6/server/boards/model" - "github.com/mattermost/mattermost-server/v6/server/boards/utils" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/filestore" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/utils" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/filestore" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) -const emptyString = "empty" - var errEmptyFilename = errors.New("IsFileArchived: empty filename not allowed") var ErrFileNotFound = errors.New("file not found") -func (a *App) SaveFile(reader io.Reader, teamID, rootID, filename string) (string, error) { +func (a *App) SaveFile(reader io.Reader, teamID, boardID, filename string, asTemplate bool) (string, error) { // NOTE: File extension includes the dot fileExtension := strings.ToLower(filepath.Ext(filename)) if fileExtension == ".jpeg" { @@ -31,44 +29,26 @@ func (a *App) SaveFile(reader io.Reader, teamID, rootID, filename string) (strin } createdFilename := utils.NewID(utils.IDTypeNone) - fullFilename := fmt.Sprintf(`%s%s`, createdFilename, fileExtension) - filePath := filepath.Join(utils.GetBaseFilePath(), fullFilename) + newFileName := fmt.Sprintf(`%s%s`, createdFilename, fileExtension) + if asTemplate { + newFileName = filename + } + filePath := getDestinationFilePath(asTemplate, teamID, boardID, newFileName) fileSize, appErr := a.filesBackend.WriteFile(reader, filePath) if appErr != nil { return "", fmt.Errorf("unable to store the file in the files storage: %w", appErr) } - now := utils.GetMillis() - - fileInfo := &mm_model.FileInfo{ - Id: createdFilename[1:], - CreatorId: "boards", - PostId: emptyString, - ChannelId: emptyString, - CreateAt: now, - UpdateAt: now, - DeleteAt: 0, - Path: filePath, - ThumbnailPath: emptyString, - PreviewPath: emptyString, - Name: filename, - Extension: fileExtension, - Size: fileSize, - MimeType: emptyString, - Width: 0, - Height: 0, - HasPreviewImage: false, - MiniPreview: nil, - Content: "", - RemoteId: nil, - } + fileInfo := model.NewFileInfo(filename) + fileInfo.Id = getFileInfoID(createdFilename) + fileInfo.Path = filePath + fileInfo.Size = fileSize err := a.store.SaveFileInfo(fileInfo) if err != nil { return "", err } - - return fullFilename, nil + return newFileName, nil } func (a *App) GetFileInfo(filename string) (*mm_model.FileInfo, error) { @@ -79,8 +59,7 @@ func (a *App) GetFileInfo(filename string) (*mm_model.FileInfo, error) { // filename is in the format 7. // we want to extract the part of this as this // will be the fileinfo id. - parts := strings.Split(filename, ".") - fileInfoID := parts[0][1:] + fileInfoID := getFileInfoID(strings.Split(filename, ".")[0]) fileInfo, err := a.store.GetFileInfo(fileInfoID) if err != nil { return nil, err @@ -90,10 +69,33 @@ func (a *App) GetFileInfo(filename string) (*mm_model.FileInfo, error) { } func (a *App) GetFile(teamID, rootID, fileName string) (*mm_model.FileInfo, filestore.ReadCloseSeeker, error) { + fileInfo, filePath, err := a.GetFilePath(teamID, rootID, fileName) + if err != nil { + a.logger.Error("GetFile: Failed to GetFilePath.", mlog.String("Team", teamID), mlog.String("board", rootID), mlog.String("filename", fileName), mlog.Err(err)) + return nil, nil, err + } + + exists, err := a.filesBackend.FileExists(filePath) + if err != nil { + a.logger.Error("GetFile: Failed to check if file exists as path. ", mlog.String("Path", filePath), mlog.Err(err)) + return nil, nil, err + } + if !exists { + return nil, nil, ErrFileNotFound + } + + reader, err := a.filesBackend.Reader(filePath) + if err != nil { + a.logger.Error("GetFile: Failed to get file reader of existing file at path", mlog.String("Path", filePath), mlog.Err(err)) + return nil, nil, err + } + return fileInfo, reader, nil +} + +func (a *App) GetFilePath(teamID, rootID, fileName string) (*mm_model.FileInfo, string, error) { fileInfo, err := a.GetFileInfo(fileName) if err != nil && !model.IsErrNotFound(err) { - a.logger.Error("111") - return nil, nil, err + return nil, "", err } var filePath string @@ -104,22 +106,23 @@ func (a *App) GetFile(teamID, rootID, fileName string) (*mm_model.FileInfo, file filePath = filepath.Join(teamID, rootID, fileName) } - exists, err := a.filesBackend.FileExists(filePath) - if err != nil { - a.logger.Error(fmt.Sprintf("GetFile: Failed to check if file exists as path. Path: %s, error: %e", filePath, err)) - return nil, nil, err - } + return fileInfo, filePath, nil +} - if !exists { - return nil, nil, ErrFileNotFound +func getDestinationFilePath(isTemplate bool, teamID, boardID, filename string) string { + // if saving a file for a template, save using the "old method" that is /teamID/boardID/fileName + // this will prevent template files from being deleted by DataRetention, + // which deletes all files inside the "date" subdirectory + if isTemplate { + return filepath.Join(teamID, boardID, filename) } + return filepath.Join(utils.GetBaseFilePath(), filename) +} - reader, err := a.filesBackend.Reader(filePath) - if err != nil { - a.logger.Error(fmt.Sprintf("GetFile: Failed to get file reader of existing file at path: %s, error: %e", filePath, err)) - return nil, nil, err - } - return fileInfo, reader, nil +func getFileInfoID(fileName string) string { + // Boards ids are 27 characters long with a prefix character. + // removing the prefix, returns the 26 character uuid + return fileName[1:] } func (a *App) GetFileReader(teamID, rootID, filename string) (filestore.ReadCloseSeeker, error) { @@ -175,3 +178,121 @@ func (a *App) MoveFile(channelID, teamID, boardID, filename string) error { } return nil } + +func (a *App) CopyAndUpdateCardFiles(boardID, userID string, blocks []*model.Block, asTemplate bool) error { + newFileNames, err := a.CopyCardFiles(boardID, blocks, asTemplate) + if err != nil { + a.logger.Error("Could not copy files while duplicating board", mlog.String("BoardID", boardID), mlog.Err(err)) + } + + // blocks now has updated file ids for any blocks containing files. We need to update the database for them. + blockIDs := make([]string, 0) + blockPatches := make([]model.BlockPatch, 0) + for _, block := range blocks { + if block.Type == model.TypeImage || block.Type == model.TypeAttachment { + if fileID, ok := block.Fields["fileId"].(string); ok { + blockIDs = append(blockIDs, block.ID) + blockPatches = append(blockPatches, model.BlockPatch{ + UpdatedFields: map[string]interface{}{ + "fileId": newFileNames[fileID], + }, + DeletedFields: []string{"attachmentId"}, + }) + } + } + } + a.logger.Debug("Duplicate boards patching file IDs", mlog.Int("count", len(blockIDs))) + + if len(blockIDs) != 0 { + patches := &model.BlockPatchBatch{ + BlockIDs: blockIDs, + BlockPatches: blockPatches, + } + if err := a.store.PatchBlocks(patches, userID); err != nil { + return fmt.Errorf("could not patch file IDs while duplicating board %s: %w", boardID, err) + } + } + + return nil +} + +func (a *App) CopyCardFiles(sourceBoardID string, copiedBlocks []*model.Block, asTemplate bool) (map[string]string, error) { + // Images attached in cards have a path comprising the card's board ID. + // When we create a template from this board, we need to copy the files + // with the new board ID in path. + // Not doing so causing images in templates (and boards created from this + // template) to fail to load. + + // look up ID of source sourceBoard, which may be different than the blocks. + sourceBoard, err := a.GetBoard(sourceBoardID) + if err != nil || sourceBoard == nil { + return nil, fmt.Errorf("cannot fetch source board %s for CopyCardFiles: %w", sourceBoardID, err) + } + + var destBoard *model.Board + newFileNames := make(map[string]string) + for _, block := range copiedBlocks { + if block.Type != model.TypeImage && block.Type != model.TypeAttachment { + continue + } + + fileId, isOk := block.Fields["fileId"].(string) + if !isOk { + fileId, isOk = block.Fields["attachmentId"].(string) + if !isOk { + continue + } + } + + // create unique filename + ext := filepath.Ext(fileId) + fileInfoID := utils.NewID(utils.IDTypeNone) + destFilename := fileInfoID + ext + + if destBoard == nil || block.BoardID != destBoard.ID { + destBoard = sourceBoard + if block.BoardID != destBoard.ID { + destBoard, err = a.GetBoard(block.BoardID) + if err != nil { + return nil, fmt.Errorf("cannot fetch destination board %s for CopyCardFiles: %w", sourceBoardID, err) + } + } + } + + // GetFilePath will retrieve the correct path + // depending on whether FileInfo table is used for the file. + fileInfo, sourceFilePath, err := a.GetFilePath(sourceBoard.TeamID, sourceBoard.ID, fileId) + if err != nil { + return nil, fmt.Errorf("cannot fetch destination board %s for CopyCardFiles: %w", sourceBoardID, err) + } + destinationFilePath := getDestinationFilePath(asTemplate, destBoard.TeamID, destBoard.ID, destFilename) + + if fileInfo == nil { + fileInfo = model.NewFileInfo(destFilename) + } + fileInfo.Id = getFileInfoID(fileInfoID) + fileInfo.Path = destinationFilePath + err = a.store.SaveFileInfo(fileInfo) + if err != nil { + return nil, fmt.Errorf("CopyCardFiles: cannot create fileinfo: %w", err) + } + + a.logger.Debug( + "Copying card file", + mlog.String("sourceFilePath", sourceFilePath), + mlog.String("destinationFilePath", destinationFilePath), + ) + + if err := a.filesBackend.CopyFile(sourceFilePath, destinationFilePath); err != nil { + a.logger.Error( + "CopyCardFiles failed to copy file", + mlog.String("sourceFilePath", sourceFilePath), + mlog.String("destinationFilePath", destinationFilePath), + mlog.Err(err), + ) + } + newFileNames[fileId] = destFilename + } + + return newFileNames, nil +} diff --git a/server/boards/app/files_test.go b/server/boards/app/files_test.go index fc6a363da5..c494b8a872 100644 --- a/server/boards/app/files_test.go +++ b/server/boards/app/files_test.go @@ -15,10 +15,11 @@ import ( "github.com/golang/mock/gomock" "github.com/stretchr/testify/assert" - mm_model "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/plugin/plugintest/mock" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/filestore" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/filestore/mocks" + "github.com/mattermost/mattermost-server/server/v8/boards/model" + mm_model "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/filestore" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/filestore/mocks" + "github.com/mattermost/mattermost-server/server/v8/plugin/plugintest/mock" ) const ( @@ -210,7 +211,7 @@ func TestSaveFile(t *testing.T) { } mockedFileBackend.On("WriteFile", mockedReadCloseSeek, mock.Anything).Return(writeFileFunc, writeFileErrorFunc) - actual, err := th.App.SaveFile(mockedReadCloseSeek, "1", testBoardID, fileName) + actual, err := th.App.SaveFile(mockedReadCloseSeek, "1", testBoardID, fileName, false) assert.Equal(t, fileName, actual) assert.NoError(t, err) }) @@ -234,7 +235,7 @@ func TestSaveFile(t *testing.T) { } mockedFileBackend.On("WriteFile", mockedReadCloseSeek, mock.Anything).Return(writeFileFunc, writeFileErrorFunc) - actual, err := th.App.SaveFile(mockedReadCloseSeek, "1", "test-board-id", fileName) + actual, err := th.App.SaveFile(mockedReadCloseSeek, "1", "test-board-id", fileName, false) assert.NoError(t, err) assert.NotNil(t, actual) }) @@ -258,7 +259,7 @@ func TestSaveFile(t *testing.T) { } mockedFileBackend.On("WriteFile", mockedReadCloseSeek, mock.Anything).Return(writeFileFunc, writeFileErrorFunc) - actual, err := th.App.SaveFile(mockedReadCloseSeek, "1", "test-board-id", fileName) + actual, err := th.App.SaveFile(mockedReadCloseSeek, "1", "test-board-id", fileName, false) assert.Equal(t, "", actual) assert.Equal(t, "unable to store the file in the files storage: Mocked File backend error", err.Error()) }) @@ -312,7 +313,7 @@ func TestGetFileInfo(t *testing.T) { func TestGetFile(t *testing.T) { th, _ := SetupTestHelper(t) - t.Run("when FileInfo exists", func(t *testing.T) { + t.Run("happy path, no errors", func(t *testing.T) { th.Store.EXPECT().GetFileInfo("fileInfoID").Return(&mm_model.FileInfo{ Id: "fileInfoID", Path: "/path/to/file/fileName.txt", @@ -337,27 +338,72 @@ func TestGetFile(t *testing.T) { assert.NotNil(t, seeker) }) - t.Run("when FileInfo doesn't exist", func(t *testing.T) { - th.Store.EXPECT().GetFileInfo("fileInfoID").Return(nil, nil) + t.Run("when GetFilePath() throws error", func(t *testing.T) { + th.Store.EXPECT().GetFileInfo("fileInfoID").Return(nil, errDummy) + + fileInfo, seeker, err := th.App.GetFile("teamID", "boardID", "7fileInfoID.txt") + assert.Error(t, err) + assert.Nil(t, fileInfo) + assert.Nil(t, seeker) + }) + + t.Run("when FileExists returns false", func(t *testing.T) { + th.Store.EXPECT().GetFileInfo("fileInfoID").Return(&mm_model.FileInfo{ + Id: "fileInfoID", + Path: "/path/to/file/fileName.txt", + }, nil) mockedFileBackend := &mocks.FileBackend{} th.App.filesBackend = mockedFileBackend - mockedReadCloseSeek := &mocks.ReadCloseSeeker{} - readerFunc := func(path string) filestore.ReadCloseSeeker { - return mockedReadCloseSeek - } - - readerErrorFunc := func(path string) error { - return nil - } - - mockedFileBackend.On("Reader", "teamID/boardID/7fileInfoID.txt").Return(readerFunc, readerErrorFunc) - mockedFileBackend.On("FileExists", "teamID/boardID/7fileInfoID.txt").Return(true, nil) + mockedFileBackend.On("FileExists", "/path/to/file/fileName.txt").Return(false, nil) fileInfo, seeker, err := th.App.GetFile("teamID", "boardID", "7fileInfoID.txt") + assert.Error(t, err) + assert.Nil(t, fileInfo) + assert.Nil(t, seeker) + }) + t.Run("when FileReader throws error", func(t *testing.T) { + th.Store.EXPECT().GetFileInfo("fileInfoID").Return(&mm_model.FileInfo{ + Id: "fileInfoID", + Path: "/path/to/file/fileName.txt", + }, nil) + + mockedFileBackend := &mocks.FileBackend{} + th.App.filesBackend = mockedFileBackend + mockedFileBackend.On("Reader", "/path/to/file/fileName.txt").Return(nil, errDummy) + mockedFileBackend.On("FileExists", "/path/to/file/fileName.txt").Return(true, nil) + + fileInfo, seeker, err := th.App.GetFile("teamID", "boardID", "7fileInfoID.txt") + assert.Error(t, err) + assert.Nil(t, fileInfo) + assert.Nil(t, seeker) + }) + +} + +func TestGetFilePath(t *testing.T) { + th, _ := SetupTestHelper(t) + + t.Run("when FileInfo exists", func(t *testing.T) { + path := "/path/to/file/fileName.txt" + th.Store.EXPECT().GetFileInfo("fileInfoID").Return(&mm_model.FileInfo{ + Id: "fileInfoID", + Path: path, + }, nil) + + fileInfo, filePath, err := th.App.GetFilePath("teamID", "boardID", "7fileInfoID.txt") + assert.NoError(t, err) + assert.NotNil(t, fileInfo) + assert.Equal(t, path, filePath) + }) + + t.Run("when FileInfo doesn't exist", func(t *testing.T) { + th.Store.EXPECT().GetFileInfo("fileInfoID").Return(nil, nil) + + fileInfo, filePath, err := th.App.GetFilePath("teamID", "boardID", "7fileInfoID.txt") assert.NoError(t, err) assert.Nil(t, fileInfo) - assert.NotNil(t, seeker) + assert.Equal(t, "teamID/boardID/7fileInfoID.txt", filePath) }) t.Run("when FileInfo exists but FileInfo.Path is not set", func(t *testing.T) { @@ -366,22 +412,158 @@ func TestGetFile(t *testing.T) { Path: "", }, nil) - mockedFileBackend := &mocks.FileBackend{} - th.App.filesBackend = mockedFileBackend - mockedReadCloseSeek := &mocks.ReadCloseSeeker{} - readerFunc := func(path string) filestore.ReadCloseSeeker { - return mockedReadCloseSeek - } - - readerErrorFunc := func(path string) error { - return nil - } - mockedFileBackend.On("Reader", "teamID/boardID/7fileInfoID.txt").Return(readerFunc, readerErrorFunc) - mockedFileBackend.On("FileExists", "teamID/boardID/7fileInfoID.txt").Return(true, nil) - - fileInfo, seeker, err := th.App.GetFile("teamID", "boardID", "7fileInfoID.txt") + fileInfo, filePath, err := th.App.GetFilePath("teamID", "boardID", "7fileInfoID.txt") assert.NoError(t, err) assert.NotNil(t, fileInfo) - assert.NotNil(t, seeker) + assert.Equal(t, "teamID/boardID/7fileInfoID.txt", filePath) + }) +} + +func TestCopyCard(t *testing.T) { + th, _ := SetupTestHelper(t) + imageBlock := &model.Block{ + ID: "imageBlock", + ParentID: "c3zqnh6fsu3f4mr6hzq9hizwske", + CreatedBy: "6k6ynxdp47dujjhhojw9nqhmyh", + ModifiedBy: "6k6ynxdp47dujjhhojw9nqhmyh", + Schema: 1, + Type: "image", + Title: "", + Fields: map[string]interface{}{"fileId": "7fileName.jpg"}, + CreateAt: 1680725585250, + UpdateAt: 1680725585250, + DeleteAt: 0, + BoardID: "boardID", + } + t.Run("Board doesn't exist", func(t *testing.T) { + th.Store.EXPECT().GetBoard("boardID").Return(nil, errDummy) + _, err := th.App.CopyCardFiles("boardID", []*model.Block{}, false) + assert.Error(t, err) + }) + + t.Run("Board exists, image block, with FileInfo", func(t *testing.T) { + path := "/path/to/file/fileName.txt" + fileInfo := &mm_model.FileInfo{ + Id: "imageBlock", + Path: path, + } + th.Store.EXPECT().GetBoard("boardID").Return(&model.Board{ + ID: "boardID", + IsTemplate: false, + }, nil) + th.Store.EXPECT().GetFileInfo("fileName").Return(fileInfo, nil) + th.Store.EXPECT().SaveFileInfo(fileInfo).Return(nil) + + mockedFileBackend := &mocks.FileBackend{} + th.App.filesBackend = mockedFileBackend + mockedFileBackend.On("CopyFile", mock.Anything, mock.Anything).Return(nil) + + updatedFileNames, err := th.App.CopyCardFiles("boardID", []*model.Block{imageBlock}, false) + assert.NoError(t, err) + assert.Equal(t, "7fileName.jpg", imageBlock.Fields["fileId"]) + assert.NotNil(t, updatedFileNames["7fileName.jpg"]) + assert.NotNil(t, updatedFileNames[imageBlock.Fields["fileId"].(string)]) + }) + + t.Run("Board exists, attachment block, with FileInfo", func(t *testing.T) { + attachmentBlock := &model.Block{ + ID: "attachmentBlock", + ParentID: "c3zqnh6fsu3f4mr6hzq9hizwske", + CreatedBy: "6k6ynxdp47dujjhhojw9nqhmyh", + ModifiedBy: "6k6ynxdp47dujjhhojw9nqhmyh", + Schema: 1, + Type: "attachment", + Title: "", + Fields: map[string]interface{}{"fileId": "7fileName.jpg"}, + CreateAt: 1680725585250, + UpdateAt: 1680725585250, + DeleteAt: 0, + BoardID: "boardID", + } + + path := "/path/to/file/fileName.txt" + fileInfo := &mm_model.FileInfo{ + Id: "attachmentBlock", + Path: path, + } + th.Store.EXPECT().GetBoard("boardID").Return(&model.Board{ + ID: "boardID", + IsTemplate: false, + }, nil) + th.Store.EXPECT().GetFileInfo("fileName").Return(fileInfo, nil) + th.Store.EXPECT().SaveFileInfo(fileInfo).Return(nil) + + mockedFileBackend := &mocks.FileBackend{} + th.App.filesBackend = mockedFileBackend + mockedFileBackend.On("CopyFile", mock.Anything, mock.Anything).Return(nil) + + updatedFileNames, err := th.App.CopyCardFiles("boardID", []*model.Block{attachmentBlock}, false) + assert.NoError(t, err) + assert.NotNil(t, updatedFileNames[imageBlock.Fields["fileId"].(string)]) + }) + + t.Run("Board exists, image block, without FileInfo", func(t *testing.T) { + // path := "/path/to/file/fileName.txt" + // fileInfo := &mm_model.FileInfo{ + // Id: "imageBlock", + // Path: path, + // } + th.Store.EXPECT().GetBoard("boardID").Return(&model.Board{ + ID: "boardID", + IsTemplate: false, + }, nil) + th.Store.EXPECT().GetFileInfo(gomock.Any()).Return(nil, nil) + th.Store.EXPECT().SaveFileInfo(gomock.Any()).Return(nil) + + mockedFileBackend := &mocks.FileBackend{} + th.App.filesBackend = mockedFileBackend + mockedFileBackend.On("CopyFile", mock.Anything, mock.Anything).Return(nil) + + updatedFileNames, err := th.App.CopyCardFiles("boardID", []*model.Block{imageBlock}, false) + assert.NoError(t, err) + assert.NotNil(t, imageBlock.Fields["fileId"].(string)) + assert.NotNil(t, updatedFileNames[imageBlock.Fields["fileId"].(string)]) + }) +} + +func TestCopyAndUpdateCardFiles(t *testing.T) { + th, _ := SetupTestHelper(t) + imageBlock := &model.Block{ + ID: "imageBlock", + ParentID: "c3zqnh6fsu3f4mr6hzq9hizwske", + CreatedBy: "6k6ynxdp47dujjhhojw9nqhmyh", + ModifiedBy: "6k6ynxdp47dujjhhojw9nqhmyh", + Schema: 1, + Type: "image", + Title: "", + Fields: map[string]interface{}{"fileId": "7fileName.jpg"}, + CreateAt: 1680725585250, + UpdateAt: 1680725585250, + DeleteAt: 0, + BoardID: "boardID", + } + + t.Run("Board exists, image block, with FileInfo", func(t *testing.T) { + path := "/path/to/file/fileName.txt" + fileInfo := &mm_model.FileInfo{ + Id: "imageBlock", + Path: path, + } + th.Store.EXPECT().GetBoard("boardID").Return(&model.Board{ + ID: "boardID", + IsTemplate: false, + }, nil) + th.Store.EXPECT().GetFileInfo("fileName").Return(fileInfo, nil) + th.Store.EXPECT().SaveFileInfo(fileInfo).Return(nil) + th.Store.EXPECT().PatchBlocks(gomock.Any(), "userID").Return(nil) + + mockedFileBackend := &mocks.FileBackend{} + th.App.filesBackend = mockedFileBackend + mockedFileBackend.On("CopyFile", mock.Anything, mock.Anything).Return(nil) + + err := th.App.CopyAndUpdateCardFiles("boardID", "userID", []*model.Block{imageBlock}, false) + assert.NoError(t, err) + + assert.NotEqual(t, path, imageBlock.Fields["fileId"]) }) } diff --git a/server/boards/app/helper_test.go b/server/boards/app/helper_test.go index 75df2aa843..d337592a79 100644 --- a/server/boards/app/helper_test.go +++ b/server/boards/app/helper_test.go @@ -7,18 +7,18 @@ import ( "github.com/golang/mock/gomock" - "github.com/mattermost/mattermost-server/v6/server/boards/auth" - "github.com/mattermost/mattermost-server/v6/server/boards/services/config" - "github.com/mattermost/mattermost-server/v6/server/boards/services/metrics" - "github.com/mattermost/mattermost-server/v6/server/boards/services/permissions/mmpermissions" - mmpermissionsMocks "github.com/mattermost/mattermost-server/v6/server/boards/services/permissions/mmpermissions/mocks" - permissionsMocks "github.com/mattermost/mattermost-server/v6/server/boards/services/permissions/mocks" - "github.com/mattermost/mattermost-server/v6/server/boards/services/store/mockstore" - "github.com/mattermost/mattermost-server/v6/server/boards/services/webhook" - "github.com/mattermost/mattermost-server/v6/server/boards/ws" + "github.com/mattermost/mattermost-server/server/v8/boards/auth" + "github.com/mattermost/mattermost-server/server/v8/boards/services/config" + "github.com/mattermost/mattermost-server/server/v8/boards/services/metrics" + "github.com/mattermost/mattermost-server/server/v8/boards/services/permissions/mmpermissions" + mmpermissionsMocks "github.com/mattermost/mattermost-server/server/v8/boards/services/permissions/mmpermissions/mocks" + permissionsMocks "github.com/mattermost/mattermost-server/server/v8/boards/services/permissions/mocks" + "github.com/mattermost/mattermost-server/server/v8/boards/services/store/mockstore" + "github.com/mattermost/mattermost-server/server/v8/boards/services/webhook" + "github.com/mattermost/mattermost-server/server/v8/boards/ws" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/filestore/mocks" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/filestore/mocks" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) type TestHelper struct { diff --git a/server/boards/app/import.go b/server/boards/app/import.go index 7b4d5a1607..1b30c09a88 100644 --- a/server/boards/app/import.go +++ b/server/boards/app/import.go @@ -16,10 +16,10 @@ import ( "github.com/krolaw/zipstream" - "github.com/mattermost/mattermost-server/v6/server/boards/model" - "github.com/mattermost/mattermost-server/v6/server/boards/utils" + "github.com/mattermost/mattermost-server/server/v8/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/utils" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) const ( @@ -44,27 +44,19 @@ func (a *App) ImportArchive(r io.Reader, opt model.ImportArchiveOptions) error { a.logger.Debug("importing legacy archive") _, errImport := a.ImportBoardJSONL(br, opt) - go func() { - if err := a.UpdateCardLimitTimestamp(); err != nil { - a.logger.Error( - "UpdateCardLimitTimestamp failed after importing a legacy file", - mlog.Err(err), - ) - } - }() - return errImport } - a.logger.Debug("importing archive") zr := zipstream.NewReader(br) - boardMap := make(map[string]string) // maps old board ids to new + boardMap := make(map[string]*model.Board) // maps old board ids to new + fileMap := make(map[string]string) // maps old fileIds to new for { hdr, err := zr.Next() if err != nil { if errors.Is(err, io.EOF) { + a.fixImagesAttachments(boardMap, fileMap, opt.TeamID, opt.ModifiedBy) a.logger.Debug("import archive - done", mlog.Int("boards_imported", len(boardMap))) return nil } @@ -84,14 +76,14 @@ func (a *App) ImportArchive(r io.Reader, opt model.ImportArchiveOptions) error { return model.NewErrUnsupportedArchiveVersion(ver, archiveVersion) } case "board.jsonl": - boardID, err := a.ImportBoardJSONL(zr, opt) + board, err := a.ImportBoardJSONL(zr, opt) if err != nil { return fmt.Errorf("cannot import board %s: %w", dir, err) } - boardMap[dir] = boardID + boardMap[dir] = board default: // import file/image; dir is the old board id - boardID, ok := boardMap[dir] + board, ok := boardMap[dir] if !ok { a.logger.Warn("skipping orphan image in archive", mlog.String("dir", dir), @@ -99,33 +91,63 @@ func (a *App) ImportArchive(r io.Reader, opt model.ImportArchiveOptions) error { ) continue } - // save file with original filename so it matches name in image block. - filePath := filepath.Join(opt.TeamID, boardID, filename) - _, err := a.filesBackend.WriteFile(zr, filePath) + + newFileName, err := a.SaveFile(zr, opt.TeamID, board.ID, filename, board.IsTemplate) if err != nil { return fmt.Errorf("cannot import file %s for board %s: %w", filename, dir, err) } + fileMap[filename] = newFileName + + a.logger.Debug("import archive file", + mlog.String("TeamID", opt.TeamID), + mlog.String("boardID", board.ID), + mlog.String("filename", filename), + mlog.String("newFileName", newFileName), + ) + } + } +} + +// Update image and attachment blocks +func (a *App) fixImagesAttachments(boardMap map[string]*model.Board, fileMap map[string]string, teamID string, userId string) { + blockIDs := make([]string, 0) + blockPatches := make([]model.BlockPatch, 0) + for _, board := range boardMap { + if board.IsTemplate { + continue } - a.logger.Trace("import archive file", - mlog.String("dir", dir), - mlog.String("filename", filename), - ) + opts := model.QueryBlocksOptions{ + BoardID: board.ID, + } + newBlocks, err := a.GetBlocks(opts) + if err != nil { + a.logger.Info("cannot retrieve imported blocks for board", mlog.String("BoardID", board.ID), mlog.Err(err)) + return + } - go func() { - if err := a.UpdateCardLimitTimestamp(); err != nil { - a.logger.Error( - "UpdateCardLimitTimestamp failed after importing an archive", - mlog.Err(err), - ) + for _, block := range newBlocks { + if block.Type == "image" || block.Type == "attachment" { + fieldName := "fileId" + oldId := block.Fields[fieldName] + blockIDs = append(blockIDs, block.ID) + + blockPatches = append(blockPatches, model.BlockPatch{ + UpdatedFields: map[string]interface{}{ + fieldName: fileMap[oldId.(string)], + }, + }) } - }() + } + + blockPatchBatch := model.BlockPatchBatch{BlockIDs: blockIDs, BlockPatches: blockPatches} + a.PatchBlocks(teamID, &blockPatchBatch, userId) } } // ImportBoardJSONL imports a JSONL file containing blocks for one board. The resulting // board id is returned. -func (a *App) ImportBoardJSONL(r io.Reader, opt model.ImportArchiveOptions) (string, error) { +func (a *App) ImportBoardJSONL(r io.Reader, opt model.ImportArchiveOptions) (*model.Board, error) { // TODO: Stream this once `model.GenerateBlockIDs` can take a stream of blocks. // We don't want to load the whole file in memory, even though it's a single board. boardsAndBlocks := &model.BoardsAndBlocks{ @@ -158,7 +180,7 @@ func (a *App) ImportBoardJSONL(r io.Reader, opt model.ImportArchiveOptions) (str if !skip { var archiveLine model.ArchiveLine if err := json.Unmarshal(line, &archiveLine); err != nil { - return "", fmt.Errorf("error parsing archive line %d: %w", lineNum, err) + return nil, fmt.Errorf("error parsing archive line %d: %w", lineNum, err) } // first line must be a board @@ -170,7 +192,7 @@ func (a *App) ImportBoardJSONL(r io.Reader, opt model.ImportArchiveOptions) (str case "board": var board model.Board if err2 := json.Unmarshal(archiveLine.Data, &board); err2 != nil { - return "", fmt.Errorf("invalid board in archive line %d: %w", lineNum, err2) + return nil, fmt.Errorf("invalid board in archive line %d: %w", lineNum, err2) } board.ModifiedBy = userID board.UpdateAt = now @@ -181,20 +203,20 @@ func (a *App) ImportBoardJSONL(r io.Reader, opt model.ImportArchiveOptions) (str // legacy archives encoded boards as blocks; we need to convert them to real boards. var block *model.Block if err2 := json.Unmarshal(archiveLine.Data, &block); err2 != nil { - return "", fmt.Errorf("invalid board block in archive line %d: %w", lineNum, err2) + return nil, fmt.Errorf("invalid board block in archive line %d: %w", lineNum, err2) } block.ModifiedBy = userID block.UpdateAt = now board, err := a.blockToBoard(block, opt) if err != nil { - return "", fmt.Errorf("cannot convert archive line %d to block: %w", lineNum, err) + return nil, fmt.Errorf("cannot convert archive line %d to block: %w", lineNum, err) } boardsAndBlocks.Boards = append(boardsAndBlocks.Boards, board) boardID = board.ID case "block": var block *model.Block if err2 := json.Unmarshal(archiveLine.Data, &block); err2 != nil { - return "", fmt.Errorf("invalid block in archive line %d: %w", lineNum, err2) + return nil, fmt.Errorf("invalid block in archive line %d: %w", lineNum, err2) } block.ModifiedBy = userID block.UpdateAt = now @@ -203,11 +225,11 @@ func (a *App) ImportBoardJSONL(r io.Reader, opt model.ImportArchiveOptions) (str case "boardMember": var boardMember *model.BoardMember if err2 := json.Unmarshal(archiveLine.Data, &boardMember); err2 != nil { - return "", fmt.Errorf("invalid board Member in archive line %d: %w", lineNum, err2) + return nil, fmt.Errorf("invalid board Member in archive line %d: %w", lineNum, err2) } boardMembers = append(boardMembers, boardMember) default: - return "", model.NewErrUnsupportedArchiveLineType(lineNum, archiveLine.Type) + return nil, model.NewErrUnsupportedArchiveLineType(lineNum, archiveLine.Type) } firstLine = false } @@ -217,7 +239,7 @@ func (a *App) ImportBoardJSONL(r io.Reader, opt model.ImportArchiveOptions) (str if errors.Is(errRead, io.EOF) { break } - return "", fmt.Errorf("error reading archive line %d: %w", lineNum, errRead) + return nil, fmt.Errorf("error reading archive line %d: %w", lineNum, errRead) } lineNum++ } @@ -234,12 +256,12 @@ func (a *App) ImportBoardJSONL(r io.Reader, opt model.ImportArchiveOptions) (str var err error boardsAndBlocks, err = model.GenerateBoardsAndBlocksIDs(boardsAndBlocks, a.logger) if err != nil { - return "", fmt.Errorf("error generating archive block IDs: %w", err) + return nil, fmt.Errorf("error generating archive block IDs: %w", err) } boardsAndBlocks, err = a.CreateBoardsAndBlocks(boardsAndBlocks, opt.ModifiedBy, false) if err != nil { - return "", fmt.Errorf("error inserting archive blocks: %w", err) + return nil, fmt.Errorf("error inserting archive blocks: %w", err) } // add users to all the new boards (if not the fake system user). @@ -251,7 +273,7 @@ func (a *App) ImportBoardJSONL(r io.Reader, opt model.ImportArchiveOptions) (str SchemeAdmin: true, } if _, err2 := a.AddMemberToBoard(adminMember); err2 != nil { - return "", fmt.Errorf("cannot add adminMember to board: %w", err2) + return nil, fmt.Errorf("cannot add adminMember to board: %w", err2) } for _, boardMember := range boardMembers { bm := &model.BoardMember{ @@ -266,16 +288,16 @@ func (a *App) ImportBoardJSONL(r io.Reader, opt model.ImportArchiveOptions) (str Synthetic: boardMember.Synthetic, } if _, err2 := a.AddMemberToBoard(bm); err2 != nil { - return "", fmt.Errorf("cannot add member to board: %w", err2) + return nil, fmt.Errorf("cannot add member to board: %w", err2) } } } // find new board id for _, board := range boardsAndBlocks.Boards { - return board.ID, nil + return board, nil } - return "", fmt.Errorf("missing board in archive: %w", model.ErrInvalidBoardBlock) + return nil, fmt.Errorf("missing board in archive: %w", model.ErrInvalidBoardBlock) } // fixBoardsandBlocks allows the caller of `ImportArchive` to modify or filters boards and blocks being diff --git a/server/boards/app/import_test.go b/server/boards/app/import_test.go index 2b4f7342c5..061549cbad 100644 --- a/server/boards/app/import_test.go +++ b/server/boards/app/import_test.go @@ -7,12 +7,12 @@ import ( "bytes" "testing" - "github.com/mattermost/mattermost-server/v6/server/boards/utils" + "github.com/mattermost/mattermost-server/server/v8/boards/utils" "github.com/golang/mock/gomock" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/server/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/model" ) func TestApp_ImportArchive(t *testing.T) { @@ -138,9 +138,76 @@ func TestApp_ImportArchive(t *testing.T) { th.Store.EXPECT().GetUserByID("hxxzooc3ff8cubsgtcmpn8733e").AnyTimes().Return(user2, nil) th.Store.EXPECT().GetUserByID("nto73edn5ir6ifimo5a53y1dwa").AnyTimes().Return(user3, nil) - boardID, err := th.App.ImportBoardJSONL(r, opts) - require.Equal(t, board.ID, boardID, "Board ID should be same") + newBoard, err := th.App.ImportBoardJSONL(r, opts) require.NoError(t, err, "import archive should not fail") + require.Equal(t, board.ID, newBoard.ID, "Board ID should be same") + }) + + t.Run("fix image and attachment", func(t *testing.T) { + boardMap := map[string]*model.Board{ + "test": board, + } + + fileMap := map[string]string{ + "oldFileName1.jpg": "newFileName1.jpg", + "oldFileName2.jpg": "newFileName2.jpg", + } + + imageBlock := &model.Block{ + ID: "blockID-1", + ParentID: "c3zqnh6fsu3f4mr6hzq9hizwske", + CreatedBy: "6k6ynxdp47dujjhhojw9nqhmyh", + ModifiedBy: "6k6ynxdp47dujjhhojw9nqhmyh", + Schema: 1, + Type: "image", + Title: "", + Fields: map[string]interface{}{"fileId": "oldFileName1.jpg"}, + CreateAt: 1680725585250, + UpdateAt: 1680725585250, + DeleteAt: 0, + BoardID: "board-id", + } + + attachmentBlock := &model.Block{ + ID: "blockID-2", + ParentID: "c3zqnh6fsu3f4mr6hzq9hizwske", + CreatedBy: "6k6ynxdp47dujjhhojw9nqhmyh", + ModifiedBy: "6k6ynxdp47dujjhhojw9nqhmyh", + Schema: 1, + Type: "attachment", + Title: "", + Fields: map[string]interface{}{"fileId": "oldFileName2.jpg"}, + CreateAt: 1680725585250, + UpdateAt: 1680725585250, + DeleteAt: 0, + BoardID: "board-id", + } + + blockIDs := []string{"blockID-1", "blockID-2"} + + blockPatch := model.BlockPatch{ + UpdatedFields: map[string]interface{}{"fileId": "newFileName1.jpg"}, + } + + blockPatch2 := model.BlockPatch{ + UpdatedFields: map[string]interface{}{"fileId": "newFileName2.jpg"}, + } + + blockPatches := []model.BlockPatch{blockPatch, blockPatch2} + + blockPatchesBatch := model.BlockPatchBatch{BlockIDs: blockIDs, BlockPatches: blockPatches} + + opts := model.QueryBlocksOptions{ + BoardID: board.ID, + } + th.Store.EXPECT().GetBlocks(opts).Return([]*model.Block{imageBlock, attachmentBlock}, nil) + th.Store.EXPECT().GetBlocksByIDs(blockIDs).Return([]*model.Block{imageBlock, attachmentBlock}, nil) + th.Store.EXPECT().GetBlock(blockIDs[0]).Return(imageBlock, nil) + th.Store.EXPECT().GetBlock(blockIDs[1]).Return(attachmentBlock, nil) + th.Store.EXPECT().GetMembersForBoard("board-id").AnyTimes().Return([]*model.BoardMember{}, nil) + + th.Store.EXPECT().PatchBlocks(&blockPatchesBatch, "my-userid") + th.App.fixImagesAttachments(boardMap, fileMap, "test-team", "my-userid") }) } diff --git a/server/boards/app/initialize.go b/server/boards/app/initialize.go index 408c00bcac..0e63a3057f 100644 --- a/server/boards/app/initialize.go +++ b/server/boards/app/initialize.go @@ -6,7 +6,7 @@ package app import ( "context" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) // initialize is called when the App is first created. diff --git a/server/boards/app/insights.go b/server/boards/app/insights.go index 2cc319a94d..b14c155cf9 100644 --- a/server/boards/app/insights.go +++ b/server/boards/app/insights.go @@ -6,8 +6,8 @@ package app import ( "github.com/pkg/errors" - mm_model "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/model" + mm_model "github.com/mattermost/mattermost-server/server/v8/model" ) func (a *App) GetTeamBoardsInsights(userID string, teamID string, opts *mm_model.InsightsOpts) (*model.BoardInsightsList, error) { diff --git a/server/boards/app/insights_test.go b/server/boards/app/insights_test.go index fcd94a0a5f..ff87b31d7e 100644 --- a/server/boards/app/insights_test.go +++ b/server/boards/app/insights_test.go @@ -8,8 +8,8 @@ import ( "github.com/stretchr/testify/require" - mm_model "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/model" + mm_model "github.com/mattermost/mattermost-server/server/v8/model" ) var mockInsightsBoards = []*model.Board{ diff --git a/server/boards/app/onboarding.go b/server/boards/app/onboarding.go index 4e4ea91999..b30b0d5f0f 100644 --- a/server/boards/app/onboarding.go +++ b/server/boards/app/onboarding.go @@ -6,7 +6,7 @@ package app import ( "errors" - "github.com/mattermost/mattermost-server/v6/server/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/model" ) const ( diff --git a/server/boards/app/onboarding_test.go b/server/boards/app/onboarding_test.go index a93b0ec034..97e7eef529 100644 --- a/server/boards/app/onboarding_test.go +++ b/server/boards/app/onboarding_test.go @@ -6,11 +6,11 @@ package app import ( "testing" - "github.com/mattermost/mattermost-server/v6/server/boards/utils" + "github.com/mattermost/mattermost-server/server/v8/boards/utils" "github.com/stretchr/testify/assert" - "github.com/mattermost/mattermost-server/v6/server/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/model" ) const ( diff --git a/server/boards/app/permissions.go b/server/boards/app/permissions.go index 0d340e3f0c..a1d7da51dd 100644 --- a/server/boards/app/permissions.go +++ b/server/boards/app/permissions.go @@ -4,7 +4,7 @@ package app import ( - mm_model "github.com/mattermost/mattermost-server/v6/model" + mm_model "github.com/mattermost/mattermost-server/server/v8/model" ) func (a *App) HasPermissionToBoard(userID, boardID string, permission *mm_model.Permission) bool { diff --git a/server/boards/app/server_metadata.go b/server/boards/app/server_metadata.go index 1082057828..28a2a44bca 100644 --- a/server/boards/app/server_metadata.go +++ b/server/boards/app/server_metadata.go @@ -6,7 +6,7 @@ package app import ( "runtime" - "github.com/mattermost/mattermost-server/v6/server/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/model" ) type ServerMetadata struct { diff --git a/server/boards/app/server_metadata_test.go b/server/boards/app/server_metadata_test.go index 08eab2cb82..76991bac20 100644 --- a/server/boards/app/server_metadata_test.go +++ b/server/boards/app/server_metadata_test.go @@ -8,7 +8,7 @@ import ( "runtime" "testing" - "github.com/mattermost/mattermost-server/v6/server/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/model" ) func TestGetServerMetadata(t *testing.T) { diff --git a/server/boards/app/sharing.go b/server/boards/app/sharing.go index ab73b41d6d..3dc7ede811 100644 --- a/server/boards/app/sharing.go +++ b/server/boards/app/sharing.go @@ -4,7 +4,7 @@ package app import ( - "github.com/mattermost/mattermost-server/v6/server/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/model" ) func (a *App) GetSharing(boardID string) (*model.Sharing, error) { diff --git a/server/boards/app/sharing_test.go b/server/boards/app/sharing_test.go index ecda3b62b8..ebf6fea176 100644 --- a/server/boards/app/sharing_test.go +++ b/server/boards/app/sharing_test.go @@ -10,8 +10,8 @@ import ( "github.com/pkg/errors" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/server/boards/model" - "github.com/mattermost/mattermost-server/v6/server/boards/utils" + "github.com/mattermost/mattermost-server/server/v8/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/utils" ) func TestGetSharing(t *testing.T) { diff --git a/server/boards/app/subscriptions.go b/server/boards/app/subscriptions.go index c25fc436de..26bab3214b 100644 --- a/server/boards/app/subscriptions.go +++ b/server/boards/app/subscriptions.go @@ -4,10 +4,10 @@ package app import ( - "github.com/mattermost/mattermost-server/v6/server/boards/model" - "github.com/mattermost/mattermost-server/v6/server/boards/utils" + "github.com/mattermost/mattermost-server/server/v8/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/utils" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) func (a *App) CreateSubscription(sub *model.Subscription) (*model.Subscription, error) { diff --git a/server/boards/app/teams.go b/server/boards/app/teams.go index 114a45e6df..83c998ee34 100644 --- a/server/boards/app/teams.go +++ b/server/boards/app/teams.go @@ -4,10 +4,10 @@ package app import ( - "github.com/mattermost/mattermost-server/v6/server/boards/model" - "github.com/mattermost/mattermost-server/v6/server/boards/utils" + "github.com/mattermost/mattermost-server/server/v8/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/utils" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) func (a *App) GetRootTeam() (*model.Team, error) { diff --git a/server/boards/app/teams_test.go b/server/boards/app/teams_test.go index 48911f4d11..e418c1968a 100644 --- a/server/boards/app/teams_test.go +++ b/server/boards/app/teams_test.go @@ -12,7 +12,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/server/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/model" ) var errInvalidTeam = errors.New("invalid team id") diff --git a/server/boards/app/templates.go b/server/boards/app/templates.go index 9cd0b1d1bc..0f17d3e08e 100644 --- a/server/boards/app/templates.go +++ b/server/boards/app/templates.go @@ -8,10 +8,10 @@ import ( "fmt" "strings" - "github.com/mattermost/mattermost-server/v6/server/boards/assets" - "github.com/mattermost/mattermost-server/v6/server/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/assets" + "github.com/mattermost/mattermost-server/server/v8/boards/model" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) const ( diff --git a/server/boards/app/templates_test.go b/server/boards/app/templates_test.go index dee1e08ece..496929a7ef 100644 --- a/server/boards/app/templates_test.go +++ b/server/boards/app/templates_test.go @@ -9,10 +9,10 @@ import ( "github.com/golang/mock/gomock" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/server/boards/model" - "github.com/mattermost/mattermost-server/v6/server/boards/utils" + "github.com/mattermost/mattermost-server/server/v8/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/utils" - "github.com/mattermost/mattermost-server/v6/plugin/plugintest/mock" + "github.com/mattermost/mattermost-server/server/v8/plugin/plugintest/mock" ) func TestApp_initializeTemplates(t *testing.T) { @@ -53,6 +53,7 @@ func TestApp_initializeTemplates(t *testing.T) { th.Store.EXPECT().GetMembersForBoard(board.ID).AnyTimes().Return([]*model.BoardMember{}, nil) th.Store.EXPECT().GetBoard(board.ID).AnyTimes().Return(board, nil) th.Store.EXPECT().GetMemberForBoard(gomock.Any(), gomock.Any()).AnyTimes().Return(boardMember, nil) + th.Store.EXPECT().SaveFileInfo(gomock.Any()).Return(nil).AnyTimes() th.FilesBackend.On("WriteFile", mock.Anything, mock.Anything).Return(int64(1), nil) diff --git a/server/boards/app/user.go b/server/boards/app/user.go index 31ff2ee9cf..c798e7a333 100644 --- a/server/boards/app/user.go +++ b/server/boards/app/user.go @@ -4,8 +4,8 @@ package app import ( - mm_model "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/model" + mm_model "github.com/mattermost/mattermost-server/server/v8/model" ) func (a *App) GetTeamUsers(teamID string, asGuestID string) ([]*model.User, error) { diff --git a/server/boards/app/user_test.go b/server/boards/app/user_test.go index f9cc9890d3..e1aa8ee597 100644 --- a/server/boards/app/user_test.go +++ b/server/boards/app/user_test.go @@ -8,8 +8,8 @@ import ( "github.com/stretchr/testify/assert" - mm_model "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/model" + mm_model "github.com/mattermost/mattermost-server/server/v8/model" ) func TestSearchUsers(t *testing.T) { diff --git a/server/boards/auth/auth.go b/server/boards/auth/auth.go index 0e90c8ecbd..8e93c0cd44 100644 --- a/server/boards/auth/auth.go +++ b/server/boards/auth/auth.go @@ -7,11 +7,11 @@ package auth import ( "github.com/pkg/errors" - "github.com/mattermost/mattermost-server/v6/server/boards/model" - "github.com/mattermost/mattermost-server/v6/server/boards/services/config" - "github.com/mattermost/mattermost-server/v6/server/boards/services/permissions" - "github.com/mattermost/mattermost-server/v6/server/boards/services/store" - "github.com/mattermost/mattermost-server/v6/server/boards/utils" + "github.com/mattermost/mattermost-server/server/v8/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/services/config" + "github.com/mattermost/mattermost-server/server/v8/boards/services/permissions" + "github.com/mattermost/mattermost-server/server/v8/boards/services/store" + "github.com/mattermost/mattermost-server/server/v8/boards/utils" ) type AuthInterface interface { diff --git a/server/boards/auth/auth_test.go b/server/boards/auth/auth_test.go index 99afcc9196..65491d37ca 100644 --- a/server/boards/auth/auth_test.go +++ b/server/boards/auth/auth_test.go @@ -10,14 +10,14 @@ import ( "github.com/pkg/errors" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/server/boards/model" - "github.com/mattermost/mattermost-server/v6/server/boards/services/config" - "github.com/mattermost/mattermost-server/v6/server/boards/services/permissions/localpermissions" - mockpermissions "github.com/mattermost/mattermost-server/v6/server/boards/services/permissions/mocks" - "github.com/mattermost/mattermost-server/v6/server/boards/services/store/mockstore" - "github.com/mattermost/mattermost-server/v6/server/boards/utils" + "github.com/mattermost/mattermost-server/server/v8/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/services/config" + "github.com/mattermost/mattermost-server/server/v8/boards/services/permissions/localpermissions" + mockpermissions "github.com/mattermost/mattermost-server/server/v8/boards/services/permissions/mocks" + "github.com/mattermost/mattermost-server/server/v8/boards/services/store/mockstore" + "github.com/mattermost/mattermost-server/server/v8/boards/utils" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) type TestHelper struct { diff --git a/server/boards/auth/mocks/mockauth_interface.go b/server/boards/auth/mocks/mockauth_interface.go index 082c22bc2e..45d151310d 100644 --- a/server/boards/auth/mocks/mockauth_interface.go +++ b/server/boards/auth/mocks/mockauth_interface.go @@ -2,7 +2,7 @@ // See LICENSE.txt for license information. // Code generated by MockGen. DO NOT EDIT. -// Source: github.com/mattermost/mattermost-server/v6/server/boards/auth (interfaces: AuthInterface) +// Source: github.com/mattermost/mattermost-server/server/v8/boards/auth (interfaces: AuthInterface) // Package mocks is a generated GoMock package. package mocks @@ -11,7 +11,7 @@ import ( reflect "reflect" gomock "github.com/golang/mock/gomock" - model "github.com/mattermost/mattermost-server/v6/server/boards/model" + model "github.com/mattermost/mattermost-server/server/v8/boards/model" ) // MockAuthInterface is a mock of AuthInterface interface. diff --git a/server/boards/client/client.go b/server/boards/client/client.go index d803e2e444..ea33a38c2b 100644 --- a/server/boards/client/client.go +++ b/server/boards/client/client.go @@ -12,10 +12,10 @@ import ( "net/http" "strings" - "github.com/mattermost/mattermost-server/v6/server/boards/api" - "github.com/mattermost/mattermost-server/v6/server/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/api" + "github.com/mattermost/mattermost-server/server/v8/boards/model" - mm_model "github.com/mattermost/mattermost-server/v6/model" + mm_model "github.com/mattermost/mattermost-server/server/v8/model" ) const ( diff --git a/server/boards/integrationtests/blocks_test.go b/server/boards/integrationtests/blocks_test.go index 8960129a04..16365fd034 100644 --- a/server/boards/integrationtests/blocks_test.go +++ b/server/boards/integrationtests/blocks_test.go @@ -7,8 +7,8 @@ import ( "testing" "time" - "github.com/mattermost/mattermost-server/v6/server/boards/model" - "github.com/mattermost/mattermost-server/v6/server/boards/utils" + "github.com/mattermost/mattermost-server/server/v8/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/utils" "github.com/stretchr/testify/require" ) diff --git a/server/boards/integrationtests/board_test.go b/server/boards/integrationtests/board_test.go index 0088e8433a..3f48b8f790 100644 --- a/server/boards/integrationtests/board_test.go +++ b/server/boards/integrationtests/board_test.go @@ -9,9 +9,9 @@ import ( "testing" "time" - "github.com/mattermost/mattermost-server/v6/server/boards/client" - "github.com/mattermost/mattermost-server/v6/server/boards/model" - "github.com/mattermost/mattermost-server/v6/server/boards/utils" + "github.com/mattermost/mattermost-server/server/v8/boards/client" + "github.com/mattermost/mattermost-server/server/v8/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/utils" "github.com/stretchr/testify/require" ) diff --git a/server/boards/integrationtests/boards_and_blocks_test.go b/server/boards/integrationtests/boards_and_blocks_test.go index 8541265c38..965b3f320f 100644 --- a/server/boards/integrationtests/boards_and_blocks_test.go +++ b/server/boards/integrationtests/boards_and_blocks_test.go @@ -6,7 +6,7 @@ package integrationtests import ( "testing" - "github.com/mattermost/mattermost-server/v6/server/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/model" "github.com/stretchr/testify/require" ) @@ -133,7 +133,7 @@ func TestCreateBoardsAndBlocks(t *testing.T) { require.Equal(t, "public board", board1.Title) require.Equal(t, model.BoardTypeOpen, board1.Type) require.NotEqual(t, "board-id-1", board1.ID) - blocks1, err := th.Server.App().GetBlocksForBoard(board1.ID) + blocks1, err := th.Server.App().GetBlocks(model.QueryBlocksOptions{BoardID: board1.ID}) require.NoError(t, err) require.Len(t, blocks1, 1) require.Equal(t, "block 1", blocks1[0].Title) @@ -147,7 +147,7 @@ func TestCreateBoardsAndBlocks(t *testing.T) { require.Equal(t, "private board", board2.Title) require.Equal(t, model.BoardTypePrivate, board2.Type) require.NotEqual(t, "board-id-2", board2.ID) - blocks2, err := th.Server.App().GetBlocksForBoard(board2.ID) + blocks2, err := th.Server.App().GetBlocks(model.QueryBlocksOptions{BoardID: board2.ID}) require.NoError(t, err) require.Len(t, blocks2, 1) require.Equal(t, "block 2", blocks2[0].Title) diff --git a/server/boards/integrationtests/boardsapp_test.go b/server/boards/integrationtests/boardsapp_test.go index f327520a7d..8faf4156d6 100644 --- a/server/boards/integrationtests/boardsapp_test.go +++ b/server/boards/integrationtests/boardsapp_test.go @@ -11,10 +11,10 @@ import ( "github.com/stretchr/testify/assert" - "github.com/mattermost/mattermost-server/v6/server/boards/server" + "github.com/mattermost/mattermost-server/server/v8/boards/server" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) func TestSetConfiguration(t *testing.T) { diff --git a/server/boards/integrationtests/cards_test.go b/server/boards/integrationtests/cards_test.go index aba146823a..e2290d46aa 100644 --- a/server/boards/integrationtests/cards_test.go +++ b/server/boards/integrationtests/cards_test.go @@ -11,8 +11,8 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/server/boards/model" - "github.com/mattermost/mattermost-server/v6/server/boards/utils" + "github.com/mattermost/mattermost-server/server/v8/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/utils" ) func TestCreateCard(t *testing.T) { diff --git a/server/boards/integrationtests/clienttestlib.go b/server/boards/integrationtests/clienttestlib.go index 10997b0b18..3c7f0ab003 100644 --- a/server/boards/integrationtests/clienttestlib.go +++ b/server/boards/integrationtests/clienttestlib.go @@ -10,19 +10,19 @@ import ( "testing" "time" - "github.com/mattermost/mattermost-server/v6/server/boards/client" - "github.com/mattermost/mattermost-server/v6/server/boards/model" - "github.com/mattermost/mattermost-server/v6/server/boards/server" - "github.com/mattermost/mattermost-server/v6/server/boards/services/auth" - "github.com/mattermost/mattermost-server/v6/server/boards/services/config" - "github.com/mattermost/mattermost-server/v6/server/boards/services/permissions/localpermissions" - "github.com/mattermost/mattermost-server/v6/server/boards/services/permissions/mmpermissions" - "github.com/mattermost/mattermost-server/v6/server/boards/services/store" - "github.com/mattermost/mattermost-server/v6/server/boards/services/store/sqlstore" - "github.com/mattermost/mattermost-server/v6/server/boards/utils" + "github.com/mattermost/mattermost-server/server/v8/boards/client" + "github.com/mattermost/mattermost-server/server/v8/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/server" + "github.com/mattermost/mattermost-server/server/v8/boards/services/auth" + "github.com/mattermost/mattermost-server/server/v8/boards/services/config" + "github.com/mattermost/mattermost-server/server/v8/boards/services/permissions/localpermissions" + "github.com/mattermost/mattermost-server/server/v8/boards/services/permissions/mmpermissions" + "github.com/mattermost/mattermost-server/server/v8/boards/services/store" + "github.com/mattermost/mattermost-server/server/v8/boards/services/store/sqlstore" + "github.com/mattermost/mattermost-server/server/v8/boards/utils" - mm_model "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + mm_model "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" "github.com/stretchr/testify/require" ) diff --git a/server/boards/integrationtests/compliance_test.go b/server/boards/integrationtests/compliance_test.go index 64ac6bb594..7ed89c3c7e 100644 --- a/server/boards/integrationtests/compliance_test.go +++ b/server/boards/integrationtests/compliance_test.go @@ -11,8 +11,8 @@ import ( "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/server/boards/model" - "github.com/mattermost/mattermost-server/v6/server/boards/utils" + "github.com/mattermost/mattermost-server/server/v8/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/utils" ) var ( diff --git a/server/boards/integrationtests/configuration_test.go b/server/boards/integrationtests/configuration_test.go index 349e6df8a5..fd49036e4a 100644 --- a/server/boards/integrationtests/configuration_test.go +++ b/server/boards/integrationtests/configuration_test.go @@ -8,14 +8,14 @@ import ( "github.com/golang/mock/gomock" - "github.com/mattermost/mattermost-server/v6/server/boards/model" - "github.com/mattermost/mattermost-server/v6/server/boards/server" - "github.com/mattermost/mattermost-server/v6/server/boards/ws" + "github.com/mattermost/mattermost-server/server/v8/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/server" + "github.com/mattermost/mattermost-server/server/v8/boards/ws" - mockservicesapi "github.com/mattermost/mattermost-server/v6/server/boards/model/mocks" + mockservicesapi "github.com/mattermost/mattermost-server/server/v8/boards/model/mocks" - mm_model "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + mm_model "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" "github.com/stretchr/testify/assert" ) diff --git a/server/boards/integrationtests/content_blocks_test.go b/server/boards/integrationtests/content_blocks_test.go index 8455ae5f4d..461bbd8da4 100644 --- a/server/boards/integrationtests/content_blocks_test.go +++ b/server/boards/integrationtests/content_blocks_test.go @@ -7,8 +7,8 @@ import ( "fmt" "testing" - "github.com/mattermost/mattermost-server/v6/server/boards/model" - "github.com/mattermost/mattermost-server/v6/server/boards/utils" + "github.com/mattermost/mattermost-server/server/v8/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/utils" "github.com/stretchr/testify/require" ) diff --git a/server/boards/integrationtests/export_test.go b/server/boards/integrationtests/export_test.go index 40de905346..f896e83632 100644 --- a/server/boards/integrationtests/export_test.go +++ b/server/boards/integrationtests/export_test.go @@ -9,8 +9,8 @@ import ( "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/server/boards/model" - "github.com/mattermost/mattermost-server/v6/server/boards/utils" + "github.com/mattermost/mattermost-server/server/v8/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/utils" ) func TestExportBoard(t *testing.T) { @@ -62,7 +62,7 @@ func TestExportBoard(t *testing.T) { require.NoError(t, err) require.Len(t, boardsImported, 1) boardImported := boardsImported[0] - blocksImported, err := th.Server.App().GetBlocksForBoard(boardImported.ID) + blocksImported, err := th.Server.App().GetBlocks(model.QueryBlocksOptions{BoardID: boardImported.ID}) require.NoError(t, err) require.Len(t, blocksImported, 1) require.Equal(t, block.Title, blocksImported[0].Title) diff --git a/server/boards/integrationtests/file_test.go b/server/boards/integrationtests/file_test.go index fc66cf4c2f..f0598ce83e 100644 --- a/server/boards/integrationtests/file_test.go +++ b/server/boards/integrationtests/file_test.go @@ -7,7 +7,7 @@ import ( "bytes" "testing" - "github.com/mattermost/mattermost-server/v6/server/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/model" "github.com/stretchr/testify/require" ) diff --git a/server/boards/integrationtests/permissions_test.go b/server/boards/integrationtests/permissions_test.go index e86f1d1c64..a784ef2bf3 100644 --- a/server/boards/integrationtests/permissions_test.go +++ b/server/boards/integrationtests/permissions_test.go @@ -15,8 +15,8 @@ import ( "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/server/boards/client" - "github.com/mattermost/mattermost-server/v6/server/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/client" + "github.com/mattermost/mattermost-server/server/v8/boards/model" ) type Clients struct { @@ -3379,7 +3379,7 @@ func TestPermissionsGetFile(t *testing.T) { clients := setupClients(th) testData := setupData(t, th) - newFileID, err := th.Server.App().SaveFile(bytes.NewBuffer([]byte("test")), "test-team", testData.privateBoard.ID, "test.png") + newFileID, err := th.Server.App().SaveFile(bytes.NewBuffer([]byte("test")), "test-team", testData.privateBoard.ID, "test.png", false) require.NoError(t, err) ttCases := ttCasesF() @@ -3394,7 +3394,7 @@ func TestPermissionsGetFile(t *testing.T) { clients := setupLocalClients(th) testData := setupData(t, th) - newFileID, err := th.Server.App().SaveFile(bytes.NewBuffer([]byte("test")), "test-team", testData.privateBoard.ID, "test.png") + newFileID, err := th.Server.App().SaveFile(bytes.NewBuffer([]byte("test")), "test-team", testData.privateBoard.ID, "test.png", false) require.NoError(t, err) ttCases := ttCasesF() diff --git a/server/boards/integrationtests/pluginteststore.go b/server/boards/integrationtests/pluginteststore.go index 06e8f92b12..0f289252de 100644 --- a/server/boards/integrationtests/pluginteststore.go +++ b/server/boards/integrationtests/pluginteststore.go @@ -9,10 +9,10 @@ import ( "strconv" "strings" - "github.com/mattermost/mattermost-server/v6/server/boards/model" - "github.com/mattermost/mattermost-server/v6/server/boards/services/store" + "github.com/mattermost/mattermost-server/server/v8/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/services/store" - mm_model "github.com/mattermost/mattermost-server/v6/model" + mm_model "github.com/mattermost/mattermost-server/server/v8/model" ) var errTestStore = errors.New("plugin test store error") diff --git a/server/boards/integrationtests/sharing_test.go b/server/boards/integrationtests/sharing_test.go index 44719679de..982f88c74f 100644 --- a/server/boards/integrationtests/sharing_test.go +++ b/server/boards/integrationtests/sharing_test.go @@ -8,8 +8,8 @@ import ( "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/server/boards/model" - "github.com/mattermost/mattermost-server/v6/server/boards/utils" + "github.com/mattermost/mattermost-server/server/v8/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/utils" ) func TestSharing(t *testing.T) { diff --git a/server/boards/integrationtests/sidebar_test.go b/server/boards/integrationtests/sidebar_test.go index a2c3aed354..d62c3b48a3 100644 --- a/server/boards/integrationtests/sidebar_test.go +++ b/server/boards/integrationtests/sidebar_test.go @@ -8,7 +8,7 @@ import ( "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/server/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/model" ) func TestSidebar(t *testing.T) { diff --git a/server/boards/integrationtests/statistics_test.go b/server/boards/integrationtests/statistics_test.go index 5123183b70..cb0e44b456 100644 --- a/server/boards/integrationtests/statistics_test.go +++ b/server/boards/integrationtests/statistics_test.go @@ -8,8 +8,8 @@ import ( "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/server/boards/client" - "github.com/mattermost/mattermost-server/v6/server/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/client" + "github.com/mattermost/mattermost-server/server/v8/boards/model" ) func TestStatisticsLocalMode(t *testing.T) { diff --git a/server/boards/integrationtests/subscriptions_test.go b/server/boards/integrationtests/subscriptions_test.go index 0f4a09ab3a..cfd75a7019 100644 --- a/server/boards/integrationtests/subscriptions_test.go +++ b/server/boards/integrationtests/subscriptions_test.go @@ -10,9 +10,9 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/server/boards/client" - "github.com/mattermost/mattermost-server/v6/server/boards/model" - "github.com/mattermost/mattermost-server/v6/server/boards/utils" + "github.com/mattermost/mattermost-server/server/v8/boards/client" + "github.com/mattermost/mattermost-server/server/v8/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/utils" ) func createTestSubscriptions(client *client.Client, num int) ([]*model.Subscription, string, error) { diff --git a/server/boards/integrationtests/teststore.go b/server/boards/integrationtests/teststore.go index 134078c5da..bc2bed79d3 100644 --- a/server/boards/integrationtests/teststore.go +++ b/server/boards/integrationtests/teststore.go @@ -4,9 +4,9 @@ package integrationtests import ( - "github.com/mattermost/mattermost-server/v6/server/boards/services/store" + "github.com/mattermost/mattermost-server/server/v8/boards/services/store" - mm_model "github.com/mattermost/mattermost-server/v6/model" + mm_model "github.com/mattermost/mattermost-server/server/v8/model" ) type TestStore struct { diff --git a/server/boards/integrationtests/user_test.go b/server/boards/integrationtests/user_test.go index af494acd47..836bbbd0c5 100644 --- a/server/boards/integrationtests/user_test.go +++ b/server/boards/integrationtests/user_test.go @@ -10,8 +10,8 @@ import ( "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/server/boards/model" - "github.com/mattermost/mattermost-server/v6/server/boards/utils" + "github.com/mattermost/mattermost-server/server/v8/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/utils" ) const ( diff --git a/server/boards/model/auth.go b/server/boards/model/auth.go index a667a56e63..f63acab92d 100644 --- a/server/boards/model/auth.go +++ b/server/boards/model/auth.go @@ -9,7 +9,7 @@ import ( "io" "strings" - "github.com/mattermost/mattermost-server/v6/server/boards/services/auth" + "github.com/mattermost/mattermost-server/server/v8/boards/services/auth" ) const ( diff --git a/server/boards/model/block.go b/server/boards/model/block.go index 587c648eff..972e564b0a 100644 --- a/server/boards/model/block.go +++ b/server/boards/model/block.go @@ -8,7 +8,7 @@ import ( "io" "strconv" - "github.com/mattermost/mattermost-server/v6/server/boards/services/audit" + "github.com/mattermost/mattermost-server/server/v8/boards/services/audit" ) // Block is the basic data unit @@ -176,7 +176,7 @@ type QueryBlocksOptions struct { ParentID string // if not empty then filter for blocks belonging to specified parent BlockType BlockType // if not empty and not `TypeUnknown` then filter for records of specified block type Page int // page number to select when paginating - PerPage int // number of blocks per page (default=-1, meaning unlimited) + PerPage int // number of blocks per page (default=0, meaning unlimited) } // QuerySubtreeOptions are query options that can be passed to GetSubTree methods. diff --git a/server/boards/model/block_test.go b/server/boards/model/block_test.go index 05cede4395..f35239ac0a 100644 --- a/server/boards/model/block_test.go +++ b/server/boards/model/block_test.go @@ -8,9 +8,9 @@ import ( "github.com/stretchr/testify/assert" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" - "github.com/mattermost/mattermost-server/v6/server/boards/utils" + "github.com/mattermost/mattermost-server/server/v8/boards/utils" "github.com/stretchr/testify/require" ) diff --git a/server/boards/model/blockid.go b/server/boards/model/blockid.go index 521779a6ed..d0309a9021 100644 --- a/server/boards/model/blockid.go +++ b/server/boards/model/blockid.go @@ -6,9 +6,9 @@ package model import ( "fmt" - "github.com/mattermost/mattermost-server/v6/server/boards/utils" + "github.com/mattermost/mattermost-server/server/v8/boards/utils" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) // GenerateBlockIDs generates new IDs for all the blocks of the list, diff --git a/server/boards/model/blocktype.go b/server/boards/model/blocktype.go index 7fb868e700..6c1868898d 100644 --- a/server/boards/model/blocktype.go +++ b/server/boards/model/blocktype.go @@ -7,7 +7,7 @@ import ( "errors" "strings" - "github.com/mattermost/mattermost-server/v6/server/boards/utils" + "github.com/mattermost/mattermost-server/server/v8/boards/utils" ) // BlockType represents a block type. diff --git a/server/boards/model/board_insights.go b/server/boards/model/board_insights.go index cd34ddc919..74fe283901 100644 --- a/server/boards/model/board_insights.go +++ b/server/boards/model/board_insights.go @@ -7,7 +7,7 @@ import ( "encoding/json" "io" - mm_model "github.com/mattermost/mattermost-server/v6/model" + mm_model "github.com/mattermost/mattermost-server/server/v8/model" ) // BoardInsightsList is a response type with pagination support. diff --git a/server/boards/model/boards_and_blocks.go b/server/boards/model/boards_and_blocks.go index 3ebe548d2b..159e091acf 100644 --- a/server/boards/model/boards_and_blocks.go +++ b/server/boards/model/boards_and_blocks.go @@ -9,9 +9,9 @@ import ( "fmt" "io" - "github.com/mattermost/mattermost-server/v6/server/boards/utils" + "github.com/mattermost/mattermost-server/server/v8/boards/utils" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) var ErrNoBoardsInBoardsAndBlocks = errors.New("at least one board is required") diff --git a/server/boards/model/boards_and_blocks_test.go b/server/boards/model/boards_and_blocks_test.go index 0c6d0b0891..4c89496ae3 100644 --- a/server/boards/model/boards_and_blocks_test.go +++ b/server/boards/model/boards_and_blocks_test.go @@ -8,7 +8,7 @@ import ( "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) func TestIsValidBoardsAndBlocks(t *testing.T) { diff --git a/server/boards/model/card.go b/server/boards/model/card.go index 377672dea9..f27c59af7e 100644 --- a/server/boards/model/card.go +++ b/server/boards/model/card.go @@ -9,7 +9,7 @@ import ( "github.com/rivo/uniseg" - "github.com/mattermost/mattermost-server/v6/server/boards/utils" + "github.com/mattermost/mattermost-server/server/v8/boards/utils" ) var ErrBoardIDMismatch = errors.New("Board IDs do not match") diff --git a/server/boards/model/card_test.go b/server/boards/model/card_test.go index 3274ac1e2e..96237ebfc8 100644 --- a/server/boards/model/card_test.go +++ b/server/boards/model/card_test.go @@ -10,7 +10,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/server/boards/utils" + "github.com/mattermost/mattermost-server/server/v8/boards/utils" ) func TestBlock2Card(t *testing.T) { diff --git a/server/boards/model/category.go b/server/boards/model/category.go index ad925768ab..0d49b3b0a0 100644 --- a/server/boards/model/category.go +++ b/server/boards/model/category.go @@ -9,7 +9,7 @@ import ( "io" "strings" - "github.com/mattermost/mattermost-server/v6/server/boards/utils" + "github.com/mattermost/mattermost-server/server/v8/boards/utils" ) const ( diff --git a/server/boards/model/error.go b/server/boards/model/error.go index 0c1727904c..678520c87f 100644 --- a/server/boards/model/error.go +++ b/server/boards/model/error.go @@ -10,7 +10,7 @@ import ( "net/http" "strings" - mm_model "github.com/mattermost/mattermost-server/v6/model" + mm_model "github.com/mattermost/mattermost-server/server/v8/model" ) var ( diff --git a/server/boards/model/file.go b/server/boards/model/file.go new file mode 100644 index 0000000000..3a00008cac --- /dev/null +++ b/server/boards/model/file.go @@ -0,0 +1,27 @@ +// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. +// See LICENSE.txt for license information. +package model + +import ( + "mime" + "path/filepath" + "strings" + + "github.com/mattermost/mattermost-server/server/v8/boards/utils" + mm_model "github.com/mattermost/mattermost-server/server/v8/model" +) + +func NewFileInfo(name string) *mm_model.FileInfo { + + extension := strings.ToLower(filepath.Ext(name)) + now := utils.GetMillis() + return &mm_model.FileInfo{ + CreatorId: "boards", + CreateAt: now, + UpdateAt: now, + Name: name, + Extension: extension, + MimeType: mime.TypeByExtension(extension), + } + +} diff --git a/server/boards/model/mocks/mockservicesapi.go b/server/boards/model/mocks/mockservicesapi.go index 23da9096c7..724c0c9e28 100644 --- a/server/boards/model/mocks/mockservicesapi.go +++ b/server/boards/model/mocks/mockservicesapi.go @@ -2,7 +2,7 @@ // See LICENSE.txt for license information. // Code generated by MockGen. DO NOT EDIT. -// Source: github.com/mattermost/mattermost-server/v6/server/boards/model (interfaces: ServicesAPI) +// Source: github.com/mattermost/mattermost-server/server/v8/boards/model (interfaces: ServicesAPI) // Package mocks is a generated GoMock package. package mocks @@ -13,8 +13,8 @@ import ( gomock "github.com/golang/mock/gomock" mux "github.com/gorilla/mux" - model "github.com/mattermost/mattermost-server/v6/model" - mlog "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + model "github.com/mattermost/mattermost-server/server/v8/model" + mlog "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) // MockServicesAPI is a mock of ServicesAPI interface. diff --git a/server/boards/model/mocks/propValueResolverMock.go b/server/boards/model/mocks/propValueResolverMock.go index 6937de3c7d..0030038d46 100644 --- a/server/boards/model/mocks/propValueResolverMock.go +++ b/server/boards/model/mocks/propValueResolverMock.go @@ -2,7 +2,7 @@ // See LICENSE.txt for license information. // Code generated by MockGen. DO NOT EDIT. -// Source: github.com/mattermost/mattermost-server/v6/server/boards/model (interfaces: PropValueResolver) +// Source: github.com/mattermost/mattermost-server/server/v8/boards/model (interfaces: PropValueResolver) // Package mocks is a generated GoMock package. package mocks @@ -11,7 +11,7 @@ import ( reflect "reflect" gomock "github.com/golang/mock/gomock" - model "github.com/mattermost/mattermost-server/v6/server/boards/model" + model "github.com/mattermost/mattermost-server/server/v8/boards/model" ) // MockPropValueResolver is a mock of PropValueResolver interface. diff --git a/server/boards/model/notification.go b/server/boards/model/notification.go index 2cfc150b90..dfb2641aa4 100644 --- a/server/boards/model/notification.go +++ b/server/boards/model/notification.go @@ -6,7 +6,7 @@ package model import ( "time" - "github.com/mattermost/mattermost-server/v6/server/channels/utils" + "github.com/mattermost/mattermost-server/server/v8/channels/utils" ) // NotificationHint provides a hint that a block has been modified and has subscribers that diff --git a/server/boards/model/permission.go b/server/boards/model/permission.go index 95998f4df8..544f131cfc 100644 --- a/server/boards/model/permission.go +++ b/server/boards/model/permission.go @@ -4,7 +4,7 @@ package model import ( - mm_model "github.com/mattermost/mattermost-server/v6/model" + mm_model "github.com/mattermost/mattermost-server/server/v8/model" ) var ( diff --git a/server/boards/model/properties.go b/server/boards/model/properties.go index c10bd84178..c640d87d0a 100644 --- a/server/boards/model/properties.go +++ b/server/boards/model/properties.go @@ -11,7 +11,7 @@ import ( "fmt" "strings" - "github.com/mattermost/mattermost-server/v6/server/boards/utils" + "github.com/mattermost/mattermost-server/server/v8/boards/utils" ) var ErrInvalidBoardBlock = errors.New("invalid board block") diff --git a/server/boards/model/properties_test.go b/server/boards/model/properties_test.go index 0546c529b5..df24231779 100644 --- a/server/boards/model/properties_test.go +++ b/server/boards/model/properties_test.go @@ -10,7 +10,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/server/boards/utils" + "github.com/mattermost/mattermost-server/server/v8/boards/utils" ) type MockResolver struct{} diff --git a/server/boards/model/services_api.go b/server/boards/model/services_api.go index 6623adc80b..0a8f106042 100644 --- a/server/boards/model/services_api.go +++ b/server/boards/model/services_api.go @@ -10,8 +10,8 @@ import ( "github.com/gorilla/mux" - mm_model "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + mm_model "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) const ( @@ -20,11 +20,13 @@ const ( botDescription = "Created by Boards plugin." ) -var FocalboardBot = &mm_model.Bot{ - Username: botUsername, - DisplayName: botDisplayname, - Description: botDescription, - OwnerId: SystemUserID, +func GetDefaultFocalboardBot() *mm_model.Bot { + return &mm_model.Bot{ + Username: botUsername, + DisplayName: botDisplayname, + Description: botDescription, + OwnerId: SystemUserID, + } } type ServicesAPI interface { diff --git a/server/boards/model/util.go b/server/boards/model/util.go index dcb2f96671..4d80a2a2e3 100644 --- a/server/boards/model/util.go +++ b/server/boards/model/util.go @@ -6,7 +6,7 @@ package model import ( "time" - mm_model "github.com/mattermost/mattermost-server/v6/model" + mm_model "github.com/mattermost/mattermost-server/server/v8/model" ) // GetMillis is a convenience method to get milliseconds since epoch. diff --git a/server/boards/model/version.go b/server/boards/model/version.go index 12f5b5887b..be8a561634 100644 --- a/server/boards/model/version.go +++ b/server/boards/model/version.go @@ -4,7 +4,7 @@ package model import ( - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) // This is a list of all the current versions including any patches. diff --git a/server/boards/product/api_adapter.go b/server/boards/product/api_adapter.go index 506c2ba91c..e0d2f1d276 100644 --- a/server/boards/product/api_adapter.go +++ b/server/boards/product/api_adapter.go @@ -8,11 +8,11 @@ import ( "github.com/gorilla/mux" - mm_model "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/app/request" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/app/request" + mm_model "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" - "github.com/mattermost/mattermost-server/v6/server/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/model" ) // normalizeAppError returns a truly nil error if appErr is nil diff --git a/server/boards/product/boards_product.go b/server/boards/product/boards_product.go index 7e74c86349..9fc74101cb 100644 --- a/server/boards/product/boards_product.go +++ b/server/boards/product/boards_product.go @@ -7,13 +7,13 @@ import ( "errors" "fmt" - "github.com/mattermost/mattermost-server/v6/server/boards/model" - "github.com/mattermost/mattermost-server/v6/server/boards/server" + "github.com/mattermost/mattermost-server/server/v8/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/server" - mm_model "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/plugin" - "github.com/mattermost/mattermost-server/v6/server/channels/product" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/product" + mm_model "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/plugin" ) const ( diff --git a/server/boards/product/imports/boards_imports.go b/server/boards/product/imports/boards_imports.go index cf6081d414..e684480eaf 100644 --- a/server/boards/product/imports/boards_imports.go +++ b/server/boards/product/imports/boards_imports.go @@ -6,5 +6,5 @@ package imports import ( // Needed to ensure the init() method in the FocalBoard product is run. // This file is copied to the mmserver imports package via makefile. - _ "github.com/mattermost/mattermost-server/v6/server/boards/product" + _ "github.com/mattermost/mattermost-server/server/v8/boards/product" ) diff --git a/server/boards/server/boards_service.go b/server/boards/server/boards_service.go index a702c026a3..3eedabfc4e 100644 --- a/server/boards/server/boards_service.go +++ b/server/boards/server/boards_service.go @@ -8,19 +8,19 @@ import ( "net/http" "sync" - "github.com/mattermost/mattermost-server/v6/server/boards/auth" - "github.com/mattermost/mattermost-server/v6/server/boards/model" - "github.com/mattermost/mattermost-server/v6/server/boards/services/config" - "github.com/mattermost/mattermost-server/v6/server/boards/services/notify" - "github.com/mattermost/mattermost-server/v6/server/boards/services/permissions/mmpermissions" - "github.com/mattermost/mattermost-server/v6/server/boards/services/store" - "github.com/mattermost/mattermost-server/v6/server/boards/services/store/mattermostauthlayer" - "github.com/mattermost/mattermost-server/v6/server/boards/services/store/sqlstore" - "github.com/mattermost/mattermost-server/v6/server/boards/ws" + "github.com/mattermost/mattermost-server/server/v8/boards/auth" + "github.com/mattermost/mattermost-server/server/v8/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/services/config" + "github.com/mattermost/mattermost-server/server/v8/boards/services/notify" + "github.com/mattermost/mattermost-server/server/v8/boards/services/permissions/mmpermissions" + "github.com/mattermost/mattermost-server/server/v8/boards/services/store" + "github.com/mattermost/mattermost-server/server/v8/boards/services/store/mattermostauthlayer" + "github.com/mattermost/mattermost-server/server/v8/boards/services/store/sqlstore" + "github.com/mattermost/mattermost-server/server/v8/boards/ws" - mm_model "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/plugin" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + mm_model "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/plugin" ) const ( diff --git a/server/boards/server/boards_service_api.go b/server/boards/server/boards_service_api.go index 9464a1309b..1ad34b3656 100644 --- a/server/boards/server/boards_service_api.go +++ b/server/boards/server/boards_service_api.go @@ -4,11 +4,11 @@ package server import ( - "github.com/mattermost/mattermost-server/v6/server/boards/app" - "github.com/mattermost/mattermost-server/v6/server/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/app" + "github.com/mattermost/mattermost-server/server/v8/boards/model" - mm_model "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/product" + "github.com/mattermost/mattermost-server/server/v8/channels/product" + mm_model "github.com/mattermost/mattermost-server/server/v8/model" ) // boardsServiceAPI provides a service API for other products such as Channels. diff --git a/server/boards/server/boards_service_util.go b/server/boards/server/boards_service_util.go index c1de21897e..2661d960ef 100644 --- a/server/boards/server/boards_service_util.go +++ b/server/boards/server/boards_service_util.go @@ -8,9 +8,9 @@ import ( "path" "strings" - "github.com/mattermost/mattermost-server/v6/server/boards/services/config" + "github.com/mattermost/mattermost-server/server/v8/boards/services/config" - mm_model "github.com/mattermost/mattermost-server/v6/model" + mm_model "github.com/mattermost/mattermost-server/server/v8/model" ) const defaultS3Timeout = 60 * 1000 // 60 seconds diff --git a/server/boards/server/data_retention_test.go b/server/boards/server/data_retention_test.go index 927e6b5afa..18a731d918 100644 --- a/server/boards/server/data_retention_test.go +++ b/server/boards/server/data_retention_test.go @@ -11,12 +11,12 @@ import ( "github.com/golang/mock/gomock" "github.com/stretchr/testify/assert" - "github.com/mattermost/mattermost-server/v6/server/boards/services/config" - "github.com/mattermost/mattermost-server/v6/server/boards/services/permissions/localpermissions" - "github.com/mattermost/mattermost-server/v6/server/boards/services/store/mockstore" + "github.com/mattermost/mattermost-server/server/v8/boards/services/config" + "github.com/mattermost/mattermost-server/server/v8/boards/services/permissions/localpermissions" + "github.com/mattermost/mattermost-server/server/v8/boards/services/store/mockstore" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) type TestHelperMockStore struct { diff --git a/server/boards/server/notifications.go b/server/boards/server/notifications.go index dba47ba45d..656e37f999 100644 --- a/server/boards/server/notifications.go +++ b/server/boards/server/notifications.go @@ -7,15 +7,15 @@ import ( "fmt" "time" - "github.com/mattermost/mattermost-server/v6/server/boards/model" - "github.com/mattermost/mattermost-server/v6/server/boards/services/config" - "github.com/mattermost/mattermost-server/v6/server/boards/services/notify/notifymentions" - "github.com/mattermost/mattermost-server/v6/server/boards/services/notify/notifysubscriptions" - "github.com/mattermost/mattermost-server/v6/server/boards/services/notify/plugindelivery" - "github.com/mattermost/mattermost-server/v6/server/boards/services/permissions" - "github.com/mattermost/mattermost-server/v6/server/boards/services/store" + "github.com/mattermost/mattermost-server/server/v8/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/services/config" + "github.com/mattermost/mattermost-server/server/v8/boards/services/notify/notifymentions" + "github.com/mattermost/mattermost-server/server/v8/boards/services/notify/notifysubscriptions" + "github.com/mattermost/mattermost-server/server/v8/boards/services/notify/plugindelivery" + "github.com/mattermost/mattermost-server/server/v8/boards/services/permissions" + "github.com/mattermost/mattermost-server/server/v8/boards/services/store" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) type notifyBackendParams struct { @@ -66,7 +66,7 @@ func createSubscriptionsNotifyBackend(params notifyBackendParams) (*notifysubscr } func createDelivery(servicesAPI model.ServicesAPI, serverRoot string) (*plugindelivery.PluginDelivery, error) { - bot := model.FocalboardBot + bot := model.GetDefaultFocalboardBot() botID, err := servicesAPI.EnsureBot(bot) if err != nil { diff --git a/server/boards/server/params.go b/server/boards/server/params.go index e5613fc349..3511620d07 100644 --- a/server/boards/server/params.go +++ b/server/boards/server/params.go @@ -6,14 +6,14 @@ package server import ( "fmt" - "github.com/mattermost/mattermost-server/v6/server/boards/model" - "github.com/mattermost/mattermost-server/v6/server/boards/services/config" - "github.com/mattermost/mattermost-server/v6/server/boards/services/notify" - "github.com/mattermost/mattermost-server/v6/server/boards/services/permissions" - "github.com/mattermost/mattermost-server/v6/server/boards/services/store" - "github.com/mattermost/mattermost-server/v6/server/boards/ws" + "github.com/mattermost/mattermost-server/server/v8/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/services/config" + "github.com/mattermost/mattermost-server/server/v8/boards/services/notify" + "github.com/mattermost/mattermost-server/server/v8/boards/services/permissions" + "github.com/mattermost/mattermost-server/server/v8/boards/services/store" + "github.com/mattermost/mattermost-server/server/v8/boards/ws" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) type Params struct { diff --git a/server/boards/server/post.go b/server/boards/server/post.go index 755d2b70cf..fcafbcb8b5 100644 --- a/server/boards/server/post.go +++ b/server/boards/server/post.go @@ -9,8 +9,8 @@ import ( "net/url" "strings" - mm_model "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/markdown" + mm_model "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/markdown" ) func postWithBoardsEmbed(post *mm_model.Post) *mm_model.Post { diff --git a/server/boards/server/server.go b/server/boards/server/server.go index d79f30129b..a66e2c3351 100644 --- a/server/boards/server/server.go +++ b/server/boards/server/server.go @@ -19,26 +19,26 @@ import ( "github.com/oklog/run" - "github.com/mattermost/mattermost-server/v6/server/boards/api" - "github.com/mattermost/mattermost-server/v6/server/boards/app" - "github.com/mattermost/mattermost-server/v6/server/boards/auth" - appModel "github.com/mattermost/mattermost-server/v6/server/boards/model" - "github.com/mattermost/mattermost-server/v6/server/boards/services/audit" - "github.com/mattermost/mattermost-server/v6/server/boards/services/config" - "github.com/mattermost/mattermost-server/v6/server/boards/services/metrics" - "github.com/mattermost/mattermost-server/v6/server/boards/services/notify" - "github.com/mattermost/mattermost-server/v6/server/boards/services/notify/notifylogger" - "github.com/mattermost/mattermost-server/v6/server/boards/services/scheduler" - "github.com/mattermost/mattermost-server/v6/server/boards/services/store" - "github.com/mattermost/mattermost-server/v6/server/boards/services/store/sqlstore" - "github.com/mattermost/mattermost-server/v6/server/boards/services/telemetry" - "github.com/mattermost/mattermost-server/v6/server/boards/services/webhook" - "github.com/mattermost/mattermost-server/v6/server/boards/utils" - "github.com/mattermost/mattermost-server/v6/server/boards/web" - "github.com/mattermost/mattermost-server/v6/server/boards/ws" + "github.com/mattermost/mattermost-server/server/v8/boards/api" + "github.com/mattermost/mattermost-server/server/v8/boards/app" + "github.com/mattermost/mattermost-server/server/v8/boards/auth" + appModel "github.com/mattermost/mattermost-server/server/v8/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/services/audit" + "github.com/mattermost/mattermost-server/server/v8/boards/services/config" + "github.com/mattermost/mattermost-server/server/v8/boards/services/metrics" + "github.com/mattermost/mattermost-server/server/v8/boards/services/notify" + "github.com/mattermost/mattermost-server/server/v8/boards/services/notify/notifylogger" + "github.com/mattermost/mattermost-server/server/v8/boards/services/scheduler" + "github.com/mattermost/mattermost-server/server/v8/boards/services/store" + "github.com/mattermost/mattermost-server/server/v8/boards/services/store/sqlstore" + "github.com/mattermost/mattermost-server/server/v8/boards/services/telemetry" + "github.com/mattermost/mattermost-server/server/v8/boards/services/webhook" + "github.com/mattermost/mattermost-server/server/v8/boards/utils" + "github.com/mattermost/mattermost-server/server/v8/boards/web" + "github.com/mattermost/mattermost-server/server/v8/boards/ws" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/filestore" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/filestore" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) const ( diff --git a/server/boards/services/audit/audit.go b/server/boards/services/audit/audit.go index a965c977d8..d11dd0915e 100644 --- a/server/boards/services/audit/audit.go +++ b/server/boards/services/audit/audit.go @@ -4,7 +4,7 @@ package audit import ( - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) const ( diff --git a/server/boards/services/audit/record.go b/server/boards/services/audit/record.go index 0987bde849..60b55b1293 100644 --- a/server/boards/services/audit/record.go +++ b/server/boards/services/audit/record.go @@ -3,7 +3,7 @@ package audit -import "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" +import "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" // Meta represents metadata that can be added to a audit record as name/value pairs. type Meta struct { diff --git a/server/boards/services/metrics/service.go b/server/boards/services/metrics/service.go index bc3a97eb44..1ffcc7f9d9 100644 --- a/server/boards/services/metrics/service.go +++ b/server/boards/services/metrics/service.go @@ -9,7 +9,7 @@ import ( "github.com/pkg/errors" "github.com/prometheus/client_golang/prometheus/promhttp" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) // Service prometheus to run the server. diff --git a/server/boards/services/notify/notifylogger/logger_backend.go b/server/boards/services/notify/notifylogger/logger_backend.go index 52ff8b6bd9..8370988498 100644 --- a/server/boards/services/notify/notifylogger/logger_backend.go +++ b/server/boards/services/notify/notifylogger/logger_backend.go @@ -4,9 +4,9 @@ package notifylogger import ( - "github.com/mattermost/mattermost-server/v6/server/boards/services/notify" + "github.com/mattermost/mattermost-server/server/v8/boards/services/notify" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) const ( diff --git a/server/boards/services/notify/notifymentions/app_api.go b/server/boards/services/notify/notifymentions/app_api.go index 1110b54458..ab66fb700f 100644 --- a/server/boards/services/notify/notifymentions/app_api.go +++ b/server/boards/services/notify/notifymentions/app_api.go @@ -2,7 +2,7 @@ // See LICENSE.txt for license information. package notifymentions -import "github.com/mattermost/mattermost-server/v6/server/boards/model" +import "github.com/mattermost/mattermost-server/server/v8/boards/model" type AppAPI interface { GetMemberForBoard(boardID, userID string) (*model.BoardMember, error) diff --git a/server/boards/services/notify/notifymentions/delivery.go b/server/boards/services/notify/notifymentions/delivery.go index 7e097feb5c..499b582483 100644 --- a/server/boards/services/notify/notifymentions/delivery.go +++ b/server/boards/services/notify/notifymentions/delivery.go @@ -4,9 +4,9 @@ package notifymentions import ( - "github.com/mattermost/mattermost-server/v6/server/boards/services/notify" + "github.com/mattermost/mattermost-server/server/v8/boards/services/notify" - mm_model "github.com/mattermost/mattermost-server/v6/model" + mm_model "github.com/mattermost/mattermost-server/server/v8/model" ) // MentionDelivery provides an interface for delivering @mention notifications to other systems, such as diff --git a/server/boards/services/notify/notifymentions/mentions.go b/server/boards/services/notify/notifymentions/mentions.go index f6e60d95db..00e4a1835d 100644 --- a/server/boards/services/notify/notifymentions/mentions.go +++ b/server/boards/services/notify/notifymentions/mentions.go @@ -7,9 +7,9 @@ import ( "regexp" "strings" - "github.com/mattermost/mattermost-server/v6/server/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/model" - mm_model "github.com/mattermost/mattermost-server/v6/model" + mm_model "github.com/mattermost/mattermost-server/server/v8/model" ) var atMentionRegexp = regexp.MustCompile(`\B@[[:alnum:]][[:alnum:]\.\-_:]*`) diff --git a/server/boards/services/notify/notifymentions/mentions_backend.go b/server/boards/services/notify/notifymentions/mentions_backend.go index fdb13b5342..9d0c84190e 100644 --- a/server/boards/services/notify/notifymentions/mentions_backend.go +++ b/server/boards/services/notify/notifymentions/mentions_backend.go @@ -10,11 +10,11 @@ import ( "github.com/wiggin77/merror" - "github.com/mattermost/mattermost-server/v6/server/boards/model" - "github.com/mattermost/mattermost-server/v6/server/boards/services/notify" - "github.com/mattermost/mattermost-server/v6/server/boards/services/permissions" + "github.com/mattermost/mattermost-server/server/v8/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/services/notify" + "github.com/mattermost/mattermost-server/server/v8/boards/services/permissions" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) const ( diff --git a/server/boards/services/notify/notifymentions/mentions_test.go b/server/boards/services/notify/notifymentions/mentions_test.go index 758e116854..1529c7bc64 100644 --- a/server/boards/services/notify/notifymentions/mentions_test.go +++ b/server/boards/services/notify/notifymentions/mentions_test.go @@ -7,9 +7,9 @@ import ( "reflect" "testing" - "github.com/mattermost/mattermost-server/v6/server/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/model" - mm_model "github.com/mattermost/mattermost-server/v6/model" + mm_model "github.com/mattermost/mattermost-server/server/v8/model" ) func Test_extractMentions(t *testing.T) { diff --git a/server/boards/services/notify/notifysubscriptions/app_api.go b/server/boards/services/notify/notifysubscriptions/app_api.go index b2b9333f73..cfbee71019 100644 --- a/server/boards/services/notify/notifysubscriptions/app_api.go +++ b/server/boards/services/notify/notifysubscriptions/app_api.go @@ -6,7 +6,7 @@ package notifysubscriptions import ( "time" - "github.com/mattermost/mattermost-server/v6/server/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/model" ) type AppAPI interface { diff --git a/server/boards/services/notify/notifysubscriptions/delivery.go b/server/boards/services/notify/notifysubscriptions/delivery.go index 449616efb7..59f0a82382 100644 --- a/server/boards/services/notify/notifysubscriptions/delivery.go +++ b/server/boards/services/notify/notifysubscriptions/delivery.go @@ -4,9 +4,9 @@ package notifysubscriptions import ( - "github.com/mattermost/mattermost-server/v6/server/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/model" - mm_model "github.com/mattermost/mattermost-server/v6/model" + mm_model "github.com/mattermost/mattermost-server/server/v8/model" ) // SubscriptionDelivery provides an interface for delivering subscription notifications to other systems, such as diff --git a/server/boards/services/notify/notifysubscriptions/diff.go b/server/boards/services/notify/notifysubscriptions/diff.go index ede57d2949..1e36359799 100644 --- a/server/boards/services/notify/notifysubscriptions/diff.go +++ b/server/boards/services/notify/notifysubscriptions/diff.go @@ -7,9 +7,9 @@ import ( "fmt" "sort" - "github.com/mattermost/mattermost-server/v6/server/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/model" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) // Diff represents a difference between two versions of a block. diff --git a/server/boards/services/notify/notifysubscriptions/diff2markdown.go b/server/boards/services/notify/notifysubscriptions/diff2markdown.go index 4d7bc287f0..dfa0de1c03 100644 --- a/server/boards/services/notify/notifysubscriptions/diff2markdown.go +++ b/server/boards/services/notify/notifysubscriptions/diff2markdown.go @@ -8,7 +8,7 @@ import ( "github.com/sergi/go-diff/diffmatchpatch" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) func generateMarkdownDiff(oldText string, newText string, logger mlog.LoggerIFace) string { diff --git a/server/boards/services/notify/notifysubscriptions/diff2slackattachments.go b/server/boards/services/notify/notifysubscriptions/diff2slackattachments.go index e94e96614a..fd8904774f 100644 --- a/server/boards/services/notify/notifysubscriptions/diff2slackattachments.go +++ b/server/boards/services/notify/notifysubscriptions/diff2slackattachments.go @@ -13,10 +13,10 @@ import ( "github.com/wiggin77/merror" - "github.com/mattermost/mattermost-server/v6/server/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/model" - mm_model "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + mm_model "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) const ( diff --git a/server/boards/services/notify/notifysubscriptions/notifier.go b/server/boards/services/notify/notifysubscriptions/notifier.go index 22a0f1dde2..c2acb78336 100644 --- a/server/boards/services/notify/notifysubscriptions/notifier.go +++ b/server/boards/services/notify/notifysubscriptions/notifier.go @@ -11,11 +11,11 @@ import ( "github.com/wiggin77/merror" - "github.com/mattermost/mattermost-server/v6/server/boards/model" - "github.com/mattermost/mattermost-server/v6/server/boards/services/permissions" - "github.com/mattermost/mattermost-server/v6/server/boards/utils" + "github.com/mattermost/mattermost-server/server/v8/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/services/permissions" + "github.com/mattermost/mattermost-server/server/v8/boards/utils" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) const ( diff --git a/server/boards/services/notify/notifysubscriptions/subscriptions_backend.go b/server/boards/services/notify/notifysubscriptions/subscriptions_backend.go index 881e9160cf..af020bea6b 100644 --- a/server/boards/services/notify/notifysubscriptions/subscriptions_backend.go +++ b/server/boards/services/notify/notifysubscriptions/subscriptions_backend.go @@ -11,11 +11,11 @@ import ( "github.com/wiggin77/merror" - "github.com/mattermost/mattermost-server/v6/server/boards/model" - "github.com/mattermost/mattermost-server/v6/server/boards/services/notify" - "github.com/mattermost/mattermost-server/v6/server/boards/services/permissions" + "github.com/mattermost/mattermost-server/server/v8/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/services/notify" + "github.com/mattermost/mattermost-server/server/v8/boards/services/permissions" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) const ( diff --git a/server/boards/services/notify/notifysubscriptions/util.go b/server/boards/services/notify/notifysubscriptions/util.go index 5494ceca9f..04f5b77433 100644 --- a/server/boards/services/notify/notifysubscriptions/util.go +++ b/server/boards/services/notify/notifysubscriptions/util.go @@ -6,7 +6,7 @@ package notifysubscriptions import ( "strings" - "github.com/mattermost/mattermost-server/v6/server/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/model" ) func getBoardDescription(board *model.Block) string { diff --git a/server/boards/services/notify/plugindelivery/mention_deliver.go b/server/boards/services/notify/plugindelivery/mention_deliver.go index 330b0b23c3..dbb12e3c3b 100644 --- a/server/boards/services/notify/plugindelivery/mention_deliver.go +++ b/server/boards/services/notify/plugindelivery/mention_deliver.go @@ -6,10 +6,10 @@ package plugindelivery import ( "fmt" - "github.com/mattermost/mattermost-server/v6/server/boards/services/notify" - "github.com/mattermost/mattermost-server/v6/server/boards/utils" + "github.com/mattermost/mattermost-server/server/v8/boards/services/notify" + "github.com/mattermost/mattermost-server/server/v8/boards/utils" - mm_model "github.com/mattermost/mattermost-server/v6/model" + mm_model "github.com/mattermost/mattermost-server/server/v8/model" ) // MentionDeliver notifies a user they have been mentioned in a blockv ia the plugin API. diff --git a/server/boards/services/notify/plugindelivery/message.go b/server/boards/services/notify/plugindelivery/message.go index 26983bb644..ebaa0f7020 100644 --- a/server/boards/services/notify/plugindelivery/message.go +++ b/server/boards/services/notify/plugindelivery/message.go @@ -6,7 +6,7 @@ package plugindelivery import ( "fmt" - "github.com/mattermost/mattermost-server/v6/server/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/model" ) const ( diff --git a/server/boards/services/notify/plugindelivery/plugin_delivery.go b/server/boards/services/notify/plugindelivery/plugin_delivery.go index aa01ec3cb9..890118b3c9 100644 --- a/server/boards/services/notify/plugindelivery/plugin_delivery.go +++ b/server/boards/services/notify/plugindelivery/plugin_delivery.go @@ -4,7 +4,7 @@ package plugindelivery import ( - mm_model "github.com/mattermost/mattermost-server/v6/model" + mm_model "github.com/mattermost/mattermost-server/server/v8/model" ) type servicesAPI interface { diff --git a/server/boards/services/notify/plugindelivery/subscription_deliver.go b/server/boards/services/notify/plugindelivery/subscription_deliver.go index 21fc3d7db1..a9353eb442 100644 --- a/server/boards/services/notify/plugindelivery/subscription_deliver.go +++ b/server/boards/services/notify/plugindelivery/subscription_deliver.go @@ -7,9 +7,9 @@ import ( "errors" "fmt" - "github.com/mattermost/mattermost-server/v6/server/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/model" - mm_model "github.com/mattermost/mattermost-server/v6/model" + mm_model "github.com/mattermost/mattermost-server/server/v8/model" ) var ( diff --git a/server/boards/services/notify/plugindelivery/user.go b/server/boards/services/notify/plugindelivery/user.go index e7f16931ab..c705a39107 100644 --- a/server/boards/services/notify/plugindelivery/user.go +++ b/server/boards/services/notify/plugindelivery/user.go @@ -6,9 +6,9 @@ package plugindelivery import ( "strings" - "github.com/mattermost/mattermost-server/v6/server/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/model" - mm_model "github.com/mattermost/mattermost-server/v6/model" + mm_model "github.com/mattermost/mattermost-server/server/v8/model" ) const ( diff --git a/server/boards/services/notify/plugindelivery/user_test.go b/server/boards/services/notify/plugindelivery/user_test.go index 4702988a87..1c5aeccf4c 100644 --- a/server/boards/services/notify/plugindelivery/user_test.go +++ b/server/boards/services/notify/plugindelivery/user_test.go @@ -7,9 +7,9 @@ import ( "reflect" "testing" - "github.com/mattermost/mattermost-server/v6/server/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/model" - mm_model "github.com/mattermost/mattermost-server/v6/model" + mm_model "github.com/mattermost/mattermost-server/server/v8/model" ) var ( diff --git a/server/boards/services/notify/service.go b/server/boards/services/notify/service.go index 3814920497..308b2e7459 100644 --- a/server/boards/services/notify/service.go +++ b/server/boards/services/notify/service.go @@ -8,9 +8,9 @@ import ( "github.com/wiggin77/merror" - "github.com/mattermost/mattermost-server/v6/server/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/model" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) type Action string diff --git a/server/boards/services/permissions/localpermissions/helpers_test.go b/server/boards/services/permissions/localpermissions/helpers_test.go index 26b0524088..13f0bfa389 100644 --- a/server/boards/services/permissions/localpermissions/helpers_test.go +++ b/server/boards/services/permissions/localpermissions/helpers_test.go @@ -6,11 +6,11 @@ package localpermissions import ( "testing" - "github.com/mattermost/mattermost-server/v6/server/boards/model" - permissionsMocks "github.com/mattermost/mattermost-server/v6/server/boards/services/permissions/mocks" + "github.com/mattermost/mattermost-server/server/v8/boards/model" + permissionsMocks "github.com/mattermost/mattermost-server/server/v8/boards/services/permissions/mocks" - mm_model "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + mm_model "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" "github.com/golang/mock/gomock" "github.com/stretchr/testify/assert" diff --git a/server/boards/services/permissions/localpermissions/localpermissions.go b/server/boards/services/permissions/localpermissions/localpermissions.go index 00c76abeac..ef63b55353 100644 --- a/server/boards/services/permissions/localpermissions/localpermissions.go +++ b/server/boards/services/permissions/localpermissions/localpermissions.go @@ -4,11 +4,11 @@ package localpermissions import ( - "github.com/mattermost/mattermost-server/v6/server/boards/model" - "github.com/mattermost/mattermost-server/v6/server/boards/services/permissions" + "github.com/mattermost/mattermost-server/server/v8/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/services/permissions" - mm_model "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + mm_model "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) type Service struct { diff --git a/server/boards/services/permissions/localpermissions/localpermissions_test.go b/server/boards/services/permissions/localpermissions/localpermissions_test.go index c141413225..8bc65bf49e 100644 --- a/server/boards/services/permissions/localpermissions/localpermissions_test.go +++ b/server/boards/services/permissions/localpermissions/localpermissions_test.go @@ -7,9 +7,9 @@ import ( "database/sql" "testing" - "github.com/mattermost/mattermost-server/v6/server/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/model" - mm_model "github.com/mattermost/mattermost-server/v6/model" + mm_model "github.com/mattermost/mattermost-server/server/v8/model" "github.com/stretchr/testify/assert" ) diff --git a/server/boards/services/permissions/mmpermissions/helpers_test.go b/server/boards/services/permissions/mmpermissions/helpers_test.go index 3ecfb8b93b..f8be25a1d6 100644 --- a/server/boards/services/permissions/mmpermissions/helpers_test.go +++ b/server/boards/services/permissions/mmpermissions/helpers_test.go @@ -6,12 +6,12 @@ package mmpermissions import ( "testing" - "github.com/mattermost/mattermost-server/v6/server/boards/model" - mmpermissionsMocks "github.com/mattermost/mattermost-server/v6/server/boards/services/permissions/mmpermissions/mocks" - permissionsMocks "github.com/mattermost/mattermost-server/v6/server/boards/services/permissions/mocks" + "github.com/mattermost/mattermost-server/server/v8/boards/model" + mmpermissionsMocks "github.com/mattermost/mattermost-server/server/v8/boards/services/permissions/mmpermissions/mocks" + permissionsMocks "github.com/mattermost/mattermost-server/server/v8/boards/services/permissions/mocks" - mm_model "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + mm_model "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" "github.com/golang/mock/gomock" "github.com/stretchr/testify/assert" diff --git a/server/boards/services/permissions/mmpermissions/mmpermissions.go b/server/boards/services/permissions/mmpermissions/mmpermissions.go index dba72213b1..671d9b10db 100644 --- a/server/boards/services/permissions/mmpermissions/mmpermissions.go +++ b/server/boards/services/permissions/mmpermissions/mmpermissions.go @@ -4,11 +4,11 @@ package mmpermissions import ( - "github.com/mattermost/mattermost-server/v6/server/boards/model" - "github.com/mattermost/mattermost-server/v6/server/boards/services/permissions" + "github.com/mattermost/mattermost-server/server/v8/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/services/permissions" - mm_model "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + mm_model "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) type APIInterface interface { diff --git a/server/boards/services/permissions/mmpermissions/mmpermissions_test.go b/server/boards/services/permissions/mmpermissions/mmpermissions_test.go index e2d48cf580..9e532f7b98 100644 --- a/server/boards/services/permissions/mmpermissions/mmpermissions_test.go +++ b/server/boards/services/permissions/mmpermissions/mmpermissions_test.go @@ -1,16 +1,16 @@ // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. -//go:generate mockgen -copyright_file=../../../../copyright.txt -destination=mocks/mockpluginapi.go -package mocks github.com/mattermost/mattermost-server/v6/plugin API +//go:generate mockgen -copyright_file=../../../../copyright.txt -destination=mocks/mockpluginapi.go -package mocks github.com/mattermost/mattermost-server/server/v8/plugin API package mmpermissions import ( "database/sql" "testing" - "github.com/mattermost/mattermost-server/v6/server/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/model" - mm_model "github.com/mattermost/mattermost-server/v6/model" + mm_model "github.com/mattermost/mattermost-server/server/v8/model" "github.com/stretchr/testify/assert" ) diff --git a/server/boards/services/permissions/mmpermissions/mocks/mockpluginapi.go b/server/boards/services/permissions/mmpermissions/mocks/mockpluginapi.go index 45cf40000b..612dd07d17 100644 --- a/server/boards/services/permissions/mmpermissions/mocks/mockpluginapi.go +++ b/server/boards/services/permissions/mmpermissions/mocks/mockpluginapi.go @@ -2,7 +2,7 @@ // See LICENSE.txt for license information. // Code generated by MockGen. DO NOT EDIT. -// Source: github.com/mattermost/mattermost-server/v6/plugin (interfaces: API) +// Source: github.com/mattermost/mattermost-server/server/v8/plugin (interfaces: API) // Package mocks is a generated GoMock package. package mocks @@ -13,7 +13,7 @@ import ( reflect "reflect" gomock "github.com/golang/mock/gomock" - model "github.com/mattermost/mattermost-server/v6/model" + model "github.com/mattermost/mattermost-server/server/v8/model" ) // MockAPI is a mock of API interface. diff --git a/server/boards/services/permissions/mocks/mockstore.go b/server/boards/services/permissions/mocks/mockstore.go index 3bab466231..39fe98f029 100644 --- a/server/boards/services/permissions/mocks/mockstore.go +++ b/server/boards/services/permissions/mocks/mockstore.go @@ -2,7 +2,7 @@ // See LICENSE.txt for license information. // Code generated by MockGen. DO NOT EDIT. -// Source: github.com/mattermost/mattermost-server/v6/server/boards/services/permissions (interfaces: Store) +// Source: github.com/mattermost/mattermost-server/server/v8/boards/services/permissions (interfaces: Store) // Package mocks is a generated GoMock package. package mocks @@ -11,7 +11,7 @@ import ( reflect "reflect" gomock "github.com/golang/mock/gomock" - model "github.com/mattermost/mattermost-server/v6/server/boards/model" + model "github.com/mattermost/mattermost-server/server/v8/boards/model" ) // MockStore is a mock of Store interface. diff --git a/server/boards/services/permissions/permissions.go b/server/boards/services/permissions/permissions.go index 3c8d8a94fb..2adfdd28a1 100644 --- a/server/boards/services/permissions/permissions.go +++ b/server/boards/services/permissions/permissions.go @@ -6,9 +6,9 @@ package permissions import ( - "github.com/mattermost/mattermost-server/v6/server/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/model" - mm_model "github.com/mattermost/mattermost-server/v6/model" + mm_model "github.com/mattermost/mattermost-server/server/v8/model" ) type PermissionsService interface { diff --git a/server/boards/services/store/generators/transactional_store.go.tmpl b/server/boards/services/store/generators/transactional_store.go.tmpl index 517fbc1bf1..ff81becb83 100644 --- a/server/boards/services/store/generators/transactional_store.go.tmpl +++ b/server/boards/services/store/generators/transactional_store.go.tmpl @@ -16,10 +16,10 @@ import ( "context" "time" - "github.com/mattermost/mattermost-server/v6/server/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/model" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" - mm_model "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" + mm_model "github.com/mattermost/mattermost-server/server/v8/model" ) {{range $index, $element := .Methods}} diff --git a/server/boards/services/store/mattermostauthlayer/mattermostauthlayer.go b/server/boards/services/store/mattermostauthlayer/mattermostauthlayer.go index e749d5d9cd..b024d5224a 100644 --- a/server/boards/services/store/mattermostauthlayer/mattermostauthlayer.go +++ b/server/boards/services/store/mattermostauthlayer/mattermostauthlayer.go @@ -11,15 +11,15 @@ import ( "net/http" "strings" - mm_model "github.com/mattermost/mattermost-server/v6/model" + mm_model "github.com/mattermost/mattermost-server/server/v8/model" sq "github.com/Masterminds/squirrel" - "github.com/mattermost/mattermost-server/v6/server/boards/model" - "github.com/mattermost/mattermost-server/v6/server/boards/services/store" - "github.com/mattermost/mattermost-server/v6/server/boards/utils" + "github.com/mattermost/mattermost-server/server/v8/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/services/store" + "github.com/mattermost/mattermost-server/server/v8/boards/utils" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) var boardsBotID string @@ -70,9 +70,10 @@ func New(dbType string, db *sql.DB, store store.Store, logger mlog.LoggerIFace, return layer, nil } -// Shutdown close the connection with the store. +// For MattermostAuthLayer we don't close the database connection +// because it's directly managed by the platform func (s *MattermostAuthLayer) Shutdown() error { - return s.Store.Shutdown() + return nil } func (s *MattermostAuthLayer) GetRegisteredUserCount() (int, error) { @@ -1218,7 +1219,7 @@ func (s *MattermostAuthLayer) GetChannel(teamID, channelID string) (*mm_model.Ch func (s *MattermostAuthLayer) getBoardsBotID() (string, error) { if boardsBotID == "" { var err error - boardsBotID, err = s.servicesAPI.EnsureBot(model.FocalboardBot) + boardsBotID, err = s.servicesAPI.EnsureBot(model.GetDefaultFocalboardBot()) if err != nil { s.logger.Error("failed to ensure boards bot", mlog.Err(err)) return "", err diff --git a/server/boards/services/store/mattermostauthlayer/mattermostauthlayer_test.go b/server/boards/services/store/mattermostauthlayer/mattermostauthlayer_test.go index caa6bc88c3..88a936db9f 100644 --- a/server/boards/services/store/mattermostauthlayer/mattermostauthlayer_test.go +++ b/server/boards/services/store/mattermostauthlayer/mattermostauthlayer_test.go @@ -9,9 +9,9 @@ import ( "github.com/golang/mock/gomock" - "github.com/mattermost/mattermost-server/v6/server/boards/model" - mockservicesapi "github.com/mattermost/mattermost-server/v6/server/boards/model/mocks" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/boards/model" + mockservicesapi "github.com/mattermost/mattermost-server/server/v8/boards/model/mocks" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" "github.com/stretchr/testify/require" ) @@ -24,11 +24,11 @@ func TestGetBoardsBotID(t *testing.T) { mmAuthLayer, _ := New("test", nil, nil, mlog.CreateConsoleTestLogger(true, mlog.LvlError), servicesAPI, "") - servicesAPI.EXPECT().EnsureBot(model.FocalboardBot).Return("", errTest) + servicesAPI.EXPECT().EnsureBot(model.GetDefaultFocalboardBot()).Return("", errTest) _, err := mmAuthLayer.getBoardsBotID() require.NotEmpty(t, err) - servicesAPI.EXPECT().EnsureBot(model.FocalboardBot).Return("TestBotID", nil).Times(1) + servicesAPI.EXPECT().EnsureBot(model.GetDefaultFocalboardBot()).Return("TestBotID", nil).Times(1) botID, err := mmAuthLayer.getBoardsBotID() require.Empty(t, err) require.NotEmpty(t, botID) diff --git a/server/boards/services/store/mockstore/mockstore.go b/server/boards/services/store/mockstore/mockstore.go index 1c5f6e0c21..153b7aa7ca 100644 --- a/server/boards/services/store/mockstore/mockstore.go +++ b/server/boards/services/store/mockstore/mockstore.go @@ -2,7 +2,7 @@ // See LICENSE.txt for license information. // Code generated by MockGen. DO NOT EDIT. -// Source: github.com/mattermost/mattermost-server/v6/server/boards/services/store (interfaces: Store) +// Source: github.com/mattermost/mattermost-server/server/v8/boards/services/store (interfaces: Store) // Package mockstore is a generated GoMock package. package mockstore @@ -12,8 +12,8 @@ import ( time "time" gomock "github.com/golang/mock/gomock" - model "github.com/mattermost/mattermost-server/v6/model" - model0 "github.com/mattermost/mattermost-server/v6/server/boards/model" + model "github.com/mattermost/mattermost-server/server/v8/boards/model" + model0 "github.com/mattermost/mattermost-server/server/v8/model" ) // MockStore is a mock of Store interface. @@ -83,10 +83,10 @@ func (mr *MockStoreMockRecorder) CleanUpSessions(arg0 interface{}) *gomock.Call } // CreateBoardsAndBlocks mocks base method. -func (m *MockStore) CreateBoardsAndBlocks(arg0 *model0.BoardsAndBlocks, arg1 string) (*model0.BoardsAndBlocks, error) { +func (m *MockStore) CreateBoardsAndBlocks(arg0 *model.BoardsAndBlocks, arg1 string) (*model.BoardsAndBlocks, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "CreateBoardsAndBlocks", arg0, arg1) - ret0, _ := ret[0].(*model0.BoardsAndBlocks) + ret0, _ := ret[0].(*model.BoardsAndBlocks) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -98,11 +98,11 @@ func (mr *MockStoreMockRecorder) CreateBoardsAndBlocks(arg0, arg1 interface{}) * } // CreateBoardsAndBlocksWithAdmin mocks base method. -func (m *MockStore) CreateBoardsAndBlocksWithAdmin(arg0 *model0.BoardsAndBlocks, arg1 string) (*model0.BoardsAndBlocks, []*model0.BoardMember, error) { +func (m *MockStore) CreateBoardsAndBlocksWithAdmin(arg0 *model.BoardsAndBlocks, arg1 string) (*model.BoardsAndBlocks, []*model.BoardMember, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "CreateBoardsAndBlocksWithAdmin", arg0, arg1) - ret0, _ := ret[0].(*model0.BoardsAndBlocks) - ret1, _ := ret[1].([]*model0.BoardMember) + ret0, _ := ret[0].(*model.BoardsAndBlocks) + ret1, _ := ret[1].([]*model.BoardMember) ret2, _ := ret[2].(error) return ret0, ret1, ret2 } @@ -114,7 +114,7 @@ func (mr *MockStoreMockRecorder) CreateBoardsAndBlocksWithAdmin(arg0, arg1 inter } // CreateCategory mocks base method. -func (m *MockStore) CreateCategory(arg0 model0.Category) error { +func (m *MockStore) CreateCategory(arg0 model.Category) error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "CreateCategory", arg0) ret0, _ := ret[0].(error) @@ -128,7 +128,7 @@ func (mr *MockStoreMockRecorder) CreateCategory(arg0 interface{}) *gomock.Call { } // CreateSession mocks base method. -func (m *MockStore) CreateSession(arg0 *model0.Session) error { +func (m *MockStore) CreateSession(arg0 *model.Session) error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "CreateSession", arg0) ret0, _ := ret[0].(error) @@ -142,10 +142,10 @@ func (mr *MockStoreMockRecorder) CreateSession(arg0 interface{}) *gomock.Call { } // CreateSubscription mocks base method. -func (m *MockStore) CreateSubscription(arg0 *model0.Subscription) (*model0.Subscription, error) { +func (m *MockStore) CreateSubscription(arg0 *model.Subscription) (*model.Subscription, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "CreateSubscription", arg0) - ret0, _ := ret[0].(*model0.Subscription) + ret0, _ := ret[0].(*model.Subscription) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -157,10 +157,10 @@ func (mr *MockStoreMockRecorder) CreateSubscription(arg0 interface{}) *gomock.Ca } // CreateUser mocks base method. -func (m *MockStore) CreateUser(arg0 *model0.User) (*model0.User, error) { +func (m *MockStore) CreateUser(arg0 *model.User) (*model.User, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "CreateUser", arg0) - ret0, _ := ret[0].(*model0.User) + ret0, _ := ret[0].(*model.User) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -256,7 +256,7 @@ func (mr *MockStoreMockRecorder) DeleteBoardRecord(arg0, arg1 interface{}) *gomo } // DeleteBoardsAndBlocks mocks base method. -func (m *MockStore) DeleteBoardsAndBlocks(arg0 *model0.DeleteBoardsAndBlocks, arg1 string) error { +func (m *MockStore) DeleteBoardsAndBlocks(arg0 *model.DeleteBoardsAndBlocks, arg1 string) error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "DeleteBoardsAndBlocks", arg0, arg1) ret0, _ := ret[0].(error) @@ -354,10 +354,10 @@ func (mr *MockStoreMockRecorder) DropAllTables() *gomock.Call { } // DuplicateBlock mocks base method. -func (m *MockStore) DuplicateBlock(arg0, arg1, arg2 string, arg3 bool) ([]*model0.Block, error) { +func (m *MockStore) DuplicateBlock(arg0, arg1, arg2 string, arg3 bool) ([]*model.Block, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "DuplicateBlock", arg0, arg1, arg2, arg3) - ret0, _ := ret[0].([]*model0.Block) + ret0, _ := ret[0].([]*model.Block) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -369,11 +369,11 @@ func (mr *MockStoreMockRecorder) DuplicateBlock(arg0, arg1, arg2, arg3 interface } // DuplicateBoard mocks base method. -func (m *MockStore) DuplicateBoard(arg0, arg1, arg2 string, arg3 bool) (*model0.BoardsAndBlocks, []*model0.BoardMember, error) { +func (m *MockStore) DuplicateBoard(arg0, arg1, arg2 string, arg3 bool) (*model.BoardsAndBlocks, []*model.BoardMember, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "DuplicateBoard", arg0, arg1, arg2, arg3) - ret0, _ := ret[0].(*model0.BoardsAndBlocks) - ret1, _ := ret[1].([]*model0.BoardMember) + ret0, _ := ret[0].(*model.BoardsAndBlocks) + ret1, _ := ret[1].([]*model.BoardMember) ret2, _ := ret[2].(error) return ret0, ret1, ret2 } @@ -400,10 +400,10 @@ func (mr *MockStoreMockRecorder) GetActiveUserCount(arg0 interface{}) *gomock.Ca } // GetAllTeams mocks base method. -func (m *MockStore) GetAllTeams() ([]*model0.Team, error) { +func (m *MockStore) GetAllTeams() ([]*model.Team, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetAllTeams") - ret0, _ := ret[0].([]*model0.Team) + ret0, _ := ret[0].([]*model.Team) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -415,10 +415,10 @@ func (mr *MockStoreMockRecorder) GetAllTeams() *gomock.Call { } // GetBlock mocks base method. -func (m *MockStore) GetBlock(arg0 string) (*model0.Block, error) { +func (m *MockStore) GetBlock(arg0 string) (*model.Block, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetBlock", arg0) - ret0, _ := ret[0].(*model0.Block) + ret0, _ := ret[0].(*model.Block) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -445,10 +445,10 @@ func (mr *MockStoreMockRecorder) GetBlockCountsByType() *gomock.Call { } // GetBlockHistory mocks base method. -func (m *MockStore) GetBlockHistory(arg0 string, arg1 model0.QueryBlockHistoryOptions) ([]*model0.Block, error) { +func (m *MockStore) GetBlockHistory(arg0 string, arg1 model.QueryBlockHistoryOptions) ([]*model.Block, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetBlockHistory", arg0, arg1) - ret0, _ := ret[0].([]*model0.Block) + ret0, _ := ret[0].([]*model.Block) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -460,10 +460,10 @@ func (mr *MockStoreMockRecorder) GetBlockHistory(arg0, arg1 interface{}) *gomock } // GetBlockHistoryDescendants mocks base method. -func (m *MockStore) GetBlockHistoryDescendants(arg0 string, arg1 model0.QueryBlockHistoryOptions) ([]*model0.Block, error) { +func (m *MockStore) GetBlockHistoryDescendants(arg0 string, arg1 model.QueryBlockHistoryOptions) ([]*model.Block, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetBlockHistoryDescendants", arg0, arg1) - ret0, _ := ret[0].([]*model0.Block) + ret0, _ := ret[0].([]*model.Block) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -475,10 +475,10 @@ func (mr *MockStoreMockRecorder) GetBlockHistoryDescendants(arg0, arg1 interface } // GetBlockHistoryNewestChildren mocks base method. -func (m *MockStore) GetBlockHistoryNewestChildren(arg0 string, arg1 model0.QueryBlockHistoryChildOptions) ([]*model0.Block, bool, error) { +func (m *MockStore) GetBlockHistoryNewestChildren(arg0 string, arg1 model.QueryBlockHistoryChildOptions) ([]*model.Block, bool, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetBlockHistoryNewestChildren", arg0, arg1) - ret0, _ := ret[0].([]*model0.Block) + ret0, _ := ret[0].([]*model.Block) ret1, _ := ret[1].(bool) ret2, _ := ret[2].(error) return ret0, ret1, ret2 @@ -491,10 +491,10 @@ func (mr *MockStoreMockRecorder) GetBlockHistoryNewestChildren(arg0, arg1 interf } // GetBlocks mocks base method. -func (m *MockStore) GetBlocks(arg0 model0.QueryBlocksOptions) ([]*model0.Block, error) { +func (m *MockStore) GetBlocks(arg0 model.QueryBlocksOptions) ([]*model.Block, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetBlocks", arg0) - ret0, _ := ret[0].([]*model0.Block) + ret0, _ := ret[0].([]*model.Block) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -506,10 +506,10 @@ func (mr *MockStoreMockRecorder) GetBlocks(arg0 interface{}) *gomock.Call { } // GetBlocksByIDs mocks base method. -func (m *MockStore) GetBlocksByIDs(arg0 []string) ([]*model0.Block, error) { +func (m *MockStore) GetBlocksByIDs(arg0 []string) ([]*model.Block, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetBlocksByIDs", arg0) - ret0, _ := ret[0].([]*model0.Block) + ret0, _ := ret[0].([]*model.Block) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -521,10 +521,10 @@ func (mr *MockStoreMockRecorder) GetBlocksByIDs(arg0 interface{}) *gomock.Call { } // GetBlocksComplianceHistory mocks base method. -func (m *MockStore) GetBlocksComplianceHistory(arg0 model0.QueryBlocksComplianceHistoryOptions) ([]*model0.BlockHistory, bool, error) { +func (m *MockStore) GetBlocksComplianceHistory(arg0 model.QueryBlocksComplianceHistoryOptions) ([]*model.BlockHistory, bool, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetBlocksComplianceHistory", arg0) - ret0, _ := ret[0].([]*model0.BlockHistory) + ret0, _ := ret[0].([]*model.BlockHistory) ret1, _ := ret[1].(bool) ret2, _ := ret[2].(error) return ret0, ret1, ret2 @@ -536,71 +536,11 @@ func (mr *MockStoreMockRecorder) GetBlocksComplianceHistory(arg0 interface{}) *g return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetBlocksComplianceHistory", reflect.TypeOf((*MockStore)(nil).GetBlocksComplianceHistory), arg0) } -// GetBlocksForBoard mocks base method. -func (m *MockStore) GetBlocksForBoard(arg0 string) ([]*model0.Block, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetBlocksForBoard", arg0) - ret0, _ := ret[0].([]*model0.Block) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// GetBlocksForBoard indicates an expected call of GetBlocksForBoard. -func (mr *MockStoreMockRecorder) GetBlocksForBoard(arg0 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetBlocksForBoard", reflect.TypeOf((*MockStore)(nil).GetBlocksForBoard), arg0) -} - -// GetBlocksWithParent mocks base method. -func (m *MockStore) GetBlocksWithParent(arg0, arg1 string) ([]*model0.Block, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetBlocksWithParent", arg0, arg1) - ret0, _ := ret[0].([]*model0.Block) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// GetBlocksWithParent indicates an expected call of GetBlocksWithParent. -func (mr *MockStoreMockRecorder) GetBlocksWithParent(arg0, arg1 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetBlocksWithParent", reflect.TypeOf((*MockStore)(nil).GetBlocksWithParent), arg0, arg1) -} - -// GetBlocksWithParentAndType mocks base method. -func (m *MockStore) GetBlocksWithParentAndType(arg0, arg1, arg2 string) ([]*model0.Block, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetBlocksWithParentAndType", arg0, arg1, arg2) - ret0, _ := ret[0].([]*model0.Block) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// GetBlocksWithParentAndType indicates an expected call of GetBlocksWithParentAndType. -func (mr *MockStoreMockRecorder) GetBlocksWithParentAndType(arg0, arg1, arg2 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetBlocksWithParentAndType", reflect.TypeOf((*MockStore)(nil).GetBlocksWithParentAndType), arg0, arg1, arg2) -} - -// GetBlocksWithType mocks base method. -func (m *MockStore) GetBlocksWithType(arg0, arg1 string) ([]*model0.Block, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetBlocksWithType", arg0, arg1) - ret0, _ := ret[0].([]*model0.Block) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// GetBlocksWithType indicates an expected call of GetBlocksWithType. -func (mr *MockStoreMockRecorder) GetBlocksWithType(arg0, arg1 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetBlocksWithType", reflect.TypeOf((*MockStore)(nil).GetBlocksWithType), arg0, arg1) -} - // GetBoard mocks base method. -func (m *MockStore) GetBoard(arg0 string) (*model0.Board, error) { +func (m *MockStore) GetBoard(arg0 string) (*model.Board, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetBoard", arg0) - ret0, _ := ret[0].(*model0.Board) + ret0, _ := ret[0].(*model.Board) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -612,11 +552,11 @@ func (mr *MockStoreMockRecorder) GetBoard(arg0 interface{}) *gomock.Call { } // GetBoardAndCard mocks base method. -func (m *MockStore) GetBoardAndCard(arg0 *model0.Block) (*model0.Board, *model0.Block, error) { +func (m *MockStore) GetBoardAndCard(arg0 *model.Block) (*model.Board, *model.Block, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetBoardAndCard", arg0) - ret0, _ := ret[0].(*model0.Board) - ret1, _ := ret[1].(*model0.Block) + ret0, _ := ret[0].(*model.Board) + ret1, _ := ret[1].(*model.Block) ret2, _ := ret[2].(error) return ret0, ret1, ret2 } @@ -628,11 +568,11 @@ func (mr *MockStoreMockRecorder) GetBoardAndCard(arg0 interface{}) *gomock.Call } // GetBoardAndCardByID mocks base method. -func (m *MockStore) GetBoardAndCardByID(arg0 string) (*model0.Board, *model0.Block, error) { +func (m *MockStore) GetBoardAndCardByID(arg0 string) (*model.Board, *model.Block, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetBoardAndCardByID", arg0) - ret0, _ := ret[0].(*model0.Board) - ret1, _ := ret[1].(*model0.Block) + ret0, _ := ret[0].(*model.Board) + ret1, _ := ret[1].(*model.Block) ret2, _ := ret[2].(error) return ret0, ret1, ret2 } @@ -659,10 +599,10 @@ func (mr *MockStoreMockRecorder) GetBoardCount() *gomock.Call { } // GetBoardHistory mocks base method. -func (m *MockStore) GetBoardHistory(arg0 string, arg1 model0.QueryBoardHistoryOptions) ([]*model0.Board, error) { +func (m *MockStore) GetBoardHistory(arg0 string, arg1 model.QueryBoardHistoryOptions) ([]*model.Board, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetBoardHistory", arg0, arg1) - ret0, _ := ret[0].([]*model0.Board) + ret0, _ := ret[0].([]*model.Board) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -674,10 +614,10 @@ func (mr *MockStoreMockRecorder) GetBoardHistory(arg0, arg1 interface{}) *gomock } // GetBoardMemberHistory mocks base method. -func (m *MockStore) GetBoardMemberHistory(arg0, arg1 string, arg2 uint64) ([]*model0.BoardMemberHistoryEntry, error) { +func (m *MockStore) GetBoardMemberHistory(arg0, arg1 string, arg2 uint64) ([]*model.BoardMemberHistoryEntry, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetBoardMemberHistory", arg0, arg1, arg2) - ret0, _ := ret[0].([]*model0.BoardMemberHistoryEntry) + ret0, _ := ret[0].([]*model.BoardMemberHistoryEntry) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -689,10 +629,10 @@ func (mr *MockStoreMockRecorder) GetBoardMemberHistory(arg0, arg1, arg2 interfac } // GetBoardsComplianceHistory mocks base method. -func (m *MockStore) GetBoardsComplianceHistory(arg0 model0.QueryBoardsComplianceHistoryOptions) ([]*model0.BoardHistory, bool, error) { +func (m *MockStore) GetBoardsComplianceHistory(arg0 model.QueryBoardsComplianceHistoryOptions) ([]*model.BoardHistory, bool, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetBoardsComplianceHistory", arg0) - ret0, _ := ret[0].([]*model0.BoardHistory) + ret0, _ := ret[0].([]*model.BoardHistory) ret1, _ := ret[1].(bool) ret2, _ := ret[2].(error) return ret0, ret1, ret2 @@ -705,10 +645,10 @@ func (mr *MockStoreMockRecorder) GetBoardsComplianceHistory(arg0 interface{}) *g } // GetBoardsForCompliance mocks base method. -func (m *MockStore) GetBoardsForCompliance(arg0 model0.QueryBoardsForComplianceOptions) ([]*model0.Board, bool, error) { +func (m *MockStore) GetBoardsForCompliance(arg0 model.QueryBoardsForComplianceOptions) ([]*model.Board, bool, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetBoardsForCompliance", arg0) - ret0, _ := ret[0].([]*model0.Board) + ret0, _ := ret[0].([]*model.Board) ret1, _ := ret[1].(bool) ret2, _ := ret[2].(error) return ret0, ret1, ret2 @@ -721,10 +661,10 @@ func (mr *MockStoreMockRecorder) GetBoardsForCompliance(arg0 interface{}) *gomoc } // GetBoardsForUserAndTeam mocks base method. -func (m *MockStore) GetBoardsForUserAndTeam(arg0, arg1 string, arg2 bool) ([]*model0.Board, error) { +func (m *MockStore) GetBoardsForUserAndTeam(arg0, arg1 string, arg2 bool) ([]*model.Board, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetBoardsForUserAndTeam", arg0, arg1, arg2) - ret0, _ := ret[0].([]*model0.Board) + ret0, _ := ret[0].([]*model.Board) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -736,10 +676,10 @@ func (mr *MockStoreMockRecorder) GetBoardsForUserAndTeam(arg0, arg1, arg2 interf } // GetBoardsInTeamByIds mocks base method. -func (m *MockStore) GetBoardsInTeamByIds(arg0 []string, arg1 string) ([]*model0.Board, error) { +func (m *MockStore) GetBoardsInTeamByIds(arg0 []string, arg1 string) ([]*model.Board, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetBoardsInTeamByIds", arg0, arg1) - ret0, _ := ret[0].([]*model0.Board) + ret0, _ := ret[0].([]*model.Board) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -766,10 +706,10 @@ func (mr *MockStoreMockRecorder) GetCardLimitTimestamp() *gomock.Call { } // GetCategory mocks base method. -func (m *MockStore) GetCategory(arg0 string) (*model0.Category, error) { +func (m *MockStore) GetCategory(arg0 string) (*model.Category, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetCategory", arg0) - ret0, _ := ret[0].(*model0.Category) + ret0, _ := ret[0].(*model.Category) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -781,10 +721,10 @@ func (mr *MockStoreMockRecorder) GetCategory(arg0 interface{}) *gomock.Call { } // GetChannel mocks base method. -func (m *MockStore) GetChannel(arg0, arg1 string) (*model.Channel, error) { +func (m *MockStore) GetChannel(arg0, arg1 string) (*model0.Channel, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetChannel", arg0, arg1) - ret0, _ := ret[0].(*model.Channel) + ret0, _ := ret[0].(*model0.Channel) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -796,10 +736,10 @@ func (mr *MockStoreMockRecorder) GetChannel(arg0, arg1 interface{}) *gomock.Call } // GetCloudLimits mocks base method. -func (m *MockStore) GetCloudLimits() (*model.ProductLimits, error) { +func (m *MockStore) GetCloudLimits() (*model0.ProductLimits, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetCloudLimits") - ret0, _ := ret[0].(*model.ProductLimits) + ret0, _ := ret[0].(*model0.ProductLimits) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -811,10 +751,10 @@ func (mr *MockStoreMockRecorder) GetCloudLimits() *gomock.Call { } // GetFileInfo mocks base method. -func (m *MockStore) GetFileInfo(arg0 string) (*model.FileInfo, error) { +func (m *MockStore) GetFileInfo(arg0 string) (*model0.FileInfo, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetFileInfo", arg0) - ret0, _ := ret[0].(*model.FileInfo) + ret0, _ := ret[0].(*model0.FileInfo) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -826,10 +766,10 @@ func (mr *MockStoreMockRecorder) GetFileInfo(arg0 interface{}) *gomock.Call { } // GetLicense mocks base method. -func (m *MockStore) GetLicense() *model.License { +func (m *MockStore) GetLicense() *model0.License { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetLicense") - ret0, _ := ret[0].(*model.License) + ret0, _ := ret[0].(*model0.License) return ret0 } @@ -840,10 +780,10 @@ func (mr *MockStoreMockRecorder) GetLicense() *gomock.Call { } // GetMemberForBoard mocks base method. -func (m *MockStore) GetMemberForBoard(arg0, arg1 string) (*model0.BoardMember, error) { +func (m *MockStore) GetMemberForBoard(arg0, arg1 string) (*model.BoardMember, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetMemberForBoard", arg0, arg1) - ret0, _ := ret[0].(*model0.BoardMember) + ret0, _ := ret[0].(*model.BoardMember) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -855,10 +795,10 @@ func (mr *MockStoreMockRecorder) GetMemberForBoard(arg0, arg1 interface{}) *gomo } // GetMembersForBoard mocks base method. -func (m *MockStore) GetMembersForBoard(arg0 string) ([]*model0.BoardMember, error) { +func (m *MockStore) GetMembersForBoard(arg0 string) ([]*model.BoardMember, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetMembersForBoard", arg0) - ret0, _ := ret[0].([]*model0.BoardMember) + ret0, _ := ret[0].([]*model.BoardMember) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -870,10 +810,10 @@ func (mr *MockStoreMockRecorder) GetMembersForBoard(arg0 interface{}) *gomock.Ca } // GetMembersForUser mocks base method. -func (m *MockStore) GetMembersForUser(arg0 string) ([]*model0.BoardMember, error) { +func (m *MockStore) GetMembersForUser(arg0 string) ([]*model.BoardMember, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetMembersForUser", arg0) - ret0, _ := ret[0].([]*model0.BoardMember) + ret0, _ := ret[0].([]*model.BoardMember) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -885,10 +825,10 @@ func (mr *MockStoreMockRecorder) GetMembersForUser(arg0 interface{}) *gomock.Cal } // GetNextNotificationHint mocks base method. -func (m *MockStore) GetNextNotificationHint(arg0 bool) (*model0.NotificationHint, error) { +func (m *MockStore) GetNextNotificationHint(arg0 bool) (*model.NotificationHint, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetNextNotificationHint", arg0) - ret0, _ := ret[0].(*model0.NotificationHint) + ret0, _ := ret[0].(*model.NotificationHint) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -900,10 +840,10 @@ func (mr *MockStoreMockRecorder) GetNextNotificationHint(arg0 interface{}) *gomo } // GetNotificationHint mocks base method. -func (m *MockStore) GetNotificationHint(arg0 string) (*model0.NotificationHint, error) { +func (m *MockStore) GetNotificationHint(arg0 string) (*model.NotificationHint, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetNotificationHint", arg0) - ret0, _ := ret[0].(*model0.NotificationHint) + ret0, _ := ret[0].(*model.NotificationHint) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -930,10 +870,10 @@ func (mr *MockStoreMockRecorder) GetRegisteredUserCount() *gomock.Call { } // GetSession mocks base method. -func (m *MockStore) GetSession(arg0 string, arg1 int64) (*model0.Session, error) { +func (m *MockStore) GetSession(arg0 string, arg1 int64) (*model.Session, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetSession", arg0, arg1) - ret0, _ := ret[0].(*model0.Session) + ret0, _ := ret[0].(*model.Session) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -945,10 +885,10 @@ func (mr *MockStoreMockRecorder) GetSession(arg0, arg1 interface{}) *gomock.Call } // GetSharing mocks base method. -func (m *MockStore) GetSharing(arg0 string) (*model0.Sharing, error) { +func (m *MockStore) GetSharing(arg0 string) (*model.Sharing, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetSharing", arg0) - ret0, _ := ret[0].(*model0.Sharing) + ret0, _ := ret[0].(*model.Sharing) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -960,10 +900,10 @@ func (mr *MockStoreMockRecorder) GetSharing(arg0 interface{}) *gomock.Call { } // GetSubTree2 mocks base method. -func (m *MockStore) GetSubTree2(arg0, arg1 string, arg2 model0.QuerySubtreeOptions) ([]*model0.Block, error) { +func (m *MockStore) GetSubTree2(arg0, arg1 string, arg2 model.QuerySubtreeOptions) ([]*model.Block, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetSubTree2", arg0, arg1, arg2) - ret0, _ := ret[0].([]*model0.Block) + ret0, _ := ret[0].([]*model.Block) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -990,10 +930,10 @@ func (mr *MockStoreMockRecorder) GetSubscribersCountForBlock(arg0 interface{}) * } // GetSubscribersForBlock mocks base method. -func (m *MockStore) GetSubscribersForBlock(arg0 string) ([]*model0.Subscriber, error) { +func (m *MockStore) GetSubscribersForBlock(arg0 string) ([]*model.Subscriber, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetSubscribersForBlock", arg0) - ret0, _ := ret[0].([]*model0.Subscriber) + ret0, _ := ret[0].([]*model.Subscriber) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -1005,10 +945,10 @@ func (mr *MockStoreMockRecorder) GetSubscribersForBlock(arg0 interface{}) *gomoc } // GetSubscription mocks base method. -func (m *MockStore) GetSubscription(arg0, arg1 string) (*model0.Subscription, error) { +func (m *MockStore) GetSubscription(arg0, arg1 string) (*model.Subscription, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetSubscription", arg0, arg1) - ret0, _ := ret[0].(*model0.Subscription) + ret0, _ := ret[0].(*model.Subscription) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -1020,10 +960,10 @@ func (mr *MockStoreMockRecorder) GetSubscription(arg0, arg1 interface{}) *gomock } // GetSubscriptions mocks base method. -func (m *MockStore) GetSubscriptions(arg0 string) ([]*model0.Subscription, error) { +func (m *MockStore) GetSubscriptions(arg0 string) ([]*model.Subscription, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetSubscriptions", arg0) - ret0, _ := ret[0].([]*model0.Subscription) + ret0, _ := ret[0].([]*model.Subscription) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -1065,10 +1005,10 @@ func (mr *MockStoreMockRecorder) GetSystemSettings() *gomock.Call { } // GetTeam mocks base method. -func (m *MockStore) GetTeam(arg0 string) (*model0.Team, error) { +func (m *MockStore) GetTeam(arg0 string) (*model.Team, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetTeam", arg0) - ret0, _ := ret[0].(*model0.Team) + ret0, _ := ret[0].(*model.Team) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -1080,10 +1020,10 @@ func (mr *MockStoreMockRecorder) GetTeam(arg0 interface{}) *gomock.Call { } // GetTeamBoardsInsights mocks base method. -func (m *MockStore) GetTeamBoardsInsights(arg0 string, arg1 int64, arg2, arg3 int, arg4 []string) (*model0.BoardInsightsList, error) { +func (m *MockStore) GetTeamBoardsInsights(arg0 string, arg1 int64, arg2, arg3 int, arg4 []string) (*model.BoardInsightsList, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetTeamBoardsInsights", arg0, arg1, arg2, arg3, arg4) - ret0, _ := ret[0].(*model0.BoardInsightsList) + ret0, _ := ret[0].(*model.BoardInsightsList) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -1110,10 +1050,10 @@ func (mr *MockStoreMockRecorder) GetTeamCount() *gomock.Call { } // GetTeamsForUser mocks base method. -func (m *MockStore) GetTeamsForUser(arg0 string) ([]*model0.Team, error) { +func (m *MockStore) GetTeamsForUser(arg0 string) ([]*model.Team, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetTeamsForUser", arg0) - ret0, _ := ret[0].([]*model0.Team) + ret0, _ := ret[0].([]*model.Team) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -1125,10 +1065,10 @@ func (mr *MockStoreMockRecorder) GetTeamsForUser(arg0 interface{}) *gomock.Call } // GetTemplateBoards mocks base method. -func (m *MockStore) GetTemplateBoards(arg0, arg1 string) ([]*model0.Board, error) { +func (m *MockStore) GetTemplateBoards(arg0, arg1 string) ([]*model.Board, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetTemplateBoards", arg0, arg1) - ret0, _ := ret[0].([]*model0.Board) + ret0, _ := ret[0].([]*model.Board) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -1155,10 +1095,10 @@ func (mr *MockStoreMockRecorder) GetUsedCardsCount() *gomock.Call { } // GetUserBoardsInsights mocks base method. -func (m *MockStore) GetUserBoardsInsights(arg0, arg1 string, arg2 int64, arg3, arg4 int, arg5 []string) (*model0.BoardInsightsList, error) { +func (m *MockStore) GetUserBoardsInsights(arg0, arg1 string, arg2 int64, arg3, arg4 int, arg5 []string) (*model.BoardInsightsList, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetUserBoardsInsights", arg0, arg1, arg2, arg3, arg4, arg5) - ret0, _ := ret[0].(*model0.BoardInsightsList) + ret0, _ := ret[0].(*model.BoardInsightsList) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -1170,10 +1110,10 @@ func (mr *MockStoreMockRecorder) GetUserBoardsInsights(arg0, arg1, arg2, arg3, a } // GetUserByEmail mocks base method. -func (m *MockStore) GetUserByEmail(arg0 string) (*model0.User, error) { +func (m *MockStore) GetUserByEmail(arg0 string) (*model.User, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetUserByEmail", arg0) - ret0, _ := ret[0].(*model0.User) + ret0, _ := ret[0].(*model.User) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -1185,10 +1125,10 @@ func (mr *MockStoreMockRecorder) GetUserByEmail(arg0 interface{}) *gomock.Call { } // GetUserByID mocks base method. -func (m *MockStore) GetUserByID(arg0 string) (*model0.User, error) { +func (m *MockStore) GetUserByID(arg0 string) (*model.User, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetUserByID", arg0) - ret0, _ := ret[0].(*model0.User) + ret0, _ := ret[0].(*model.User) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -1200,10 +1140,10 @@ func (mr *MockStoreMockRecorder) GetUserByID(arg0 interface{}) *gomock.Call { } // GetUserByUsername mocks base method. -func (m *MockStore) GetUserByUsername(arg0 string) (*model0.User, error) { +func (m *MockStore) GetUserByUsername(arg0 string) (*model.User, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetUserByUsername", arg0) - ret0, _ := ret[0].(*model0.User) + ret0, _ := ret[0].(*model.User) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -1215,10 +1155,10 @@ func (mr *MockStoreMockRecorder) GetUserByUsername(arg0 interface{}) *gomock.Cal } // GetUserCategories mocks base method. -func (m *MockStore) GetUserCategories(arg0, arg1 string) ([]model0.Category, error) { +func (m *MockStore) GetUserCategories(arg0, arg1 string) ([]model.Category, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetUserCategories", arg0, arg1) - ret0, _ := ret[0].([]model0.Category) + ret0, _ := ret[0].([]model.Category) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -1230,10 +1170,10 @@ func (mr *MockStoreMockRecorder) GetUserCategories(arg0, arg1 interface{}) *gomo } // GetUserCategoryBoards mocks base method. -func (m *MockStore) GetUserCategoryBoards(arg0, arg1 string) ([]model0.CategoryBoards, error) { +func (m *MockStore) GetUserCategoryBoards(arg0, arg1 string) ([]model.CategoryBoards, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetUserCategoryBoards", arg0, arg1) - ret0, _ := ret[0].([]model0.CategoryBoards) + ret0, _ := ret[0].([]model.CategoryBoards) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -1245,10 +1185,10 @@ func (mr *MockStoreMockRecorder) GetUserCategoryBoards(arg0, arg1 interface{}) * } // GetUserPreferences mocks base method. -func (m *MockStore) GetUserPreferences(arg0 string) (model.Preferences, error) { +func (m *MockStore) GetUserPreferences(arg0 string) (model0.Preferences, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetUserPreferences", arg0) - ret0, _ := ret[0].(model.Preferences) + ret0, _ := ret[0].(model0.Preferences) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -1275,10 +1215,10 @@ func (mr *MockStoreMockRecorder) GetUserTimezone(arg0 interface{}) *gomock.Call } // GetUsersByTeam mocks base method. -func (m *MockStore) GetUsersByTeam(arg0, arg1 string, arg2, arg3 bool) ([]*model0.User, error) { +func (m *MockStore) GetUsersByTeam(arg0, arg1 string, arg2, arg3 bool) ([]*model.User, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetUsersByTeam", arg0, arg1, arg2, arg3) - ret0, _ := ret[0].([]*model0.User) + ret0, _ := ret[0].([]*model.User) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -1290,10 +1230,10 @@ func (mr *MockStoreMockRecorder) GetUsersByTeam(arg0, arg1, arg2, arg3 interface } // GetUsersList mocks base method. -func (m *MockStore) GetUsersList(arg0 []string, arg1, arg2 bool) ([]*model0.User, error) { +func (m *MockStore) GetUsersList(arg0 []string, arg1, arg2 bool) ([]*model.User, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetUsersList", arg0, arg1, arg2) - ret0, _ := ret[0].([]*model0.User) + ret0, _ := ret[0].([]*model.User) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -1305,7 +1245,7 @@ func (mr *MockStoreMockRecorder) GetUsersList(arg0, arg1, arg2 interface{}) *gom } // InsertBlock mocks base method. -func (m *MockStore) InsertBlock(arg0 *model0.Block, arg1 string) error { +func (m *MockStore) InsertBlock(arg0 *model.Block, arg1 string) error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "InsertBlock", arg0, arg1) ret0, _ := ret[0].(error) @@ -1319,7 +1259,7 @@ func (mr *MockStoreMockRecorder) InsertBlock(arg0, arg1 interface{}) *gomock.Cal } // InsertBlocks mocks base method. -func (m *MockStore) InsertBlocks(arg0 []*model0.Block, arg1 string) error { +func (m *MockStore) InsertBlocks(arg0 []*model.Block, arg1 string) error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "InsertBlocks", arg0, arg1) ret0, _ := ret[0].(error) @@ -1333,10 +1273,10 @@ func (mr *MockStoreMockRecorder) InsertBlocks(arg0, arg1 interface{}) *gomock.Ca } // InsertBoard mocks base method. -func (m *MockStore) InsertBoard(arg0 *model0.Board, arg1 string) (*model0.Board, error) { +func (m *MockStore) InsertBoard(arg0 *model.Board, arg1 string) (*model.Board, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "InsertBoard", arg0, arg1) - ret0, _ := ret[0].(*model0.Board) + ret0, _ := ret[0].(*model.Board) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -1348,11 +1288,11 @@ func (mr *MockStoreMockRecorder) InsertBoard(arg0, arg1 interface{}) *gomock.Cal } // InsertBoardWithAdmin mocks base method. -func (m *MockStore) InsertBoardWithAdmin(arg0 *model0.Board, arg1 string) (*model0.Board, *model0.BoardMember, error) { +func (m *MockStore) InsertBoardWithAdmin(arg0 *model.Board, arg1 string) (*model.Board, *model.BoardMember, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "InsertBoardWithAdmin", arg0, arg1) - ret0, _ := ret[0].(*model0.Board) - ret1, _ := ret[1].(*model0.BoardMember) + ret0, _ := ret[0].(*model.Board) + ret1, _ := ret[1].(*model.BoardMember) ret2, _ := ret[2].(error) return ret0, ret1, ret2 } @@ -1364,7 +1304,7 @@ func (mr *MockStoreMockRecorder) InsertBoardWithAdmin(arg0, arg1 interface{}) *g } // PatchBlock mocks base method. -func (m *MockStore) PatchBlock(arg0 string, arg1 *model0.BlockPatch, arg2 string) error { +func (m *MockStore) PatchBlock(arg0 string, arg1 *model.BlockPatch, arg2 string) error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "PatchBlock", arg0, arg1, arg2) ret0, _ := ret[0].(error) @@ -1378,7 +1318,7 @@ func (mr *MockStoreMockRecorder) PatchBlock(arg0, arg1, arg2 interface{}) *gomoc } // PatchBlocks mocks base method. -func (m *MockStore) PatchBlocks(arg0 *model0.BlockPatchBatch, arg1 string) error { +func (m *MockStore) PatchBlocks(arg0 *model.BlockPatchBatch, arg1 string) error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "PatchBlocks", arg0, arg1) ret0, _ := ret[0].(error) @@ -1392,10 +1332,10 @@ func (mr *MockStoreMockRecorder) PatchBlocks(arg0, arg1 interface{}) *gomock.Cal } // PatchBoard mocks base method. -func (m *MockStore) PatchBoard(arg0 string, arg1 *model0.BoardPatch, arg2 string) (*model0.Board, error) { +func (m *MockStore) PatchBoard(arg0 string, arg1 *model.BoardPatch, arg2 string) (*model.Board, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "PatchBoard", arg0, arg1, arg2) - ret0, _ := ret[0].(*model0.Board) + ret0, _ := ret[0].(*model.Board) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -1407,10 +1347,10 @@ func (mr *MockStoreMockRecorder) PatchBoard(arg0, arg1, arg2 interface{}) *gomoc } // PatchBoardsAndBlocks mocks base method. -func (m *MockStore) PatchBoardsAndBlocks(arg0 *model0.PatchBoardsAndBlocks, arg1 string) (*model0.BoardsAndBlocks, error) { +func (m *MockStore) PatchBoardsAndBlocks(arg0 *model.PatchBoardsAndBlocks, arg1 string) (*model.BoardsAndBlocks, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "PatchBoardsAndBlocks", arg0, arg1) - ret0, _ := ret[0].(*model0.BoardsAndBlocks) + ret0, _ := ret[0].(*model.BoardsAndBlocks) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -1422,10 +1362,10 @@ func (mr *MockStoreMockRecorder) PatchBoardsAndBlocks(arg0, arg1 interface{}) *g } // PatchUserPreferences mocks base method. -func (m *MockStore) PatchUserPreferences(arg0 string, arg1 model0.UserPreferencesPatch) (model.Preferences, error) { +func (m *MockStore) PatchUserPreferences(arg0 string, arg1 model.UserPreferencesPatch) (model0.Preferences, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "PatchUserPreferences", arg0, arg1) - ret0, _ := ret[0].(model.Preferences) + ret0, _ := ret[0].(model0.Preferences) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -1451,7 +1391,7 @@ func (mr *MockStoreMockRecorder) PostMessage(arg0, arg1, arg2 interface{}) *gomo } // RefreshSession mocks base method. -func (m *MockStore) RefreshSession(arg0 *model0.Session) error { +func (m *MockStore) RefreshSession(arg0 *model.Session) error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "RefreshSession", arg0) ret0, _ := ret[0].(error) @@ -1465,7 +1405,7 @@ func (mr *MockStoreMockRecorder) RefreshSession(arg0 interface{}) *gomock.Call { } // RemoveDefaultTemplates mocks base method. -func (m *MockStore) RemoveDefaultTemplates(arg0 []*model0.Board) error { +func (m *MockStore) RemoveDefaultTemplates(arg0 []*model.Board) error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "RemoveDefaultTemplates", arg0) ret0, _ := ret[0].(error) @@ -1524,7 +1464,7 @@ func (mr *MockStoreMockRecorder) RunDataRetention(arg0, arg1 interface{}) *gomoc } // SaveFileInfo mocks base method. -func (m *MockStore) SaveFileInfo(arg0 *model.FileInfo) error { +func (m *MockStore) SaveFileInfo(arg0 *model0.FileInfo) error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "SaveFileInfo", arg0) ret0, _ := ret[0].(error) @@ -1538,10 +1478,10 @@ func (mr *MockStoreMockRecorder) SaveFileInfo(arg0 interface{}) *gomock.Call { } // SaveMember mocks base method. -func (m *MockStore) SaveMember(arg0 *model0.BoardMember) (*model0.BoardMember, error) { +func (m *MockStore) SaveMember(arg0 *model.BoardMember) (*model.BoardMember, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "SaveMember", arg0) - ret0, _ := ret[0].(*model0.BoardMember) + ret0, _ := ret[0].(*model.BoardMember) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -1553,10 +1493,10 @@ func (mr *MockStoreMockRecorder) SaveMember(arg0 interface{}) *gomock.Call { } // SearchBoardsForUser mocks base method. -func (m *MockStore) SearchBoardsForUser(arg0 string, arg1 model0.BoardSearchField, arg2 string, arg3 bool) ([]*model0.Board, error) { +func (m *MockStore) SearchBoardsForUser(arg0 string, arg1 model.BoardSearchField, arg2 string, arg3 bool) ([]*model.Board, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "SearchBoardsForUser", arg0, arg1, arg2, arg3) - ret0, _ := ret[0].([]*model0.Board) + ret0, _ := ret[0].([]*model.Board) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -1568,10 +1508,10 @@ func (mr *MockStoreMockRecorder) SearchBoardsForUser(arg0, arg1, arg2, arg3 inte } // SearchBoardsForUserInTeam mocks base method. -func (m *MockStore) SearchBoardsForUserInTeam(arg0, arg1, arg2 string) ([]*model0.Board, error) { +func (m *MockStore) SearchBoardsForUserInTeam(arg0, arg1, arg2 string) ([]*model.Board, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "SearchBoardsForUserInTeam", arg0, arg1, arg2) - ret0, _ := ret[0].([]*model0.Board) + ret0, _ := ret[0].([]*model.Board) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -1583,10 +1523,10 @@ func (mr *MockStoreMockRecorder) SearchBoardsForUserInTeam(arg0, arg1, arg2 inte } // SearchUserChannels mocks base method. -func (m *MockStore) SearchUserChannels(arg0, arg1, arg2 string) ([]*model.Channel, error) { +func (m *MockStore) SearchUserChannels(arg0, arg1, arg2 string) ([]*model0.Channel, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "SearchUserChannels", arg0, arg1, arg2) - ret0, _ := ret[0].([]*model.Channel) + ret0, _ := ret[0].([]*model0.Channel) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -1598,10 +1538,10 @@ func (mr *MockStoreMockRecorder) SearchUserChannels(arg0, arg1, arg2 interface{} } // SearchUsersByTeam mocks base method. -func (m *MockStore) SearchUsersByTeam(arg0, arg1, arg2 string, arg3, arg4, arg5 bool) ([]*model0.User, error) { +func (m *MockStore) SearchUsersByTeam(arg0, arg1, arg2 string, arg3, arg4, arg5 bool) ([]*model.User, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "SearchUsersByTeam", arg0, arg1, arg2, arg3, arg4, arg5) - ret0, _ := ret[0].([]*model0.User) + ret0, _ := ret[0].([]*model.User) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -1712,7 +1652,7 @@ func (mr *MockStoreMockRecorder) UpdateCardLimitTimestamp(arg0 interface{}) *gom } // UpdateCategory mocks base method. -func (m *MockStore) UpdateCategory(arg0 model0.Category) error { +func (m *MockStore) UpdateCategory(arg0 model.Category) error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "UpdateCategory", arg0) ret0, _ := ret[0].(error) @@ -1726,7 +1666,7 @@ func (mr *MockStoreMockRecorder) UpdateCategory(arg0 interface{}) *gomock.Call { } // UpdateSession mocks base method. -func (m *MockStore) UpdateSession(arg0 *model0.Session) error { +func (m *MockStore) UpdateSession(arg0 *model.Session) error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "UpdateSession", arg0) ret0, _ := ret[0].(error) @@ -1754,10 +1694,10 @@ func (mr *MockStoreMockRecorder) UpdateSubscribersNotifiedAt(arg0, arg1 interfac } // UpdateUser mocks base method. -func (m *MockStore) UpdateUser(arg0 *model0.User) (*model0.User, error) { +func (m *MockStore) UpdateUser(arg0 *model.User) (*model.User, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "UpdateUser", arg0) - ret0, _ := ret[0].(*model0.User) + ret0, _ := ret[0].(*model.User) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -1797,10 +1737,10 @@ func (mr *MockStoreMockRecorder) UpdateUserPasswordByID(arg0, arg1 interface{}) } // UpsertNotificationHint mocks base method. -func (m *MockStore) UpsertNotificationHint(arg0 *model0.NotificationHint, arg1 time.Duration) (*model0.NotificationHint, error) { +func (m *MockStore) UpsertNotificationHint(arg0 *model.NotificationHint, arg1 time.Duration) (*model.NotificationHint, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "UpsertNotificationHint", arg0, arg1) - ret0, _ := ret[0].(*model0.NotificationHint) + ret0, _ := ret[0].(*model.NotificationHint) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -1812,7 +1752,7 @@ func (mr *MockStoreMockRecorder) UpsertNotificationHint(arg0, arg1 interface{}) } // UpsertSharing mocks base method. -func (m *MockStore) UpsertSharing(arg0 model0.Sharing) error { +func (m *MockStore) UpsertSharing(arg0 model.Sharing) error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "UpsertSharing", arg0) ret0, _ := ret[0].(error) @@ -1826,7 +1766,7 @@ func (mr *MockStoreMockRecorder) UpsertSharing(arg0 interface{}) *gomock.Call { } // UpsertTeamSettings mocks base method. -func (m *MockStore) UpsertTeamSettings(arg0 model0.Team) error { +func (m *MockStore) UpsertTeamSettings(arg0 model.Team) error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "UpsertTeamSettings", arg0) ret0, _ := ret[0].(error) @@ -1840,7 +1780,7 @@ func (mr *MockStoreMockRecorder) UpsertTeamSettings(arg0 interface{}) *gomock.Ca } // UpsertTeamSignupToken mocks base method. -func (m *MockStore) UpsertTeamSignupToken(arg0 model0.Team) error { +func (m *MockStore) UpsertTeamSignupToken(arg0 model.Team) error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "UpsertTeamSignupToken", arg0) ret0, _ := ret[0].(error) diff --git a/server/boards/services/store/sqlstore/blocks.go b/server/boards/services/store/sqlstore/blocks.go index 67318e6b25..2e960f918c 100644 --- a/server/boards/services/store/sqlstore/blocks.go +++ b/server/boards/services/store/sqlstore/blocks.go @@ -9,14 +9,14 @@ import ( "fmt" "strings" - "github.com/mattermost/mattermost-server/v6/server/boards/utils" + "github.com/mattermost/mattermost-server/server/v8/boards/utils" sq "github.com/Masterminds/squirrel" _ "github.com/lib/pq" // postgres driver - "github.com/mattermost/mattermost-server/v6/server/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/model" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) const ( @@ -105,23 +105,6 @@ func (s *SQLStore) getBlocks(db sq.BaseRunner, opts model.QueryBlocksOptions) ([ return s.blocksFromRows(rows) } -func (s *SQLStore) getBlocksWithParentAndType(db sq.BaseRunner, boardID, parentID string, blockType string) ([]*model.Block, error) { - opts := model.QueryBlocksOptions{ - BoardID: boardID, - ParentID: parentID, - BlockType: model.BlockType(blockType), - } - return s.getBlocks(db, opts) -} - -func (s *SQLStore) getBlocksWithParent(db sq.BaseRunner, boardID, parentID string) ([]*model.Block, error) { - opts := model.QueryBlocksOptions{ - BoardID: boardID, - ParentID: parentID, - } - return s.getBlocks(db, opts) -} - func (s *SQLStore) getBlocksByIDs(db sq.BaseRunner, ids []string) ([]*model.Block, error) { query := s.getQueryBuilder(db). Select(s.blockFields("")...). @@ -148,14 +131,6 @@ func (s *SQLStore) getBlocksByIDs(db sq.BaseRunner, ids []string) ([]*model.Bloc return blocks, nil } -func (s *SQLStore) getBlocksWithType(db sq.BaseRunner, boardID, blockType string) ([]*model.Block, error) { - opts := model.QueryBlocksOptions{ - BoardID: boardID, - BlockType: model.BlockType(blockType), - } - return s.getBlocks(db, opts) -} - // getSubTree2 returns blocks within 2 levels of the given blockID. func (s *SQLStore) getSubTree2(db sq.BaseRunner, boardID string, blockID string, opts model.QuerySubtreeOptions) ([]*model.Block, error) { query := s.getQueryBuilder(db). @@ -188,13 +163,6 @@ func (s *SQLStore) getSubTree2(db sq.BaseRunner, boardID string, blockID string, return s.blocksFromRows(rows) } -func (s *SQLStore) getBlocksForBoard(db sq.BaseRunner, boardID string) ([]*model.Block, error) { - opts := model.QueryBlocksOptions{ - BoardID: boardID, - } - return s.getBlocks(db, opts) -} - func (s *SQLStore) blocksFromRows(rows *sql.Rows) ([]*model.Block, error) { results := []*model.Block{} diff --git a/server/boards/services/store/sqlstore/board.go b/server/boards/services/store/sqlstore/board.go index 15ed9dfb6e..f9bbb1188a 100644 --- a/server/boards/services/store/sqlstore/board.go +++ b/server/boards/services/store/sqlstore/board.go @@ -12,13 +12,13 @@ import ( "strings" "time" - "github.com/mattermost/mattermost-server/v6/server/boards/utils" + "github.com/mattermost/mattermost-server/server/v8/boards/utils" sq "github.com/Masterminds/squirrel" - "github.com/mattermost/mattermost-server/v6/server/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/model" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) func boardFields(tableAlias string) []string { diff --git a/server/boards/services/store/sqlstore/board_insights.go b/server/boards/services/store/sqlstore/board_insights.go index 0e59b8b14c..03afbe2203 100644 --- a/server/boards/services/store/sqlstore/board_insights.go +++ b/server/boards/services/store/sqlstore/board_insights.go @@ -9,13 +9,13 @@ import ( "strings" "time" - "github.com/mattermost/mattermost-server/v6/server/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/model" sq "github.com/Masterminds/squirrel" - mm_model "github.com/mattermost/mattermost-server/v6/model" + mm_model "github.com/mattermost/mattermost-server/server/v8/model" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) func (s *SQLStore) getTeamBoardsInsights(db sq.BaseRunner, teamID string, since int64, offset int, limit int, boardIDs []string) (*model.BoardInsightsList, error) { diff --git a/server/boards/services/store/sqlstore/boards_and_blocks.go b/server/boards/services/store/sqlstore/boards_and_blocks.go index 23d8f5696c..8221470d94 100644 --- a/server/boards/services/store/sqlstore/boards_and_blocks.go +++ b/server/boards/services/store/sqlstore/boards_and_blocks.go @@ -8,7 +8,7 @@ import ( sq "github.com/Masterminds/squirrel" - "github.com/mattermost/mattermost-server/v6/server/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/model" ) type BlockDoesntBelongToBoardsErr struct { @@ -166,7 +166,7 @@ func (s *SQLStore) duplicateBoard(db sq.BaseRunner, boardID string, userID strin } bab.Boards = []*model.Board{board} - blocks, err := s.getBlocksForBoard(db, boardID) + blocks, err := s.getBlocks(db, model.QueryBlocksOptions{BoardID: boardID}) if err != nil { return nil, nil, err } diff --git a/server/boards/services/store/sqlstore/boards_migrator.go b/server/boards/services/store/sqlstore/boards_migrator.go index 79afeddc66..6e8a93dbef 100644 --- a/server/boards/services/store/sqlstore/boards_migrator.go +++ b/server/boards/services/store/sqlstore/boards_migrator.go @@ -18,11 +18,11 @@ import ( embedded "github.com/mattermost/morph/sources/embedded" "github.com/mgdelacroix/foundation" - "github.com/mattermost/mattermost-server/v6/server/channels/db" - mmSqlStore "github.com/mattermost/mattermost-server/v6/server/channels/store/sqlstore" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/db" + mmSqlStore "github.com/mattermost/mattermost-server/server/v8/channels/store/sqlstore" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" - "github.com/mattermost/mattermost-server/v6/server/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/model" ) var tablePrefix = "focalboard_" diff --git a/server/boards/services/store/sqlstore/category.go b/server/boards/services/store/sqlstore/category.go index 98a00d23b4..9df553bd1f 100644 --- a/server/boards/services/store/sqlstore/category.go +++ b/server/boards/services/store/sqlstore/category.go @@ -9,10 +9,10 @@ import ( sq "github.com/Masterminds/squirrel" - "github.com/mattermost/mattermost-server/v6/server/boards/model" - "github.com/mattermost/mattermost-server/v6/server/boards/utils" + "github.com/mattermost/mattermost-server/server/v8/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/utils" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) const categorySortOrderGap = 10 diff --git a/server/boards/services/store/sqlstore/category_boards.go b/server/boards/services/store/sqlstore/category_boards.go index 2b40b9998f..9009b6d242 100644 --- a/server/boards/services/store/sqlstore/category_boards.go +++ b/server/boards/services/store/sqlstore/category_boards.go @@ -9,10 +9,10 @@ import ( sq "github.com/Masterminds/squirrel" - "github.com/mattermost/mattermost-server/v6/server/boards/model" - "github.com/mattermost/mattermost-server/v6/server/boards/utils" + "github.com/mattermost/mattermost-server/server/v8/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/utils" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) func (s *SQLStore) getUserCategoryBoards(db sq.BaseRunner, userID, teamID string) ([]model.CategoryBoards, error) { diff --git a/server/boards/services/store/sqlstore/cloud.go b/server/boards/services/store/sqlstore/cloud.go index 729c69494f..054d71a8f5 100644 --- a/server/boards/services/store/sqlstore/cloud.go +++ b/server/boards/services/store/sqlstore/cloud.go @@ -10,8 +10,8 @@ import ( sq "github.com/Masterminds/squirrel" - "github.com/mattermost/mattermost-server/v6/server/boards/model" - "github.com/mattermost/mattermost-server/v6/server/boards/services/store" + "github.com/mattermost/mattermost-server/server/v8/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/services/store" ) var ErrInvalidCardLimitValue = errors.New("card limit value is invalid") diff --git a/server/boards/services/store/sqlstore/compliance.go b/server/boards/services/store/sqlstore/compliance.go index cd7c468e23..33618ae5ec 100644 --- a/server/boards/services/store/sqlstore/compliance.go +++ b/server/boards/services/store/sqlstore/compliance.go @@ -8,9 +8,9 @@ import ( sq "github.com/Masterminds/squirrel" - "github.com/mattermost/mattermost-server/v6/server/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/model" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) func (s *SQLStore) getBoardsForCompliance(db sq.BaseRunner, opts model.QueryBoardsForComplianceOptions) ([]*model.Board, bool, error) { diff --git a/server/boards/services/store/sqlstore/data_migrations.go b/server/boards/services/store/sqlstore/data_migrations.go index 8e18022319..46756dd412 100644 --- a/server/boards/services/store/sqlstore/data_migrations.go +++ b/server/boards/services/store/sqlstore/data_migrations.go @@ -12,10 +12,10 @@ import ( sq "github.com/Masterminds/squirrel" "github.com/wiggin77/merror" - "github.com/mattermost/mattermost-server/v6/server/boards/model" - "github.com/mattermost/mattermost-server/v6/server/boards/utils" + "github.com/mattermost/mattermost-server/server/v8/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/utils" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) const ( diff --git a/server/boards/services/store/sqlstore/data_migrations_test.go b/server/boards/services/store/sqlstore/data_migrations_test.go index 5a44f9ca2e..f2dad54228 100644 --- a/server/boards/services/store/sqlstore/data_migrations_test.go +++ b/server/boards/services/store/sqlstore/data_migrations_test.go @@ -7,10 +7,10 @@ import ( "testing" "time" - "github.com/mattermost/mattermost-server/v6/server/boards/services/store/sqlstore/migrationstests" + "github.com/mattermost/mattermost-server/server/v8/boards/services/store/sqlstore/migrationstests" "github.com/mgdelacroix/foundation" - "github.com/mattermost/mattermost-server/v6/server/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/model" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/server/boards/services/store/sqlstore/data_retention.go b/server/boards/services/store/sqlstore/data_retention.go index 3017cad048..414ad27275 100644 --- a/server/boards/services/store/sqlstore/data_retention.go +++ b/server/boards/services/store/sqlstore/data_retention.go @@ -12,9 +12,9 @@ import ( sq "github.com/Masterminds/squirrel" _ "github.com/lib/pq" // postgres driver - "github.com/mattermost/mattermost-server/v6/server/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/model" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) type RetentionTableDeletionInfo struct { diff --git a/server/boards/services/store/sqlstore/file.go b/server/boards/services/store/sqlstore/file.go index e8afc51e1d..abe3d98e48 100644 --- a/server/boards/services/store/sqlstore/file.go +++ b/server/boards/services/store/sqlstore/file.go @@ -9,10 +9,10 @@ import ( sq "github.com/Masterminds/squirrel" - "github.com/mattermost/mattermost-server/v6/server/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/model" - mm_model "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + mm_model "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) func (s *SQLStore) saveFileInfo(db sq.BaseRunner, fileInfo *mm_model.FileInfo) error { diff --git a/server/boards/services/store/sqlstore/legacy_blocks.go b/server/boards/services/store/sqlstore/legacy_blocks.go index 92714709ed..38609d6844 100644 --- a/server/boards/services/store/sqlstore/legacy_blocks.go +++ b/server/boards/services/store/sqlstore/legacy_blocks.go @@ -8,13 +8,13 @@ import ( "encoding/json" "strings" - "github.com/mattermost/mattermost-server/v6/server/boards/utils" + "github.com/mattermost/mattermost-server/server/v8/boards/utils" sq "github.com/Masterminds/squirrel" - "github.com/mattermost/mattermost-server/v6/server/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/model" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) func legacyBoardFields(prefix string) []string { diff --git a/server/boards/services/store/sqlstore/migrate.go b/server/boards/services/store/sqlstore/migrate.go index 08da7df19a..63b4665490 100644 --- a/server/boards/services/store/sqlstore/migrate.go +++ b/server/boards/services/store/sqlstore/migrate.go @@ -16,9 +16,9 @@ import ( sq "github.com/Masterminds/squirrel" - mm_model "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store/sqlstore" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/store/sqlstore" + mm_model "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" "github.com/mattermost/morph" drivers "github.com/mattermost/morph/drivers" @@ -28,7 +28,7 @@ import ( _ "github.com/lib/pq" // postgres driver - "github.com/mattermost/mattermost-server/v6/server/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/model" ) //go:embed migrations/*.sql @@ -70,7 +70,10 @@ func (s *SQLStore) getMigrationConnection() (*sql.DB, error) { } *settings.DriverName = s.dbType - db := sqlstore.SetupConnection("master", connectionString, &settings) + db, err := sqlstore.SetupConnection("master", connectionString, &settings, sqlstore.DBPingAttempts) + if err != nil { + return nil, err + } return db, nil } diff --git a/server/boards/services/store/sqlstore/migrationstests/deleted_membership_boards_migration_test.go b/server/boards/services/store/sqlstore/migrationstests/deleted_membership_boards_migration_test.go index a494c9e307..d55b3e704e 100644 --- a/server/boards/services/store/sqlstore/migrationstests/deleted_membership_boards_migration_test.go +++ b/server/boards/services/store/sqlstore/migrationstests/deleted_membership_boards_migration_test.go @@ -6,7 +6,7 @@ package migrationstests import ( "testing" - "github.com/mattermost/mattermost-server/v6/server/boards/services/store/sqlstore" + "github.com/mattermost/mattermost-server/server/v8/boards/services/store/sqlstore" "github.com/mgdelacroix/foundation" "github.com/stretchr/testify/require" ) diff --git a/server/boards/services/store/sqlstore/migrationstests/migrate_34_test.go b/server/boards/services/store/sqlstore/migrationstests/migrate_34_test.go index 9505df77e6..68ad2a04d2 100644 --- a/server/boards/services/store/sqlstore/migrationstests/migrate_34_test.go +++ b/server/boards/services/store/sqlstore/migrationstests/migrate_34_test.go @@ -6,7 +6,7 @@ package migrationstests import ( "testing" - "github.com/mattermost/mattermost-server/v6/server/boards/services/store/sqlstore" + "github.com/mattermost/mattermost-server/server/v8/boards/services/store/sqlstore" "github.com/mgdelacroix/foundation" "github.com/stretchr/testify/require" ) diff --git a/server/boards/services/store/sqlstore/migrationstests/migration35_test.go b/server/boards/services/store/sqlstore/migrationstests/migration35_test.go index ab0fbe4329..814e2b1734 100644 --- a/server/boards/services/store/sqlstore/migrationstests/migration35_test.go +++ b/server/boards/services/store/sqlstore/migrationstests/migration35_test.go @@ -6,7 +6,7 @@ package migrationstests import ( "testing" - "github.com/mattermost/mattermost-server/v6/server/boards/services/store/sqlstore" + "github.com/mattermost/mattermost-server/server/v8/boards/services/store/sqlstore" "github.com/mgdelacroix/foundation" ) diff --git a/server/boards/services/store/sqlstore/migrationstests/migration36_test.go b/server/boards/services/store/sqlstore/migrationstests/migration36_test.go index 409b521956..feedb2d8a6 100644 --- a/server/boards/services/store/sqlstore/migrationstests/migration36_test.go +++ b/server/boards/services/store/sqlstore/migrationstests/migration36_test.go @@ -6,7 +6,7 @@ package migrationstests import ( "testing" - "github.com/mattermost/mattermost-server/v6/server/boards/services/store/sqlstore" + "github.com/mattermost/mattermost-server/server/v8/boards/services/store/sqlstore" "github.com/mgdelacroix/foundation" "github.com/stretchr/testify/require" ) diff --git a/server/boards/services/store/sqlstore/migrationstests/migration37_test.go b/server/boards/services/store/sqlstore/migrationstests/migration37_test.go index 5bb35adf7d..1b9dd71a44 100644 --- a/server/boards/services/store/sqlstore/migrationstests/migration37_test.go +++ b/server/boards/services/store/sqlstore/migrationstests/migration37_test.go @@ -6,7 +6,7 @@ package migrationstests import ( "testing" - "github.com/mattermost/mattermost-server/v6/server/boards/services/store/sqlstore" + "github.com/mattermost/mattermost-server/server/v8/boards/services/store/sqlstore" "github.com/mgdelacroix/foundation" "github.com/stretchr/testify/require" ) diff --git a/server/boards/services/store/sqlstore/migrationstests/migration38_test.go b/server/boards/services/store/sqlstore/migrationstests/migration38_test.go index f76d9ae414..24b62866da 100644 --- a/server/boards/services/store/sqlstore/migrationstests/migration38_test.go +++ b/server/boards/services/store/sqlstore/migrationstests/migration38_test.go @@ -6,7 +6,7 @@ package migrationstests import ( "testing" - "github.com/mattermost/mattermost-server/v6/server/boards/services/store/sqlstore" + "github.com/mattermost/mattermost-server/server/v8/boards/services/store/sqlstore" "github.com/mgdelacroix/foundation" "github.com/stretchr/testify/require" ) diff --git a/server/boards/services/store/sqlstore/migrationstests/migration_18_test.go b/server/boards/services/store/sqlstore/migrationstests/migration_18_test.go index cd788cd4b2..5abbf31e91 100644 --- a/server/boards/services/store/sqlstore/migrationstests/migration_18_test.go +++ b/server/boards/services/store/sqlstore/migrationstests/migration_18_test.go @@ -7,7 +7,7 @@ import ( "encoding/json" "testing" - "github.com/mattermost/mattermost-server/v6/server/boards/services/store/sqlstore" + "github.com/mattermost/mattermost-server/server/v8/boards/services/store/sqlstore" "github.com/mgdelacroix/foundation" "github.com/stretchr/testify/require" ) diff --git a/server/boards/services/store/sqlstore/migrationstests/migration_28_test.go b/server/boards/services/store/sqlstore/migrationstests/migration_28_test.go index 651d401895..1b65ef5d54 100644 --- a/server/boards/services/store/sqlstore/migrationstests/migration_28_test.go +++ b/server/boards/services/store/sqlstore/migrationstests/migration_28_test.go @@ -6,7 +6,7 @@ package migrationstests import ( "testing" - "github.com/mattermost/mattermost-server/v6/server/boards/services/store/sqlstore" + "github.com/mattermost/mattermost-server/server/v8/boards/services/store/sqlstore" "github.com/mgdelacroix/foundation" "github.com/stretchr/testify/require" ) diff --git a/server/boards/services/store/sqlstore/migrationstests/migration_33_test.go b/server/boards/services/store/sqlstore/migrationstests/migration_33_test.go index 92f424635f..f0cbb51ece 100644 --- a/server/boards/services/store/sqlstore/migrationstests/migration_33_test.go +++ b/server/boards/services/store/sqlstore/migrationstests/migration_33_test.go @@ -9,7 +9,7 @@ import ( "github.com/mgdelacroix/foundation" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/server/boards/services/store/sqlstore" + "github.com/mattermost/mattermost-server/server/v8/boards/services/store/sqlstore" ) func Test33RemoveDeletedCategoryBoards(t *testing.T) { diff --git a/server/boards/services/store/sqlstore/notificationhints.go b/server/boards/services/store/sqlstore/notificationhints.go index d19c236c26..ce0337cd02 100644 --- a/server/boards/services/store/sqlstore/notificationhints.go +++ b/server/boards/services/store/sqlstore/notificationhints.go @@ -10,10 +10,10 @@ import ( sq "github.com/Masterminds/squirrel" - "github.com/mattermost/mattermost-server/v6/server/boards/model" - "github.com/mattermost/mattermost-server/v6/server/boards/utils" + "github.com/mattermost/mattermost-server/server/v8/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/utils" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) var notificationHintFields = []string{ diff --git a/server/boards/services/store/sqlstore/params.go b/server/boards/services/store/sqlstore/params.go index c75da0a9ed..f08e512eb0 100644 --- a/server/boards/services/store/sqlstore/params.go +++ b/server/boards/services/store/sqlstore/params.go @@ -7,9 +7,9 @@ import ( "database/sql" "fmt" - mm_model "github.com/mattermost/mattermost-server/v6/model" + mm_model "github.com/mattermost/mattermost-server/server/v8/model" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) // servicesAPI is the interface required my the Params to interact with the mattermost-server. diff --git a/server/boards/services/store/sqlstore/public_methods.go b/server/boards/services/store/sqlstore/public_methods.go index dca9d162bf..5947b283e7 100644 --- a/server/boards/services/store/sqlstore/public_methods.go +++ b/server/boards/services/store/sqlstore/public_methods.go @@ -16,10 +16,10 @@ import ( "context" "time" - "github.com/mattermost/mattermost-server/v6/server/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/model" - mm_model "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + mm_model "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) func (s *SQLStore) AddUpdateCategoryBoard(userID string, categoryID string, boardIDs []string) error { @@ -326,26 +326,6 @@ func (s *SQLStore) GetBlocksComplianceHistory(opts model.QueryBlocksComplianceHi } -func (s *SQLStore) GetBlocksForBoard(boardID string) ([]*model.Block, error) { - return s.getBlocksForBoard(s.db, boardID) - -} - -func (s *SQLStore) GetBlocksWithParent(boardID string, parentID string) ([]*model.Block, error) { - return s.getBlocksWithParent(s.db, boardID, parentID) - -} - -func (s *SQLStore) GetBlocksWithParentAndType(boardID string, parentID string, blockType string) ([]*model.Block, error) { - return s.getBlocksWithParentAndType(s.db, boardID, parentID, blockType) - -} - -func (s *SQLStore) GetBlocksWithType(boardID string, blockType string) ([]*model.Block, error) { - return s.getBlocksWithType(s.db, boardID, blockType) - -} - func (s *SQLStore) GetBoard(id string) (*model.Board, error) { return s.getBoard(s.db, id) diff --git a/server/boards/services/store/sqlstore/schema_table_migration.go b/server/boards/services/store/sqlstore/schema_table_migration.go index 663e5d5026..8ec5f154a9 100644 --- a/server/boards/services/store/sqlstore/schema_table_migration.go +++ b/server/boards/services/store/sqlstore/schema_table_migration.go @@ -12,9 +12,9 @@ import ( sq "github.com/Masterminds/squirrel" "github.com/mattermost/morph/models" - "github.com/mattermost/mattermost-server/v6/server/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/model" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) // EnsureSchemaMigrationFormat checks the schema migrations table @@ -126,7 +126,7 @@ func (s *SQLStore) isSchemaMigrationNeeded() (bool, error) { case model.MysqlDBType: query = query.Where(sq.Eq{"TABLE_SCHEMA": s.schemaName}) case model.PostgresDBType: - query = query.Where(sq.Eq{"TABLE_SCHEMA": "current_schema()"}) + query = query.Where("table_schema = current_schema()") } rows, err := query.Query() diff --git a/server/boards/services/store/sqlstore/session.go b/server/boards/services/store/sqlstore/session.go index 6abe4e987c..967eed002d 100644 --- a/server/boards/services/store/sqlstore/session.go +++ b/server/boards/services/store/sqlstore/session.go @@ -8,8 +8,8 @@ import ( sq "github.com/Masterminds/squirrel" - "github.com/mattermost/mattermost-server/v6/server/boards/model" - "github.com/mattermost/mattermost-server/v6/server/boards/utils" + "github.com/mattermost/mattermost-server/server/v8/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/utils" ) // GetActiveUserCount returns the number of users with active sessions within N seconds ago. diff --git a/server/boards/services/store/sqlstore/sharing.go b/server/boards/services/store/sqlstore/sharing.go index 9dc6176d72..2b7cd6faa7 100644 --- a/server/boards/services/store/sqlstore/sharing.go +++ b/server/boards/services/store/sqlstore/sharing.go @@ -4,8 +4,8 @@ package sqlstore import ( - "github.com/mattermost/mattermost-server/v6/server/boards/model" - "github.com/mattermost/mattermost-server/v6/server/boards/utils" + "github.com/mattermost/mattermost-server/server/v8/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/utils" sq "github.com/Masterminds/squirrel" ) diff --git a/server/boards/services/store/sqlstore/sqlstore.go b/server/boards/services/store/sqlstore/sqlstore.go index b98befc5a9..34be3d446d 100644 --- a/server/boards/services/store/sqlstore/sqlstore.go +++ b/server/boards/services/store/sqlstore/sqlstore.go @@ -11,11 +11,11 @@ import ( sq "github.com/Masterminds/squirrel" - "github.com/mattermost/mattermost-server/v6/server/boards/model" - "github.com/mattermost/mattermost-server/v6/server/boards/services/store" + "github.com/mattermost/mattermost-server/server/v8/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/services/store" - mm_model "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + mm_model "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) // SQLStore is a SQL database. @@ -199,6 +199,10 @@ func (s *SQLStore) DBVersion() string { return version } +// dropAllTables deletes the contents of all the database tables +// except the schema_migrations table with the intention of cleaning +// the state for the next text to execute without having to run the +// migrations. func (s *SQLStore) dropAllTables(db sq.BaseRunner) error { if s.DBType() == model.PostgresDBType { _, err := db.Exec(`DO diff --git a/server/boards/services/store/sqlstore/sqlstore_test.go b/server/boards/services/store/sqlstore/sqlstore_test.go index fe769a69ca..d0435f4c65 100644 --- a/server/boards/services/store/sqlstore/sqlstore_test.go +++ b/server/boards/services/store/sqlstore/sqlstore_test.go @@ -6,11 +6,11 @@ package sqlstore import ( "testing" - "github.com/mattermost/mattermost-server/v6/server/boards/services/store/storetests" + "github.com/mattermost/mattermost-server/server/v8/boards/services/store/storetests" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/server/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/model" ) func TestSQLStore(t *testing.T) { diff --git a/server/boards/services/store/sqlstore/subscriptions.go b/server/boards/services/store/sqlstore/subscriptions.go index a986cf11d5..5c7bfb93a5 100644 --- a/server/boards/services/store/sqlstore/subscriptions.go +++ b/server/boards/services/store/sqlstore/subscriptions.go @@ -9,9 +9,9 @@ import ( sq "github.com/Masterminds/squirrel" - "github.com/mattermost/mattermost-server/v6/server/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/model" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) var subscriptionFields = []string{ diff --git a/server/boards/services/store/sqlstore/system.go b/server/boards/services/store/sqlstore/system.go index e6b6172f45..140fdef5ec 100644 --- a/server/boards/services/store/sqlstore/system.go +++ b/server/boards/services/store/sqlstore/system.go @@ -6,7 +6,7 @@ package sqlstore import ( sq "github.com/Masterminds/squirrel" - "github.com/mattermost/mattermost-server/v6/server/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/model" ) func (s *SQLStore) getSystemSetting(db sq.BaseRunner, key string) (string, error) { diff --git a/server/boards/services/store/sqlstore/team.go b/server/boards/services/store/sqlstore/team.go index c917b224a8..15b4b292f0 100644 --- a/server/boards/services/store/sqlstore/team.go +++ b/server/boards/services/store/sqlstore/team.go @@ -7,10 +7,10 @@ import ( "database/sql" "encoding/json" - "github.com/mattermost/mattermost-server/v6/server/boards/model" - "github.com/mattermost/mattermost-server/v6/server/boards/utils" + "github.com/mattermost/mattermost-server/server/v8/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/utils" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" sq "github.com/Masterminds/squirrel" ) diff --git a/server/boards/services/store/sqlstore/templates.go b/server/boards/services/store/sqlstore/templates.go index d3febf9dd0..730071d0ee 100644 --- a/server/boards/services/store/sqlstore/templates.go +++ b/server/boards/services/store/sqlstore/templates.go @@ -9,9 +9,9 @@ import ( sq "github.com/Masterminds/squirrel" - "github.com/mattermost/mattermost-server/v6/server/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/model" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) var ( diff --git a/server/boards/services/store/sqlstore/testlib.go b/server/boards/services/store/sqlstore/testlib.go index a79b2a1643..4a7af3661d 100644 --- a/server/boards/services/store/sqlstore/testlib.go +++ b/server/boards/services/store/sqlstore/testlib.go @@ -9,10 +9,10 @@ import ( "os" "testing" - "github.com/mattermost/mattermost-server/v6/server/boards/model" - "github.com/mattermost/mattermost-server/v6/server/boards/services/store" - "github.com/mattermost/mattermost-server/v6/server/channels/store/storetest" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/services/store" + "github.com/mattermost/mattermost-server/server/v8/channels/store/storetest" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" "github.com/mgdelacroix/foundation" "github.com/stretchr/testify/require" ) diff --git a/server/boards/services/store/sqlstore/user.go b/server/boards/services/store/sqlstore/user.go index 5818b4ff6e..49113eb5af 100644 --- a/server/boards/services/store/sqlstore/user.go +++ b/server/boards/services/store/sqlstore/user.go @@ -8,15 +8,15 @@ import ( "errors" "fmt" - mm_model "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + mm_model "github.com/mattermost/mattermost-server/server/v8/model" sq "github.com/Masterminds/squirrel" - "github.com/mattermost/mattermost-server/v6/server/boards/model" - "github.com/mattermost/mattermost-server/v6/server/boards/utils" + "github.com/mattermost/mattermost-server/server/v8/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/utils" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) var ( diff --git a/server/boards/services/store/sqlstore/util.go b/server/boards/services/store/sqlstore/util.go index 0b9340d59c..2f9244f1fa 100644 --- a/server/boards/services/store/sqlstore/util.go +++ b/server/boards/services/store/sqlstore/util.go @@ -10,10 +10,10 @@ import ( sq "github.com/Masterminds/squirrel" - "github.com/mattermost/mattermost-server/v6/server/boards/model" - "github.com/mattermost/mattermost-server/v6/server/boards/utils" + "github.com/mattermost/mattermost-server/server/v8/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/utils" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) func (s *SQLStore) CloseRows(rows *sql.Rows) { diff --git a/server/boards/services/store/store.go b/server/boards/services/store/store.go index 5d4da0460b..d3e994d9e5 100644 --- a/server/boards/services/store/store.go +++ b/server/boards/services/store/store.go @@ -8,9 +8,9 @@ package store import ( "time" - "github.com/mattermost/mattermost-server/v6/server/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/model" - mm_model "github.com/mattermost/mattermost-server/v6/model" + mm_model "github.com/mattermost/mattermost-server/server/v8/model" ) const CardLimitTimestampSystemKey = "card_limit_timestamp" @@ -18,12 +18,8 @@ const CardLimitTimestampSystemKey = "card_limit_timestamp" // Store represents the abstraction of the data storage. type Store interface { GetBlocks(opts model.QueryBlocksOptions) ([]*model.Block, error) - GetBlocksWithParentAndType(boardID, parentID string, blockType string) ([]*model.Block, error) - GetBlocksWithParent(boardID, parentID string) ([]*model.Block, error) GetBlocksByIDs(ids []string) ([]*model.Block, error) - GetBlocksWithType(boardID, blockType string) ([]*model.Block, error) GetSubTree2(boardID, blockID string, opts model.QuerySubtreeOptions) ([]*model.Block, error) - GetBlocksForBoard(boardID string) ([]*model.Block, error) // @withTransaction InsertBlock(block *model.Block, userID string) error // @withTransaction diff --git a/server/boards/services/store/storetests/blocks.go b/server/boards/services/store/storetests/blocks.go index 85dbae606b..b3e48f560a 100644 --- a/server/boards/services/store/storetests/blocks.go +++ b/server/boards/services/store/storetests/blocks.go @@ -9,9 +9,9 @@ import ( "testing" "time" - "github.com/mattermost/mattermost-server/v6/server/boards/model" - "github.com/mattermost/mattermost-server/v6/server/boards/services/store" - "github.com/mattermost/mattermost-server/v6/server/boards/utils" + "github.com/mattermost/mattermost-server/server/v8/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/services/store" + "github.com/mattermost/mattermost-server/server/v8/boards/utils" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -69,7 +69,7 @@ func testInsertBlock(t *testing.T, store store.Store) { userID := testUserID boardID := testBoardID - blocks, errBlocks := store.GetBlocksForBoard(boardID) + blocks, errBlocks := store.GetBlocks(model.QueryBlocksOptions{BoardID: boardID}) require.NoError(t, errBlocks) initialCount := len(blocks) @@ -85,7 +85,7 @@ func testInsertBlock(t *testing.T, store store.Store) { err := store.InsertBlock(block, "user-id-1") require.NoError(t, err) - blocks, err := store.GetBlocksForBoard(boardID) + blocks, err := store.GetBlocks(model.QueryBlocksOptions{BoardID: boardID}) require.NoError(t, err) require.Len(t, blocks, initialCount+1) @@ -105,7 +105,7 @@ func testInsertBlock(t *testing.T, store store.Store) { err := store.InsertBlock(block, "user-id-1") require.Error(t, err) - blocks, err := store.GetBlocksForBoard(boardID) + blocks, err := store.GetBlocks(model.QueryBlocksOptions{BoardID: boardID}) require.NoError(t, err) require.Len(t, blocks, initialCount+1) }) @@ -121,7 +121,7 @@ func testInsertBlock(t *testing.T, store store.Store) { err := store.InsertBlock(block, "user-id-1") require.Error(t, err) - blocks, err := store.GetBlocksForBoard(boardID) + blocks, err := store.GetBlocks(model.QueryBlocksOptions{BoardID: boardID}) require.NoError(t, err) require.Len(t, blocks, initialCount+1) }) @@ -204,7 +204,7 @@ func testInsertBlock(t *testing.T, store store.Store) { func testInsertBlocks(t *testing.T, store store.Store) { userID := testUserID - blocks, errBlocks := store.GetBlocksForBoard("id-test") + blocks, errBlocks := store.GetBlocks(model.QueryBlocksOptions{BoardID: "id-test"}) require.NoError(t, errBlocks) initialCount := len(blocks) @@ -227,7 +227,7 @@ func testInsertBlocks(t *testing.T, store store.Store) { err := store.InsertBlocks(newBlocks, "user-id-1") require.Error(t, err) - blocks, err := store.GetBlocksForBoard("id-test") + blocks, err := store.GetBlocks(model.QueryBlocksOptions{BoardID: "id-test"}) require.NoError(t, err) // no blocks should have been inserted require.Len(t, blocks, initialCount) @@ -249,7 +249,7 @@ func testPatchBlock(t *testing.T, store store.Store) { err := store.InsertBlock(block, "user-id-1") require.NoError(t, err) - blocks, errBlocks := store.GetBlocksForBoard(boardID) + blocks, errBlocks := store.GetBlocks(model.QueryBlocksOptions{BoardID: boardID}) require.NoError(t, errBlocks) initialCount := len(blocks) @@ -259,7 +259,7 @@ func testPatchBlock(t *testing.T, store store.Store) { require.ErrorAs(t, err, &nf) require.True(t, model.IsErrNotFound(err)) - blocks, err := store.GetBlocksForBoard(boardID) + blocks, err := store.GetBlocks(model.QueryBlocksOptions{BoardID: boardID}) require.NoError(t, err) require.Len(t, blocks, initialCount) }) @@ -272,7 +272,7 @@ func testPatchBlock(t *testing.T, store store.Store) { err := store.PatchBlock("id-test", blockPatch, "user-id-1") require.Error(t, err) - blocks, err := store.GetBlocksForBoard(boardID) + blocks, err := store.GetBlocks(model.QueryBlocksOptions{BoardID: boardID}) require.NoError(t, err) require.Len(t, blocks, initialCount) }) @@ -452,7 +452,7 @@ var ( func testGetSubTree2(t *testing.T, store store.Store) { boardID := testBoardID - blocks, err := store.GetBlocksForBoard(boardID) + blocks, err := store.GetBlocks(model.QueryBlocksOptions{BoardID: boardID}) require.NoError(t, err) initialCount := len(blocks) @@ -460,7 +460,7 @@ func testGetSubTree2(t *testing.T, store store.Store) { time.Sleep(1 * time.Millisecond) defer DeleteBlocks(t, store, subtreeSampleBlocks, "test") - blocks, err = store.GetBlocksForBoard(boardID) + blocks, err = store.GetBlocks(model.QueryBlocksOptions{BoardID: boardID}) require.NoError(t, err) require.Len(t, blocks, initialCount+6) @@ -492,7 +492,7 @@ func testDeleteBlock(t *testing.T, store store.Store) { userID := testUserID boardID := testBoardID - blocks, err := store.GetBlocksForBoard(boardID) + blocks, err := store.GetBlocks(model.QueryBlocksOptions{BoardID: boardID}) require.NoError(t, err) initialCount := len(blocks) @@ -516,7 +516,7 @@ func testDeleteBlock(t *testing.T, store store.Store) { InsertBlocks(t, store, blocksToInsert, "user-id-1") defer DeleteBlocks(t, store, blocksToInsert, "test") - blocks, err = store.GetBlocksForBoard(boardID) + blocks, err = store.GetBlocks(model.QueryBlocksOptions{BoardID: boardID}) require.NoError(t, err) require.Len(t, blocks, initialCount+3) @@ -550,7 +550,7 @@ func testUndeleteBlock(t *testing.T, store store.Store) { boardID := testBoardID userID := testUserID - blocks, err := store.GetBlocksForBoard(boardID) + blocks, err := store.GetBlocks(model.QueryBlocksOptions{BoardID: boardID}) require.NoError(t, err) initialCount := len(blocks) @@ -574,7 +574,7 @@ func testUndeleteBlock(t *testing.T, store store.Store) { InsertBlocks(t, store, blocksToInsert, "user-id-1") defer DeleteBlocks(t, store, blocksToInsert, "test") - blocks, err = store.GetBlocksForBoard(boardID) + blocks, err = store.GetBlocks(model.QueryBlocksOptions{BoardID: boardID}) require.NoError(t, err) require.Len(t, blocks, initialCount+3) @@ -643,7 +643,7 @@ func testUndeleteBlock(t *testing.T, store store.Store) { func testGetBlocks(t *testing.T, store store.Store) { boardID := testBoardID - blocks, err := store.GetBlocksForBoard(boardID) + blocks, err := store.GetBlocks(model.QueryBlocksOptions{BoardID: boardID}) require.NoError(t, err) blocksToInsert := []*model.Block{ @@ -686,65 +686,74 @@ func testGetBlocks(t *testing.T, store store.Store) { InsertBlocks(t, store, blocksToInsert, "user-id-1") defer DeleteBlocks(t, store, blocksToInsert, "test") - t.Run("not existing parent", func(t *testing.T) { + t.Run("not existing parent with type", func(t *testing.T) { time.Sleep(1 * time.Millisecond) - blocks, err = store.GetBlocksWithParentAndType(boardID, "not-exists", "test") + opts := model.QueryBlocksOptions{BoardID: boardID, ParentID: "not-exists", BlockType: model.BlockType("test")} + blocks, err = store.GetBlocks(opts) require.NoError(t, err) require.Empty(t, blocks) }) - t.Run("not existing type", func(t *testing.T) { + t.Run("not existing type with parent", func(t *testing.T) { time.Sleep(1 * time.Millisecond) - blocks, err = store.GetBlocksWithParentAndType(boardID, "block1", "not-existing") + opts := model.QueryBlocksOptions{BoardID: boardID, ParentID: "block1", BlockType: model.BlockType("not-existing")} + blocks, err = store.GetBlocks(opts) require.NoError(t, err) require.Empty(t, blocks) }) t.Run("valid parent and type", func(t *testing.T) { time.Sleep(1 * time.Millisecond) - blocks, err = store.GetBlocksWithParentAndType(boardID, "block1", "test") + opts := model.QueryBlocksOptions{BoardID: boardID, ParentID: "block1", BlockType: model.BlockType("test")} + blocks, err = store.GetBlocks(opts) require.NoError(t, err) require.Len(t, blocks, 2) }) t.Run("not existing parent", func(t *testing.T) { time.Sleep(1 * time.Millisecond) - blocks, err = store.GetBlocksWithParent(boardID, "not-exists") + opts := model.QueryBlocksOptions{BoardID: boardID, ParentID: "not-exists"} + blocks, err = store.GetBlocks(opts) require.NoError(t, err) require.Empty(t, blocks) }) t.Run("valid parent", func(t *testing.T) { time.Sleep(1 * time.Millisecond) - blocks, err = store.GetBlocksWithParent(boardID, "block1") + opts := model.QueryBlocksOptions{BoardID: boardID, ParentID: "block1"} + blocks, err = store.GetBlocks(opts) require.NoError(t, err) require.Len(t, blocks, 3) }) t.Run("not existing type", func(t *testing.T) { time.Sleep(1 * time.Millisecond) - blocks, err = store.GetBlocksWithType(boardID, "not-exists") + opts := model.QueryBlocksOptions{BoardID: boardID, BlockType: model.BlockType("not-exists")} + blocks, err = store.GetBlocks(opts) require.NoError(t, err) require.Empty(t, blocks) }) t.Run("valid type", func(t *testing.T) { time.Sleep(1 * time.Millisecond) - blocks, err = store.GetBlocksWithType(boardID, "test") + opts := model.QueryBlocksOptions{BoardID: boardID, BlockType: model.BlockType("test")} + blocks, err = store.GetBlocks(opts) require.NoError(t, err) require.Len(t, blocks, 4) }) t.Run("not existing board", func(t *testing.T) { time.Sleep(1 * time.Millisecond) - blocks, err = store.GetBlocksForBoard("not-exists") + opts := model.QueryBlocksOptions{BoardID: "not-exists"} + blocks, err = store.GetBlocks(opts) require.NoError(t, err) require.Empty(t, blocks) }) t.Run("all blocks of the a board", func(t *testing.T) { time.Sleep(1 * time.Millisecond) - blocks, err = store.GetBlocksForBoard(boardID) + opts := model.QueryBlocksOptions{BoardID: boardID} + blocks, err = store.GetBlocks(opts) require.NoError(t, err) require.Len(t, blocks, 5) }) @@ -863,7 +872,7 @@ func testDuplicateBlock(t *testing.T, store store.Store) { func testGetBlockMetadata(t *testing.T, store store.Store) { boardID := testBoardID - blocks, err := store.GetBlocksForBoard(boardID) + blocks, err := store.GetBlocks(model.QueryBlocksOptions{BoardID: boardID}) require.NoError(t, err) blocksToInsert := []*model.Block{ @@ -1082,12 +1091,20 @@ func testUndeleteBlockChildren(t *testing.T, store store.Store) { require.Nil(t, block) // ensure the card children were deleted - blocks, err := store.GetBlocksWithParentAndType(cardDelete.BoardID, cardDelete.ID, model.TypeText) + blocks, err := store.GetBlocks(model.QueryBlocksOptions{ + BoardID: cardDelete.BoardID, + ParentID: cardDelete.ID, + BlockType: model.TypeText}, + ) require.NoError(t, err) assert.Empty(t, blocks) // ensure the other card children remain. - blocks, err = store.GetBlocksWithParentAndType(cardKeep.BoardID, cardKeep.ID, model.TypeText) + blocks, err = store.GetBlocks(model.QueryBlocksOptions{ + BoardID: cardKeep.BoardID, + ParentID: cardKeep.ID, + BlockType: model.TypeText}, + ) require.NoError(t, err) assert.Len(t, blocks, len(blocksKeep)) @@ -1101,7 +1118,11 @@ func testUndeleteBlockChildren(t *testing.T, store store.Store) { require.NotNil(t, block) // ensure the card children were restored - blocks, err = store.GetBlocksWithParentAndType(cardDelete.BoardID, cardDelete.ID, model.TypeText) + blocks, err = store.GetBlocks(model.QueryBlocksOptions{ + BoardID: cardDelete.BoardID, + ParentID: cardDelete.ID, + BlockType: model.TypeText}, + ) require.NoError(t, err) assert.Len(t, blocks, len(blocksDelete)) }) @@ -1117,12 +1138,12 @@ func testUndeleteBlockChildren(t *testing.T, store store.Store) { require.Nil(t, board) // ensure all cards and blocks for the board were deleted - blocks, err := store.GetBlocksForBoard(boardDelete.ID) + blocks, err := store.GetBlocks(model.QueryBlocksOptions{BoardID: boardDelete.ID}) require.NoError(t, err) assert.Empty(t, blocks) // ensure the other board's cards and blocks remain. - blocks, err = store.GetBlocksForBoard(boardKeep.ID) + blocks, err = store.GetBlocks(model.QueryBlocksOptions{BoardID: boardKeep.ID}) require.NoError(t, err) assert.Len(t, blocks, len(blocksKeep)+len(cardsKeep)) @@ -1136,7 +1157,7 @@ func testUndeleteBlockChildren(t *testing.T, store store.Store) { require.NotNil(t, board) // ensure the board's cards and blocks were restored. - blocks, err = store.GetBlocksForBoard(boardDelete.ID) + blocks, err = store.GetBlocks(model.QueryBlocksOptions{BoardID: boardDelete.ID}) require.NoError(t, err) assert.Len(t, blocks, len(blocksDelete)+len(cardsDelete)) }) diff --git a/server/boards/services/store/storetests/board_insights.go b/server/boards/services/store/storetests/board_insights.go index 304c57183b..0268178db4 100644 --- a/server/boards/services/store/storetests/board_insights.go +++ b/server/boards/services/store/storetests/board_insights.go @@ -9,8 +9,8 @@ import ( "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/server/boards/model" - "github.com/mattermost/mattermost-server/v6/server/boards/services/store" + "github.com/mattermost/mattermost-server/server/v8/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/services/store" ) const ( diff --git a/server/boards/services/store/storetests/boards.go b/server/boards/services/store/storetests/boards.go index 7e47e0dbeb..84bae5097d 100644 --- a/server/boards/services/store/storetests/boards.go +++ b/server/boards/services/store/storetests/boards.go @@ -7,9 +7,9 @@ import ( "testing" "time" - "github.com/mattermost/mattermost-server/v6/server/boards/model" - "github.com/mattermost/mattermost-server/v6/server/boards/services/store" - "github.com/mattermost/mattermost-server/v6/server/boards/utils" + "github.com/mattermost/mattermost-server/server/v8/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/services/store" + "github.com/mattermost/mattermost-server/server/v8/boards/utils" "github.com/stretchr/testify/require" ) diff --git a/server/boards/services/store/storetests/boards_and_blocks.go b/server/boards/services/store/storetests/boards_and_blocks.go index 1b58fc39b6..36be017610 100644 --- a/server/boards/services/store/storetests/boards_and_blocks.go +++ b/server/boards/services/store/storetests/boards_and_blocks.go @@ -8,9 +8,9 @@ import ( "testing" "time" - "github.com/mattermost/mattermost-server/v6/server/boards/model" - "github.com/mattermost/mattermost-server/v6/server/boards/services/store" - "github.com/mattermost/mattermost-server/v6/server/boards/utils" + "github.com/mattermost/mattermost-server/server/v8/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/services/store" + "github.com/mattermost/mattermost-server/server/v8/boards/utils" "github.com/stretchr/testify/require" ) diff --git a/server/boards/services/store/storetests/category.go b/server/boards/services/store/storetests/category.go index 2e1a849cd8..c7afabe2c4 100644 --- a/server/boards/services/store/storetests/category.go +++ b/server/boards/services/store/storetests/category.go @@ -8,9 +8,9 @@ import ( "github.com/stretchr/testify/assert" - "github.com/mattermost/mattermost-server/v6/server/boards/model" - "github.com/mattermost/mattermost-server/v6/server/boards/services/store" - "github.com/mattermost/mattermost-server/v6/server/boards/utils" + "github.com/mattermost/mattermost-server/server/v8/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/services/store" + "github.com/mattermost/mattermost-server/server/v8/boards/utils" ) type testFunc func(t *testing.T, store store.Store) diff --git a/server/boards/services/store/storetests/categoryBoards.go b/server/boards/services/store/storetests/categoryBoards.go index 5f77d461ec..a3552fb058 100644 --- a/server/boards/services/store/storetests/categoryBoards.go +++ b/server/boards/services/store/storetests/categoryBoards.go @@ -8,9 +8,9 @@ import ( "github.com/stretchr/testify/assert" - "github.com/mattermost/mattermost-server/v6/server/boards/model" - "github.com/mattermost/mattermost-server/v6/server/boards/services/store" - "github.com/mattermost/mattermost-server/v6/server/boards/utils" + "github.com/mattermost/mattermost-server/server/v8/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/services/store" + "github.com/mattermost/mattermost-server/server/v8/boards/utils" ) func StoreTestCategoryBoardsStore(t *testing.T, runStoreTests func(*testing.T, func(*testing.T, store.Store))) { diff --git a/server/boards/services/store/storetests/cloud.go b/server/boards/services/store/storetests/cloud.go index d29e53f7b3..792f852a17 100644 --- a/server/boards/services/store/storetests/cloud.go +++ b/server/boards/services/store/storetests/cloud.go @@ -9,10 +9,10 @@ import ( "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/server/boards/model" - "github.com/mattermost/mattermost-server/v6/server/boards/services/store" - storeservice "github.com/mattermost/mattermost-server/v6/server/boards/services/store" - "github.com/mattermost/mattermost-server/v6/server/boards/utils" + "github.com/mattermost/mattermost-server/server/v8/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/services/store" + storeservice "github.com/mattermost/mattermost-server/server/v8/boards/services/store" + "github.com/mattermost/mattermost-server/server/v8/boards/utils" ) func StoreTestCloudStore(t *testing.T, runStoreTests func(*testing.T, func(*testing.T, store.Store))) { diff --git a/server/boards/services/store/storetests/compliance.go b/server/boards/services/store/storetests/compliance.go index 4818aab0a9..1964b6257d 100644 --- a/server/boards/services/store/storetests/compliance.go +++ b/server/boards/services/store/storetests/compliance.go @@ -10,9 +10,9 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/server/boards/model" - "github.com/mattermost/mattermost-server/v6/server/boards/services/store" - "github.com/mattermost/mattermost-server/v6/server/boards/utils" + "github.com/mattermost/mattermost-server/server/v8/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/services/store" + "github.com/mattermost/mattermost-server/server/v8/boards/utils" ) func StoreTestComplianceHistoryStore(t *testing.T, runStoreTests func(*testing.T, func(*testing.T, store.Store))) { diff --git a/server/boards/services/store/storetests/data_retention.go b/server/boards/services/store/storetests/data_retention.go index 83901845ed..df8ed9a028 100644 --- a/server/boards/services/store/storetests/data_retention.go +++ b/server/boards/services/store/storetests/data_retention.go @@ -6,9 +6,9 @@ import ( "testing" "time" - "github.com/mattermost/mattermost-server/v6/server/boards/model" - "github.com/mattermost/mattermost-server/v6/server/boards/services/store" - "github.com/mattermost/mattermost-server/v6/server/boards/utils" + "github.com/mattermost/mattermost-server/server/v8/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/services/store" + "github.com/mattermost/mattermost-server/server/v8/boards/utils" "github.com/stretchr/testify/require" ) @@ -98,7 +98,7 @@ func LoadData(t *testing.T, store store.Store) { func testRunDataRetention(t *testing.T, store store.Store, batchSize int) { LoadData(t, store) - blocks, err := store.GetBlocksForBoard(boardID) + blocks, err := store.GetBlocks(model.QueryBlocksOptions{BoardID: boardID}) require.NoError(t, err) require.Len(t, blocks, 4) initialCount := len(blocks) @@ -115,7 +115,7 @@ func testRunDataRetention(t *testing.T, store store.Store, batchSize int) { require.True(t, deletions > int64(initialCount)) // expect all blocks to be deleted. - blocks, errBlocks := store.GetBlocksForBoard(boardID) + blocks, errBlocks := store.GetBlocks(model.QueryBlocksOptions{BoardID: boardID}) require.NoError(t, errBlocks) require.Equal(t, 0, len(blocks)) diff --git a/server/boards/services/store/storetests/files.go b/server/boards/services/store/storetests/files.go index 9915f76467..52aa98954a 100644 --- a/server/boards/services/store/storetests/files.go +++ b/server/boards/services/store/storetests/files.go @@ -6,10 +6,10 @@ package storetests import ( "testing" - mm_model "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/boards/model" - "github.com/mattermost/mattermost-server/v6/server/boards/services/store" - "github.com/mattermost/mattermost-server/v6/server/boards/utils" + "github.com/mattermost/mattermost-server/server/v8/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/services/store" + "github.com/mattermost/mattermost-server/server/v8/boards/utils" + mm_model "github.com/mattermost/mattermost-server/server/v8/model" "github.com/stretchr/testify/require" ) diff --git a/server/boards/services/store/storetests/helpers.go b/server/boards/services/store/storetests/helpers.go index ec85d0c777..b7e85ca551 100644 --- a/server/boards/services/store/storetests/helpers.go +++ b/server/boards/services/store/storetests/helpers.go @@ -8,8 +8,8 @@ import ( "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/server/boards/model" - "github.com/mattermost/mattermost-server/v6/server/boards/services/store" + "github.com/mattermost/mattermost-server/server/v8/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/services/store" ) func InsertBlocks(t *testing.T, s store.Store, blocks []*model.Block, userID string) { diff --git a/server/boards/services/store/storetests/notificationhints.go b/server/boards/services/store/storetests/notificationhints.go index e07d1f2429..07a31136bd 100644 --- a/server/boards/services/store/storetests/notificationhints.go +++ b/server/boards/services/store/storetests/notificationhints.go @@ -10,9 +10,9 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/server/boards/model" - "github.com/mattermost/mattermost-server/v6/server/boards/services/store" - "github.com/mattermost/mattermost-server/v6/server/boards/utils" + "github.com/mattermost/mattermost-server/server/v8/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/services/store" + "github.com/mattermost/mattermost-server/server/v8/boards/utils" ) func StoreTestNotificationHintsStore(t *testing.T, runStoreTests func(*testing.T, func(*testing.T, store.Store))) { diff --git a/server/boards/services/store/storetests/session.go b/server/boards/services/store/storetests/session.go index 73876712b8..b15a71718d 100644 --- a/server/boards/services/store/storetests/session.go +++ b/server/boards/services/store/storetests/session.go @@ -10,8 +10,8 @@ import ( "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/server/boards/model" - "github.com/mattermost/mattermost-server/v6/server/boards/services/store" + "github.com/mattermost/mattermost-server/server/v8/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/services/store" ) func StoreTestSessionStore(t *testing.T, runStoreTests func(*testing.T, func(*testing.T, store.Store))) { diff --git a/server/boards/services/store/storetests/sharing.go b/server/boards/services/store/storetests/sharing.go index 94740df6eb..1bd492c5f8 100644 --- a/server/boards/services/store/storetests/sharing.go +++ b/server/boards/services/store/storetests/sharing.go @@ -8,8 +8,8 @@ import ( "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/server/boards/model" - "github.com/mattermost/mattermost-server/v6/server/boards/services/store" + "github.com/mattermost/mattermost-server/server/v8/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/services/store" ) func StoreTestSharingStore(t *testing.T, runStoreTests func(*testing.T, func(*testing.T, store.Store))) { diff --git a/server/boards/services/store/storetests/subscriptions.go b/server/boards/services/store/storetests/subscriptions.go index f21b72217f..833bcd4ca0 100644 --- a/server/boards/services/store/storetests/subscriptions.go +++ b/server/boards/services/store/storetests/subscriptions.go @@ -9,8 +9,8 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/server/boards/model" - "github.com/mattermost/mattermost-server/v6/server/boards/services/store" + "github.com/mattermost/mattermost-server/server/v8/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/services/store" ) //nolint:dupl diff --git a/server/boards/services/store/storetests/system.go b/server/boards/services/store/storetests/system.go index f3c16be6a4..2f0014bc78 100644 --- a/server/boards/services/store/storetests/system.go +++ b/server/boards/services/store/storetests/system.go @@ -8,7 +8,7 @@ import ( "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/server/boards/services/store" + "github.com/mattermost/mattermost-server/server/v8/boards/services/store" ) func StoreTestSystemStore(t *testing.T, runStoreTests func(*testing.T, func(*testing.T, store.Store))) { diff --git a/server/boards/services/store/storetests/teams.go b/server/boards/services/store/storetests/teams.go index e3642f4f38..e2997c5008 100644 --- a/server/boards/services/store/storetests/teams.go +++ b/server/boards/services/store/storetests/teams.go @@ -6,14 +6,14 @@ package storetests import ( "fmt" - "github.com/mattermost/mattermost-server/v6/server/boards/model" - "github.com/mattermost/mattermost-server/v6/server/boards/utils" + "github.com/mattermost/mattermost-server/server/v8/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/utils" "testing" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/server/boards/services/store" + "github.com/mattermost/mattermost-server/server/v8/boards/services/store" ) func StoreTestTeamStore(t *testing.T, runStoreTests func(*testing.T, func(*testing.T, store.Store))) { diff --git a/server/boards/services/store/storetests/users.go b/server/boards/services/store/storetests/users.go index 7fbe9ac032..73ff54ddbb 100644 --- a/server/boards/services/store/storetests/users.go +++ b/server/boards/services/store/storetests/users.go @@ -10,9 +10,9 @@ import ( "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/server/boards/model" - "github.com/mattermost/mattermost-server/v6/server/boards/services/store" - "github.com/mattermost/mattermost-server/v6/server/boards/utils" + "github.com/mattermost/mattermost-server/server/v8/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/services/store" + "github.com/mattermost/mattermost-server/server/v8/boards/utils" ) //nolint:dupl diff --git a/server/boards/services/store/storetests/util.go b/server/boards/services/store/storetests/util.go index ba8c4fd14e..976e60448e 100644 --- a/server/boards/services/store/storetests/util.go +++ b/server/boards/services/store/storetests/util.go @@ -11,9 +11,9 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/server/boards/model" - "github.com/mattermost/mattermost-server/v6/server/boards/services/store" - "github.com/mattermost/mattermost-server/v6/server/boards/utils" + "github.com/mattermost/mattermost-server/server/v8/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/services/store" + "github.com/mattermost/mattermost-server/server/v8/boards/utils" ) func createTestUsers(t *testing.T, store store.Store, num int) []*model.User { diff --git a/server/boards/services/telemetry/mocks/ServerIface.go b/server/boards/services/telemetry/mocks/ServerIface.go index 3b237f22c0..54a00ab2a5 100644 --- a/server/boards/services/telemetry/mocks/ServerIface.go +++ b/server/boards/services/telemetry/mocks/ServerIface.go @@ -5,12 +5,12 @@ package mocks import ( - httpservice "github.com/mattermost/mattermost-server/v6/server/platform/services/httpservice" + httpservice "github.com/mattermost/mattermost-server/server/v8/platform/services/httpservice" mock "github.com/stretchr/testify/mock" - model "github.com/mattermost/mattermost-server/v6/model" + model "github.com/mattermost/mattermost-server/server/v8/model" - plugin "github.com/mattermost/mattermost-server/v6/plugin" + plugin "github.com/mattermost/mattermost-server/server/v8/plugin" ) // ServerIface is an autogenerated mock type for the ServerIface type diff --git a/server/boards/services/telemetry/telemetry.go b/server/boards/services/telemetry/telemetry.go index 9719f76f78..256bde2bf6 100644 --- a/server/boards/services/telemetry/telemetry.go +++ b/server/boards/services/telemetry/telemetry.go @@ -10,10 +10,10 @@ import ( rudder "github.com/rudderlabs/analytics-go" - "github.com/mattermost/mattermost-server/v6/server/boards/services/scheduler" + "github.com/mattermost/mattermost-server/server/v8/boards/services/scheduler" - "github.com/mattermost/mattermost-server/v6/server/channels/utils" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/utils" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) const ( diff --git a/server/boards/services/telemetry/telemetry_test.go b/server/boards/services/telemetry/telemetry_test.go index f84a95affd..ec78a0587a 100644 --- a/server/boards/services/telemetry/telemetry_test.go +++ b/server/boards/services/telemetry/telemetry_test.go @@ -16,7 +16,7 @@ import ( "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) func mockServer() (chan []byte, *httptest.Server) { diff --git a/server/boards/services/webhook/webhook.go b/server/boards/services/webhook/webhook.go index 4fbcc14bde..98c70f5ce6 100644 --- a/server/boards/services/webhook/webhook.go +++ b/server/boards/services/webhook/webhook.go @@ -9,10 +9,10 @@ import ( "io" "net/http" - "github.com/mattermost/mattermost-server/v6/server/boards/model" - "github.com/mattermost/mattermost-server/v6/server/boards/services/config" + "github.com/mattermost/mattermost-server/server/v8/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/services/config" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) // NotifyUpdate calls webhooks. diff --git a/server/boards/services/webhook/webhook_test.go b/server/boards/services/webhook/webhook_test.go index 60ccfad744..9d7c41ec1c 100644 --- a/server/boards/services/webhook/webhook_test.go +++ b/server/boards/services/webhook/webhook_test.go @@ -10,10 +10,10 @@ import ( "github.com/stretchr/testify/assert" - "github.com/mattermost/mattermost-server/v6/server/boards/model" - "github.com/mattermost/mattermost-server/v6/server/boards/services/config" + "github.com/mattermost/mattermost-server/server/v8/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/services/config" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) func TestClientUpdateNotify(t *testing.T) { diff --git a/server/boards/utils/callbackqueue.go b/server/boards/utils/callbackqueue.go index 87772e18c4..cd1923bad2 100644 --- a/server/boards/utils/callbackqueue.go +++ b/server/boards/utils/callbackqueue.go @@ -9,7 +9,7 @@ import ( "sync/atomic" "time" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) // CallbackFunc is a func that can enqueued in the callback queue and will be diff --git a/server/boards/utils/callbackqueue_test.go b/server/boards/utils/callbackqueue_test.go index 2eaf16a3c2..5328fda269 100644 --- a/server/boards/utils/callbackqueue_test.go +++ b/server/boards/utils/callbackqueue_test.go @@ -11,7 +11,7 @@ import ( "github.com/stretchr/testify/assert" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) func Test_newChangeNotifier(t *testing.T) { diff --git a/server/boards/utils/utils.go b/server/boards/utils/utils.go index d9b2f4e2e3..a8220e4f62 100644 --- a/server/boards/utils/utils.go +++ b/server/boards/utils/utils.go @@ -9,7 +9,7 @@ import ( "reflect" "time" - mm_model "github.com/mattermost/mattermost-server/v6/model" + mm_model "github.com/mattermost/mattermost-server/server/v8/model" ) type IDType byte diff --git a/server/boards/web/webserver.go b/server/boards/web/webserver.go index 1b5594eb3f..457767a559 100644 --- a/server/boards/web/webserver.go +++ b/server/boards/web/webserver.go @@ -16,7 +16,7 @@ import ( "github.com/gorilla/mux" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) // RoutedService defines the interface that is needed for any service to diff --git a/server/boards/web/webserver_test.go b/server/boards/web/webserver_test.go index 3dd0edcac2..24b0a04dba 100644 --- a/server/boards/web/webserver_test.go +++ b/server/boards/web/webserver_test.go @@ -8,7 +8,7 @@ import ( "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) func Test_NewServer(t *testing.T) { diff --git a/server/boards/ws/adapter.go b/server/boards/ws/adapter.go index 8134da8271..be4160780a 100644 --- a/server/boards/ws/adapter.go +++ b/server/boards/ws/adapter.go @@ -5,7 +5,7 @@ package ws import ( - "github.com/mattermost/mattermost-server/v6/server/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/model" ) const ( diff --git a/server/boards/ws/common.go b/server/boards/ws/common.go index ab1531eda4..4a5a1794b0 100644 --- a/server/boards/ws/common.go +++ b/server/boards/ws/common.go @@ -4,7 +4,7 @@ package ws import ( - "github.com/mattermost/mattermost-server/v6/server/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/model" ) // UpdateCategoryMessage is sent on block updates. diff --git a/server/boards/ws/helpers_test.go b/server/boards/ws/helpers_test.go index c8840131f5..997e5ef6eb 100644 --- a/server/boards/ws/helpers_test.go +++ b/server/boards/ws/helpers_test.go @@ -6,11 +6,11 @@ package ws import ( "testing" - authMocks "github.com/mattermost/mattermost-server/v6/server/boards/auth/mocks" - wsMocks "github.com/mattermost/mattermost-server/v6/server/boards/ws/mocks" + authMocks "github.com/mattermost/mattermost-server/server/v8/boards/auth/mocks" + wsMocks "github.com/mattermost/mattermost-server/server/v8/boards/ws/mocks" - mm_model "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + mm_model "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" "github.com/golang/mock/gomock" ) diff --git a/server/boards/ws/mocks/mockpluginapi.go b/server/boards/ws/mocks/mockpluginapi.go index 45cf40000b..612dd07d17 100644 --- a/server/boards/ws/mocks/mockpluginapi.go +++ b/server/boards/ws/mocks/mockpluginapi.go @@ -2,7 +2,7 @@ // See LICENSE.txt for license information. // Code generated by MockGen. DO NOT EDIT. -// Source: github.com/mattermost/mattermost-server/v6/plugin (interfaces: API) +// Source: github.com/mattermost/mattermost-server/server/v8/plugin (interfaces: API) // Package mocks is a generated GoMock package. package mocks @@ -13,7 +13,7 @@ import ( reflect "reflect" gomock "github.com/golang/mock/gomock" - model "github.com/mattermost/mattermost-server/v6/model" + model "github.com/mattermost/mattermost-server/server/v8/model" ) // MockAPI is a mock of API interface. diff --git a/server/boards/ws/mocks/mockstore.go b/server/boards/ws/mocks/mockstore.go index f8693f2dee..58aab276c3 100644 --- a/server/boards/ws/mocks/mockstore.go +++ b/server/boards/ws/mocks/mockstore.go @@ -2,7 +2,7 @@ // See LICENSE.txt for license information. // Code generated by MockGen. DO NOT EDIT. -// Source: github.com/mattermost/mattermost-server/v6/server/boards/ws (interfaces: Store) +// Source: github.com/mattermost/mattermost-server/server/v8/boards/ws (interfaces: Store) // Package mocks is a generated GoMock package. package mocks @@ -11,7 +11,7 @@ import ( reflect "reflect" gomock "github.com/golang/mock/gomock" - model "github.com/mattermost/mattermost-server/v6/server/boards/model" + model "github.com/mattermost/mattermost-server/server/v8/boards/model" ) // MockStore is a mock of Store interface. diff --git a/server/boards/ws/plugin_adapter.go b/server/boards/ws/plugin_adapter.go index d34a0c350f..c80f2d8e65 100644 --- a/server/boards/ws/plugin_adapter.go +++ b/server/boards/ws/plugin_adapter.go @@ -1,7 +1,7 @@ // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. -//go:generate mockgen -copyright_file=../../copyright.txt -destination=mocks/mockpluginapi.go -package mocks github.com/mattermost/mattermost-server/v6/plugin API +//go:generate mockgen -copyright_file=../../copyright.txt -destination=mocks/mockpluginapi.go -package mocks github.com/mattermost/mattermost-server/server/v8/plugin API package ws import ( @@ -11,12 +11,12 @@ import ( "sync/atomic" "time" - "github.com/mattermost/mattermost-server/v6/server/boards/auth" - "github.com/mattermost/mattermost-server/v6/server/boards/model" - "github.com/mattermost/mattermost-server/v6/server/boards/utils" + "github.com/mattermost/mattermost-server/server/v8/boards/auth" + "github.com/mattermost/mattermost-server/server/v8/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/utils" - mm_model "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + mm_model "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) const websocketMessagePrefix = "custom_boards_" diff --git a/server/boards/ws/plugin_adapter_client.go b/server/boards/ws/plugin_adapter_client.go index 2286681aec..bb24ec5ccf 100644 --- a/server/boards/ws/plugin_adapter_client.go +++ b/server/boards/ws/plugin_adapter_client.go @@ -8,7 +8,7 @@ import ( "sync/atomic" "time" - mm_model "github.com/mattermost/mattermost-server/v6/model" + mm_model "github.com/mattermost/mattermost-server/server/v8/model" ) type PluginAdapterClient struct { diff --git a/server/boards/ws/plugin_adapter_cluster.go b/server/boards/ws/plugin_adapter_cluster.go index 636d86595b..df55772787 100644 --- a/server/boards/ws/plugin_adapter_cluster.go +++ b/server/boards/ws/plugin_adapter_cluster.go @@ -6,8 +6,8 @@ package ws import ( "encoding/json" - mm_model "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + mm_model "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) type ClusterMessage struct { diff --git a/server/boards/ws/plugin_adapter_test.go b/server/boards/ws/plugin_adapter_test.go index 29dfcf3a9c..88fe421842 100644 --- a/server/boards/ws/plugin_adapter_test.go +++ b/server/boards/ws/plugin_adapter_test.go @@ -7,9 +7,9 @@ import ( "sync" "testing" - "github.com/mattermost/mattermost-server/v6/server/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/model" - mm_model "github.com/mattermost/mattermost-server/v6/model" + mm_model "github.com/mattermost/mattermost-server/server/v8/model" "github.com/stretchr/testify/require" ) diff --git a/server/boards/ws/server.go b/server/boards/ws/server.go index 52a3c5a0fb..6c22f39ac3 100644 --- a/server/boards/ws/server.go +++ b/server/boards/ws/server.go @@ -11,11 +11,11 @@ import ( "github.com/gorilla/mux" "github.com/gorilla/websocket" - "github.com/mattermost/mattermost-server/v6/server/boards/auth" - "github.com/mattermost/mattermost-server/v6/server/boards/model" - "github.com/mattermost/mattermost-server/v6/server/boards/utils" + "github.com/mattermost/mattermost-server/server/v8/boards/auth" + "github.com/mattermost/mattermost-server/server/v8/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/utils" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) func (wss *websocketSession) WriteJSON(v interface{}) error { diff --git a/server/boards/ws/server_test.go b/server/boards/ws/server_test.go index 2b26208d97..337e0205f4 100644 --- a/server/boards/ws/server_test.go +++ b/server/boards/ws/server_test.go @@ -7,10 +7,10 @@ import ( "sync" "testing" - "github.com/mattermost/mattermost-server/v6/server/boards/auth" - "github.com/mattermost/mattermost-server/v6/server/boards/model" + "github.com/mattermost/mattermost-server/server/v8/boards/auth" + "github.com/mattermost/mattermost-server/server/v8/boards/model" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" "github.com/gorilla/websocket" "github.com/stretchr/testify/require" diff --git a/server/build/Dockerfile b/server/build/Dockerfile index 2faf4af160..8017e620f1 100644 --- a/server/build/Dockerfile +++ b/server/build/Dockerfile @@ -1,4 +1,4 @@ -FROM debian:buster-slim@sha256:5b0b1a9a54651bbe9d4d3ee96bbda2b2a1da3d2fa198ddebbced46dfdca7f216 +FROM ubuntu:jammy-20230308@sha256:7a57c69fe1e9d5b97c5fe649849e79f2cfc3bf11d10bbd5218b4eb61716aebe6 # Setting bash as our shell, and enabling pipefail option @@ -8,73 +8,18 @@ SHELL ["/bin/bash", "-o", "pipefail", "-c"] ENV PATH="/mattermost/bin:${PATH}" ARG PUID=2000 ARG PGID=2000 -ARG MM_PACKAGE="https://releases.mattermost.com/7.9.1/mattermost-7.9.1-linux-amd64.tar.gz?src=docker" +ARG MM_PACKAGE="https://releases.mattermost.com/7.10.0/mattermost-7.10.0-linux-amd64.tar.gz?src=docker" # # Install needed packages and indirect dependencies RUN apt-get update \ && apt-get install --no-install-recommends -y \ - ca-certificates=20200601~deb10u2 \ - curl=7.64.0-4+deb10u2 \ - mime-support=3.62 \ - unrtf=0.21.10-clean-1 \ - wv=1.2.9-4.2+b2 \ - poppler-utils=0.71.0-5 \ - tidy=2:5.6.0-10 \ - libssl1.1=1.1.1n-0+deb10u3 \ - sensible-utils=0.0.12 \ - libsasl2-modules-db=2.1.27+dfsg-1+deb10u2 \ - libsasl2-2=2.1.27+dfsg-1+deb10u2 \ - libldap-common=2.4.47+dfsg-3+deb10u7 \ - libldap-2.4-2=2.4.47+dfsg-3+deb10u7 \ - libicu63=63.1-6+deb10u3 \ - libxml2=2.9.4+dfsg1-7+deb10u4 \ - ucf=3.0038+nmu1 \ - openssl=1.1.1n-0+deb10u3 \ - libkeyutils1=1.6-6 \ - libkrb5support0=1.17-3+deb10u4 \ - libk5crypto3=1.17-3+deb10u4 \ - libkrb5-3=1.17-3+deb10u4 \ - libgssapi-krb5-2=1.17-3+deb10u4 \ - libnghttp2-14=1.36.0-2+deb10u1 \ - libpsl5=0.20.2-2 \ - librtmp1=2.4+20151223.gitfa8646d.1-2 \ - libssh2-1=1.8.0-2.1 \ - libcurl4=7.64.0-4+deb10u2 \ - fonts-dejavu-core=2.37-1 \ - fontconfig-config=2.13.1-2 \ - libbsd0=0.9.1-2+deb10u1 \ - libexpat1=2.2.6-2+deb10u4 \ - libpng16-16=1.6.36-6 \ - libfreetype6=2.9.1-3+deb10u2 \ - libfontconfig1=2.13.1-2 \ - libpixman-1-0=0.36.0-1 \ - libxau6=1:1.0.8-1+b2 \ - libxdmcp6=1:1.1.2-3 \ - libxcb1=1.13.1-2 \ - libx11-data=2:1.6.7-1+deb10u2 \ - libx11-6=2:1.6.7-1+deb10u2 \ - libxcb-render0=1.13.1-2 \ - libxcb-shm0=1.13.1-2 \ - libxext6=2:1.3.3-1+b2 \ - libxrender1=1:0.9.10-1 \ - libcairo2=1.16.0-4+deb10u1 \ - libcurl3-gnutls=7.64.0-4+deb10u5 \ - libglib2.0-0=2.58.3-2+deb10u3 \ - libgsf-1-common=1.14.45-1 \ - libgsf-1-114=1.14.45-1 \ - libjbig0=2.1-3.1+b2 \ - libjpeg62-turbo=1:1.5.2-2+deb10u1 \ - liblcms2-2=2.9-3 \ - libnspr4=2:4.20-1 \ - libsqlite3-0=3.27.2-3+deb10u1 \ - libnss3=2:3.42.1-1+deb10u5 \ - libopenjp2-7=2.3.0-2+deb10u2 \ - libwebp6=0.6.1-2+deb10u1 \ - libtiff5=4.1.0+git191117-2~deb10u4 \ - libpoppler82=0.71.0-5 \ - libtidy5deb1=2:5.6.0-10 \ - libwmf0.2-7=0.2.8.4-14 \ - libwv-1.2-4=1.2.9-4.2+b2 \ + ca-certificates \ + curl \ + mime-support \ + unrtf \ + wv \ + poppler-utils \ + tidy \ && rm -rf /var/lib/apt/lists/* # Set mattermost group/user and download Mattermost diff --git a/server/build/release.mk b/server/build/release.mk index 694b9a625c..fd5d7dc4e9 100644 --- a/server/build/release.mk +++ b/server/build/release.mk @@ -134,8 +134,8 @@ else endif cp ../NOTICE.txt $(DIST_PATH) cp ../README.md $(DIST_PATH) - if [ -f ../manifest.txt ]; then \ - cp ../manifest.txt $(DIST_PATH); \ + if [ -f bin/manifest.txt ]; then \ + cp bin/manifest.txt $(DIST_PATH); \ fi @# Import Mattermost plugin public key diff --git a/server/channels/api4/api.go b/server/channels/api4/api.go index a5e89b5046..5240be9b39 100644 --- a/server/channels/api4/api.go +++ b/server/channels/api4/api.go @@ -10,9 +10,9 @@ import ( graphql "github.com/graph-gophers/graphql-go" _ "github.com/mattermost/go-i18n/i18n" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/app" - "github.com/mattermost/mattermost-server/v6/server/channels/web" + "github.com/mattermost/mattermost-server/server/v8/channels/app" + "github.com/mattermost/mattermost-server/server/v8/channels/web" + "github.com/mattermost/mattermost-server/server/v8/model" ) type Routes struct { diff --git a/server/channels/api4/apitestlib.go b/server/channels/api4/apitestlib.go index 44d6540af5..c1ef006f8d 100644 --- a/server/channels/api4/apitestlib.go +++ b/server/channels/api4/apitestlib.go @@ -26,18 +26,18 @@ import ( "github.com/minio/minio-go/v7/pkg/credentials" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/plugin/plugintest/mock" - "github.com/mattermost/mattermost-server/v6/server/channels/app" - "github.com/mattermost/mattermost-server/v6/server/channels/app/request" - "github.com/mattermost/mattermost-server/v6/server/channels/store" - "github.com/mattermost/mattermost-server/v6/server/channels/store/storetest/mocks" - "github.com/mattermost/mattermost-server/v6/server/channels/testlib" - "github.com/mattermost/mattermost-server/v6/server/channels/web" - "github.com/mattermost/mattermost-server/v6/server/channels/wsapi" - "github.com/mattermost/mattermost-server/v6/server/config" - "github.com/mattermost/mattermost-server/v6/server/platform/services/searchengine" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/app" + "github.com/mattermost/mattermost-server/server/v8/channels/app/request" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/store/storetest/mocks" + "github.com/mattermost/mattermost-server/server/v8/channels/testlib" + "github.com/mattermost/mattermost-server/server/v8/channels/web" + "github.com/mattermost/mattermost-server/server/v8/channels/wsapi" + "github.com/mattermost/mattermost-server/server/v8/config" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/services/searchengine" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/plugin/plugintest/mock" ) type TestHelper struct { @@ -93,7 +93,9 @@ func setupTestHelper(dbStore store.Store, searchEngine *searchengine.Broker, ent panic("failed to initialize memory store: " + err.Error()) } - memoryConfig := &model.Config{} + memoryConfig := &model.Config{ + SqlSettings: *mainHelper.GetSQLSettings(), + } memoryConfig.SetDefaults() *memoryConfig.PluginSettings.Directory = filepath.Join(tempWorkspace, "plugins") *memoryConfig.PluginSettings.ClientDirectory = filepath.Join(tempWorkspace, "webapp") @@ -287,6 +289,7 @@ func SetupConfig(tb testing.TB, updateConfig func(cfg *model.Config)) *TestHelpe dbStore := mainHelper.GetStore() dbStore.DropAllTables() dbStore.MarkSystemRanUnitTests() + mainHelper.PreloadBoardsMigrationsIfNeeded() searchEngine := mainHelper.GetSearchEngine() th := setupTestHelper(dbStore, searchEngine, false, true, updateConfig, nil) th.InitLogin() @@ -294,7 +297,8 @@ func SetupConfig(tb testing.TB, updateConfig func(cfg *model.Config)) *TestHelpe } func SetupConfigWithStoreMock(tb testing.TB, updateConfig func(cfg *model.Config)) *TestHelper { - th := setupTestHelper(testlib.GetMockStoreForSetupFunctions(), nil, false, false, updateConfig, nil) + setupOptions := []app.Option{app.SkipProductsInitialization()} + th := setupTestHelper(testlib.GetMockStoreForSetupFunctions(), nil, false, false, updateConfig, setupOptions) statusMock := mocks.StatusStore{} statusMock.On("UpdateExpiredDNDStatuses").Return([]*model.Status{}, nil) statusMock.On("Get", "user1").Return(&model.Status{UserId: "user1", Status: model.StatusOnline}, nil) @@ -308,7 +312,8 @@ func SetupConfigWithStoreMock(tb testing.TB, updateConfig func(cfg *model.Config } func SetupWithStoreMock(tb testing.TB) *TestHelper { - th := setupTestHelper(testlib.GetMockStoreForSetupFunctions(), nil, false, false, nil, nil) + setupOptions := []app.Option{app.SkipProductsInitialization()} + th := setupTestHelper(testlib.GetMockStoreForSetupFunctions(), nil, false, false, nil, setupOptions) statusMock := mocks.StatusStore{} statusMock.On("UpdateExpiredDNDStatuses").Return([]*model.Status{}, nil) statusMock.On("Get", "user1").Return(&model.Status{UserId: "user1", Status: model.StatusOnline}, nil) @@ -322,7 +327,8 @@ func SetupWithStoreMock(tb testing.TB) *TestHelper { } func SetupEnterpriseWithStoreMock(tb testing.TB, options ...app.Option) *TestHelper { - th := setupTestHelper(testlib.GetMockStoreForSetupFunctions(), nil, true, false, nil, options) + setupOptions := append(options, app.SkipProductsInitialization()) + th := setupTestHelper(testlib.GetMockStoreForSetupFunctions(), nil, true, false, nil, setupOptions) statusMock := mocks.StatusStore{} statusMock.On("UpdateExpiredDNDStatuses").Return([]*model.Status{}, nil) statusMock.On("Get", "user1").Return(&model.Status{UserId: "user1", Status: model.StatusOnline}, nil) @@ -479,6 +485,14 @@ func (th *TestHelper) InitBasic() *TestHelper { return th } +func (th *TestHelper) DeleteBots() *TestHelper { + preexistingBots, _ := th.App.GetBots(&model.BotGetOptions{Page: 0, PerPage: 100}) + for _, bot := range preexistingBots { + th.App.PermanentDeleteBot(bot.UserId) + } + return th +} + func (th *TestHelper) waitForConnectivity() { for i := 0; i < 1000; i++ { conn, err := net.Dial("tcp", fmt.Sprintf("localhost:%v", th.App.Srv().ListenAddr.Port)) @@ -1079,12 +1093,6 @@ func CheckErrorMessage(tb testing.TB, err error, message string) { require.Equalf(tb, message, appError.Message, "incorrect error message, actual: %s, expected: %s", appError.Id, message) } -func CheckStartsWith(tb testing.TB, value, prefix, message string) { - tb.Helper() - - require.True(tb, strings.HasPrefix(value, prefix), message, value) -} - // Similar to s3.New() but allows initialization of signature v2 or signature v4 client. // If signV2 input is false, function always returns signature v4. // diff --git a/server/channels/api4/bleve.go b/server/channels/api4/bleve.go index 122882379d..022445ca82 100644 --- a/server/channels/api4/bleve.go +++ b/server/channels/api4/bleve.go @@ -6,8 +6,8 @@ package api4 import ( "net/http" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/audit" + "github.com/mattermost/mattermost-server/server/v8/channels/audit" + "github.com/mattermost/mattermost-server/server/v8/model" ) func (api *API) InitBleve() { diff --git a/server/channels/api4/bleve_test.go b/server/channels/api4/bleve_test.go index f66aab45ed..29d873d022 100644 --- a/server/channels/api4/bleve_test.go +++ b/server/channels/api4/bleve_test.go @@ -8,7 +8,7 @@ import ( "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestBlevePurgeIndexes(t *testing.T) { diff --git a/server/channels/api4/bot.go b/server/channels/api4/bot.go index 024cd008be..e76ee02a53 100644 --- a/server/channels/api4/bot.go +++ b/server/channels/api4/bot.go @@ -8,9 +8,9 @@ import ( "net/http" "strconv" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/audit" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/audit" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) func (api *API) InitBot() { diff --git a/server/channels/api4/bot_test.go b/server/channels/api4/bot_test.go index 5a76d23f45..9c0cbb068d 100644 --- a/server/channels/api4/bot_test.go +++ b/server/channels/api4/bot_test.go @@ -11,7 +11,7 @@ import ( "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestCreateBot(t *testing.T) { @@ -297,11 +297,10 @@ func TestPatchBot(t *testing.T) { require.NoError(t, err) CheckOKStatus(t, resp) - bots, resp, err := th.Client.GetBots(0, 2, "") + bot, resp, err := th.Client.GetBot(createdBot.UserId, "") require.NoError(t, err) CheckOKStatus(t, resp) - require.Len(t, bots, 1) - require.Equal(t, []*model.Bot{patchedBot}, bots) + require.Equal(t, patchedBot, bot) }) t.Run("patch my bot without permission", func(t *testing.T) { @@ -630,7 +629,7 @@ func TestGetBot(t *testing.T) { } func TestGetBots(t *testing.T) { - th := Setup(t).InitBasic() + th := Setup(t).InitBasic().DeleteBots() defer th.TearDown() th.App.UpdateConfig(func(cfg *model.Config) { diff --git a/server/channels/api4/brand.go b/server/channels/api4/brand.go index a1dfbfb2c3..b5e9640a61 100644 --- a/server/channels/api4/brand.go +++ b/server/channels/api4/brand.go @@ -7,8 +7,8 @@ import ( "io" "net/http" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/audit" + "github.com/mattermost/mattermost-server/server/v8/channels/audit" + "github.com/mattermost/mattermost-server/server/v8/model" ) func (api *API) InitBrand() { diff --git a/server/channels/api4/brand_test.go b/server/channels/api4/brand_test.go index 2646191469..ec2e65ea8e 100644 --- a/server/channels/api4/brand_test.go +++ b/server/channels/api4/brand_test.go @@ -9,7 +9,7 @@ import ( "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/server/channels/utils/testutils" + "github.com/mattermost/mattermost-server/server/v8/channels/utils/testutils" ) func TestGetBrandImage(t *testing.T) { diff --git a/server/channels/api4/channel.go b/server/channels/api4/channel.go index 78aab7f1cc..8425df21b1 100644 --- a/server/channels/api4/channel.go +++ b/server/channels/api4/channel.go @@ -10,10 +10,10 @@ import ( "strconv" "strings" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/app" - "github.com/mattermost/mattermost-server/v6/server/channels/audit" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/app" + "github.com/mattermost/mattermost-server/server/v8/channels/audit" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) func (api *API) InitChannel() { diff --git a/server/channels/api4/channel_category.go b/server/channels/api4/channel_category.go index ce0625dacf..2eea5a5045 100644 --- a/server/channels/api4/channel_category.go +++ b/server/channels/api4/channel_category.go @@ -7,9 +7,9 @@ import ( "encoding/json" "net/http" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/audit" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/audit" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) func getCategoriesForTeamForUser(c *Context, w http.ResponseWriter, r *http.Request) { diff --git a/server/channels/api4/channel_category_test.go b/server/channels/api4/channel_category_test.go index e58a557ee6..527686d70c 100644 --- a/server/channels/api4/channel_category_test.go +++ b/server/channels/api4/channel_category_test.go @@ -12,7 +12,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestCreateCategoryForTeamForUser(t *testing.T) { diff --git a/server/channels/api4/channel_local.go b/server/channels/api4/channel_local.go index 7d85edf0c2..c5e6c6b355 100644 --- a/server/channels/api4/channel_local.go +++ b/server/channels/api4/channel_local.go @@ -7,10 +7,10 @@ import ( "encoding/json" "net/http" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/app" - "github.com/mattermost/mattermost-server/v6/server/channels/audit" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/app" + "github.com/mattermost/mattermost-server/server/v8/channels/audit" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) func (api *API) InitChannelLocal() { diff --git a/server/channels/api4/channel_test.go b/server/channels/api4/channel_test.go index 61a960b5aa..20ef2cd05a 100644 --- a/server/channels/api4/channel_test.go +++ b/server/channels/api4/channel_test.go @@ -17,11 +17,11 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/plugin/plugintest/mock" - "github.com/mattermost/mattermost-server/v6/server/channels/app" - "github.com/mattermost/mattermost-server/v6/server/channels/store/storetest/mocks" - "github.com/mattermost/mattermost-server/v6/server/channels/utils/testutils" + "github.com/mattermost/mattermost-server/server/v8/channels/app" + "github.com/mattermost/mattermost-server/server/v8/channels/store/storetest/mocks" + "github.com/mattermost/mattermost-server/server/v8/channels/utils/testutils" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/plugin/plugintest/mock" ) func TestCreateChannel(t *testing.T) { @@ -859,14 +859,23 @@ func TestGetPublicChannelsForTeam(t *testing.T) { require.NoError(t, err) require.Len(t, channels, 4, "wrong path") - for i, c := range channels { + var foundPublicChannel1, foundPublicChannel2 bool + for _, c := range channels { // check all channels included are open require.Equal(t, model.ChannelTypeOpen, c.Type, "should include open channel only") // only check the created 2 public channels - require.False(t, i < 2 && !(c.DisplayName == publicChannel1.DisplayName || c.DisplayName == publicChannel2.DisplayName), "should match public channel display name") + switch c.DisplayName { + case publicChannel1.DisplayName: + foundPublicChannel1 = true + case publicChannel2.DisplayName: + foundPublicChannel2 = true + } } + require.True(t, foundPublicChannel1, "failed to find publicChannel1") + require.True(t, foundPublicChannel2, "failed to find publicChannel2") + privateChannel := th.CreatePrivateChannel() channels, _, err = client.GetPublicChannelsForTeam(team.Id, 0, 100, "") require.NoError(t, err) @@ -1135,9 +1144,14 @@ func TestGetAllChannels(t *testing.T) { require.NoError(t, err) beforeCount := len(channels) - firstChannel := channels[0].Channel + deletedChannel := channels[0].Channel - _, err = client.DeleteChannel(firstChannel.Id) + // Never try to delete the default channel + if deletedChannel.Name == "town-square" { + deletedChannel = channels[1].Channel + } + + _, err = client.DeleteChannel(deletedChannel.Id) require.NoError(t, err) channels, _, err = client.GetAllChannels(0, 10000, "") @@ -1147,7 +1161,7 @@ func TestGetAllChannels(t *testing.T) { } require.NoError(t, err) require.Len(t, channels, beforeCount-1) - require.NotContains(t, ids, firstChannel.Id) + require.NotContains(t, ids, deletedChannel.Id) channels, _, err = client.GetAllChannelsIncludeDeleted(0, 10000, "") ids = []string{} @@ -1156,7 +1170,7 @@ func TestGetAllChannels(t *testing.T) { } require.NoError(t, err) require.True(t, len(channels) > beforeCount) - require.Contains(t, ids, firstChannel.Id) + require.Contains(t, ids, deletedChannel.Id) }) _, resp, err := client.GetAllChannels(0, 20, "") @@ -4140,6 +4154,12 @@ func TestGetChannelModerations(t *testing.T) { scheme.DefaultChannelGuestRole = "" mockStore := mocks.Store{} + + // Playbooks DB job requires a plugin mock + pluginStore := mocks.PluginStore{} + pluginStore.On("List", mock.Anything, mock.Anything, mock.Anything).Return([]string{}, nil) + mockStore.On("Plugin").Return(&pluginStore) + mockSchemeStore := mocks.SchemeStore{} mockSchemeStore.On("Get", mock.Anything).Return(scheme, nil) mockStore.On("Scheme").Return(&mockSchemeStore) @@ -4282,6 +4302,12 @@ func TestPatchChannelModerations(t *testing.T) { scheme.DefaultChannelGuestRole = "" mockStore := mocks.Store{} + + // Playbooks DB job requires a plugin mock + pluginStore := mocks.PluginStore{} + pluginStore.On("List", mock.Anything, mock.Anything, mock.Anything).Return([]string{}, nil) + mockStore.On("Plugin").Return(&pluginStore) + mockSchemeStore := mocks.SchemeStore{} mockSchemeStore.On("Get", mock.Anything).Return(scheme, nil) mockSchemeStore.On("Save", mock.Anything).Return(scheme, nil) @@ -4340,7 +4366,6 @@ func TestPatchChannelModerations(t *testing.T) { require.Equal(t, moderation.Roles.Members.Enabled, true) } }) - } func TestGetChannelMemberCountsByGroup(t *testing.T) { diff --git a/server/channels/api4/cloud.go b/server/channels/api4/cloud.go index 48a8ddf83f..f795e3c1d2 100644 --- a/server/channels/api4/cloud.go +++ b/server/channels/api4/cloud.go @@ -11,10 +11,10 @@ import ( "net/http" "time" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/audit" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/web" + "github.com/mattermost/mattermost-server/server/v8/channels/audit" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/web" ) func (api *API) InitCloud() { @@ -103,6 +103,7 @@ func getSubscription(c *Context, w http.ResponseWriter, r *http.Request) { DNS: "", LastInvoice: &model.Invoice{}, DelinquentSince: subscription.DelinquentSince, + BillingType: "", } } @@ -888,5 +889,4 @@ func selfServeDeleteWorkspace(c *Context, w http.ResponseWriter, r *http.Request c.App.Srv().GetTelemetryService().SendTelemetry("delete_workspace_feedback", deleteRequest.Feedback.ToMap()) ReturnStatusOK(w) - } diff --git a/server/channels/api4/cloud_test.go b/server/channels/api4/cloud_test.go index 6b2067ec15..7cfe985df6 100644 --- a/server/channels/api4/cloud_test.go +++ b/server/channels/api4/cloud_test.go @@ -11,8 +11,8 @@ import ( "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/einterfaces/mocks" + "github.com/mattermost/mattermost-server/server/v8/channels/einterfaces/mocks" + "github.com/mattermost/mattermost-server/server/v8/model" ) func Test_getCloudLimits(t *testing.T) { diff --git a/server/channels/api4/cluster.go b/server/channels/api4/cluster.go index 74e6e2b26d..233a83f3a0 100644 --- a/server/channels/api4/cluster.go +++ b/server/channels/api4/cluster.go @@ -7,7 +7,7 @@ import ( "encoding/json" "net/http" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) func (api *API) InitCluster() { diff --git a/server/channels/api4/cluster_test.go b/server/channels/api4/cluster_test.go index 8fe56ebbeb..175bfd1295 100644 --- a/server/channels/api4/cluster_test.go +++ b/server/channels/api4/cluster_test.go @@ -8,7 +8,7 @@ import ( "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestGetClusterStatus(t *testing.T) { diff --git a/server/channels/api4/command.go b/server/channels/api4/command.go index 5bce4b8169..724994fe01 100644 --- a/server/channels/api4/command.go +++ b/server/channels/api4/command.go @@ -9,9 +9,9 @@ import ( "strconv" "strings" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/audit" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/audit" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) func (api *API) InitCommand() { @@ -323,9 +323,9 @@ func executeCommand(c *Context, w http.ResponseWriter, r *http.Request) { defer c.LogAuditRec(auditRec) audit.AddEventParameterAuditable(auditRec, "command_args", &commandArgs) - // checks that user is a member of the specified channel, and that they have permission to use slash commands in it - if !c.App.SessionHasPermissionToChannel(c.AppContext, *c.AppContext.Session(), commandArgs.ChannelId, model.PermissionUseSlashCommands) { - c.SetPermissionError(model.PermissionUseSlashCommands) + // Checks that user is a member of the specified channel, and that they have permission to create a post in it. + if !c.App.SessionHasPermissionToChannel(c.AppContext, *c.AppContext.Session(), commandArgs.ChannelId, model.PermissionCreatePost) { + c.SetPermissionError(model.PermissionCreatePost) return } @@ -343,8 +343,8 @@ func executeCommand(c *Context, w http.ResponseWriter, r *http.Request) { // if the slash command was used in a DM or GM, ensure that the user is a member of the specified team, so that // they can't just execute slash commands against arbitrary teams if c.AppContext.Session().GetTeamByTeamId(commandArgs.TeamId) == nil { - if !c.App.SessionHasPermissionTo(*c.AppContext.Session(), model.PermissionUseSlashCommands) { - c.SetPermissionError(model.PermissionUseSlashCommands) + if !c.App.SessionHasPermissionTo(*c.AppContext.Session(), model.PermissionCreatePost) { + c.SetPermissionError(model.PermissionCreatePost) return } } diff --git a/server/channels/api4/command_help_test.go b/server/channels/api4/command_help_test.go index ca255cc6a5..b7ba178a9c 100644 --- a/server/channels/api4/command_help_test.go +++ b/server/channels/api4/command_help_test.go @@ -9,7 +9,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestHelpCommand(t *testing.T) { diff --git a/server/channels/api4/command_local.go b/server/channels/api4/command_local.go index 22d60acf0c..3c7f2d44b0 100644 --- a/server/channels/api4/command_local.go +++ b/server/channels/api4/command_local.go @@ -7,9 +7,9 @@ import ( "encoding/json" "net/http" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/audit" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/audit" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) func (api *API) InitCommandLocal() { diff --git a/server/channels/api4/command_test.go b/server/channels/api4/command_test.go index e2fc67d8f0..b1328da3b1 100644 --- a/server/channels/api4/command_test.go +++ b/server/channels/api4/command_test.go @@ -14,8 +14,9 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/app/request" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) func TestCreateCommand(t *testing.T) { @@ -1065,3 +1066,80 @@ func TestExecuteCommandInTeamUserIsNotOn(t *testing.T) { require.Error(t, err) CheckForbiddenStatus(t, resp) } + +func TestExecuteCommandReadOnly(t *testing.T) { + th := Setup(t).InitBasic() + ctx := request.EmptyContext(th.TestLogger) + defer th.TearDown() + client := th.Client + + enableCommands := *th.App.Config().ServiceSettings.EnableCommands + allowedInternalConnections := *th.App.Config().ServiceSettings.AllowedUntrustedInternalConnections + defer func() { + th.App.UpdateConfig(func(cfg *model.Config) { cfg.ServiceSettings.EnableCommands = &enableCommands }) + th.App.UpdateConfig(func(cfg *model.Config) { + cfg.ServiceSettings.AllowedUntrustedInternalConnections = &allowedInternalConnections + }) + }() + th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.EnableCommands = true }) + th.App.UpdateConfig(func(cfg *model.Config) { + *cfg.ServiceSettings.AllowedUntrustedInternalConnections = "localhost,127.0.0.1" + }) + + expectedCommandResponse := &model.CommandResponse{ + Text: "test post command response", + ResponseType: model.CommandResponseTypeInChannel, + Type: "custom_test", + Props: map[string]any{"someprop": "somevalue"}, + } + + ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + require.Equal(t, http.MethodPost, r.Method) + r.ParseForm() + require.Equal(t, th.BasicTeam.Name, r.FormValue("team_domain")) + + w.Header().Set("Content-Type", "application/json") + if err := json.NewEncoder(w).Encode(expectedCommandResponse); err != nil { + th.TestLogger.Warn("Error while writing response", mlog.Err(err)) + } + })) + defer ts.Close() + + // create a slash command on that team + postCmd := &model.Command{ + CreatorId: th.BasicUser.Id, + TeamId: th.BasicTeam.Id, + URL: ts.URL, + Method: model.CommandMethodPost, + Trigger: "postcommand", + } + _, appErr := th.App.CreateCommand(postCmd) + require.Nil(t, appErr, "failed to create post command") + + // Confirm that the command works when the channel is not read only + _, resp, err := client.ExecuteCommandWithTeam(th.BasicChannel.Id, th.BasicChannel.TeamId, "/postcommand") + require.NoError(t, err) + CheckOKStatus(t, resp) + + // Enable Enterprise features + th.App.Srv().SetLicense(model.NewTestLicense()) + + th.App.SetPhase2PermissionsMigrationStatus(true) + + _, appErr = th.App.PatchChannelModerationsForChannel( + ctx, + th.BasicChannel, + []*model.ChannelModerationPatch{{ + Name: &model.PermissionCreatePost.Id, + Roles: &model.ChannelModeratedRolesPatch{ + Guests: model.NewBool(false), + Members: model.NewBool(false), + }, + }}) + require.Nil(t, appErr) + + // Confirm that the command fails when the channel is read only + _, resp, err = client.ExecuteCommandWithTeam(th.BasicChannel.Id, th.BasicChannel.TeamId, "/postcommand") + require.Error(t, err) + CheckForbiddenStatus(t, resp) +} diff --git a/server/channels/api4/commands_test.go b/server/channels/api4/commands_test.go index 44d3b45345..2ec4450759 100644 --- a/server/channels/api4/commands_test.go +++ b/server/channels/api4/commands_test.go @@ -10,9 +10,9 @@ import ( "github.com/stretchr/testify/require" - _ "github.com/mattermost/mattermost-server/v6/server/channels/app/slashcommands" + _ "github.com/mattermost/mattermost-server/server/v8/channels/app/slashcommands" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestEchoCommand(t *testing.T) { diff --git a/server/channels/api4/compliance.go b/server/channels/api4/compliance.go index cdeb7d442d..8d86aa7030 100644 --- a/server/channels/api4/compliance.go +++ b/server/channels/api4/compliance.go @@ -10,9 +10,9 @@ import ( "github.com/avct/uasurfer" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/audit" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/audit" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) func (api *API) InitCompliance() { diff --git a/server/channels/api4/config.go b/server/channels/api4/config.go index 042636b17e..3d223424e0 100644 --- a/server/channels/api4/config.go +++ b/server/channels/api4/config.go @@ -10,12 +10,12 @@ import ( "reflect" "strings" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/audit" - "github.com/mattermost/mattermost-server/v6/server/channels/utils" - "github.com/mattermost/mattermost-server/v6/server/config" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/i18n" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/audit" + "github.com/mattermost/mattermost-server/server/v8/channels/utils" + "github.com/mattermost/mattermost-server/server/v8/config" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/i18n" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) var writeFilter func(c *Context, structField reflect.StructField) bool diff --git a/server/channels/api4/config_local.go b/server/channels/api4/config_local.go index c6f7a2dc55..33e4b9cc2f 100644 --- a/server/channels/api4/config_local.go +++ b/server/channels/api4/config_local.go @@ -8,11 +8,11 @@ import ( "net/http" "reflect" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/audit" - "github.com/mattermost/mattermost-server/v6/server/channels/utils" - "github.com/mattermost/mattermost-server/v6/server/config" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/audit" + "github.com/mattermost/mattermost-server/server/v8/channels/utils" + "github.com/mattermost/mattermost-server/server/v8/config" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) func (api *API) InitConfigLocal() { diff --git a/server/channels/api4/config_test.go b/server/channels/api4/config_test.go index 5b6900d6a7..a248254253 100644 --- a/server/channels/api4/config_test.go +++ b/server/channels/api4/config_test.go @@ -15,9 +15,9 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/app" - "github.com/mattermost/mattermost-server/v6/server/config" + "github.com/mattermost/mattermost-server/server/v8/channels/app" + "github.com/mattermost/mattermost-server/server/v8/config" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestGetConfig(t *testing.T) { diff --git a/server/channels/api4/cors_test.go b/server/channels/api4/cors_test.go index 8fd130d0c2..f95b764495 100644 --- a/server/channels/api4/cors_test.go +++ b/server/channels/api4/cors_test.go @@ -11,8 +11,8 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store/storetest/mocks" + "github.com/mattermost/mattermost-server/server/v8/channels/store/storetest/mocks" + "github.com/mattermost/mattermost-server/server/v8/model" ) const ( diff --git a/server/channels/api4/data_retention.go b/server/channels/api4/data_retention.go index 73139ab7e0..9acb51b11a 100644 --- a/server/channels/api4/data_retention.go +++ b/server/channels/api4/data_retention.go @@ -7,9 +7,9 @@ import ( "encoding/json" "net/http" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/audit" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/audit" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) func (api *API) InitDataRetention() { diff --git a/server/channels/api4/drafts.go b/server/channels/api4/drafts.go index bfd1112f94..d48c0b3964 100644 --- a/server/channels/api4/drafts.go +++ b/server/channels/api4/drafts.go @@ -7,8 +7,8 @@ import ( "encoding/json" "net/http" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) func (api *API) InitDrafts() { diff --git a/server/channels/api4/drafts_test.go b/server/channels/api4/drafts_test.go index ed3d32c065..f9afe4eae8 100644 --- a/server/channels/api4/drafts_test.go +++ b/server/channels/api4/drafts_test.go @@ -10,8 +10,8 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/utils/testutils" + "github.com/mattermost/mattermost-server/server/v8/channels/utils/testutils" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestUpsertDraft(t *testing.T) { diff --git a/server/channels/api4/elasticsearch.go b/server/channels/api4/elasticsearch.go index a8edfa4858..eaede8aa47 100644 --- a/server/channels/api4/elasticsearch.go +++ b/server/channels/api4/elasticsearch.go @@ -7,9 +7,9 @@ import ( "encoding/json" "net/http" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/audit" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/audit" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) func (api *API) InitElasticsearch() { diff --git a/server/channels/api4/elasticsearch_test.go b/server/channels/api4/elasticsearch_test.go index b20bd74ab4..c814c61b5f 100644 --- a/server/channels/api4/elasticsearch_test.go +++ b/server/channels/api4/elasticsearch_test.go @@ -10,7 +10,7 @@ import ( "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestElasticsearchTest(t *testing.T) { diff --git a/server/channels/api4/emoji.go b/server/channels/api4/emoji.go index 0cbd7a0073..42db023009 100644 --- a/server/channels/api4/emoji.go +++ b/server/channels/api4/emoji.go @@ -8,11 +8,11 @@ import ( "io" "net/http" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/app" - "github.com/mattermost/mattermost-server/v6/server/channels/audit" - "github.com/mattermost/mattermost-server/v6/server/channels/web" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/app" + "github.com/mattermost/mattermost-server/server/v8/channels/audit" + "github.com/mattermost/mattermost-server/server/v8/channels/web" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) const ( diff --git a/server/channels/api4/emoji_test.go b/server/channels/api4/emoji_test.go index b4237d2eb6..17f263e188 100644 --- a/server/channels/api4/emoji_test.go +++ b/server/channels/api4/emoji_test.go @@ -14,10 +14,10 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/app" - "github.com/mattermost/mattermost-server/v6/server/channels/utils" - "github.com/mattermost/mattermost-server/v6/server/channels/utils/fileutils" + "github.com/mattermost/mattermost-server/server/v8/channels/app" + "github.com/mattermost/mattermost-server/server/v8/channels/utils" + "github.com/mattermost/mattermost-server/server/v8/channels/utils/fileutils" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestCreateEmoji(t *testing.T) { diff --git a/server/channels/api4/export.go b/server/channels/api4/export.go index 47cd94a5f2..2f1110f031 100644 --- a/server/channels/api4/export.go +++ b/server/channels/api4/export.go @@ -9,8 +9,8 @@ import ( "path/filepath" "time" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/audit" + "github.com/mattermost/mattermost-server/server/v8/channels/audit" + "github.com/mattermost/mattermost-server/server/v8/model" ) func (api *API) InitExport() { diff --git a/server/channels/api4/export_test.go b/server/channels/api4/export_test.go index 818493538d..b8c65b8ed8 100644 --- a/server/channels/api4/export_test.go +++ b/server/channels/api4/export_test.go @@ -10,8 +10,8 @@ import ( "path/filepath" "testing" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/utils/fileutils" + "github.com/mattermost/mattermost-server/server/v8/channels/utils/fileutils" + "github.com/mattermost/mattermost-server/server/v8/model" "github.com/stretchr/testify/require" ) diff --git a/server/channels/api4/file.go b/server/channels/api4/file.go index 901160b3d5..b09d6d1491 100644 --- a/server/channels/api4/file.go +++ b/server/channels/api4/file.go @@ -14,12 +14,12 @@ import ( "strconv" "time" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/app" - "github.com/mattermost/mattermost-server/v6/server/channels/audit" - "github.com/mattermost/mattermost-server/v6/server/channels/utils" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/web" + "github.com/mattermost/mattermost-server/server/v8/channels/app" + "github.com/mattermost/mattermost-server/server/v8/channels/audit" + "github.com/mattermost/mattermost-server/server/v8/channels/utils" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/web" ) const ( diff --git a/server/channels/api4/file_test.go b/server/channels/api4/file_test.go index 05005e015e..af89e72fb0 100644 --- a/server/channels/api4/file_test.go +++ b/server/channels/api4/file_test.go @@ -15,7 +15,6 @@ import ( "net/url" "os" "path/filepath" - "runtime" "strings" "testing" "time" @@ -23,10 +22,10 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/app" - "github.com/mattermost/mattermost-server/v6/server/channels/utils/fileutils" - "github.com/mattermost/mattermost-server/v6/server/channels/utils/testutils" + "github.com/mattermost/mattermost-server/server/v8/channels/app" + "github.com/mattermost/mattermost-server/server/v8/channels/utils/fileutils" + "github.com/mattermost/mattermost-server/server/v8/channels/utils/testutils" + "github.com/mattermost/mattermost-server/server/v8/model" ) var testDir = "" @@ -790,6 +789,12 @@ func TestGetFileHeaders(t *testing.T) { t.Skip("skipping because no file driver is enabled") } + CheckStartsWith := func(tb testing.TB, value, prefix, message string) { + tb.Helper() + + require.True(tb, strings.HasPrefix(value, prefix), fmt.Sprintf("%s: %s", message, value)) + } + testHeaders := func(data []byte, filename string, expectedContentType string, getInline bool, loadFile bool) func(*testing.T) { return func(t *testing.T) { if loadFile { @@ -832,11 +837,8 @@ func TestGetFileHeaders(t *testing.T) { t.Run("txt", testHeaders(data, "test.txt", "text/plain", false, false)) t.Run("html", testHeaders(data, "test.html", "text/plain", false, false)) t.Run("js", testHeaders(data, "test.js", "text/plain", false, false)) - if os.Getenv("IS_CI") == "true" { - t.Run("go", testHeaders(data, "test.go", "application/octet-stream", false, false)) - } else if runtime.GOOS == "linux" || runtime.GOOS == "darwin" { - t.Run("go", testHeaders(data, "test.go", "text/x-go; charset=utf-8", false, false)) - } + // *.go are categorized differently by different platforms + // t.Run("go", testHeaders(data, "test.go", "text/x-go; charset=utf-8", false, false)) t.Run("zip", testHeaders(data, "test.zip", "application/zip", false, false)) // Not every platform can recognize these //t.Run("exe", testHeaders(data, "test.exe", "application/x-ms", false)) diff --git a/server/channels/api4/graphql.go b/server/channels/api4/graphql.go index 138a004ab9..486fe117ff 100644 --- a/server/channels/api4/graphql.go +++ b/server/channels/api4/graphql.go @@ -13,9 +13,9 @@ import ( graphql "github.com/graph-gophers/graphql-go" gqlerrors "github.com/graph-gophers/graphql-go/errors" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/web" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/web" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) type graphQLInput struct { diff --git a/server/channels/api4/graphql_client.go b/server/channels/api4/graphql_client.go index edc893eeee..571560665a 100644 --- a/server/channels/api4/graphql_client.go +++ b/server/channels/api4/graphql_client.go @@ -9,7 +9,7 @@ import ( "net/http" "strings" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) // graphQLClient is an internal test client to run the tests. diff --git a/server/channels/api4/group.go b/server/channels/api4/group.go index d6dbfb0da3..0a465f4c00 100644 --- a/server/channels/api4/group.go +++ b/server/channels/api4/group.go @@ -11,9 +11,9 @@ import ( "strconv" "strings" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/app" - "github.com/mattermost/mattermost-server/v6/server/channels/audit" + "github.com/mattermost/mattermost-server/server/v8/channels/app" + "github.com/mattermost/mattermost-server/server/v8/channels/audit" + "github.com/mattermost/mattermost-server/server/v8/model" ) func (api *API) InitGroup() { diff --git a/server/channels/api4/group_test.go b/server/channels/api4/group_test.go index 7fdf38147e..f08909dc2a 100644 --- a/server/channels/api4/group_test.go +++ b/server/channels/api4/group_test.go @@ -13,7 +13,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestGetGroup(t *testing.T) { diff --git a/server/channels/api4/handlers.go b/server/channels/api4/handlers.go index 2c98381cfb..b7833fac87 100644 --- a/server/channels/api4/handlers.go +++ b/server/channels/api4/handlers.go @@ -8,8 +8,8 @@ import ( "github.com/mattermost/gziphandler" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/web" + "github.com/mattermost/mattermost-server/server/v8/channels/web" + "github.com/mattermost/mattermost-server/server/v8/model" ) type Context = web.Context diff --git a/server/channels/api4/handlers_test.go b/server/channels/api4/handlers_test.go index 9c2087cdaa..22a3757294 100644 --- a/server/channels/api4/handlers_test.go +++ b/server/channels/api4/handlers_test.go @@ -11,7 +11,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) func handlerForGzip(c *Context, w http.ResponseWriter, r *http.Request) { diff --git a/server/channels/api4/hosted_customer.go b/server/channels/api4/hosted_customer.go index ba791c28cc..c7beef7ebd 100644 --- a/server/channels/api4/hosted_customer.go +++ b/server/channels/api4/hosted_customer.go @@ -10,15 +10,14 @@ import ( "fmt" "io" "net/http" - "reflect" "time" "github.com/pkg/errors" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/utils" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/web" + "github.com/mattermost/mattermost-server/server/v8/channels/utils" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/web" ) // APIs for self-hosted workspaces to communicate with the backing customer & payments system. @@ -32,6 +31,8 @@ func (api *API) InitHostedCustomer() { api.BaseRoutes.HostedCustomer.Handle("/customer", api.APISessionRequired(selfHostedCustomer)).Methods("POST") // POST /api/v4/hosted_customer/confirm api.BaseRoutes.HostedCustomer.Handle("/confirm", api.APISessionRequired(selfHostedConfirm)).Methods("POST") + // POST /api.v4/hosted_customer/confirm-expand + api.BaseRoutes.HostedCustomer.Handle("/confirm-expand", api.APISessionRequired(selfHostedConfirmExpand)).Methods("POST") // GET /api/v4/hosted_customer/invoices api.BaseRoutes.HostedCustomer.Handle("/invoices", api.APISessionRequired(selfHostedInvoices)).Methods("GET") // GET /api/v4/hosted_customer/invoices/{invoice_id:in_[A-Za-z0-9]+}/pdf @@ -172,6 +173,7 @@ func selfHostedConfirm(c *Context, w http.ResponseWriter, r *http.Request) { c.Err = userErr return } + confirmResponse, err := c.App.Cloud().ConfirmSelfHostedSignup(confirm, user.Email) if err != nil { if confirmResponse != nil { @@ -185,9 +187,8 @@ func selfHostedConfirm(c *Context, w http.ResponseWriter, r *http.Request) { c.Err = model.NewAppError(where, "api.cloud.app_error", nil, "", http.StatusInternalServerError).Wrap(err) return } - license, err := c.App.Srv().Platform().SaveLicense([]byte(confirmResponse.License)) - // dealing with an AppError - if !(reflect.ValueOf(err).Kind() == reflect.Ptr && reflect.ValueOf(err).IsNil()) { + license, appErr := c.App.Srv().Platform().SaveLicense([]byte(confirmResponse.License)) + if appErr != nil { if confirmResponse != nil { c.App.NotifySelfHostedSignupProgress(confirmResponse.Progress, user.Id) } @@ -325,3 +326,80 @@ func handleSubscribeToNewsletter(c *Context, w http.ResponseWriter, r *http.Requ ReturnStatusOK(w) } + +func selfHostedConfirmExpand(c *Context, w http.ResponseWriter, r *http.Request) { + const where = "Api4.selfHostedConfirmExpand" + + ensureSelfHostedAdmin(c, where) + if c.Err != nil { + return + } + + if !checkSelfHostedPurchaseEnabled(c) { + c.Err = model.NewAppError(where, "api.cloud.app_error", nil, "", http.StatusNotImplemented) + return + } + + bodyBytes, err := io.ReadAll(r.Body) + if err != nil { + c.Err = model.NewAppError(where, "api.cloud.app_error", nil, "", http.StatusBadRequest).Wrap(err) + return + } + + var confirm model.SelfHostedConfirmPaymentMethodRequest + err = json.Unmarshal(bodyBytes, &confirm) + if err != nil { + c.Err = model.NewAppError(where, "api.cloud.request_error", nil, "", http.StatusBadRequest).Wrap(err) + return + } + + user, userErr := c.App.GetUser(c.AppContext.Session().UserId) + if userErr != nil { + c.Err = userErr + return + } + + confirmResponse, err := c.App.Cloud().ConfirmSelfHostedExpansion(confirm, user.Email) + if err != nil { + if confirmResponse != nil { + c.App.NotifySelfHostedSignupProgress(confirmResponse.Progress, user.Id) + } + + if err.Error() == fmt.Sprintf("%d", http.StatusUnprocessableEntity) { + c.Err = model.NewAppError(where, "api.cloud.app_error", nil, "", http.StatusUnprocessableEntity).Wrap(err) + return + } + c.Err = model.NewAppError(where, "api.cloud.app_error", nil, "", http.StatusInternalServerError).Wrap(err) + return + } + + license, appErr := c.App.Srv().Platform().SaveLicense([]byte(confirmResponse.License)) + // dealing with an AppError + if appErr != nil { + if confirmResponse != nil { + c.App.NotifySelfHostedSignupProgress(confirmResponse.Progress, user.Id) + } + c.Err = model.NewAppError(where, "api.cloud.app_error", nil, "", http.StatusInternalServerError).Wrap(err) + return + } + clientResponse, err := json.Marshal(model.SelfHostedSignupConfirmClientResponse{ + License: utils.GetClientLicense(license), + Progress: confirmResponse.Progress, + }) + if err != nil { + if confirmResponse != nil { + c.App.NotifySelfHostedSignupProgress(confirmResponse.Progress, user.Id) + } + c.Err = model.NewAppError(where, "api.cloud.app_error", nil, "", http.StatusInternalServerError).Wrap(err) + return + } + + go func() { + err := c.App.Cloud().ConfirmSelfHostedSignupLicenseApplication() + if err != nil { + c.Logger.Warn("Unable to confirm license application", mlog.Err(err)) + } + }() + + _, _ = w.Write(clientResponse) +} diff --git a/server/channels/api4/hosted_customer_test.go b/server/channels/api4/hosted_customer_test.go index 25bc35c779..671cc0f86e 100644 --- a/server/channels/api4/hosted_customer_test.go +++ b/server/channels/api4/hosted_customer_test.go @@ -11,8 +11,8 @@ import ( "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/einterfaces/mocks" + "github.com/mattermost/mattermost-server/server/v8/channels/einterfaces/mocks" + "github.com/mattermost/mattermost-server/server/v8/model" ) var valFalse = false diff --git a/server/channels/api4/image.go b/server/channels/api4/image.go index f6f67cd516..3884ed0954 100644 --- a/server/channels/api4/image.go +++ b/server/channels/api4/image.go @@ -7,7 +7,7 @@ import ( "net/http" "net/url" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) func (api *API) InitImage() { diff --git a/server/channels/api4/image_test.go b/server/channels/api4/image_test.go index 4c552e7d86..5f188f77b8 100644 --- a/server/channels/api4/image_test.go +++ b/server/channels/api4/image_test.go @@ -14,7 +14,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestGetImage(t *testing.T) { diff --git a/server/channels/api4/import.go b/server/channels/api4/import.go index 0e4d3d9c34..acb1ade270 100644 --- a/server/channels/api4/import.go +++ b/server/channels/api4/import.go @@ -7,8 +7,8 @@ import ( "encoding/json" "net/http" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) func (api *API) InitImport() { diff --git a/server/channels/api4/import_test.go b/server/channels/api4/import_test.go index 2ae8b10b19..7ed85a0224 100644 --- a/server/channels/api4/import_test.go +++ b/server/channels/api4/import_test.go @@ -10,8 +10,8 @@ import ( "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/utils/fileutils" + "github.com/mattermost/mattermost-server/server/v8/channels/utils/fileutils" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestListImports(t *testing.T) { diff --git a/server/channels/api4/insights.go b/server/channels/api4/insights.go index dd9e204eae..48e3eee641 100644 --- a/server/channels/api4/insights.go +++ b/server/channels/api4/insights.go @@ -8,7 +8,7 @@ import ( "net/http" "time" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) func (api *API) InitInsights() { diff --git a/server/channels/api4/insights_test.go b/server/channels/api4/insights_test.go index 1acb8496f4..88c40ffb1a 100644 --- a/server/channels/api4/insights_test.go +++ b/server/channels/api4/insights_test.go @@ -10,9 +10,9 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store" - "github.com/mattermost/mattermost-server/v6/server/channels/utils/testutils" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/utils/testutils" + "github.com/mattermost/mattermost-server/server/v8/model" ) // Top Reactions diff --git a/server/channels/api4/integration_action.go b/server/channels/api4/integration_action.go index f008ece921..bd9d65832f 100644 --- a/server/channels/api4/integration_action.go +++ b/server/channels/api4/integration_action.go @@ -7,8 +7,8 @@ import ( "encoding/json" "net/http" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) func (api *API) InitAction() { diff --git a/server/channels/api4/integration_action_test.go b/server/channels/api4/integration_action_test.go index 92b4f2ccbe..d090b6c1ec 100644 --- a/server/channels/api4/integration_action_test.go +++ b/server/channels/api4/integration_action_test.go @@ -13,7 +13,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) type testHandler struct { diff --git a/server/channels/api4/job.go b/server/channels/api4/job.go index a7d0a1e3ed..63368eb1a1 100644 --- a/server/channels/api4/job.go +++ b/server/channels/api4/job.go @@ -10,10 +10,10 @@ import ( "strconv" "time" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/audit" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/web" + "github.com/mattermost/mattermost-server/server/v8/channels/audit" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/web" ) func (api *API) InitJob() { diff --git a/server/channels/api4/job_test.go b/server/channels/api4/job_test.go index e80b1e2d14..2ff395202f 100644 --- a/server/channels/api4/job_test.go +++ b/server/channels/api4/job_test.go @@ -11,7 +11,7 @@ import ( "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestCreateJob(t *testing.T) { diff --git a/server/channels/api4/ldap.go b/server/channels/api4/ldap.go index d914386a12..cfdfe154b0 100644 --- a/server/channels/api4/ldap.go +++ b/server/channels/api4/ldap.go @@ -8,9 +8,9 @@ import ( "mime/multipart" "net/http" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/audit" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/audit" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) type mixedUnlinkedGroup struct { diff --git a/server/channels/api4/ldap_test.go b/server/channels/api4/ldap_test.go index e3583f9293..4187bb25c8 100644 --- a/server/channels/api4/ldap_test.go +++ b/server/channels/api4/ldap_test.go @@ -8,9 +8,9 @@ import ( "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/plugin/plugintest/mock" - "github.com/mattermost/mattermost-server/v6/server/channels/einterfaces/mocks" + "github.com/mattermost/mattermost-server/server/v8/channels/einterfaces/mocks" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/plugin/plugintest/mock" ) var spPrivateKey = `-----BEGIN PRIVATE KEY----- diff --git a/server/channels/api4/license.go b/server/channels/api4/license.go index 9911c241e1..065ff90fd6 100644 --- a/server/channels/api4/license.go +++ b/server/channels/api4/license.go @@ -11,11 +11,11 @@ import ( "io" "net/http" - "github.com/mattermost/mattermost-server/v6/server/channels/utils" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/utils" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/audit" + "github.com/mattermost/mattermost-server/server/v8/channels/audit" + "github.com/mattermost/mattermost-server/server/v8/model" ) func (api *API) InitLicense() { @@ -351,18 +351,21 @@ func requestTrueUpReview(c *Context, w http.ResponseWriter, r *http.Request) { return } - // Do not send true-up review data if the user has already requested one for the quarter. - // And only send a true-up review via as a one-time telemetry request if telemetry is disabled. + // True-up is only enabled when telemetry is disabled. + // When telemetry is enabled, we already have all the data necessary for true-up reviews to be completed. telemetryEnabled := c.App.Config().LogSettings.EnableDiagnostics if telemetryEnabled != nil && !*telemetryEnabled { - // Send telemetry data - c.App.Srv().GetTelemetryService().SendTelemetry(model.TrueUpReviewTelemetryName, profileMap) - - // Update the review status to reflect the completion. - status.Completed = true - c.App.Srv().Store().TrueUpReview().Update(status) + err = c.App.Cloud().SubmitTrueUpReview(c.AppContext.Session().UserId, profileMap) + if err != nil { + c.Err = model.NewAppError("requestTrueUpReview", "api.license.true_up_review.failed_to_submit", nil, err.Error(), http.StatusInternalServerError) + return + } } + // Update the review status to reflect the completion. + status.Completed = true + c.App.Srv().Store().TrueUpReview().Update(status) + // Encode to string rather than byte[] otherwise json.Marshal will encode it further. encodedData := b64.StdEncoding.EncodeToString(profileMapJson) responseContent := struct { @@ -370,6 +373,7 @@ func requestTrueUpReview(c *Context, w http.ResponseWriter, r *http.Request) { }{Content: encodedData} response, _ := json.Marshal(responseContent) + w.WriteHeader(http.StatusOK) w.Write(response) } diff --git a/server/channels/api4/license_local.go b/server/channels/api4/license_local.go index f2a30a972b..e1380b3f6f 100644 --- a/server/channels/api4/license_local.go +++ b/server/channels/api4/license_local.go @@ -9,9 +9,9 @@ import ( "io" "net/http" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/audit" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/audit" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) func (api *API) InitLicenseLocal() { diff --git a/server/channels/api4/license_test.go b/server/channels/api4/license_test.go index 08a9e57305..d580d6243d 100644 --- a/server/channels/api4/license_test.go +++ b/server/channels/api4/license_test.go @@ -10,11 +10,11 @@ import ( "testing" "time" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/einterfaces/mocks" - "github.com/mattermost/mattermost-server/v6/server/channels/utils" - mocks2 "github.com/mattermost/mattermost-server/v6/server/channels/utils/mocks" - "github.com/mattermost/mattermost-server/v6/server/channels/utils/testutils" + "github.com/mattermost/mattermost-server/server/v8/channels/einterfaces/mocks" + "github.com/mattermost/mattermost-server/server/v8/channels/utils" + mocks2 "github.com/mattermost/mattermost-server/server/v8/channels/utils/mocks" + "github.com/mattermost/mattermost-server/server/v8/channels/utils/testutils" + "github.com/mattermost/mattermost-server/server/v8/model" "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" @@ -478,18 +478,33 @@ func TestRequestRenewalLink(t *testing.T) { } func TestRequestTrueUpReview(t *testing.T) { - th := Setup(t) - defer th.TearDown() - - th.App.Srv().SetLicense(model.NewTestLicense()) - t.Run("returns status 200 when telemetry data sent", func(t *testing.T) { - resp, err := th.SystemAdminClient.DoAPIPost("/license/review", "") + th := Setup(t).InitBasic() + defer th.TearDown() + th.App.Srv().SetLicense(model.NewTestLicense()) + + th.Client.Login(th.SystemAdminUser.Email, th.SystemAdminUser.Password) + + cloud := mocks.CloudInterface{} + cloud.Mock.On("SubmitTrueUpReview", mock.Anything, mock.Anything).Return(nil) + + cloudImpl := th.App.Srv().Cloud + defer func() { + th.App.Srv().Cloud = cloudImpl + }() + th.App.Srv().Cloud = &cloud + + var reviewProfile map[string]any + resp, err := th.Client.SubmitTrueUpReview(reviewProfile) require.NoError(t, err) require.Equal(t, http.StatusOK, resp.StatusCode) }) t.Run("returns 501 when ran by cloud user", func(t *testing.T) { + th := Setup(t).InitBasic() + defer th.TearDown() + th.App.Srv().SetLicense(model.NewTestLicense()) + th.App.Srv().SetLicense(model.NewTestLicense("cloud")) resp, err := th.SystemAdminClient.DoAPIPost("/license/review", "") @@ -500,12 +515,19 @@ func TestRequestTrueUpReview(t *testing.T) { }) t.Run("returns 403 when user does not have permissions", func(t *testing.T) { + th := Setup(t).InitBasic() + defer th.TearDown() + th.App.Srv().SetLicense(model.NewTestLicense()) + resp, err := th.Client.DoAPIPost("/license/review", "") require.Error(t, err) require.Equal(t, http.StatusForbidden, resp.StatusCode) }) t.Run("returns 400 when license is nil", func(t *testing.T) { + th := Setup(t).InitBasic() + defer th.TearDown() + th.App.Srv().SetLicense(nil) resp, err := th.SystemAdminClient.DoAPIPost("/license/review", "") diff --git a/server/channels/api4/main_test.go b/server/channels/api4/main_test.go index 85807f03db..e7b1bb91e3 100644 --- a/server/channels/api4/main_test.go +++ b/server/channels/api4/main_test.go @@ -7,7 +7,7 @@ import ( "flag" "testing" - "github.com/mattermost/mattermost-server/v6/server/channels/testlib" + "github.com/mattermost/mattermost-server/server/v8/channels/testlib" ) var replicaFlag bool diff --git a/server/channels/api4/notify_admin.go b/server/channels/api4/notify_admin.go index 36af8263a0..e94f280de9 100644 --- a/server/channels/api4/notify_admin.go +++ b/server/channels/api4/notify_admin.go @@ -7,7 +7,7 @@ import ( "encoding/json" "net/http" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) func handleNotifyAdmin(c *Context, w http.ResponseWriter, r *http.Request) { diff --git a/server/channels/api4/notify_admin_test.go b/server/channels/api4/notify_admin_test.go index 2ba2640451..d633421f42 100644 --- a/server/channels/api4/notify_admin_test.go +++ b/server/channels/api4/notify_admin_test.go @@ -8,7 +8,7 @@ import ( "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestNotifyAdmin(t *testing.T) { @@ -22,7 +22,7 @@ func TestNotifyAdmin(t *testing.T) { }) require.Error(t, err) - require.Equal(t, err.Error(), ": Unable to save notify data.") + require.Equal(t, ": Unable to save notify data.", err.Error()) require.Equal(t, http.StatusInternalServerError, statusCode) }) @@ -38,7 +38,7 @@ func TestNotifyAdmin(t *testing.T) { }) require.Error(t, err) - require.Equal(t, err.Error(), ": Unable to save notify data.") + require.Equal(t, ": Unable to save notify data.", err.Error()) require.Equal(t, http.StatusInternalServerError, statusCode) }) @@ -53,7 +53,7 @@ func TestNotifyAdmin(t *testing.T) { }) require.Error(t, err) - require.Equal(t, err.Error(), ": Unable to save notify data.") + require.Equal(t, ": Unable to save notify data.", err.Error()) require.Equal(t, http.StatusInternalServerError, statusCode) }) @@ -68,7 +68,7 @@ func TestNotifyAdmin(t *testing.T) { }) require.Error(t, err) - require.Equal(t, err.Error(), ": Unable to save notify data.") + require.Equal(t, ": Unable to save notify data.", err.Error()) require.Equal(t, http.StatusInternalServerError, statusCode) }) @@ -90,7 +90,7 @@ func TestNotifyAdmin(t *testing.T) { }) require.Error(t, err) - require.Equal(t, err.Error(), ": Already notified admin") + require.Equal(t, ": Already notified admin", err.Error()) require.Equal(t, http.StatusForbidden, statusCode) }) @@ -118,7 +118,7 @@ func TestTriggerNotifyAdmin(t *testing.T) { statusCode, err := th.SystemAdminClient.TriggerNotifyAdmin(&model.NotifyAdminToUpgradeRequest{}) require.Error(t, err) - require.Equal(t, err.Error(), ": Internal error during cloud api request.") + require.Equal(t, ": Internal error during cloud api request.", err.Error()) require.Equal(t, http.StatusForbidden, statusCode) }) @@ -132,7 +132,7 @@ func TestTriggerNotifyAdmin(t *testing.T) { statusCode, err := th.Client.TriggerNotifyAdmin(&model.NotifyAdminToUpgradeRequest{}) require.Error(t, err) - require.Equal(t, err.Error(), ": You do not have the appropriate permissions.") + require.Equal(t, ": You do not have the appropriate permissions.", err.Error()) require.Equal(t, http.StatusForbidden, statusCode) }) diff --git a/server/channels/api4/oauth.go b/server/channels/api4/oauth.go index bed603afe3..fb486cc7c2 100644 --- a/server/channels/api4/oauth.go +++ b/server/channels/api4/oauth.go @@ -7,9 +7,9 @@ import ( "encoding/json" "net/http" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/audit" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/audit" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) func (api *API) InitOAuth() { diff --git a/server/channels/api4/oauth_test.go b/server/channels/api4/oauth_test.go index face6ca564..1ab7ea5191 100644 --- a/server/channels/api4/oauth_test.go +++ b/server/channels/api4/oauth_test.go @@ -10,7 +10,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestCreateOAuthApp(t *testing.T) { diff --git a/server/channels/api4/openGraph.go b/server/channels/api4/openGraph.go index 789afc3730..0eba8030a8 100644 --- a/server/channels/api4/openGraph.go +++ b/server/channels/api4/openGraph.go @@ -6,8 +6,8 @@ package api4 import ( "net/http" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) func (api *API) InitOpenGraph() { diff --git a/server/channels/api4/openGraph_test.go b/server/channels/api4/openGraph_test.go index 5faedfc9ae..5a038fb4da 100644 --- a/server/channels/api4/openGraph_test.go +++ b/server/channels/api4/openGraph_test.go @@ -11,7 +11,7 @@ import ( "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestGetOpenGraphMetadata(t *testing.T) { diff --git a/server/channels/api4/permission.go b/server/channels/api4/permission.go index a0aac0a6eb..f732f3afe9 100644 --- a/server/channels/api4/permission.go +++ b/server/channels/api4/permission.go @@ -8,7 +8,7 @@ import ( "net/http" "strings" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) func (api *API) InitPermissions() { diff --git a/server/channels/api4/permissions_test.go b/server/channels/api4/permissions_test.go index 1eb4b3d01e..16aa71d135 100644 --- a/server/channels/api4/permissions_test.go +++ b/server/channels/api4/permissions_test.go @@ -9,7 +9,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestGetAncillaryPermissions(t *testing.T) { diff --git a/server/channels/api4/plugin.go b/server/channels/api4/plugin.go index e645a5822c..c6aa44961e 100644 --- a/server/channels/api4/plugin.go +++ b/server/channels/api4/plugin.go @@ -13,10 +13,10 @@ import ( "github.com/pkg/errors" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/audit" - "github.com/mattermost/mattermost-server/v6/server/channels/store" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/audit" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) const ( diff --git a/server/channels/api4/plugin_test.go b/server/channels/api4/plugin_test.go index 24c0d5d483..8a923d1d0c 100644 --- a/server/channels/api4/plugin_test.go +++ b/server/channels/api4/plugin_test.go @@ -22,10 +22,10 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/plugin" - "github.com/mattermost/mattermost-server/v6/server/channels/testlib" - "github.com/mattermost/mattermost-server/v6/server/channels/utils/fileutils" + "github.com/mattermost/mattermost-server/server/v8/channels/testlib" + "github.com/mattermost/mattermost-server/server/v8/channels/utils/fileutils" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/plugin" ) func TestPlugin(t *testing.T) { @@ -76,24 +76,6 @@ func TestPlugin(t *testing.T) { _, err = client.RemovePlugin(manifest.Id) require.NoError(t, err) - t.Run("install plugin from URL with slow response time", func(t *testing.T) { - if testing.Short() { - t.Skip("skipping test to install plugin from a slow response server") - } - - // Install from URL - slow server to simulate longer bundle download times - slowTestServer := httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { - time.Sleep(60 * time.Second) // Wait longer than the previous default 30 seconds timeout - res.WriteHeader(http.StatusOK) - res.Write(tarData) - })) - defer func() { slowTestServer.Close() }() - - manifest, _, err = client.InstallPluginFromURL(slowTestServer.URL, true) - require.NoError(t, err) - assert.Equal(t, "testplugin", manifest.Id) - }) - th.App.Channels().RemovePlugin(manifest.Id) th.App.UpdateConfig(func(cfg *model.Config) { *cfg.PluginSettings.Enable = false }) @@ -121,6 +103,7 @@ func TestPlugin(t *testing.T) { // Successful upload manifest, _, err = client.UploadPlugin(bytes.NewReader(tarData)) require.NoError(t, err) + assert.Equal(t, "testplugin", manifest.Id) th.App.UpdateConfig(func(cfg *model.Config) { *cfg.PluginSettings.EnableUploads = true }) @@ -1652,6 +1635,59 @@ func TestInstallMarketplacePlugin(t *testing.T) { require.Nil(t, manifest) assert.True(t, requestHandled) }, "verify EnterprisePlugins is true for E20") +} + +func TestInstallMarketplacePluginPrepackagedDisabled(t *testing.T) { + path, _ := fileutils.FindDir("tests") + + signatureFilename := "testplugin2.tar.gz.sig" + signatureFileReader, err := os.Open(filepath.Join(path, signatureFilename)) + require.NoError(t, err) + sigFile, err := io.ReadAll(signatureFileReader) + require.NoError(t, err) + pluginSignature := base64.StdEncoding.EncodeToString(sigFile) + + tarData, err := os.ReadFile(filepath.Join(path, "testplugin2.tar.gz")) + require.NoError(t, err) + pluginServer := httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + res.WriteHeader(http.StatusOK) + res.Write(tarData) + })) + defer pluginServer.Close() + + samplePlugins := []*model.MarketplacePlugin{ + { + BaseMarketplacePlugin: &model.BaseMarketplacePlugin{ + HomepageURL: "https://example.com/mattermost/mattermost-plugin-nps", + IconData: "https://example.com/icon.svg", + DownloadURL: pluginServer.URL, + Manifest: &model.Manifest{ + Id: "testplugin2", + Name: "testplugin2", + Description: "a second plugin", + Version: "1.2.2", + MinServerVersion: "", + }, + }, + InstalledVersion: "", + }, + { + BaseMarketplacePlugin: &model.BaseMarketplacePlugin{ + HomepageURL: "https://example.com/mattermost/mattermost-plugin-nps", + IconData: "https://example.com/icon.svg", + DownloadURL: pluginServer.URL, + Manifest: &model.Manifest{ + Id: "testplugin2", + Name: "testplugin2", + Description: "a second plugin", + Version: "1.2.3", + MinServerVersion: "", + }, + Signature: pluginSignature, + }, + InstalledVersion: "", + }, + } t.Run("install prepackaged and remote plugins through marketplace", func(t *testing.T) { prepackagedPluginsDir := "prepackaged_plugins" @@ -1669,13 +1705,13 @@ func TestInstallMarketplacePlugin(t *testing.T) { err = testlib.CopyFile(filepath.Join(path, "testplugin.tar.gz.asc"), filepath.Join(prepackagedPluginsDir, "testplugin.tar.gz.sig")) require.NoError(t, err) - th2 := SetupConfig(t, func(cfg *model.Config) { + th := SetupConfig(t, func(cfg *model.Config) { // Disable auto-installing prepackaged plugins *cfg.PluginSettings.AutomaticPrepackagedPlugins = false }).InitBasic() - defer th2.TearDown() + defer th.TearDown() - th2.TestForSystemAdminAndLocal(t, func(t *testing.T, client *model.Client4) { + th.TestForSystemAdminAndLocal(t, func(t *testing.T, client *model.Client4) { pluginSignatureFile, err := os.Open(filepath.Join(path, "testplugin.tar.gz.asc")) require.NoError(t, err) pluginSignatureData, err := io.ReadAll(pluginSignatureFile) @@ -1683,113 +1719,161 @@ func TestInstallMarketplacePlugin(t *testing.T) { key, err := os.Open(filepath.Join(path, "development-private-key.asc")) require.NoError(t, err) - appErr := th2.App.AddPublicKey("pub_key", key) + appErr := th.App.AddPublicKey("pub_key", key) require.Nil(t, appErr) + t.Cleanup(func() { + appErr = th.App.DeletePublicKey("pub_key") + require.Nil(t, appErr) + }) + testServer := httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { serverVersion := req.URL.Query().Get("server_version") require.NotEmpty(t, serverVersion) require.Equal(t, model.CurrentVersion, serverVersion) res.WriteHeader(http.StatusOK) + var out []byte - out, err = json.Marshal([]*model.MarketplacePlugin{samplePlugins[1]}) - require.NoError(t, err) + + // Return something if testplugin2 or no specific plugin is requested + pluginID := req.URL.Query().Get("plugin_id") + if pluginID == "" || pluginID == samplePlugins[1].Manifest.Id { + out, err = json.Marshal([]*model.MarketplacePlugin{samplePlugins[1]}) + require.NoError(t, err) + } + res.Write(out) })) defer testServer.Close() - th2.App.UpdateConfig(func(cfg *model.Config) { + th.App.UpdateConfig(func(cfg *model.Config) { *cfg.PluginSettings.EnableMarketplace = true *cfg.PluginSettings.EnableRemoteMarketplace = false *cfg.PluginSettings.MarketplaceURL = testServer.URL *cfg.PluginSettings.AllowInsecureDownloadURL = false }) - env := th2.App.GetPluginsEnvironment() + env := th.App.GetPluginsEnvironment() pluginsResp, _, err := client.GetPlugins() require.NoError(t, err) require.Len(t, pluginsResp.Active, 0) require.Len(t, pluginsResp.Inactive, 0) - // Should fail to install unknown prepackaged plugin - pRequest := &model.InstallMarketplacePluginRequest{Id: "testpluginXX"} - manifest, resp, err := client.InstallMarketplacePlugin(pRequest) - require.Error(t, err) - CheckInternalErrorStatus(t, resp) - require.Nil(t, manifest) + t.Run("Should fail to install unknown prepackaged plugin", func(t *testing.T) { + pRequest := &model.InstallMarketplacePluginRequest{Id: "testpluginXX"} + manifest, resp, err := client.InstallMarketplacePlugin(pRequest) + require.Error(t, err) + CheckInternalErrorStatus(t, resp) + require.Nil(t, manifest) - plugins := env.PrepackagedPlugins() - require.Len(t, plugins, 1) - require.Equal(t, "testplugin", plugins[0].Manifest.Id) - require.Equal(t, pluginSignatureData, plugins[0].Signature) + plugins := env.PrepackagedPlugins() + require.Len(t, plugins, 1) + require.Equal(t, "testplugin", plugins[0].Manifest.Id) + require.Equal(t, pluginSignatureData, plugins[0].Signature) - pluginsResp, _, err = client.GetPlugins() - require.NoError(t, err) - require.Len(t, pluginsResp.Active, 0) - require.Len(t, pluginsResp.Inactive, 0) + pluginsResp, _, err = client.GetPlugins() + require.NoError(t, err) + require.Len(t, pluginsResp.Active, 0) + require.Len(t, pluginsResp.Inactive, 0) + }) - pRequest = &model.InstallMarketplacePluginRequest{Id: "testplugin"} - manifest1, _, err := client.InstallMarketplacePlugin(pRequest) - require.NoError(t, err) - require.NotNil(t, manifest1) - require.Equal(t, "testplugin", manifest1.Id) - require.Equal(t, "0.0.1", manifest1.Version) + t.Run("Install prepackaged plugin with Marketplace disabled", func(t *testing.T) { + pRequest := &model.InstallMarketplacePluginRequest{Id: "testplugin"} + manifest, _, err := client.InstallMarketplacePlugin(pRequest) + require.NoError(t, err) + require.NotNil(t, manifest) + require.Equal(t, "testplugin", manifest.Id) + require.Equal(t, "0.0.1", manifest.Version) - pluginsResp, _, err = client.GetPlugins() - require.NoError(t, err) - require.Len(t, pluginsResp.Active, 0) - require.Equal(t, pluginsResp.Inactive, []*model.PluginInfo{{ - Manifest: *manifest1, - }}) + t.Cleanup(func() { + _, err = client.RemovePlugin(manifest.Id) + require.NoError(t, err) + }) - // Try to install remote marketplace plugin - pRequest = &model.InstallMarketplacePluginRequest{Id: "testplugin2"} - manifest, resp, err = client.InstallMarketplacePlugin(pRequest) - require.Error(t, err) - CheckInternalErrorStatus(t, resp) - require.Nil(t, manifest) + pluginsResp, _, err = client.GetPlugins() + require.NoError(t, err) + require.Len(t, pluginsResp.Active, 0) + require.Equal(t, pluginsResp.Inactive, []*model.PluginInfo{{ + Manifest: *manifest, + }}) + }) + + t.Run("Try to install remote marketplace plugin while Marketplace is disabled", func(t *testing.T) { + pRequest := &model.InstallMarketplacePluginRequest{Id: "testplugin2"} + manifest, resp, err := client.InstallMarketplacePlugin(pRequest) + require.Error(t, err) + CheckInternalErrorStatus(t, resp) + require.Nil(t, manifest) + }) // Enable remote marketplace - th2.App.UpdateConfig(func(cfg *model.Config) { + th.App.UpdateConfig(func(cfg *model.Config) { *cfg.PluginSettings.EnableMarketplace = true *cfg.PluginSettings.EnableRemoteMarketplace = true *cfg.PluginSettings.MarketplaceURL = testServer.URL *cfg.PluginSettings.AllowInsecureDownloadURL = true }) - pRequest = &model.InstallMarketplacePluginRequest{Id: "testplugin2"} - manifest2, _, err := client.InstallMarketplacePlugin(pRequest) - require.NoError(t, err) - require.NotNil(t, manifest2) - require.Equal(t, "testplugin2", manifest2.Id) - require.Equal(t, "1.2.3", manifest2.Version) + t.Run("Install prepackaged, not listed plugin with Marketplace enabled", func(t *testing.T) { + pRequest := &model.InstallMarketplacePluginRequest{Id: "testplugin"} + manifest, _, err := client.InstallMarketplacePlugin(pRequest) + require.NoError(t, err) - pluginsResp, _, err = client.GetPlugins() - require.NoError(t, err) - require.Len(t, pluginsResp.Active, 0) - require.ElementsMatch(t, pluginsResp.Inactive, []*model.PluginInfo{ - { - Manifest: *manifest1, - }, - { - Manifest: *manifest2, - }, + t.Cleanup(func() { + _, err = client.RemovePlugin(manifest.Id) + require.NoError(t, err) + }) + + require.NotNil(t, manifest) + assert.Equal(t, "testplugin", manifest.Id) + assert.Equal(t, "0.0.1", manifest.Version) }) - // Clean up - _, err = client.RemovePlugin(manifest1.Id) - require.NoError(t, err) + t.Run("Install both a prepacked and a Marketplace plugin", func(t *testing.T) { + pRequest := &model.InstallMarketplacePluginRequest{Id: "testplugin"} + manifest1, _, err := client.InstallMarketplacePlugin(pRequest) + require.NoError(t, err) + require.NotNil(t, manifest1) + assert.Equal(t, "testplugin", manifest1.Id) + assert.Equal(t, "0.0.1", manifest1.Version) - _, err = client.RemovePlugin(manifest2.Id) - require.NoError(t, err) + t.Cleanup(func() { + _, err = client.RemovePlugin(manifest1.Id) + require.NoError(t, err) + }) - appErr = th2.App.DeletePublicKey("pub_key") + pRequest = &model.InstallMarketplacePluginRequest{Id: "testplugin2"} + manifest2, _, err := client.InstallMarketplacePlugin(pRequest) + require.NoError(t, err) + require.NotNil(t, manifest2) + require.Equal(t, "testplugin2", manifest2.Id) + require.Equal(t, "1.2.3", manifest2.Version) + + t.Cleanup(func() { + _, err = client.RemovePlugin(manifest2.Id) + require.NoError(t, err) + }) + + pluginsResp, _, err = client.GetPlugins() + require.NoError(t, err) + require.Len(t, pluginsResp.Active, 0) + require.ElementsMatch(t, pluginsResp.Inactive, []*model.PluginInfo{ + { + Manifest: *manifest1, + }, + { + Manifest: *manifest2, + }, + }) + }) + + appErr = th.App.DeletePublicKey("pub_key") require.Nil(t, appErr) }) }) - th.TestForSystemAdminAndLocal(t, func(t *testing.T, client *model.Client4) { + t.Run("missing prepackaged and remote plugin signatures", func(t *testing.T) { prepackagedPluginsDir := "prepackaged_plugins" os.RemoveAll(prepackagedPluginsDir) @@ -1809,70 +1893,72 @@ func TestInstallMarketplacePlugin(t *testing.T) { }).InitBasic() defer th.TearDown() - key, err := os.Open(filepath.Join(path, "development-private-key.asc")) - require.NoError(t, err) - appErr := th.App.AddPublicKey("pub_key", key) - require.Nil(t, appErr) - - testServer := httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { - serverVersion := req.URL.Query().Get("server_version") - require.NotEmpty(t, serverVersion) - require.Equal(t, model.CurrentVersion, serverVersion) - - mPlugins := []*model.MarketplacePlugin{samplePlugins[0]} - require.Empty(t, mPlugins[0].Signature) - res.WriteHeader(http.StatusOK) - var out []byte - out, err = json.Marshal(mPlugins) + th.TestForSystemAdminAndLocal(t, func(t *testing.T, client *model.Client4) { + key, err := os.Open(filepath.Join(path, "development-private-key.asc")) require.NoError(t, err) - res.Write(out) - })) - defer testServer.Close() + appErr := th.App.AddPublicKey("pub_key", key) + require.Nil(t, appErr) - th.App.UpdateConfig(func(cfg *model.Config) { - *cfg.PluginSettings.EnableMarketplace = true - *cfg.PluginSettings.EnableRemoteMarketplace = true - *cfg.PluginSettings.MarketplaceURL = testServer.URL - *cfg.PluginSettings.AllowInsecureDownloadURL = true + testServer := httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + serverVersion := req.URL.Query().Get("server_version") + require.NotEmpty(t, serverVersion) + require.Equal(t, model.CurrentVersion, serverVersion) + + mPlugins := []*model.MarketplacePlugin{samplePlugins[0]} + require.Empty(t, mPlugins[0].Signature) + res.WriteHeader(http.StatusOK) + var out []byte + out, err = json.Marshal(mPlugins) + require.NoError(t, err) + res.Write(out) + })) + defer testServer.Close() + + th.App.UpdateConfig(func(cfg *model.Config) { + *cfg.PluginSettings.EnableMarketplace = true + *cfg.PluginSettings.EnableRemoteMarketplace = true + *cfg.PluginSettings.MarketplaceURL = testServer.URL + *cfg.PluginSettings.AllowInsecureDownloadURL = true + }) + + env := th.App.GetPluginsEnvironment() + plugins := env.PrepackagedPlugins() + require.Len(t, plugins, 1) + require.Equal(t, "testplugin", plugins[0].Manifest.Id) + require.Empty(t, plugins[0].Signature) + + pluginsResp, _, err := client.GetPlugins() + require.NoError(t, err) + require.Len(t, pluginsResp.Active, 0) + require.Len(t, pluginsResp.Inactive, 0) + + pRequest := &model.InstallMarketplacePluginRequest{Id: "testplugin"} + manifest, resp, err := client.InstallMarketplacePlugin(pRequest) + require.Error(t, err) + CheckInternalErrorStatus(t, resp) + require.Nil(t, manifest) + + pluginsResp, _, err = client.GetPlugins() + require.NoError(t, err) + require.Len(t, pluginsResp.Active, 0) + require.Len(t, pluginsResp.Inactive, 0) + + pRequest = &model.InstallMarketplacePluginRequest{Id: "testplugin2"} + manifest, resp, err = client.InstallMarketplacePlugin(pRequest) + require.Error(t, err) + CheckInternalErrorStatus(t, resp) + require.Nil(t, manifest) + + pluginsResp, _, err = client.GetPlugins() + require.NoError(t, err) + require.Len(t, pluginsResp.Active, 0) + require.Len(t, pluginsResp.Inactive, 0) + + // Clean up + appErr = th.App.DeletePublicKey("pub_key") + require.Nil(t, appErr) }) - - env := th.App.GetPluginsEnvironment() - plugins := env.PrepackagedPlugins() - require.Len(t, plugins, 1) - require.Equal(t, "testplugin", plugins[0].Manifest.Id) - require.Empty(t, plugins[0].Signature) - - pluginsResp, _, err := client.GetPlugins() - require.NoError(t, err) - require.Len(t, pluginsResp.Active, 0) - require.Len(t, pluginsResp.Inactive, 0) - - pRequest := &model.InstallMarketplacePluginRequest{Id: "testplugin"} - manifest, resp, err := client.InstallMarketplacePlugin(pRequest) - require.Error(t, err) - CheckInternalErrorStatus(t, resp) - require.Nil(t, manifest) - - pluginsResp, _, err = client.GetPlugins() - require.NoError(t, err) - require.Len(t, pluginsResp.Active, 0) - require.Len(t, pluginsResp.Inactive, 0) - - pRequest = &model.InstallMarketplacePluginRequest{Id: "testplugin2"} - manifest, resp, err = client.InstallMarketplacePlugin(pRequest) - require.Error(t, err) - CheckInternalErrorStatus(t, resp) - require.Nil(t, manifest) - - pluginsResp, _, err = client.GetPlugins() - require.NoError(t, err) - require.Len(t, pluginsResp.Active, 0) - require.Len(t, pluginsResp.Inactive, 0) - - // Clean up - appErr = th.App.DeletePublicKey("pub_key") - require.Nil(t, appErr) - }, "missing prepackaged and remote plugin signatures") + }) } func findClusterMessages(event model.ClusterEvent, msgs []*model.ClusterMessage) []*model.ClusterMessage { diff --git a/server/channels/api4/post.go b/server/channels/api4/post.go index 1588a3b913..8690aa4e32 100644 --- a/server/channels/api4/post.go +++ b/server/channels/api4/post.go @@ -9,11 +9,11 @@ import ( "strconv" "time" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/app" - "github.com/mattermost/mattermost-server/v6/server/channels/audit" - "github.com/mattermost/mattermost-server/v6/server/channels/web" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/app" + "github.com/mattermost/mattermost-server/server/v8/channels/audit" + "github.com/mattermost/mattermost-server/server/v8/channels/web" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) func (api *API) InitPost() { diff --git a/server/channels/api4/post_test.go b/server/channels/api4/post_test.go index fd480eb5d9..8ab88fefff 100644 --- a/server/channels/api4/post_test.go +++ b/server/channels/api4/post_test.go @@ -21,13 +21,13 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/plugin/plugintest/mock" - "github.com/mattermost/mattermost-server/v6/server/channels/app" - "github.com/mattermost/mattermost-server/v6/server/channels/store/storetest/mocks" - "github.com/mattermost/mattermost-server/v6/server/channels/utils" - "github.com/mattermost/mattermost-server/v6/server/channels/utils/testutils" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/app" + "github.com/mattermost/mattermost-server/server/v8/channels/store/storetest/mocks" + "github.com/mattermost/mattermost-server/server/v8/channels/utils" + "github.com/mattermost/mattermost-server/server/v8/channels/utils/testutils" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/plugin/plugintest/mock" ) func TestCreatePost(t *testing.T) { @@ -452,32 +452,68 @@ func testCreatePostWithOutgoingHook( } func TestCreatePostWithOutgoingHook_form_urlencoded(t *testing.T) { - testCreatePostWithOutgoingHook(t, "application/x-www-form-urlencoded", "application/x-www-form-urlencoded", "triggerword lorem ipsum", "triggerword", []string{"file_id_1"}, app.TriggerwordsExactMatch, false) - testCreatePostWithOutgoingHook(t, "application/x-www-form-urlencoded", "application/x-www-form-urlencoded", "triggerwordaaazzz lorem ipsum", "triggerword", []string{"file_id_1"}, app.TriggerwordsStartsWith, false) - testCreatePostWithOutgoingHook(t, "application/x-www-form-urlencoded", "application/x-www-form-urlencoded", "", "", []string{"file_id_1"}, app.TriggerwordsExactMatch, false) - testCreatePostWithOutgoingHook(t, "application/x-www-form-urlencoded", "application/x-www-form-urlencoded", "", "", []string{"file_id_1"}, app.TriggerwordsStartsWith, false) - testCreatePostWithOutgoingHook(t, "application/x-www-form-urlencoded", "application/x-www-form-urlencoded", "triggerword lorem ipsum", "triggerword", []string{"file_id_1"}, app.TriggerwordsExactMatch, true) - testCreatePostWithOutgoingHook(t, "application/x-www-form-urlencoded", "application/x-www-form-urlencoded", "triggerwordaaazzz lorem ipsum", "triggerword", []string{"file_id_1"}, app.TriggerwordsStartsWith, true) + t.Run("Case 1", func(t *testing.T) { + testCreatePostWithOutgoingHook(t, "application/x-www-form-urlencoded", "application/x-www-form-urlencoded", "triggerword lorem ipsum", "triggerword", []string{"file_id_1"}, app.TriggerwordsExactMatch, false) + }) + t.Run("Case 2", func(t *testing.T) { + testCreatePostWithOutgoingHook(t, "application/x-www-form-urlencoded", "application/x-www-form-urlencoded", "triggerwordaaazzz lorem ipsum", "triggerword", []string{"file_id_1"}, app.TriggerwordsStartsWith, false) + }) + t.Run("Case 3", func(t *testing.T) { + testCreatePostWithOutgoingHook(t, "application/x-www-form-urlencoded", "application/x-www-form-urlencoded", "", "", []string{"file_id_1"}, app.TriggerwordsExactMatch, false) + }) + t.Run("Case 4", func(t *testing.T) { + testCreatePostWithOutgoingHook(t, "application/x-www-form-urlencoded", "application/x-www-form-urlencoded", "", "", []string{"file_id_1"}, app.TriggerwordsStartsWith, false) + }) + t.Run("Case 5", func(t *testing.T) { + testCreatePostWithOutgoingHook(t, "application/x-www-form-urlencoded", "application/x-www-form-urlencoded", "triggerword lorem ipsum", "triggerword", []string{"file_id_1"}, app.TriggerwordsExactMatch, true) + }) + t.Run("Case 6", func(t *testing.T) { + testCreatePostWithOutgoingHook(t, "application/x-www-form-urlencoded", "application/x-www-form-urlencoded", "triggerwordaaazzz lorem ipsum", "triggerword", []string{"file_id_1"}, app.TriggerwordsStartsWith, true) + }) } func TestCreatePostWithOutgoingHook_json(t *testing.T) { - testCreatePostWithOutgoingHook(t, "application/json", "application/json", "triggerword lorem ipsum", "triggerword", []string{"file_id_1, file_id_2"}, app.TriggerwordsExactMatch, false) - testCreatePostWithOutgoingHook(t, "application/json", "application/json", "triggerwordaaazzz lorem ipsum", "triggerword", []string{"file_id_1, file_id_2"}, app.TriggerwordsStartsWith, false) - testCreatePostWithOutgoingHook(t, "application/json", "application/json", "triggerword lorem ipsum", "", []string{"file_id_1"}, app.TriggerwordsExactMatch, false) - testCreatePostWithOutgoingHook(t, "application/json", "application/json", "triggerwordaaazzz lorem ipsum", "", []string{"file_id_1"}, app.TriggerwordsStartsWith, false) - testCreatePostWithOutgoingHook(t, "application/json", "application/json", "triggerword lorem ipsum", "triggerword", []string{"file_id_1, file_id_2"}, app.TriggerwordsExactMatch, true) - testCreatePostWithOutgoingHook(t, "application/json", "application/json", "triggerwordaaazzz lorem ipsum", "", []string{"file_id_1"}, app.TriggerwordsStartsWith, true) + t.Run("Case 1", func(t *testing.T) { + testCreatePostWithOutgoingHook(t, "application/json", "application/json", "triggerword lorem ipsum", "triggerword", []string{"file_id_1, file_id_2"}, app.TriggerwordsExactMatch, false) + }) + t.Run("Case 2", func(t *testing.T) { + testCreatePostWithOutgoingHook(t, "application/json", "application/json", "triggerwordaaazzz lorem ipsum", "triggerword", []string{"file_id_1, file_id_2"}, app.TriggerwordsStartsWith, false) + }) + t.Run("Case 3", func(t *testing.T) { + testCreatePostWithOutgoingHook(t, "application/json", "application/json", "triggerword lorem ipsum", "", []string{"file_id_1"}, app.TriggerwordsExactMatch, false) + }) + t.Run("Case 4", func(t *testing.T) { + testCreatePostWithOutgoingHook(t, "application/json", "application/json", "triggerwordaaazzz lorem ipsum", "", []string{"file_id_1"}, app.TriggerwordsStartsWith, false) + }) + t.Run("Case 5", func(t *testing.T) { + testCreatePostWithOutgoingHook(t, "application/json", "application/json", "triggerword lorem ipsum", "triggerword", []string{"file_id_1, file_id_2"}, app.TriggerwordsExactMatch, true) + }) + t.Run("Case 6", func(t *testing.T) { + testCreatePostWithOutgoingHook(t, "application/json", "application/json", "triggerwordaaazzz lorem ipsum", "", []string{"file_id_1"}, app.TriggerwordsStartsWith, true) + }) } // hooks created before we added the ContentType field should be considered as // application/x-www-form-urlencoded func TestCreatePostWithOutgoingHook_no_content_type(t *testing.T) { - testCreatePostWithOutgoingHook(t, "", "application/x-www-form-urlencoded", "triggerword lorem ipsum", "triggerword", []string{"file_id_1"}, app.TriggerwordsExactMatch, false) - testCreatePostWithOutgoingHook(t, "", "application/x-www-form-urlencoded", "triggerwordaaazzz lorem ipsum", "triggerword", []string{"file_id_1"}, app.TriggerwordsStartsWith, false) - testCreatePostWithOutgoingHook(t, "", "application/x-www-form-urlencoded", "triggerword lorem ipsum", "", []string{"file_id_1, file_id_2"}, app.TriggerwordsExactMatch, false) - testCreatePostWithOutgoingHook(t, "", "application/x-www-form-urlencoded", "triggerwordaaazzz lorem ipsum", "", []string{"file_id_1, file_id_2"}, app.TriggerwordsStartsWith, false) - testCreatePostWithOutgoingHook(t, "", "application/x-www-form-urlencoded", "triggerword lorem ipsum", "triggerword", []string{"file_id_1"}, app.TriggerwordsExactMatch, true) - testCreatePostWithOutgoingHook(t, "", "application/x-www-form-urlencoded", "triggerword lorem ipsum", "", []string{"file_id_1, file_id_2"}, app.TriggerwordsExactMatch, true) + t.Run("Case 1", func(t *testing.T) { + testCreatePostWithOutgoingHook(t, "", "application/x-www-form-urlencoded", "triggerword lorem ipsum", "triggerword", []string{"file_id_1"}, app.TriggerwordsExactMatch, false) + }) + t.Run("Case 2", func(t *testing.T) { + testCreatePostWithOutgoingHook(t, "", "application/x-www-form-urlencoded", "triggerwordaaazzz lorem ipsum", "triggerword", []string{"file_id_1"}, app.TriggerwordsStartsWith, false) + }) + t.Run("Case 3", func(t *testing.T) { + testCreatePostWithOutgoingHook(t, "", "application/x-www-form-urlencoded", "triggerword lorem ipsum", "", []string{"file_id_1, file_id_2"}, app.TriggerwordsExactMatch, false) + }) + t.Run("Case 4", func(t *testing.T) { + testCreatePostWithOutgoingHook(t, "", "application/x-www-form-urlencoded", "triggerwordaaazzz lorem ipsum", "", []string{"file_id_1, file_id_2"}, app.TriggerwordsStartsWith, false) + }) + t.Run("Case 5", func(t *testing.T) { + testCreatePostWithOutgoingHook(t, "", "application/x-www-form-urlencoded", "triggerword lorem ipsum", "triggerword", []string{"file_id_1"}, app.TriggerwordsExactMatch, true) + }) + t.Run("Case 6", func(t *testing.T) { + testCreatePostWithOutgoingHook(t, "", "application/x-www-form-urlencoded", "triggerword lorem ipsum", "", []string{"file_id_1, file_id_2"}, app.TriggerwordsExactMatch, true) + }) } func TestCreatePostPublic(t *testing.T) { @@ -1541,6 +1577,12 @@ func TestGetFlaggedPostsForUser(t *testing.T) { mockStore.On("License").Return(th.App.Srv().Store().License()) mockStore.On("Role").Return(th.App.Srv().Store().Role()) mockStore.On("Close").Return(nil) + + // Playbooks DB job requires a plugin mock + pluginStore := mocks.PluginStore{} + pluginStore.On("List", mock.Anything, mock.Anything, mock.Anything).Return([]string{}, nil) + mockStore.On("Plugin").Return(&pluginStore) + th.App.Srv().SetStore(&mockStore) _, resp, err = th.SystemAdminClient.GetFlaggedPostsForUser(user.Id, 0, 10) @@ -3193,6 +3235,7 @@ func TestGetEditHistoryForPost(t *testing.T) { func TestCreatePostNotificationsWithCRT(t *testing.T) { th := Setup(t).InitBasic() + defer th.TearDown() rpost := th.CreatePost() th.App.UpdateConfig(func(cfg *model.Config) { diff --git a/server/channels/api4/preference.go b/server/channels/api4/preference.go index fa522de844..4483e00c22 100644 --- a/server/channels/api4/preference.go +++ b/server/channels/api4/preference.go @@ -7,9 +7,9 @@ import ( "encoding/json" "net/http" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/audit" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/audit" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) func (api *API) InitPreference() { diff --git a/server/channels/api4/preference_test.go b/server/channels/api4/preference_test.go index 8f70c00445..b270995099 100644 --- a/server/channels/api4/preference_test.go +++ b/server/channels/api4/preference_test.go @@ -11,7 +11,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestGetPreferences(t *testing.T) { diff --git a/server/channels/api4/reaction.go b/server/channels/api4/reaction.go index b2b65892a1..b58a71e8f9 100644 --- a/server/channels/api4/reaction.go +++ b/server/channels/api4/reaction.go @@ -7,8 +7,8 @@ import ( "encoding/json" "net/http" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) func (api *API) InitReaction() { diff --git a/server/channels/api4/reaction_test.go b/server/channels/api4/reaction_test.go index 21aeaa3b0e..45d3aab9a3 100644 --- a/server/channels/api4/reaction_test.go +++ b/server/channels/api4/reaction_test.go @@ -10,7 +10,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestSaveReaction(t *testing.T) { diff --git a/server/channels/api4/remote_cluster.go b/server/channels/api4/remote_cluster.go index f469da5a60..75783f0c98 100644 --- a/server/channels/api4/remote_cluster.go +++ b/server/channels/api4/remote_cluster.go @@ -9,11 +9,11 @@ import ( "net/http" "time" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/app" - "github.com/mattermost/mattermost-server/v6/server/channels/audit" - "github.com/mattermost/mattermost-server/v6/server/platform/services/remotecluster" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/app" + "github.com/mattermost/mattermost-server/server/v8/channels/audit" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/services/remotecluster" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) func (api *API) InitRemoteCluster() { diff --git a/server/channels/api4/resolver.go b/server/channels/api4/resolver.go index 7148325e61..1ebbcf04dd 100644 --- a/server/channels/api4/resolver.go +++ b/server/channels/api4/resolver.go @@ -10,10 +10,10 @@ import ( "github.com/graph-gophers/dataloader/v6" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/app" - "github.com/mattermost/mattermost-server/v6/server/channels/store" - "github.com/mattermost/mattermost-server/v6/server/channels/web" + "github.com/mattermost/mattermost-server/server/v8/channels/app" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/web" + "github.com/mattermost/mattermost-server/server/v8/model" ) // cursorPrefix is used to categorize objects @@ -353,9 +353,12 @@ func (*resolver) SidebarCategories(ctx context.Context, args struct { return nil, appErr } } else { + appsCategoryEnabled := c.App.Config().FeatureFlags.AppsSidebarCategory + opts := &store.SidebarCategorySearchOpts{ - TeamID: args.TeamID, - ExcludeTeam: args.ExcludeTeam, + TeamID: args.TeamID, + ExcludeTeam: args.ExcludeTeam, + AppsCategoryEnabled: appsCategoryEnabled, } categories, appErr = c.App.GetSidebarCategories(c.AppContext, args.UserID, opts) if appErr != nil { diff --git a/server/channels/api4/resolver_channel.go b/server/channels/api4/resolver_channel.go index 1061102b2d..0650248131 100644 --- a/server/channels/api4/resolver_channel.go +++ b/server/channels/api4/resolver_channel.go @@ -10,8 +10,8 @@ import ( "sort" "strings" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/web" + "github.com/mattermost/mattermost-server/server/v8/channels/web" + "github.com/mattermost/mattermost-server/server/v8/model" ) // channel is an internal graphQL wrapper struct to add resolver methods. diff --git a/server/channels/api4/resolver_channel_member.go b/server/channels/api4/resolver_channel_member.go index 22d6a2c380..e26aaca041 100644 --- a/server/channels/api4/resolver_channel_member.go +++ b/server/channels/api4/resolver_channel_member.go @@ -11,8 +11,8 @@ import ( "github.com/graph-gophers/dataloader/v6" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/web" + "github.com/mattermost/mattermost-server/server/v8/channels/web" + "github.com/mattermost/mattermost-server/server/v8/model" ) // channelMember is an internal graphQL wrapper struct to add resolver methods. diff --git a/server/channels/api4/resolver_channel_member_test.go b/server/channels/api4/resolver_channel_member_test.go index fc55454516..e1c5cc9699 100644 --- a/server/channels/api4/resolver_channel_member_test.go +++ b/server/channels/api4/resolver_channel_member_test.go @@ -11,7 +11,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestGraphQLChannelMembers(t *testing.T) { diff --git a/server/channels/api4/resolver_channel_test.go b/server/channels/api4/resolver_channel_test.go index 891d476393..6d1b535568 100644 --- a/server/channels/api4/resolver_channel_test.go +++ b/server/channels/api4/resolver_channel_test.go @@ -11,7 +11,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestGraphQLChannels(t *testing.T) { diff --git a/server/channels/api4/resolver_sidebar_categories_test.go b/server/channels/api4/resolver_sidebar_categories_test.go index a0882a88f5..5d4b3ee691 100644 --- a/server/channels/api4/resolver_sidebar_categories_test.go +++ b/server/channels/api4/resolver_sidebar_categories_test.go @@ -12,7 +12,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestGraphQLSidebarCategories(t *testing.T) { diff --git a/server/channels/api4/resolver_team.go b/server/channels/api4/resolver_team.go index 42ac606e2f..a94be2cc5a 100644 --- a/server/channels/api4/resolver_team.go +++ b/server/channels/api4/resolver_team.go @@ -9,8 +9,8 @@ import ( "github.com/graph-gophers/dataloader/v6" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/web" + "github.com/mattermost/mattermost-server/server/v8/channels/web" + "github.com/mattermost/mattermost-server/server/v8/model" ) func getGraphQLTeam(ctx context.Context, id string) (*model.Team, error) { diff --git a/server/channels/api4/resolver_team_member.go b/server/channels/api4/resolver_team_member.go index 0da4656aab..3036a4d146 100644 --- a/server/channels/api4/resolver_team_member.go +++ b/server/channels/api4/resolver_team_member.go @@ -9,7 +9,7 @@ import ( "github.com/graph-gophers/dataloader/v6" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) // teamMember is an internal graphQL wrapper struct to add resolver methods. diff --git a/server/channels/api4/resolver_team_member_test.go b/server/channels/api4/resolver_team_member_test.go index 95d003df8e..42b7c9efe1 100644 --- a/server/channels/api4/resolver_team_member_test.go +++ b/server/channels/api4/resolver_team_member_test.go @@ -12,7 +12,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestGraphQLTeamMembers(t *testing.T) { diff --git a/server/channels/api4/resolver_test.go b/server/channels/api4/resolver_test.go index 7911154c08..17eba4b864 100644 --- a/server/channels/api4/resolver_test.go +++ b/server/channels/api4/resolver_test.go @@ -11,7 +11,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestGraphQLConfig(t *testing.T) { diff --git a/server/channels/api4/resolver_user.go b/server/channels/api4/resolver_user.go index 5fa364eeb4..588b961e7f 100644 --- a/server/channels/api4/resolver_user.go +++ b/server/channels/api4/resolver_user.go @@ -9,8 +9,8 @@ import ( "github.com/graph-gophers/dataloader/v6" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/web" + "github.com/mattermost/mattermost-server/server/v8/channels/web" + "github.com/mattermost/mattermost-server/server/v8/model" ) // user is an internal graphQL wrapper struct to add resolver methods. diff --git a/server/channels/api4/resolver_user_test.go b/server/channels/api4/resolver_user_test.go index 1a13f819a7..b6104a181d 100644 --- a/server/channels/api4/resolver_user_test.go +++ b/server/channels/api4/resolver_user_test.go @@ -13,7 +13,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestGraphQLUser(t *testing.T) { diff --git a/server/channels/api4/role.go b/server/channels/api4/role.go index b7ca855ef7..40d4527bf9 100644 --- a/server/channels/api4/role.go +++ b/server/channels/api4/role.go @@ -7,9 +7,9 @@ import ( "encoding/json" "net/http" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/audit" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/audit" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) var notAllowedPermissions = []string{ diff --git a/server/channels/api4/role_test.go b/server/channels/api4/role_test.go index 0a1d3145cd..5bc281a21c 100644 --- a/server/channels/api4/role_test.go +++ b/server/channels/api4/role_test.go @@ -12,7 +12,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestGetAllRoles(t *testing.T) { diff --git a/server/channels/api4/saml.go b/server/channels/api4/saml.go index d78b0449f5..4cae4f2d55 100644 --- a/server/channels/api4/saml.go +++ b/server/channels/api4/saml.go @@ -10,9 +10,9 @@ import ( "mime/multipart" "net/http" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/audit" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/audit" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) func (api *API) InitSaml() { diff --git a/server/channels/api4/saml_test.go b/server/channels/api4/saml_test.go index 0ededf5ea4..2d41632fe5 100644 --- a/server/channels/api4/saml_test.go +++ b/server/channels/api4/saml_test.go @@ -9,8 +9,8 @@ import ( "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/einterfaces/mocks" + "github.com/mattermost/mattermost-server/server/v8/channels/einterfaces/mocks" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestGetSamlMetadata(t *testing.T) { diff --git a/server/channels/api4/scheme.go b/server/channels/api4/scheme.go index 7ff94d3e07..85dc095382 100644 --- a/server/channels/api4/scheme.go +++ b/server/channels/api4/scheme.go @@ -7,9 +7,9 @@ import ( "encoding/json" "net/http" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/audit" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/audit" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) func (api *API) InitScheme() { diff --git a/server/channels/api4/scheme_test.go b/server/channels/api4/scheme_test.go index ba478a243e..13e4e631d3 100644 --- a/server/channels/api4/scheme_test.go +++ b/server/channels/api4/scheme_test.go @@ -11,7 +11,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestCreateScheme(t *testing.T) { diff --git a/server/channels/api4/shared_channel.go b/server/channels/api4/shared_channel.go index 5e53ee5f33..8bb40a82d5 100644 --- a/server/channels/api4/shared_channel.go +++ b/server/channels/api4/shared_channel.go @@ -7,7 +7,7 @@ import ( "encoding/json" "net/http" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) func (api *API) InitSharedChannels() { diff --git a/server/channels/api4/shared_channel_test.go b/server/channels/api4/shared_channel_test.go index 0f15f6c965..befe9642b6 100644 --- a/server/channels/api4/shared_channel_test.go +++ b/server/channels/api4/shared_channel_test.go @@ -13,8 +13,8 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/app" + "github.com/mattermost/mattermost-server/server/v8/channels/app" + "github.com/mattermost/mattermost-server/server/v8/model" ) var ( diff --git a/server/channels/api4/status.go b/server/channels/api4/status.go index 8ff7eaa248..62a4c0e7ec 100644 --- a/server/channels/api4/status.go +++ b/server/channels/api4/status.go @@ -7,8 +7,8 @@ import ( "encoding/json" "net/http" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) func (api *API) InitStatus() { diff --git a/server/channels/api4/status_test.go b/server/channels/api4/status_test.go index 61241a5718..bde3e695b4 100644 --- a/server/channels/api4/status_test.go +++ b/server/channels/api4/status_test.go @@ -10,7 +10,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestGetUserStatus(t *testing.T) { diff --git a/server/channels/api4/system.go b/server/channels/api4/system.go index 216533b67f..bb3442ba54 100644 --- a/server/channels/api4/system.go +++ b/server/channels/api4/system.go @@ -17,12 +17,12 @@ import ( "github.com/pkg/errors" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/audit" - "github.com/mattermost/mattermost-server/v6/server/platform/services/cache" - "github.com/mattermost/mattermost-server/v6/server/platform/services/upgrader" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/web" + "github.com/mattermost/mattermost-server/server/v8/channels/audit" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/services/cache" + "github.com/mattermost/mattermost-server/server/v8/platform/services/upgrader" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/web" ) const ( @@ -190,6 +190,8 @@ func getSystemPing(c *Context, w http.ResponseWriter, r *http.Request) { s["CanReceiveNotifications"] = c.App.SendTestPushNotification(deviceID) } + s["ActiveSearchBackend"] = c.App.ActiveSearchBackend() + if s[model.STATUS] != model.StatusOk { w.WriteHeader(http.StatusInternalServerError) } diff --git a/server/channels/api4/system_local.go b/server/channels/api4/system_local.go index dc7508c874..65e6d12b1c 100644 --- a/server/channels/api4/system_local.go +++ b/server/channels/api4/system_local.go @@ -7,8 +7,8 @@ import ( "encoding/json" "net/http" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/audit" + "github.com/mattermost/mattermost-server/server/v8/channels/audit" + "github.com/mattermost/mattermost-server/server/v8/model" ) func (api *API) InitSystemLocal() { diff --git a/server/channels/api4/system_test.go b/server/channels/api4/system_test.go index effce7253d..25574e4400 100644 --- a/server/channels/api4/system_test.go +++ b/server/channels/api4/system_test.go @@ -21,9 +21,9 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/utils/fileutils" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/utils/fileutils" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) func TestGetPing(t *testing.T) { @@ -892,6 +892,7 @@ func TestCompleteOnboarding(t *testing.T) { req := &model.CompleteOnboardingRequest{ InstallPlugins: []string{"testplugin2"}, + Organization: "my-org", } t.Run("as a regular user", func(t *testing.T) { diff --git a/server/channels/api4/team.go b/server/channels/api4/team.go index 0049b47c38..bef7d2223d 100644 --- a/server/channels/api4/team.go +++ b/server/channels/api4/team.go @@ -14,9 +14,9 @@ import ( "strconv" "strings" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/audit" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/audit" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) const ( diff --git a/server/channels/api4/team_local.go b/server/channels/api4/team_local.go index d9b1019ef3..310ea0de84 100644 --- a/server/channels/api4/team_local.go +++ b/server/channels/api4/team_local.go @@ -12,11 +12,11 @@ import ( "github.com/pkg/errors" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/app/email" - "github.com/mattermost/mattermost-server/v6/server/channels/audit" - "github.com/mattermost/mattermost-server/v6/server/channels/store" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/app/email" + "github.com/mattermost/mattermost-server/server/v8/channels/audit" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) func (api *API) InitTeamLocal() { diff --git a/server/channels/api4/team_test.go b/server/channels/api4/team_test.go index f511ffe3f1..e9ae1bea28 100644 --- a/server/channels/api4/team_test.go +++ b/server/channels/api4/team_test.go @@ -17,14 +17,14 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/plugin/plugintest/mock" - "github.com/mattermost/mattermost-server/v6/server/channels/app" - "github.com/mattermost/mattermost-server/v6/server/channels/app/request" - "github.com/mattermost/mattermost-server/v6/server/channels/einterfaces/mocks" - "github.com/mattermost/mattermost-server/v6/server/channels/utils/testutils" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/i18n" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mail" + "github.com/mattermost/mattermost-server/server/v8/channels/app" + "github.com/mattermost/mattermost-server/server/v8/channels/app/request" + "github.com/mattermost/mattermost-server/server/v8/channels/einterfaces/mocks" + "github.com/mattermost/mattermost-server/server/v8/channels/utils/testutils" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/i18n" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mail" + "github.com/mattermost/mattermost-server/server/v8/plugin/plugintest/mock" ) func TestCreateTeam(t *testing.T) { @@ -1173,11 +1173,10 @@ func TestGetAllTeams(t *testing.T) { } var teams []*model.Team - var count int64 var resp *model.Response var err2 error if tc.WithCount { - teams, count, resp, err2 = client.GetAllTeamsWithTotalCount("", tc.Page, tc.PerPage) + teams, _, resp, err2 = client.GetAllTeamsWithTotalCount("", tc.Page, tc.PerPage) } else { teams, resp, err2 = client.GetAllTeams("", tc.Page, tc.PerPage) } @@ -1187,11 +1186,12 @@ func TestGetAllTeams(t *testing.T) { return } require.NoError(t, err2) - require.Equal(t, len(tc.ExpectedTeams), len(teams)) - for idx, team := range teams { - assert.Equal(t, tc.ExpectedTeams[idx], team.Id) + + actualTeamIds := make([]string, 0, len(tc.ExpectedTeams)) + for _, team := range teams { + actualTeamIds = append(actualTeamIds, team.Id) } - require.Equal(t, tc.ExpectedCount, count) + require.ElementsMatch(t, tc.ExpectedTeams, actualTeamIds) }) } diff --git a/server/channels/api4/terms_of_service.go b/server/channels/api4/terms_of_service.go index a5906cc77e..d0d72604f8 100644 --- a/server/channels/api4/terms_of_service.go +++ b/server/channels/api4/terms_of_service.go @@ -7,10 +7,10 @@ import ( "encoding/json" "net/http" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/app" - "github.com/mattermost/mattermost-server/v6/server/channels/audit" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/app" + "github.com/mattermost/mattermost-server/server/v8/channels/audit" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) func (api *API) InitTermsOfService() { diff --git a/server/channels/api4/terms_of_service_test.go b/server/channels/api4/terms_of_service_test.go index e3699d14a4..eac3ed54fe 100644 --- a/server/channels/api4/terms_of_service_test.go +++ b/server/channels/api4/terms_of_service_test.go @@ -9,7 +9,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestGetTermsOfService(t *testing.T) { diff --git a/server/channels/api4/upload.go b/server/channels/api4/upload.go index f94a351149..55850903db 100644 --- a/server/channels/api4/upload.go +++ b/server/channels/api4/upload.go @@ -10,10 +10,10 @@ import ( "mime/multipart" "net/http" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/app" - "github.com/mattermost/mattermost-server/v6/server/channels/audit" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/app" + "github.com/mattermost/mattermost-server/server/v8/channels/audit" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) func (api *API) InitUpload() { diff --git a/server/channels/api4/upload_test.go b/server/channels/api4/upload_test.go index 9606d660bb..9ed6d1eaae 100644 --- a/server/channels/api4/upload_test.go +++ b/server/channels/api4/upload_test.go @@ -14,8 +14,8 @@ import ( "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/utils/fileutils" + "github.com/mattermost/mattermost-server/server/v8/channels/utils/fileutils" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestCreateUpload(t *testing.T) { diff --git a/server/channels/api4/usage.go b/server/channels/api4/usage.go index d39ecbead4..fabf880a32 100644 --- a/server/channels/api4/usage.go +++ b/server/channels/api4/usage.go @@ -7,8 +7,8 @@ import ( "encoding/json" "net/http" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/utils" + "github.com/mattermost/mattermost-server/server/v8/channels/utils" + "github.com/mattermost/mattermost-server/server/v8/model" ) func (api *API) InitUsage() { diff --git a/server/channels/api4/usage_test.go b/server/channels/api4/usage_test.go index a8e93dc9f7..b85b2f0029 100644 --- a/server/channels/api4/usage_test.go +++ b/server/channels/api4/usage_test.go @@ -10,7 +10,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestGetPostsUsage(t *testing.T) { diff --git a/server/channels/api4/user.go b/server/channels/api4/user.go index d2a4fbdc8f..62ac9d28ce 100644 --- a/server/channels/api4/user.go +++ b/server/channels/api4/user.go @@ -12,13 +12,13 @@ import ( "strings" "time" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/app" - "github.com/mattermost/mattermost-server/v6/server/channels/audit" - "github.com/mattermost/mattermost-server/v6/server/channels/store" - "github.com/mattermost/mattermost-server/v6/server/channels/utils" - "github.com/mattermost/mattermost-server/v6/server/channels/web" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/app" + "github.com/mattermost/mattermost-server/server/v8/channels/audit" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/utils" + "github.com/mattermost/mattermost-server/server/v8/channels/web" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) func (api *API) InitUser() { @@ -3115,6 +3115,10 @@ func getThreadForUser(c *Context, w http.ResponseWriter, r *http.Request) { c.SetPermissionError(model.PermissionEditOtherUsers) return } + if !c.App.SessionHasPermissionToChannelByPost(*c.AppContext.Session(), c.Params.ThreadId, model.PermissionReadChannel) { + c.SetPermissionError(model.PermissionReadChannel) + return + } extendedStr := r.URL.Query().Get("extended") extended, _ := strconv.ParseBool(extendedStr) @@ -3145,6 +3149,10 @@ func getThreadsForUser(c *Context, w http.ResponseWriter, r *http.Request) { c.SetPermissionError(model.PermissionEditOtherUsers) return } + if !c.App.SessionHasPermissionToTeam(*c.AppContext.Session(), c.Params.TeamId, model.PermissionViewTeam) { + c.SetPermissionError(model.PermissionViewTeam) + return + } options := model.GetUserThreadsOpts{ Since: 0, @@ -3222,6 +3230,10 @@ func updateReadStateThreadByUser(c *Context, w http.ResponseWriter, r *http.Requ c.SetPermissionError(model.PermissionEditOtherUsers) return } + if !c.App.SessionHasPermissionToChannelByPost(*c.AppContext.Session(), c.Params.ThreadId, model.PermissionReadChannel) { + c.SetPermissionError(model.PermissionReadChannel) + return + } thread, err := c.App.UpdateThreadReadForUser(c.AppContext, c.AppContext.Session().Id, c.Params.UserId, c.Params.TeamId, c.Params.ThreadId, c.Params.Timestamp) if err != nil { @@ -3288,6 +3300,10 @@ func unfollowThreadByUser(c *Context, w http.ResponseWriter, r *http.Request) { c.SetPermissionError(model.PermissionEditOtherUsers) return } + if !c.App.SessionHasPermissionToChannelByPost(*c.AppContext.Session(), c.Params.ThreadId, model.PermissionReadChannel) { + c.SetPermissionError(model.PermissionReadChannel) + return + } err := c.App.UpdateThreadFollowForUser(c.Params.UserId, c.Params.TeamId, c.Params.ThreadId, false) if err != nil { @@ -3347,6 +3363,10 @@ func updateReadStateAllThreadsByUser(c *Context, w http.ResponseWriter, r *http. c.SetPermissionError(model.PermissionEditOtherUsers) return } + if !c.App.SessionHasPermissionToTeam(*c.AppContext.Session(), c.Params.TeamId, model.PermissionViewTeam) { + c.SetPermissionError(model.PermissionViewTeam) + return + } err := c.App.UpdateThreadsReadForUser(c.Params.UserId, c.Params.TeamId) if err != nil { diff --git a/server/channels/api4/user_local.go b/server/channels/api4/user_local.go index ec1d2d2aba..21cc0f800c 100644 --- a/server/channels/api4/user_local.go +++ b/server/channels/api4/user_local.go @@ -9,11 +9,11 @@ import ( "strconv" "strings" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/audit" - "github.com/mattermost/mattermost-server/v6/server/channels/store" - "github.com/mattermost/mattermost-server/v6/server/channels/utils" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/audit" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/utils" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) func (api *API) InitUserLocal() { diff --git a/server/channels/api4/user_test.go b/server/channels/api4/user_test.go index b1e1af07f4..0f1947ad39 100644 --- a/server/channels/api4/user_test.go +++ b/server/channels/api4/user_test.go @@ -20,13 +20,13 @@ import ( "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/app" - "github.com/mattermost/mattermost-server/v6/server/channels/einterfaces/mocks" - "github.com/mattermost/mattermost-server/v6/server/channels/utils/testutils" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mail" + "github.com/mattermost/mattermost-server/server/v8/channels/app" + "github.com/mattermost/mattermost-server/server/v8/channels/einterfaces/mocks" + "github.com/mattermost/mattermost-server/server/v8/channels/utils/testutils" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mail" - _ "github.com/mattermost/mattermost-server/v6/model/oauthproviders/gitlab" + _ "github.com/mattermost/mattermost-server/server/v8/model/oauthproviders/gitlab" ) func TestCreateUser(t *testing.T) { @@ -2714,7 +2714,7 @@ func TestGetUsersInTeam(t *testing.T) { } func TestGetUsersNotInTeam(t *testing.T) { - th := Setup(t).InitBasic() + th := Setup(t).InitBasic().DeleteBots() defer th.TearDown() teamId := th.BasicTeam.Id @@ -3664,9 +3664,16 @@ func TestSetDefaultProfileImage(t *testing.T) { defer th.TearDown() user := th.BasicUser + startTime := model.GetMillis() + time.Sleep(time.Millisecond) + _, err := th.Client.SetDefaultProfileImage(user.Id) require.NoError(t, err) + iuser, getUserErr := th.App.GetUser(user.Id) + require.Nil(t, getUserErr) + assert.Less(t, iuser.LastPictureUpdate, -startTime, "LastPictureUpdate should be set to -(current time in milliseconds)") + resp, err := th.Client.SetDefaultProfileImage(model.NewId()) require.Error(t, err) CheckForbiddenStatus(t, resp) @@ -3684,12 +3691,14 @@ func TestSetDefaultProfileImage(t *testing.T) { require.Fail(t, "Should have failed either forbidden or unauthorized") } + time.Sleep(time.Millisecond) + _, err = th.SystemAdminClient.SetDefaultProfileImage(user.Id) require.NoError(t, err) ruser, appErr := th.App.GetUser(user.Id) require.Nil(t, appErr) - assert.Equal(t, int64(0), ruser.LastPictureUpdate, "Picture should have reset to default") + assert.Less(t, ruser.LastPictureUpdate, iuser.LastPictureUpdate, "LastPictureUpdate should be updated to a lower negative number") info := &model.FileInfo{Path: "users/" + user.Id + "/profile.png"} err = th.cleanupTestFile(info) @@ -6372,6 +6381,15 @@ func TestGetThreadsForUser(t *testing.T) { require.NoError(t, err) require.Equal(t, uss.TotalUnreadThreads, int64(2)) }) + + t.Run("should error when not a team member", func(t *testing.T) { + th.UnlinkUserFromTeam(th.BasicUser, th.BasicTeam) + defer th.LinkUserToTeam(th.BasicUser, th.BasicTeam) + + _, resp, err := th.Client.GetUserThreads(th.BasicUser.Id, th.BasicTeam.Id, model.GetUserThreadsOpts{}) + require.Error(t, err) + CheckForbiddenStatus(t, resp) + }) } func TestThreadSocketEvents(t *testing.T) { @@ -6867,52 +6885,64 @@ func TestSingleThreadGet(t *testing.T) { }) client := th.Client - defer th.App.Srv().Store().Post().PermanentDeleteByUser(th.BasicUser.Id) - defer th.App.Srv().Store().Post().PermanentDeleteByUser(th.SystemAdminUser.Id) - // create a post by regular user - rpost, _ := postAndCheck(t, client, &model.Post{ChannelId: th.BasicChannel.Id, Message: "testMsg"}) - // reply with another - postAndCheck(t, th.SystemAdminClient, &model.Post{ChannelId: th.BasicChannel.Id, Message: "testReply", RootId: rpost.Id}) + t.Run("get single thread", func(t *testing.T) { + defer th.App.Srv().Store().Post().PermanentDeleteByUser(th.BasicUser.Id) + defer th.App.Srv().Store().Post().PermanentDeleteByUser(th.SystemAdminUser.Id) - // create another thread to check that we are not returning it by mistake - rpost2, _ := postAndCheck(t, client, &model.Post{ - ChannelId: th.BasicChannel2.Id, - Message: "testMsg2", - Metadata: &model.PostMetadata{ - Priority: &model.PostPriority{ - Priority: model.NewString(model.PostPriorityUrgent), + // create a post by regular user + rpost, _ := postAndCheck(t, client, &model.Post{ChannelId: th.BasicChannel.Id, Message: "testMsg"}) + // reply with another + postAndCheck(t, th.SystemAdminClient, &model.Post{ChannelId: th.BasicChannel.Id, Message: "testReply", RootId: rpost.Id}) + + // create another thread to check that we are not returning it by mistake + rpost2, _ := postAndCheck(t, client, &model.Post{ + ChannelId: th.BasicChannel2.Id, + Message: "testMsg2", + Metadata: &model.PostMetadata{ + Priority: &model.PostPriority{ + Priority: model.NewString(model.PostPriorityUrgent), + }, }, - }, - }) - postAndCheck(t, th.SystemAdminClient, &model.Post{ChannelId: th.BasicChannel2.Id, Message: "testReply", RootId: rpost2.Id}) + }) + postAndCheck(t, th.SystemAdminClient, &model.Post{ChannelId: th.BasicChannel2.Id, Message: "testReply", RootId: rpost2.Id}) - // regular user should have two threads with 3 replies total - threads, _ := checkThreadListReplies(t, th, th.Client, th.BasicUser.Id, 2, 2, nil) + // regular user should have two threads with 3 replies total + threads, _ := checkThreadListReplies(t, th, th.Client, th.BasicUser.Id, 2, 2, nil) - tr, _, err := th.Client.GetUserThread(th.BasicUser.Id, th.BasicTeam.Id, threads.Threads[0].PostId, false) - require.NoError(t, err) - require.NotNil(t, tr) - require.Equal(t, threads.Threads[0].PostId, tr.PostId) - require.Empty(t, tr.Participants[0].Username) + tr, _, err := th.Client.GetUserThread(th.BasicUser.Id, th.BasicTeam.Id, threads.Threads[0].PostId, false) + require.NoError(t, err) + require.NotNil(t, tr) + require.Equal(t, threads.Threads[0].PostId, tr.PostId) + require.Empty(t, tr.Participants[0].Username) - th.App.UpdateConfig(func(cfg *model.Config) { - *cfg.ServiceSettings.PostPriority = false + th.App.UpdateConfig(func(cfg *model.Config) { + *cfg.ServiceSettings.PostPriority = false + }) + + tr, _, err = th.Client.GetUserThread(th.BasicUser.Id, th.BasicTeam.Id, threads.Threads[0].PostId, true) + require.NoError(t, err) + require.NotEmpty(t, tr.Participants[0].Username) + require.Equal(t, false, tr.IsUrgent) + + th.App.UpdateConfig(func(cfg *model.Config) { + *cfg.ServiceSettings.PostPriority = true + cfg.FeatureFlags.PostPriority = true + }) + + tr, _, err = th.Client.GetUserThread(th.BasicUser.Id, th.BasicTeam.Id, threads.Threads[0].PostId, true) + require.NoError(t, err) + require.Equal(t, true, tr.IsUrgent) }) - tr, _, err = th.Client.GetUserThread(th.BasicUser.Id, th.BasicTeam.Id, threads.Threads[0].PostId, true) - require.NoError(t, err) - require.NotEmpty(t, tr.Participants[0].Username) - require.Equal(t, false, tr.IsUrgent) + t.Run("should error when not a team member", func(t *testing.T) { + th.UnlinkUserFromTeam(th.BasicUser, th.BasicTeam) + defer th.LinkUserToTeam(th.BasicUser, th.BasicTeam) - th.App.UpdateConfig(func(cfg *model.Config) { - *cfg.ServiceSettings.PostPriority = true - cfg.FeatureFlags.PostPriority = true + _, resp, err := th.Client.GetUserThread(th.BasicUser.Id, th.BasicTeam.Id, model.NewId(), false) + require.Error(t, err) + CheckForbiddenStatus(t, resp) }) - - tr, _, err = th.Client.GetUserThread(th.BasicUser.Id, th.BasicTeam.Id, threads.Threads[0].PostId, true) - require.NoError(t, err) - require.Equal(t, true, tr.IsUrgent) } func TestMaintainUnreadMentionsInThread(t *testing.T) { @@ -7084,6 +7114,23 @@ func TestReadThreads(t *testing.T) { checkThreadListReplies(t, th, th.Client, th.BasicUser.Id, 1, 1, nil) }) + + t.Run("should error when not a team member", func(t *testing.T) { + th.UnlinkUserFromTeam(th.BasicUser, th.BasicTeam) + defer th.LinkUserToTeam(th.BasicUser, th.BasicTeam) + + _, resp, err := th.Client.UpdateThreadReadForUser(th.BasicUser.Id, th.BasicTeam.Id, model.NewId(), model.GetMillis()) + require.Error(t, err) + CheckForbiddenStatus(t, resp) + + _, resp, err = th.Client.SetThreadUnreadByPostId(th.BasicUser.Id, th.BasicTeam.Id, model.NewId(), model.NewId()) + require.Error(t, err) + CheckForbiddenStatus(t, resp) + + resp, err = th.Client.UpdateThreadsReadForUser(th.BasicUser.Id, th.BasicTeam.Id) + require.Error(t, err) + CheckForbiddenStatus(t, resp) + }) } func TestMarkThreadUnreadMentionCount(t *testing.T) { diff --git a/server/channels/api4/user_viewmembers_test.go b/server/channels/api4/user_viewmembers_test.go index 1359873866..40c051b0ae 100644 --- a/server/channels/api4/user_viewmembers_test.go +++ b/server/channels/api4/user_viewmembers_test.go @@ -8,7 +8,7 @@ import ( "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestAPIRestrictedViewMembers(t *testing.T) { diff --git a/server/channels/api4/webhook.go b/server/channels/api4/webhook.go index 36b5aa113a..4d96e08a61 100644 --- a/server/channels/api4/webhook.go +++ b/server/channels/api4/webhook.go @@ -7,9 +7,9 @@ import ( "encoding/json" "net/http" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/audit" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/audit" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) func (api *API) InitWebhook() { diff --git a/server/channels/api4/webhook_local.go b/server/channels/api4/webhook_local.go index dbe57deb06..eacdf2af88 100644 --- a/server/channels/api4/webhook_local.go +++ b/server/channels/api4/webhook_local.go @@ -7,9 +7,9 @@ import ( "encoding/json" "net/http" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/audit" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/audit" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) func (api *API) InitWebhookLocal() { diff --git a/server/channels/api4/webhook_test.go b/server/channels/api4/webhook_test.go index 85335dbb35..468fd58082 100644 --- a/server/channels/api4/webhook_test.go +++ b/server/channels/api4/webhook_test.go @@ -9,7 +9,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestCreateIncomingWebhook(t *testing.T) { diff --git a/server/channels/api4/websocket.go b/server/channels/api4/websocket.go index e2fa25a565..54fea3f4aa 100644 --- a/server/channels/api4/websocket.go +++ b/server/channels/api4/websocket.go @@ -8,9 +8,9 @@ import ( "github.com/gorilla/websocket" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/app/platform" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/app/platform" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) const ( diff --git a/server/channels/api4/websocket_norace_test.go b/server/channels/api4/websocket_norace_test.go index 88d2a508c7..5be1d539c2 100644 --- a/server/channels/api4/websocket_norace_test.go +++ b/server/channels/api4/websocket_norace_test.go @@ -12,7 +12,7 @@ import ( "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) // TestWebSocket is intentionally made to skip -race mode diff --git a/server/channels/api4/websocket_test.go b/server/channels/api4/websocket_test.go index c1a804f3bc..b7127814bc 100644 --- a/server/channels/api4/websocket_test.go +++ b/server/channels/api4/websocket_test.go @@ -14,9 +14,9 @@ import ( "github.com/gorilla/websocket" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/testlib" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/testlib" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) func TestWebSocketTrailingSlash(t *testing.T) { @@ -424,10 +424,14 @@ func TestWebSocketUpgrade(t *testing.T) { th := Setup(t) defer th.TearDown() + buffer := &mlog.Buffer{} + err := mlog.AddWriterTarget(th.TestLogger, buffer, true, mlog.StdAll...) + require.NoError(t, err) + url := fmt.Sprintf("http://localhost:%v", th.App.Srv().ListenAddr.Port) + model.APIURLSuffix + "/websocket" resp, err := http.Get(url) require.NoError(t, err) require.Equal(t, resp.StatusCode, http.StatusBadRequest) require.NoError(t, th.TestLogger.Flush()) - testlib.AssertLog(t, th.LogBuffer, mlog.LvlDebug.Name, "Failed to upgrade websocket connection.") + testlib.AssertLog(t, buffer, mlog.LvlDebug.Name, "Failed to upgrade websocket connection.") } diff --git a/server/channels/api4/work_templates.go b/server/channels/api4/work_templates.go index 2f6836682e..bf3d5860b7 100644 --- a/server/channels/api4/work_templates.go +++ b/server/channels/api4/work_templates.go @@ -7,8 +7,8 @@ import ( "encoding/json" "net/http" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/app/worktemplates" + "github.com/mattermost/mattermost-server/server/v8/channels/app/worktemplates" + "github.com/mattermost/mattermost-server/server/v8/model" ) func (api *API) InitWorkTemplate() { diff --git a/server/channels/app/admin.go b/server/channels/app/admin.go index fb3ab53000..b559dca1e0 100644 --- a/server/channels/app/admin.go +++ b/server/channels/app/admin.go @@ -10,11 +10,11 @@ import ( "net/http" "time" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/app/request" - "github.com/mattermost/mattermost-server/v6/server/platform/services/cache" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/i18n" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mail" + "github.com/mattermost/mattermost-server/server/v8/channels/app/request" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/services/cache" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/i18n" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mail" ) var latestVersionCache = cache.NewLRU(cache.LRUOptions{ diff --git a/server/channels/app/admin_advisor.go b/server/channels/app/admin_advisor.go index 23397e1060..70fb4b4151 100644 --- a/server/channels/app/admin_advisor.go +++ b/server/channels/app/admin_advisor.go @@ -7,11 +7,11 @@ import ( "net/http" "strings" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/app/request" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/i18n" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mail" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/app/request" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/i18n" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mail" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) func (a *App) GetWarnMetricsStatus() (map[string]*model.WarnMetricStatus, *model.AppError) { diff --git a/server/channels/app/admin_test.go b/server/channels/app/admin_test.go index 00c0175ead..a583a572e3 100644 --- a/server/channels/app/admin_test.go +++ b/server/channels/app/admin_test.go @@ -11,7 +11,7 @@ import ( "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestGetLatestVersion(t *testing.T) { diff --git a/server/channels/app/analytics.go b/server/channels/app/analytics.go index c4582df158..83b8eb043f 100644 --- a/server/channels/app/analytics.go +++ b/server/channels/app/analytics.go @@ -8,8 +8,8 @@ import ( "golang.org/x/sync/errgroup" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) const ( diff --git a/server/channels/app/app.go b/server/channels/app/app.go index 20387b2234..f7f30c1936 100644 --- a/server/channels/app/app.go +++ b/server/channels/app/app.go @@ -9,16 +9,16 @@ import ( "strconv" "time" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/einterfaces" - "github.com/mattermost/mattermost-server/v6/server/channels/product" - "github.com/mattermost/mattermost-server/v6/server/channels/utils" - "github.com/mattermost/mattermost-server/v6/server/platform/services/httpservice" - "github.com/mattermost/mattermost-server/v6/server/platform/services/imageproxy" - "github.com/mattermost/mattermost-server/v6/server/platform/services/searchengine" - "github.com/mattermost/mattermost-server/v6/server/platform/services/timezones" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/templates" + "github.com/mattermost/mattermost-server/server/v8/channels/einterfaces" + "github.com/mattermost/mattermost-server/server/v8/channels/product" + "github.com/mattermost/mattermost-server/server/v8/channels/utils" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/services/httpservice" + "github.com/mattermost/mattermost-server/server/v8/platform/services/imageproxy" + "github.com/mattermost/mattermost-server/server/v8/platform/services/searchengine" + "github.com/mattermost/mattermost-server/server/v8/platform/services/timezones" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/templates" ) // App is a pure functional component that does not have any fields, except Server. diff --git a/server/channels/app/app_iface.go b/server/channels/app/app_iface.go index b7355144ea..0ca3855d0c 100644 --- a/server/channels/app/app_iface.go +++ b/server/channels/app/app_iface.go @@ -18,23 +18,23 @@ import ( "reflect" "time" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/plugin" - "github.com/mattermost/mattermost-server/v6/server/channels/app/platform" - "github.com/mattermost/mattermost-server/v6/server/channels/app/request" - "github.com/mattermost/mattermost-server/v6/server/channels/app/worktemplates" - "github.com/mattermost/mattermost-server/v6/server/channels/audit" - "github.com/mattermost/mattermost-server/v6/server/channels/einterfaces" - "github.com/mattermost/mattermost-server/v6/server/channels/product" - "github.com/mattermost/mattermost-server/v6/server/channels/store" - "github.com/mattermost/mattermost-server/v6/server/platform/services/httpservice" - "github.com/mattermost/mattermost-server/v6/server/platform/services/imageproxy" - "github.com/mattermost/mattermost-server/v6/server/platform/services/remotecluster" - "github.com/mattermost/mattermost-server/v6/server/platform/services/searchengine" - "github.com/mattermost/mattermost-server/v6/server/platform/services/timezones" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/filestore" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/i18n" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/app/platform" + "github.com/mattermost/mattermost-server/server/v8/channels/app/request" + "github.com/mattermost/mattermost-server/server/v8/channels/app/worktemplates" + "github.com/mattermost/mattermost-server/server/v8/channels/audit" + "github.com/mattermost/mattermost-server/server/v8/channels/einterfaces" + "github.com/mattermost/mattermost-server/server/v8/channels/product" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/services/httpservice" + "github.com/mattermost/mattermost-server/server/v8/platform/services/imageproxy" + "github.com/mattermost/mattermost-server/server/v8/platform/services/remotecluster" + "github.com/mattermost/mattermost-server/server/v8/platform/services/searchengine" + "github.com/mattermost/mattermost-server/server/v8/platform/services/timezones" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/filestore" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/i18n" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/plugin" ) // AppIface is extracted from App struct and contains all it's exported methods. It's provided to allow partial interface passing and app layers creation. @@ -264,8 +264,6 @@ type AppIface interface { // MoveChannel method is prone to data races if someone joins to channel during the move process. However this // function is only exposed to sysadmins and the possibility of this edge case is relatively small. MoveChannel(c request.CTX, team *model.Team, channel *model.Channel, user *model.User) *model.AppError - // NewWebConn returns a new WebConn instance. - NewWebConn(cfg *platform.WebConnConfig) *platform.WebConn // NotifySessionsExpired is called periodically from the job server to notify any mobile sessions that have expired. NotifySessionsExpired() error // OverrideIconURLIfEmoji changes the post icon override URL prop, if it has an emoji icon, @@ -402,6 +400,7 @@ type AppIface interface { VerifyPlugin(plugin, signature io.ReadSeeker) *model.AppError AccountMigration() einterfaces.AccountMigrationInterface ActivateMfa(userID, token string) *model.AppError + ActiveSearchBackend() string AddChannelsToRetentionPolicy(policyID string, channelIDs []string) *model.AppError AddConfigListener(listener func(*model.Config, *model.Config)) string AddDirectChannels(c request.CTX, teamID string, user *model.User) *model.AppError @@ -893,6 +892,7 @@ type AppIface interface { InviteNewUsersToTeam(emailList []string, teamID, senderId string) *model.AppError InviteNewUsersToTeamGracefully(memberInvite *model.MemberInvite, teamID, senderId string, reminderInterval string) ([]*model.EmailInviteWithError, *model.AppError) IsCRTEnabledForUser(c request.CTX, userID string) bool + IsConfigReadOnly() bool IsFirstAdmin(user *model.User) bool IsFirstUserAccount() bool IsLeader() bool @@ -1120,6 +1120,7 @@ type AppIface interface { UpdateChannelPrivacy(c request.CTX, oldChannel *model.Channel, user *model.User) (*model.Channel, *model.AppError) UpdateCommand(oldCmd, updatedCmd *model.Command) (*model.Command, *model.AppError) UpdateConfig(f func(*model.Config)) + UpdateDefaultProfileImage(c request.CTX, user *model.User) *model.AppError UpdateEphemeralPost(c request.CTX, userID string, post *model.Post) *model.Post UpdateExpiredDNDStatuses() ([]*model.Status, error) UpdateGroup(group *model.Group) (*model.Group, *model.AppError) diff --git a/server/channels/app/app_test.go b/server/channels/app/app_test.go index 291a4daa5f..0ba8caff88 100644 --- a/server/channels/app/app_test.go +++ b/server/channels/app/app_test.go @@ -12,12 +12,13 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" + "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store/storetest/mocks" + "github.com/mattermost/mattermost-server/server/v8/channels/store/storetest/mocks" + "github.com/mattermost/mattermost-server/server/v8/model" ) -/* Temporarily comment out until MM-11108 +/* TODO: Temporarily comment out until MM-11108 func TestAppRace(t *testing.T) { for i := 0; i < 10; i++ { a, err := New() @@ -61,6 +62,8 @@ func TestUnitUpdateConfig(t *testing.T) { prev := *th.App.Config().ServiceSettings.SiteURL + require.False(t, th.App.IsConfigReadOnly()) + var called int32 th.App.AddConfigListener(func(old, current *model.Config) { atomic.AddInt32(&called, 1) @@ -116,7 +119,6 @@ func TestDoAdvancedPermissionsMigration(t *testing.T) { model.PermissionGetPublicLink.Id, model.PermissionCreatePost.Id, model.PermissionUseChannelMentions.Id, - model.PermissionUseSlashCommands.Id, model.PermissionManagePublicChannelProperties.Id, model.PermissionDeletePublicChannel.Id, model.PermissionManagePrivateChannelProperties.Id, diff --git a/server/channels/app/audit.go b/server/channels/app/audit.go index 00d441ddc7..e599d2e9d7 100644 --- a/server/channels/app/audit.go +++ b/server/channels/app/audit.go @@ -9,11 +9,11 @@ import ( "net/http" "os/user" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/audit" - "github.com/mattermost/mattermost-server/v6/server/channels/store" - "github.com/mattermost/mattermost-server/v6/server/config" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/audit" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/config" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) var ( diff --git a/server/channels/app/authentication.go b/server/channels/app/authentication.go index dbac2df81a..aac42c936c 100644 --- a/server/channels/app/authentication.go +++ b/server/channels/app/authentication.go @@ -8,10 +8,10 @@ import ( "net/http" "strings" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/app/request" - "github.com/mattermost/mattermost-server/v6/server/channels/app/users" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mfa" + "github.com/mattermost/mattermost-server/server/v8/channels/app/request" + "github.com/mattermost/mattermost-server/server/v8/channels/app/users" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mfa" ) type TokenLocation int diff --git a/server/channels/app/authentication_test.go b/server/channels/app/authentication_test.go index 38e83cc383..eb4ed1d4cf 100644 --- a/server/channels/app/authentication_test.go +++ b/server/channels/app/authentication_test.go @@ -11,7 +11,7 @@ import ( "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestParseAuthTokenFromRequest(t *testing.T) { diff --git a/server/channels/app/authorization.go b/server/channels/app/authorization.go index 5a115703ef..261dc39a34 100644 --- a/server/channels/app/authorization.go +++ b/server/channels/app/authorization.go @@ -9,9 +9,9 @@ import ( "net/http" "strings" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/app/request" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/app/request" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) func (a *App) MakePermissionError(s *model.Session, permissions []*model.Permission) *model.AppError { diff --git a/server/channels/app/authorization_test.go b/server/channels/app/authorization_test.go index 9560e76e44..4106cd1966 100644 --- a/server/channels/app/authorization_test.go +++ b/server/channels/app/authorization_test.go @@ -16,9 +16,9 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/plugin/plugintest/mock" - "github.com/mattermost/mattermost-server/v6/server/channels/store/storetest/mocks" + "github.com/mattermost/mattermost-server/server/v8/channels/store/storetest/mocks" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/plugin/plugintest/mock" ) func TestCheckIfRolesGrantPermission(t *testing.T) { @@ -85,6 +85,12 @@ func TestSessionHasPermissionToChannel(t *testing.T) { // Regression test for MM-29812 // Mock the channel store so getting the channel returns with an error, as per the bug report. mockStore := mocks.Store{} + + // Playbooks DB job requires a plugin mock + pluginStore := mocks.PluginStore{} + pluginStore.On("List", mock.Anything, mock.Anything, mock.Anything).Return([]string{}, nil) + mockStore.On("Plugin").Return(&pluginStore) + mockChannelStore := mocks.ChannelStore{} mockChannelStore.On("Get", mock.Anything, mock.Anything).Return(nil, fmt.Errorf("arbitrary error")) mockChannelStore.On("GetAllChannelMembersForUser", mock.Anything, mock.Anything, mock.Anything).Return(th.App.Srv().Store().Channel().GetAllChannelMembersForUser(th.BasicUser.Id, false, false)) diff --git a/server/channels/app/auto_responder.go b/server/channels/app/auto_responder.go index 849509e782..d002cf0ab5 100644 --- a/server/channels/app/auto_responder.go +++ b/server/channels/app/auto_responder.go @@ -7,8 +7,8 @@ import ( "net/http" "time" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/app/request" + "github.com/mattermost/mattermost-server/server/v8/channels/app/request" + "github.com/mattermost/mattermost-server/server/v8/model" ) // check if there is any auto_response type post in channel by the user in a calender day diff --git a/server/channels/app/auto_responder_test.go b/server/channels/app/auto_responder_test.go index a7acc6eca1..8bd9e8493a 100644 --- a/server/channels/app/auto_responder_test.go +++ b/server/channels/app/auto_responder_test.go @@ -10,7 +10,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestSetAutoResponderStatus(t *testing.T) { diff --git a/server/channels/app/bot.go b/server/channels/app/bot.go index 3f8db288b8..ae117a05da 100644 --- a/server/channels/app/bot.go +++ b/server/channels/app/bot.go @@ -9,12 +9,12 @@ import ( "fmt" "net/http" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/app/request" - "github.com/mattermost/mattermost-server/v6/server/channels/product" - "github.com/mattermost/mattermost-server/v6/server/channels/store" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/i18n" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/app/request" + "github.com/mattermost/mattermost-server/server/v8/channels/product" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/i18n" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) const ( diff --git a/server/channels/app/bot_test.go b/server/channels/app/bot_test.go index 6b77b08fa0..c55a01414e 100644 --- a/server/channels/app/bot_test.go +++ b/server/channels/app/bot_test.go @@ -11,7 +11,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestCreateBot(t *testing.T) { @@ -278,7 +278,7 @@ func TestGetBot(t *testing.T) { } func TestGetBots(t *testing.T) { - th := Setup(t) + th := Setup(t).DeleteBots() defer th.TearDown() OwnerId1 := model.NewId() diff --git a/server/channels/app/brand.go b/server/channels/app/brand.go index be3b6c32be..3c2abf3650 100644 --- a/server/channels/app/brand.go +++ b/server/channels/app/brand.go @@ -9,7 +9,7 @@ import ( "net/http" "time" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) const ( diff --git a/server/channels/app/busy.go b/server/channels/app/busy.go index 41b9c758db..a72bb2ce71 100644 --- a/server/channels/app/busy.go +++ b/server/channels/app/busy.go @@ -10,8 +10,8 @@ import ( "sync/atomic" "time" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/einterfaces" + "github.com/mattermost/mattermost-server/server/v8/channels/einterfaces" + "github.com/mattermost/mattermost-server/server/v8/model" ) const ( diff --git a/server/channels/app/busy_test.go b/server/channels/app/busy_test.go index 87fe0df323..2b267fa443 100644 --- a/server/channels/app/busy_test.go +++ b/server/channels/app/busy_test.go @@ -10,8 +10,8 @@ import ( "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/einterfaces" + "github.com/mattermost/mattermost-server/server/v8/channels/einterfaces" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestBusySet(t *testing.T) { diff --git a/server/channels/app/channel.go b/server/channels/app/channel.go index e03e627487..3738132cc4 100644 --- a/server/channels/app/channel.go +++ b/server/channels/app/channel.go @@ -14,15 +14,15 @@ import ( "github.com/mattermost/logr/v2" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/plugin" - "github.com/mattermost/mattermost-server/v6/server/channels/app/request" - "github.com/mattermost/mattermost-server/v6/server/channels/product" - "github.com/mattermost/mattermost-server/v6/server/channels/store" - "github.com/mattermost/mattermost-server/v6/server/channels/store/sqlstore" - "github.com/mattermost/mattermost-server/v6/server/channels/utils" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/i18n" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/app/request" + "github.com/mattermost/mattermost-server/server/v8/channels/product" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/store/sqlstore" + "github.com/mattermost/mattermost-server/server/v8/channels/utils" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/i18n" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/plugin" ) // channelsWrapper provides an implementation of `product.ChannelService` to be used by products. @@ -1354,6 +1354,10 @@ func (a *App) UpdateChannelMemberNotifyProps(c request.CTX, data map[string]stri filteredProps[model.IgnoreChannelMentionsNotifyProp] = ignoreChannelMentions } + if channelAutoFollowThreads, exists := data[model.ChannelAutoFollowThreads]; exists { + filteredProps[model.ChannelAutoFollowThreads] = channelAutoFollowThreads + } + member, err := a.Srv().Store().Channel().UpdateMemberNotifyProps(channelID, userID, filteredProps) if err != nil { var appErr *model.AppError @@ -2408,7 +2412,6 @@ func (a *App) PostAddToChannelMessage(c request.CTX, user *model.User, addedUser Message: message, Type: postType, UserId: user.Id, - RootId: postRootId, Props: model.StringInterface{ "userId": user.Id, "username": user.Username, @@ -2518,6 +2521,9 @@ func (a *App) removeUserFromChannel(c request.CTX, userIDToRemove string, remove if err := a.Srv().Store().ChannelMemberHistory().LogLeaveEvent(userIDToRemove, channel.Id, model.GetMillis()); err != nil { return model.NewAppError("removeUserFromChannel", "app.channel_member_history.log_leave_event.internal_error", nil, "", http.StatusInternalServerError).Wrap(err) } + if err := a.Srv().Store().Thread().DeleteMembershipsForChannel(userIDToRemove, channel.Id); err != nil { + return model.NewAppError("removeUserFromChannel", model.NoTranslation, nil, "failed to delete threadmemberships upon leaving channel", http.StatusInternalServerError).Wrap(err) + } if isGuest { currentMembers, err := a.GetChannelMembersForUser(c, channel.TeamId, userIDToRemove) diff --git a/server/channels/app/channel_category.go b/server/channels/app/channel_category.go index b9758c38d1..4c8e3585bb 100644 --- a/server/channels/app/channel_category.go +++ b/server/channels/app/channel_category.go @@ -8,10 +8,10 @@ import ( "errors" "net/http" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/app/request" - "github.com/mattermost/mattermost-server/v6/server/channels/store" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/app/request" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) func (a *App) createInitialSidebarCategories(userID string, opts *store.SidebarCategorySearchOpts) (*model.OrderedSidebarCategories, *model.AppError) { @@ -25,13 +25,17 @@ func (a *App) createInitialSidebarCategories(userID string, opts *store.SidebarC func (a *App) GetSidebarCategoriesForTeamForUser(c request.CTX, userID, teamID string) (*model.OrderedSidebarCategories, *model.AppError) { var appErr *model.AppError - categories, err := a.Srv().Store().Channel().GetSidebarCategoriesForTeamForUser(userID, teamID) - if err == nil && len(categories.Categories) == 0 { - // A user must always have categories, so migration must not have happened yet, and we should run it ourselves - categories, appErr = a.createInitialSidebarCategories(userID, &store.SidebarCategorySearchOpts{ - TeamID: teamID, - ExcludeTeam: false, - }) + appsCategoryEnabled := a.Config().FeatureFlags.AppsSidebarCategory + options := &store.SidebarCategorySearchOpts{ + TeamID: teamID, + ExcludeTeam: false, + AppsCategoryEnabled: appsCategoryEnabled, + } + categories, err := a.Srv().Store().Channel().GetSidebarCategoriesForTeamForUser(userID, teamID, options) + if err == nil && (len(categories.Categories) == 0 || (appsCategoryEnabled && checkMissingSystemSidebarCategories(categories))) { + // A user must always have system categories, so migration must not have happened yet, and we should run it ourselves + categories, appErr = a.createInitialSidebarCategories(userID, options) + if appErr != nil { return nil, appErr } @@ -52,10 +56,17 @@ func (a *App) GetSidebarCategoriesForTeamForUser(c request.CTX, userID, teamID s func (a *App) GetSidebarCategories(c request.CTX, userID string, opts *store.SidebarCategorySearchOpts) (*model.OrderedSidebarCategories, *model.AppError) { var appErr *model.AppError - categories, err := a.Srv().Store().Channel().GetSidebarCategories(userID, opts) - if err == nil && len(categories.Categories) == 0 { - // A user must always have categories, so migration must not have happened yet, and we should run it ourselves - categories, appErr = a.createInitialSidebarCategories(userID, opts) + appsCategoryEnabled := a.Config().FeatureFlags.AppsSidebarCategory + options := &store.SidebarCategorySearchOpts{ + TeamID: opts.TeamID, + ExcludeTeam: opts.ExcludeTeam, + AppsCategoryEnabled: appsCategoryEnabled, + } + categories, err := a.Srv().Store().Channel().GetSidebarCategories(userID, options) + if err == nil && (len(categories.Categories) == 0 || (appsCategoryEnabled && checkMissingSystemSidebarCategories(categories))) { + // A user must always have system categories, so migration must not have happened yet, and we should run it ourselves + categories, appErr = a.createInitialSidebarCategories(userID, options) + if appErr != nil { return nil, appErr } @@ -90,7 +101,8 @@ func (a *App) GetSidebarCategoryOrder(c request.CTX, userID, teamID string) ([]s } func (a *App) GetSidebarCategory(c request.CTX, categoryId string) (*model.SidebarCategoryWithChannels, *model.AppError) { - category, err := a.Srv().Store().Channel().GetSidebarCategory(categoryId) + appsCategoryEnabled := a.Config().FeatureFlags.AppsSidebarCategory + category, err := a.Srv().Store().Channel().GetSidebarCategory(categoryId, &store.SidebarCategorySearchOpts{AppsCategoryEnabled: appsCategoryEnabled}) if err != nil { var nfErr *store.ErrNotFound switch { @@ -105,7 +117,8 @@ func (a *App) GetSidebarCategory(c request.CTX, categoryId string) (*model.Sideb } func (a *App) CreateSidebarCategory(c request.CTX, userID, teamID string, newCategory *model.SidebarCategoryWithChannels) (*model.SidebarCategoryWithChannels, *model.AppError) { - category, err := a.Srv().Store().Channel().CreateSidebarCategory(userID, teamID, newCategory) + appsCategoryEnabled := a.Config().FeatureFlags.AppsSidebarCategory + category, err := a.Srv().Store().Channel().CreateSidebarCategory(userID, teamID, newCategory, &store.SidebarCategorySearchOpts{AppsCategoryEnabled: appsCategoryEnabled}) if err != nil { var nfErr *store.ErrNotFound switch { @@ -142,7 +155,13 @@ func (a *App) UpdateSidebarCategoryOrder(c request.CTX, userID, teamID string, c } func (a *App) UpdateSidebarCategories(c request.CTX, userID, teamID string, categories []*model.SidebarCategoryWithChannels) ([]*model.SidebarCategoryWithChannels, *model.AppError) { - updatedCategories, originalCategories, err := a.Srv().Store().Channel().UpdateSidebarCategories(userID, teamID, categories) + appsCategoryEnabled := a.Config().FeatureFlags.AppsSidebarCategory + updatedCategories, originalCategories, err := a.Srv().Store().Channel().UpdateSidebarCategories( + userID, + teamID, + categories, + &store.SidebarCategorySearchOpts{AppsCategoryEnabled: appsCategoryEnabled}, + ) if err != nil { return nil, model.NewAppError("UpdateSidebarCategories", "app.channel.sidebar_categories.app_error", nil, "", http.StatusInternalServerError).Wrap(err) } @@ -286,3 +305,17 @@ func (a *App) DeleteSidebarCategory(c request.CTX, userID, teamID, categoryId st return nil } + +func checkMissingSystemSidebarCategories(categories *model.OrderedSidebarCategories) bool { + missingSystemCategories := make(map[model.SidebarCategoryType]struct{}) + + for _, systemSidebarCategory := range model.SystemSidebarCategories { + missingSystemCategories[systemSidebarCategory] = struct{}{} + } + + for _, category := range categories.Categories { + delete(missingSystemCategories, category.Type) + } + + return len(missingSystemCategories) != 0 +} diff --git a/server/channels/app/channel_category_test.go b/server/channels/app/channel_category_test.go index f9759742f6..f697f773d7 100644 --- a/server/channels/app/channel_category_test.go +++ b/server/channels/app/channel_category_test.go @@ -9,7 +9,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestSidebarCategory(t *testing.T) { diff --git a/server/channels/app/channel_category_with_apps_category_test.go b/server/channels/app/channel_category_with_apps_category_test.go new file mode 100644 index 0000000000..7ce2f9fbb3 --- /dev/null +++ b/server/channels/app/channel_category_with_apps_category_test.go @@ -0,0 +1,481 @@ +// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. +// See LICENSE.txt for license information. + +package app + +import ( + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + + "github.com/mattermost/mattermost-server/server/v8/model" +) + +func TestSidebarCategoryWithAppsCategory(t *testing.T) { + th := Setup(t).InitBasicWithAppsSidebarEnabled() + defer th.TearDown() + + basicChannel2 := th.CreateChannel(th.Context, th.BasicTeam) + defer th.App.PermanentDeleteChannel(th.Context, basicChannel2) + user := th.CreateUser() + defer th.App.Srv().Store().User().PermanentDelete(user.Id) + th.LinkUserToTeam(user, th.BasicTeam) + th.AddUserToChannel(user, basicChannel2) + + var createdCategory *model.SidebarCategoryWithChannels + t.Run("CreateSidebarCategory", func(t *testing.T) { + catData := model.SidebarCategoryWithChannels{ + SidebarCategory: model.SidebarCategory{ + DisplayName: "TEST", + }, + Channels: []string{th.BasicChannel.Id, basicChannel2.Id, basicChannel2.Id}, + } + _, err := th.App.CreateSidebarCategory(th.Context, user.Id, th.BasicTeam.Id, &catData) + require.NotNil(t, err, "Should return error due to duplicate IDs") + catData.Channels = []string{th.BasicChannel.Id, basicChannel2.Id} + cat, err := th.App.CreateSidebarCategory(th.Context, user.Id, th.BasicTeam.Id, &catData) + require.Nil(t, err, "Expected no error") + require.NotNil(t, cat, "Expected category object, got nil") + createdCategory = cat + }) + + t.Run("UpdateSidebarCategories", func(t *testing.T) { + require.NotNil(t, createdCategory) + createdCategory.Channels = []string{th.BasicChannel.Id} + updatedCat, err := th.App.UpdateSidebarCategories(th.Context, user.Id, th.BasicTeam.Id, []*model.SidebarCategoryWithChannels{createdCategory}) + require.Nil(t, err, "Expected no error") + require.NotNil(t, updatedCat, "Expected category object, got nil") + require.Len(t, updatedCat, 1) + require.Len(t, updatedCat[0].Channels, 1) + require.Equal(t, updatedCat[0].Channels[0], th.BasicChannel.Id) + }) + + t.Run("UpdateSidebarCategoryOrder", func(t *testing.T) { + err := th.App.UpdateSidebarCategoryOrder(th.Context, user.Id, th.BasicTeam.Id, []string{th.BasicChannel.Id, basicChannel2.Id}) + require.NotNil(t, err, "Should return error due to invalid order") + + actualOrder, err := th.App.GetSidebarCategoryOrder(th.Context, user.Id, th.BasicTeam.Id) + require.Nil(t, err, "Should fetch order successfully") + + actualOrder[2], actualOrder[3] = actualOrder[3], actualOrder[2] + err = th.App.UpdateSidebarCategoryOrder(th.Context, user.Id, th.BasicTeam.Id, actualOrder) + require.Nil(t, err, "Should update order successfully") + + // We create a copy of actualOrder to prevent racy read + // of the slice when the broadcast message is sent from webhub. + newOrder := make([]string, len(actualOrder)) + copy(newOrder, actualOrder) + newOrder[2] = "asd" + err = th.App.UpdateSidebarCategoryOrder(th.Context, user.Id, th.BasicTeam.Id, newOrder) + require.NotNil(t, err, "Should return error due to invalid id") + }) + + t.Run("GetSidebarCategoryOrder", func(t *testing.T) { + catOrder, err := th.App.GetSidebarCategoryOrder(th.Context, user.Id, th.BasicTeam.Id) + require.Nil(t, err, "Expected no error") + require.Len(t, catOrder, 5) + require.Equal(t, catOrder[1], createdCategory.Id, "the newly created category should be after favorites") + }) +} + +func TestGetSidebarCategoriesWithAppsCategory(t *testing.T) { + t.Run("should return the sidebar categories for the given user/team", func(t *testing.T) { + th := Setup(t).InitBasicWithAppsSidebarEnabled() + defer th.TearDown() + + _, err := th.App.CreateSidebarCategory(th.Context, th.BasicUser.Id, th.BasicTeam.Id, &model.SidebarCategoryWithChannels{ + SidebarCategory: model.SidebarCategory{ + UserId: th.BasicUser.Id, + TeamId: th.BasicTeam.Id, + DisplayName: "new category", + }, + }) + require.Nil(t, err) + + categories, err := th.App.GetSidebarCategoriesForTeamForUser(th.Context, th.BasicUser.Id, th.BasicTeam.Id) + assert.Nil(t, err) + assert.Len(t, categories.Categories, 5) + }) + + t.Run("should create the initial categories even if migration hasn't ran yet", func(t *testing.T) { + th := Setup(t).InitBasicWithAppsSidebarEnabled() + defer th.TearDown() + + // Manually add the user to the team without going through the app layer to simulate a pre-existing user/team + // relationship that hasn't been migrated yet + team := th.CreateTeam() + _, err := th.App.Srv().Store().Team().SaveMember(&model.TeamMember{ + TeamId: team.Id, + UserId: th.BasicUser.Id, + SchemeUser: true, + }, 100) + require.NoError(t, err) + + categories, appErr := th.App.GetSidebarCategoriesForTeamForUser(th.Context, th.BasicUser.Id, team.Id) + assert.Nil(t, appErr) + assert.Len(t, categories.Categories, 4) + }) + + t.Run("should return a store error if a db table is missing", func(t *testing.T) { + th := Setup(t).InitBasicWithAppsSidebarEnabled() + defer th.TearDown() + + // Temporarily renaming a table to force a DB error. + sqlStore := mainHelper.GetSQLStore() + _, err := sqlStore.GetMasterX().Exec("ALTER TABLE SidebarCategories RENAME TO SidebarCategoriesTest") + require.NoError(t, err) + defer func() { + _, err := sqlStore.GetMasterX().Exec("ALTER TABLE SidebarCategoriesTest RENAME TO SidebarCategories") + require.NoError(t, err) + }() + + categories, appErr := th.App.GetSidebarCategoriesForTeamForUser(th.Context, th.BasicUser.Id, th.BasicTeam.Id) + assert.Nil(t, categories) + assert.NotNil(t, appErr) + assert.Equal(t, "app.channel.sidebar_categories.app_error", appErr.Id) + }) +} + +func TestUpdateSidebarCategoriesWithAppsCategory(t *testing.T) { + t.Run("should mute and unmute all channels in a category when it is muted or unmuted", func(t *testing.T) { + th := Setup(t).InitBasicWithAppsSidebarEnabled() + defer th.TearDown() + + categories, err := th.App.GetSidebarCategoriesForTeamForUser(th.Context, th.BasicUser.Id, th.BasicTeam.Id) + require.Nil(t, err) + + channelsCategory := categories.Categories[1] + + // Create some channels to be part of the channels category + channel1 := th.CreateChannel(th.Context, th.BasicTeam) + th.AddUserToChannel(th.BasicUser, channel1) + + channel2 := th.CreateChannel(th.Context, th.BasicTeam) + th.AddUserToChannel(th.BasicUser, channel2) + + // Mute the category + updated, err := th.App.UpdateSidebarCategories(th.Context, th.BasicUser.Id, th.BasicTeam.Id, []*model.SidebarCategoryWithChannels{ + { + SidebarCategory: model.SidebarCategory{ + Id: channelsCategory.Id, + Muted: true, + }, + Channels: []string{channel1.Id, channel2.Id}, + }, + }) + require.Nil(t, err) + assert.True(t, updated[0].Muted) + + // Confirm that the channels are now muted + member1, err := th.App.GetChannelMember(th.Context, channel1.Id, th.BasicUser.Id) + require.Nil(t, err) + assert.True(t, member1.IsChannelMuted()) + member2, err := th.App.GetChannelMember(th.Context, channel2.Id, th.BasicUser.Id) + require.Nil(t, err) + assert.True(t, member2.IsChannelMuted()) + + // Unmute the category + updated, err = th.App.UpdateSidebarCategories(th.Context, th.BasicUser.Id, th.BasicTeam.Id, []*model.SidebarCategoryWithChannels{ + { + SidebarCategory: model.SidebarCategory{ + Id: channelsCategory.Id, + Muted: false, + }, + Channels: []string{channel1.Id, channel2.Id}, + }, + }) + require.Nil(t, err) + assert.False(t, updated[0].Muted) + + // Confirm that the channels are now unmuted + member1, err = th.App.GetChannelMember(th.Context, channel1.Id, th.BasicUser.Id) + require.Nil(t, err) + assert.False(t, member1.IsChannelMuted()) + member2, err = th.App.GetChannelMember(th.Context, channel2.Id, th.BasicUser.Id) + require.Nil(t, err) + assert.False(t, member2.IsChannelMuted()) + }) + + t.Run("should mute and unmute channels moved from an unmuted category to a muted one and back", func(t *testing.T) { + th := Setup(t).InitBasicWithAppsSidebarEnabled() + defer th.TearDown() + + // Create some channels + channel1 := th.CreateChannel(th.Context, th.BasicTeam) + th.AddUserToChannel(th.BasicUser, channel1) + + channel2 := th.CreateChannel(th.Context, th.BasicTeam) + th.AddUserToChannel(th.BasicUser, channel2) + + // And some categories + mutedCategory, err := th.App.CreateSidebarCategory(th.Context, th.BasicUser.Id, th.BasicTeam.Id, &model.SidebarCategoryWithChannels{ + SidebarCategory: model.SidebarCategory{ + DisplayName: "muted", + Muted: true, + }, + }) + require.Nil(t, err) + require.True(t, mutedCategory.Muted) + + unmutedCategory, err := th.App.CreateSidebarCategory(th.Context, th.BasicUser.Id, th.BasicTeam.Id, &model.SidebarCategoryWithChannels{ + SidebarCategory: model.SidebarCategory{ + DisplayName: "unmuted", + Muted: false, + }, + Channels: []string{channel1.Id, channel2.Id}, + }) + require.Nil(t, err) + require.False(t, unmutedCategory.Muted) + + // Move the channels + _, err = th.App.UpdateSidebarCategories(th.Context, th.BasicUser.Id, th.BasicTeam.Id, []*model.SidebarCategoryWithChannels{ + { + SidebarCategory: model.SidebarCategory{ + Id: mutedCategory.Id, + DisplayName: mutedCategory.DisplayName, + Muted: mutedCategory.Muted, + }, + Channels: []string{channel1.Id, channel2.Id}, + }, + { + SidebarCategory: model.SidebarCategory{ + Id: unmutedCategory.Id, + DisplayName: unmutedCategory.DisplayName, + Muted: unmutedCategory.Muted, + }, + Channels: []string{}, + }, + }) + require.Nil(t, err) + + // Confirm that the channels are now muted + member1, err := th.App.GetChannelMember(th.Context, channel1.Id, th.BasicUser.Id) + require.Nil(t, err) + assert.True(t, member1.IsChannelMuted()) + member2, err := th.App.GetChannelMember(th.Context, channel2.Id, th.BasicUser.Id) + require.Nil(t, err) + assert.True(t, member2.IsChannelMuted()) + + // Move the channels back + _, err = th.App.UpdateSidebarCategories(th.Context, th.BasicUser.Id, th.BasicTeam.Id, []*model.SidebarCategoryWithChannels{ + { + SidebarCategory: model.SidebarCategory{ + Id: mutedCategory.Id, + DisplayName: mutedCategory.DisplayName, + Muted: mutedCategory.Muted, + }, + Channels: []string{}, + }, + { + SidebarCategory: model.SidebarCategory{ + Id: unmutedCategory.Id, + DisplayName: unmutedCategory.DisplayName, + Muted: unmutedCategory.Muted, + }, + Channels: []string{channel1.Id, channel2.Id}, + }, + }) + require.Nil(t, err) + + // Confirm that the channels are now unmuted + member1, err = th.App.GetChannelMember(th.Context, channel1.Id, th.BasicUser.Id) + require.Nil(t, err) + assert.False(t, member1.IsChannelMuted()) + member2, err = th.App.GetChannelMember(th.Context, channel2.Id, th.BasicUser.Id) + require.Nil(t, err) + assert.False(t, member2.IsChannelMuted()) + }) + + t.Run("should not mute or unmute channels moved between muted categories", func(t *testing.T) { + th := Setup(t).InitBasicWithAppsSidebarEnabled() + defer th.TearDown() + + // Create some channels + channel1 := th.CreateChannel(th.Context, th.BasicTeam) + th.AddUserToChannel(th.BasicUser, channel1) + + channel2 := th.CreateChannel(th.Context, th.BasicTeam) + th.AddUserToChannel(th.BasicUser, channel2) + + // And some categories + category1, err := th.App.CreateSidebarCategory(th.Context, th.BasicUser.Id, th.BasicTeam.Id, &model.SidebarCategoryWithChannels{ + SidebarCategory: model.SidebarCategory{ + DisplayName: "category1", + Muted: true, + }, + }) + require.Nil(t, err) + require.True(t, category1.Muted) + + category2, err := th.App.CreateSidebarCategory(th.Context, th.BasicUser.Id, th.BasicTeam.Id, &model.SidebarCategoryWithChannels{ + SidebarCategory: model.SidebarCategory{ + DisplayName: "category2", + Muted: true, + }, + Channels: []string{channel1.Id, channel2.Id}, + }) + require.Nil(t, err) + require.True(t, category2.Muted) + + // Move the unmuted channels + _, err = th.App.UpdateSidebarCategories(th.Context, th.BasicUser.Id, th.BasicTeam.Id, []*model.SidebarCategoryWithChannels{ + { + SidebarCategory: model.SidebarCategory{ + Id: category1.Id, + DisplayName: category1.DisplayName, + Muted: category1.Muted, + }, + Channels: []string{channel1.Id, channel2.Id}, + }, + { + SidebarCategory: model.SidebarCategory{ + Id: category2.Id, + DisplayName: category2.DisplayName, + Muted: category2.Muted, + }, + Channels: []string{}, + }, + }) + require.Nil(t, err) + + // Confirm that the channels are still unmuted + member1, err := th.App.GetChannelMember(th.Context, channel1.Id, th.BasicUser.Id) + require.Nil(t, err) + assert.False(t, member1.IsChannelMuted()) + member2, err := th.App.GetChannelMember(th.Context, channel2.Id, th.BasicUser.Id) + require.Nil(t, err) + assert.False(t, member2.IsChannelMuted()) + + // Mute the channels manually + _, err = th.App.ToggleMuteChannel(th.Context, channel1.Id, th.BasicUser.Id) + require.Nil(t, err) + _, err = th.App.ToggleMuteChannel(th.Context, channel2.Id, th.BasicUser.Id) + require.Nil(t, err) + + // Move the muted channels back + _, err = th.App.UpdateSidebarCategories(th.Context, th.BasicUser.Id, th.BasicTeam.Id, []*model.SidebarCategoryWithChannels{ + { + SidebarCategory: model.SidebarCategory{ + Id: category1.Id, + DisplayName: category1.DisplayName, + Muted: category1.Muted, + }, + Channels: []string{}, + }, + { + SidebarCategory: model.SidebarCategory{ + Id: category2.Id, + DisplayName: category2.DisplayName, + Muted: category2.Muted, + }, + Channels: []string{channel1.Id, channel2.Id}, + }, + }) + require.Nil(t, err) + + // Confirm that the channels are still muted + member1, err = th.App.GetChannelMember(th.Context, channel1.Id, th.BasicUser.Id) + require.Nil(t, err) + assert.True(t, member1.IsChannelMuted()) + member2, err = th.App.GetChannelMember(th.Context, channel2.Id, th.BasicUser.Id) + require.Nil(t, err) + assert.True(t, member2.IsChannelMuted()) + }) + + t.Run("should not mute or unmute channels moved between unmuted categories", func(t *testing.T) { + th := Setup(t).InitBasicWithAppsSidebarEnabled() + defer th.TearDown() + + // Create some channels + channel1 := th.CreateChannel(th.Context, th.BasicTeam) + th.AddUserToChannel(th.BasicUser, channel1) + + channel2 := th.CreateChannel(th.Context, th.BasicTeam) + th.AddUserToChannel(th.BasicUser, channel2) + + // And some categories + category1, err := th.App.CreateSidebarCategory(th.Context, th.BasicUser.Id, th.BasicTeam.Id, &model.SidebarCategoryWithChannels{ + SidebarCategory: model.SidebarCategory{ + DisplayName: "category1", + Muted: false, + }, + }) + require.Nil(t, err) + require.False(t, category1.Muted) + + category2, err := th.App.CreateSidebarCategory(th.Context, th.BasicUser.Id, th.BasicTeam.Id, &model.SidebarCategoryWithChannels{ + SidebarCategory: model.SidebarCategory{ + DisplayName: "category2", + Muted: false, + }, + Channels: []string{channel1.Id, channel2.Id}, + }) + require.Nil(t, err) + require.False(t, category2.Muted) + + // Move the unmuted channels + _, err = th.App.UpdateSidebarCategories(th.Context, th.BasicUser.Id, th.BasicTeam.Id, []*model.SidebarCategoryWithChannels{ + { + SidebarCategory: model.SidebarCategory{ + Id: category1.Id, + DisplayName: category1.DisplayName, + Muted: category1.Muted, + }, + Channels: []string{channel1.Id, channel2.Id}, + }, + { + SidebarCategory: model.SidebarCategory{ + Id: category2.Id, + DisplayName: category2.DisplayName, + Muted: category2.Muted, + }, + Channels: []string{}, + }, + }) + require.Nil(t, err) + + // Confirm that the channels are still unmuted + member1, err := th.App.GetChannelMember(th.Context, channel1.Id, th.BasicUser.Id) + require.Nil(t, err) + assert.False(t, member1.IsChannelMuted()) + member2, err := th.App.GetChannelMember(th.Context, channel2.Id, th.BasicUser.Id) + require.Nil(t, err) + assert.False(t, member2.IsChannelMuted()) + + // Mute the channels manually + _, err = th.App.ToggleMuteChannel(th.Context, channel1.Id, th.BasicUser.Id) + require.Nil(t, err) + _, err = th.App.ToggleMuteChannel(th.Context, channel2.Id, th.BasicUser.Id) + require.Nil(t, err) + + // Move the muted channels back + _, err = th.App.UpdateSidebarCategories(th.Context, th.BasicUser.Id, th.BasicTeam.Id, []*model.SidebarCategoryWithChannels{ + { + SidebarCategory: model.SidebarCategory{ + Id: category1.Id, + DisplayName: category1.DisplayName, + Muted: category1.Muted, + }, + Channels: []string{}, + }, + { + SidebarCategory: model.SidebarCategory{ + Id: category2.Id, + DisplayName: category2.DisplayName, + Muted: category2.Muted, + }, + Channels: []string{channel1.Id, channel2.Id}, + }, + }) + require.Nil(t, err) + + // Confirm that the channels are still muted + member1, err = th.App.GetChannelMember(th.Context, channel1.Id, th.BasicUser.Id) + require.Nil(t, err) + assert.True(t, member1.IsChannelMuted()) + member2, err = th.App.GetChannelMember(th.Context, channel2.Id, th.BasicUser.Id) + require.Nil(t, err) + assert.True(t, member2.IsChannelMuted()) + }) +} diff --git a/server/channels/app/channel_test.go b/server/channels/app/channel_test.go index f06449368c..2b427ba806 100644 --- a/server/channels/app/channel_test.go +++ b/server/channels/app/channel_test.go @@ -18,9 +18,9 @@ import ( "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/app/users" - "github.com/mattermost/mattermost-server/v6/server/channels/store/storetest/mocks" + "github.com/mattermost/mattermost-server/server/v8/channels/app/users" + "github.com/mattermost/mattermost-server/server/v8/channels/store/storetest/mocks" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestPermanentDeleteChannel(t *testing.T) { @@ -554,7 +554,7 @@ func TestGetDirectChannelCreatesChannelMemberHistoryRecord(t *testing.T) { } func TestAddUserToChannelCreatesChannelMemberHistoryRecord(t *testing.T) { - th := Setup(t).InitBasic() + th := Setup(t).InitBasic().DeleteBots() defer th.TearDown() // create a user and add it to a channel @@ -609,6 +609,85 @@ func TestLeaveDefaultChannel(t *testing.T) { _, err = th.App.GetChannelMember(th.Context, townSquare.Id, guest.Id) assert.NotNil(t, err) }) + + t.Run("Trying to leave the default channel should not delete thread memberships", func(t *testing.T) { + post := &model.Post{ + ChannelId: townSquare.Id, + Message: "root post", + UserId: th.BasicUser.Id, + } + rpost, err := th.App.CreatePost(th.Context, post, th.BasicChannel, false, true) + require.Nil(t, err) + + reply := &model.Post{ + ChannelId: townSquare.Id, + Message: "reply post", + UserId: th.BasicUser.Id, + RootId: rpost.Id, + } + _, err = th.App.CreatePost(th.Context, reply, th.BasicChannel, false, true) + require.Nil(t, err) + + threads, err := th.App.GetThreadsForUser(th.BasicUser.Id, townSquare.TeamId, model.GetUserThreadsOpts{}) + require.Nil(t, err) + require.Len(t, threads.Threads, 1) + + err = th.App.LeaveChannel(th.Context, townSquare.Id, th.BasicUser.Id) + assert.NotNil(t, err, "It should fail to remove a regular user from the default channel") + assert.Equal(t, err.Id, "api.channel.remove.default.app_error") + + threads, err = th.App.GetThreadsForUser(th.BasicUser.Id, townSquare.TeamId, model.GetUserThreadsOpts{}) + require.Nil(t, err) + require.Len(t, threads.Threads, 1) + }) +} + +func TestLeaveChannel(t *testing.T) { + th := Setup(t).InitBasic() + defer th.TearDown() + + createThread := func(channel *model.Channel) (rpost *model.Post) { + t.Helper() + post := &model.Post{ + ChannelId: channel.Id, + Message: "root post", + UserId: th.BasicUser.Id, + } + + rpost, err := th.App.CreatePost(th.Context, post, th.BasicChannel, false, true) + require.Nil(t, err) + + reply := &model.Post{ + ChannelId: channel.Id, + Message: "reply post", + UserId: th.BasicUser.Id, + RootId: rpost.Id, + } + _, err = th.App.CreatePost(th.Context, reply, th.BasicChannel, false, true) + require.Nil(t, err) + + return rpost + } + + t.Run("thread memberships are deleted", func(t *testing.T) { + createThread(th.BasicChannel) + channel2 := th.createChannel(th.Context, th.BasicTeam, model.ChannelTypeOpen) + createThread(channel2) + + threads, err := th.App.GetThreadsForUser(th.BasicUser.Id, th.BasicChannel.TeamId, model.GetUserThreadsOpts{}) + require.Nil(t, err) + require.Len(t, threads.Threads, 2) + + err = th.App.LeaveChannel(th.Context, th.BasicChannel.Id, th.BasicUser.Id) + require.Nil(t, err) + + _, err = th.App.GetChannelMember(th.Context, th.BasicChannel.Id, th.BasicUser.Id) + require.NotNil(t, err, "It should remove channel membership") + + threads, err = th.App.GetThreadsForUser(th.BasicUser.Id, th.BasicChannel.TeamId, model.GetUserThreadsOpts{}) + require.Nil(t, err) + require.Len(t, threads.Threads, 1) + }) } func TestLeaveLastChannel(t *testing.T) { diff --git a/server/channels/app/channels.go b/server/channels/app/channels.go index f2ae0e6d11..57252b403a 100644 --- a/server/channels/app/channels.go +++ b/server/channels/app/channels.go @@ -11,16 +11,16 @@ import ( "github.com/pkg/errors" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/plugin" - "github.com/mattermost/mattermost-server/v6/server/channels/app/imaging" - "github.com/mattermost/mattermost-server/v6/server/channels/app/request" - "github.com/mattermost/mattermost-server/v6/server/channels/einterfaces" - "github.com/mattermost/mattermost-server/v6/server/channels/product" - "github.com/mattermost/mattermost-server/v6/server/config" - "github.com/mattermost/mattermost-server/v6/server/platform/services/imageproxy" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/filestore" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/app/imaging" + "github.com/mattermost/mattermost-server/server/v8/channels/app/request" + "github.com/mattermost/mattermost-server/server/v8/channels/einterfaces" + "github.com/mattermost/mattermost-server/server/v8/channels/product" + "github.com/mattermost/mattermost-server/server/v8/config" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/services/imageproxy" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/filestore" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/plugin" ) const ServerKey product.ServiceKey = "server" diff --git a/server/channels/app/cloud.go b/server/channels/app/cloud.go index 29cd5a50c1..3114368f1f 100644 --- a/server/channels/app/cloud.go +++ b/server/channels/app/cloud.go @@ -10,10 +10,10 @@ import ( "net/http" "time" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/einterfaces" - "github.com/mattermost/mattermost-server/v6/server/channels/product" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/einterfaces" + "github.com/mattermost/mattermost-server/server/v8/channels/product" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) // Ensure cloud service wrapper implements `product.CloudService` diff --git a/server/channels/app/cluster_handlers.go b/server/channels/app/cluster_handlers.go index 896eee9eb1..7c5ce3b983 100644 --- a/server/channels/app/cluster_handlers.go +++ b/server/channels/app/cluster_handlers.go @@ -6,9 +6,9 @@ package app import ( "encoding/json" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/plugin" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/plugin" ) func (s *Server) clusterInstallPluginHandler(msg *model.ClusterMessage) { diff --git a/server/channels/app/collection.go b/server/channels/app/collection.go index f144fb3237..dbe7c0d8a3 100644 --- a/server/channels/app/collection.go +++ b/server/channels/app/collection.go @@ -6,8 +6,8 @@ package app import ( "net/http" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) func (a *App) RegisterCollectionAndTopic(pluginID, collectionType, topicType string) error { diff --git a/server/channels/app/command.go b/server/channels/app/command.go index acf4e496c2..1e94e5cdad 100644 --- a/server/channels/app/command.go +++ b/server/channels/app/command.go @@ -14,11 +14,11 @@ import ( "sync" "unicode" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/app/request" - "github.com/mattermost/mattermost-server/v6/server/channels/store" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/i18n" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/app/request" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/i18n" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) const ( diff --git a/server/channels/app/command_autocomplete.go b/server/channels/app/command_autocomplete.go index 434fa3cd20..6132332d31 100644 --- a/server/channels/app/command_autocomplete.go +++ b/server/channels/app/command_autocomplete.go @@ -11,9 +11,9 @@ import ( "sort" "strings" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/app/request" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/app/request" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) // AutocompleteDynamicArgProvider dynamically provides auto-completion args for built-in commands. diff --git a/server/channels/app/command_autocomplete_test.go b/server/channels/app/command_autocomplete_test.go index 19d8bc9817..99e5d40855 100644 --- a/server/channels/app/command_autocomplete_test.go +++ b/server/channels/app/command_autocomplete_test.go @@ -9,9 +9,9 @@ import ( "github.com/stretchr/testify/assert" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/app/request" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/i18n" + "github.com/mattermost/mattermost-server/server/v8/channels/app/request" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/i18n" ) func TestParseStaticListArgument(t *testing.T) { diff --git a/server/channels/app/compliance.go b/server/channels/app/compliance.go index 95c68ab9ba..40e333825f 100644 --- a/server/channels/app/compliance.go +++ b/server/channels/app/compliance.go @@ -8,9 +8,9 @@ import ( "net/http" "os" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) func (a *App) GetComplianceReports(page, perPage int) (model.Compliances, *model.AppError) { diff --git a/server/channels/app/config.go b/server/channels/app/config.go index 39961922c5..d7265935c3 100644 --- a/server/channels/app/config.go +++ b/server/channels/app/config.go @@ -14,10 +14,10 @@ import ( "github.com/pkg/errors" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/utils" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mail" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/utils" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mail" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) const ( @@ -40,6 +40,10 @@ func (a *App) UpdateConfig(f func(*model.Config)) { a.Srv().platform.UpdateConfig(f) } +func (a *App) IsConfigReadOnly() bool { + return a.Srv().platform.IsConfigReadOnly() +} + func (a *App) ReloadConfig() error { return a.Srv().platform.ReloadConfig() } diff --git a/server/channels/app/config_test.go b/server/channels/app/config_test.go index 65a3ae4d92..102de38754 100644 --- a/server/channels/app/config_test.go +++ b/server/channels/app/config_test.go @@ -11,9 +11,9 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store/storetest/mocks" - "github.com/mattermost/mattermost-server/v6/server/channels/utils" + "github.com/mattermost/mattermost-server/server/v8/channels/store/storetest/mocks" + "github.com/mattermost/mattermost-server/server/v8/channels/utils" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestAsymmetricSigningKey(t *testing.T) { diff --git a/server/channels/app/context.go b/server/channels/app/context.go index 5a289e6037..03cb895b37 100644 --- a/server/channels/app/context.go +++ b/server/channels/app/context.go @@ -6,9 +6,9 @@ package app import ( "context" - "github.com/mattermost/mattermost-server/v6/plugin" - "github.com/mattermost/mattermost-server/v6/server/channels/app/request" - "github.com/mattermost/mattermost-server/v6/server/channels/store/sqlstore" + "github.com/mattermost/mattermost-server/server/v8/channels/app/request" + "github.com/mattermost/mattermost-server/server/v8/channels/store/sqlstore" + "github.com/mattermost/mattermost-server/server/v8/plugin" ) // WithMaster adds the context value that master DB should be selected for this request. diff --git a/server/channels/app/data_retention.go b/server/channels/app/data_retention.go index e7b914e14d..dd2ef11dca 100644 --- a/server/channels/app/data_retention.go +++ b/server/channels/app/data_retention.go @@ -6,7 +6,7 @@ package app import ( "net/http" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) func (a *App) GetGlobalRetentionPolicy() (*model.GlobalRetentionPolicy, *model.AppError) { diff --git a/server/channels/app/download.go b/server/channels/app/download.go index 9646c357f7..ec6ddf8b14 100644 --- a/server/channels/app/download.go +++ b/server/channels/app/download.go @@ -11,8 +11,8 @@ import ( "github.com/pkg/errors" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/utils" + "github.com/mattermost/mattermost-server/server/v8/channels/utils" + "github.com/mattermost/mattermost-server/server/v8/model" ) const ( diff --git a/server/channels/app/download_test.go b/server/channels/app/download_test.go index 7830647d27..172c527c19 100644 --- a/server/channels/app/download_test.go +++ b/server/channels/app/download_test.go @@ -11,7 +11,7 @@ import ( "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestDownloadFromURL(t *testing.T) { diff --git a/server/channels/app/draft.go b/server/channels/app/draft.go index a8ca1ef9d2..83e9d748ff 100644 --- a/server/channels/app/draft.go +++ b/server/channels/app/draft.go @@ -9,10 +9,10 @@ import ( "errors" "net/http" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/app/request" - "github.com/mattermost/mattermost-server/v6/server/channels/store" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/app/request" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) func (a *App) GetDraft(userID, channelID, rootID string) (*model.Draft, *model.AppError) { diff --git a/server/channels/app/draft_test.go b/server/channels/app/draft_test.go index 83c7d090d8..ac19cedac0 100644 --- a/server/channels/app/draft_test.go +++ b/server/channels/app/draft_test.go @@ -10,8 +10,8 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/utils/testutils" + "github.com/mattermost/mattermost-server/server/v8/channels/utils/testutils" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestGetDraft(t *testing.T) { diff --git a/server/channels/app/email/email.go b/server/channels/app/email/email.go index bb64e6efd0..2b3fcacef8 100644 --- a/server/channels/app/email/email.go +++ b/server/channels/app/email/email.go @@ -15,11 +15,11 @@ import ( "github.com/pkg/errors" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/i18n" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mail" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/templates" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/i18n" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mail" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/templates" "github.com/microcosm-cc/bluemonday" ) diff --git a/server/channels/app/email/email_batching.go b/server/channels/app/email/email_batching.go index 91e4bd1204..1988a358cd 100644 --- a/server/channels/app/email/email_batching.go +++ b/server/channels/app/email/email_batching.go @@ -14,9 +14,9 @@ import ( "sync" "time" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/i18n" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/i18n" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) const ( diff --git a/server/channels/app/email/email_batching_test.go b/server/channels/app/email/email_batching_test.go index 4444bc253d..087351e6a3 100644 --- a/server/channels/app/email/email_batching_test.go +++ b/server/channels/app/email/email_batching_test.go @@ -12,7 +12,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestHandleNewNotifications(t *testing.T) { diff --git a/server/channels/app/email/email_test.go b/server/channels/app/email/email_test.go index 3fb2e09a7a..7a8c87979e 100644 --- a/server/channels/app/email/email_test.go +++ b/server/channels/app/email/email_test.go @@ -12,8 +12,8 @@ import ( "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mail" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mail" ) func TestCondenseSiteURL(t *testing.T) { diff --git a/server/channels/app/email/helper_test.go b/server/channels/app/email/helper_test.go index b4c31cf134..52f97c0af7 100644 --- a/server/channels/app/email/helper_test.go +++ b/server/channels/app/email/helper_test.go @@ -9,15 +9,15 @@ import ( "path/filepath" "testing" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/plugin/plugintest/mock" - "github.com/mattermost/mattermost-server/v6/server/channels/app/users" - "github.com/mattermost/mattermost-server/v6/server/channels/store" - "github.com/mattermost/mattermost-server/v6/server/channels/store/storetest/mocks" - "github.com/mattermost/mattermost-server/v6/server/channels/testlib" - "github.com/mattermost/mattermost-server/v6/server/config" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/templates" + "github.com/mattermost/mattermost-server/server/v8/channels/app/users" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/store/storetest/mocks" + "github.com/mattermost/mattermost-server/server/v8/channels/testlib" + "github.com/mattermost/mattermost-server/server/v8/config" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/templates" + "github.com/mattermost/mattermost-server/server/v8/plugin/plugintest/mock" ) type TestHelper struct { diff --git a/server/channels/app/email/main_test.go b/server/channels/app/email/main_test.go index fc9ea8f28d..a2bcf53cdb 100644 --- a/server/channels/app/email/main_test.go +++ b/server/channels/app/email/main_test.go @@ -7,7 +7,7 @@ import ( "flag" "testing" - "github.com/mattermost/mattermost-server/v6/server/channels/testlib" + "github.com/mattermost/mattermost-server/server/v8/channels/testlib" ) var mainHelper *testlib.MainHelper diff --git a/server/channels/app/email/mocks/ServiceInterface.go b/server/channels/app/email/mocks/ServiceInterface.go index 04a6ddbf24..8dcf51de5d 100644 --- a/server/channels/app/email/mocks/ServiceInterface.go +++ b/server/channels/app/email/mocks/ServiceInterface.go @@ -7,13 +7,13 @@ package mocks import ( io "io" - i18n "github.com/mattermost/mattermost-server/v6/server/platform/shared/i18n" + i18n "github.com/mattermost/mattermost-server/server/v8/platform/shared/i18n" mock "github.com/stretchr/testify/mock" - model "github.com/mattermost/mattermost-server/v6/model" + model "github.com/mattermost/mattermost-server/server/v8/model" - templates "github.com/mattermost/mattermost-server/v6/server/platform/shared/templates" + templates "github.com/mattermost/mattermost-server/server/v8/platform/shared/templates" throttled "github.com/throttled/throttled" ) diff --git a/server/channels/app/email/notification_email.go b/server/channels/app/email/notification_email.go index 542f43aff5..5bf441be8c 100644 --- a/server/channels/app/email/notification_email.go +++ b/server/channels/app/email/notification_email.go @@ -10,10 +10,10 @@ import ( "path/filepath" "strings" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/utils" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/i18n" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/utils" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/i18n" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) type FieldRow struct { diff --git a/server/channels/app/email/notification_email_test.go b/server/channels/app/email/notification_email_test.go index ee599c988a..f9bf6e6ae1 100644 --- a/server/channels/app/email/notification_email_test.go +++ b/server/channels/app/email/notification_email_test.go @@ -8,7 +8,7 @@ import ( "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestProcessMessageAttachments(t *testing.T) { diff --git a/server/channels/app/email/service.go b/server/channels/app/email/service.go index 3aa0b658f4..0ddf55f35f 100644 --- a/server/channels/app/email/service.go +++ b/server/channels/app/email/service.go @@ -12,12 +12,12 @@ import ( "github.com/throttled/throttled" "github.com/throttled/throttled/store/memstore" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/app/users" - "github.com/mattermost/mattermost-server/v6/server/channels/store" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/i18n" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/templates" + "github.com/mattermost/mattermost-server/server/v8/channels/app/users" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/i18n" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/templates" ) const ( diff --git a/server/channels/app/email/utils.go b/server/channels/app/email/utils.go index e13d610ac2..225b9178f0 100644 --- a/server/channels/app/email/utils.go +++ b/server/channels/app/email/utils.go @@ -4,8 +4,8 @@ package email import ( - "github.com/mattermost/mattermost-server/v6/server/channels/utils" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mail" + "github.com/mattermost/mattermost-server/server/v8/channels/utils" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mail" ) func (es *Service) mailServiceConfig(replyToAddress string) *mail.SMTPConfig { diff --git a/server/channels/app/email_test.go b/server/channels/app/email_test.go index c7d3c56e6e..d0969ccd67 100644 --- a/server/channels/app/email_test.go +++ b/server/channels/app/email_test.go @@ -11,7 +11,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestSendInviteEmailRateLimits(t *testing.T) { diff --git a/server/channels/app/emoji.go b/server/channels/app/emoji.go index 92a9662376..5a7a847d0a 100644 --- a/server/channels/app/emoji.go +++ b/server/channels/app/emoji.go @@ -22,11 +22,11 @@ import ( "github.com/disintegration/imaging" _ "golang.org/x/image/webp" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/app/request" - "github.com/mattermost/mattermost-server/v6/server/channels/store" - "github.com/mattermost/mattermost-server/v6/server/channels/utils" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/app/request" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/utils" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) const ( diff --git a/server/channels/app/enterprise.go b/server/channels/app/enterprise.go index f8e913a828..bf7a18b05c 100644 --- a/server/channels/app/enterprise.go +++ b/server/channels/app/enterprise.go @@ -4,8 +4,8 @@ package app import ( - "github.com/mattermost/mattermost-server/v6/server/channels/einterfaces" - ejobs "github.com/mattermost/mattermost-server/v6/server/channels/einterfaces/jobs" + "github.com/mattermost/mattermost-server/server/v8/channels/einterfaces" + ejobs "github.com/mattermost/mattermost-server/server/v8/channels/einterfaces/jobs" ) var accountMigrationInterface func(*App) einterfaces.AccountMigrationInterface @@ -50,6 +50,12 @@ func RegisterJobsElasticsearchIndexerInterface(f func(*Server) ejobs.IndexerJobI jobsElasticsearchIndexerInterface = f } +var jobsElasticsearchFixChannelIndexInterface func(*Server) ejobs.ElasticsearchFixChannelIndexInterface + +func RegisterJobsElasticsearchFixChannelIndexInterface(f func(*Server) ejobs.ElasticsearchFixChannelIndexInterface) { + jobsElasticsearchFixChannelIndexInterface = f +} + var jobsLdapSyncInterface func(*App) ejobs.LdapSyncInterface func RegisterJobsLdapSyncInterface(f func(*App) ejobs.LdapSyncInterface) { diff --git a/server/channels/app/enterprise_test.go b/server/channels/app/enterprise_test.go index e518b1b078..79ec61cc6d 100644 --- a/server/channels/app/enterprise_test.go +++ b/server/channels/app/enterprise_test.go @@ -9,10 +9,10 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/einterfaces" - "github.com/mattermost/mattermost-server/v6/server/channels/einterfaces/mocks" - storemocks "github.com/mattermost/mattermost-server/v6/server/channels/store/storetest/mocks" + "github.com/mattermost/mattermost-server/server/v8/channels/einterfaces" + "github.com/mattermost/mattermost-server/server/v8/channels/einterfaces/mocks" + storemocks "github.com/mattermost/mattermost-server/server/v8/channels/store/storetest/mocks" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestSAMLSettings(t *testing.T) { diff --git a/server/channels/app/expirynotify.go b/server/channels/app/expirynotify.go index 16d56bacf4..6155815b54 100644 --- a/server/channels/app/expirynotify.go +++ b/server/channels/app/expirynotify.go @@ -6,9 +6,9 @@ package app import ( "net/http" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/i18n" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/i18n" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) const ( diff --git a/server/channels/app/expirynotify_test.go b/server/channels/app/expirynotify_test.go index 42b74e802b..3db5d09003 100644 --- a/server/channels/app/expirynotify_test.go +++ b/server/channels/app/expirynotify_test.go @@ -10,7 +10,7 @@ import ( "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestNotifySessionsExpired(t *testing.T) { diff --git a/server/channels/app/export.go b/server/channels/app/export.go index 5dd00a33eb..1ba7450bb1 100644 --- a/server/channels/app/export.go +++ b/server/channels/app/export.go @@ -18,11 +18,11 @@ import ( "github.com/pkg/errors" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/app/imports" - "github.com/mattermost/mattermost-server/v6/server/channels/app/request" - "github.com/mattermost/mattermost-server/v6/server/channels/store" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/app/imports" + "github.com/mattermost/mattermost-server/server/v8/channels/app/request" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) // We use this map to identify the exportable preferences. diff --git a/server/channels/app/export_converters.go b/server/channels/app/export_converters.go index 23fd750ff2..10b943caef 100644 --- a/server/channels/app/export_converters.go +++ b/server/channels/app/export_converters.go @@ -6,8 +6,8 @@ package app import ( "strings" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/app/imports" + "github.com/mattermost/mattermost-server/server/v8/channels/app/imports" + "github.com/mattermost/mattermost-server/server/v8/model" ) func ImportLineFromTeam(team *model.TeamForExport) *imports.LineImportData { diff --git a/server/channels/app/export_test.go b/server/channels/app/export_test.go index 1d97d80826..5a6fa59752 100644 --- a/server/channels/app/export_test.go +++ b/server/channels/app/export_test.go @@ -14,9 +14,9 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/utils" - "github.com/mattermost/mattermost-server/v6/server/channels/utils/fileutils" + "github.com/mattermost/mattermost-server/server/v8/channels/utils" + "github.com/mattermost/mattermost-server/server/v8/channels/utils/fileutils" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestReactionsOfPost(t *testing.T) { diff --git a/server/channels/app/extract_plugin_tar.go b/server/channels/app/extract_plugin_tar.go index 9640f5e906..5212e73e12 100644 --- a/server/channels/app/extract_plugin_tar.go +++ b/server/channels/app/extract_plugin_tar.go @@ -13,7 +13,7 @@ import ( "github.com/pkg/errors" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) // extractTarGz takes in an io.Reader containing the bytes for a .tar.gz file and diff --git a/server/channels/app/featureflag/feature_flags_sync.go b/server/channels/app/featureflag/feature_flags_sync.go index 8fb51fdb6a..7d1af97a7a 100644 --- a/server/channels/app/featureflag/feature_flags_sync.go +++ b/server/channels/app/featureflag/feature_flags_sync.go @@ -13,8 +13,8 @@ import ( "github.com/splitio/go-client/v6/splitio/client" "github.com/splitio/go-client/v6/splitio/conf" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) type SyncParams struct { diff --git a/server/channels/app/featureflag/feature_flags_sync_test.go b/server/channels/app/featureflag/feature_flags_sync_test.go index dc4f59a501..eb967d00da 100644 --- a/server/channels/app/featureflag/feature_flags_sync_test.go +++ b/server/channels/app/featureflag/feature_flags_sync_test.go @@ -8,7 +8,7 @@ import ( "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestGetStructFields(t *testing.T) { diff --git a/server/channels/app/featureflag/split_logger.go b/server/channels/app/featureflag/split_logger.go index f806d75793..6a61a9a324 100644 --- a/server/channels/app/featureflag/split_logger.go +++ b/server/channels/app/featureflag/split_logger.go @@ -6,7 +6,7 @@ package featureflag import ( "fmt" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) type splitLogger struct { diff --git a/server/channels/app/file.go b/server/channels/app/file.go index 826f224dc8..bd7ce30577 100644 --- a/server/channels/app/file.go +++ b/server/channels/app/file.go @@ -24,16 +24,16 @@ import ( "sync" "time" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/plugin" - "github.com/mattermost/mattermost-server/v6/server/channels/app/imaging" - "github.com/mattermost/mattermost-server/v6/server/channels/app/request" - "github.com/mattermost/mattermost-server/v6/server/channels/product" - "github.com/mattermost/mattermost-server/v6/server/channels/store" - "github.com/mattermost/mattermost-server/v6/server/channels/utils" - "github.com/mattermost/mattermost-server/v6/server/platform/services/docextractor" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/filestore" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/app/imaging" + "github.com/mattermost/mattermost-server/server/v8/channels/app/request" + "github.com/mattermost/mattermost-server/server/v8/channels/product" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/utils" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/services/docextractor" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/filestore" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/plugin" "github.com/pkg/errors" ) diff --git a/server/channels/app/file_bench_test.go b/server/channels/app/file_bench_test.go index 2ab58f51aa..315bc304ef 100644 --- a/server/channels/app/file_bench_test.go +++ b/server/channels/app/file_bench_test.go @@ -13,7 +13,7 @@ import ( "testing" "time" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) var randomJPEG []byte diff --git a/server/channels/app/file_helper.go b/server/channels/app/file_helper.go index a3059ff30b..309867e3b6 100644 --- a/server/channels/app/file_helper.go +++ b/server/channels/app/file_helper.go @@ -6,7 +6,7 @@ package app import ( "net/http" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) // removeInaccessibleContentFromFilesSlice removes content from the files beyond the cloud plan's limit diff --git a/server/channels/app/file_helper_test.go b/server/channels/app/file_helper_test.go index b3de7be086..b1b26be527 100644 --- a/server/channels/app/file_helper_test.go +++ b/server/channels/app/file_helper_test.go @@ -9,7 +9,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestFilterInaccessibleFiles(t *testing.T) { diff --git a/server/channels/app/file_test.go b/server/channels/app/file_test.go index 842e69fb55..5ba9acef39 100644 --- a/server/channels/app/file_test.go +++ b/server/channels/app/file_test.go @@ -16,13 +16,13 @@ import ( "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - eMocks "github.com/mattermost/mattermost-server/v6/server/channels/einterfaces/mocks" - "github.com/mattermost/mattermost-server/v6/server/channels/store" - storemocks "github.com/mattermost/mattermost-server/v6/server/channels/store/storetest/mocks" - "github.com/mattermost/mattermost-server/v6/server/channels/utils/fileutils" - "github.com/mattermost/mattermost-server/v6/server/platform/services/searchengine/mocks" - filesStoreMocks "github.com/mattermost/mattermost-server/v6/server/platform/shared/filestore/mocks" + eMocks "github.com/mattermost/mattermost-server/server/v8/channels/einterfaces/mocks" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + storemocks "github.com/mattermost/mattermost-server/server/v8/channels/store/storetest/mocks" + "github.com/mattermost/mattermost-server/server/v8/channels/utils/fileutils" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/services/searchengine/mocks" + filesStoreMocks "github.com/mattermost/mattermost-server/server/v8/platform/shared/filestore/mocks" ) func TestGeneratePublicLinkHash(t *testing.T) { diff --git a/server/channels/app/group.go b/server/channels/app/group.go index 3faefa869c..d004e4d4d9 100644 --- a/server/channels/app/group.go +++ b/server/channels/app/group.go @@ -8,8 +8,8 @@ import ( "errors" "net/http" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" ) func (a *App) GetGroup(id string, opts *model.GetGroupOpts, viewRestrictions *model.ViewUsersRestrictions) (*model.Group, *model.AppError) { diff --git a/server/channels/app/group_test.go b/server/channels/app/group_test.go index fb53d3e637..bf6b51eeec 100644 --- a/server/channels/app/group_test.go +++ b/server/channels/app/group_test.go @@ -9,7 +9,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestGetGroup(t *testing.T) { diff --git a/server/channels/app/helper_test.go b/server/channels/app/helper_test.go index 1b45e5c1b2..e192560c43 100644 --- a/server/channels/app/helper_test.go +++ b/server/channels/app/helper_test.go @@ -15,16 +15,16 @@ import ( "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/plugin" - "github.com/mattermost/mattermost-server/v6/server/channels/app/request" - "github.com/mattermost/mattermost-server/v6/server/channels/einterfaces" - "github.com/mattermost/mattermost-server/v6/server/channels/store" - "github.com/mattermost/mattermost-server/v6/server/channels/store/sqlstore" - "github.com/mattermost/mattermost-server/v6/server/channels/store/storetest/mocks" - "github.com/mattermost/mattermost-server/v6/server/channels/testlib" - "github.com/mattermost/mattermost-server/v6/server/config" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/app/request" + "github.com/mattermost/mattermost-server/server/v8/channels/einterfaces" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/store/sqlstore" + "github.com/mattermost/mattermost-server/server/v8/channels/store/storetest/mocks" + "github.com/mattermost/mattermost-server/server/v8/channels/testlib" + "github.com/mattermost/mattermost-server/server/v8/config" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/plugin" ) type TestHelper struct { @@ -52,8 +52,8 @@ func setupTestHelper(dbStore store.Store, enterprise bool, includeCacheLayer boo } configStore := config.NewTestMemoryStore() - memoryConfig := configStore.Get() + memoryConfig.SqlSettings = *mainHelper.GetSQLSettings() *memoryConfig.PluginSettings.Directory = filepath.Join(tempWorkspace, "plugins") *memoryConfig.PluginSettings.ClientDirectory = filepath.Join(tempWorkspace, "webapp") *memoryConfig.PluginSettings.AutomaticPrepackagedPlugins = false @@ -138,7 +138,7 @@ func setupTestHelper(dbStore store.Store, enterprise bool, includeCacheLayer boo return th } -func Setup(tb testing.TB) *TestHelper { +func Setup(tb testing.TB, options ...Option) *TestHelper { if testing.Short() { tb.SkipNow() } @@ -147,7 +147,7 @@ func Setup(tb testing.TB) *TestHelper { dbStore.MarkSystemRanUnitTests() mainHelper.PreloadMigrations() - return setupTestHelper(dbStore, false, true, nil, tb) + return setupTestHelper(dbStore, false, true, options, tb) } func SetupWithoutPreloadMigrations(tb testing.TB) *TestHelper { @@ -157,13 +157,16 @@ func SetupWithoutPreloadMigrations(tb testing.TB) *TestHelper { dbStore := mainHelper.GetStore() dbStore.DropAllTables() dbStore.MarkSystemRanUnitTests() + // Only boards migrations are applied + mainHelper.PreloadBoardsMigrationsIfNeeded() return setupTestHelper(dbStore, false, true, nil, tb) } func SetupWithStoreMock(tb testing.TB) *TestHelper { mockStore := testlib.GetMockStoreForSetupFunctions() - th := setupTestHelper(mockStore, false, false, nil, tb) + setupOptions := []Option{SkipProductsInitialization()} + th := setupTestHelper(mockStore, false, false, setupOptions, tb) statusMock := mocks.StatusStore{} statusMock.On("UpdateExpiredDNDStatuses").Return([]*model.Status{}, nil) statusMock.On("Get", "user1").Return(&model.Status{UserId: "user1", Status: model.StatusOnline}, nil) @@ -184,7 +187,8 @@ func SetupWithStoreMock(tb testing.TB) *TestHelper { func SetupEnterpriseWithStoreMock(tb testing.TB) *TestHelper { mockStore := testlib.GetMockStoreForSetupFunctions() - th := setupTestHelper(mockStore, true, false, nil, tb) + setupOptions := []Option{SkipProductsInitialization()} + th := setupTestHelper(mockStore, true, false, setupOptions, tb) statusMock := mocks.StatusStore{} statusMock.On("UpdateExpiredDNDStatuses").Return([]*model.Status{}, nil) statusMock.On("Get", "user1").Return(&model.Status{UserId: "user1", Status: model.StatusOnline}, nil) @@ -249,6 +253,20 @@ func (th *TestHelper) InitBasic() *TestHelper { return th } +func (th *TestHelper) InitBasicWithAppsSidebarEnabled() *TestHelper { + th.App.Config().FeatureFlags.AppsSidebarCategory = true + + return th.InitBasic() +} + +func (th *TestHelper) DeleteBots() *TestHelper { + preexistingBots, _ := th.App.GetBots(&model.BotGetOptions{Page: 0, PerPage: 100}) + for _, bot := range preexistingBots { + th.App.PermanentDeleteBot(bot.UserId) + } + return th +} + func (*TestHelper) MakeEmail() string { return "success_" + model.NewId() + "@simulator.amazonses.com" } diff --git a/server/channels/app/hosted_customer.go b/server/channels/app/hosted_customer.go index d27945e85d..8b95353e7f 100644 --- a/server/channels/app/hosted_customer.go +++ b/server/channels/app/hosted_customer.go @@ -4,7 +4,7 @@ package app import ( - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) func (a *App) NotifySelfHostedSignupProgress(progress string, userId string) { diff --git a/server/channels/app/image.go b/server/channels/app/image.go index e65cf3527a..113402a768 100644 --- a/server/channels/app/image.go +++ b/server/channels/app/image.go @@ -7,7 +7,7 @@ import ( "fmt" "io" - "github.com/mattermost/mattermost-server/v6/server/channels/app/imaging" + "github.com/mattermost/mattermost-server/server/v8/channels/app/imaging" ) func checkImageResolutionLimit(w, h int, maxRes int64) error { diff --git a/server/channels/app/imaging/decode_bench_test.go b/server/channels/app/imaging/decode_bench_test.go index 88495c8f32..1fdec80414 100644 --- a/server/channels/app/imaging/decode_bench_test.go +++ b/server/channels/app/imaging/decode_bench_test.go @@ -10,7 +10,7 @@ import ( "sync" "testing" - "github.com/mattermost/mattermost-server/v6/server/channels/utils/fileutils" + "github.com/mattermost/mattermost-server/server/v8/channels/utils/fileutils" "github.com/stretchr/testify/require" ) diff --git a/server/channels/app/imaging/decode_test.go b/server/channels/app/imaging/decode_test.go index 070f2ea780..6426999e28 100644 --- a/server/channels/app/imaging/decode_test.go +++ b/server/channels/app/imaging/decode_test.go @@ -9,7 +9,7 @@ import ( "sync" "testing" - "github.com/mattermost/mattermost-server/v6/server/channels/utils/fileutils" + "github.com/mattermost/mattermost-server/server/v8/channels/utils/fileutils" "github.com/stretchr/testify/require" ) diff --git a/server/channels/app/imaging/utils_test.go b/server/channels/app/imaging/utils_test.go index a5330fbc09..e626ddffc1 100644 --- a/server/channels/app/imaging/utils_test.go +++ b/server/channels/app/imaging/utils_test.go @@ -9,7 +9,7 @@ import ( "os" "testing" - "github.com/mattermost/mattermost-server/v6/server/channels/utils/fileutils" + "github.com/mattermost/mattermost-server/server/v8/channels/utils/fileutils" "github.com/stretchr/testify/require" ) diff --git a/server/channels/app/import.go b/server/channels/app/import.go index 2f094ec788..ec00dc5325 100644 --- a/server/channels/app/import.go +++ b/server/channels/app/import.go @@ -14,10 +14,10 @@ import ( "strings" "sync" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/app/imports" - "github.com/mattermost/mattermost-server/v6/server/channels/app/request" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/app/imports" + "github.com/mattermost/mattermost-server/server/v8/channels/app/request" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) type ReactionImportData = imports.ReactionImportData // part of the app interface diff --git a/server/channels/app/import_functions.go b/server/channels/app/import_functions.go index f266d2e30e..1a3bd3eb91 100644 --- a/server/channels/app/import_functions.go +++ b/server/channels/app/import_functions.go @@ -17,14 +17,14 @@ import ( "github.com/mattermost/logr/v2" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/app/imports" - "github.com/mattermost/mattermost-server/v6/server/channels/app/request" - "github.com/mattermost/mattermost-server/v6/server/channels/app/teams" - "github.com/mattermost/mattermost-server/v6/server/channels/app/users" - "github.com/mattermost/mattermost-server/v6/server/channels/store" - "github.com/mattermost/mattermost-server/v6/server/channels/utils" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/app/imports" + "github.com/mattermost/mattermost-server/server/v8/channels/app/request" + "github.com/mattermost/mattermost-server/server/v8/channels/app/teams" + "github.com/mattermost/mattermost-server/server/v8/channels/app/users" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/utils" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) // -- Bulk Import Functions -- diff --git a/server/channels/app/import_functions_test.go b/server/channels/app/import_functions_test.go index 89fa43b71a..d540783603 100644 --- a/server/channels/app/import_functions_test.go +++ b/server/channels/app/import_functions_test.go @@ -14,13 +14,13 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/app/imports" - "github.com/mattermost/mattermost-server/v6/server/channels/store" - "github.com/mattermost/mattermost-server/v6/server/channels/testlib" - "github.com/mattermost/mattermost-server/v6/server/channels/utils" - "github.com/mattermost/mattermost-server/v6/server/channels/utils/fileutils" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/app/imports" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/testlib" + "github.com/mattermost/mattermost-server/server/v8/channels/utils" + "github.com/mattermost/mattermost-server/server/v8/channels/utils/fileutils" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) func TestImportImportScheme(t *testing.T) { @@ -459,7 +459,7 @@ func TestImportImportRole(t *testing.T) { // Try changing all the params and reimporting. data.DisplayName = ptrStr("new display name") data.Description = ptrStr("description") - data.Permissions = &[]string{"use_slash_commands"} + data.Permissions = &[]string{"manage_slash_commands"} err = th.App.importRole(th.Context, &data, false, true) require.Nil(t, err, "Should have succeeded. %v", err) diff --git a/server/channels/app/import_test.go b/server/channels/app/import_test.go index 7d972dd0bd..82ef27fe6a 100644 --- a/server/channels/app/import_test.go +++ b/server/channels/app/import_test.go @@ -16,12 +16,12 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/app/imports" - "github.com/mattermost/mattermost-server/v6/server/channels/app/request" - "github.com/mattermost/mattermost-server/v6/server/channels/utils" - "github.com/mattermost/mattermost-server/v6/server/channels/utils/fileutils" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/app/imports" + "github.com/mattermost/mattermost-server/server/v8/channels/app/request" + "github.com/mattermost/mattermost-server/server/v8/channels/utils" + "github.com/mattermost/mattermost-server/server/v8/channels/utils/fileutils" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) func ptrStr(s string) *string { diff --git a/server/channels/app/imports/import_types.go b/server/channels/app/imports/import_types.go index 981a5dd8f8..19e2ad90fd 100644 --- a/server/channels/app/imports/import_types.go +++ b/server/channels/app/imports/import_types.go @@ -7,7 +7,7 @@ import ( "archive/zip" "encoding/json" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) // Import Data Models diff --git a/server/channels/app/imports/import_validators.go b/server/channels/app/imports/import_validators.go index 4b60f252b1..d0f98b1482 100644 --- a/server/channels/app/imports/import_validators.go +++ b/server/channels/app/imports/import_validators.go @@ -10,8 +10,8 @@ import ( "strings" "unicode/utf8" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) func ValidateSchemeImportData(data *SchemeImportData) *model.AppError { diff --git a/server/channels/app/imports/import_validators_test.go b/server/channels/app/imports/import_validators_test.go index 6d57a72e97..318177e191 100644 --- a/server/channels/app/imports/import_validators_test.go +++ b/server/channels/app/imports/import_validators_test.go @@ -12,8 +12,8 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/utils/fileutils" + "github.com/mattermost/mattermost-server/server/v8/channels/utils/fileutils" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestImportValidateSchemeImportData(t *testing.T) { diff --git a/server/channels/app/integration_action.go b/server/channels/app/integration_action.go index f221beb16d..c82feb04d3 100644 --- a/server/channels/app/integration_action.go +++ b/server/channels/app/integration_action.go @@ -32,12 +32,12 @@ import ( "github.com/gorilla/mux" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/app/request" - "github.com/mattermost/mattermost-server/v6/server/channels/store" - "github.com/mattermost/mattermost-server/v6/server/channels/utils" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/i18n" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/app/request" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/utils" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/i18n" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) func (a *App) DoPostAction(c *request.Context, postID, actionId, userID, selectedOption string) (string, *model.AppError) { @@ -332,7 +332,7 @@ func (a *App) DoActionRequest(c *request.Context, rawURL string, body []byte) (* var httpClient *http.Client subpath, _ := utils.GetSubpathFromConfig(a.Config()) siteURL, _ := url.Parse(*a.Config().ServiceSettings.SiteURL) - if (inURL.Hostname() == "localhost" || inURL.Hostname() == "127.0.0.1" || inURL.Hostname() == siteURL.Hostname()) && strings.HasPrefix(inURL.Path, path.Join(subpath, "plugins")) { + if inURL.Hostname() == siteURL.Hostname() && strings.HasPrefix(inURL.Path, path.Join(subpath, "plugins")) { req.Header.Set(model.HeaderAuth, "Bearer "+c.Session().Token) httpClient = a.HTTPService().MakeClient(true) } else { diff --git a/server/channels/app/integration_action_test.go b/server/channels/app/integration_action_test.go index 0651f52ad4..1f459296a3 100644 --- a/server/channels/app/integration_action_test.go +++ b/server/channels/app/integration_action_test.go @@ -16,7 +16,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) // Test for MM-13598 where an invalid integration URL was causing a crash @@ -313,6 +313,13 @@ func TestPostAction(t *testing.T) { attachmentsPlugin, ok := postplugin.GetProp("attachments").([]*model.SlackAttachment) require.True(t, ok) + _, err = th.App.DoPostAction(th.Context, postplugin.Id, attachmentsPlugin[0].Actions[0].Id, th.BasicUser.Id, "") + require.Equal(t, "api.post.do_action.action_integration.app_error", err.Id) + + th.App.UpdateConfig(func(cfg *model.Config) { + *cfg.ServiceSettings.AllowedUntrustedInternalConnections = "localhost,127.0.0.1" + }) + _, err = th.App.DoPostAction(th.Context, postplugin.Id, attachmentsPlugin[0].Actions[0].Id, th.BasicUser.Id, "") require.Nil(t, err) @@ -541,8 +548,8 @@ func TestSubmitInteractiveDialog(t *testing.T) { "net/http" "encoding/json" - "github.com/mattermost/mattermost-server/v6/plugin" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/plugin" + "github.com/mattermost/mattermost-server/server/v8/model" ) type MyPlugin struct { @@ -833,8 +840,8 @@ func TestPostActionRelativePluginURL(t *testing.T) { "net/http" "encoding/json" - "github.com/mattermost/mattermost-server/v6/plugin" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/plugin" + "github.com/mattermost/mattermost-server/server/v8/model" ) type MyPlugin struct { @@ -1035,7 +1042,7 @@ func TestDoPluginRequest(t *testing.T) { "reflect" "sort" - "github.com/mattermost/mattermost-server/v6/plugin" + "github.com/mattermost/mattermost-server/server/v8/plugin" ) type MyPlugin struct { diff --git a/server/channels/app/job.go b/server/channels/app/job.go index 6d2e7c4d26..b3cc6697ce 100644 --- a/server/channels/app/job.go +++ b/server/channels/app/job.go @@ -7,8 +7,8 @@ import ( "errors" "net/http" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" ) func (a *App) GetJob(id string) (*model.Job, *model.AppError) { diff --git a/server/channels/app/job_test.go b/server/channels/app/job_test.go index 270250836d..1dd635f505 100644 --- a/server/channels/app/job_test.go +++ b/server/channels/app/job_test.go @@ -10,8 +10,8 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store/sqlstore" + "github.com/mattermost/mattermost-server/server/v8/channels/store/sqlstore" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestGetJob(t *testing.T) { diff --git a/server/channels/app/ldap.go b/server/channels/app/ldap.go index 3753f9cf7a..0735baa74b 100644 --- a/server/channels/app/ldap.go +++ b/server/channels/app/ldap.go @@ -8,9 +8,9 @@ import ( "mime/multipart" "net/http" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/i18n" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/i18n" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) // SyncLdap starts an LDAP sync job. diff --git a/server/channels/app/license.go b/server/channels/app/license.go index 4b05cf1cf1..3444f244bc 100644 --- a/server/channels/app/license.go +++ b/server/channels/app/license.go @@ -10,9 +10,9 @@ import ( "github.com/dgrijalva/jwt-go" "github.com/pkg/errors" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/product" - "github.com/mattermost/mattermost-server/v6/server/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/product" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" ) const ( diff --git a/server/channels/app/license_test.go b/server/channels/app/license_test.go index 996ac5cd58..ea6bbcf7eb 100644 --- a/server/channels/app/license_test.go +++ b/server/channels/app/license_test.go @@ -9,7 +9,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestLoadLicense(t *testing.T) { @@ -71,8 +71,6 @@ func TestGetSanitizedClientLicense(t *testing.T) { assert.False(t, ok) _, ok = m["SkuName"] assert.False(t, ok) - _, ok = m["SkuShortName"] - assert.False(t, ok) } func TestGenerateRenewalToken(t *testing.T) { diff --git a/server/channels/app/login.go b/server/channels/app/login.go index a33c31a869..27a7a0caf9 100644 --- a/server/channels/app/login.go +++ b/server/channels/app/login.go @@ -16,12 +16,12 @@ import ( "github.com/avct/uasurfer" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/plugin" - "github.com/mattermost/mattermost-server/v6/server/channels/app/request" - "github.com/mattermost/mattermost-server/v6/server/channels/store" - "github.com/mattermost/mattermost-server/v6/server/channels/utils" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/app/request" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/utils" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/plugin" ) const cwsTokenEnv = "CWS_CLOUD_TOKEN" diff --git a/server/channels/app/login_test.go b/server/channels/app/login_test.go index 280b0df937..72e596b52b 100644 --- a/server/channels/app/login_test.go +++ b/server/channels/app/login_test.go @@ -10,7 +10,7 @@ import ( "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestCheckForClientSideCert(t *testing.T) { diff --git a/server/channels/app/main_test.go b/server/channels/app/main_test.go index 9edfcf6b62..41e35701e0 100644 --- a/server/channels/app/main_test.go +++ b/server/channels/app/main_test.go @@ -7,7 +7,7 @@ import ( "flag" "testing" - "github.com/mattermost/mattermost-server/v6/server/channels/testlib" + "github.com/mattermost/mattermost-server/server/v8/channels/testlib" ) var mainHelper *testlib.MainHelper diff --git a/server/channels/app/migrations.go b/server/channels/app/migrations.go index 70e61ca9b6..66eab5f40f 100644 --- a/server/channels/app/migrations.go +++ b/server/channels/app/migrations.go @@ -8,8 +8,8 @@ import ( "fmt" "reflect" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) const EmojisPermissionsMigrationKey = "EmojisPermissionsMigrationComplete" @@ -559,6 +559,24 @@ func (s *Server) doPostPriorityConfigDefaultTrueMigration() { } } +func (s *Server) doElasticsearchFixChannelIndex() { + // If the migration is already marked as completed, don't do it again. + if _, err := s.Store().System().GetByName(model.MigrationKeyElasticsearchFixChannelIndex); err == nil { + return + } + + license := s.License() + if model.BuildEnterpriseReady != "true" || license == nil || !*license.Features.Elasticsearch { + mlog.Info("Skipping triggering Elasticsearch channel index fix job as build is not Enterprise ready") + return + } + + if _, appErr := s.Jobs.CreateJob(model.JobTypeElasticsearchFixChannelIndex, nil); appErr != nil { + mlog.Fatal("failed to start job for fixing Elasticsearch channels index", mlog.Err(appErr)) + return + } +} + func (a *App) DoAppMigrations() { a.Srv().doAppMigrations() } @@ -580,4 +598,5 @@ func (s *Server) doAppMigrations() { s.doFirstAdminSetupCompleteMigration() s.doRemainingSchemaMigrations() s.doPostPriorityConfigDefaultTrueMigration() + s.doElasticsearchFixChannelIndex() } diff --git a/server/channels/app/mocks/WorkTemplateExecutor.go b/server/channels/app/mocks/WorkTemplateExecutor.go index 4d2083d8dc..93fb2693c5 100644 --- a/server/channels/app/mocks/WorkTemplateExecutor.go +++ b/server/channels/app/mocks/WorkTemplateExecutor.go @@ -5,11 +5,11 @@ package mocks import ( - model "github.com/mattermost/mattermost-server/v6/model" - request "github.com/mattermost/mattermost-server/v6/server/channels/app/request" + request "github.com/mattermost/mattermost-server/server/v8/channels/app/request" + model "github.com/mattermost/mattermost-server/server/v8/model" mock "github.com/stretchr/testify/mock" - worktemplates "github.com/mattermost/mattermost-server/v6/server/channels/app/worktemplates" + worktemplates "github.com/mattermost/mattermost-server/server/v8/channels/app/worktemplates" ) // WorkTemplateExecutor is an autogenerated mock type for the WorkTemplateExecutor type diff --git a/server/channels/app/notification.go b/server/channels/app/notification.go index 54545b5301..68ae82bff1 100644 --- a/server/channels/app/notification.go +++ b/server/channels/app/notification.go @@ -15,12 +15,12 @@ import ( "github.com/pkg/errors" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/app/request" - "github.com/mattermost/mattermost-server/v6/server/channels/store" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/i18n" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/markdown" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/app/request" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/i18n" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/markdown" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) func (a *App) canSendPushNotifications() bool { @@ -101,13 +101,15 @@ func (a *App) SendNotifications(c request.CTX, post *model.Post, team *model.Tea } channelMemberNotifyPropsMap := result.Data.(map[string]model.StringMap) - followers := make(model.StringArray, 0) + followers := make(model.StringSet, 0) if tchan != nil { result = <-tchan if result.NErr != nil { return nil, result.NErr } - followers = result.Data.([]string) + for _, v := range result.Data.([]string) { + followers.Add(v) + } } groups := make(map[string]*model.Group) @@ -235,6 +237,14 @@ func (a *App) SendNotifications(c request.CTX, post *model.Post, team *model.Tea threadParticipants[id] = true } + if channel.Type != model.ChannelTypeDirect { + for id, propsMap := range channelMemberNotifyPropsMap { + if ok := followers.Has(id); !ok && propsMap[model.ChannelAutoFollowThreads] == model.ChannelAutoFollowThreadsOn { + threadParticipants[id] = true + } + } + } + // sema is a counting semaphore to throttle the number of concurrent DB requests. // A concurrency of 8 should be sufficient. // We don't want to set a higher limit which can bring down the DB. @@ -286,8 +296,8 @@ func (a *App) SendNotifications(c request.CTX, post *model.Post, team *model.Tea followersMutex.Lock() // add new followers to existing followers - if threadMembership.Following && !followers.Contains(userID) { - followers = append(followers, userID) + if ok := followers.Has(userID); !ok && threadMembership.Following { + followers.Add(userID) newParticipants[userID] = true } followersMutex.Unlock() @@ -330,7 +340,7 @@ func (a *App) SendNotifications(c request.CTX, post *model.Post, team *model.Tea notificationsForCRT := &CRTNotifiers{} if isCRTAllowed && post.RootId != "" { - for _, uid := range followers { + for uid := range followers { profile := profileMap[uid] if profile == nil || !a.IsCRTEnabledForUser(c, uid) { continue @@ -578,7 +588,7 @@ func (a *App) SendNotifications(c request.CTX, post *model.Post, team *model.Tea // If this is a reply in a thread, notify participants if isCRTAllowed && post.RootId != "" { - for _, uid := range followers { + for uid := range followers { // A user following a thread but had left the channel won't get a notification // https://mattermost.atlassian.net/browse/MM-36769 if profileMap[uid] == nil { diff --git a/server/channels/app/notification_email.go b/server/channels/app/notification_email.go index 4856affdb0..b540ac066c 100644 --- a/server/channels/app/notification_email.go +++ b/server/channels/app/notification_email.go @@ -14,12 +14,12 @@ import ( "github.com/pkg/errors" - "github.com/mattermost/mattermost-server/v6/model" - email "github.com/mattermost/mattermost-server/v6/server/channels/app/email" - "github.com/mattermost/mattermost-server/v6/server/channels/app/request" - "github.com/mattermost/mattermost-server/v6/server/channels/utils" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/i18n" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + email "github.com/mattermost/mattermost-server/server/v8/channels/app/email" + "github.com/mattermost/mattermost-server/server/v8/channels/app/request" + "github.com/mattermost/mattermost-server/server/v8/channels/utils" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/i18n" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) func (a *App) sendNotificationEmail(c request.CTX, notification *PostNotification, user *model.User, team *model.Team, senderProfileImage []byte) error { diff --git a/server/channels/app/notification_email_test.go b/server/channels/app/notification_email_test.go index 283e96244c..c6948f0ff5 100644 --- a/server/channels/app/notification_email_test.go +++ b/server/channels/app/notification_email_test.go @@ -14,10 +14,10 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store/storetest/mocks" - "github.com/mattermost/mattermost-server/v6/server/platform/services/timezones" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/i18n" + "github.com/mattermost/mattermost-server/server/v8/channels/store/storetest/mocks" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/services/timezones" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/i18n" ) func TestGetDirectMessageNotificationEmailSubject(t *testing.T) { diff --git a/server/channels/app/notification_push.go b/server/channels/app/notification_push.go index 0e74dd3098..5c188322f0 100644 --- a/server/channels/app/notification_push.go +++ b/server/channels/app/notification_push.go @@ -14,11 +14,11 @@ import ( "strings" "sync" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/app/request" - "github.com/mattermost/mattermost-server/v6/server/channels/utils" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/i18n" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/app/request" + "github.com/mattermost/mattermost-server/server/v8/channels/utils" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/i18n" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) type notificationType string diff --git a/server/channels/app/notification_push_test.go b/server/channels/app/notification_push_test.go index 8c42bdbbca..b4803db659 100644 --- a/server/channels/app/notification_push_test.go +++ b/server/channels/app/notification_push_test.go @@ -17,14 +17,14 @@ import ( "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/app/platform" - "github.com/mattermost/mattermost-server/v6/server/channels/product" - "github.com/mattermost/mattermost-server/v6/server/channels/store/storetest/mocks" - "github.com/mattermost/mattermost-server/v6/server/channels/testlib" - "github.com/mattermost/mattermost-server/v6/server/config" - fmocks "github.com/mattermost/mattermost-server/v6/server/platform/shared/filestore/mocks" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/i18n" + "github.com/mattermost/mattermost-server/server/v8/channels/app/platform" + "github.com/mattermost/mattermost-server/server/v8/channels/product" + "github.com/mattermost/mattermost-server/server/v8/channels/store/storetest/mocks" + "github.com/mattermost/mattermost-server/server/v8/channels/testlib" + "github.com/mattermost/mattermost-server/server/v8/config" + "github.com/mattermost/mattermost-server/server/v8/model" + fmocks "github.com/mattermost/mattermost-server/server/v8/platform/shared/filestore/mocks" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/i18n" ) func TestDoesNotifyPropsAllowPushNotification(t *testing.T) { @@ -1433,6 +1433,10 @@ func TestPushNotificationRace(t *testing.T) { memoryStore := config.NewTestMemoryStore() mockStore := testlib.GetMockStoreForSetupFunctions() + // Playbooks DB job requires a plugin mock + pluginStore := mocks.PluginStore{} + pluginStore.On("List", mock.Anything, mock.Anything, mock.Anything).Return([]string{}, nil) + mockStore.On("Plugin").Return(&pluginStore) mockPreferenceStore := mocks.PreferenceStore{} mockPreferenceStore.On("Get", mock.AnythingOfType("string"), @@ -1445,10 +1449,12 @@ func TestPushNotificationRace(t *testing.T) { Router: mux.NewRouter(), } var err error - s.platform, err = platform.New(platform.ServiceConfig{ - ConfigStore: memoryStore, - }, platform.SetFileStore(&fmocks.FileBackend{})) - s.SetStore(mockStore) + s.platform, err = platform.New( + platform.ServiceConfig{ + ConfigStore: memoryStore, + }, + platform.SetFileStore(&fmocks.FileBackend{}), + platform.StoreOverride(mockStore)) require.NoError(t, err) serviceMap := map[product.ServiceKey]any{ ServerKey: s, diff --git a/server/channels/app/notification_test.go b/server/channels/app/notification_test.go index e9cde44fa5..4dfcd3f74d 100644 --- a/server/channels/app/notification_test.go +++ b/server/channels/app/notification_test.go @@ -10,9 +10,10 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/utils" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/i18n" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/utils" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/i18n" ) func getLicWithSkuShortName(skuShortName string) *model.License { @@ -2819,3 +2820,66 @@ func TestReplyPostNotificationsWithCRT(t *testing.T) { assert.Nil(t, membership) }) } + +func TestChannelAutoFollowThreads(t *testing.T) { + th := Setup(t).InitBasic() + defer th.TearDown() + + u1 := th.BasicUser + u2 := th.BasicUser2 + u3 := th.CreateUser() + th.LinkUserToTeam(u3, th.BasicTeam) + c1 := th.BasicChannel + th.AddUserToChannel(u2, c1) + th.AddUserToChannel(u3, c1) + + // Set auto-follow for user 2 + member, appErr := th.App.UpdateChannelMemberNotifyProps(th.Context, map[string]string{model.ChannelAutoFollowThreads: model.ChannelAutoFollowThreadsOn}, c1.Id, u2.Id) + require.Nil(t, appErr) + require.Equal(t, model.ChannelAutoFollowThreadsOn, member.NotifyProps[model.ChannelAutoFollowThreads]) + + rootPost := &model.Post{ + ChannelId: c1.Id, + Message: "root post by user3", + UserId: u3.Id, + } + rpost, appErr := th.App.CreatePost(th.Context, rootPost, c1, false, true) + require.Nil(t, appErr) + + replyPost1 := &model.Post{ + ChannelId: c1.Id, + Message: "reply post by user1", + UserId: u1.Id, + RootId: rpost.Id, + } + _, appErr = th.App.CreatePost(th.Context, replyPost1, c1, false, true) + require.Nil(t, appErr) + + // user-2 starts auto-following thread + threadMembership, appErr := th.App.GetThreadMembershipForUser(u2.Id, rpost.Id) + require.Nil(t, appErr) + require.NotNil(t, threadMembership) + assert.True(t, threadMembership.Following) + + // Set "following" to false + _, err := th.App.Srv().Store().Thread().MaintainMembership(u2.Id, rpost.Id, store.ThreadMembershipOpts{ + Following: false, + UpdateFollowing: true, + }) + require.NoError(t, err) + + replyPost2 := &model.Post{ + ChannelId: c1.Id, + Message: "reply post 2 by user1", + UserId: u1.Id, + RootId: rpost.Id, + } + _, appErr = th.App.CreatePost(th.Context, replyPost2, c1, false, true) + require.Nil(t, appErr) + + // Do NOT start auto-following thread, once "un-followed" + threadMembership, appErr = th.App.GetThreadMembershipForUser(u2.Id, rpost.Id) + require.Nil(t, appErr) + require.NotNil(t, threadMembership) + assert.False(t, threadMembership.Following) +} diff --git a/server/channels/app/notify_admin.go b/server/channels/app/notify_admin.go index 87a294c55f..3437e392f2 100644 --- a/server/channels/app/notify_admin.go +++ b/server/channels/app/notify_admin.go @@ -11,11 +11,11 @@ import ( "strconv" "strings" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/app/request" - "github.com/mattermost/mattermost-server/v6/server/channels/store" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/i18n" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/app/request" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/i18n" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) const lastTrialNotificationTimeStamp = "LAST_TRIAL_NOTIFICATION_TIMESTAMP" diff --git a/server/channels/app/notify_admin_test.go b/server/channels/app/notify_admin_test.go index 2cd0ba719a..a521b3fa05 100644 --- a/server/channels/app/notify_admin_test.go +++ b/server/channels/app/notify_admin_test.go @@ -12,8 +12,8 @@ import ( "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/app/request" + "github.com/mattermost/mattermost-server/server/v8/channels/app/request" + "github.com/mattermost/mattermost-server/server/v8/model" ) const PluginIdGithub = "github" diff --git a/server/channels/app/oauth.go b/server/channels/app/oauth.go index b8f0ec4c52..6b3e937abb 100644 --- a/server/channels/app/oauth.go +++ b/server/channels/app/oauth.go @@ -18,14 +18,14 @@ import ( "github.com/pkg/errors" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/app/platform" - "github.com/mattermost/mattermost-server/v6/server/channels/app/request" - "github.com/mattermost/mattermost-server/v6/server/channels/einterfaces" - "github.com/mattermost/mattermost-server/v6/server/channels/store" - "github.com/mattermost/mattermost-server/v6/server/channels/utils" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/i18n" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/app/platform" + "github.com/mattermost/mattermost-server/server/v8/channels/app/request" + "github.com/mattermost/mattermost-server/server/v8/channels/einterfaces" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/utils" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/i18n" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) const ( diff --git a/server/channels/app/oauth_test.go b/server/channels/app/oauth_test.go index 2167973391..8e9d591373 100644 --- a/server/channels/app/oauth_test.go +++ b/server/channels/app/oauth_test.go @@ -17,11 +17,11 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/plugin/plugintest/mock" - "github.com/mattermost/mattermost-server/v6/server/channels/einterfaces" - "github.com/mattermost/mattermost-server/v6/server/channels/einterfaces/mocks" - "github.com/mattermost/mattermost-server/v6/server/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/einterfaces" + "github.com/mattermost/mattermost-server/server/v8/channels/einterfaces/mocks" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/plugin/plugintest/mock" ) func TestGetOAuthAccessTokenForImplicitFlow(t *testing.T) { diff --git a/server/channels/app/onboarding.go b/server/channels/app/onboarding.go index e50ebe33d7..3b76aefe53 100644 --- a/server/channels/app/onboarding.go +++ b/server/channels/app/onboarding.go @@ -8,10 +8,10 @@ import ( "github.com/pkg/errors" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/app/request" - "github.com/mattermost/mattermost-server/v6/server/channels/store" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/app/request" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) func (a *App) markAdminOnboardingComplete(c *request.Context) *model.AppError { @@ -28,6 +28,24 @@ func (a *App) markAdminOnboardingComplete(c *request.Context) *model.AppError { } func (a *App) CompleteOnboarding(c *request.Context, request *model.CompleteOnboardingRequest) *model.AppError { + isCloud := a.Srv().License() != nil && *a.Srv().License().Features.Cloud + + if !isCloud && request.Organization == "" { + mlog.Error("No organization name provided for self hosted onboarding") + return model.NewAppError("CompleteOnboarding", "api.error_no_organization_name_provided_for_self_hosted_onboarding", nil, "", http.StatusBadRequest) + } + + if request.Organization != "" { + err := a.Srv().Store().System().SaveOrUpdate(&model.System{ + Name: model.SystemOrganizationName, + Value: request.Organization, + }) + if err != nil { + // don't block onboarding because of that. + a.Log().Error("failed to save organization name", mlog.Err(err)) + } + } + pluginsEnvironment := a.Channels().GetPluginsEnvironment() if pluginsEnvironment == nil { return a.markAdminOnboardingComplete(c) diff --git a/server/channels/app/onboarding_test.go b/server/channels/app/onboarding_test.go new file mode 100644 index 0000000000..cf8462cf28 --- /dev/null +++ b/server/channels/app/onboarding_test.go @@ -0,0 +1,30 @@ +// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. +// See LICENSE.txt for license information. + +package app + +import ( + "testing" + + "github.com/stretchr/testify/require" + + "github.com/mattermost/mattermost-server/server/v8/channels/app/request" + mm_model "github.com/mattermost/mattermost-server/server/v8/model" +) + +func TestOnboardingSavesOrganizationName(t *testing.T) { + th := Setup(t) + defer th.TearDown() + + err := th.App.CompleteOnboarding(&request.Context{}, &mm_model.CompleteOnboardingRequest{ + Organization: "Mattermost In Tests", + }) + require.Nil(t, err) + defer func() { + th.App.Srv().Store().System().PermanentDeleteByName(mm_model.SystemOrganizationName) + }() + + sys, storeErr := th.App.Srv().Store().System().GetByName(mm_model.SystemOrganizationName) + require.NoError(t, storeErr) + require.Equal(t, "Mattermost In Tests", sys.Value) +} diff --git a/server/channels/app/opengraph.go b/server/channels/app/opengraph.go index c0dd998f17..cf002e50c8 100644 --- a/server/channels/app/opengraph.go +++ b/server/channels/app/opengraph.go @@ -12,7 +12,7 @@ import ( "github.com/dyatlov/go-opengraph/opengraph" "golang.org/x/net/html/charset" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) const ( diff --git a/server/channels/app/opentracing/opentracing_layer.go b/server/channels/app/opentracing/opentracing_layer.go index 452ab79fa8..39827e4e9d 100644 --- a/server/channels/app/opentracing/opentracing_layer.go +++ b/server/channels/app/opentracing/opentracing_layer.go @@ -18,25 +18,25 @@ import ( "reflect" "time" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/plugin" - "github.com/mattermost/mattermost-server/v6/server/channels/app" - "github.com/mattermost/mattermost-server/v6/server/channels/app/platform" - "github.com/mattermost/mattermost-server/v6/server/channels/app/request" - "github.com/mattermost/mattermost-server/v6/server/channels/app/worktemplates" - "github.com/mattermost/mattermost-server/v6/server/channels/audit" - "github.com/mattermost/mattermost-server/v6/server/channels/einterfaces" - "github.com/mattermost/mattermost-server/v6/server/channels/product" - "github.com/mattermost/mattermost-server/v6/server/channels/store" - "github.com/mattermost/mattermost-server/v6/server/platform/services/httpservice" - "github.com/mattermost/mattermost-server/v6/server/platform/services/imageproxy" - "github.com/mattermost/mattermost-server/v6/server/platform/services/remotecluster" - "github.com/mattermost/mattermost-server/v6/server/platform/services/searchengine" - "github.com/mattermost/mattermost-server/v6/server/platform/services/timezones" - "github.com/mattermost/mattermost-server/v6/server/platform/services/tracing" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/filestore" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/i18n" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/app" + "github.com/mattermost/mattermost-server/server/v8/channels/app/platform" + "github.com/mattermost/mattermost-server/server/v8/channels/app/request" + "github.com/mattermost/mattermost-server/server/v8/channels/app/worktemplates" + "github.com/mattermost/mattermost-server/server/v8/channels/audit" + "github.com/mattermost/mattermost-server/server/v8/channels/einterfaces" + "github.com/mattermost/mattermost-server/server/v8/channels/product" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/services/httpservice" + "github.com/mattermost/mattermost-server/server/v8/platform/services/imageproxy" + "github.com/mattermost/mattermost-server/server/v8/platform/services/remotecluster" + "github.com/mattermost/mattermost-server/server/v8/platform/services/searchengine" + "github.com/mattermost/mattermost-server/server/v8/platform/services/timezones" + "github.com/mattermost/mattermost-server/server/v8/platform/services/tracing" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/filestore" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/i18n" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/plugin" "github.com/opentracing/opentracing-go/ext" spanlog "github.com/opentracing/opentracing-go/log" ) @@ -89,6 +89,23 @@ func (a *OpenTracingAppLayer) ActivateMfa(userID string, token string) *model.Ap return resultVar0 } +func (a *OpenTracingAppLayer) ActiveSearchBackend() string { + origCtx := a.ctx + span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.ActiveSearchBackend") + + a.ctx = newCtx + a.app.Srv().Store().SetContext(newCtx) + defer func() { + a.app.Srv().Store().SetContext(origCtx) + a.ctx = origCtx + }() + + defer span.Finish() + resultVar0 := a.app.ActiveSearchBackend() + + return resultVar0 +} + func (a *OpenTracingAppLayer) AddChannelMember(c request.CTX, userID string, channel *model.Channel, opts app.ChannelMemberOpts) (*model.ChannelMember, *model.AppError) { origCtx := a.ctx span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.AddChannelMember") @@ -11992,6 +12009,23 @@ func (a *OpenTracingAppLayer) IsCRTEnabledForUser(c request.CTX, userID string) return resultVar0 } +func (a *OpenTracingAppLayer) IsConfigReadOnly() bool { + origCtx := a.ctx + span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.IsConfigReadOnly") + + a.ctx = newCtx + a.app.Srv().Store().SetContext(newCtx) + defer func() { + a.app.Srv().Store().SetContext(origCtx) + a.ctx = origCtx + }() + + defer span.Finish() + resultVar0 := a.app.IsConfigReadOnly() + + return resultVar0 +} + func (a *OpenTracingAppLayer) IsFirstAdmin(user *model.User) bool { origCtx := a.ctx span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.IsFirstAdmin") @@ -12761,23 +12795,6 @@ func (a *OpenTracingAppLayer) NewPluginAPI(c *request.Context, manifest *model.M return resultVar0 } -func (a *OpenTracingAppLayer) NewWebConn(cfg *platform.WebConnConfig) *platform.WebConn { - origCtx := a.ctx - span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.NewWebConn") - - a.ctx = newCtx - a.app.Srv().Store().SetContext(newCtx) - defer func() { - a.app.Srv().Store().SetContext(origCtx) - a.ctx = origCtx - }() - - defer span.Finish() - resultVar0 := a.app.NewWebConn(cfg) - - return resultVar0 -} - func (a *OpenTracingAppLayer) NotifyAndSetWarnMetricAck(warnMetricId string, sender *model.User, forceAck bool, isBot bool) *model.AppError { origCtx := a.ctx span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.NotifyAndSetWarnMetricAck") @@ -17359,6 +17376,28 @@ func (a *OpenTracingAppLayer) UpdateDNDStatusOfUsers() { a.app.UpdateDNDStatusOfUsers() } +func (a *OpenTracingAppLayer) UpdateDefaultProfileImage(c request.CTX, user *model.User) *model.AppError { + origCtx := a.ctx + span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.UpdateDefaultProfileImage") + + a.ctx = newCtx + a.app.Srv().Store().SetContext(newCtx) + defer func() { + a.app.Srv().Store().SetContext(origCtx) + a.ctx = origCtx + }() + + defer span.Finish() + resultVar0 := a.app.UpdateDefaultProfileImage(c, user) + + if resultVar0 != nil { + span.LogFields(spanlog.Error(resultVar0)) + ext.Error.Set(span, true) + } + + return resultVar0 +} + func (a *OpenTracingAppLayer) UpdateEphemeralPost(c request.CTX, userID string, post *model.Post) *model.Post { origCtx := a.ctx span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.UpdateEphemeralPost") diff --git a/server/channels/app/options.go b/server/channels/app/options.go index 04b663dd69..4134194bf7 100644 --- a/server/channels/app/options.go +++ b/server/channels/app/options.go @@ -4,13 +4,13 @@ package app import ( - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/app/platform" - "github.com/mattermost/mattermost-server/v6/server/channels/einterfaces" - "github.com/mattermost/mattermost-server/v6/server/channels/store" - "github.com/mattermost/mattermost-server/v6/server/config" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/filestore" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/app/platform" + "github.com/mattermost/mattermost-server/server/v8/channels/einterfaces" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/config" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/filestore" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) type Option func(s *Server) error @@ -103,6 +103,17 @@ func SkipPostInitialization() Option { } } +// SkipProductsInitialization is intended for testing only, in cases +// where we're mocking components like the store and products cannot +// be initialized correctly +func SkipProductsInitialization() Option { + return func(s *Server) error { + s.skipProductsInit = true + + return nil + } +} + type AppOption func(a *App) type AppOptionCreator func() []AppOption diff --git a/server/channels/app/permissions.go b/server/channels/app/permissions.go index 35aa5ba00e..374e44be37 100644 --- a/server/channels/app/permissions.go +++ b/server/channels/app/permissions.go @@ -13,9 +13,9 @@ import ( "github.com/pkg/errors" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/app/request" - "github.com/mattermost/mattermost-server/v6/server/channels/product" + "github.com/mattermost/mattermost-server/server/v8/channels/app/request" + "github.com/mattermost/mattermost-server/server/v8/channels/product" + "github.com/mattermost/mattermost-server/server/v8/model" ) const permissionsExportBatchSize = 100 diff --git a/server/channels/app/permissions_migrations.go b/server/channels/app/permissions_migrations.go index b6672ff29c..0e2e3135bc 100644 --- a/server/channels/app/permissions_migrations.go +++ b/server/channels/app/permissions_migrations.go @@ -8,9 +8,9 @@ import ( "net/http" "strings" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store" - "github.com/mattermost/mattermost-server/v6/server/channels/store/sqlstore" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/store/sqlstore" + "github.com/mattermost/mattermost-server/server/v8/model" ) type permissionTransformation struct { diff --git a/server/channels/app/permissions_migrations_test.go b/server/channels/app/permissions_migrations_test.go index 50fa179595..6f3418157c 100644 --- a/server/channels/app/permissions_migrations_test.go +++ b/server/channels/app/permissions_migrations_test.go @@ -9,8 +9,8 @@ import ( "github.com/stretchr/testify/assert" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store/sqlstore" + "github.com/mattermost/mattermost-server/server/v8/channels/store/sqlstore" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestApplyPermissionsMap(t *testing.T) { diff --git a/server/channels/app/permissions_test.go b/server/channels/app/permissions_test.go index cdfef0165e..37ced9bd92 100644 --- a/server/channels/app/permissions_test.go +++ b/server/channels/app/permissions_test.go @@ -13,7 +13,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) type testWriter struct { @@ -114,7 +114,7 @@ func TestImportPermissions(t *testing.T) { } beforeCount = len(results) - json := fmt.Sprintf(`{"display_name":"%v","name":"%v","description":"%v","scope":"%v","default_team_admin_role":"","default_team_user_role":"","default_channel_admin_role":"%v","default_channel_user_role":"%v","roles":[{"id":"yzfx3g9xjjfw8cqo6bpn33xr7o","name":"%v","display_name":"Channel Admin Role for Scheme my_scheme_1526475590","description":"","create_at":1526475589687,"update_at":1526475589687,"delete_at":0,"permissions":["manage_channel_roles"],"scheme_managed":true,"built_in":false},{"id":"a7s3cp4n33dfxbsrmyh9djao3a","name":"%v","display_name":"Channel User Role for Scheme my_scheme_1526475590","description":"","create_at":1526475589688,"update_at":1526475589688,"delete_at":0,"permissions":["read_channel","add_reaction","remove_reaction","manage_public_channel_members","upload_file","get_public_link","create_post","use_slash_commands","manage_private_channel_members","delete_post","edit_post"],"scheme_managed":true,"built_in":false}]}`, displayName, name, description, scope, roleName1, roleName2, roleName1, roleName2) + json := fmt.Sprintf(`{"display_name":"%v","name":"%v","description":"%v","scope":"%v","default_team_admin_role":"","default_team_user_role":"","default_channel_admin_role":"%v","default_channel_user_role":"%v","roles":[{"id":"yzfx3g9xjjfw8cqo6bpn33xr7o","name":"%v","display_name":"Channel Admin Role for Scheme my_scheme_1526475590","description":"","create_at":1526475589687,"update_at":1526475589687,"delete_at":0,"permissions":["manage_channel_roles"],"scheme_managed":true,"built_in":false},{"id":"a7s3cp4n33dfxbsrmyh9djao3a","name":"%v","display_name":"Channel User Role for Scheme my_scheme_1526475590","description":"","create_at":1526475589688,"update_at":1526475589688,"delete_at":0,"permissions":["read_channel","add_reaction","remove_reaction","manage_public_channel_members","upload_file","get_public_link","create_post","manage_private_channel_members","delete_post","edit_post"],"scheme_managed":true,"built_in":false}]}`, displayName, name, description, scope, roleName1, roleName2, roleName1, roleName2) r := strings.NewReader(json) err := th.App.ImportPermissions(r) @@ -183,7 +183,7 @@ func TestImportPermissions_idempotentScheme(t *testing.T) { roleName1 := model.NewId() roleName2 := model.NewId() - json := fmt.Sprintf(`{"display_name":"%v","name":"%v","description":"%v","scope":"%v","default_team_admin_role":"","default_team_user_role":"","default_channel_admin_role":"%v","default_channel_user_role":"%v","roles":[{"id":"yzfx3g9xjjfw8cqo6bpn33xr7o","name":"%v","display_name":"Channel Admin Role for Scheme my_scheme_1526475590","description":"","create_at":1526475589687,"update_at":1526475589687,"delete_at":0,"permissions":["manage_channel_roles"],"scheme_managed":true,"built_in":false},{"id":"a7s3cp4n33dfxbsrmyh9djao3a","name":"%v","display_name":"Channel User Role for Scheme my_scheme_1526475590","description":"","create_at":1526475589688,"update_at":1526475589688,"delete_at":0,"permissions":["read_channel","add_reaction","remove_reaction","manage_public_channel_members","upload_file","get_public_link","create_post","use_slash_commands","manage_private_channel_members","delete_post","edit_post"],"scheme_managed":true,"built_in":false}]}`, displayName, name, description, scope, roleName1, roleName2, roleName1, roleName2) + json := fmt.Sprintf(`{"display_name":"%v","name":"%v","description":"%v","scope":"%v","default_team_admin_role":"","default_team_user_role":"","default_channel_admin_role":"%v","default_channel_user_role":"%v","roles":[{"id":"yzfx3g9xjjfw8cqo6bpn33xr7o","name":"%v","display_name":"Channel Admin Role for Scheme my_scheme_1526475590","description":"","create_at":1526475589687,"update_at":1526475589687,"delete_at":0,"permissions":["manage_channel_roles"],"scheme_managed":true,"built_in":false},{"id":"a7s3cp4n33dfxbsrmyh9djao3a","name":"%v","display_name":"Channel User Role for Scheme my_scheme_1526475590","description":"","create_at":1526475589688,"update_at":1526475589688,"delete_at":0,"permissions":["read_channel","add_reaction","remove_reaction","manage_public_channel_members","upload_file","get_public_link","create_post","manage_private_channel_members","delete_post","edit_post"],"scheme_managed":true,"built_in":false}]}`, displayName, name, description, scope, roleName1, roleName2, roleName1, roleName2) jsonl := strings.Repeat(json+"\n", 4) r := strings.NewReader(jsonl) @@ -226,7 +226,7 @@ func TestImportPermissions_schemeDeletedOnRoleFailure(t *testing.T) { roleName1 := model.NewId() roleName2 := model.NewId() - jsonl := fmt.Sprintf(`{"display_name":"%v","name":"%v","description":"%v","scope":"%v","default_team_admin_role":"","default_team_user_role":"","default_channel_admin_role":"%v","default_channel_user_role":"%v","roles":[{"id":"yzfx3g9xjjfw8cqo6bpn33xr7o","name":"%v","display_name":"Channel Admin Role for Scheme my_scheme_1526475590","description":"","create_at":1526475589687,"update_at":1526475589687,"delete_at":0,"permissions":["manage_channel_roles"],"scheme_managed":true,"built_in":false},{"id":"a7s3cp4n33dfxbsrmyh9djao3a","name":"%v","display_name":"Channel User Role for Scheme my_scheme_1526475590","description":"","create_at":1526475589688,"update_at":1526475589688,"delete_at":0,"permissions":["read_channel","add_reaction","remove_reaction","manage_public_channel_members","upload_file","get_public_link","create_post","use_slash_commands","manage_private_channel_members","delete_post","edit_post"],"scheme_managed":true,"built_in":false}]}`, displayName, name, description, scope, roleName1, roleName2, roleName1, roleName2) + jsonl := fmt.Sprintf(`{"display_name":"%v","name":"%v","description":"%v","scope":"%v","default_team_admin_role":"","default_team_user_role":"","default_channel_admin_role":"%v","default_channel_user_role":"%v","roles":[{"id":"yzfx3g9xjjfw8cqo6bpn33xr7o","name":"%v","display_name":"Channel Admin Role for Scheme my_scheme_1526475590","description":"","create_at":1526475589687,"update_at":1526475589687,"delete_at":0,"permissions":["manage_channel_roles"],"scheme_managed":true,"built_in":false},{"id":"a7s3cp4n33dfxbsrmyh9djao3a","name":"%v","display_name":"Channel User Role for Scheme my_scheme_1526475590","description":"","create_at":1526475589688,"update_at":1526475589688,"delete_at":0,"permissions":["read_channel","add_reaction","remove_reaction","manage_public_channel_members","upload_file","get_public_link","create_post","manage_private_channel_members","delete_post","edit_post"],"scheme_managed":true,"built_in":false}]}`, displayName, name, description, scope, roleName1, roleName2, roleName1, roleName2) r := strings.NewReader(jsonl) var results []*model.Scheme diff --git a/server/channels/app/platform/busy.go b/server/channels/app/platform/busy.go index 71be83b37d..7db12dc3ce 100644 --- a/server/channels/app/platform/busy.go +++ b/server/channels/app/platform/busy.go @@ -10,8 +10,8 @@ import ( "sync/atomic" "time" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/einterfaces" + "github.com/mattermost/mattermost-server/server/v8/channels/einterfaces" + "github.com/mattermost/mattermost-server/server/v8/model" ) const ( diff --git a/server/channels/app/platform/busy_test.go b/server/channels/app/platform/busy_test.go index 8c249ff95e..475b8f1408 100644 --- a/server/channels/app/platform/busy_test.go +++ b/server/channels/app/platform/busy_test.go @@ -10,8 +10,8 @@ import ( "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/einterfaces" + "github.com/mattermost/mattermost-server/server/v8/channels/einterfaces" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestBusySet(t *testing.T) { diff --git a/server/channels/app/platform/cluster.go b/server/channels/app/platform/cluster.go index a53ed9870c..b953cd82f1 100644 --- a/server/channels/app/platform/cluster.go +++ b/server/channels/app/platform/cluster.go @@ -8,11 +8,11 @@ import ( "fmt" "net/http" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/einterfaces" - "github.com/mattermost/mattermost-server/v6/server/channels/product" - "github.com/mattermost/mattermost-server/v6/server/channels/store" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/einterfaces" + "github.com/mattermost/mattermost-server/server/v8/channels/product" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) // ensure cluster service wrapper implements `product.ClusterService` diff --git a/server/channels/app/platform/cluster_discovery.go b/server/channels/app/platform/cluster_discovery.go index 5fad2bf6f8..200dfe734f 100644 --- a/server/channels/app/platform/cluster_discovery.go +++ b/server/channels/app/platform/cluster_discovery.go @@ -6,8 +6,8 @@ package platform import ( "time" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) const ( diff --git a/server/channels/app/platform/cluster_discovery_test.go b/server/channels/app/platform/cluster_discovery_test.go index b52739baab..d19ab0c4ad 100644 --- a/server/channels/app/platform/cluster_discovery_test.go +++ b/server/channels/app/platform/cluster_discovery_test.go @@ -7,7 +7,7 @@ import ( "testing" "time" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestClusterDiscoveryService(t *testing.T) { diff --git a/server/channels/app/platform/cluster_handlers.go b/server/channels/app/platform/cluster_handlers.go index 05b9c668a3..690d912ab0 100644 --- a/server/channels/app/platform/cluster_handlers.go +++ b/server/channels/app/platform/cluster_handlers.go @@ -9,9 +9,9 @@ import ( "fmt" "runtime/debug" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/einterfaces" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/einterfaces" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) func (ps *PlatformService) RegisterClusterHandlers() { diff --git a/server/channels/app/platform/config.go b/server/channels/app/platform/config.go index 5c2ab0a05d..30dddabd61 100644 --- a/server/channels/app/platform/config.go +++ b/server/channels/app/platform/config.go @@ -17,12 +17,12 @@ import ( "reflect" "strconv" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/einterfaces" - "github.com/mattermost/mattermost-server/v6/server/channels/product" - "github.com/mattermost/mattermost-server/v6/server/channels/store" - "github.com/mattermost/mattermost-server/v6/server/config" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/einterfaces" + "github.com/mattermost/mattermost-server/server/v8/channels/product" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/config" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) // ServiceConfig is used to initialize the PlatformService. @@ -65,6 +65,11 @@ func (ps *PlatformService) UpdateConfig(f func(*model.Config)) { } } +// IsConfigReadOnly returns true if the underlying configstore is readonly. +func (ps *PlatformService) IsConfigReadOnly() bool { + return ps.configStore.IsReadOnly() +} + // SaveConfig replaces the active configuration, optionally notifying cluster peers. // It returns both the previous and current configs. func (ps *PlatformService) SaveConfig(newCfg *model.Config, sendConfigChangeClusterMessage bool) (*model.Config, *model.Config, *model.AppError) { diff --git a/server/channels/app/platform/config_test.go b/server/channels/app/platform/config_test.go index b54ab03989..777396feb6 100644 --- a/server/channels/app/platform/config_test.go +++ b/server/channels/app/platform/config_test.go @@ -11,9 +11,9 @@ import ( "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/einterfaces/mocks" - smocks "github.com/mattermost/mattermost-server/v6/server/channels/store/storetest/mocks" + "github.com/mattermost/mattermost-server/server/v8/channels/einterfaces/mocks" + smocks "github.com/mattermost/mattermost-server/server/v8/channels/store/storetest/mocks" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestConfigListener(t *testing.T) { diff --git a/server/channels/app/platform/enterprise.go b/server/channels/app/platform/enterprise.go index 6780f894eb..19c0da9d03 100644 --- a/server/channels/app/platform/enterprise.go +++ b/server/channels/app/platform/enterprise.go @@ -4,8 +4,8 @@ package platform import ( - "github.com/mattermost/mattermost-server/v6/server/channels/einterfaces" - "github.com/mattermost/mattermost-server/v6/server/platform/services/searchengine" + "github.com/mattermost/mattermost-server/server/v8/channels/einterfaces" + "github.com/mattermost/mattermost-server/server/v8/platform/services/searchengine" ) var clusterInterface func(*PlatformService) einterfaces.ClusterInterface diff --git a/server/channels/app/platform/feature_flags.go b/server/channels/app/platform/feature_flags.go index 62e130bfbc..eedee3b95c 100644 --- a/server/channels/app/platform/feature_flags.go +++ b/server/channels/app/platform/feature_flags.go @@ -8,8 +8,8 @@ import ( "os" "time" - "github.com/mattermost/mattermost-server/v6/server/channels/app/featureflag" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/app/featureflag" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) // SetupFeatureFlags called on startup and when the cluster leader changes. diff --git a/server/channels/app/platform/helper_test.go b/server/channels/app/platform/helper_test.go index 5049603f63..e4adda7ea4 100644 --- a/server/channels/app/platform/helper_test.go +++ b/server/channels/app/platform/helper_test.go @@ -11,12 +11,12 @@ import ( "github.com/stretchr/testify/mock" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/einterfaces" - "github.com/mattermost/mattermost-server/v6/server/channels/store" - "github.com/mattermost/mattermost-server/v6/server/channels/store/storetest/mocks" - "github.com/mattermost/mattermost-server/v6/server/channels/testlib" - "github.com/mattermost/mattermost-server/v6/server/config" + "github.com/mattermost/mattermost-server/server/v8/channels/einterfaces" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/store/storetest/mocks" + "github.com/mattermost/mattermost-server/server/v8/channels/testlib" + "github.com/mattermost/mattermost-server/server/v8/config" + "github.com/mattermost/mattermost-server/server/v8/model" ) type TestHelper struct { @@ -99,6 +99,7 @@ func (th *TestHelper) InitBasic() *TestHelper { func SetupWithStoreMock(tb testing.TB, options ...Option) *TestHelper { mockStore := testlib.GetMockStoreForSetupFunctions() + options = append(options, StoreOverride(mockStore)) th := setupTestHelper(mockStore, false, false, tb, options...) statusMock := mocks.StatusStore{} statusMock.On("UpdateExpiredDNDStatuses").Return([]*model.Status{}, nil) @@ -136,6 +137,7 @@ func setupTestHelper(dbStore store.Store, enterprise bool, includeCacheLayer boo configStore := config.NewTestMemoryStore() memoryConfig := configStore.Get() + memoryConfig.SqlSettings = *mainHelper.GetSQLSettings() *memoryConfig.PluginSettings.Directory = filepath.Join(tempWorkspace, "plugins") *memoryConfig.PluginSettings.ClientDirectory = filepath.Join(tempWorkspace, "webapp") *memoryConfig.PluginSettings.AutomaticPrepackagedPlugins = false diff --git a/server/channels/app/platform/license.go b/server/channels/app/platform/license.go index cabe4d36d8..4531acfcc0 100644 --- a/server/channels/app/platform/license.go +++ b/server/channels/app/platform/license.go @@ -14,11 +14,11 @@ import ( "github.com/dgrijalva/jwt-go" "github.com/pkg/errors" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/einterfaces" - "github.com/mattermost/mattermost-server/v6/server/channels/jobs" - "github.com/mattermost/mattermost-server/v6/server/channels/utils" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/einterfaces" + "github.com/mattermost/mattermost-server/server/v8/channels/jobs" + "github.com/mattermost/mattermost-server/server/v8/channels/utils" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) const ( diff --git a/server/channels/app/platform/license_test.go b/server/channels/app/platform/license_test.go index 8f875ea91d..258c2fbe38 100644 --- a/server/channels/app/platform/license_test.go +++ b/server/channels/app/platform/license_test.go @@ -9,7 +9,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestLoadLicense(t *testing.T) { @@ -71,8 +71,6 @@ func TestGetSanitizedClientLicense(t *testing.T) { assert.False(t, ok) _, ok = m["SkuName"] assert.False(t, ok) - _, ok = m["SkuShortName"] - assert.False(t, ok) } func TestGenerateRenewalToken(t *testing.T) { diff --git a/server/channels/app/platform/link_cache.go b/server/channels/app/platform/link_cache.go index 3c44b11888..d13d30cfc7 100644 --- a/server/channels/app/platform/link_cache.go +++ b/server/channels/app/platform/link_cache.go @@ -6,7 +6,7 @@ package platform import ( "time" - "github.com/mattermost/mattermost-server/v6/server/platform/services/cache" + "github.com/mattermost/mattermost-server/server/v8/platform/services/cache" ) const LinkCacheSize = 10000 diff --git a/server/channels/app/platform/log.go b/server/channels/app/platform/log.go index f04725a04d..eee1b3096e 100644 --- a/server/channels/app/platform/log.go +++ b/server/channels/app/platform/log.go @@ -13,9 +13,9 @@ import ( "os" "time" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/config" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/config" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) func (ps *PlatformService) Log() mlog.LoggerIFace { diff --git a/server/channels/app/platform/main_test.go b/server/channels/app/platform/main_test.go index 5eb0ef8389..ca15d20c43 100644 --- a/server/channels/app/platform/main_test.go +++ b/server/channels/app/platform/main_test.go @@ -7,7 +7,7 @@ import ( "flag" "testing" - "github.com/mattermost/mattermost-server/v6/server/channels/testlib" + "github.com/mattermost/mattermost-server/server/v8/channels/testlib" ) var mainHelper *testlib.MainHelper diff --git a/server/channels/app/platform/metrics.go b/server/channels/app/platform/metrics.go index a691a41649..9f753d269a 100644 --- a/server/channels/app/platform/metrics.go +++ b/server/channels/app/platform/metrics.go @@ -18,9 +18,9 @@ import ( "github.com/gorilla/mux" "github.com/pkg/errors" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/einterfaces" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/einterfaces" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) const TimeToWaitForConnectionsToCloseOnServerShutdown = time.Second diff --git a/server/channels/app/platform/mocks/SuiteIFace.go b/server/channels/app/platform/mocks/SuiteIFace.go index b919999f6e..8d437058d1 100644 --- a/server/channels/app/platform/mocks/SuiteIFace.go +++ b/server/channels/app/platform/mocks/SuiteIFace.go @@ -5,7 +5,7 @@ package mocks import ( - model "github.com/mattermost/mattermost-server/v6/model" + model "github.com/mattermost/mattermost-server/server/v8/model" mock "github.com/stretchr/testify/mock" ) diff --git a/server/channels/app/platform/options.go b/server/channels/app/platform/options.go index 043f18b6ba..656a6d7932 100644 --- a/server/channels/app/platform/options.go +++ b/server/channels/app/platform/options.go @@ -8,13 +8,13 @@ import ( "github.com/pkg/errors" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/einterfaces" - "github.com/mattermost/mattermost-server/v6/server/channels/store" - "github.com/mattermost/mattermost-server/v6/server/channels/store/localcachelayer" - "github.com/mattermost/mattermost-server/v6/server/config" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/filestore" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/einterfaces" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/store/localcachelayer" + "github.com/mattermost/mattermost-server/server/v8/config" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/filestore" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) type Option func(ps *PlatformService) error diff --git a/server/channels/app/platform/searchengine.go b/server/channels/app/platform/searchengine.go index c64f12a805..5852965ec7 100644 --- a/server/channels/app/platform/searchengine.go +++ b/server/channels/app/platform/searchengine.go @@ -4,8 +4,8 @@ package platform import ( - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) func (ps *PlatformService) StartSearchEngine() (string, string) { diff --git a/server/channels/app/platform/service.go b/server/channels/app/platform/service.go index cccc5ef921..5fce0dcee0 100644 --- a/server/channels/app/platform/service.go +++ b/server/channels/app/platform/service.go @@ -11,23 +11,23 @@ import ( "sync" "sync/atomic" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/plugin" - "github.com/mattermost/mattermost-server/v6/server/channels/app/featureflag" - "github.com/mattermost/mattermost-server/v6/server/channels/einterfaces" - "github.com/mattermost/mattermost-server/v6/server/channels/jobs" - "github.com/mattermost/mattermost-server/v6/server/channels/store" - "github.com/mattermost/mattermost-server/v6/server/channels/store/localcachelayer" - "github.com/mattermost/mattermost-server/v6/server/channels/store/retrylayer" - "github.com/mattermost/mattermost-server/v6/server/channels/store/searchlayer" - "github.com/mattermost/mattermost-server/v6/server/channels/store/sqlstore" - "github.com/mattermost/mattermost-server/v6/server/channels/store/timerlayer" - "github.com/mattermost/mattermost-server/v6/server/config" - "github.com/mattermost/mattermost-server/v6/server/platform/services/cache" - "github.com/mattermost/mattermost-server/v6/server/platform/services/searchengine" - "github.com/mattermost/mattermost-server/v6/server/platform/services/searchengine/bleveengine" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/filestore" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/app/featureflag" + "github.com/mattermost/mattermost-server/server/v8/channels/einterfaces" + "github.com/mattermost/mattermost-server/server/v8/channels/jobs" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/store/localcachelayer" + "github.com/mattermost/mattermost-server/server/v8/channels/store/retrylayer" + "github.com/mattermost/mattermost-server/server/v8/channels/store/searchlayer" + "github.com/mattermost/mattermost-server/server/v8/channels/store/sqlstore" + "github.com/mattermost/mattermost-server/server/v8/channels/store/timerlayer" + "github.com/mattermost/mattermost-server/server/v8/config" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/services/cache" + "github.com/mattermost/mattermost-server/server/v8/platform/services/searchengine" + "github.com/mattermost/mattermost-server/server/v8/platform/services/searchengine/bleveengine" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/filestore" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/plugin" ) // PlatformService is the service for the platform related tasks. It is diff --git a/server/channels/app/platform/service_test.go b/server/channels/app/platform/service_test.go index e79d335fe6..f9840c35bf 100644 --- a/server/channels/app/platform/service_test.go +++ b/server/channels/app/platform/service_test.go @@ -15,10 +15,10 @@ import ( "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/einterfaces/mocks" - "github.com/mattermost/mattermost-server/v6/server/channels/store/storetest" - "github.com/mattermost/mattermost-server/v6/server/config" + "github.com/mattermost/mattermost-server/server/v8/channels/einterfaces/mocks" + "github.com/mattermost/mattermost-server/server/v8/channels/store/storetest" + "github.com/mattermost/mattermost-server/server/v8/config" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestReadReplicaDisabledBasedOnLicense(t *testing.T) { @@ -28,16 +28,7 @@ func TestReadReplicaDisabledBasedOnLicense(t *testing.T) { if driverName == "" { driverName = model.DatabaseDriverPostgres } - dsn := "" - if driverName == model.DatabaseDriverPostgres { - dsn = os.Getenv("TEST_DATABASE_POSTGRESQL_DSN") - } else { - dsn = os.Getenv("TEST_DATABASE_MYSQL_DSN") - } cfg.SqlSettings = *storetest.MakeSqlSettings(driverName, false) - if dsn != "" { - cfg.SqlSettings.DataSource = &dsn - } cfg.SqlSettings.DataSourceReplicas = []string{*cfg.SqlSettings.DataSource} cfg.SqlSettings.DataSourceSearchReplicas = []string{*cfg.SqlSettings.DataSource} diff --git a/server/channels/app/platform/session.go b/server/channels/app/platform/session.go index d12127db41..1b09f5c583 100644 --- a/server/channels/app/platform/session.go +++ b/server/channels/app/platform/session.go @@ -8,9 +8,9 @@ import ( "fmt" "time" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store/sqlstore" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/store/sqlstore" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) func (ps *PlatformService) ReturnSessionToPool(session *model.Session) { diff --git a/server/channels/app/platform/session_test.go b/server/channels/app/platform/session_test.go index e33c2e8e50..6682fb7771 100644 --- a/server/channels/app/platform/session_test.go +++ b/server/channels/app/platform/session_test.go @@ -9,7 +9,7 @@ import ( "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) const ( diff --git a/server/channels/app/platform/shared_channel_notifier.go b/server/channels/app/platform/shared_channel_notifier.go index bb8aff72b3..b04c57a7a9 100644 --- a/server/channels/app/platform/shared_channel_notifier.go +++ b/server/channels/app/platform/shared_channel_notifier.go @@ -9,9 +9,9 @@ import ( "github.com/pkg/errors" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/platform/services/sharedchannel" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/services/sharedchannel" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) var sharedChannelEventsForSync model.StringArray = []string{ diff --git a/server/channels/app/platform/shared_channel_notifier_test.go b/server/channels/app/platform/shared_channel_notifier_test.go index a69bb8ab77..7a4ca14c89 100644 --- a/server/channels/app/platform/shared_channel_notifier_test.go +++ b/server/channels/app/platform/shared_channel_notifier_test.go @@ -9,9 +9,9 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/plugin/plugintest/mock" - "github.com/mattermost/mattermost-server/v6/server/channels/store/storetest/mocks" + "github.com/mattermost/mattermost-server/server/v8/channels/store/storetest/mocks" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/plugin/plugintest/mock" ) func TestServerSyncSharedChannelHandler(t *testing.T) { diff --git a/server/channels/app/platform/shared_channel_service_iface.go b/server/channels/app/platform/shared_channel_service_iface.go index 7406489c0d..7e00d874a1 100644 --- a/server/channels/app/platform/shared_channel_service_iface.go +++ b/server/channels/app/platform/shared_channel_service_iface.go @@ -4,8 +4,8 @@ package platform import ( - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/platform/services/sharedchannel" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/services/sharedchannel" ) // SharedChannelServiceIFace is the interface to the shared channel service diff --git a/server/channels/app/platform/status.go b/server/channels/app/platform/status.go index cd5fdd800e..eba8034838 100644 --- a/server/channels/app/platform/status.go +++ b/server/channels/app/platform/status.go @@ -8,9 +8,9 @@ import ( "errors" "net/http" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) func (ps *PlatformService) AddStatusCacheSkipClusterSend(status *model.Status) { diff --git a/server/channels/app/platform/status_test.go b/server/channels/app/platform/status_test.go index c0dabc5c98..2f341f2f0b 100644 --- a/server/channels/app/platform/status_test.go +++ b/server/channels/app/platform/status_test.go @@ -8,7 +8,7 @@ import ( "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestSaveStatus(t *testing.T) { diff --git a/server/channels/app/platform/web_conn.go b/server/channels/app/platform/web_conn.go index ac72c98cdf..4925f41439 100644 --- a/server/channels/app/platform/web_conn.go +++ b/server/channels/app/platform/web_conn.go @@ -20,10 +20,10 @@ import ( "github.com/gorilla/websocket" "github.com/vmihailenco/msgpack/v5" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/plugin" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/i18n" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/i18n" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/plugin" ) const ( @@ -171,10 +171,12 @@ func (ps *PlatformService) PopulateWebConnConfig(s *model.Session, cfg *WebConnC // NewWebConn returns a new WebConn instance. func (ps *PlatformService) NewWebConn(cfg *WebConnConfig, suite SuiteIFace, runner HookRunner) *WebConn { + userID := cfg.Session.UserId + session := cfg.Session if cfg.Session.UserId != "" { ps.Go(func() { - ps.SetStatusOnline(cfg.Session.UserId, false) - ps.UpdateLastActivityAtIfNeeded(cfg.Session) + ps.SetStatusOnline(userID, false) + ps.UpdateLastActivityAtIfNeeded(session) }) } @@ -232,9 +234,9 @@ func (ps *PlatformService) NewWebConn(cfg *WebConnConfig, suite SuiteIFace, runn wc.SetSessionExpiresAt(cfg.Session.ExpiresAt) wc.SetConnectionID(cfg.ConnectionID) - wc.Platform.Go(func() { - wc.HookRunner.RunMultiHook(func(hooks plugin.Hooks) bool { - hooks.OnWebSocketConnect(wc.GetConnectionID(), wc.UserId) + ps.Go(func() { + runner.RunMultiHook(func(hooks plugin.Hooks) bool { + hooks.OnWebSocketConnect(wc.GetConnectionID(), userID) return true }, plugin.OnWebSocketConnectID) }) @@ -334,9 +336,10 @@ func (wc *WebConn) Pump() { wc.Platform.HubUnregister(wc) close(wc.pumpFinished) + userID := wc.UserId wc.Platform.Go(func() { wc.HookRunner.RunMultiHook(func(hooks plugin.Hooks) bool { - hooks.OnWebSocketDisconnect(wc.GetConnectionID(), wc.UserId) + hooks.OnWebSocketDisconnect(wc.GetConnectionID(), userID) return true }, plugin.OnWebSocketDisconnectID) }) @@ -353,8 +356,9 @@ func (wc *WebConn) readPump() { return err } if wc.IsAuthenticated() { + userID := wc.UserId wc.Platform.Go(func() { - wc.Platform.SetStatusAwayIfNeeded(wc.UserId, false) + wc.Platform.SetStatusAwayIfNeeded(userID, false) }) } return nil diff --git a/server/channels/app/platform/web_conn_test.go b/server/channels/app/platform/web_conn_test.go index 149f7d019d..d0d0b3b350 100644 --- a/server/channels/app/platform/web_conn_test.go +++ b/server/channels/app/platform/web_conn_test.go @@ -15,8 +15,8 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/plugin" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/plugin" ) type hookRunner struct { diff --git a/server/channels/app/platform/web_hub.go b/server/channels/app/platform/web_hub.go index 02652adf58..7193215f47 100644 --- a/server/channels/app/platform/web_hub.go +++ b/server/channels/app/platform/web_hub.go @@ -11,8 +11,8 @@ import ( "sync/atomic" "time" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) const ( @@ -436,8 +436,9 @@ func (h *Hub) Start() { conns := connIndex.ForUser(webConn.UserId) if len(conns) == 0 || areAllInactive(conns) { + userID := webConn.UserId h.platform.Go(func() { - h.platform.SetStatusOffline(webConn.UserId, false) + h.platform.SetStatusOffline(userID, false) }) continue } @@ -452,8 +453,9 @@ func (h *Hub) Start() { } if h.platform.isUserAway(latestActivity) { + userID := webConn.UserId h.platform.Go(func() { - h.platform.SetStatusLastActivityAt(webConn.UserId, latestActivity) + h.platform.SetStatusLastActivityAt(userID, latestActivity) }) } case userID := <-h.invalidateUser: diff --git a/server/channels/app/platform/web_hub_test.go b/server/channels/app/platform/web_hub_test.go index 0fc45e730c..d11b7c4fec 100644 --- a/server/channels/app/platform/web_hub_test.go +++ b/server/channels/app/platform/web_hub_test.go @@ -17,11 +17,11 @@ import ( "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - platform_mocks "github.com/mattermost/mattermost-server/v6/server/channels/app/platform/mocks" - "github.com/mattermost/mattermost-server/v6/server/channels/store/storetest/mocks" - "github.com/mattermost/mattermost-server/v6/server/channels/testlib" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/i18n" + platform_mocks "github.com/mattermost/mattermost-server/server/v8/channels/app/platform/mocks" + "github.com/mattermost/mattermost-server/server/v8/channels/store/storetest/mocks" + "github.com/mattermost/mattermost-server/server/v8/channels/testlib" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/i18n" ) func dummyWebsocketHandler(t *testing.T) http.HandlerFunc { @@ -82,6 +82,7 @@ func TestHubStopWithMultipleConnections(t *testing.T) { // block the caller indefinitely. func TestHubStopRaceCondition(t *testing.T) { th := Setup(t).InitBasic() + defer th.Service.Store.Close() // We do not call TearDown because th.TearDown shuts down the hub again. And hub close is not idempotent. // Making it idempotent is not really important to the server because close only happens once. // So we just use this quick hack for the test. diff --git a/server/channels/app/platform/websocket_router.go b/server/channels/app/platform/websocket_router.go index 563c72a3b4..d8b0c8167a 100644 --- a/server/channels/app/platform/websocket_router.go +++ b/server/channels/app/platform/websocket_router.go @@ -6,9 +6,9 @@ package platform import ( "net/http" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/i18n" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/i18n" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) type webSocketHandler interface { diff --git a/server/channels/app/plugin.go b/server/channels/app/plugin.go index 210002a3ff..e6f5c2a4de 100644 --- a/server/channels/app/plugin.go +++ b/server/channels/app/plugin.go @@ -20,14 +20,14 @@ import ( svg "github.com/h2non/go-is-svg" "github.com/pkg/errors" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/plugin" - "github.com/mattermost/mattermost-server/v6/server/channels/app/request" - "github.com/mattermost/mattermost-server/v6/server/channels/product" - "github.com/mattermost/mattermost-server/v6/server/channels/utils/fileutils" - "github.com/mattermost/mattermost-server/v6/server/platform/services/marketplace" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/filestore" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/app/request" + "github.com/mattermost/mattermost-server/server/v8/channels/product" + "github.com/mattermost/mattermost-server/server/v8/channels/utils/fileutils" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/services/marketplace" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/filestore" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/plugin" ) const prepackagedPluginsDir = "prepackaged_plugins" @@ -231,7 +231,6 @@ func (ch *Channels) initPlugins(c *request.Context, pluginDir, webappPluginDir s NewDriverImpl(ch.srv), pluginDir, webappPluginDir, - *ch.cfgSvc.Config().ExperimentalSettings.PatchPluginsReactDOM, ch.srv.Log(), ch.srv.GetMetrics(), ) @@ -352,7 +351,7 @@ func (ch *Channels) syncPlugins() *model.AppError { } mlog.Info("Syncing plugin from file store", mlog.String("bundle", plugin.path)) - if _, err := ch.installPluginLocally(reader, signature, installPluginLocallyAlways); err != nil { + if _, err := ch.installPluginLocally(reader, signature, installPluginLocallyAlways); err != nil && err.Id != "app.plugin.blocked.app_error" && err.Id != "app.plugin.skip_installation.app_error" { mlog.Error("Failed to sync plugin from file store", mlog.String("bundle", plugin.path), mlog.Err(err)) } }(plugin) @@ -952,6 +951,11 @@ func (ch *Channels) processPrepackagedPlugins(pluginsDir string) []*plugin.Prepa defer wg.Done() p, err := ch.processPrepackagedPlugin(psPath) if err != nil { + var appErr *model.AppError + // A log line already appears if the plugin is on the blocklist + if errors.As(err, &appErr) && (appErr.Id == "app.plugin.blocked.app_error" || appErr.Id == "app.plugin.skip_installation.app_error") { + return + } mlog.Error("Failed to install prepackaged plugin", mlog.String("path", psPath.path), mlog.Err(err)) return } diff --git a/server/channels/app/plugin_api.go b/server/channels/app/plugin_api.go index 6e202efb16..71fefaa2aa 100644 --- a/server/channels/app/plugin_api.go +++ b/server/channels/app/plugin_api.go @@ -14,10 +14,10 @@ import ( "strconv" "strings" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/app/request" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/i18n" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/app/request" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/i18n" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) type PluginAPI struct { diff --git a/server/channels/app/plugin_api_test.go b/server/channels/app/plugin_api_test.go index 0feb32df2a..4c9fa41ead 100644 --- a/server/channels/app/plugin_api_test.go +++ b/server/channels/app/plugin_api_test.go @@ -25,13 +25,13 @@ import ( "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/plugin" - "github.com/mattermost/mattermost-server/v6/server/channels/app/request" - "github.com/mattermost/mattermost-server/v6/server/channels/einterfaces/mocks" - "github.com/mattermost/mattermost-server/v6/server/channels/utils" - "github.com/mattermost/mattermost-server/v6/server/channels/utils/fileutils" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/i18n" + "github.com/mattermost/mattermost-server/server/v8/channels/app/request" + "github.com/mattermost/mattermost-server/server/v8/channels/einterfaces/mocks" + "github.com/mattermost/mattermost-server/server/v8/channels/utils" + "github.com/mattermost/mattermost-server/server/v8/channels/utils/fileutils" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/i18n" + "github.com/mattermost/mattermost-server/server/v8/plugin" ) func getDefaultPluginSettingsSchema() string { @@ -92,7 +92,7 @@ func setupMultiPluginAPITest(t *testing.T, pluginCodes []string, pluginManifests return app.NewPluginAPI(c, manifest) } - env, err := plugin.NewEnvironment(newPluginAPI, NewDriverImpl(app.Srv()), pluginDir, webappPluginDir, false, app.Log(), nil) + env, err := plugin.NewEnvironment(newPluginAPI, NewDriverImpl(app.Srv()), pluginDir, webappPluginDir, app.Log(), nil) require.NoError(t, err) require.Equal(t, len(pluginCodes), len(pluginIDs)) @@ -143,7 +143,7 @@ func TestPublicFilesPathConfiguration(t *testing.T) { package main import ( - "github.com/mattermost/mattermost-server/v6/plugin" + "github.com/mattermost/mattermost-server/server/v8/plugin" ) type MyPlugin struct { @@ -304,7 +304,7 @@ func TestPluginAPIUpdateUserPreferences(t *testing.T) { } func TestPluginAPIGetUsers(t *testing.T) { - th := Setup(t) + th := Setup(t).DeleteBots() defer th.TearDown() api := th.SetupPluginAPI() @@ -759,7 +759,7 @@ func TestPluginAPILoadPluginConfiguration(t *testing.T) { cfg.PluginSettings.Plugins["testloadpluginconfig"] = pluginJson }) - testFolder, found := fileutils.FindDir("mattermost-server/server/channels/app/plugin_api_tests") + testFolder, found := fileutils.FindDir("channels/app/plugin_api_tests") require.True(t, found, "Cannot find tests folder") fullPath := path.Join(testFolder, "manual.test_load_configuration_plugin", "main.go") @@ -794,7 +794,7 @@ func TestPluginAPILoadPluginConfigurationDefaults(t *testing.T) { cfg.PluginSettings.Plugins["testloadpluginconfig"] = pluginJson }) - testFolder, found := fileutils.FindDir("mattermost-server/server/channels/app/plugin_api_tests") + testFolder, found := fileutils.FindDir("channels/app/plugin_api_tests") require.True(t, found, "Cannot find tests folder") fullPath := path.Join(testFolder, "manual.test_load_configuration_defaults_plugin", "main.go") @@ -830,7 +830,7 @@ func TestPluginAPIGetPlugins(t *testing.T) { package main import ( - "github.com/mattermost/mattermost-server/v6/plugin" + "github.com/mattermost/mattermost-server/server/v8/plugin" ) type MyPlugin struct { @@ -849,7 +849,7 @@ func TestPluginAPIGetPlugins(t *testing.T) { defer os.RemoveAll(pluginDir) defer os.RemoveAll(webappPluginDir) - env, err := plugin.NewEnvironment(th.NewPluginAPI, NewDriverImpl(th.Server), pluginDir, webappPluginDir, false, th.App.Log(), nil) + env, err := plugin.NewEnvironment(th.NewPluginAPI, NewDriverImpl(th.Server), pluginDir, webappPluginDir, th.App.Log(), nil) require.NoError(t, err) pluginIDs := []string{"pluginid1", "pluginid2", "pluginid3"} @@ -937,7 +937,7 @@ func TestInstallPlugin(t *testing.T) { return app.NewPluginAPI(c, manifest) } - env, err := plugin.NewEnvironment(newPluginAPI, NewDriverImpl(app.Srv()), pluginDir, webappPluginDir, false, app.Log(), nil) + env, err := plugin.NewEnvironment(newPluginAPI, NewDriverImpl(app.Srv()), pluginDir, webappPluginDir, app.Log(), nil) require.NoError(t, err) app.ch.SetPluginsEnvironment(env) @@ -982,7 +982,7 @@ func TestInstallPlugin(t *testing.T) { "github.com/pkg/errors" - "github.com/mattermost/mattermost-server/v6/plugin" + "github.com/mattermost/mattermost-server/server/v8/plugin" ) type configuration struct { @@ -1160,7 +1160,7 @@ func pluginAPIHookTest(t *testing.T, th *TestHelper, fileName string, id string, func TestBasicAPIPlugins(t *testing.T) { defaultSchema := getDefaultPluginSettingsSchema() - testFolder, found := fileutils.FindDir("mattermost-server/server/channels/app/plugin_api_tests") + testFolder, found := fileutils.FindDir("channels/app/plugin_api_tests") require.True(t, found, "Cannot read find app folder") dirs, err := os.ReadDir(testFolder) require.NoError(t, err, "Cannot read test folder %v", testFolder) @@ -1171,7 +1171,7 @@ func TestBasicAPIPlugins(t *testing.T) { mainPath := path.Join(testFolder, d, "main.go") _, err := os.Stat(mainPath) require.NoError(t, err, "Cannot find plugin main file at %v", mainPath) - th := Setup(t).InitBasic() + th := Setup(t).InitBasic().DeleteBots() defer th.TearDown() setDefaultPluginConfig(th, dir.Name()) err = pluginAPIHookTest(t, th, mainPath, dir.Name(), defaultSchema) @@ -1498,7 +1498,7 @@ func TestInterpluginPluginHTTP(t *testing.T) { package main import ( - "github.com/mattermost/mattermost-server/v6/plugin" + "github.com/mattermost/mattermost-server/server/v8/plugin" "bytes" "net/http" ) @@ -1539,8 +1539,8 @@ func TestInterpluginPluginHTTP(t *testing.T) { package main import ( - "github.com/mattermost/mattermost-server/v6/plugin" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/plugin" + "github.com/mattermost/mattermost-server/server/v8/model" "bytes" "net/http" "io" @@ -1632,7 +1632,7 @@ func TestAPIMetrics(t *testing.T) { defer os.RemoveAll(pluginDir) defer os.RemoveAll(webappPluginDir) - env, err := plugin.NewEnvironment(th.NewPluginAPI, NewDriverImpl(th.Server), pluginDir, webappPluginDir, false, th.App.Log(), metricsMock) + env, err := plugin.NewEnvironment(th.NewPluginAPI, NewDriverImpl(th.Server), pluginDir, webappPluginDir, th.App.Log(), metricsMock) require.NoError(t, err) th.App.ch.SetPluginsEnvironment(env) @@ -1644,8 +1644,8 @@ func TestAPIMetrics(t *testing.T) { package main import ( - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/plugin" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/plugin" ) type MyPlugin struct { @@ -1746,7 +1746,7 @@ func TestPluginHTTPConnHijack(t *testing.T) { th := Setup(t) defer th.TearDown() - testFolder, found := fileutils.FindDir("mattermost-server/server/channels/app/plugin_api_tests") + testFolder, found := fileutils.FindDir("channels/app/plugin_api_tests") require.True(t, found, "Cannot find tests folder") fullPath := path.Join(testFolder, "manual.test_http_hijack_plugin", "main.go") @@ -1781,7 +1781,7 @@ func TestPluginHTTPUpgradeWebSocket(t *testing.T) { th := Setup(t) defer th.TearDown() - testFolder, found := fileutils.FindDir("mattermost-server/server/channels/app/plugin_api_tests") + testFolder, found := fileutils.FindDir("channels/app/plugin_api_tests") require.True(t, found, "Cannot find tests folder") fullPath := path.Join(testFolder, "manual.test_http_upgrade_websocket_plugin", "main.go") @@ -2044,7 +2044,7 @@ func TestRegisterCollectionAndTopic(t *testing.T) { import ( "github.com/pkg/errors" - "github.com/mattermost/mattermost-server/v6/plugin" + "github.com/mattermost/mattermost-server/server/v8/plugin" ) type MyPlugin struct { @@ -2079,7 +2079,7 @@ func TestRegisterCollectionAndTopic(t *testing.T) { return th.App.NewPluginAPI(th.Context, manifest) } - env, err := plugin.NewEnvironment(newPluginAPI, NewDriverImpl(th.App.Srv()), pluginDir, webappPluginDir, false, th.App.Log(), nil) + env, err := plugin.NewEnvironment(newPluginAPI, NewDriverImpl(th.App.Srv()), pluginDir, webappPluginDir, th.App.Log(), nil) require.NoError(t, err) th.App.ch.SetPluginsEnvironment(env) @@ -2112,8 +2112,8 @@ func TestPluginUploadsAPI(t *testing.T) { "fmt" "bytes" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/plugin" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/plugin" ) type TestPlugin struct { @@ -2179,7 +2179,7 @@ func TestPluginUploadsAPI(t *testing.T) { newPluginAPI := func(manifest *model.Manifest) plugin.API { return th.App.NewPluginAPI(th.Context, manifest) } - env, err := plugin.NewEnvironment(newPluginAPI, NewDriverImpl(th.App.Srv()), pluginDir, webappPluginDir, false, th.App.Log(), nil) + env, err := plugin.NewEnvironment(newPluginAPI, NewDriverImpl(th.App.Srv()), pluginDir, webappPluginDir, th.App.Log(), nil) require.NoError(t, err) th.App.ch.SetPluginsEnvironment(env) diff --git a/server/channels/app/plugin_api_tests/manual.test_http_hijack_plugin/main.go b/server/channels/app/plugin_api_tests/manual.test_http_hijack_plugin/main.go index cb2ec08b94..4d9a744d13 100644 --- a/server/channels/app/plugin_api_tests/manual.test_http_hijack_plugin/main.go +++ b/server/channels/app/plugin_api_tests/manual.test_http_hijack_plugin/main.go @@ -6,7 +6,7 @@ package main import ( "net/http" - "github.com/mattermost/mattermost-server/v6/plugin" + "github.com/mattermost/mattermost-server/server/v8/plugin" ) type Plugin struct { diff --git a/server/channels/app/plugin_api_tests/manual.test_http_upgrade_websocket_plugin/main.go b/server/channels/app/plugin_api_tests/manual.test_http_upgrade_websocket_plugin/main.go index 96930d7fbe..2d301d192b 100644 --- a/server/channels/app/plugin_api_tests/manual.test_http_upgrade_websocket_plugin/main.go +++ b/server/channels/app/plugin_api_tests/manual.test_http_upgrade_websocket_plugin/main.go @@ -9,8 +9,8 @@ import ( "github.com/gorilla/websocket" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/plugin" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/plugin" ) type Plugin struct { diff --git a/server/channels/app/plugin_api_tests/manual.test_load_configuration_defaults_plugin/main.go b/server/channels/app/plugin_api_tests/manual.test_load_configuration_defaults_plugin/main.go index 8c17342a13..03d9b4376a 100644 --- a/server/channels/app/plugin_api_tests/manual.test_load_configuration_defaults_plugin/main.go +++ b/server/channels/app/plugin_api_tests/manual.test_load_configuration_defaults_plugin/main.go @@ -4,9 +4,9 @@ package main import ( - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/plugin" - "github.com/mattermost/mattermost-server/v6/server/channels/app/plugin_api_tests" + "github.com/mattermost/mattermost-server/server/v8/channels/app/plugin_api_tests" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/plugin" ) type configuration struct { diff --git a/server/channels/app/plugin_api_tests/manual.test_load_configuration_plugin/main.go b/server/channels/app/plugin_api_tests/manual.test_load_configuration_plugin/main.go index d393c07ba2..287f526240 100644 --- a/server/channels/app/plugin_api_tests/manual.test_load_configuration_plugin/main.go +++ b/server/channels/app/plugin_api_tests/manual.test_load_configuration_plugin/main.go @@ -6,9 +6,9 @@ package main import ( "fmt" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/plugin" - "github.com/mattermost/mattermost-server/v6/server/channels/app/plugin_api_tests" + "github.com/mattermost/mattermost-server/server/v8/channels/app/plugin_api_tests" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/plugin" ) type configuration struct { diff --git a/server/channels/app/plugin_api_tests/test_bots_plugin/main.go b/server/channels/app/plugin_api_tests/test_bots_plugin/main.go index 694c20ae89..4b1660efad 100644 --- a/server/channels/app/plugin_api_tests/test_bots_plugin/main.go +++ b/server/channels/app/plugin_api_tests/test_bots_plugin/main.go @@ -4,9 +4,9 @@ package main import ( - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/plugin" - "github.com/mattermost/mattermost-server/v6/server/channels/app/plugin_api_tests" + "github.com/mattermost/mattermost-server/server/v8/channels/app/plugin_api_tests" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/plugin" ) type MyPlugin struct { diff --git a/server/channels/app/plugin_api_tests/test_call_log_api_plugin/main.go b/server/channels/app/plugin_api_tests/test_call_log_api_plugin/main.go index dc21bc3acf..fbe4c004b8 100644 --- a/server/channels/app/plugin_api_tests/test_call_log_api_plugin/main.go +++ b/server/channels/app/plugin_api_tests/test_call_log_api_plugin/main.go @@ -6,8 +6,8 @@ package main import ( "github.com/pkg/errors" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/plugin" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/plugin" ) type PluginUsingLogAPI struct { diff --git a/server/channels/app/plugin_api_tests/test_db_driver/main.go b/server/channels/app/plugin_api_tests/test_db_driver/main.go index d99a64166a..010a906978 100644 --- a/server/channels/app/plugin_api_tests/test_db_driver/main.go +++ b/server/channels/app/plugin_api_tests/test_db_driver/main.go @@ -7,12 +7,12 @@ import ( "database/sql" "testing" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/plugin" - "github.com/mattermost/mattermost-server/v6/server/channels/app/plugin_api_tests" - "github.com/mattermost/mattermost-server/v6/server/channels/store/sqlstore" - "github.com/mattermost/mattermost-server/v6/server/channels/store/storetest" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/driver" + "github.com/mattermost/mattermost-server/server/v8/channels/app/plugin_api_tests" + "github.com/mattermost/mattermost-server/server/v8/channels/store/sqlstore" + "github.com/mattermost/mattermost-server/server/v8/channels/store/storetest" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/driver" + "github.com/mattermost/mattermost-server/server/v8/plugin" ) type MyPlugin struct { diff --git a/server/channels/app/plugin_api_tests/test_get_bundle_path_plugin/main.go b/server/channels/app/plugin_api_tests/test_get_bundle_path_plugin/main.go index 096aabe4c0..3a9aed3369 100644 --- a/server/channels/app/plugin_api_tests/test_get_bundle_path_plugin/main.go +++ b/server/channels/app/plugin_api_tests/test_get_bundle_path_plugin/main.go @@ -7,9 +7,9 @@ import ( "fmt" "path/filepath" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/plugin" - "github.com/mattermost/mattermost-server/v6/server/channels/app/plugin_api_tests" + "github.com/mattermost/mattermost-server/server/v8/channels/app/plugin_api_tests" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/plugin" ) type MyPlugin struct { diff --git a/server/channels/app/plugin_api_tests/test_get_channels_for_team_for_user_plugin/main.go b/server/channels/app/plugin_api_tests/test_get_channels_for_team_for_user_plugin/main.go index d903985f47..04574a56c8 100644 --- a/server/channels/app/plugin_api_tests/test_get_channels_for_team_for_user_plugin/main.go +++ b/server/channels/app/plugin_api_tests/test_get_channels_for_team_for_user_plugin/main.go @@ -4,9 +4,9 @@ package main import ( - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/plugin" - "github.com/mattermost/mattermost-server/v6/server/channels/app/plugin_api_tests" + "github.com/mattermost/mattermost-server/server/v8/channels/app/plugin_api_tests" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/plugin" ) type MyPlugin struct { diff --git a/server/channels/app/plugin_api_tests/test_get_direct_channel_plugin/main.go b/server/channels/app/plugin_api_tests/test_get_direct_channel_plugin/main.go index 317164bd1f..cd2c7b402c 100644 --- a/server/channels/app/plugin_api_tests/test_get_direct_channel_plugin/main.go +++ b/server/channels/app/plugin_api_tests/test_get_direct_channel_plugin/main.go @@ -4,9 +4,9 @@ package main import ( - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/plugin" - "github.com/mattermost/mattermost-server/v6/server/channels/app/plugin_api_tests" + "github.com/mattermost/mattermost-server/server/v8/channels/app/plugin_api_tests" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/plugin" ) type MyPlugin struct { diff --git a/server/channels/app/plugin_api_tests/test_get_plugin_status_plugin/main.go b/server/channels/app/plugin_api_tests/test_get_plugin_status_plugin/main.go index 09297c8f90..b4c8857345 100644 --- a/server/channels/app/plugin_api_tests/test_get_plugin_status_plugin/main.go +++ b/server/channels/app/plugin_api_tests/test_get_plugin_status_plugin/main.go @@ -4,9 +4,9 @@ package main import ( - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/plugin" - "github.com/mattermost/mattermost-server/v6/server/channels/app/plugin_api_tests" + "github.com/mattermost/mattermost-server/server/v8/channels/app/plugin_api_tests" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/plugin" ) type MyPlugin struct { diff --git a/server/channels/app/plugin_api_tests/test_get_profile_image_plugin/main.go b/server/channels/app/plugin_api_tests/test_get_profile_image_plugin/main.go index 15bbc6e46b..95aad7da56 100644 --- a/server/channels/app/plugin_api_tests/test_get_profile_image_plugin/main.go +++ b/server/channels/app/plugin_api_tests/test_get_profile_image_plugin/main.go @@ -4,9 +4,9 @@ package main import ( - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/plugin" - "github.com/mattermost/mattermost-server/v6/server/channels/app/plugin_api_tests" + "github.com/mattermost/mattermost-server/server/v8/channels/app/plugin_api_tests" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/plugin" ) type MyPlugin struct { diff --git a/server/channels/app/plugin_api_tests/test_kv/main.go b/server/channels/app/plugin_api_tests/test_kv/main.go index 6c4338e5d6..0d9cf00fed 100644 --- a/server/channels/app/plugin_api_tests/test_kv/main.go +++ b/server/channels/app/plugin_api_tests/test_kv/main.go @@ -7,9 +7,9 @@ import ( "bytes" "fmt" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/plugin" - "github.com/mattermost/mattermost-server/v6/server/channels/app/plugin_api_tests" + "github.com/mattermost/mattermost-server/server/v8/channels/app/plugin_api_tests" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/plugin" ) type MyPlugin struct { diff --git a/server/channels/app/plugin_api_tests/test_member_channels_plugin/main.go b/server/channels/app/plugin_api_tests/test_member_channels_plugin/main.go index 7d1907f627..901be0098b 100644 --- a/server/channels/app/plugin_api_tests/test_member_channels_plugin/main.go +++ b/server/channels/app/plugin_api_tests/test_member_channels_plugin/main.go @@ -4,9 +4,9 @@ package main import ( - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/plugin" - "github.com/mattermost/mattermost-server/v6/server/channels/app/plugin_api_tests" + "github.com/mattermost/mattermost-server/server/v8/channels/app/plugin_api_tests" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/plugin" ) type MyPlugin struct { diff --git a/server/channels/app/plugin_api_tests/test_members_plugin/main.go b/server/channels/app/plugin_api_tests/test_members_plugin/main.go index 18743f2b4f..2f34426b35 100644 --- a/server/channels/app/plugin_api_tests/test_members_plugin/main.go +++ b/server/channels/app/plugin_api_tests/test_members_plugin/main.go @@ -4,9 +4,9 @@ package main import ( - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/plugin" - "github.com/mattermost/mattermost-server/v6/server/channels/app/plugin_api_tests" + "github.com/mattermost/mattermost-server/server/v8/channels/app/plugin_api_tests" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/plugin" ) type MyPlugin struct { diff --git a/server/channels/app/plugin_api_tests/test_search_channels_plugin/main.go b/server/channels/app/plugin_api_tests/test_search_channels_plugin/main.go index 345c61f38e..f37e59700a 100644 --- a/server/channels/app/plugin_api_tests/test_search_channels_plugin/main.go +++ b/server/channels/app/plugin_api_tests/test_search_channels_plugin/main.go @@ -4,9 +4,9 @@ package main import ( - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/plugin" - "github.com/mattermost/mattermost-server/v6/server/channels/app/plugin_api_tests" + "github.com/mattermost/mattermost-server/server/v8/channels/app/plugin_api_tests" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/plugin" ) type MyPlugin struct { diff --git a/server/channels/app/plugin_api_tests/test_search_posts_in_team_plugin/main.go b/server/channels/app/plugin_api_tests/test_search_posts_in_team_plugin/main.go index ceab1b553b..fa9a252f99 100644 --- a/server/channels/app/plugin_api_tests/test_search_posts_in_team_plugin/main.go +++ b/server/channels/app/plugin_api_tests/test_search_posts_in_team_plugin/main.go @@ -6,9 +6,9 @@ package main import ( "fmt" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/plugin" - "github.com/mattermost/mattermost-server/v6/server/channels/app/plugin_api_tests" + "github.com/mattermost/mattermost-server/server/v8/channels/app/plugin_api_tests" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/plugin" ) type MyPlugin struct { diff --git a/server/channels/app/plugin_api_tests/test_search_teams_plugin/main.go b/server/channels/app/plugin_api_tests/test_search_teams_plugin/main.go index 1ab06341c2..225af48903 100644 --- a/server/channels/app/plugin_api_tests/test_search_teams_plugin/main.go +++ b/server/channels/app/plugin_api_tests/test_search_teams_plugin/main.go @@ -6,9 +6,9 @@ package main import ( "fmt" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/plugin" - "github.com/mattermost/mattermost-server/v6/server/channels/app/plugin_api_tests" + "github.com/mattermost/mattermost-server/server/v8/channels/app/plugin_api_tests" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/plugin" ) type MyPlugin struct { diff --git a/server/channels/app/plugin_api_tests/test_send_mail_plugin/main.go b/server/channels/app/plugin_api_tests/test_send_mail_plugin/main.go index 28248fe443..5b2d0e551e 100644 --- a/server/channels/app/plugin_api_tests/test_send_mail_plugin/main.go +++ b/server/channels/app/plugin_api_tests/test_send_mail_plugin/main.go @@ -7,10 +7,10 @@ import ( "fmt" "strings" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/plugin" - "github.com/mattermost/mattermost-server/v6/server/channels/app/plugin_api_tests" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mail" + "github.com/mattermost/mattermost-server/server/v8/channels/app/plugin_api_tests" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mail" + "github.com/mattermost/mattermost-server/server/v8/plugin" ) type MyPlugin struct { diff --git a/server/channels/app/plugin_api_tests/test_sessions_plugin/main.go b/server/channels/app/plugin_api_tests/test_sessions_plugin/main.go index 0417d78bb8..2a3fd4bf76 100644 --- a/server/channels/app/plugin_api_tests/test_sessions_plugin/main.go +++ b/server/channels/app/plugin_api_tests/test_sessions_plugin/main.go @@ -7,9 +7,9 @@ import ( "fmt" "time" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/plugin" - "github.com/mattermost/mattermost-server/v6/server/channels/app/plugin_api_tests" + "github.com/mattermost/mattermost-server/server/v8/channels/app/plugin_api_tests" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/plugin" ) type MyPlugin struct { diff --git a/server/channels/app/plugin_api_tests/test_set_profile_image_plugin/main.go b/server/channels/app/plugin_api_tests/test_set_profile_image_plugin/main.go index 4025fd6d72..0980ee2bfa 100644 --- a/server/channels/app/plugin_api_tests/test_set_profile_image_plugin/main.go +++ b/server/channels/app/plugin_api_tests/test_set_profile_image_plugin/main.go @@ -10,9 +10,9 @@ import ( "image/color" "image/png" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/plugin" - "github.com/mattermost/mattermost-server/v6/server/channels/app/plugin_api_tests" + "github.com/mattermost/mattermost-server/server/v8/channels/app/plugin_api_tests" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/plugin" ) type MyPlugin struct { diff --git a/server/channels/app/plugin_api_tests/test_update_user_active_plugin/main.go b/server/channels/app/plugin_api_tests/test_update_user_active_plugin/main.go index 863814c30f..1ada1da272 100644 --- a/server/channels/app/plugin_api_tests/test_update_user_active_plugin/main.go +++ b/server/channels/app/plugin_api_tests/test_update_user_active_plugin/main.go @@ -4,9 +4,9 @@ package main import ( - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/plugin" - "github.com/mattermost/mattermost-server/v6/server/channels/app/plugin_api_tests" + "github.com/mattermost/mattermost-server/server/v8/channels/app/plugin_api_tests" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/plugin" ) type MyPlugin struct { diff --git a/server/channels/app/plugin_api_tests/test_update_user_status_plugin/main.go b/server/channels/app/plugin_api_tests/test_update_user_status_plugin/main.go index fdd57ec8e9..dceee1f502 100644 --- a/server/channels/app/plugin_api_tests/test_update_user_status_plugin/main.go +++ b/server/channels/app/plugin_api_tests/test_update_user_status_plugin/main.go @@ -6,9 +6,9 @@ package main import ( "fmt" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/plugin" - "github.com/mattermost/mattermost-server/v6/server/channels/app/plugin_api_tests" + "github.com/mattermost/mattermost-server/server/v8/channels/app/plugin_api_tests" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/plugin" ) type MyPlugin struct { diff --git a/server/channels/app/plugin_commands.go b/server/channels/app/plugin_commands.go index ffb4f00d9d..fb47b6373d 100644 --- a/server/channels/app/plugin_commands.go +++ b/server/channels/app/plugin_commands.go @@ -11,9 +11,9 @@ import ( "github.com/pkg/errors" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/app/request" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/app/request" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) type PluginCommand struct { diff --git a/server/channels/app/plugin_commands_test.go b/server/channels/app/plugin_commands_test.go index 9d80070206..3c70fb718a 100644 --- a/server/channels/app/plugin_commands_test.go +++ b/server/channels/app/plugin_commands_test.go @@ -10,11 +10,11 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/plugin" - "github.com/mattermost/mattermost-server/v6/server/channels/app/request" - "github.com/mattermost/mattermost-server/v6/server/channels/product" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/i18n" + "github.com/mattermost/mattermost-server/server/v8/channels/app/request" + "github.com/mattermost/mattermost-server/server/v8/channels/product" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/i18n" + "github.com/mattermost/mattermost-server/server/v8/plugin" ) func TestPluginCommand(t *testing.T) { @@ -43,8 +43,8 @@ func TestPluginCommand(t *testing.T) { package main import ( - "github.com/mattermost/mattermost-server/v6/plugin" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/plugin" + "github.com/mattermost/mattermost-server/server/v8/model" ) type configuration struct { @@ -124,8 +124,8 @@ func TestPluginCommand(t *testing.T) { package main import ( - "github.com/mattermost/mattermost-server/v6/plugin" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/plugin" + "github.com/mattermost/mattermost-server/server/v8/model" ) type configuration struct { @@ -231,8 +231,8 @@ func TestPluginCommand(t *testing.T) { package main import ( - "github.com/mattermost/mattermost-server/v6/plugin" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/plugin" + "github.com/mattermost/mattermost-server/server/v8/model" ) type configuration struct { @@ -296,8 +296,8 @@ func TestPluginCommand(t *testing.T) { package main import ( - "github.com/mattermost/mattermost-server/v6/plugin" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/plugin" + "github.com/mattermost/mattermost-server/server/v8/model" ) type MyPlugin struct { @@ -341,8 +341,8 @@ func TestPluginCommand(t *testing.T) { package main import ( - "github.com/mattermost/mattermost-server/v6/plugin" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/plugin" + "github.com/mattermost/mattermost-server/server/v8/model" ) type MyPlugin struct { @@ -392,8 +392,8 @@ func TestPluginCommand(t *testing.T) { package main import ( - "github.com/mattermost/mattermost-server/v6/plugin" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/plugin" + "github.com/mattermost/mattermost-server/server/v8/model" ) type configuration struct { @@ -465,7 +465,6 @@ func (p *TProduct) ExecuteCommand(c *plugin.Context, args *model.CommandArgs) (* } func TestProductCommands(t *testing.T) { - products := map[string]product.Manifest{ "productT": { Initializer: newTProduct, @@ -474,10 +473,11 @@ func TestProductCommands(t *testing.T) { } t.Run("Execute product command", func(t *testing.T) { - th := Setup(t).InitBasic() + th := Setup(t, SkipProductsInitialization()).InitBasic() defer th.TearDown() // Server hijack. // This must be done in a cleaner way. + th.Server.skipProductsInit = false th.Server.initializeProducts(products, th.Server.services) th.Server.products["productT"].Start() require.Len(t, th.Server.products, 2) // 1 product + channels @@ -504,11 +504,11 @@ func TestProductCommands(t *testing.T) { }) t.Run("Product commands can override builtin commands", func(t *testing.T) { - th := Setup(t).InitBasic() + th := Setup(t, SkipProductsInitialization()).InitBasic() defer th.TearDown() - // Server hijack. // This must be done in a cleaner way. + th.Server.skipProductsInit = false th.Server.initializeProducts(products, th.Server.services) th.Server.products["productT"].Start() require.Len(t, th.Server.products, 2) // 1 product + channels @@ -535,8 +535,7 @@ func TestProductCommands(t *testing.T) { }) t.Run("Plugin commands can override product commands", func(t *testing.T) { - - th := Setup(t).InitBasic() + th := Setup(t, SkipProductsInitialization()).InitBasic() defer th.TearDown() th.App.UpdateConfig(func(cfg *model.Config) { @@ -549,8 +548,8 @@ func TestProductCommands(t *testing.T) { package main import ( - "github.com/mattermost/mattermost-server/v6/plugin" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/plugin" + "github.com/mattermost/mattermost-server/server/v8/model" ) type configuration struct { @@ -602,6 +601,7 @@ func TestProductCommands(t *testing.T) { // Server hijack. // This must be done in a cleaner way. + th.Server.skipProductsInit = false th.Server.initializeProducts(products, th.Server.services) th.Server.products["productT"].Start() require.Len(t, th.Server.products, 2) // 1 product + channels diff --git a/server/channels/app/plugin_db_driver.go b/server/channels/app/plugin_db_driver.go index a29fa7467f..d13a7df35d 100644 --- a/server/channels/app/plugin_db_driver.go +++ b/server/channels/app/plugin_db_driver.go @@ -10,8 +10,8 @@ import ( "sync" "time" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/plugin" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/plugin" ) // DriverImpl implements the plugin.Driver interface on the server-side. diff --git a/server/channels/app/plugin_deadlock_test.go b/server/channels/app/plugin_deadlock_test.go index 359b9c4f41..227f72c57e 100644 --- a/server/channels/app/plugin_deadlock_test.go +++ b/server/channels/app/plugin_deadlock_test.go @@ -12,7 +12,7 @@ import ( "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestPluginDeadlock(t *testing.T) { @@ -24,8 +24,8 @@ func TestPluginDeadlock(t *testing.T) { package main import ( - "github.com/mattermost/mattermost-server/v6/plugin" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/plugin" + "github.com/mattermost/mattermost-server/server/v8/model" ) type MyPlugin struct { @@ -112,8 +112,8 @@ func TestPluginDeadlock(t *testing.T) { package main import ( - "github.com/mattermost/mattermost-server/v6/plugin" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/plugin" + "github.com/mattermost/mattermost-server/server/v8/model" ) type MyPlugin struct { @@ -147,8 +147,8 @@ func TestPluginDeadlock(t *testing.T) { package main import ( - "github.com/mattermost/mattermost-server/v6/plugin" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/plugin" + "github.com/mattermost/mattermost-server/server/v8/model" ) type MyPlugin struct { @@ -218,8 +218,8 @@ func TestPluginDeadlock(t *testing.T) { package main import ( - "github.com/mattermost/mattermost-server/v6/plugin" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/plugin" + "github.com/mattermost/mattermost-server/server/v8/model" ) type MyPlugin struct { diff --git a/server/channels/app/plugin_event.go b/server/channels/app/plugin_event.go index c30e2d1af5..3391a792aa 100644 --- a/server/channels/app/plugin_event.go +++ b/server/channels/app/plugin_event.go @@ -6,7 +6,7 @@ package app import ( "encoding/json" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) func (ch *Channels) notifyClusterPluginEvent(event model.ClusterEvent, data model.PluginEventData) { diff --git a/server/channels/app/plugin_health_check_test.go b/server/channels/app/plugin_health_check_test.go index 1c2d67f87f..73e0c31f21 100644 --- a/server/channels/app/plugin_health_check_test.go +++ b/server/channels/app/plugin_health_check_test.go @@ -8,8 +8,8 @@ import ( "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/plugin" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/plugin" ) func TestHealthCheckJob(t *testing.T) { @@ -21,8 +21,8 @@ func TestHealthCheckJob(t *testing.T) { package main import ( - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/plugin" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/plugin" ) type MyPlugin struct { diff --git a/server/channels/app/plugin_hooks_test.go b/server/channels/app/plugin_hooks_test.go index f6324908b0..3dc5e50ee3 100644 --- a/server/channels/app/plugin_hooks_test.go +++ b/server/channels/app/plugin_hooks_test.go @@ -19,12 +19,12 @@ import ( "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/plugin" - "github.com/mattermost/mattermost-server/v6/plugin/plugintest" - "github.com/mattermost/mattermost-server/v6/server/channels/app/request" - "github.com/mattermost/mattermost-server/v6/server/channels/einterfaces/mocks" - "github.com/mattermost/mattermost-server/v6/server/channels/utils" + "github.com/mattermost/mattermost-server/server/v8/channels/app/request" + "github.com/mattermost/mattermost-server/server/v8/channels/einterfaces/mocks" + "github.com/mattermost/mattermost-server/server/v8/channels/utils" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/plugin" + "github.com/mattermost/mattermost-server/server/v8/plugin/plugintest" ) func SetAppEnvironmentWithPlugins(t *testing.T, pluginCode []string, app *App, apiFunc func(*model.Manifest) plugin.API) (func(), []string, []error) { @@ -33,7 +33,7 @@ func SetAppEnvironmentWithPlugins(t *testing.T, pluginCode []string, app *App, a webappPluginDir, err := os.MkdirTemp("", "") require.NoError(t, err) - env, err := plugin.NewEnvironment(apiFunc, NewDriverImpl(app.Srv()), pluginDir, webappPluginDir, false, app.Log(), nil) + env, err := plugin.NewEnvironment(apiFunc, NewDriverImpl(app.Srv()), pluginDir, webappPluginDir, app.Log(), nil) require.NoError(t, err) app.ch.SetPluginsEnvironment(env) @@ -72,8 +72,8 @@ func TestHookMessageWillBePosted(t *testing.T) { package main import ( - "github.com/mattermost/mattermost-server/v6/plugin" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/plugin" + "github.com/mattermost/mattermost-server/server/v8/model" ) type MyPlugin struct { @@ -112,8 +112,8 @@ func TestHookMessageWillBePosted(t *testing.T) { package main import ( - "github.com/mattermost/mattermost-server/v6/plugin" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/plugin" + "github.com/mattermost/mattermost-server/server/v8/model" ) type MyPlugin struct { @@ -153,8 +153,8 @@ func TestHookMessageWillBePosted(t *testing.T) { package main import ( - "github.com/mattermost/mattermost-server/v6/plugin" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/plugin" + "github.com/mattermost/mattermost-server/server/v8/model" ) type MyPlugin struct { @@ -196,8 +196,8 @@ func TestHookMessageWillBePosted(t *testing.T) { package main import ( - "github.com/mattermost/mattermost-server/v6/plugin" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/plugin" + "github.com/mattermost/mattermost-server/server/v8/model" ) type MyPlugin struct { @@ -240,8 +240,8 @@ func TestHookMessageWillBePosted(t *testing.T) { package main import ( - "github.com/mattermost/mattermost-server/v6/plugin" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/plugin" + "github.com/mattermost/mattermost-server/server/v8/model" ) type MyPlugin struct { @@ -262,8 +262,8 @@ func TestHookMessageWillBePosted(t *testing.T) { package main import ( - "github.com/mattermost/mattermost-server/v6/plugin" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/plugin" + "github.com/mattermost/mattermost-server/server/v8/model" ) type MyPlugin struct { @@ -308,8 +308,8 @@ func TestHookMessageHasBeenPosted(t *testing.T) { package main import ( - "github.com/mattermost/mattermost-server/v6/plugin" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/plugin" + "github.com/mattermost/mattermost-server/server/v8/model" ) type MyPlugin struct { @@ -346,8 +346,8 @@ func TestHookMessageWillBeUpdated(t *testing.T) { package main import ( - "github.com/mattermost/mattermost-server/v6/plugin" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/plugin" + "github.com/mattermost/mattermost-server/server/v8/model" ) type MyPlugin struct { @@ -394,8 +394,8 @@ func TestHookMessageHasBeenUpdated(t *testing.T) { package main import ( - "github.com/mattermost/mattermost-server/v6/plugin" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/plugin" + "github.com/mattermost/mattermost-server/server/v8/model" ) type MyPlugin struct { @@ -442,8 +442,8 @@ func TestHookFileWillBeUploaded(t *testing.T) { import ( "io" - "github.com/mattermost/mattermost-server/v6/plugin" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/plugin" + "github.com/mattermost/mattermost-server/server/v8/model" ) type MyPlugin struct { @@ -487,8 +487,8 @@ func TestHookFileWillBeUploaded(t *testing.T) { import ( "fmt" "io" - "github.com/mattermost/mattermost-server/v6/plugin" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/plugin" + "github.com/mattermost/mattermost-server/server/v8/model" ) type MyPlugin struct { @@ -536,8 +536,8 @@ func TestHookFileWillBeUploaded(t *testing.T) { import ( "io" - "github.com/mattermost/mattermost-server/v6/plugin" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/plugin" + "github.com/mattermost/mattermost-server/server/v8/model" ) type MyPlugin struct { @@ -593,8 +593,8 @@ func TestHookFileWillBeUploaded(t *testing.T) { "io" "fmt" "bytes" - "github.com/mattermost/mattermost-server/v6/plugin" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/plugin" + "github.com/mattermost/mattermost-server/server/v8/model" ) type MyPlugin struct { @@ -661,8 +661,8 @@ func TestUserWillLogIn_Blocked(t *testing.T) { package main import ( - "github.com/mattermost/mattermost-server/v6/plugin" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/plugin" + "github.com/mattermost/mattermost-server/server/v8/model" ) type MyPlugin struct { @@ -700,8 +700,8 @@ func TestUserWillLogInIn_Passed(t *testing.T) { package main import ( - "github.com/mattermost/mattermost-server/v6/plugin" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/plugin" + "github.com/mattermost/mattermost-server/server/v8/model" ) type MyPlugin struct { @@ -740,8 +740,8 @@ func TestUserHasLoggedIn(t *testing.T) { package main import ( - "github.com/mattermost/mattermost-server/v6/plugin" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/plugin" + "github.com/mattermost/mattermost-server/server/v8/model" ) type MyPlugin struct { @@ -782,8 +782,8 @@ func TestUserHasBeenCreated(t *testing.T) { package main import ( - "github.com/mattermost/mattermost-server/v6/plugin" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/plugin" + "github.com/mattermost/mattermost-server/server/v8/model" ) type MyPlugin struct { @@ -831,7 +831,7 @@ func TestErrorString(t *testing.T) { import ( "errors" - "github.com/mattermost/mattermost-server/v6/plugin" + "github.com/mattermost/mattermost-server/server/v8/plugin" ) type MyPlugin struct { @@ -860,8 +860,8 @@ func TestErrorString(t *testing.T) { package main import ( - "github.com/mattermost/mattermost-server/v6/plugin" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/plugin" + "github.com/mattermost/mattermost-server/server/v8/model" ) type MyPlugin struct { @@ -913,8 +913,8 @@ func TestHookContext(t *testing.T) { package main import ( - "github.com/mattermost/mattermost-server/v6/plugin" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/plugin" + "github.com/mattermost/mattermost-server/server/v8/model" ) type MyPlugin struct { @@ -956,8 +956,8 @@ func TestActiveHooks(t *testing.T) { package main import ( - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/plugin" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/plugin" ) type MyPlugin struct { @@ -1030,7 +1030,7 @@ func TestHookMetrics(t *testing.T) { defer os.RemoveAll(pluginDir) defer os.RemoveAll(webappPluginDir) - env, err := plugin.NewEnvironment(th.NewPluginAPI, NewDriverImpl(th.Server), pluginDir, webappPluginDir, false, th.App.Log(), metricsMock) + env, err := plugin.NewEnvironment(th.NewPluginAPI, NewDriverImpl(th.Server), pluginDir, webappPluginDir, th.App.Log(), metricsMock) require.NoError(t, err) th.App.ch.SetPluginsEnvironment(env) @@ -1042,8 +1042,8 @@ func TestHookMetrics(t *testing.T) { package main import ( - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/plugin" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/plugin" ) type MyPlugin struct { @@ -1129,8 +1129,8 @@ func TestHookReactionHasBeenAdded(t *testing.T) { package main import ( - "github.com/mattermost/mattermost-server/v6/plugin" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/plugin" + "github.com/mattermost/mattermost-server/server/v8/model" ) type MyPlugin struct { @@ -1171,8 +1171,8 @@ func TestHookReactionHasBeenRemoved(t *testing.T) { package main import ( - "github.com/mattermost/mattermost-server/v6/plugin" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/plugin" + "github.com/mattermost/mattermost-server/server/v8/model" ) type MyPlugin struct { @@ -1202,7 +1202,7 @@ func TestHookReactionHasBeenRemoved(t *testing.T) { } func TestHookRunDataRetention(t *testing.T) { - th := Setup(t).InitBasic() + th := Setup(t, SkipProductsInitialization()).InitBasic() defer th.TearDown() tearDown, pluginIDs, _ := SetAppEnvironmentWithPlugins(t, @@ -1211,7 +1211,7 @@ func TestHookRunDataRetention(t *testing.T) { package main import ( - "github.com/mattermost/mattermost-server/v6/plugin" + "github.com/mattermost/mattermost-server/server/v8/plugin" ) type MyPlugin struct { @@ -1255,7 +1255,7 @@ func TestHookOnSendDailyTelemetry(t *testing.T) { package main import ( - "github.com/mattermost/mattermost-server/v6/plugin" + "github.com/mattermost/mattermost-server/server/v8/plugin" ) type MyPlugin struct { @@ -1298,8 +1298,8 @@ func TestHookOnCloudLimitsUpdated(t *testing.T) { package main import ( - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/plugin" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/plugin" ) type MyPlugin struct { diff --git a/server/channels/app/plugin_install.go b/server/channels/app/plugin_install.go index 5db3e2cb77..59ae9be613 100644 --- a/server/channels/app/plugin_install.go +++ b/server/channels/app/plugin_install.go @@ -45,11 +45,11 @@ import ( "github.com/blang/semver" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/plugin" - "github.com/mattermost/mattermost-server/v6/server/channels/utils" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/filestore" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/utils" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/filestore" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/plugin" ) // managedPluginFileName is the file name of the flag file that marks @@ -92,7 +92,10 @@ func (ch *Channels) installPluginFromData(data model.PluginEventData) { manifest, appErr := ch.installPluginLocally(reader, signature, installPluginLocallyAlways) if appErr != nil { - mlog.Error("Failed to sync plugin from file store", mlog.String("bundle", plugin.path), mlog.Err(appErr)) + // A log line already appears if the plugin is on the blocklist or skipped + if appErr.Id != "app.plugin.blocked.app_error" && appErr.Id != "app.plugin.skip_installation.app_error" { + mlog.Error("Failed to sync plugin from file store", mlog.String("bundle", plugin.path), mlog.Err(appErr)) + } return } @@ -200,35 +203,38 @@ func (ch *Channels) InstallMarketplacePlugin(request *model.InstallMarketplacePl if *ch.cfgSvc.Config().PluginSettings.EnableRemoteMarketplace { var plugin *model.BaseMarketplacePlugin plugin, appErr = ch.getRemoteMarketplacePlugin(request.Id, request.Version) - if appErr != nil { - return nil, appErr + // The plugin might only be prepackaged and not on the Marketplace. + if appErr != nil && appErr.Id != "app.plugin.marketplace_plugins.not_found.app_error" { + mlog.Warn("Failed to reach Marketplace to install plugin", mlog.String("plugin_id", request.Id), mlog.Err(appErr)) } - var prepackagedVersion semver.Version - if prepackagedPlugin != nil { - var err error - prepackagedVersion, err = semver.Parse(prepackagedPlugin.Manifest.Version) - if err != nil { - return nil, model.NewAppError("InstallMarketplacePlugin", "app.plugin.invalid_version.app_error", nil, "", http.StatusBadRequest).Wrap(err) + if plugin != nil { + var prepackagedVersion semver.Version + if prepackagedPlugin != nil { + var err error + prepackagedVersion, err = semver.Parse(prepackagedPlugin.Manifest.Version) + if err != nil { + return nil, model.NewAppError("InstallMarketplacePlugin", "app.plugin.invalid_version.app_error", nil, "", http.StatusBadRequest).Wrap(err) + } } - } - marketplaceVersion, err := semver.Parse(plugin.Manifest.Version) - if err != nil { - return nil, model.NewAppError("InstallMarketplacePlugin", "app.prepackged-plugin.invalid_version.app_error", nil, "", http.StatusBadRequest).Wrap(err) - } + marketplaceVersion, err := semver.Parse(plugin.Manifest.Version) + if err != nil { + return nil, model.NewAppError("InstallMarketplacePlugin", "app.prepackged-plugin.invalid_version.app_error", nil, "", http.StatusBadRequest).Wrap(err) + } - if prepackagedVersion.LT(marketplaceVersion) { // Always true if no prepackaged plugin was found - downloadedPluginBytes, err := ch.srv.downloadFromURL(plugin.DownloadURL) - if err != nil { - return nil, model.NewAppError("InstallMarketplacePlugin", "app.plugin.install_marketplace_plugin.app_error", nil, "", http.StatusInternalServerError).Wrap(err) + if prepackagedVersion.LT(marketplaceVersion) { // Always true if no prepackaged plugin was found + downloadedPluginBytes, err := ch.srv.downloadFromURL(plugin.DownloadURL) + if err != nil { + return nil, model.NewAppError("InstallMarketplacePlugin", "app.plugin.install_marketplace_plugin.app_error", nil, "", http.StatusInternalServerError).Wrap(err) + } + signature, err := plugin.DecodeSignature() + if err != nil { + return nil, model.NewAppError("InstallMarketplacePlugin", "app.plugin.signature_decode.app_error", nil, "", http.StatusNotImplemented).Wrap(err) + } + pluginFile = bytes.NewReader(downloadedPluginBytes) + signatureFile = signature } - signature, err := plugin.DecodeSignature() - if err != nil { - return nil, model.NewAppError("InstallMarketplacePlugin", "app.plugin.signature_decode.app_error", nil, "", http.StatusNotImplemented).Wrap(err) - } - pluginFile = bytes.NewReader(downloadedPluginBytes) - signatureFile = signature } } @@ -330,8 +336,8 @@ func (ch *Channels) installExtractedPlugin(manifest *model.Manifest, fromPluginD // Check plugin id is not blocked if plugin.PluginIDIsBlocked(manifest.Id) { - mlog.Debug("Skipping installation of plugin since plugin is on blocklist", mlog.String("plugin_id", manifest.Id)) - return nil, nil + mlog.Debug("Skipping installation of plugin since plugin is on blocklist. Some plugins are blocked because they are built into this version of Mattermost.", mlog.String("plugin_id", manifest.Id)) + return nil, model.NewAppError("installExtractedPlugin", "app.plugin.blocked.app_error", map[string]any{"Id": manifest.Id}, "", http.StatusInternalServerError) } // Check for plugins installed with the same ID. @@ -365,7 +371,7 @@ func (ch *Channels) installExtractedPlugin(manifest *model.Manifest, fromPluginD if version.LTE(existingVersion) { mlog.Debug("Skipping local installation of plugin since existing version is newer", mlog.String("plugin_id", manifest.Id)) - return nil, nil + return nil, model.NewAppError("installExtractedPlugin", "app.plugin.skip_installation.app_error", map[string]any{"Id": manifest.Id}, "", http.StatusInternalServerError) } } diff --git a/server/channels/app/plugin_install_test.go b/server/channels/app/plugin_install_test.go index 5fde414bd6..0b2b912ff3 100644 --- a/server/channels/app/plugin_install_test.go +++ b/server/channels/app/plugin_install_test.go @@ -17,8 +17,8 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/utils/fileutils" + "github.com/mattermost/mattermost-server/server/v8/channels/utils/fileutils" + "github.com/mattermost/mattermost-server/server/v8/model" ) type nilReadSeeker struct { @@ -172,10 +172,9 @@ func TestInstallPluginLocally(t *testing.T) { defer th.TearDown() cleanExistingBundles(t, th) - manifest, appErr := installPlugin(t, th, "playbooks", "0.0.1", installPluginLocallyAlways) - require.Nil(t, appErr) - require.Nil(t, manifest) - + _, appErr := installPlugin(t, th, "playbooks", "0.0.1", installPluginLocallyAlways) + require.NotNil(t, appErr) + require.Equal(t, "app.plugin.blocked.app_error", appErr.Id) assertBundleInfoManifests(t, th, []*model.Manifest{}) }) @@ -222,9 +221,9 @@ func TestInstallPluginLocally(t *testing.T) { require.Nil(t, appErr) require.NotNil(t, existingManifest) - manifest, appErr := installPlugin(t, th, "valid", "0.0.1", installPluginLocallyOnlyIfNewOrUpgrade) - require.Nil(t, appErr) - require.Nil(t, manifest) + _, appErr = installPlugin(t, th, "valid", "0.0.1", installPluginLocallyOnlyIfNewOrUpgrade) + require.NotNil(t, appErr) + require.Equal(t, "app.plugin.skip_installation.app_error", appErr.Id) assertBundleInfoManifests(t, th, []*model.Manifest{existingManifest}) }) @@ -238,9 +237,9 @@ func TestInstallPluginLocally(t *testing.T) { require.Nil(t, appErr) require.NotNil(t, existingManifest) - manifest, appErr := installPlugin(t, th, "valid", "0.0.2", installPluginLocallyOnlyIfNewOrUpgrade) - require.Nil(t, appErr) - require.Nil(t, manifest) + _, appErr = installPlugin(t, th, "valid", "0.0.2", installPluginLocallyOnlyIfNewOrUpgrade) + require.NotNil(t, appErr) + require.Equal(t, "app.plugin.skip_installation.app_error", appErr.Id) assertBundleInfoManifests(t, th, []*model.Manifest{existingManifest}) }) diff --git a/server/channels/app/plugin_key_value_store.go b/server/channels/app/plugin_key_value_store.go index adf3ab4bf8..a10d3fc3fb 100644 --- a/server/channels/app/plugin_key_value_store.go +++ b/server/channels/app/plugin_key_value_store.go @@ -9,9 +9,9 @@ import ( "errors" "net/http" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) func getKeyHash(key string) string { diff --git a/server/channels/app/plugin_requests.go b/server/channels/app/plugin_requests.go index 92475f4ed3..4db8b9b425 100644 --- a/server/channels/app/plugin_requests.go +++ b/server/channels/app/plugin_requests.go @@ -13,10 +13,10 @@ import ( "github.com/gorilla/mux" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/plugin" - "github.com/mattermost/mattermost-server/v6/server/channels/utils" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/utils" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/plugin" ) func (ch *Channels) ServePluginRequest(w http.ResponseWriter, r *http.Request) { diff --git a/server/channels/app/plugin_requests_test.go b/server/channels/app/plugin_requests_test.go index 143a23c7ef..cc869a72a2 100644 --- a/server/channels/app/plugin_requests_test.go +++ b/server/channels/app/plugin_requests_test.go @@ -15,8 +15,8 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/utils/fileutils" + "github.com/mattermost/mattermost-server/server/v8/channels/utils/fileutils" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestServePluginPublicRequest(t *testing.T) { diff --git a/server/channels/app/plugin_shutdown_test.go b/server/channels/app/plugin_shutdown_test.go index 293d882f1f..193c2b9d1c 100644 --- a/server/channels/app/plugin_shutdown_test.go +++ b/server/channels/app/plugin_shutdown_test.go @@ -24,7 +24,7 @@ func TestPluginShutdownTest(t *testing.T) { package main import ( - "github.com/mattermost/mattermost-server/v6/plugin" + "github.com/mattermost/mattermost-server/server/v8/plugin" ) type MyPlugin struct { @@ -39,7 +39,7 @@ func TestPluginShutdownTest(t *testing.T) { package main import ( - "github.com/mattermost/mattermost-server/v6/plugin" + "github.com/mattermost/mattermost-server/server/v8/plugin" ) type MyPlugin struct { diff --git a/server/channels/app/plugin_signature.go b/server/channels/app/plugin_signature.go index b27f2fe834..ed9a126105 100644 --- a/server/channels/app/plugin_signature.go +++ b/server/channels/app/plugin_signature.go @@ -13,9 +13,9 @@ import ( "golang.org/x/crypto/openpgp" //nolint:staticcheck "golang.org/x/crypto/openpgp/armor" //nolint:staticcheck - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/utils" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/utils" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) // GetPublicKey will return the actual public key saved in the `name` file. diff --git a/server/channels/app/plugin_signature_test.go b/server/channels/app/plugin_signature_test.go index e38af4a7ea..10db749b03 100644 --- a/server/channels/app/plugin_signature_test.go +++ b/server/channels/app/plugin_signature_test.go @@ -11,9 +11,9 @@ import ( "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store/storetest/mocks" - "github.com/mattermost/mattermost-server/v6/server/channels/utils/fileutils" + "github.com/mattermost/mattermost-server/server/v8/channels/store/storetest/mocks" + "github.com/mattermost/mattermost-server/server/v8/channels/utils/fileutils" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestPluginPublicKeys(t *testing.T) { diff --git a/server/channels/app/plugin_statuses.go b/server/channels/app/plugin_statuses.go index 399d58e5b2..e3493199ba 100644 --- a/server/channels/app/plugin_statuses.go +++ b/server/channels/app/plugin_statuses.go @@ -6,7 +6,7 @@ package app import ( "net/http" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) // GetPluginStatus returns the status for a plugin installed on this server. diff --git a/server/channels/app/plugin_test.go b/server/channels/app/plugin_test.go index 0c8fb3e232..0df3f4d6ab 100644 --- a/server/channels/app/plugin_test.go +++ b/server/channels/app/plugin_test.go @@ -20,12 +20,12 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/plugin" - "github.com/mattermost/mattermost-server/v6/server/channels/app/request" - "github.com/mattermost/mattermost-server/v6/server/channels/testlib" - "github.com/mattermost/mattermost-server/v6/server/channels/utils/fileutils" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/app/request" + "github.com/mattermost/mattermost-server/server/v8/channels/testlib" + "github.com/mattermost/mattermost-server/server/v8/channels/utils/fileutils" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/plugin" ) func getHashedKey(key string) string { @@ -729,8 +729,8 @@ func TestPluginPanicLogs(t *testing.T) { package main import ( - "github.com/mattermost/mattermost-server/v6/plugin" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/plugin" + "github.com/mattermost/mattermost-server/server/v8/model" ) type MyPlugin struct { @@ -778,7 +778,7 @@ func TestPluginStatusActivateError(t *testing.T) { import ( "errors" - "github.com/mattermost/mattermost-server/v6/plugin" + "github.com/mattermost/mattermost-server/server/v8/plugin" ) type MyPlugin struct { diff --git a/server/channels/app/post.go b/server/channels/app/post.go index 35d6f8b6d6..f309209ed6 100644 --- a/server/channels/app/post.go +++ b/server/channels/app/post.go @@ -15,15 +15,15 @@ import ( "sync" "time" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/plugin" - "github.com/mattermost/mattermost-server/v6/server/channels/app/request" - "github.com/mattermost/mattermost-server/v6/server/channels/product" - "github.com/mattermost/mattermost-server/v6/server/channels/store" - "github.com/mattermost/mattermost-server/v6/server/channels/store/sqlstore" - "github.com/mattermost/mattermost-server/v6/server/platform/services/cache" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/i18n" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/app/request" + "github.com/mattermost/mattermost-server/server/v8/channels/product" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/store/sqlstore" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/services/cache" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/i18n" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/plugin" ) const ( @@ -1901,6 +1901,12 @@ func isCommentMention(user *model.User, post *model.Post, otherPosts map[string] return mentioned } + if _, ok := otherPosts[post.RootId]; !ok { + mlog.Warn("Can't determine the comment mentions as the rootPost is past the cloud plan's limit", mlog.String("rootPostID", post.RootId), mlog.String("commentID", post.Id)) + + return false + } + // Whether or not the user was mentioned because they started the thread mentioned := otherPosts[post.RootId].UserId == user.Id diff --git a/server/channels/app/post_acknowledgements.go b/server/channels/app/post_acknowledgements.go index e170676638..259dea4f90 100644 --- a/server/channels/app/post_acknowledgements.go +++ b/server/channels/app/post_acknowledgements.go @@ -8,10 +8,10 @@ import ( "errors" "net/http" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/app/request" - "github.com/mattermost/mattermost-server/v6/server/channels/store" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/app/request" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) func (a *App) SaveAcknowledgementForPost(c *request.Context, postID, userID string) (*model.PostAcknowledgement, *model.AppError) { diff --git a/server/channels/app/post_acknowledgements_test.go b/server/channels/app/post_acknowledgements_test.go index 86f95548d5..aa54200dcb 100644 --- a/server/channels/app/post_acknowledgements_test.go +++ b/server/channels/app/post_acknowledgements_test.go @@ -8,7 +8,7 @@ import ( "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestPostAcknowledgementsApp(t *testing.T) { diff --git a/server/channels/app/post_helpers.go b/server/channels/app/post_helpers.go index d57a25a2da..625cfe458b 100644 --- a/server/channels/app/post_helpers.go +++ b/server/channels/app/post_helpers.go @@ -7,7 +7,7 @@ import ( "net/http" "sort" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) type filterPostOptions struct { diff --git a/server/channels/app/post_helpers_test.go b/server/channels/app/post_helpers_test.go index c8d479b352..8bcbbdcc84 100644 --- a/server/channels/app/post_helpers_test.go +++ b/server/channels/app/post_helpers_test.go @@ -9,7 +9,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestGetTimeSortedPostAccessibleBounds(t *testing.T) { diff --git a/server/channels/app/post_metadata.go b/server/channels/app/post_metadata.go index 9048f3c5d3..33b50e00ff 100644 --- a/server/channels/app/post_metadata.go +++ b/server/channels/app/post_metadata.go @@ -19,12 +19,12 @@ import ( "github.com/dyatlov/go-opengraph/opengraph" "golang.org/x/net/idna" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/app/platform" - "github.com/mattermost/mattermost-server/v6/server/channels/app/request" - "github.com/mattermost/mattermost-server/v6/server/channels/utils/imgutils" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/markdown" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/app/platform" + "github.com/mattermost/mattermost-server/server/v8/channels/app/request" + "github.com/mattermost/mattermost-server/server/v8/channels/utils/imgutils" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/markdown" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) type linkMetadataCache struct { diff --git a/server/channels/app/post_metadata_test.go b/server/channels/app/post_metadata_test.go index 9b3e0602fa..caaa423818 100644 --- a/server/channels/app/post_metadata_test.go +++ b/server/channels/app/post_metadata_test.go @@ -18,8 +18,8 @@ import ( "testing" "time" - "github.com/mattermost/mattermost-server/v6/server/channels/store" - "github.com/mattermost/mattermost-server/v6/server/channels/store/storetest/mocks" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/store/storetest/mocks" "github.com/stretchr/testify/mock" "github.com/dyatlov/go-opengraph/opengraph" @@ -27,11 +27,11 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/app/platform" - "github.com/mattermost/mattermost-server/v6/server/channels/utils/testutils" - "github.com/mattermost/mattermost-server/v6/server/platform/services/httpservice" - "github.com/mattermost/mattermost-server/v6/server/platform/services/imageproxy" + "github.com/mattermost/mattermost-server/server/v8/channels/app/platform" + "github.com/mattermost/mattermost-server/server/v8/channels/utils/testutils" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/services/httpservice" + "github.com/mattermost/mattermost-server/server/v8/platform/services/imageproxy" ) func TestPreparePostListForClient(t *testing.T) { diff --git a/server/channels/app/post_priority.go b/server/channels/app/post_priority.go index d4efd534b8..cc0a74f490 100644 --- a/server/channels/app/post_priority.go +++ b/server/channels/app/post_priority.go @@ -7,7 +7,7 @@ import ( "database/sql" "net/http" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) func (a *App) GetPriorityForPost(postId string) (*model.PostPriority, *model.AppError) { diff --git a/server/channels/app/post_test.go b/server/channels/app/post_test.go index 6d9e044573..a9dd68dcd5 100644 --- a/server/channels/app/post_test.go +++ b/server/channels/app/post_test.go @@ -9,6 +9,7 @@ import ( "fmt" "net/http" "os" + "strconv" "sync" "testing" "time" @@ -16,17 +17,17 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/plugin/plugintest/mock" - "github.com/mattermost/mattermost-server/v6/server/channels/app/platform" - eMocks "github.com/mattermost/mattermost-server/v6/server/channels/einterfaces/mocks" - "github.com/mattermost/mattermost-server/v6/server/channels/store" - "github.com/mattermost/mattermost-server/v6/server/channels/store/storetest" - storemocks "github.com/mattermost/mattermost-server/v6/server/channels/store/storetest/mocks" - "github.com/mattermost/mattermost-server/v6/server/channels/testlib" - "github.com/mattermost/mattermost-server/v6/server/platform/services/imageproxy" - "github.com/mattermost/mattermost-server/v6/server/platform/services/searchengine/mocks" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/app/platform" + eMocks "github.com/mattermost/mattermost-server/server/v8/channels/einterfaces/mocks" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/store/storetest" + storemocks "github.com/mattermost/mattermost-server/server/v8/channels/store/storetest/mocks" + "github.com/mattermost/mattermost-server/server/v8/channels/testlib" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/services/imageproxy" + "github.com/mattermost/mattermost-server/server/v8/platform/services/searchengine/mocks" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/plugin/plugintest/mock" ) func TestCreatePostDeduplicate(t *testing.T) { @@ -60,8 +61,8 @@ func TestCreatePostDeduplicate(t *testing.T) { package main import ( - "github.com/mattermost/mattermost-server/v6/plugin" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/plugin" + "github.com/mattermost/mattermost-server/server/v8/model" ) type MyPlugin struct { @@ -109,8 +110,8 @@ func TestCreatePostDeduplicate(t *testing.T) { package main import ( - "github.com/mattermost/mattermost-server/v6/plugin" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/plugin" + "github.com/mattermost/mattermost-server/server/v8/model" "time" ) @@ -2068,6 +2069,66 @@ func TestCountMentionsFromPost(t *testing.T) { assert.Equal(t, 1, count) }) + t.Run("should not include comments made before the given post when rootPost is inaccessible", func(t *testing.T) { + th := Setup(t).InitBasic() + defer th.TearDown() + + th.App.Srv().SetLicense(model.NewTestLicense("cloud")) + + user1 := th.BasicUser + user2 := th.BasicUser2 + + channel := th.CreateChannel(th.Context, th.BasicTeam) + th.AddUserToChannel(user2, channel) + + user2.NotifyProps[model.CommentsNotifyProp] = model.CommentsNotifyAny + + post1, err := th.App.CreatePost(th.Context, &model.Post{ + UserId: user1.Id, + ChannelId: channel.Id, + Message: "test1", + }, channel, false, true) + require.Nil(t, err) + _, err = th.App.CreatePost(th.Context, &model.Post{ + UserId: user2.Id, + ChannelId: channel.Id, + RootId: post1.Id, + Message: "test2", + }, channel, false, true) + require.Nil(t, err) + + time.Sleep(time.Millisecond * 2) + + post3, err := th.App.CreatePost(th.Context, &model.Post{ + UserId: user1.Id, + ChannelId: channel.Id, + Message: "test3", + }, channel, false, true) + require.Nil(t, err) + _, err = th.App.CreatePost(th.Context, &model.Post{ + UserId: user1.Id, + ChannelId: channel.Id, + RootId: post1.Id, + Message: "test4", + }, channel, false, true) + require.Nil(t, err) + + // Make posts created before post3 inaccessible + e := th.App.Srv().Store().System().SaveOrUpdate(&model.System{ + Name: model.SystemLastAccessiblePostTime, + Value: strconv.FormatInt(post3.CreateAt, 10), + }) + require.NoError(t, e) + + // post4 should mention the user, but since post2 is inaccessible due to the cloud plan's limit, + // post4 does not notify the user. + + count, _, _, err := th.App.countMentionsFromPost(th.Context, user2, post3) + + assert.Nil(t, err) + assert.Zero(t, count) + }) + t.Run("should count mentions from the user's webhook posts", func(t *testing.T) { th := Setup(t).InitBasic() defer th.TearDown() @@ -3150,6 +3211,7 @@ func TestGetTopThreadsForUserSince(t *testing.T) { } func TestGetEditHistoryForPost(t *testing.T) { + t.Skip("This needs fixing, OriginalId seems to be empty for all posts") th := Setup(t).InitBasic() defer th.TearDown() diff --git a/server/channels/app/preference.go b/server/channels/app/preference.go index f3fc58dca2..4fdf19cb66 100644 --- a/server/channels/app/preference.go +++ b/server/channels/app/preference.go @@ -8,8 +8,8 @@ import ( "errors" "net/http" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/product" + "github.com/mattermost/mattermost-server/server/v8/channels/product" + "github.com/mattermost/mattermost-server/server/v8/model" ) // Ensure preferences service wrapper implements `product.PreferencesService` diff --git a/server/channels/app/product.go b/server/channels/app/product.go index f03a1c5446..bcffb6b504 100644 --- a/server/channels/app/product.go +++ b/server/channels/app/product.go @@ -9,7 +9,8 @@ import ( "os" "strings" - "github.com/mattermost/mattermost-server/v6/server/channels/product" + "github.com/mattermost/mattermost-server/server/v8/channels/product" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) func (s *Server) initializeProducts( @@ -71,6 +72,11 @@ func (s *Server) initializeProducts( } func (s *Server) shouldStart(product string) bool { + if s.skipProductsInit && product != "channels" { + s.Log().Warn("Skipping product start: disabled via server options", mlog.String("product", product)) + return false + } + if product == "boards" { if os.Getenv("MM_DISABLE_BOARDS") == "true" { s.Log().Warn("Skipping Boards start: disabled via env var") diff --git a/server/channels/app/product_notices.go b/server/channels/app/product_notices.go index 3c1c0a41de..1d4f47aa07 100644 --- a/server/channels/app/product_notices.go +++ b/server/channels/app/product_notices.go @@ -15,12 +15,12 @@ import ( "github.com/pkg/errors" date_constraints "github.com/reflog/dateconstraints" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/app/request" - "github.com/mattermost/mattermost-server/v6/server/channels/store" - "github.com/mattermost/mattermost-server/v6/server/channels/utils" - "github.com/mattermost/mattermost-server/v6/server/config" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/app/request" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/utils" + "github.com/mattermost/mattermost-server/server/v8/config" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) const MaxRepeatViewings = 3 diff --git a/server/channels/app/product_notices_test.go b/server/channels/app/product_notices_test.go index a7d657b511..50959cc902 100644 --- a/server/channels/app/product_notices_test.go +++ b/server/channels/app/product_notices_test.go @@ -14,8 +14,8 @@ import ( "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store/storetest/mocks" + "github.com/mattermost/mattermost-server/server/v8/channels/store/storetest/mocks" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestNoticeValidation(t *testing.T) { diff --git a/server/channels/app/product_test.go b/server/channels/app/product_test.go index 481f8bca6a..1002eedad6 100644 --- a/server/channels/app/product_test.go +++ b/server/channels/app/product_test.go @@ -8,9 +8,9 @@ import ( "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/server/channels/app/platform" - "github.com/mattermost/mattermost-server/v6/server/channels/product" - "github.com/mattermost/mattermost-server/v6/server/config" + "github.com/mattermost/mattermost-server/server/v8/channels/app/platform" + "github.com/mattermost/mattermost-server/server/v8/channels/product" + "github.com/mattermost/mattermost-server/server/v8/config" ) const ( @@ -39,8 +39,14 @@ func (p *productB) Start() error { return nil } func (p *productB) Stop() error { return nil } func TestInitializeProducts(t *testing.T) { - ps, err := platform.New(platform.ServiceConfig{ConfigStore: config.NewTestMemoryStore()}) + configStore := config.NewTestMemoryStore() + memoryConfig := configStore.Get() + memoryConfig.SqlSettings = *mainHelper.GetSQLSettings() + configStore.Set(memoryConfig) + + ps, err := platform.New(platform.ServiceConfig{ConfigStore: configStore}) require.NoError(t, err) + defer ps.Shutdown() t.Run("2 products and no circular dependency", func(t *testing.T) { serviceMap := map[product.ServiceKey]any{ @@ -148,24 +154,4 @@ func TestInitializeProducts(t *testing.T) { require.NoError(t, err) require.Len(t, server.products, 2) }) - - t.Run("boards product to be blocked", func(t *testing.T) { - products := map[string]product.Manifest{ - "productA": { - Initializer: newProductA, - }, - "boards": { - Initializer: newProductB, - }, - } - - server := &Server{ - products: make(map[string]product.Product), - platform: ps, - } - - err := server.initializeProducts(products, map[product.ServiceKey]any{}) - require.NoError(t, err) - require.Len(t, server.products, 1) - }) } diff --git a/server/channels/app/ratelimit.go b/server/channels/app/ratelimit.go index 55644b670a..49c34930ba 100644 --- a/server/channels/app/ratelimit.go +++ b/server/channels/app/ratelimit.go @@ -13,10 +13,10 @@ import ( "github.com/throttled/throttled" "github.com/throttled/throttled/store/memstore" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/utils" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/i18n" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/utils" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/i18n" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) type RateLimiter struct { diff --git a/server/channels/app/ratelimit_test.go b/server/channels/app/ratelimit_test.go index 9e1818f6f6..d976816e45 100644 --- a/server/channels/app/ratelimit_test.go +++ b/server/channels/app/ratelimit_test.go @@ -11,7 +11,7 @@ import ( "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) func genRateLimitSettings(useAuth, useIP bool, header string) *model.RateLimitSettings { diff --git a/server/channels/app/reaction.go b/server/channels/app/reaction.go index e4c6630dc9..6242b30b4d 100644 --- a/server/channels/app/reaction.go +++ b/server/channels/app/reaction.go @@ -8,10 +8,10 @@ import ( "errors" "net/http" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/plugin" - "github.com/mattermost/mattermost-server/v6/server/channels/app/request" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/app/request" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/plugin" ) func (a *App) SaveReactionForPost(c *request.Context, reaction *model.Reaction) (*model.Reaction, *model.AppError) { diff --git a/server/channels/app/reaction_test.go b/server/channels/app/reaction_test.go index d9990d34c1..1d75d91003 100644 --- a/server/channels/app/reaction_test.go +++ b/server/channels/app/reaction_test.go @@ -10,8 +10,8 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/testlib" + "github.com/mattermost/mattermost-server/server/v8/channels/testlib" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestSharedChannelSyncForReactionActions(t *testing.T) { diff --git a/server/channels/app/remote_cluster.go b/server/channels/app/remote_cluster.go index 10ab821134..6c6c67dc93 100644 --- a/server/channels/app/remote_cluster.go +++ b/server/channels/app/remote_cluster.go @@ -8,10 +8,10 @@ import ( "github.com/pkg/errors" - "github.com/mattermost/mattermost-server/v6/server/channels/store/sqlstore" - "github.com/mattermost/mattermost-server/v6/server/platform/services/remotecluster" + "github.com/mattermost/mattermost-server/server/v8/channels/store/sqlstore" + "github.com/mattermost/mattermost-server/server/v8/platform/services/remotecluster" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) func (a *App) AddRemoteCluster(rc *model.RemoteCluster) (*model.RemoteCluster, *model.AppError) { diff --git a/server/channels/app/remote_cluster_service_mock.go b/server/channels/app/remote_cluster_service_mock.go index b6409d7775..69fee0fd62 100644 --- a/server/channels/app/remote_cluster_service_mock.go +++ b/server/channels/app/remote_cluster_service_mock.go @@ -6,8 +6,8 @@ package app import ( "context" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/platform/services/remotecluster" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/services/remotecluster" ) // MockOptionRemoteClusterService a mock of the remote cluster service diff --git a/server/channels/app/remote_cluster_test.go b/server/channels/app/remote_cluster_test.go index fe47ecaf85..508220ac40 100644 --- a/server/channels/app/remote_cluster_test.go +++ b/server/channels/app/remote_cluster_test.go @@ -9,8 +9,8 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/i18n" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/i18n" ) func TestAddRemoteCluster(t *testing.T) { diff --git a/server/channels/app/request/context.go b/server/channels/app/request/context.go index 96eb70accb..df3809ffe4 100644 --- a/server/channels/app/request/context.go +++ b/server/channels/app/request/context.go @@ -6,9 +6,9 @@ package request import ( "context" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/i18n" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/i18n" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) type Context struct { diff --git a/server/channels/app/role.go b/server/channels/app/role.go index 657efba69a..ca8a159eb7 100644 --- a/server/channels/app/role.go +++ b/server/channels/app/role.go @@ -11,9 +11,9 @@ import ( "reflect" "strings" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store" - "github.com/mattermost/mattermost-server/v6/server/channels/utils" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/utils" + "github.com/mattermost/mattermost-server/server/v8/model" ) func (a *App) GetRole(id string) (*model.Role, *model.AppError) { diff --git a/server/channels/app/role_test.go b/server/channels/app/role_test.go index 835e5f0832..c9db5a8c27 100644 --- a/server/channels/app/role_test.go +++ b/server/channels/app/role_test.go @@ -14,8 +14,8 @@ import ( "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/utils" + "github.com/mattermost/mattermost-server/server/v8/channels/utils" + "github.com/mattermost/mattermost-server/server/v8/model" ) type permissionInheritanceTestData struct { diff --git a/server/channels/app/saml.go b/server/channels/app/saml.go index 7a995651c9..09cd1b0e12 100644 --- a/server/channels/app/saml.go +++ b/server/channels/app/saml.go @@ -13,7 +13,7 @@ import ( "net/http" "strings" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) const ( diff --git a/server/channels/app/scheme.go b/server/channels/app/scheme.go index d765938396..abe442195e 100644 --- a/server/channels/app/scheme.go +++ b/server/channels/app/scheme.go @@ -7,8 +7,8 @@ import ( "errors" "net/http" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" ) func (a *App) GetScheme(id string) (*model.Scheme, *model.AppError) { diff --git a/server/channels/app/searchengine.go b/server/channels/app/searchengine.go index d441662a5f..fb9539cb1a 100644 --- a/server/channels/app/searchengine.go +++ b/server/channels/app/searchengine.go @@ -6,8 +6,8 @@ package app import ( "net/http" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/platform/services/searchengine" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/services/searchengine" ) func (a *App) TestElasticsearch(cfg *model.Config) *model.AppError { @@ -60,3 +60,7 @@ func (a *App) PurgeBleveIndexes() *model.AppError { } return nil } + +func (a *App) ActiveSearchBackend() string { + return a.ch.srv.platform.SearchEngine.ActiveEngine() +} diff --git a/server/channels/app/security_update_check.go b/server/channels/app/security_update_check.go index b2dcc37758..edd31cf48b 100644 --- a/server/channels/app/security_update_check.go +++ b/server/channels/app/security_update_check.go @@ -11,10 +11,10 @@ import ( "runtime" "strconv" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/i18n" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mail" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/i18n" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mail" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) const ( diff --git a/server/channels/app/server.go b/server/channels/app/server.go index 65c3dbf371..7bfe79fd3c 100644 --- a/server/channels/app/server.go +++ b/server/channels/app/server.go @@ -27,50 +27,50 @@ import ( "github.com/rs/cors" "golang.org/x/crypto/acme/autocert" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/plugin/scheduler" - "github.com/mattermost/mattermost-server/v6/server/channels/app/email" - "github.com/mattermost/mattermost-server/v6/server/channels/app/platform" - "github.com/mattermost/mattermost-server/v6/server/channels/app/request" - "github.com/mattermost/mattermost-server/v6/server/channels/app/teams" - "github.com/mattermost/mattermost-server/v6/server/channels/app/users" - "github.com/mattermost/mattermost-server/v6/server/channels/audit" - "github.com/mattermost/mattermost-server/v6/server/channels/einterfaces" - "github.com/mattermost/mattermost-server/v6/server/channels/jobs" - "github.com/mattermost/mattermost-server/v6/server/channels/jobs/active_users" - "github.com/mattermost/mattermost-server/v6/server/channels/jobs/expirynotify" - "github.com/mattermost/mattermost-server/v6/server/channels/jobs/export_delete" - "github.com/mattermost/mattermost-server/v6/server/channels/jobs/export_process" - "github.com/mattermost/mattermost-server/v6/server/channels/jobs/extract_content" - "github.com/mattermost/mattermost-server/v6/server/channels/jobs/hosted_purchase_screening" - "github.com/mattermost/mattermost-server/v6/server/channels/jobs/import_delete" - "github.com/mattermost/mattermost-server/v6/server/channels/jobs/import_process" - "github.com/mattermost/mattermost-server/v6/server/channels/jobs/last_accessible_file" - "github.com/mattermost/mattermost-server/v6/server/channels/jobs/last_accessible_post" - "github.com/mattermost/mattermost-server/v6/server/channels/jobs/migrations" - "github.com/mattermost/mattermost-server/v6/server/channels/jobs/notify_admin" - "github.com/mattermost/mattermost-server/v6/server/channels/jobs/product_notices" - "github.com/mattermost/mattermost-server/v6/server/channels/jobs/resend_invitation_email" - "github.com/mattermost/mattermost-server/v6/server/channels/product" - "github.com/mattermost/mattermost-server/v6/server/channels/store" - "github.com/mattermost/mattermost-server/v6/server/channels/utils" - "github.com/mattermost/mattermost-server/v6/server/config" - "github.com/mattermost/mattermost-server/v6/server/platform/services/awsmeter" - "github.com/mattermost/mattermost-server/v6/server/platform/services/cache" - "github.com/mattermost/mattermost-server/v6/server/platform/services/httpservice" - "github.com/mattermost/mattermost-server/v6/server/platform/services/remotecluster" - "github.com/mattermost/mattermost-server/v6/server/platform/services/searchengine/bleveengine" - "github.com/mattermost/mattermost-server/v6/server/platform/services/searchengine/bleveengine/indexer" - "github.com/mattermost/mattermost-server/v6/server/platform/services/sharedchannel" - "github.com/mattermost/mattermost-server/v6/server/platform/services/telemetry" - "github.com/mattermost/mattermost-server/v6/server/platform/services/timezones" - "github.com/mattermost/mattermost-server/v6/server/platform/services/tracing" - "github.com/mattermost/mattermost-server/v6/server/platform/services/upgrader" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/filestore" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/i18n" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mail" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/templates" + "github.com/mattermost/mattermost-server/server/v8/channels/app/email" + "github.com/mattermost/mattermost-server/server/v8/channels/app/platform" + "github.com/mattermost/mattermost-server/server/v8/channels/app/request" + "github.com/mattermost/mattermost-server/server/v8/channels/app/teams" + "github.com/mattermost/mattermost-server/server/v8/channels/app/users" + "github.com/mattermost/mattermost-server/server/v8/channels/audit" + "github.com/mattermost/mattermost-server/server/v8/channels/einterfaces" + "github.com/mattermost/mattermost-server/server/v8/channels/jobs" + "github.com/mattermost/mattermost-server/server/v8/channels/jobs/active_users" + "github.com/mattermost/mattermost-server/server/v8/channels/jobs/expirynotify" + "github.com/mattermost/mattermost-server/server/v8/channels/jobs/export_delete" + "github.com/mattermost/mattermost-server/server/v8/channels/jobs/export_process" + "github.com/mattermost/mattermost-server/server/v8/channels/jobs/extract_content" + "github.com/mattermost/mattermost-server/server/v8/channels/jobs/hosted_purchase_screening" + "github.com/mattermost/mattermost-server/server/v8/channels/jobs/import_delete" + "github.com/mattermost/mattermost-server/server/v8/channels/jobs/import_process" + "github.com/mattermost/mattermost-server/server/v8/channels/jobs/last_accessible_file" + "github.com/mattermost/mattermost-server/server/v8/channels/jobs/last_accessible_post" + "github.com/mattermost/mattermost-server/server/v8/channels/jobs/migrations" + "github.com/mattermost/mattermost-server/server/v8/channels/jobs/notify_admin" + "github.com/mattermost/mattermost-server/server/v8/channels/jobs/product_notices" + "github.com/mattermost/mattermost-server/server/v8/channels/jobs/resend_invitation_email" + "github.com/mattermost/mattermost-server/server/v8/channels/product" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/utils" + "github.com/mattermost/mattermost-server/server/v8/config" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/services/awsmeter" + "github.com/mattermost/mattermost-server/server/v8/platform/services/cache" + "github.com/mattermost/mattermost-server/server/v8/platform/services/httpservice" + "github.com/mattermost/mattermost-server/server/v8/platform/services/remotecluster" + "github.com/mattermost/mattermost-server/server/v8/platform/services/searchengine/bleveengine" + "github.com/mattermost/mattermost-server/server/v8/platform/services/searchengine/bleveengine/indexer" + "github.com/mattermost/mattermost-server/server/v8/platform/services/sharedchannel" + "github.com/mattermost/mattermost-server/server/v8/platform/services/telemetry" + "github.com/mattermost/mattermost-server/server/v8/platform/services/timezones" + "github.com/mattermost/mattermost-server/server/v8/platform/services/tracing" + "github.com/mattermost/mattermost-server/server/v8/platform/services/upgrader" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/filestore" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/i18n" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mail" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/templates" + "github.com/mattermost/mattermost-server/server/v8/plugin/scheduler" ) // declaring this as var to allow overriding in tests @@ -137,6 +137,8 @@ type Server struct { tracer *tracing.Tracer + skipProductsInit bool + products map[string]product.Product services map[product.ServiceKey]any @@ -1474,6 +1476,11 @@ func (s *Server) initJobs() { s.Jobs.RegisterJobType(model.JobTypeElasticsearchPostIndexing, builder.MakeWorker(), nil) } + if jobsElasticsearchFixChannelIndexInterface != nil { + builder := jobsElasticsearchFixChannelIndexInterface(s) + s.Jobs.RegisterJobType(model.JobTypeElasticsearchFixChannelIndex, builder.MakeWorker(), nil) + } + if jobsLdapSyncInterface != nil { builder := jobsLdapSyncInterface(New(ServerConnector(s.Channels()))) s.Jobs.RegisterJobType(model.JobTypeLdapSync, builder.MakeWorker(), builder.MakeScheduler()) diff --git a/server/channels/app/server_test.go b/server/channels/app/server_test.go index 00d2c66f71..5403c82ffe 100644 --- a/server/channels/app/server_test.go +++ b/server/channels/app/server_test.go @@ -24,20 +24,25 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/app/platform" - "github.com/mattermost/mattermost-server/v6/server/channels/utils/fileutils" - "github.com/mattermost/mattermost-server/v6/server/config" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/filestore" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/app/platform" + "github.com/mattermost/mattermost-server/server/v8/channels/utils/fileutils" + "github.com/mattermost/mattermost-server/server/v8/config" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/filestore" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) +func newServer(t *testing.T) (*Server, error) { + return newServerWithConfig(t, func(_ *model.Config) {}) +} + func newServerWithConfig(t *testing.T, f func(cfg *model.Config)) (*Server, error) { configStore, err := config.NewMemoryStore() require.NoError(t, err) store, err := config.NewStoreFromBacking(configStore, nil, false) require.NoError(t, err) cfg := store.Get() + cfg.SqlSettings = *mainHelper.GetSQLSettings() f(cfg) store.Set(cfg) @@ -61,13 +66,13 @@ func TestStartServerSuccess(t *testing.T) { } func TestStartServerPortUnavailable(t *testing.T) { - s, err := NewServer() - require.NoError(t, err) - // Listen on the next available port listener, err := net.Listen("tcp", "localhost:0") require.NoError(t, err) + s, err := newServer(t) + require.NoError(t, err) + // Attempt to listen on the port used above. s.platform.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.ListenAddress = listener.Addr().String() @@ -105,6 +110,7 @@ func TestStartServerNoS3Bucket(t *testing.T) { AmazonS3SSL: model.NewBool(false), } *cfg.ServiceSettings.ListenAddress = "localhost:0" + cfg.SqlSettings = *mainHelper.GetSQLSettings() _, _, err := store.Set(cfg) require.NoError(t, err) @@ -162,7 +168,7 @@ func TestDatabaseTypeAndMattermostVersion(t *testing.T) { os.Setenv("MM_SQLSETTINGS_DRIVERNAME", "postgres") - th := Setup(t) + th := Setup(t, SkipProductsInitialization()) defer th.TearDown() databaseType, mattermostVersion := th.Server.DatabaseTypeAndSchemaVersion() @@ -171,7 +177,7 @@ func TestDatabaseTypeAndMattermostVersion(t *testing.T) { os.Setenv("MM_SQLSETTINGS_DRIVERNAME", "mysql") - th2 := Setup(t) + th2 := Setup(t, SkipProductsInitialization()) defer th2.TearDown() databaseType, mattermostVersion = th2.Server.DatabaseTypeAndSchemaVersion() @@ -190,6 +196,7 @@ func TestStartServerTLSVersion(t *testing.T) { *cfg.ServiceSettings.TLSMinVer = "1.2" *cfg.ServiceSettings.TLSKeyFile = path.Join(testDir, "tls_test_key.pem") *cfg.ServiceSettings.TLSCertFile = path.Join(testDir, "tls_test_cert.pem") + cfg.SqlSettings = *mainHelper.GetSQLSettings() store.Set(cfg) @@ -316,7 +323,7 @@ func TestPanicLog(t *testing.T) { logger.LockConfiguration() // Creating a server with logger - s, err := NewServer() + s, err := newServer(t) require.NoError(t, err) s.Platform().SetLogger(logger) diff --git a/server/channels/app/session.go b/server/channels/app/session.go index b7fecbfd17..4fd1bfeffc 100644 --- a/server/channels/app/session.go +++ b/server/channels/app/session.go @@ -10,12 +10,12 @@ import ( "net/http" "os" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/app/platform" - "github.com/mattermost/mattermost-server/v6/server/channels/app/users" - "github.com/mattermost/mattermost-server/v6/server/channels/audit" - "github.com/mattermost/mattermost-server/v6/server/channels/store" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/app/platform" + "github.com/mattermost/mattermost-server/server/v8/channels/app/users" + "github.com/mattermost/mattermost-server/server/v8/channels/audit" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) func (a *App) CreateSession(session *model.Session) (*model.Session, *model.AppError) { diff --git a/server/channels/app/session_test.go b/server/channels/app/session_test.go index 7760bed82a..a4af3e93e4 100644 --- a/server/channels/app/session_test.go +++ b/server/channels/app/session_test.go @@ -12,7 +12,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestGetSessionIdleTimeoutInMinutes(t *testing.T) { diff --git a/server/channels/app/shared_channel.go b/server/channels/app/shared_channel.go index e6c241b1d3..82ccb7a624 100644 --- a/server/channels/app/shared_channel.go +++ b/server/channels/app/shared_channel.go @@ -8,9 +8,9 @@ import ( "fmt" "net/http" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/app/request" - "github.com/mattermost/mattermost-server/v6/server/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/app/request" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" ) func (a *App) checkChannelNotShared(c request.CTX, channelId string) error { diff --git a/server/channels/app/shared_channel_service_iface.go b/server/channels/app/shared_channel_service_iface.go index c6b93359ce..c599b5f11d 100644 --- a/server/channels/app/shared_channel_service_iface.go +++ b/server/channels/app/shared_channel_service_iface.go @@ -5,8 +5,8 @@ package app // TODO: platform: remove this and use from platform package import ( - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/platform/services/sharedchannel" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/services/sharedchannel" ) // SharedChannelServiceIFace is the interface to the shared channel service diff --git a/server/channels/app/shared_channel_test.go b/server/channels/app/shared_channel_test.go index d01269116c..44175c0f44 100644 --- a/server/channels/app/shared_channel_test.go +++ b/server/channels/app/shared_channel_test.go @@ -9,7 +9,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestApp_CheckCanInviteToSharedChannel(t *testing.T) { diff --git a/server/channels/app/slack.go b/server/channels/app/slack.go index 7f956137ea..76e3dc96dd 100644 --- a/server/channels/app/slack.go +++ b/server/channels/app/slack.go @@ -13,10 +13,10 @@ import ( "strings" "time" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/app/request" - "github.com/mattermost/mattermost-server/v6/server/channels/store" - "github.com/mattermost/mattermost-server/v6/server/platform/services/slackimport" + "github.com/mattermost/mattermost-server/server/v8/channels/app/request" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/services/slackimport" ) func (a *App) SlackImport(c *request.Context, fileData multipart.File, fileSize int64, teamID string) (*model.AppError, *bytes.Buffer) { diff --git a/server/channels/app/slack_test.go b/server/channels/app/slack_test.go index e82eb097f1..21f968281e 100644 --- a/server/channels/app/slack_test.go +++ b/server/channels/app/slack_test.go @@ -6,7 +6,7 @@ package app import ( "testing" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestProcessSlackText(t *testing.T) { diff --git a/server/channels/app/slashcommands/auto_channels.go b/server/channels/app/slashcommands/auto_channels.go index a79ffd4985..073f281221 100644 --- a/server/channels/app/slashcommands/auto_channels.go +++ b/server/channels/app/slashcommands/auto_channels.go @@ -4,10 +4,10 @@ package slashcommands import ( - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/app" - "github.com/mattermost/mattermost-server/v6/server/channels/app/request" - "github.com/mattermost/mattermost-server/v6/server/channels/utils" + "github.com/mattermost/mattermost-server/server/v8/channels/app" + "github.com/mattermost/mattermost-server/server/v8/channels/app/request" + "github.com/mattermost/mattermost-server/server/v8/channels/utils" + "github.com/mattermost/mattermost-server/server/v8/model" ) type AutoChannelCreator struct { diff --git a/server/channels/app/slashcommands/auto_constants.go b/server/channels/app/slashcommands/auto_constants.go index 1a269dab96..880e06eee6 100644 --- a/server/channels/app/slashcommands/auto_constants.go +++ b/server/channels/app/slashcommands/auto_constants.go @@ -4,8 +4,8 @@ package slashcommands import ( - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/utils" + "github.com/mattermost/mattermost-server/server/v8/channels/utils" + "github.com/mattermost/mattermost-server/server/v8/model" ) const ( diff --git a/server/channels/app/slashcommands/auto_environment.go b/server/channels/app/slashcommands/auto_environment.go index cba8fa02fe..f3e7d50957 100644 --- a/server/channels/app/slashcommands/auto_environment.go +++ b/server/channels/app/slashcommands/auto_environment.go @@ -7,10 +7,10 @@ import ( "math/rand" "time" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/app" - "github.com/mattermost/mattermost-server/v6/server/channels/app/request" - "github.com/mattermost/mattermost-server/v6/server/channels/utils" + "github.com/mattermost/mattermost-server/server/v8/channels/app" + "github.com/mattermost/mattermost-server/server/v8/channels/app/request" + "github.com/mattermost/mattermost-server/server/v8/channels/utils" + "github.com/mattermost/mattermost-server/server/v8/model" ) type TestEnvironment struct { diff --git a/server/channels/app/slashcommands/auto_posts.go b/server/channels/app/slashcommands/auto_posts.go index 08abb4061e..e375f97403 100644 --- a/server/channels/app/slashcommands/auto_posts.go +++ b/server/channels/app/slashcommands/auto_posts.go @@ -9,11 +9,11 @@ import ( "os" "path/filepath" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/app" - "github.com/mattermost/mattermost-server/v6/server/channels/app/request" - "github.com/mattermost/mattermost-server/v6/server/channels/utils" - "github.com/mattermost/mattermost-server/v6/server/channels/utils/fileutils" + "github.com/mattermost/mattermost-server/server/v8/channels/app" + "github.com/mattermost/mattermost-server/server/v8/channels/app/request" + "github.com/mattermost/mattermost-server/server/v8/channels/utils" + "github.com/mattermost/mattermost-server/server/v8/channels/utils/fileutils" + "github.com/mattermost/mattermost-server/server/v8/model" ) type AutoPostCreator struct { diff --git a/server/channels/app/slashcommands/auto_teams.go b/server/channels/app/slashcommands/auto_teams.go index dea793cd76..30cd1ef97b 100644 --- a/server/channels/app/slashcommands/auto_teams.go +++ b/server/channels/app/slashcommands/auto_teams.go @@ -4,8 +4,8 @@ package slashcommands import ( - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/utils" + "github.com/mattermost/mattermost-server/server/v8/channels/utils" + "github.com/mattermost/mattermost-server/server/v8/model" ) type TeamEnvironment struct { diff --git a/server/channels/app/slashcommands/auto_users.go b/server/channels/app/slashcommands/auto_users.go index 5e944b60cd..ed2125da79 100644 --- a/server/channels/app/slashcommands/auto_users.go +++ b/server/channels/app/slashcommands/auto_users.go @@ -7,11 +7,11 @@ import ( "errors" "net/http" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/app" - "github.com/mattermost/mattermost-server/v6/server/channels/app/request" - "github.com/mattermost/mattermost-server/v6/server/channels/store" - "github.com/mattermost/mattermost-server/v6/server/channels/utils" + "github.com/mattermost/mattermost-server/server/v8/channels/app" + "github.com/mattermost/mattermost-server/server/v8/channels/app/request" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/utils" + "github.com/mattermost/mattermost-server/server/v8/model" ) type AutoUserCreator struct { diff --git a/server/channels/app/slashcommands/command_away.go b/server/channels/app/slashcommands/command_away.go index 6f8efaeebf..bc64e53461 100644 --- a/server/channels/app/slashcommands/command_away.go +++ b/server/channels/app/slashcommands/command_away.go @@ -4,10 +4,10 @@ package slashcommands import ( - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/app" - "github.com/mattermost/mattermost-server/v6/server/channels/app/request" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/i18n" + "github.com/mattermost/mattermost-server/server/v8/channels/app" + "github.com/mattermost/mattermost-server/server/v8/channels/app/request" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/i18n" ) type AwayProvider struct { diff --git a/server/channels/app/slashcommands/command_channel_header.go b/server/channels/app/slashcommands/command_channel_header.go index 06f7bb0a04..5f8bad0dd5 100644 --- a/server/channels/app/slashcommands/command_channel_header.go +++ b/server/channels/app/slashcommands/command_channel_header.go @@ -4,10 +4,10 @@ package slashcommands import ( - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/app" - "github.com/mattermost/mattermost-server/v6/server/channels/app/request" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/i18n" + "github.com/mattermost/mattermost-server/server/v8/channels/app" + "github.com/mattermost/mattermost-server/server/v8/channels/app/request" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/i18n" ) type HeaderProvider struct { diff --git a/server/channels/app/slashcommands/command_channel_header_test.go b/server/channels/app/slashcommands/command_channel_header_test.go index 1cf7d4d6a4..7f48a978b4 100644 --- a/server/channels/app/slashcommands/command_channel_header_test.go +++ b/server/channels/app/slashcommands/command_channel_header_test.go @@ -8,7 +8,7 @@ import ( "github.com/stretchr/testify/assert" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestHeaderProviderDoCommand(t *testing.T) { diff --git a/server/channels/app/slashcommands/command_channel_purpose.go b/server/channels/app/slashcommands/command_channel_purpose.go index 31691d31e7..1477142ae0 100644 --- a/server/channels/app/slashcommands/command_channel_purpose.go +++ b/server/channels/app/slashcommands/command_channel_purpose.go @@ -4,10 +4,10 @@ package slashcommands import ( - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/app" - "github.com/mattermost/mattermost-server/v6/server/channels/app/request" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/i18n" + "github.com/mattermost/mattermost-server/server/v8/channels/app" + "github.com/mattermost/mattermost-server/server/v8/channels/app/request" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/i18n" ) type PurposeProvider struct { diff --git a/server/channels/app/slashcommands/command_channel_purpose_test.go b/server/channels/app/slashcommands/command_channel_purpose_test.go index 3f6e9a71d9..5663690cac 100644 --- a/server/channels/app/slashcommands/command_channel_purpose_test.go +++ b/server/channels/app/slashcommands/command_channel_purpose_test.go @@ -8,7 +8,7 @@ import ( "github.com/stretchr/testify/assert" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestPurposeProviderDoCommand(t *testing.T) { diff --git a/server/channels/app/slashcommands/command_channel_rename.go b/server/channels/app/slashcommands/command_channel_rename.go index ee9a0edfe3..6cf8b1a139 100644 --- a/server/channels/app/slashcommands/command_channel_rename.go +++ b/server/channels/app/slashcommands/command_channel_rename.go @@ -4,10 +4,10 @@ package slashcommands import ( - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/app" - "github.com/mattermost/mattermost-server/v6/server/channels/app/request" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/i18n" + "github.com/mattermost/mattermost-server/server/v8/channels/app" + "github.com/mattermost/mattermost-server/server/v8/channels/app/request" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/i18n" ) type RenameProvider struct { diff --git a/server/channels/app/slashcommands/command_channel_rename_test.go b/server/channels/app/slashcommands/command_channel_rename_test.go index ff8aabbb64..4530e6d917 100644 --- a/server/channels/app/slashcommands/command_channel_rename_test.go +++ b/server/channels/app/slashcommands/command_channel_rename_test.go @@ -9,7 +9,7 @@ import ( "github.com/stretchr/testify/assert" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestRenameProviderDoCommand(t *testing.T) { diff --git a/server/channels/app/slashcommands/command_code.go b/server/channels/app/slashcommands/command_code.go index 085f89b55b..bb57353e94 100644 --- a/server/channels/app/slashcommands/command_code.go +++ b/server/channels/app/slashcommands/command_code.go @@ -6,10 +6,10 @@ package slashcommands import ( "strings" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/app" - "github.com/mattermost/mattermost-server/v6/server/channels/app/request" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/i18n" + "github.com/mattermost/mattermost-server/server/v8/channels/app" + "github.com/mattermost/mattermost-server/server/v8/channels/app/request" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/i18n" ) type CodeProvider struct { diff --git a/server/channels/app/slashcommands/command_code_test.go b/server/channels/app/slashcommands/command_code_test.go index e43bd6d469..cdc0bc6d68 100644 --- a/server/channels/app/slashcommands/command_code_test.go +++ b/server/channels/app/slashcommands/command_code_test.go @@ -6,7 +6,7 @@ package slashcommands import ( "testing" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestCodeProviderDoCommand(t *testing.T) { diff --git a/server/channels/app/slashcommands/command_custom_status.go b/server/channels/app/slashcommands/command_custom_status.go index 2a85e93b8c..c7a60acd2a 100644 --- a/server/channels/app/slashcommands/command_custom_status.go +++ b/server/channels/app/slashcommands/command_custom_status.go @@ -8,11 +8,11 @@ import ( "strings" "unicode/utf8" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/app" - "github.com/mattermost/mattermost-server/v6/server/channels/app/request" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/i18n" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/app" + "github.com/mattermost/mattermost-server/server/v8/channels/app/request" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/i18n" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) type CustomStatusProvider struct { diff --git a/server/channels/app/slashcommands/command_custom_status_test.go b/server/channels/app/slashcommands/command_custom_status_test.go index 560ba2e181..359b8c11c9 100644 --- a/server/channels/app/slashcommands/command_custom_status_test.go +++ b/server/channels/app/slashcommands/command_custom_status_test.go @@ -6,7 +6,7 @@ package slashcommands import ( "testing" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestGetCustomStatus(t *testing.T) { diff --git a/server/channels/app/slashcommands/command_dnd.go b/server/channels/app/slashcommands/command_dnd.go index 5dca6ae9ad..f028f3eb22 100644 --- a/server/channels/app/slashcommands/command_dnd.go +++ b/server/channels/app/slashcommands/command_dnd.go @@ -4,10 +4,10 @@ package slashcommands import ( - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/app" - "github.com/mattermost/mattermost-server/v6/server/channels/app/request" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/i18n" + "github.com/mattermost/mattermost-server/server/v8/channels/app" + "github.com/mattermost/mattermost-server/server/v8/channels/app/request" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/i18n" ) type DndProvider struct { diff --git a/server/channels/app/slashcommands/command_echo.go b/server/channels/app/slashcommands/command_echo.go index f2105ab1f4..58dd39e5f5 100644 --- a/server/channels/app/slashcommands/command_echo.go +++ b/server/channels/app/slashcommands/command_echo.go @@ -8,11 +8,11 @@ import ( "strings" "time" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/app" - "github.com/mattermost/mattermost-server/v6/server/channels/app/request" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/i18n" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/app" + "github.com/mattermost/mattermost-server/server/v8/channels/app/request" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/i18n" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) var echoSem chan bool diff --git a/server/channels/app/slashcommands/command_expand_collapse.go b/server/channels/app/slashcommands/command_expand_collapse.go index f243cc76af..477a027935 100644 --- a/server/channels/app/slashcommands/command_expand_collapse.go +++ b/server/channels/app/slashcommands/command_expand_collapse.go @@ -7,10 +7,10 @@ import ( "encoding/json" "strconv" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/app" - "github.com/mattermost/mattermost-server/v6/server/channels/app/request" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/i18n" + "github.com/mattermost/mattermost-server/server/v8/channels/app" + "github.com/mattermost/mattermost-server/server/v8/channels/app/request" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/i18n" ) type ExpandProvider struct { diff --git a/server/channels/app/slashcommands/command_groupmsg.go b/server/channels/app/slashcommands/command_groupmsg.go index 507fd524c6..4083b2f628 100644 --- a/server/channels/app/slashcommands/command_groupmsg.go +++ b/server/channels/app/slashcommands/command_groupmsg.go @@ -7,11 +7,11 @@ import ( "fmt" "strings" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/app" - "github.com/mattermost/mattermost-server/v6/server/channels/app/request" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/i18n" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/app" + "github.com/mattermost/mattermost-server/server/v8/channels/app/request" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/i18n" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) type groupmsgProvider struct { diff --git a/server/channels/app/slashcommands/command_groupmsg_test.go b/server/channels/app/slashcommands/command_groupmsg_test.go index 5db0a977b3..6743a57de7 100644 --- a/server/channels/app/slashcommands/command_groupmsg_test.go +++ b/server/channels/app/slashcommands/command_groupmsg_test.go @@ -8,8 +8,8 @@ import ( "github.com/stretchr/testify/assert" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/i18n" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/i18n" ) func TestGroupMsgUsernames(t *testing.T) { diff --git a/server/channels/app/slashcommands/command_help.go b/server/channels/app/slashcommands/command_help.go index 15a53ed5f0..61b85dd7b9 100644 --- a/server/channels/app/slashcommands/command_help.go +++ b/server/channels/app/slashcommands/command_help.go @@ -4,10 +4,10 @@ package slashcommands import ( - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/app" - "github.com/mattermost/mattermost-server/v6/server/channels/app/request" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/i18n" + "github.com/mattermost/mattermost-server/server/v8/channels/app" + "github.com/mattermost/mattermost-server/server/v8/channels/app/request" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/i18n" ) type HelpProvider struct { diff --git a/server/channels/app/slashcommands/command_invite.go b/server/channels/app/slashcommands/command_invite.go index 9fcf79de19..906b9596ae 100644 --- a/server/channels/app/slashcommands/command_invite.go +++ b/server/channels/app/slashcommands/command_invite.go @@ -6,10 +6,10 @@ package slashcommands import ( "strings" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/app" - "github.com/mattermost/mattermost-server/v6/server/channels/app/request" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/i18n" + "github.com/mattermost/mattermost-server/server/v8/channels/app" + "github.com/mattermost/mattermost-server/server/v8/channels/app/request" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/i18n" ) type InviteProvider struct { diff --git a/server/channels/app/slashcommands/command_invite_people.go b/server/channels/app/slashcommands/command_invite_people.go index f1e895cc7c..11040ac74f 100644 --- a/server/channels/app/slashcommands/command_invite_people.go +++ b/server/channels/app/slashcommands/command_invite_people.go @@ -6,11 +6,11 @@ package slashcommands import ( "strings" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/app" - "github.com/mattermost/mattermost-server/v6/server/channels/app/request" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/i18n" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/app" + "github.com/mattermost/mattermost-server/server/v8/channels/app/request" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/i18n" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) type InvitePeopleProvider struct { diff --git a/server/channels/app/slashcommands/command_invite_people_test.go b/server/channels/app/slashcommands/command_invite_people_test.go index 8956b884b5..09112b3f57 100644 --- a/server/channels/app/slashcommands/command_invite_people_test.go +++ b/server/channels/app/slashcommands/command_invite_people_test.go @@ -8,7 +8,7 @@ import ( "github.com/stretchr/testify/assert" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestInvitePeopleProvider(t *testing.T) { diff --git a/server/channels/app/slashcommands/command_invite_test.go b/server/channels/app/slashcommands/command_invite_test.go index b2163fb4a7..b2e2532168 100644 --- a/server/channels/app/slashcommands/command_invite_test.go +++ b/server/channels/app/slashcommands/command_invite_test.go @@ -9,8 +9,8 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/app" + "github.com/mattermost/mattermost-server/server/v8/channels/app" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestInviteProvider(t *testing.T) { diff --git a/server/channels/app/slashcommands/command_join.go b/server/channels/app/slashcommands/command_join.go index 3f2c1f6053..9b87073e27 100644 --- a/server/channels/app/slashcommands/command_join.go +++ b/server/channels/app/slashcommands/command_join.go @@ -6,10 +6,10 @@ package slashcommands import ( "strings" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/app" - "github.com/mattermost/mattermost-server/v6/server/channels/app/request" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/i18n" + "github.com/mattermost/mattermost-server/server/v8/channels/app" + "github.com/mattermost/mattermost-server/server/v8/channels/app/request" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/i18n" ) type JoinProvider struct { diff --git a/server/channels/app/slashcommands/command_join_test.go b/server/channels/app/slashcommands/command_join_test.go index c30c0b1621..850a4bcc31 100644 --- a/server/channels/app/slashcommands/command_join_test.go +++ b/server/channels/app/slashcommands/command_join_test.go @@ -8,8 +8,8 @@ import ( "github.com/stretchr/testify/assert" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/i18n" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/i18n" ) func TestJoinCommandNoChannel(t *testing.T) { diff --git a/server/channels/app/slashcommands/command_leave.go b/server/channels/app/slashcommands/command_leave.go index e1868d24ea..2711d73c2b 100644 --- a/server/channels/app/slashcommands/command_leave.go +++ b/server/channels/app/slashcommands/command_leave.go @@ -4,10 +4,10 @@ package slashcommands import ( - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/app" - "github.com/mattermost/mattermost-server/v6/server/channels/app/request" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/i18n" + "github.com/mattermost/mattermost-server/server/v8/channels/app" + "github.com/mattermost/mattermost-server/server/v8/channels/app/request" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/i18n" ) type LeaveProvider struct { diff --git a/server/channels/app/slashcommands/command_leave_test.go b/server/channels/app/slashcommands/command_leave_test.go index 1abbc9048f..e7e2d149cd 100644 --- a/server/channels/app/slashcommands/command_leave_test.go +++ b/server/channels/app/slashcommands/command_leave_test.go @@ -9,7 +9,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestLeaveProviderDoCommand(t *testing.T) { diff --git a/server/channels/app/slashcommands/command_loadtest.go b/server/channels/app/slashcommands/command_loadtest.go index a0b02267b4..a3beb9bc23 100644 --- a/server/channels/app/slashcommands/command_loadtest.go +++ b/server/channels/app/slashcommands/command_loadtest.go @@ -14,12 +14,12 @@ import ( "github.com/pkg/errors" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/app" - "github.com/mattermost/mattermost-server/v6/server/channels/app/request" - "github.com/mattermost/mattermost-server/v6/server/channels/utils" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/i18n" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/app" + "github.com/mattermost/mattermost-server/server/v8/channels/app/request" + "github.com/mattermost/mattermost-server/server/v8/channels/utils" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/i18n" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) var usage = `Mattermost testing commands to help configure the system diff --git a/server/channels/app/slashcommands/command_logout.go b/server/channels/app/slashcommands/command_logout.go index cda4db774f..a8df517bf9 100644 --- a/server/channels/app/slashcommands/command_logout.go +++ b/server/channels/app/slashcommands/command_logout.go @@ -4,10 +4,10 @@ package slashcommands import ( - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/app" - "github.com/mattermost/mattermost-server/v6/server/channels/app/request" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/i18n" + "github.com/mattermost/mattermost-server/server/v8/channels/app" + "github.com/mattermost/mattermost-server/server/v8/channels/app/request" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/i18n" ) type LogoutProvider struct { diff --git a/server/channels/app/slashcommands/command_marketplace.go b/server/channels/app/slashcommands/command_marketplace.go index b33e987883..5ffbd49d2b 100644 --- a/server/channels/app/slashcommands/command_marketplace.go +++ b/server/channels/app/slashcommands/command_marketplace.go @@ -4,10 +4,10 @@ package slashcommands import ( - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/app" - "github.com/mattermost/mattermost-server/v6/server/channels/app/request" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/i18n" + "github.com/mattermost/mattermost-server/server/v8/channels/app" + "github.com/mattermost/mattermost-server/server/v8/channels/app/request" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/i18n" ) type MarketplaceProvider struct { diff --git a/server/channels/app/slashcommands/command_marketplace_test.go b/server/channels/app/slashcommands/command_marketplace_test.go index e023869204..0b6fe14bdf 100644 --- a/server/channels/app/slashcommands/command_marketplace_test.go +++ b/server/channels/app/slashcommands/command_marketplace_test.go @@ -8,7 +8,7 @@ import ( "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestMarketplaceProviderGetCommand(t *testing.T) { diff --git a/server/channels/app/slashcommands/command_me.go b/server/channels/app/slashcommands/command_me.go index b557ed4a8d..8415d21d2c 100644 --- a/server/channels/app/slashcommands/command_me.go +++ b/server/channels/app/slashcommands/command_me.go @@ -4,10 +4,10 @@ package slashcommands import ( - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/app" - "github.com/mattermost/mattermost-server/v6/server/channels/app/request" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/i18n" + "github.com/mattermost/mattermost-server/server/v8/channels/app" + "github.com/mattermost/mattermost-server/server/v8/channels/app/request" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/i18n" ) type MeProvider struct { diff --git a/server/channels/app/slashcommands/command_me_test.go b/server/channels/app/slashcommands/command_me_test.go index 20472e745b..467374f817 100644 --- a/server/channels/app/slashcommands/command_me_test.go +++ b/server/channels/app/slashcommands/command_me_test.go @@ -8,7 +8,7 @@ import ( "github.com/stretchr/testify/assert" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestMeProviderDoCommand(t *testing.T) { diff --git a/server/channels/app/slashcommands/command_msg.go b/server/channels/app/slashcommands/command_msg.go index e336ace857..7daae35e74 100644 --- a/server/channels/app/slashcommands/command_msg.go +++ b/server/channels/app/slashcommands/command_msg.go @@ -7,12 +7,12 @@ import ( "errors" "strings" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/app" - "github.com/mattermost/mattermost-server/v6/server/channels/app/request" - "github.com/mattermost/mattermost-server/v6/server/channels/store" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/i18n" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/app" + "github.com/mattermost/mattermost-server/server/v8/channels/app/request" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/i18n" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) type msgProvider struct { diff --git a/server/channels/app/slashcommands/command_msg_test.go b/server/channels/app/slashcommands/command_msg_test.go index 549f703b3f..4f8fd0d172 100644 --- a/server/channels/app/slashcommands/command_msg_test.go +++ b/server/channels/app/slashcommands/command_msg_test.go @@ -8,8 +8,8 @@ import ( "github.com/stretchr/testify/assert" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/i18n" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/i18n" ) func TestMsgProvider(t *testing.T) { diff --git a/server/channels/app/slashcommands/command_mute.go b/server/channels/app/slashcommands/command_mute.go index de2dfd4d6a..8b83b7fa5d 100644 --- a/server/channels/app/slashcommands/command_mute.go +++ b/server/channels/app/slashcommands/command_mute.go @@ -6,10 +6,10 @@ package slashcommands import ( "strings" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/app" - "github.com/mattermost/mattermost-server/v6/server/channels/app/request" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/i18n" + "github.com/mattermost/mattermost-server/server/v8/channels/app" + "github.com/mattermost/mattermost-server/server/v8/channels/app/request" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/i18n" ) type MuteProvider struct { diff --git a/server/channels/app/slashcommands/command_mute_test.go b/server/channels/app/slashcommands/command_mute_test.go index 9d62c4b6cc..5cc43352b6 100644 --- a/server/channels/app/slashcommands/command_mute_test.go +++ b/server/channels/app/slashcommands/command_mute_test.go @@ -9,8 +9,8 @@ import ( "github.com/stretchr/testify/assert" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/i18n" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/i18n" ) func TestMuteCommandNoChannel(t *testing.T) { diff --git a/server/channels/app/slashcommands/command_offline.go b/server/channels/app/slashcommands/command_offline.go index ba8a2624e4..c11729cf62 100644 --- a/server/channels/app/slashcommands/command_offline.go +++ b/server/channels/app/slashcommands/command_offline.go @@ -4,10 +4,10 @@ package slashcommands import ( - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/app" - "github.com/mattermost/mattermost-server/v6/server/channels/app/request" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/i18n" + "github.com/mattermost/mattermost-server/server/v8/channels/app" + "github.com/mattermost/mattermost-server/server/v8/channels/app/request" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/i18n" ) type OfflineProvider struct { diff --git a/server/channels/app/slashcommands/command_online.go b/server/channels/app/slashcommands/command_online.go index e17fb7fa18..df38029fd1 100644 --- a/server/channels/app/slashcommands/command_online.go +++ b/server/channels/app/slashcommands/command_online.go @@ -4,10 +4,10 @@ package slashcommands import ( - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/app" - "github.com/mattermost/mattermost-server/v6/server/channels/app/request" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/i18n" + "github.com/mattermost/mattermost-server/server/v8/channels/app" + "github.com/mattermost/mattermost-server/server/v8/channels/app/request" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/i18n" ) type OnlineProvider struct { diff --git a/server/channels/app/slashcommands/command_open.go b/server/channels/app/slashcommands/command_open.go index e9003f48a1..904a5f50ac 100644 --- a/server/channels/app/slashcommands/command_open.go +++ b/server/channels/app/slashcommands/command_open.go @@ -4,9 +4,9 @@ package slashcommands import ( - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/app" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/i18n" + "github.com/mattermost/mattermost-server/server/v8/channels/app" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/i18n" ) type OpenProvider struct { diff --git a/server/channels/app/slashcommands/command_remote.go b/server/channels/app/slashcommands/command_remote.go index b86cf561c5..ca50466586 100644 --- a/server/channels/app/slashcommands/command_remote.go +++ b/server/channels/app/slashcommands/command_remote.go @@ -9,10 +9,10 @@ import ( "fmt" "strings" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/app" - "github.com/mattermost/mattermost-server/v6/server/channels/app/request" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/i18n" + "github.com/mattermost/mattermost-server/server/v8/channels/app" + "github.com/mattermost/mattermost-server/server/v8/channels/app/request" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/i18n" ) const ( diff --git a/server/channels/app/slashcommands/command_remove.go b/server/channels/app/slashcommands/command_remove.go index 0baf47c295..e021c976a6 100644 --- a/server/channels/app/slashcommands/command_remove.go +++ b/server/channels/app/slashcommands/command_remove.go @@ -6,11 +6,11 @@ package slashcommands import ( "strings" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/app" - "github.com/mattermost/mattermost-server/v6/server/channels/app/request" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/i18n" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/app" + "github.com/mattermost/mattermost-server/server/v8/channels/app/request" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/i18n" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) type RemoveProvider struct { diff --git a/server/channels/app/slashcommands/command_remove_test.go b/server/channels/app/slashcommands/command_remove_test.go index 32fe1a2213..2d1c7821e6 100644 --- a/server/channels/app/slashcommands/command_remove_test.go +++ b/server/channels/app/slashcommands/command_remove_test.go @@ -8,7 +8,7 @@ import ( "github.com/stretchr/testify/assert" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestRemoveProviderDoCommand(t *testing.T) { diff --git a/server/channels/app/slashcommands/command_search.go b/server/channels/app/slashcommands/command_search.go index a38327ceb4..1587ae46b1 100644 --- a/server/channels/app/slashcommands/command_search.go +++ b/server/channels/app/slashcommands/command_search.go @@ -4,10 +4,10 @@ package slashcommands import ( - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/app" - "github.com/mattermost/mattermost-server/v6/server/channels/app/request" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/i18n" + "github.com/mattermost/mattermost-server/server/v8/channels/app" + "github.com/mattermost/mattermost-server/server/v8/channels/app/request" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/i18n" ) type SearchProvider struct { diff --git a/server/channels/app/slashcommands/command_settings.go b/server/channels/app/slashcommands/command_settings.go index bbc0acda94..dc19789e1f 100644 --- a/server/channels/app/slashcommands/command_settings.go +++ b/server/channels/app/slashcommands/command_settings.go @@ -4,10 +4,10 @@ package slashcommands import ( - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/app" - "github.com/mattermost/mattermost-server/v6/server/channels/app/request" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/i18n" + "github.com/mattermost/mattermost-server/server/v8/channels/app" + "github.com/mattermost/mattermost-server/server/v8/channels/app/request" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/i18n" ) type SettingsProvider struct { diff --git a/server/channels/app/slashcommands/command_share.go b/server/channels/app/slashcommands/command_share.go index 510b1dac34..0827eaf733 100644 --- a/server/channels/app/slashcommands/command_share.go +++ b/server/channels/app/slashcommands/command_share.go @@ -8,10 +8,10 @@ import ( "fmt" "strings" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/app" - "github.com/mattermost/mattermost-server/v6/server/channels/app/request" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/i18n" + "github.com/mattermost/mattermost-server/server/v8/channels/app" + "github.com/mattermost/mattermost-server/server/v8/channels/app/request" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/i18n" ) type ShareProvider struct { diff --git a/server/channels/app/slashcommands/command_share_test.go b/server/channels/app/slashcommands/command_share_test.go index 66f9a3a548..1d4e6a8fdf 100644 --- a/server/channels/app/slashcommands/command_share_test.go +++ b/server/channels/app/slashcommands/command_share_test.go @@ -9,14 +9,14 @@ import ( "github.com/stretchr/testify/assert" - "github.com/mattermost/mattermost-server/v6/server/channels/testlib" + "github.com/mattermost/mattermost-server/server/v8/channels/testlib" - "github.com/mattermost/mattermost-server/v6/server/channels/app" - "github.com/mattermost/mattermost-server/v6/server/platform/services/remotecluster" + "github.com/mattermost/mattermost-server/server/v8/channels/app" + "github.com/mattermost/mattermost-server/server/v8/platform/services/remotecluster" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestShareProviderDoCommand(t *testing.T) { diff --git a/server/channels/app/slashcommands/command_shortcuts.go b/server/channels/app/slashcommands/command_shortcuts.go index 7c0591992e..cad9369d16 100644 --- a/server/channels/app/slashcommands/command_shortcuts.go +++ b/server/channels/app/slashcommands/command_shortcuts.go @@ -4,10 +4,10 @@ package slashcommands import ( - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/app" - "github.com/mattermost/mattermost-server/v6/server/channels/app/request" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/i18n" + "github.com/mattermost/mattermost-server/server/v8/channels/app" + "github.com/mattermost/mattermost-server/server/v8/channels/app/request" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/i18n" ) type ShortcutsProvider struct { diff --git a/server/channels/app/slashcommands/command_shrug.go b/server/channels/app/slashcommands/command_shrug.go index 5653dd6714..019ed4e6c6 100644 --- a/server/channels/app/slashcommands/command_shrug.go +++ b/server/channels/app/slashcommands/command_shrug.go @@ -4,10 +4,10 @@ package slashcommands import ( - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/app" - "github.com/mattermost/mattermost-server/v6/server/channels/app/request" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/i18n" + "github.com/mattermost/mattermost-server/server/v8/channels/app" + "github.com/mattermost/mattermost-server/server/v8/channels/app/request" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/i18n" ) type ShrugProvider struct { diff --git a/server/channels/app/slashcommands/command_templates.go b/server/channels/app/slashcommands/command_templates.go index 0dca8d6631..04fa5aaba1 100644 --- a/server/channels/app/slashcommands/command_templates.go +++ b/server/channels/app/slashcommands/command_templates.go @@ -4,10 +4,10 @@ package slashcommands import ( - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/app" - "github.com/mattermost/mattermost-server/v6/server/channels/app/request" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/i18n" + "github.com/mattermost/mattermost-server/server/v8/channels/app" + "github.com/mattermost/mattermost-server/server/v8/channels/app/request" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/i18n" ) type TemplatesProvider struct { diff --git a/server/channels/app/slashcommands/command_test.go b/server/channels/app/slashcommands/command_test.go index 2de89a0feb..1ca8d861d6 100644 --- a/server/channels/app/slashcommands/command_test.go +++ b/server/channels/app/slashcommands/command_test.go @@ -16,8 +16,8 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/platform/services/httpservice" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/services/httpservice" ) type InfiniteReader struct { diff --git a/server/channels/app/slashcommands/helper_test.go b/server/channels/app/slashcommands/helper_test.go index 1941b7c355..b0890d3d38 100644 --- a/server/channels/app/slashcommands/helper_test.go +++ b/server/channels/app/slashcommands/helper_test.go @@ -13,12 +13,12 @@ import ( "testing" "time" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/app" - "github.com/mattermost/mattermost-server/v6/server/channels/app/request" - "github.com/mattermost/mattermost-server/v6/server/channels/store" - "github.com/mattermost/mattermost-server/v6/server/config" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/app" + "github.com/mattermost/mattermost-server/server/v8/channels/app/request" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/config" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) type TestHelper struct { @@ -51,6 +51,7 @@ func setupTestHelper(dbStore store.Store, enterprise bool, includeCacheLayer boo if configSet != nil { configSet(memoryConfig) } + memoryConfig.SqlSettings = *mainHelper.GetSQLSettings() *memoryConfig.PluginSettings.Directory = filepath.Join(tempWorkspace, "plugins") *memoryConfig.PluginSettings.ClientDirectory = filepath.Join(tempWorkspace, "webapp") *memoryConfig.PluginSettings.AutomaticPrepackagedPlugins = false @@ -142,6 +143,7 @@ func setup(tb testing.TB) *TestHelper { dbStore := mainHelper.GetStore() dbStore.DropAllTables() dbStore.MarkSystemRanUnitTests() + mainHelper.PreloadBoardsMigrationsIfNeeded() return setupTestHelper(dbStore, false, true, tb, nil) } diff --git a/server/channels/app/slashcommands/main_test.go b/server/channels/app/slashcommands/main_test.go index 6cbb4c352d..ab5797f831 100644 --- a/server/channels/app/slashcommands/main_test.go +++ b/server/channels/app/slashcommands/main_test.go @@ -6,7 +6,7 @@ package slashcommands import ( "testing" - "github.com/mattermost/mattermost-server/v6/server/channels/testlib" + "github.com/mattermost/mattermost-server/server/v8/channels/testlib" ) var mainHelper *testlib.MainHelper diff --git a/server/channels/app/slashcommands/util.go b/server/channels/app/slashcommands/util.go index ee46154456..5ebd3273c2 100644 --- a/server/channels/app/slashcommands/util.go +++ b/server/channels/app/slashcommands/util.go @@ -8,8 +8,8 @@ import ( "strings" "time" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/i18n" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/i18n" ) const ( diff --git a/server/channels/app/status.go b/server/channels/app/status.go index 828296babd..0ae8ea0a58 100644 --- a/server/channels/app/status.go +++ b/server/channels/app/status.go @@ -7,9 +7,9 @@ import ( "encoding/json" "net/http" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/app/request" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/app/request" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) // GetUserStatusesByIds used by apiV4 diff --git a/server/channels/app/status_test.go b/server/channels/app/status_test.go index e4ffef4585..4b12665359 100644 --- a/server/channels/app/status_test.go +++ b/server/channels/app/status_test.go @@ -9,10 +9,10 @@ import ( "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/app/users" - "github.com/mattermost/mattermost-server/v6/server/channels/store" - "github.com/mattermost/mattermost-server/v6/server/channels/store/storetest/mocks" + "github.com/mattermost/mattermost-server/server/v8/channels/app/users" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/store/storetest/mocks" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestCustomStatus(t *testing.T) { diff --git a/server/channels/app/support_packet.go b/server/channels/app/support_packet.go index 66e88eb7ea..96d5ccff07 100644 --- a/server/channels/app/support_packet.go +++ b/server/channels/app/support_packet.go @@ -13,8 +13,8 @@ import ( "github.com/pkg/errors" "gopkg.in/yaml.v2" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/config" + "github.com/mattermost/mattermost-server/server/v8/config" + "github.com/mattermost/mattermost-server/server/v8/model" ) func (a *App) GenerateSupportPacket() []model.FileData { diff --git a/server/channels/app/support_packet_test.go b/server/channels/app/support_packet_test.go index 8158db50e8..72a206b9fd 100644 --- a/server/channels/app/support_packet_test.go +++ b/server/channels/app/support_packet_test.go @@ -11,7 +11,7 @@ import ( "github.com/stretchr/testify/require" "gopkg.in/yaml.v2" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestCreatePluginsFile(t *testing.T) { diff --git a/server/channels/app/syncables.go b/server/channels/app/syncables.go index 9e1024c0b6..f4ba78f235 100644 --- a/server/channels/app/syncables.go +++ b/server/channels/app/syncables.go @@ -8,9 +8,9 @@ import ( "net/http" "strings" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/app/request" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/app/request" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) // createDefaultChannelMemberships adds users to channels based on their group memberships and how those groups are diff --git a/server/channels/app/syncables_test.go b/server/channels/app/syncables_test.go index 0908a859a2..85dad92182 100644 --- a/server/channels/app/syncables_test.go +++ b/server/channels/app/syncables_test.go @@ -8,7 +8,7 @@ import ( "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestCreateDefaultMemberships(t *testing.T) { diff --git a/server/channels/app/team.go b/server/channels/app/team.go index 4a08fcd9ab..66055b4afc 100644 --- a/server/channels/app/team.go +++ b/server/channels/app/team.go @@ -18,20 +18,20 @@ import ( "sort" "strings" - fb_model "github.com/mattermost/mattermost-server/v6/server/boards/model" + fb_model "github.com/mattermost/mattermost-server/server/v8/boards/model" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/plugin" - "github.com/mattermost/mattermost-server/v6/server/channels/app/email" - "github.com/mattermost/mattermost-server/v6/server/channels/app/imaging" - "github.com/mattermost/mattermost-server/v6/server/channels/app/request" - "github.com/mattermost/mattermost-server/v6/server/channels/app/teams" - "github.com/mattermost/mattermost-server/v6/server/channels/app/users" - "github.com/mattermost/mattermost-server/v6/server/channels/product" - "github.com/mattermost/mattermost-server/v6/server/channels/store" - "github.com/mattermost/mattermost-server/v6/server/channels/store/sqlstore" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/i18n" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/app/email" + "github.com/mattermost/mattermost-server/server/v8/channels/app/imaging" + "github.com/mattermost/mattermost-server/server/v8/channels/app/request" + "github.com/mattermost/mattermost-server/server/v8/channels/app/teams" + "github.com/mattermost/mattermost-server/server/v8/channels/app/users" + "github.com/mattermost/mattermost-server/server/v8/channels/product" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/store/sqlstore" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/i18n" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/plugin" ) // teamServiceWrapper provides an implementation of `product.TeamService` to be used by products. @@ -207,7 +207,7 @@ func (a *App) shouldCreateOnboardingLinkedBoard(c request.CTX, teamId string) bo func (a *App) createOnboardingLinkedBoard(c request.CTX, teamId string) (*fb_model.Board, *model.AppError) { const defaultTemplatesTeam = "0" - // see https://github.com/mattermost/mattermost-server/v6/server/boards/blob/main/server/services/store/sqlstore/board.go#L302 + // see https://github.com/mattermost/mattermost-server/server/v8/boards/blob/main/server/services/store/sqlstore/board.go#L302 // and https://github.com/mattermost/mattermost-server/pull/22201#discussion_r1099536430 const defaultTemplateTitle = "Welcome to Boards!" welcomeToBoardsTemplateId := fmt.Sprintf("%x", md5.Sum([]byte(defaultTemplateTitle))) @@ -956,9 +956,11 @@ func (a *App) JoinUserToTeam(c request.CTX, team *model.Team, user *model.User, return nil, model.NewAppError("JoinUserToTeam", "app.user.update_update.app_error", nil, "", http.StatusInternalServerError).Wrap(err) } + appsCategoryEnabled := a.Config().FeatureFlags.AppsSidebarCategory opts := &store.SidebarCategorySearchOpts{ - TeamID: team.Id, - ExcludeTeam: false, + TeamID: team.Id, + ExcludeTeam: false, + AppsCategoryEnabled: appsCategoryEnabled, } if _, err := a.createInitialSidebarCategories(user.Id, opts); err != nil { mlog.Warn( diff --git a/server/channels/app/team_test.go b/server/channels/app/team_test.go index d29fdeda3b..c8cda76eaf 100644 --- a/server/channels/app/team_test.go +++ b/server/channels/app/team_test.go @@ -18,15 +18,15 @@ import ( "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/app/email" - emailmocks "github.com/mattermost/mattermost-server/v6/server/channels/app/email/mocks" - "github.com/mattermost/mattermost-server/v6/server/channels/app/teams" - "github.com/mattermost/mattermost-server/v6/server/channels/app/users" - "github.com/mattermost/mattermost-server/v6/server/channels/store" - "github.com/mattermost/mattermost-server/v6/server/channels/store/sqlstore" - "github.com/mattermost/mattermost-server/v6/server/channels/store/storetest/mocks" - "github.com/mattermost/mattermost-server/v6/server/channels/testlib" + "github.com/mattermost/mattermost-server/server/v8/channels/app/email" + emailmocks "github.com/mattermost/mattermost-server/server/v8/channels/app/email/mocks" + "github.com/mattermost/mattermost-server/server/v8/channels/app/teams" + "github.com/mattermost/mattermost-server/server/v8/channels/app/users" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/store/sqlstore" + "github.com/mattermost/mattermost-server/server/v8/channels/store/storetest/mocks" + "github.com/mattermost/mattermost-server/server/v8/channels/testlib" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestCreateTeam(t *testing.T) { @@ -1025,6 +1025,119 @@ func TestJoinUserToTeam(t *testing.T) { }) } +func TestJoinUserToTeamWithAppsCategoryEnabled(t *testing.T) { + th := Setup(t) + defer th.TearDown() + + th.App.UpdateConfig(func(cfg *model.Config) { cfg.FeatureFlags.AppsSidebarCategory = true }) + + id := model.NewId() + team := &model.Team{ + DisplayName: "dn_" + id, + Name: "name" + id, + Email: "success+" + id + "@simulator.amazonses.com", + Type: model.TeamOpen, + } + + _, err := th.App.CreateTeam(th.Context, team) + require.Nil(t, err, "Should create a new team") + + maxUsersPerTeam := th.App.Config().TeamSettings.MaxUsersPerTeam + defer func() { + th.App.UpdateConfig(func(cfg *model.Config) { cfg.TeamSettings.MaxUsersPerTeam = maxUsersPerTeam }) + th.App.PermanentDeleteTeam(th.Context, team) + }() + one := 1 + th.App.UpdateConfig(func(cfg *model.Config) { cfg.TeamSettings.MaxUsersPerTeam = &one }) + + t.Run("new join", func(t *testing.T) { + user := model.User{Email: strings.ToLower(model.NewId()) + "success+test@example.com", Nickname: "Darth Vader", Username: "vader" + model.NewId(), Password: "passwd1", AuthService: ""} + ruser, _ := th.App.CreateUser(th.Context, &user) + defer th.App.PermanentDeleteUser(th.Context, &user) + + _, appErr := th.App.JoinUserToTeam(th.Context, team, ruser, "") + require.Nil(t, appErr, "Should return no error") + }) + + t.Run("new join with limit problem", func(t *testing.T) { + user1 := model.User{Email: strings.ToLower(model.NewId()) + "success+test@example.com", Nickname: "Darth Vader", Username: "vader" + model.NewId(), Password: "passwd1", AuthService: ""} + ruser1, _ := th.App.CreateUser(th.Context, &user1) + user2 := model.User{Email: strings.ToLower(model.NewId()) + "success+test@example.com", Nickname: "Darth Vader", Username: "vader" + model.NewId(), Password: "passwd1", AuthService: ""} + ruser2, _ := th.App.CreateUser(th.Context, &user2) + + defer th.App.PermanentDeleteUser(th.Context, &user1) + defer th.App.PermanentDeleteUser(th.Context, &user2) + + _, appErr := th.App.JoinUserToTeam(th.Context, team, ruser1, ruser2.Id) + require.Nil(t, appErr, "Should return no error") + + _, appErr = th.App.JoinUserToTeam(th.Context, team, ruser2, ruser1.Id) + require.NotNil(t, appErr, "Should fail") + }) + + t.Run("re-join after leaving with limit problem", func(t *testing.T) { + user1 := model.User{Email: strings.ToLower(model.NewId()) + "success+test@example.com", Nickname: "Darth Vader", Username: "vader" + model.NewId(), Password: "passwd1", AuthService: ""} + ruser1, _ := th.App.CreateUser(th.Context, &user1) + + user2 := model.User{Email: strings.ToLower(model.NewId()) + "success+test@example.com", Nickname: "Darth Vader", Username: "vader" + model.NewId(), Password: "passwd1", AuthService: ""} + ruser2, _ := th.App.CreateUser(th.Context, &user2) + + defer th.App.PermanentDeleteUser(th.Context, &user1) + defer th.App.PermanentDeleteUser(th.Context, &user2) + + _, appErr := th.App.JoinUserToTeam(th.Context, team, ruser1, ruser2.Id) + require.Nil(t, appErr, "Should return no error") + appErr = th.App.LeaveTeam(th.Context, team, ruser1, ruser1.Id) + require.Nil(t, appErr, "Should return no error") + _, appErr = th.App.JoinUserToTeam(th.Context, team, ruser2, ruser2.Id) + require.Nil(t, appErr, "Should return no error") + + _, appErr = th.App.JoinUserToTeam(th.Context, team, ruser1, ruser2.Id) + require.NotNil(t, appErr, "Should fail") + }) + + t.Run("new join with correct scheme_admin value from group syncable", func(t *testing.T) { + user1 := model.User{Email: strings.ToLower(model.NewId()) + "success+test@example.com", Nickname: "Darth Vader", Username: "vader" + model.NewId(), Password: "passwd1", AuthService: ""} + ruser1, _ := th.App.CreateUser(th.Context, &user1) + defer th.App.PermanentDeleteUser(th.Context, &user1) + + group := th.CreateGroup() + + _, err = th.App.UpsertGroupMember(group.Id, user1.Id) + require.Nil(t, err) + + gs, err := th.App.UpsertGroupSyncable(&model.GroupSyncable{ + AutoAdd: true, + SyncableId: team.Id, + Type: model.GroupSyncableTypeTeam, + GroupId: group.Id, + SchemeAdmin: false, + }) + require.Nil(t, err) + + th.App.UpdateConfig(func(cfg *model.Config) { cfg.TeamSettings.MaxUsersPerTeam = model.NewInt(999) }) + + tm1, appErr := th.App.JoinUserToTeam(th.Context, team, ruser1, "") + require.Nil(t, appErr) + require.False(t, tm1.SchemeAdmin) + + user2 := model.User{Email: strings.ToLower(model.NewId()) + "success+test@example.com", Nickname: "Darth Vader", Username: "vader" + model.NewId(), Password: "passwd1", AuthService: ""} + ruser2, _ := th.App.CreateUser(th.Context, &user2) + defer th.App.PermanentDeleteUser(th.Context, &user2) + + _, err = th.App.UpsertGroupMember(group.Id, user2.Id) + require.Nil(t, err) + + gs.SchemeAdmin = true + _, err = th.App.UpdateGroupSyncable(gs) + require.Nil(t, err) + + tm2, appErr := th.App.JoinUserToTeam(th.Context, team, ruser2, "") + require.Nil(t, appErr) + require.True(t, tm2.SchemeAdmin) + }) +} + func TestLeaveTeamPanic(t *testing.T) { th := SetupWithStoreMock(t) defer th.TearDown() diff --git a/server/channels/app/teams/helper_test.go b/server/channels/app/teams/helper_test.go index 67f78fd45b..b7265d9d61 100644 --- a/server/channels/app/teams/helper_test.go +++ b/server/channels/app/teams/helper_test.go @@ -9,10 +9,10 @@ import ( "path/filepath" "testing" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/app/request" - "github.com/mattermost/mattermost-server/v6/server/channels/store" - "github.com/mattermost/mattermost-server/v6/server/config" + "github.com/mattermost/mattermost-server/server/v8/channels/app/request" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/config" + "github.com/mattermost/mattermost-server/server/v8/model" ) type TestHelper struct { diff --git a/server/channels/app/teams/main_test.go b/server/channels/app/teams/main_test.go index b17fb1528e..621c97f30d 100644 --- a/server/channels/app/teams/main_test.go +++ b/server/channels/app/teams/main_test.go @@ -7,7 +7,7 @@ import ( "flag" "testing" - "github.com/mattermost/mattermost-server/v6/server/channels/testlib" + "github.com/mattermost/mattermost-server/server/v8/channels/testlib" ) var mainHelper *testlib.MainHelper diff --git a/server/channels/app/teams/service.go b/server/channels/app/teams/service.go index 76c773c06d..54336fa6b1 100644 --- a/server/channels/app/teams/service.go +++ b/server/channels/app/teams/service.go @@ -6,8 +6,8 @@ package teams import ( "errors" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" ) type TeamService struct { diff --git a/server/channels/app/teams/teams.go b/server/channels/app/teams/teams.go index 71480a33e5..e5b12a3d57 100644 --- a/server/channels/app/teams/teams.go +++ b/server/channels/app/teams/teams.go @@ -6,8 +6,8 @@ package teams import ( "context" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/i18n" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/i18n" ) func (ts *TeamService) CreateTeam(team *model.Team) (*model.Team, error) { diff --git a/server/channels/app/teams/teams_test.go b/server/channels/app/teams/teams_test.go index a573b729c7..04a01cf897 100644 --- a/server/channels/app/teams/teams_test.go +++ b/server/channels/app/teams/teams_test.go @@ -9,7 +9,7 @@ import ( "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestCreateTeam(t *testing.T) { diff --git a/server/channels/app/teams/utils.go b/server/channels/app/teams/utils.go index 14bef9b549..a2e12a589f 100644 --- a/server/channels/app/teams/utils.go +++ b/server/channels/app/teams/utils.go @@ -6,7 +6,7 @@ package teams import ( "strings" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) // By default the list will be (not necessarily in this order): diff --git a/server/channels/app/telemetry.go b/server/channels/app/telemetry.go index 423bbffc5b..2258d837fb 100644 --- a/server/channels/app/telemetry.go +++ b/server/channels/app/telemetry.go @@ -3,7 +3,7 @@ package app -import "github.com/mattermost/mattermost-server/v6/server/platform/services/telemetry" +import "github.com/mattermost/mattermost-server/server/v8/platform/services/telemetry" func (s *Server) GetTelemetryService() *telemetry.TelemetryService { return s.telemetryService diff --git a/server/channels/app/terms_of_service.go b/server/channels/app/terms_of_service.go index a8f33d79d5..fca66abaa1 100644 --- a/server/channels/app/terms_of_service.go +++ b/server/channels/app/terms_of_service.go @@ -7,8 +7,8 @@ import ( "errors" "net/http" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" ) func (a *App) CreateTermsOfService(text, userID string) (*model.TermsOfService, *model.AppError) { diff --git a/server/channels/app/true_up.go b/server/channels/app/true_up.go index 02aefbdde9..ab90154fd7 100644 --- a/server/channels/app/true_up.go +++ b/server/channels/app/true_up.go @@ -11,10 +11,10 @@ import ( "strings" "time" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store" - "github.com/mattermost/mattermost-server/v6/server/channels/utils" - "github.com/mattermost/mattermost-server/v6/server/platform/services/telemetry" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/utils" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/services/telemetry" ) func pluginActivated(pluginStates map[string]*model.PluginState, pluginId string) bool { diff --git a/server/channels/app/upload.go b/server/channels/app/upload.go index c534c53a7e..c8944eb27a 100644 --- a/server/channels/app/upload.go +++ b/server/channels/app/upload.go @@ -13,11 +13,11 @@ import ( "sync" "time" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/plugin" - "github.com/mattermost/mattermost-server/v6/server/channels/app/request" - "github.com/mattermost/mattermost-server/v6/server/channels/store" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/app/request" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/plugin" ) const minFirstPartSize = 5 * 1024 * 1024 // 5MB diff --git a/server/channels/app/upload_test.go b/server/channels/app/upload_test.go index 51a21ab7b7..7946d29b20 100644 --- a/server/channels/app/upload_test.go +++ b/server/channels/app/upload_test.go @@ -15,9 +15,9 @@ import ( "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/utils/fileutils" - "github.com/mattermost/mattermost-server/v6/server/channels/utils/imgutils" + "github.com/mattermost/mattermost-server/server/v8/channels/utils/fileutils" + "github.com/mattermost/mattermost-server/server/v8/channels/utils/imgutils" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestCreateUploadSession(t *testing.T) { diff --git a/server/channels/app/usage.go b/server/channels/app/usage.go index f3b132e757..31ba2257c9 100644 --- a/server/channels/app/usage.go +++ b/server/channels/app/usage.go @@ -6,8 +6,8 @@ package app import ( "net/http" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/utils" + "github.com/mattermost/mattermost-server/server/v8/channels/utils" + "github.com/mattermost/mattermost-server/server/v8/model" ) // GetPostsUsage returns the total posts count rounded down to the most diff --git a/server/channels/app/usage_test.go b/server/channels/app/usage_test.go index 11e6b60809..9a561d9711 100644 --- a/server/channels/app/usage_test.go +++ b/server/channels/app/usage_test.go @@ -10,7 +10,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" - "github.com/mattermost/mattermost-server/v6/server/channels/store/storetest/mocks" + "github.com/mattermost/mattermost-server/server/v8/channels/store/storetest/mocks" ) func TestGetPostsUsage(t *testing.T) { diff --git a/server/channels/app/user.go b/server/channels/app/user.go index f0b6b7c826..8787402a50 100644 --- a/server/channels/app/user.go +++ b/server/channels/app/user.go @@ -19,17 +19,17 @@ import ( "golang.org/x/sync/errgroup" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/plugin" - "github.com/mattermost/mattermost-server/v6/server/channels/app/email" - "github.com/mattermost/mattermost-server/v6/server/channels/app/imaging" - "github.com/mattermost/mattermost-server/v6/server/channels/app/request" - "github.com/mattermost/mattermost-server/v6/server/channels/app/users" - "github.com/mattermost/mattermost-server/v6/server/channels/einterfaces" - "github.com/mattermost/mattermost-server/v6/server/channels/store" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/i18n" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mfa" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/app/email" + "github.com/mattermost/mattermost-server/server/v8/channels/app/imaging" + "github.com/mattermost/mattermost-server/server/v8/channels/app/request" + "github.com/mattermost/mattermost-server/server/v8/channels/app/users" + "github.com/mattermost/mattermost-server/server/v8/channels/einterfaces" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/i18n" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mfa" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/plugin" ) const ( @@ -792,7 +792,7 @@ func (a *App) GetDefaultProfileImage(user *model.User) ([]byte, *model.AppError) return a.ch.srv.GetDefaultProfileImage(user) } -func (a *App) SetDefaultProfileImage(c request.CTX, user *model.User) *model.AppError { +func (a *App) UpdateDefaultProfileImage(c request.CTX, user *model.User) *model.AppError { img, appErr := a.GetDefaultProfileImage(user) if appErr != nil { return appErr @@ -809,6 +809,16 @@ func (a *App) SetDefaultProfileImage(c request.CTX, user *model.User) *model.App a.InvalidateCacheForUser(user.Id) + return nil +} + +func (a *App) SetDefaultProfileImage(c request.CTX, user *model.User) *model.AppError { + + if err := a.UpdateDefaultProfileImage(c, user); err != nil { + c.Logger().Error("Failed to update default profile image for user", mlog.String("user_id", user.Id), mlog.Err(err)) + return err + } + updatedUser, appErr := a.GetUser(user.Id) if appErr != nil { c.Logger().Warn("Error in getting users profile forcing logout", mlog.String("user_id", user.Id), mlog.Err(appErr)) @@ -1228,37 +1238,53 @@ func (a *App) UpdateUser(c request.CTX, user *model.User, sendNotifications bool } } + newUser := userUpdate.New + + if (newUser.Username != userUpdate.Old.Username) && (newUser.LastPictureUpdate <= 0) { + // When a username is updated and the profile is still using a default profile picture, generate a new one based on their username + if err := a.UpdateDefaultProfileImage(c, newUser); err != nil { + c.Logger().Warn("Error with updating default profile image", mlog.Err(err)) + } + + tempUser, getUserErr := a.GetUser(user.Id) + if getUserErr != nil { + c.Logger().Warn("Error when retrieving user after profile picture update, avatar may fail to update automatically on client applications.", mlog.Err(getUserErr)) + } else { + newUser = tempUser + } + } + if sendNotifications { - if userUpdate.New.Email != userUpdate.Old.Email || newEmail != "" { + if newUser.Email != userUpdate.Old.Email || newEmail != "" { if *a.Config().EmailSettings.RequireEmailVerification { a.Srv().Go(func() { - if err := a.SendEmailVerification(userUpdate.New, newEmail, ""); err != nil { + if err := a.SendEmailVerification(newUser, newEmail, ""); err != nil { c.Logger().Error("Failed to send email verification", mlog.Err(err)) } }) } else { a.Srv().Go(func() { - if err := a.Srv().EmailService.SendEmailChangeEmail(userUpdate.Old.Email, userUpdate.New.Email, userUpdate.New.Locale, a.GetSiteURL()); err != nil { + if err := a.Srv().EmailService.SendEmailChangeEmail(userUpdate.Old.Email, newUser.Email, newUser.Locale, a.GetSiteURL()); err != nil { c.Logger().Error("Failed to send email change email", mlog.Err(err)) } }) } } - if userUpdate.New.Username != userUpdate.Old.Username { + if newUser.Username != userUpdate.Old.Username { a.Srv().Go(func() { - if err := a.Srv().EmailService.SendChangeUsernameEmail(userUpdate.New.Username, userUpdate.New.Email, userUpdate.New.Locale, a.GetSiteURL()); err != nil { + if err := a.Srv().EmailService.SendChangeUsernameEmail(newUser.Username, newUser.Email, newUser.Locale, a.GetSiteURL()); err != nil { c.Logger().Error("Failed to send change username email", mlog.Err(err)) } }) } - a.sendUpdatedUserEvent(*userUpdate.New) + a.sendUpdatedUserEvent(*newUser) } a.InvalidateCacheForUser(user.Id) a.onUserProfileChange(user.Id) - return userUpdate.New, nil + return newUser, nil } func (a *App) UpdateUserActive(c request.CTX, userID string, active bool) *model.AppError { diff --git a/server/channels/app/user_terms_of_service.go b/server/channels/app/user_terms_of_service.go index a9c5152a23..73360d739d 100644 --- a/server/channels/app/user_terms_of_service.go +++ b/server/channels/app/user_terms_of_service.go @@ -7,8 +7,8 @@ import ( "errors" "net/http" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" ) func (a *App) GetUserTermsOfService(userID string) (*model.UserTermsOfService, *model.AppError) { diff --git a/server/channels/app/user_test.go b/server/channels/app/user_test.go index 2d52d1e19a..da1938cd7e 100644 --- a/server/channels/app/user_test.go +++ b/server/channels/app/user_test.go @@ -18,15 +18,15 @@ import ( "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - oauthgitlab "github.com/mattermost/mattermost-server/v6/model/oauthproviders/gitlab" - "github.com/mattermost/mattermost-server/v6/server/channels/app/request" - "github.com/mattermost/mattermost-server/v6/server/channels/app/users" - "github.com/mattermost/mattermost-server/v6/server/channels/einterfaces" - "github.com/mattermost/mattermost-server/v6/server/channels/einterfaces/mocks" - "github.com/mattermost/mattermost-server/v6/server/channels/store" - storemocks "github.com/mattermost/mattermost-server/v6/server/channels/store/storetest/mocks" - "github.com/mattermost/mattermost-server/v6/server/channels/utils/testutils" + "github.com/mattermost/mattermost-server/server/v8/channels/app/request" + "github.com/mattermost/mattermost-server/server/v8/channels/app/users" + "github.com/mattermost/mattermost-server/server/v8/channels/einterfaces" + "github.com/mattermost/mattermost-server/server/v8/channels/einterfaces/mocks" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + storemocks "github.com/mattermost/mattermost-server/server/v8/channels/store/storetest/mocks" + "github.com/mattermost/mattermost-server/server/v8/channels/utils/testutils" + "github.com/mattermost/mattermost-server/server/v8/model" + oauthgitlab "github.com/mattermost/mattermost-server/server/v8/model/oauthproviders/gitlab" ) func TestCreateOAuthUser(t *testing.T) { @@ -85,9 +85,11 @@ func TestCreateOAuthUser(t *testing.T) { }) } -func TestSetDefaultProfileImage(t *testing.T) { +func TestUpdateDefaultProfileImage(t *testing.T) { th := Setup(t).InitBasic() defer th.TearDown() + startTime := model.GetMillis() + time.Sleep(time.Millisecond) err := th.App.SetDefaultProfileImage(th.Context, &model.User{ Id: model.NewId(), @@ -98,11 +100,11 @@ func TestSetDefaultProfileImage(t *testing.T) { user := th.BasicUser - err = th.App.SetDefaultProfileImage(th.Context, user) + err = th.App.UpdateDefaultProfileImage(th.Context, user) require.Nil(t, err) user = getUserFromDB(th.App, user.Id, t) - assert.Equal(t, int64(0), user.LastPictureUpdate) + assert.Less(t, user.LastPictureUpdate, -startTime, "LastPictureUpdate should be set to -(current time in milliseconds)") } func TestAdjustProfileImage(t *testing.T) { @@ -194,6 +196,33 @@ func TestUpdateUser(t *testing.T) { require.NotNil(t, err) require.Nil(t, u) }) + + t.Run("fails if default profile picture is not updated when user has default profile picture and username is changed", func(t *testing.T) { + user.Username = "updatedUsername" + iLastPictureUpdate := user.LastPictureUpdate + require.Equal(t, iLastPictureUpdate, int64(0)) + u, err := th.App.UpdateUser(th.Context, user, false) + require.Nil(t, err) + require.NotNil(t, u) + require.Less(t, u.LastPictureUpdate, iLastPictureUpdate) + }) + + t.Run("fails if profile picture is updated when user has custom profile picture and username is changed", func(t *testing.T) { + // Give the user a LastPictureUpdate to mimic having a custom profile picture + err := th.App.Srv().Store().User().UpdateLastPictureUpdate(user.Id) + require.NoError(t, err) + iUser, errGetUser := th.App.GetUser(user.Id) + require.Nil(t, errGetUser) + iUser.Username = "updatedUsername" + iLastPictureUpdate := iUser.LastPictureUpdate + require.Greater(t, iLastPictureUpdate, int64(0)) + + // Attempt the update, ensure the LastPictureUpdate has not changed + updatedUser, errUpdateUser := th.App.UpdateUser(th.Context, iUser, false) + require.Nil(t, errUpdateUser) + require.NotNil(t, updatedUser) + require.Equal(t, updatedUser.LastPictureUpdate, iLastPictureUpdate) + }) } func TestUpdateUserMissingFields(t *testing.T) { @@ -255,8 +284,8 @@ func TestCreateUser(t *testing.T) { package main import ( - "github.com/mattermost/mattermost-server/v6/plugin" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/plugin" + "github.com/mattermost/mattermost-server/server/v8/model" ) type MyPlugin struct { @@ -1026,7 +1055,7 @@ func TestCreateUserWithToken(t *testing.T) { } func TestPermanentDeleteUser(t *testing.T) { - th := Setup(t).InitBasic() + th := Setup(t).InitBasic().DeleteBots() defer th.TearDown() b := []byte("testimage") diff --git a/server/channels/app/user_viewmembers_test.go b/server/channels/app/user_viewmembers_test.go index 9a14fc652c..7da06426e8 100644 --- a/server/channels/app/user_viewmembers_test.go +++ b/server/channels/app/user_viewmembers_test.go @@ -9,12 +9,12 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestRestrictedViewMembers(t *testing.T) { - th := Setup(t) + th := Setup(t).DeleteBots() defer th.TearDown() user1 := th.CreateUser() diff --git a/server/channels/app/users/helper_test.go b/server/channels/app/users/helper_test.go index de347336a6..c979ba2d08 100644 --- a/server/channels/app/users/helper_test.go +++ b/server/channels/app/users/helper_test.go @@ -10,10 +10,10 @@ import ( "sync" "testing" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/app/request" - "github.com/mattermost/mattermost-server/v6/server/channels/store" - "github.com/mattermost/mattermost-server/v6/server/config" + "github.com/mattermost/mattermost-server/server/v8/channels/app/request" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/config" + "github.com/mattermost/mattermost-server/server/v8/model" ) var initBasicOnce sync.Once diff --git a/server/channels/app/users/main_test.go b/server/channels/app/users/main_test.go index a2d3b828dc..6d731849d8 100644 --- a/server/channels/app/users/main_test.go +++ b/server/channels/app/users/main_test.go @@ -7,7 +7,7 @@ import ( "flag" "testing" - "github.com/mattermost/mattermost-server/v6/server/channels/testlib" + "github.com/mattermost/mattermost-server/server/v8/channels/testlib" ) var mainHelper *testlib.MainHelper diff --git a/server/channels/app/users/password.go b/server/channels/app/users/password.go index b8c004231f..81dfa30529 100644 --- a/server/channels/app/users/password.go +++ b/server/channels/app/users/password.go @@ -9,7 +9,7 @@ import ( "golang.org/x/crypto/bcrypt" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) func CheckUserPassword(user *model.User, password string) error { diff --git a/server/channels/app/users/password_test.go b/server/channels/app/users/password_test.go index 500abb14a1..84ef4e2971 100644 --- a/server/channels/app/users/password_test.go +++ b/server/channels/app/users/password_test.go @@ -10,7 +10,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestComparePassword(t *testing.T) { diff --git a/server/channels/app/users/profile_picture.go b/server/channels/app/users/profile_picture.go index 0d1fba9914..68eb890e0d 100644 --- a/server/channels/app/users/profile_picture.go +++ b/server/channels/app/users/profile_picture.go @@ -19,9 +19,9 @@ import ( "github.com/golang/freetype" "github.com/golang/freetype/truetype" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/utils/fileutils" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/filestore" + "github.com/mattermost/mattermost-server/server/v8/channels/utils/fileutils" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/filestore" ) const ( diff --git a/server/channels/app/users/service.go b/server/channels/app/users/service.go index cefc015f38..f1db3b2a35 100644 --- a/server/channels/app/users/service.go +++ b/server/channels/app/users/service.go @@ -6,9 +6,9 @@ package users import ( "errors" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/einterfaces" - "github.com/mattermost/mattermost-server/v6/server/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/einterfaces" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" ) type UserService struct { diff --git a/server/channels/app/users/service_test.go b/server/channels/app/users/service_test.go index 389037c63f..5d5d50e231 100644 --- a/server/channels/app/users/service_test.go +++ b/server/channels/app/users/service_test.go @@ -8,7 +8,7 @@ import ( "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestNew(t *testing.T) { diff --git a/server/channels/app/users/users.go b/server/channels/app/users/users.go index f424c88663..543be78956 100644 --- a/server/channels/app/users/users.go +++ b/server/channels/app/users/users.go @@ -8,11 +8,11 @@ import ( "encoding/base64" "fmt" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/i18n" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mfa" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/i18n" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mfa" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" "github.com/pkg/errors" ) diff --git a/server/channels/app/users/users_test.go b/server/channels/app/users/users_test.go index 8dfd14dc1c..d68b223122 100644 --- a/server/channels/app/users/users_test.go +++ b/server/channels/app/users/users_test.go @@ -6,7 +6,7 @@ package users import ( "testing" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" "github.com/stretchr/testify/require" ) diff --git a/server/channels/app/users/utils.go b/server/channels/app/users/utils.go index 52545432bc..f4cb7017ca 100644 --- a/server/channels/app/users/utils.go +++ b/server/channels/app/users/utils.go @@ -6,7 +6,7 @@ package users import ( "strings" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) // CheckUserDomain checks that a user's email domain matches a list of space-delimited domains as a string. diff --git a/server/channels/app/web_conn.go b/server/channels/app/web_conn.go index f0c4bb94c5..2ec1537586 100644 --- a/server/channels/app/web_conn.go +++ b/server/channels/app/web_conn.go @@ -4,8 +4,8 @@ package app import ( - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/app/platform" + "github.com/mattermost/mattermost-server/server/v8/channels/app/platform" + "github.com/mattermost/mattermost-server/server/v8/model" ) // PopulateWebConnConfig checks if the connection id already exists in the hub, @@ -13,8 +13,3 @@ import ( func (a *App) PopulateWebConnConfig(s *model.Session, cfg *platform.WebConnConfig, seqVal string) (*platform.WebConnConfig, error) { return a.Srv().Platform().PopulateWebConnConfig(s, cfg, seqVal) } - -// NewWebConn returns a new WebConn instance. -func (a *App) NewWebConn(cfg *platform.WebConnConfig) *platform.WebConn { - return a.Srv().Platform().NewWebConn(cfg, a, a.ch) -} diff --git a/server/channels/app/web_conn_test.go b/server/channels/app/web_conn_test.go index cd55ddf6a0..099caf6ca3 100644 --- a/server/channels/app/web_conn_test.go +++ b/server/channels/app/web_conn_test.go @@ -9,9 +9,9 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/app/platform" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/i18n" + "github.com/mattermost/mattermost-server/server/v8/channels/app/platform" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/i18n" ) func TestWebConnShouldSendEvent(t *testing.T) { diff --git a/server/channels/app/web_hub.go b/server/channels/app/web_hub.go index d65dfb4bf4..a064562039 100644 --- a/server/channels/app/web_hub.go +++ b/server/channels/app/web_hub.go @@ -4,8 +4,8 @@ package app import ( - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/app/platform" + "github.com/mattermost/mattermost-server/server/v8/channels/app/platform" + "github.com/mattermost/mattermost-server/server/v8/model" ) func (a *App) TotalWebsocketConnections() int { diff --git a/server/channels/app/webhook.go b/server/channels/app/webhook.go index dc94fd5bce..7395086130 100644 --- a/server/channels/app/webhook.go +++ b/server/channels/app/webhook.go @@ -14,11 +14,11 @@ import ( "strings" "unicode/utf8" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/app/request" - "github.com/mattermost/mattermost-server/v6/server/channels/store" - "github.com/mattermost/mattermost-server/v6/server/channels/utils" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/app/request" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/utils" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) const ( diff --git a/server/channels/app/webhook_test.go b/server/channels/app/webhook_test.go index f00c2d913f..caac38a08b 100644 --- a/server/channels/app/webhook_test.go +++ b/server/channels/app/webhook_test.go @@ -17,9 +17,9 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/testlib" - "github.com/mattermost/mattermost-server/v6/server/platform/services/httpservice" + "github.com/mattermost/mattermost-server/server/v8/channels/testlib" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/services/httpservice" ) func TestCreateIncomingWebhookForChannel(t *testing.T) { diff --git a/server/channels/app/webhub_fuzz.go b/server/channels/app/webhub_fuzz.go index eb88bb200f..829aeb2025 100644 --- a/server/channels/app/webhub_fuzz.go +++ b/server/channels/app/webhub_fuzz.go @@ -18,9 +18,9 @@ import ( "github.com/gorilla/websocket" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/testlib" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/i18n" + "github.com/mattermost/mattermost-server/server/v8/channels/testlib" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/i18n" ) // This is a file used to fuzz test the web_hub code. @@ -41,7 +41,7 @@ import ( // 1. go get -u github.com/dvyukov/go-fuzz/go-fuzz github.com/dvyukov/go-fuzz/go-fuzz-build // 2. mv app/helper_test.go app/helper.go // (Also reduce the number of push notification workers to 1 to debug stack traces easily.) -// 3. go-fuzz-build github.com/mattermost/mattermost-server/v6/server/channels/app +// 3. go-fuzz-build github.com/mattermost/mattermost-server/server/v8/channels/app // 4. Generate a corpus dir. It's just a directory with files containing random data // for go-fuzz to use as an initial seed. Use the generateInitialCorpus function for that. // 5. go-fuzz -bin=app-fuzz.zip -workdir=./workdir diff --git a/server/channels/app/websocket_router.go b/server/channels/app/websocket_router.go index ce15e90daa..e76223860f 100644 --- a/server/channels/app/websocket_router.go +++ b/server/channels/app/websocket_router.go @@ -6,9 +6,9 @@ package app // import ( // "net/http" -// "github.com/mattermost/mattermost-server/v6/model" -// "github.com/mattermost/mattermost-server/v6/server/platform/shared/i18n" -// "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" +// "github.com/mattermost/mattermost-server/server/v8/model" +// "github.com/mattermost/mattermost-server/server/v8/platform/shared/i18n" +// "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" // ) // type webSocketHandler interface { diff --git a/server/channels/app/work_template_executor.go b/server/channels/app/work_template_executor.go index a290434b37..360feb2427 100644 --- a/server/channels/app/work_template_executor.go +++ b/server/channels/app/work_template_executor.go @@ -10,16 +10,16 @@ import ( "regexp" "strings" - pbclient "github.com/mattermost/mattermost-server/v6/server/playbooks/client" + pbclient "github.com/mattermost/mattermost-server/server/v8/playbooks/client" - fb_model "github.com/mattermost/mattermost-server/v6/server/boards/model" + fb_model "github.com/mattermost/mattermost-server/server/v8/boards/model" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/app/request" - "github.com/mattermost/mattermost-server/v6/server/channels/app/worktemplates" - "github.com/mattermost/mattermost-server/v6/server/channels/product" - "github.com/mattermost/mattermost-server/v6/server/channels/store" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/app/request" + "github.com/mattermost/mattermost-server/server/v8/channels/app/worktemplates" + "github.com/mattermost/mattermost-server/server/v8/channels/product" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) type WorkTemplateExecutor interface { diff --git a/server/channels/app/work_templates.go b/server/channels/app/work_templates.go index 43bff0dfee..c2754da849 100644 --- a/server/channels/app/work_templates.go +++ b/server/channels/app/work_templates.go @@ -6,10 +6,10 @@ package app import ( "net/http" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/app/request" - "github.com/mattermost/mattermost-server/v6/server/channels/app/worktemplates" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/i18n" + "github.com/mattermost/mattermost-server/server/v8/channels/app/request" + "github.com/mattermost/mattermost-server/server/v8/channels/app/worktemplates" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/i18n" ) func (a *App) GetWorkTemplateCategories(t i18n.TranslateFunc) ([]*model.WorkTemplateCategory, *model.AppError) { diff --git a/server/channels/app/work_templates_test.go b/server/channels/app/work_templates_test.go index 6d90b33665..1ca5332f3a 100644 --- a/server/channels/app/work_templates_test.go +++ b/server/channels/app/work_templates_test.go @@ -12,12 +12,12 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/app/mocks" - "github.com/mattermost/mattermost-server/v6/server/channels/app/request" - "github.com/mattermost/mattermost-server/v6/server/channels/app/worktemplates" + "github.com/mattermost/mattermost-server/server/v8/channels/app/mocks" + "github.com/mattermost/mattermost-server/server/v8/channels/app/request" + "github.com/mattermost/mattermost-server/server/v8/channels/app/worktemplates" + "github.com/mattermost/mattermost-server/server/v8/model" - pbclient "github.com/mattermost/mattermost-server/v6/server/playbooks/client" + pbclient "github.com/mattermost/mattermost-server/server/v8/playbooks/client" ) func TestGetWorkTemplateCategories(t *testing.T) { diff --git a/server/channels/app/worktemplates/generator/main.go b/server/channels/app/worktemplates/generator/main.go index bc072fc7a5..1282ae416a 100644 --- a/server/channels/app/worktemplates/generator/main.go +++ b/server/channels/app/worktemplates/generator/main.go @@ -19,7 +19,7 @@ import ( "golang.org/x/tools/imports" "gopkg.in/yaml.v3" - "github.com/mattermost/mattermost-server/v6/server/channels/app/worktemplates" + "github.com/mattermost/mattermost-server/server/v8/channels/app/worktemplates" ) type WorkTemplateWithMD5 struct { diff --git a/server/channels/app/worktemplates/generator/worktemplate.tmpl b/server/channels/app/worktemplates/generator/worktemplate.tmpl index 60f40b5301..52d8d0be5f 100644 --- a/server/channels/app/worktemplates/generator/worktemplate.tmpl +++ b/server/channels/app/worktemplates/generator/worktemplate.tmpl @@ -93,6 +93,7 @@ var wt{{.MD5}} = &WorkTemplate{ Illustration: "{{.Playbook.Illustration}}", },{{end}}{{if .Integration}}Integration: &Integration{ ID: "{{.Integration.ID}}", + Recommended: {{.Integration.Recommended}}, },{{end}} }, {{end}} diff --git a/server/channels/app/worktemplates/model.go b/server/channels/app/worktemplates/model.go index 88223820d3..418df3b690 100644 --- a/server/channels/app/worktemplates/model.go +++ b/server/channels/app/worktemplates/model.go @@ -6,9 +6,9 @@ import ( "errors" "net/http" - pbclient "github.com/mattermost/mattermost-server/v6/server/playbooks/client" + pbclient "github.com/mattermost/mattermost-server/server/v8/playbooks/client" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) type ExecutionRequest struct { diff --git a/server/channels/app/worktemplates/model_test.go b/server/channels/app/worktemplates/model_test.go index 53e737a55c..fb131ffab6 100644 --- a/server/channels/app/worktemplates/model_test.go +++ b/server/channels/app/worktemplates/model_test.go @@ -8,9 +8,9 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" - pbclient "github.com/mattermost/mattermost-server/v6/server/playbooks/client" + pbclient "github.com/mattermost/mattermost-server/server/v8/playbooks/client" ) func TestCanBeExecuted(t *testing.T) { diff --git a/server/channels/app/worktemplates/templates.yaml b/server/channels/app/worktemplates/templates.yaml index 351e034d15..362b014a71 100644 --- a/server/channels/app/worktemplates/templates.yaml +++ b/server/channels/app/worktemplates/templates.yaml @@ -45,8 +45,10 @@ content: illustration: "/static/worktemplates/playbooks/product_release.png" - integration: id: jira + recommended: true - integration: id: github + recommended: true --- id: 'product_teams/goals_and_okrs:v1' category: product_teams @@ -86,7 +88,7 @@ content: channel: channel-1674845108569 - integration: id: zoom - + recommended: true --- id: 'product_teams/bug_bash:v1' category: product_teams @@ -120,6 +122,7 @@ content: playbook: playbook-1674844017943 - integration: id: jira + recommended: true --- id: 'product_teams/sprint_planning:v1' category: product_teams @@ -153,6 +156,7 @@ content: channel: channel-1674850783500 - integration: id: zoom + recommended: true --- id: 'product_teams/product_roadmap:v1' category: product_teams @@ -282,6 +286,7 @@ content: channel: channel-1674845108569 - integration: id: zoom + recommended: true --- id: 'companywide/create_project:v1' category: companywide @@ -316,10 +321,13 @@ content: channel: channel-1674851940114 - integration: id: jira + recommended: true - integration: id: github + recommended: true - integration: id: zoom + recommended: true --- ###################### # Leadership @@ -356,4 +364,4 @@ content: channel: channel-1674845108569 - integration: id: zoom - + recommended: true diff --git a/server/channels/app/worktemplates/types.go b/server/channels/app/worktemplates/types.go index 2b4cbedbb1..83649a4571 100644 --- a/server/channels/app/worktemplates/types.go +++ b/server/channels/app/worktemplates/types.go @@ -8,8 +8,8 @@ import ( "github.com/pkg/errors" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/i18n" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/i18n" ) type WorkTemplateCategory struct { @@ -108,7 +108,8 @@ func (wt WorkTemplate) ToModelWorkTemplate(t i18n.TranslateFunc) *model.WorkTemp if content.Integration != nil { mwt.Content = append(mwt.Content, model.WorkTemplateContent{ Integration: &model.WorkTemplateIntegration{ - ID: content.Integration.ID, + ID: content.Integration.ID, + Recommended: content.Integration.Recommended, }, }) } @@ -320,7 +321,8 @@ func (p *Playbook) Validate() error { } type Integration struct { - ID string `yaml:"id"` + ID string `yaml:"id"` + Recommended bool `yaml:"recommended"` } func (i *Integration) Validate() error { diff --git a/server/channels/app/worktemplates/worktemplate_generated.go b/server/channels/app/worktemplates/worktemplate_generated.go index a201d7c5c3..f7e3a3e16f 100644 --- a/server/channels/app/worktemplates/worktemplate_generated.go +++ b/server/channels/app/worktemplates/worktemplate_generated.go @@ -148,12 +148,14 @@ var wt00a1b44a5831c0a3acb14787b3fdd352 = &WorkTemplate{ }, { Integration: &Integration{ - ID: "jira", + ID: "jira", + Recommended: true, }, }, { Integration: &Integration{ - ID: "github", + ID: "github", + Recommended: true, }, }, }, @@ -214,7 +216,8 @@ var wt5baa68055bf9ea423273662e01ccc575 = &WorkTemplate{ }, { Integration: &Integration{ - ID: "zoom", + ID: "zoom", + Recommended: true, }, }, }, @@ -265,7 +268,8 @@ var wtfeb56bc6a8f277c47b503bd1c92d830e = &WorkTemplate{ }, { Integration: &Integration{ - ID: "jira", + ID: "jira", + Recommended: true, }, }, }, @@ -317,7 +321,8 @@ var wt8d2ef53deac5517eb349dc5de6150196 = &WorkTemplate{ }, { Integration: &Integration{ - ID: "zoom", + ID: "zoom", + Recommended: true, }, }, }, @@ -518,7 +523,8 @@ var wtf7b846d35810f8272eeb9a1a562025b5 = &WorkTemplate{ }, { Integration: &Integration{ - ID: "zoom", + ID: "zoom", + Recommended: true, }, }, }, @@ -570,17 +576,20 @@ var wtb9ab412890c2410c7b49eec8f12e7edc = &WorkTemplate{ }, { Integration: &Integration{ - ID: "jira", + ID: "jira", + Recommended: true, }, }, { Integration: &Integration{ - ID: "github", + ID: "github", + Recommended: true, }, }, { Integration: &Integration{ - ID: "zoom", + ID: "zoom", + Recommended: true, }, }, }, @@ -632,7 +641,8 @@ var wt32ab773bfe021e3d4913931041552559 = &WorkTemplate{ }, { Integration: &Integration{ - ID: "zoom", + ID: "zoom", + Recommended: true, }, }, }, diff --git a/server/channels/audit/audit.go b/server/channels/audit/audit.go index 098032c5f7..9259051919 100644 --- a/server/channels/audit/audit.go +++ b/server/channels/audit/audit.go @@ -6,7 +6,7 @@ package audit import ( "fmt" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) type Audit struct { diff --git a/server/channels/audit/audit_test.go b/server/channels/audit/audit_test.go index b12a523971..ed526b3457 100644 --- a/server/channels/audit/audit_test.go +++ b/server/channels/audit/audit_test.go @@ -14,8 +14,8 @@ import ( "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) func TestAudit_LogRecord(t *testing.T) { diff --git a/server/channels/db/migrations/migrations.list b/server/channels/db/migrations/migrations.list index 6a7d33d5c6..eef5b1fe2a 100644 --- a/server/channels/db/migrations/migrations.list +++ b/server/channels/db/migrations/migrations.list @@ -212,6 +212,10 @@ channels/db/migrations/mysql/000105_remove_tokens.down.sql channels/db/migrations/mysql/000105_remove_tokens.up.sql channels/db/migrations/mysql/000106_fileinfo_channelid.down.sql channels/db/migrations/mysql/000106_fileinfo_channelid.up.sql +channels/db/migrations/mysql/000107_threadmemberships_cleanup.down.sql +channels/db/migrations/mysql/000107_threadmemberships_cleanup.up.sql +channels/db/migrations/mysql/000108_remove_orphaned_oauth_preferences.down.sql +channels/db/migrations/mysql/000108_remove_orphaned_oauth_preferences.up.sql channels/db/migrations/postgres/000001_create_teams.down.sql channels/db/migrations/postgres/000001_create_teams.up.sql channels/db/migrations/postgres/000002_create_team_members.down.sql @@ -424,3 +428,7 @@ channels/db/migrations/postgres/000105_remove_tokens.down.sql channels/db/migrations/postgres/000105_remove_tokens.up.sql channels/db/migrations/postgres/000106_fileinfo_channelid.down.sql channels/db/migrations/postgres/000106_fileinfo_channelid.up.sql +channels/db/migrations/postgres/000107_threadmemberships_cleanup.down.sql +channels/db/migrations/postgres/000107_threadmemberships_cleanup.up.sql +channels/db/migrations/postgres/000108_remove_orphaned_oauth_preferences.down.sql +channels/db/migrations/postgres/000108_remove_orphaned_oauth_preferences.up.sql diff --git a/server/channels/db/migrations/mysql/000107_threadmemberships_cleanup.down.sql b/server/channels/db/migrations/mysql/000107_threadmemberships_cleanup.down.sql new file mode 100644 index 0000000000..4743bd6462 --- /dev/null +++ b/server/channels/db/migrations/mysql/000107_threadmemberships_cleanup.down.sql @@ -0,0 +1 @@ +-- Skipping it because the forward migrations are destructive diff --git a/server/channels/db/migrations/mysql/000107_threadmemberships_cleanup.up.sql b/server/channels/db/migrations/mysql/000107_threadmemberships_cleanup.up.sql new file mode 100644 index 0000000000..90644be3f3 --- /dev/null +++ b/server/channels/db/migrations/mysql/000107_threadmemberships_cleanup.up.sql @@ -0,0 +1,5 @@ +DELETE FROM + tm USING ThreadMemberships AS tm + JOIN Threads ON Threads.PostId = tm.PostId +WHERE + (tm.UserId, Threads.ChannelId) NOT IN (SELECT UserId, ChannelId FROM ChannelMembers); diff --git a/server/channels/db/migrations/mysql/000108_remove_orphaned_oauth_preferences.down.sql b/server/channels/db/migrations/mysql/000108_remove_orphaned_oauth_preferences.down.sql new file mode 100644 index 0000000000..9a11a0a1e8 --- /dev/null +++ b/server/channels/db/migrations/mysql/000108_remove_orphaned_oauth_preferences.down.sql @@ -0,0 +1 @@ +-- Migration only applied to postgres diff --git a/server/channels/db/migrations/mysql/000108_remove_orphaned_oauth_preferences.up.sql b/server/channels/db/migrations/mysql/000108_remove_orphaned_oauth_preferences.up.sql new file mode 100644 index 0000000000..9a11a0a1e8 --- /dev/null +++ b/server/channels/db/migrations/mysql/000108_remove_orphaned_oauth_preferences.up.sql @@ -0,0 +1 @@ +-- Migration only applied to postgres diff --git a/server/channels/db/migrations/postgres/000105_remove_tokens.up.sql b/server/channels/db/migrations/postgres/000105_remove_tokens.up.sql index ac9dc4dc7d..0a9760ea05 100644 --- a/server/channels/db/migrations/postgres/000105_remove_tokens.up.sql +++ b/server/channels/db/migrations/postgres/000105_remove_tokens.up.sql @@ -4,8 +4,7 @@ WITH oauthDelete AS ( DELETE FROM oauthaccessdata o WHERE NOT EXISTS ( SELECT p.* FROM preferences p - WHERE o.clientid = p.name AND o.userid = p.userid AND p.category = 'oauth_app' - and p.name IS NULL + WHERE o.clientid = p.name AND o.userid = p.userid AND p.category = 'oauth_app' ) RETURNING o.token ) diff --git a/server/channels/db/migrations/postgres/000107_threadmemberships_cleanup.down.sql b/server/channels/db/migrations/postgres/000107_threadmemberships_cleanup.down.sql new file mode 100644 index 0000000000..4743bd6462 --- /dev/null +++ b/server/channels/db/migrations/postgres/000107_threadmemberships_cleanup.down.sql @@ -0,0 +1 @@ +-- Skipping it because the forward migrations are destructive diff --git a/server/channels/db/migrations/postgres/000107_threadmemberships_cleanup.up.sql b/server/channels/db/migrations/postgres/000107_threadmemberships_cleanup.up.sql new file mode 100644 index 0000000000..0ec82905bc --- /dev/null +++ b/server/channels/db/migrations/postgres/000107_threadmemberships_cleanup.up.sql @@ -0,0 +1,12 @@ +DELETE FROM threadmemberships WHERE (postid, userid) IN ( + SELECT + threadmemberships.postid, + threadmemberships.userid + FROM + threadmemberships + JOIN threads ON threads.postid = threadmemberships.postid + LEFT JOIN channelmembers ON channelmembers.userid = threadmemberships.userid + AND threads.channelid = channelmembers.channelid + WHERE + channelmembers.channelid IS NULL +); diff --git a/server/channels/db/migrations/postgres/000108_remove_orphaned_oauth_preferences.down.sql b/server/channels/db/migrations/postgres/000108_remove_orphaned_oauth_preferences.down.sql new file mode 100644 index 0000000000..4743bd6462 --- /dev/null +++ b/server/channels/db/migrations/postgres/000108_remove_orphaned_oauth_preferences.down.sql @@ -0,0 +1 @@ +-- Skipping it because the forward migrations are destructive diff --git a/server/channels/db/migrations/postgres/000108_remove_orphaned_oauth_preferences.up.sql b/server/channels/db/migrations/postgres/000108_remove_orphaned_oauth_preferences.up.sql new file mode 100644 index 0000000000..0e0c9a496c --- /dev/null +++ b/server/channels/db/migrations/postgres/000108_remove_orphaned_oauth_preferences.up.sql @@ -0,0 +1,33 @@ +DO $$ +DECLARE + preferences_exist boolean := false; +BEGIN + SELECT count(p.*) != 0 INTO preferences_exist FROM preferences p + WHERE ( + (NOT EXISTS ( + SELECT o.* FROM oauthaccessdata o + WHERE o.clientid = p.name AND o.userid = p.userid AND p.category = 'oauth_app' + )) + AND + (NOT EXISTS ( + SELECT oa.* FROM oauthauthdata oa + WHERE oa.clientid = p.name AND oa.userid = p.userid AND p.category = 'oauth_app' + )) + ) + AND p.category = 'oauth_app'; +IF preferences_exist THEN + DELETE FROM preferences p + WHERE ( + (NOT EXISTS ( + SELECT o.* FROM oauthaccessdata o + WHERE o.clientid = p.name AND o.userid = p.userid AND p.category = 'oauth_app' + )) + AND + (NOT EXISTS ( + SELECT oa.* FROM oauthauthdata oa + WHERE oa.clientid = p.name AND oa.userid = p.userid AND p.category = 'oauth_app' + )) + ) + AND p.category = 'oauth_app'; +END IF; +END $$; diff --git a/server/channels/einterfaces/account_migration.go b/server/channels/einterfaces/account_migration.go index 901bb73cd5..54c87458cf 100644 --- a/server/channels/einterfaces/account_migration.go +++ b/server/channels/einterfaces/account_migration.go @@ -4,7 +4,7 @@ package einterfaces import ( - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) type AccountMigrationInterface interface { diff --git a/server/channels/einterfaces/cloud.go b/server/channels/einterfaces/cloud.go index 70cdc4676a..1c0878f6ef 100644 --- a/server/channels/einterfaces/cloud.go +++ b/server/channels/einterfaces/cloud.go @@ -4,7 +4,7 @@ package einterfaces import ( - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) type CloudInterface interface { @@ -37,6 +37,7 @@ type CloudInterface interface { BootstrapSelfHostedSignup(req model.BootstrapSelfHostedSignupRequest) (*model.BootstrapSelfHostedSignupResponse, error) CreateCustomerSelfHostedSignup(req model.SelfHostedCustomerForm, requesterEmail string) (*model.SelfHostedSignupCustomerResponse, error) ConfirmSelfHostedSignup(req model.SelfHostedConfirmPaymentMethodRequest, requesterEmail string) (*model.SelfHostedSignupConfirmResponse, error) + ConfirmSelfHostedExpansion(req model.SelfHostedConfirmPaymentMethodRequest, requesterEmail string) (*model.SelfHostedSignupConfirmResponse, error) ConfirmSelfHostedSignupLicenseApplication() error GetSelfHostedInvoices() ([]*model.Invoice, error) GetSelfHostedInvoicePDF(invoiceID string) ([]byte, string, error) @@ -48,4 +49,7 @@ type CloudInterface interface { SelfServeDeleteWorkspace(userID string, deletionRequest *model.WorkspaceDeletionRequest) error SubscribeToNewsletter(userID string, req *model.SubscribeNewsletterRequest) error + + // Used only for when a customer has telemetry disabled. In this scenario, true up review telemetry will be submitted via CWS. + SubmitTrueUpReview(userID string, trueUpReviewProfile map[string]any) error } diff --git a/server/channels/einterfaces/cluster.go b/server/channels/einterfaces/cluster.go index 6ba89cd299..1bea4f521b 100644 --- a/server/channels/einterfaces/cluster.go +++ b/server/channels/einterfaces/cluster.go @@ -4,7 +4,7 @@ package einterfaces import ( - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) type ClusterMessageHandler func(msg *model.ClusterMessage) diff --git a/server/channels/einterfaces/compliance.go b/server/channels/einterfaces/compliance.go index ce607f79b6..5e895ab878 100644 --- a/server/channels/einterfaces/compliance.go +++ b/server/channels/einterfaces/compliance.go @@ -4,7 +4,7 @@ package einterfaces import ( - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) type ComplianceInterface interface { diff --git a/server/channels/einterfaces/data_retention.go b/server/channels/einterfaces/data_retention.go index 9f317bd598..e64083b9fc 100644 --- a/server/channels/einterfaces/data_retention.go +++ b/server/channels/einterfaces/data_retention.go @@ -4,7 +4,7 @@ package einterfaces import ( - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) type DataRetentionInterface interface { diff --git a/server/channels/einterfaces/jobs/cloud_interface.go b/server/channels/einterfaces/jobs/cloud_interface.go index 62619cbbd6..5f5e762c80 100644 --- a/server/channels/einterfaces/jobs/cloud_interface.go +++ b/server/channels/einterfaces/jobs/cloud_interface.go @@ -4,7 +4,7 @@ package jobs import ( - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) type CloudJobInterface interface { diff --git a/server/channels/einterfaces/jobs/data_retention.go b/server/channels/einterfaces/jobs/data_retention.go index c00ad5b20e..aebc121bd1 100644 --- a/server/channels/einterfaces/jobs/data_retention.go +++ b/server/channels/einterfaces/jobs/data_retention.go @@ -4,7 +4,7 @@ package jobs import ( - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) type DataRetentionJobInterface interface { diff --git a/server/channels/einterfaces/jobs/elasticsearch.go b/server/channels/einterfaces/jobs/elasticsearch.go index 2078895127..32ad94ff76 100644 --- a/server/channels/einterfaces/jobs/elasticsearch.go +++ b/server/channels/einterfaces/jobs/elasticsearch.go @@ -4,7 +4,7 @@ package jobs import ( - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) type ElasticsearchIndexerInterface interface { @@ -15,3 +15,7 @@ type ElasticsearchAggregatorInterface interface { MakeWorker() model.Worker MakeScheduler() model.Scheduler } + +type ElasticsearchFixChannelIndexInterface interface { + MakeWorker() model.Worker +} diff --git a/server/channels/einterfaces/jobs/indexer_interface.go b/server/channels/einterfaces/jobs/indexer_interface.go index 09035b84e0..5fa9f1ed06 100644 --- a/server/channels/einterfaces/jobs/indexer_interface.go +++ b/server/channels/einterfaces/jobs/indexer_interface.go @@ -4,7 +4,7 @@ package jobs import ( - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) type IndexerJobInterface interface { diff --git a/server/channels/einterfaces/jobs/ldap_sync.go b/server/channels/einterfaces/jobs/ldap_sync.go index 01f855043e..e38824680f 100644 --- a/server/channels/einterfaces/jobs/ldap_sync.go +++ b/server/channels/einterfaces/jobs/ldap_sync.go @@ -4,7 +4,7 @@ package jobs import ( - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) type LdapSyncInterface interface { diff --git a/server/channels/einterfaces/jobs/message_export.go b/server/channels/einterfaces/jobs/message_export.go index 5d699d73bb..bfd9bd5d9c 100644 --- a/server/channels/einterfaces/jobs/message_export.go +++ b/server/channels/einterfaces/jobs/message_export.go @@ -4,7 +4,7 @@ package jobs import ( - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) type MessageExportJobInterface interface { diff --git a/server/channels/einterfaces/ldap.go b/server/channels/einterfaces/ldap.go index 685ebfdf61..ba04eacccd 100644 --- a/server/channels/einterfaces/ldap.go +++ b/server/channels/einterfaces/ldap.go @@ -4,8 +4,8 @@ package einterfaces import ( - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/app/request" + "github.com/mattermost/mattermost-server/server/v8/channels/app/request" + "github.com/mattermost/mattermost-server/server/v8/model" ) type LdapInterface interface { diff --git a/server/channels/einterfaces/license.go b/server/channels/einterfaces/license.go index 3a66ebe56f..864050577f 100644 --- a/server/channels/einterfaces/license.go +++ b/server/channels/einterfaces/license.go @@ -3,7 +3,7 @@ package einterfaces -import "github.com/mattermost/mattermost-server/v6/model" +import "github.com/mattermost/mattermost-server/server/v8/model" type LicenseInterface interface { CanStartTrial() (bool, error) diff --git a/server/channels/einterfaces/message_export.go b/server/channels/einterfaces/message_export.go index 27cc753a9d..d06f3f26c2 100644 --- a/server/channels/einterfaces/message_export.go +++ b/server/channels/einterfaces/message_export.go @@ -6,7 +6,7 @@ package einterfaces import ( "context" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) type MessageExportInterface interface { diff --git a/server/channels/einterfaces/metrics.go b/server/channels/einterfaces/metrics.go index 6c260d6ab2..c44af2a3c5 100644 --- a/server/channels/einterfaces/metrics.go +++ b/server/channels/einterfaces/metrics.go @@ -6,13 +6,14 @@ package einterfaces import ( "database/sql" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) type MetricsInterface interface { Register() RegisterDBCollector(db *sql.DB, name string) + UnregisterDBCollector(db *sql.DB, name string) IncrementPostCreate() IncrementWebhookPost() diff --git a/server/channels/einterfaces/mfa.go b/server/channels/einterfaces/mfa.go index e3b89cabc0..b3315970e2 100644 --- a/server/channels/einterfaces/mfa.go +++ b/server/channels/einterfaces/mfa.go @@ -4,7 +4,7 @@ package einterfaces import ( - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) type MfaInterface interface { diff --git a/server/channels/einterfaces/mocks/AccountMigrationInterface.go b/server/channels/einterfaces/mocks/AccountMigrationInterface.go index d8d9209476..edaafe5e76 100644 --- a/server/channels/einterfaces/mocks/AccountMigrationInterface.go +++ b/server/channels/einterfaces/mocks/AccountMigrationInterface.go @@ -5,7 +5,7 @@ package mocks import ( - model "github.com/mattermost/mattermost-server/v6/model" + model "github.com/mattermost/mattermost-server/server/v8/model" mock "github.com/stretchr/testify/mock" ) diff --git a/server/channels/einterfaces/mocks/AppContextInterface.go b/server/channels/einterfaces/mocks/AppContextInterface.go index 6dd47b04d4..6780bc23c2 100644 --- a/server/channels/einterfaces/mocks/AppContextInterface.go +++ b/server/channels/einterfaces/mocks/AppContextInterface.go @@ -5,7 +5,7 @@ package mocks import ( - model "github.com/mattermost/mattermost-server/v6/model" + model "github.com/mattermost/mattermost-server/server/v8/model" mock "github.com/stretchr/testify/mock" ) diff --git a/server/channels/einterfaces/mocks/CloudInterface.go b/server/channels/einterfaces/mocks/CloudInterface.go index f84300dbec..66d8bc3c9e 100644 --- a/server/channels/einterfaces/mocks/CloudInterface.go +++ b/server/channels/einterfaces/mocks/CloudInterface.go @@ -5,7 +5,7 @@ package mocks import ( - model "github.com/mattermost/mattermost-server/v6/model" + model "github.com/mattermost/mattermost-server/server/v8/model" mock "github.com/stretchr/testify/mock" ) @@ -94,6 +94,32 @@ func (_m *CloudInterface) ConfirmCustomerPayment(userID string, confirmRequest * return r0 } +// ConfirmSelfHostedExpansion provides a mock function with given fields: req, requesterEmail +func (_m *CloudInterface) ConfirmSelfHostedExpansion(req model.SelfHostedConfirmPaymentMethodRequest, requesterEmail string) (*model.SelfHostedSignupConfirmResponse, error) { + ret := _m.Called(req, requesterEmail) + + var r0 *model.SelfHostedSignupConfirmResponse + var r1 error + if rf, ok := ret.Get(0).(func(model.SelfHostedConfirmPaymentMethodRequest, string) (*model.SelfHostedSignupConfirmResponse, error)); ok { + return rf(req, requesterEmail) + } + if rf, ok := ret.Get(0).(func(model.SelfHostedConfirmPaymentMethodRequest, string) *model.SelfHostedSignupConfirmResponse); ok { + r0 = rf(req, requesterEmail) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*model.SelfHostedSignupConfirmResponse) + } + } + + if rf, ok := ret.Get(1).(func(model.SelfHostedConfirmPaymentMethodRequest, string) error); ok { + r1 = rf(req, requesterEmail) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + // ConfirmSelfHostedSignup provides a mock function with given fields: req, requesterEmail func (_m *CloudInterface) ConfirmSelfHostedSignup(req model.SelfHostedConfirmPaymentMethodRequest, requesterEmail string) (*model.SelfHostedSignupConfirmResponse, error) { ret := _m.Called(req, requesterEmail) @@ -594,6 +620,20 @@ func (_m *CloudInterface) SelfServeDeleteWorkspace(userID string, deletionReques return r0 } +// SubmitTrueUpReview provides a mock function with given fields: userID, trueUpReviewProfile +func (_m *CloudInterface) SubmitTrueUpReview(userID string, trueUpReviewProfile map[string]interface{}) error { + ret := _m.Called(userID, trueUpReviewProfile) + + var r0 error + if rf, ok := ret.Get(0).(func(string, map[string]interface{}) error); ok { + r0 = rf(userID, trueUpReviewProfile) + } else { + r0 = ret.Error(0) + } + + return r0 +} + // SubscribeToNewsletter provides a mock function with given fields: userID, req func (_m *CloudInterface) SubscribeToNewsletter(userID string, req *model.SubscribeNewsletterRequest) error { ret := _m.Called(userID, req) diff --git a/server/channels/einterfaces/mocks/CloudJobInterface.go b/server/channels/einterfaces/mocks/CloudJobInterface.go index 5e08488c1b..ff5c7377c8 100644 --- a/server/channels/einterfaces/mocks/CloudJobInterface.go +++ b/server/channels/einterfaces/mocks/CloudJobInterface.go @@ -5,7 +5,7 @@ package mocks import ( - model "github.com/mattermost/mattermost-server/v6/model" + model "github.com/mattermost/mattermost-server/server/v8/model" mock "github.com/stretchr/testify/mock" ) diff --git a/server/channels/einterfaces/mocks/ClusterInterface.go b/server/channels/einterfaces/mocks/ClusterInterface.go index e957a860d2..4e4b0134f5 100644 --- a/server/channels/einterfaces/mocks/ClusterInterface.go +++ b/server/channels/einterfaces/mocks/ClusterInterface.go @@ -5,10 +5,10 @@ package mocks import ( - einterfaces "github.com/mattermost/mattermost-server/v6/server/channels/einterfaces" + einterfaces "github.com/mattermost/mattermost-server/server/v8/channels/einterfaces" mock "github.com/stretchr/testify/mock" - model "github.com/mattermost/mattermost-server/v6/model" + model "github.com/mattermost/mattermost-server/server/v8/model" ) // ClusterInterface is an autogenerated mock type for the ClusterInterface type diff --git a/server/channels/einterfaces/mocks/ClusterMessageHandler.go b/server/channels/einterfaces/mocks/ClusterMessageHandler.go index b29eb7ce1b..f280d52a0b 100644 --- a/server/channels/einterfaces/mocks/ClusterMessageHandler.go +++ b/server/channels/einterfaces/mocks/ClusterMessageHandler.go @@ -5,7 +5,7 @@ package mocks import ( - model "github.com/mattermost/mattermost-server/v6/model" + model "github.com/mattermost/mattermost-server/server/v8/model" mock "github.com/stretchr/testify/mock" ) diff --git a/server/channels/einterfaces/mocks/ComplianceInterface.go b/server/channels/einterfaces/mocks/ComplianceInterface.go index ae4f1f772b..2cc9c75ccd 100644 --- a/server/channels/einterfaces/mocks/ComplianceInterface.go +++ b/server/channels/einterfaces/mocks/ComplianceInterface.go @@ -5,7 +5,7 @@ package mocks import ( - model "github.com/mattermost/mattermost-server/v6/model" + model "github.com/mattermost/mattermost-server/server/v8/model" mock "github.com/stretchr/testify/mock" ) diff --git a/server/channels/einterfaces/mocks/DataRetentionInterface.go b/server/channels/einterfaces/mocks/DataRetentionInterface.go index 5d5932b9ff..ff7f344445 100644 --- a/server/channels/einterfaces/mocks/DataRetentionInterface.go +++ b/server/channels/einterfaces/mocks/DataRetentionInterface.go @@ -5,7 +5,7 @@ package mocks import ( - model "github.com/mattermost/mattermost-server/v6/model" + model "github.com/mattermost/mattermost-server/server/v8/model" mock "github.com/stretchr/testify/mock" ) diff --git a/server/channels/einterfaces/mocks/DataRetentionJobInterface.go b/server/channels/einterfaces/mocks/DataRetentionJobInterface.go index 7e6d4769c3..b18fd3e5d1 100644 --- a/server/channels/einterfaces/mocks/DataRetentionJobInterface.go +++ b/server/channels/einterfaces/mocks/DataRetentionJobInterface.go @@ -5,7 +5,7 @@ package mocks import ( - model "github.com/mattermost/mattermost-server/v6/model" + model "github.com/mattermost/mattermost-server/server/v8/model" mock "github.com/stretchr/testify/mock" ) diff --git a/server/channels/einterfaces/mocks/ElasticsearchAggregatorInterface.go b/server/channels/einterfaces/mocks/ElasticsearchAggregatorInterface.go index 3c821c7603..722d2b7ed5 100644 --- a/server/channels/einterfaces/mocks/ElasticsearchAggregatorInterface.go +++ b/server/channels/einterfaces/mocks/ElasticsearchAggregatorInterface.go @@ -5,7 +5,7 @@ package mocks import ( - model "github.com/mattermost/mattermost-server/v6/model" + model "github.com/mattermost/mattermost-server/server/v8/model" mock "github.com/stretchr/testify/mock" ) diff --git a/server/channels/einterfaces/mocks/ElasticsearchFixChannelIndexInterface.go b/server/channels/einterfaces/mocks/ElasticsearchFixChannelIndexInterface.go new file mode 100644 index 0000000000..08100b3cc4 --- /dev/null +++ b/server/channels/einterfaces/mocks/ElasticsearchFixChannelIndexInterface.go @@ -0,0 +1,46 @@ +// Code generated by mockery v2.23.2. DO NOT EDIT. + +// Regenerate this file using `make einterfaces-mocks`. + +package mocks + +import ( + model "github.com/mattermost/mattermost-server/server/v8/model" + mock "github.com/stretchr/testify/mock" +) + +// ElasticsearchFixChannelIndexInterface is an autogenerated mock type for the ElasticsearchFixChannelIndexInterface type +type ElasticsearchFixChannelIndexInterface struct { + mock.Mock +} + +// MakeWorker provides a mock function with given fields: +func (_m *ElasticsearchFixChannelIndexInterface) MakeWorker() model.Worker { + ret := _m.Called() + + var r0 model.Worker + if rf, ok := ret.Get(0).(func() model.Worker); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(model.Worker) + } + } + + return r0 +} + +type mockConstructorTestingTNewElasticsearchFixChannelIndexInterface interface { + mock.TestingT + Cleanup(func()) +} + +// NewElasticsearchFixChannelIndexInterface creates a new instance of ElasticsearchFixChannelIndexInterface. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +func NewElasticsearchFixChannelIndexInterface(t mockConstructorTestingTNewElasticsearchFixChannelIndexInterface) *ElasticsearchFixChannelIndexInterface { + mock := &ElasticsearchFixChannelIndexInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/server/channels/einterfaces/mocks/ElasticsearchIndexerInterface.go b/server/channels/einterfaces/mocks/ElasticsearchIndexerInterface.go index eea9855926..c68daf5c15 100644 --- a/server/channels/einterfaces/mocks/ElasticsearchIndexerInterface.go +++ b/server/channels/einterfaces/mocks/ElasticsearchIndexerInterface.go @@ -5,7 +5,7 @@ package mocks import ( - model "github.com/mattermost/mattermost-server/v6/model" + model "github.com/mattermost/mattermost-server/server/v8/model" mock "github.com/stretchr/testify/mock" ) diff --git a/server/channels/einterfaces/mocks/IndexerJobInterface.go b/server/channels/einterfaces/mocks/IndexerJobInterface.go index b040153342..639c245c3b 100644 --- a/server/channels/einterfaces/mocks/IndexerJobInterface.go +++ b/server/channels/einterfaces/mocks/IndexerJobInterface.go @@ -5,7 +5,7 @@ package mocks import ( - model "github.com/mattermost/mattermost-server/v6/model" + model "github.com/mattermost/mattermost-server/server/v8/model" mock "github.com/stretchr/testify/mock" ) diff --git a/server/channels/einterfaces/mocks/LdapInterface.go b/server/channels/einterfaces/mocks/LdapInterface.go index fa6173fb42..dd4d187884 100644 --- a/server/channels/einterfaces/mocks/LdapInterface.go +++ b/server/channels/einterfaces/mocks/LdapInterface.go @@ -5,8 +5,8 @@ package mocks import ( - model "github.com/mattermost/mattermost-server/v6/model" - request "github.com/mattermost/mattermost-server/v6/server/channels/app/request" + request "github.com/mattermost/mattermost-server/server/v8/channels/app/request" + model "github.com/mattermost/mattermost-server/server/v8/model" mock "github.com/stretchr/testify/mock" ) diff --git a/server/channels/einterfaces/mocks/LdapSyncInterface.go b/server/channels/einterfaces/mocks/LdapSyncInterface.go index 078cbe105f..4ded7caa1d 100644 --- a/server/channels/einterfaces/mocks/LdapSyncInterface.go +++ b/server/channels/einterfaces/mocks/LdapSyncInterface.go @@ -5,7 +5,7 @@ package mocks import ( - model "github.com/mattermost/mattermost-server/v6/model" + model "github.com/mattermost/mattermost-server/server/v8/model" mock "github.com/stretchr/testify/mock" ) diff --git a/server/channels/einterfaces/mocks/LicenseInterface.go b/server/channels/einterfaces/mocks/LicenseInterface.go index e7aa66322f..29595d46f5 100644 --- a/server/channels/einterfaces/mocks/LicenseInterface.go +++ b/server/channels/einterfaces/mocks/LicenseInterface.go @@ -5,7 +5,7 @@ package mocks import ( - model "github.com/mattermost/mattermost-server/v6/model" + model "github.com/mattermost/mattermost-server/server/v8/model" mock "github.com/stretchr/testify/mock" ) diff --git a/server/channels/einterfaces/mocks/MessageExportInterface.go b/server/channels/einterfaces/mocks/MessageExportInterface.go index 229aa48f13..770330ff89 100644 --- a/server/channels/einterfaces/mocks/MessageExportInterface.go +++ b/server/channels/einterfaces/mocks/MessageExportInterface.go @@ -9,7 +9,7 @@ import ( mock "github.com/stretchr/testify/mock" - model "github.com/mattermost/mattermost-server/v6/model" + model "github.com/mattermost/mattermost-server/server/v8/model" ) // MessageExportInterface is an autogenerated mock type for the MessageExportInterface type diff --git a/server/channels/einterfaces/mocks/MessageExportJobInterface.go b/server/channels/einterfaces/mocks/MessageExportJobInterface.go index 50b3763035..9bad367308 100644 --- a/server/channels/einterfaces/mocks/MessageExportJobInterface.go +++ b/server/channels/einterfaces/mocks/MessageExportJobInterface.go @@ -5,7 +5,7 @@ package mocks import ( - model "github.com/mattermost/mattermost-server/v6/model" + model "github.com/mattermost/mattermost-server/server/v8/model" mock "github.com/stretchr/testify/mock" ) diff --git a/server/channels/einterfaces/mocks/MetricsInterface.go b/server/channels/einterfaces/mocks/MetricsInterface.go index 6d98d3607e..06f568546a 100644 --- a/server/channels/einterfaces/mocks/MetricsInterface.go +++ b/server/channels/einterfaces/mocks/MetricsInterface.go @@ -8,7 +8,7 @@ import ( logr "github.com/mattermost/logr/v2" mock "github.com/stretchr/testify/mock" - model "github.com/mattermost/mattermost-server/v6/model" + model "github.com/mattermost/mattermost-server/server/v8/model" sql "database/sql" ) @@ -319,6 +319,11 @@ func (_m *MetricsInterface) SetReplicaLagTime(node string, value float64) { _m.Called(node, value) } +// UnregisterDBCollector provides a mock function with given fields: db, name +func (_m *MetricsInterface) UnregisterDBCollector(db *sql.DB, name string) { + _m.Called(db, name) +} + type mockConstructorTestingTNewMetricsInterface interface { mock.TestingT Cleanup(func()) diff --git a/server/channels/einterfaces/mocks/MfaInterface.go b/server/channels/einterfaces/mocks/MfaInterface.go index 3df6e4bb67..737da86700 100644 --- a/server/channels/einterfaces/mocks/MfaInterface.go +++ b/server/channels/einterfaces/mocks/MfaInterface.go @@ -5,7 +5,7 @@ package mocks import ( - model "github.com/mattermost/mattermost-server/v6/model" + model "github.com/mattermost/mattermost-server/server/v8/model" mock "github.com/stretchr/testify/mock" ) diff --git a/server/channels/einterfaces/mocks/NotificationInterface.go b/server/channels/einterfaces/mocks/NotificationInterface.go index 2c67239fca..06a155c285 100644 --- a/server/channels/einterfaces/mocks/NotificationInterface.go +++ b/server/channels/einterfaces/mocks/NotificationInterface.go @@ -5,7 +5,7 @@ package mocks import ( - model "github.com/mattermost/mattermost-server/v6/model" + model "github.com/mattermost/mattermost-server/server/v8/model" mock "github.com/stretchr/testify/mock" ) diff --git a/server/channels/einterfaces/mocks/OAuthProvider.go b/server/channels/einterfaces/mocks/OAuthProvider.go index 5568ebd5a3..3a8a563398 100644 --- a/server/channels/einterfaces/mocks/OAuthProvider.go +++ b/server/channels/einterfaces/mocks/OAuthProvider.go @@ -7,7 +7,7 @@ package mocks import ( io "io" - model "github.com/mattermost/mattermost-server/v6/model" + model "github.com/mattermost/mattermost-server/server/v8/model" mock "github.com/stretchr/testify/mock" ) diff --git a/server/channels/einterfaces/mocks/ResendInvitationEmailJobInterface.go b/server/channels/einterfaces/mocks/ResendInvitationEmailJobInterface.go index 8e69694e71..20853c78eb 100644 --- a/server/channels/einterfaces/mocks/ResendInvitationEmailJobInterface.go +++ b/server/channels/einterfaces/mocks/ResendInvitationEmailJobInterface.go @@ -5,7 +5,7 @@ package mocks import ( - model "github.com/mattermost/mattermost-server/v6/model" + model "github.com/mattermost/mattermost-server/server/v8/model" mock "github.com/stretchr/testify/mock" ) diff --git a/server/channels/einterfaces/mocks/SamlInterface.go b/server/channels/einterfaces/mocks/SamlInterface.go index f7908898c9..e7200b4ccf 100644 --- a/server/channels/einterfaces/mocks/SamlInterface.go +++ b/server/channels/einterfaces/mocks/SamlInterface.go @@ -5,8 +5,8 @@ package mocks import ( - model "github.com/mattermost/mattermost-server/v6/model" - request "github.com/mattermost/mattermost-server/v6/server/channels/app/request" + request "github.com/mattermost/mattermost-server/server/v8/channels/app/request" + model "github.com/mattermost/mattermost-server/server/v8/model" mock "github.com/stretchr/testify/mock" ) diff --git a/server/channels/einterfaces/notification.go b/server/channels/einterfaces/notification.go index 9a63d9da26..65d933d2dd 100644 --- a/server/channels/einterfaces/notification.go +++ b/server/channels/einterfaces/notification.go @@ -4,7 +4,7 @@ package einterfaces import ( - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) type NotificationInterface interface { diff --git a/server/channels/einterfaces/oauthproviders.go b/server/channels/einterfaces/oauthproviders.go index de60c9459f..a095921e5b 100644 --- a/server/channels/einterfaces/oauthproviders.go +++ b/server/channels/einterfaces/oauthproviders.go @@ -6,7 +6,7 @@ package einterfaces import ( "io" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) type OAuthProvider interface { diff --git a/server/channels/einterfaces/saml.go b/server/channels/einterfaces/saml.go index 41fb2bbd2b..81fab6b17b 100644 --- a/server/channels/einterfaces/saml.go +++ b/server/channels/einterfaces/saml.go @@ -4,8 +4,8 @@ package einterfaces import ( - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/app/request" + "github.com/mattermost/mattermost-server/server/v8/channels/app/request" + "github.com/mattermost/mattermost-server/server/v8/model" ) type SamlInterface interface { diff --git a/server/channels/imports/boards_imports.go b/server/channels/imports/boards_imports.go deleted file mode 100644 index 6e79d935ee..0000000000 --- a/server/channels/imports/boards_imports.go +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. -// See LICENSE.txt for license information. - -package imports - -import ( - // Needed to ensure the init() method in the FocalBoard product is run. - _ "github.com/mattermost/mattermost-server/v6/server/boards/product" -) diff --git a/server/channels/imports/playbooks_imports.go b/server/channels/imports/playbooks_imports.go deleted file mode 100644 index 3ffc936df8..0000000000 --- a/server/channels/imports/playbooks_imports.go +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. -// See LICENSE.txt for license information. - -package imports - -import ( - // Needed to ensure the init() method in the Playbooks product is run. - _ "github.com/mattermost/mattermost-server/v6/server/playbooks/product" -) diff --git a/server/channels/jobs/active_users/scheduler.go b/server/channels/jobs/active_users/scheduler.go index bc6c55de92..e1cd95a93c 100644 --- a/server/channels/jobs/active_users/scheduler.go +++ b/server/channels/jobs/active_users/scheduler.go @@ -6,8 +6,8 @@ package active_users import ( "time" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/jobs" + "github.com/mattermost/mattermost-server/server/v8/channels/jobs" + "github.com/mattermost/mattermost-server/server/v8/model" ) const schedFreq = 10 * time.Minute diff --git a/server/channels/jobs/active_users/worker.go b/server/channels/jobs/active_users/worker.go index 3d5fc3e65a..c078a87ad3 100644 --- a/server/channels/jobs/active_users/worker.go +++ b/server/channels/jobs/active_users/worker.go @@ -4,10 +4,10 @@ package active_users import ( - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/einterfaces" - "github.com/mattermost/mattermost-server/v6/server/channels/jobs" - "github.com/mattermost/mattermost-server/v6/server/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/einterfaces" + "github.com/mattermost/mattermost-server/server/v8/channels/jobs" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" ) const ( diff --git a/server/channels/jobs/base_schedulers.go b/server/channels/jobs/base_schedulers.go index 0de90b2d2f..5b198a59af 100644 --- a/server/channels/jobs/base_schedulers.go +++ b/server/channels/jobs/base_schedulers.go @@ -8,7 +8,7 @@ import ( "math/big" "time" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) type PeriodicScheduler struct { diff --git a/server/channels/jobs/base_workers.go b/server/channels/jobs/base_workers.go index d8344b383a..92bd3041d0 100644 --- a/server/channels/jobs/base_workers.go +++ b/server/channels/jobs/base_workers.go @@ -6,8 +6,8 @@ package jobs import ( "net/http" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) type SimpleWorker struct { diff --git a/server/channels/jobs/expirynotify/scheduler.go b/server/channels/jobs/expirynotify/scheduler.go index c22fb6a370..6cf302b239 100644 --- a/server/channels/jobs/expirynotify/scheduler.go +++ b/server/channels/jobs/expirynotify/scheduler.go @@ -6,8 +6,8 @@ package expirynotify import ( "time" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/jobs" + "github.com/mattermost/mattermost-server/server/v8/channels/jobs" + "github.com/mattermost/mattermost-server/server/v8/model" ) const schedFreq = 10 * time.Minute diff --git a/server/channels/jobs/expirynotify/worker.go b/server/channels/jobs/expirynotify/worker.go index eef266a645..67662b8de2 100644 --- a/server/channels/jobs/expirynotify/worker.go +++ b/server/channels/jobs/expirynotify/worker.go @@ -4,8 +4,8 @@ package expirynotify import ( - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/jobs" + "github.com/mattermost/mattermost-server/server/v8/channels/jobs" + "github.com/mattermost/mattermost-server/server/v8/model" ) const ( diff --git a/server/channels/jobs/export_delete/scheduler.go b/server/channels/jobs/export_delete/scheduler.go index 651232891e..6348b88a10 100644 --- a/server/channels/jobs/export_delete/scheduler.go +++ b/server/channels/jobs/export_delete/scheduler.go @@ -6,8 +6,8 @@ package export_delete import ( "time" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/jobs" + "github.com/mattermost/mattermost-server/server/v8/channels/jobs" + "github.com/mattermost/mattermost-server/server/v8/model" ) const schedFreq = 24 * time.Hour diff --git a/server/channels/jobs/export_delete/worker.go b/server/channels/jobs/export_delete/worker.go index e1c17dc913..372e6a3221 100644 --- a/server/channels/jobs/export_delete/worker.go +++ b/server/channels/jobs/export_delete/worker.go @@ -9,10 +9,10 @@ import ( "github.com/wiggin77/merror" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/jobs" - "github.com/mattermost/mattermost-server/v6/server/platform/services/configservice" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/jobs" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/services/configservice" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) const jobName = "ExportDelete" diff --git a/server/channels/jobs/export_process/worker.go b/server/channels/jobs/export_process/worker.go index dab103da6c..ef496a98c2 100644 --- a/server/channels/jobs/export_process/worker.go +++ b/server/channels/jobs/export_process/worker.go @@ -8,11 +8,11 @@ import ( "io" "path/filepath" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/app/request" - "github.com/mattermost/mattermost-server/v6/server/channels/jobs" - "github.com/mattermost/mattermost-server/v6/server/platform/services/configservice" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/app/request" + "github.com/mattermost/mattermost-server/server/v8/channels/jobs" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/services/configservice" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) const jobName = "ExportProcess" diff --git a/server/channels/jobs/extract_content/worker.go b/server/channels/jobs/extract_content/worker.go index 3e777e70ee..af2b819ccb 100644 --- a/server/channels/jobs/extract_content/worker.go +++ b/server/channels/jobs/extract_content/worker.go @@ -6,10 +6,10 @@ package extract_content import ( "strconv" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/jobs" - "github.com/mattermost/mattermost-server/v6/server/channels/store" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/jobs" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) var ignoredFiles = map[string]bool{ diff --git a/server/channels/jobs/hosted_purchase_screening/scheduler.go b/server/channels/jobs/hosted_purchase_screening/scheduler.go index b7fd279a5d..612bc89188 100644 --- a/server/channels/jobs/hosted_purchase_screening/scheduler.go +++ b/server/channels/jobs/hosted_purchase_screening/scheduler.go @@ -6,8 +6,8 @@ package hosted_purchase_screening import ( "time" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/jobs" + "github.com/mattermost/mattermost-server/server/v8/channels/jobs" + "github.com/mattermost/mattermost-server/server/v8/model" ) const schedFreq = 24 * time.Hour diff --git a/server/channels/jobs/hosted_purchase_screening/worker.go b/server/channels/jobs/hosted_purchase_screening/worker.go index 28037c3239..7a00705a2f 100644 --- a/server/channels/jobs/hosted_purchase_screening/worker.go +++ b/server/channels/jobs/hosted_purchase_screening/worker.go @@ -7,8 +7,8 @@ import ( "strconv" "time" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/jobs" + "github.com/mattermost/mattermost-server/server/v8/channels/jobs" + "github.com/mattermost/mattermost-server/server/v8/model" ) const ( diff --git a/server/channels/jobs/import_delete/scheduler.go b/server/channels/jobs/import_delete/scheduler.go index e81e0fc311..16191741a8 100644 --- a/server/channels/jobs/import_delete/scheduler.go +++ b/server/channels/jobs/import_delete/scheduler.go @@ -6,8 +6,8 @@ package import_delete import ( "time" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/jobs" + "github.com/mattermost/mattermost-server/server/v8/channels/jobs" + "github.com/mattermost/mattermost-server/server/v8/model" ) const schedFreq = 24 * time.Hour diff --git a/server/channels/jobs/import_delete/worker.go b/server/channels/jobs/import_delete/worker.go index 257ab50904..9d4eb4c0b3 100644 --- a/server/channels/jobs/import_delete/worker.go +++ b/server/channels/jobs/import_delete/worker.go @@ -10,11 +10,11 @@ import ( "github.com/wiggin77/merror" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/jobs" - "github.com/mattermost/mattermost-server/v6/server/channels/store" - "github.com/mattermost/mattermost-server/v6/server/platform/services/configservice" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/jobs" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/services/configservice" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) const jobName = "ImportDelete" diff --git a/server/channels/jobs/import_process/worker.go b/server/channels/jobs/import_process/worker.go index 0437256f5c..e87e6792d2 100644 --- a/server/channels/jobs/import_process/worker.go +++ b/server/channels/jobs/import_process/worker.go @@ -12,12 +12,12 @@ import ( "strconv" "strings" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/app/request" - "github.com/mattermost/mattermost-server/v6/server/channels/jobs" - "github.com/mattermost/mattermost-server/v6/server/platform/services/configservice" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/filestore" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/app/request" + "github.com/mattermost/mattermost-server/server/v8/channels/jobs" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/services/configservice" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/filestore" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) const jobName = "ImportProcess" diff --git a/server/channels/jobs/jobs.go b/server/channels/jobs/jobs.go index a7b1c0912d..03322c9874 100644 --- a/server/channels/jobs/jobs.go +++ b/server/channels/jobs/jobs.go @@ -12,9 +12,9 @@ import ( "strings" "time" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) const ( diff --git a/server/channels/jobs/jobs_test.go b/server/channels/jobs/jobs_test.go index f094fdda65..f3f05a9acf 100644 --- a/server/channels/jobs/jobs_test.go +++ b/server/channels/jobs/jobs_test.go @@ -11,11 +11,11 @@ import ( "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/einterfaces/mocks" - "github.com/mattermost/mattermost-server/v6/server/channels/store" - "github.com/mattermost/mattermost-server/v6/server/channels/store/storetest" - "github.com/mattermost/mattermost-server/v6/server/channels/utils/testutils" + "github.com/mattermost/mattermost-server/server/v8/channels/einterfaces/mocks" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/store/storetest" + "github.com/mattermost/mattermost-server/server/v8/channels/utils/testutils" + "github.com/mattermost/mattermost-server/server/v8/model" ) func makeJobServer(t *testing.T) (*JobServer, *storetest.Store, *mocks.MetricsInterface) { diff --git a/server/channels/jobs/jobs_watcher.go b/server/channels/jobs/jobs_watcher.go index c17d870906..f28a816074 100644 --- a/server/channels/jobs/jobs_watcher.go +++ b/server/channels/jobs/jobs_watcher.go @@ -7,8 +7,8 @@ import ( "math/rand" "time" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) // Default polling interval for jobs termination. diff --git a/server/channels/jobs/last_accessible_file/scheduler.go b/server/channels/jobs/last_accessible_file/scheduler.go index 06a4ad8249..e31fd06983 100644 --- a/server/channels/jobs/last_accessible_file/scheduler.go +++ b/server/channels/jobs/last_accessible_file/scheduler.go @@ -7,9 +7,9 @@ import ( "strconv" "time" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/jobs" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/jobs" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) const schedFreq = 2 * time.Hour diff --git a/server/channels/jobs/last_accessible_file/worker.go b/server/channels/jobs/last_accessible_file/worker.go index 8ffa41ed7f..e11ff23797 100644 --- a/server/channels/jobs/last_accessible_file/worker.go +++ b/server/channels/jobs/last_accessible_file/worker.go @@ -4,8 +4,8 @@ package last_accessible_file import ( - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/jobs" + "github.com/mattermost/mattermost-server/server/v8/channels/jobs" + "github.com/mattermost/mattermost-server/server/v8/model" ) const ( diff --git a/server/channels/jobs/last_accessible_post/scheduler.go b/server/channels/jobs/last_accessible_post/scheduler.go index 0927a6df9e..f9195c5755 100644 --- a/server/channels/jobs/last_accessible_post/scheduler.go +++ b/server/channels/jobs/last_accessible_post/scheduler.go @@ -7,9 +7,9 @@ import ( "strconv" "time" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/jobs" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/jobs" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) const schedFreq = 30 * time.Minute diff --git a/server/channels/jobs/last_accessible_post/worker.go b/server/channels/jobs/last_accessible_post/worker.go index 0bf338b05c..0c7eb11695 100644 --- a/server/channels/jobs/last_accessible_post/worker.go +++ b/server/channels/jobs/last_accessible_post/worker.go @@ -4,8 +4,8 @@ package last_accessible_post import ( - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/jobs" + "github.com/mattermost/mattermost-server/server/v8/channels/jobs" + "github.com/mattermost/mattermost-server/server/v8/model" ) const ( diff --git a/server/channels/jobs/migrations/advanced_permissions_phase_2.go b/server/channels/jobs/migrations/advanced_permissions_phase_2.go index 9912679451..2fa16316ef 100644 --- a/server/channels/jobs/migrations/advanced_permissions_phase_2.go +++ b/server/channels/jobs/migrations/advanced_permissions_phase_2.go @@ -9,8 +9,8 @@ import ( "net/http" "strings" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) type AdvancedPermissionsPhase2Progress struct { diff --git a/server/channels/jobs/migrations/helper_test.go b/server/channels/jobs/migrations/helper_test.go index 90722b8e33..54f2e59ab5 100644 --- a/server/channels/jobs/migrations/helper_test.go +++ b/server/channels/jobs/migrations/helper_test.go @@ -6,8 +6,8 @@ package migrations import ( "testing" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" ) func Setup(tb testing.TB) store.Store { diff --git a/server/channels/jobs/migrations/main_test.go b/server/channels/jobs/migrations/main_test.go index 3d6aabd776..abc6339e8c 100644 --- a/server/channels/jobs/migrations/main_test.go +++ b/server/channels/jobs/migrations/main_test.go @@ -6,7 +6,7 @@ package migrations import ( "testing" - "github.com/mattermost/mattermost-server/v6/server/channels/testlib" + "github.com/mattermost/mattermost-server/server/v8/channels/testlib" ) var mainHelper *testlib.MainHelper diff --git a/server/channels/jobs/migrations/migrations.go b/server/channels/jobs/migrations/migrations.go index 1783fd58e7..2e38b827aa 100644 --- a/server/channels/jobs/migrations/migrations.go +++ b/server/channels/jobs/migrations/migrations.go @@ -6,8 +6,8 @@ package migrations import ( "net/http" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" ) const ( diff --git a/server/channels/jobs/migrations/migrations_test.go b/server/channels/jobs/migrations/migrations_test.go index fee7830c0d..73e7602d4e 100644 --- a/server/channels/jobs/migrations/migrations_test.go +++ b/server/channels/jobs/migrations/migrations_test.go @@ -9,7 +9,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestGetMigrationState(t *testing.T) { diff --git a/server/channels/jobs/migrations/scheduler.go b/server/channels/jobs/migrations/scheduler.go index 52969f3f35..9607cb8381 100644 --- a/server/channels/jobs/migrations/scheduler.go +++ b/server/channels/jobs/migrations/scheduler.go @@ -6,10 +6,10 @@ package migrations import ( "time" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/jobs" - "github.com/mattermost/mattermost-server/v6/server/channels/store" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/jobs" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) const ( diff --git a/server/channels/jobs/migrations/worker.go b/server/channels/jobs/migrations/worker.go index dcfd8ef47d..bc3d340747 100644 --- a/server/channels/jobs/migrations/worker.go +++ b/server/channels/jobs/migrations/worker.go @@ -9,10 +9,10 @@ import ( "sync/atomic" "time" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/jobs" - "github.com/mattermost/mattermost-server/v6/server/channels/store" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/jobs" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) const ( diff --git a/server/channels/jobs/notify_admin/install_plugin_scheduler.go b/server/channels/jobs/notify_admin/install_plugin_scheduler.go index 91ebdb79c1..241697b9f9 100644 --- a/server/channels/jobs/notify_admin/install_plugin_scheduler.go +++ b/server/channels/jobs/notify_admin/install_plugin_scheduler.go @@ -7,9 +7,9 @@ import ( "strconv" "time" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/jobs" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/jobs" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) const installPluginSchedFreq = 24 * time.Hour diff --git a/server/channels/jobs/notify_admin/scheduler.go b/server/channels/jobs/notify_admin/scheduler.go index c2ba31f16e..84974bd87c 100644 --- a/server/channels/jobs/notify_admin/scheduler.go +++ b/server/channels/jobs/notify_admin/scheduler.go @@ -7,9 +7,9 @@ import ( "strconv" "time" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/jobs" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/jobs" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) const schedFreq = 24 * time.Hour diff --git a/server/channels/jobs/notify_admin/worker.go b/server/channels/jobs/notify_admin/worker.go index 283b1647dd..f6fa418204 100644 --- a/server/channels/jobs/notify_admin/worker.go +++ b/server/channels/jobs/notify_admin/worker.go @@ -4,8 +4,8 @@ package notify_admin import ( - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/jobs" + "github.com/mattermost/mattermost-server/server/v8/channels/jobs" + "github.com/mattermost/mattermost-server/server/v8/model" ) const ( diff --git a/server/channels/jobs/product_notices/scheduler.go b/server/channels/jobs/product_notices/scheduler.go index 4dee2b72db..a4008772b7 100644 --- a/server/channels/jobs/product_notices/scheduler.go +++ b/server/channels/jobs/product_notices/scheduler.go @@ -6,8 +6,8 @@ package product_notices import ( "time" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/jobs" + "github.com/mattermost/mattermost-server/server/v8/channels/jobs" + "github.com/mattermost/mattermost-server/server/v8/model" ) type Scheduler struct { diff --git a/server/channels/jobs/product_notices/worker.go b/server/channels/jobs/product_notices/worker.go index e268735790..65bee0bcc2 100644 --- a/server/channels/jobs/product_notices/worker.go +++ b/server/channels/jobs/product_notices/worker.go @@ -4,9 +4,9 @@ package product_notices import ( - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/jobs" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/jobs" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) const jobName = "ProductNotices" diff --git a/server/channels/jobs/resend_invitation_email/worker.go b/server/channels/jobs/resend_invitation_email/worker.go index 48a228795c..9bcdaf6473 100644 --- a/server/channels/jobs/resend_invitation_email/worker.go +++ b/server/channels/jobs/resend_invitation_email/worker.go @@ -8,12 +8,12 @@ import ( "os" "strconv" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/jobs" - "github.com/mattermost/mattermost-server/v6/server/channels/store" - "github.com/mattermost/mattermost-server/v6/server/platform/services/configservice" - "github.com/mattermost/mattermost-server/v6/server/platform/services/telemetry" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/jobs" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/services/configservice" + "github.com/mattermost/mattermost-server/server/v8/platform/services/telemetry" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) const FourtyEightHoursInMillis int64 = 172800000 diff --git a/server/channels/jobs/schedulers.go b/server/channels/jobs/schedulers.go index 03f3a18834..73afae178f 100644 --- a/server/channels/jobs/schedulers.go +++ b/server/channels/jobs/schedulers.go @@ -8,8 +8,8 @@ import ( "fmt" "time" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) type Schedulers struct { diff --git a/server/channels/jobs/schedulers_test.go b/server/channels/jobs/schedulers_test.go index dc65c04f29..6bd51981ee 100644 --- a/server/channels/jobs/schedulers_test.go +++ b/server/channels/jobs/schedulers_test.go @@ -10,10 +10,10 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/plugin/plugintest/mock" - "github.com/mattermost/mattermost-server/v6/server/channels/store/storetest" - "github.com/mattermost/mattermost-server/v6/server/channels/utils/testutils" + "github.com/mattermost/mattermost-server/server/v8/channels/store/storetest" + "github.com/mattermost/mattermost-server/server/v8/channels/utils/testutils" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/plugin/plugintest/mock" ) type MockScheduler struct { diff --git a/server/channels/jobs/server.go b/server/channels/jobs/server.go index 7ddcf1eccc..90d045a68b 100644 --- a/server/channels/jobs/server.go +++ b/server/channels/jobs/server.go @@ -7,10 +7,10 @@ import ( "sync" "time" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/einterfaces" - "github.com/mattermost/mattermost-server/v6/server/channels/store" - "github.com/mattermost/mattermost-server/v6/server/platform/services/configservice" + "github.com/mattermost/mattermost-server/server/v8/channels/einterfaces" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/services/configservice" ) type JobServer struct { diff --git a/server/channels/jobs/workers.go b/server/channels/jobs/workers.go index ac77e5e82a..d09b783d5a 100644 --- a/server/channels/jobs/workers.go +++ b/server/channels/jobs/workers.go @@ -6,9 +6,9 @@ package jobs import ( "errors" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/platform/services/configservice" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/services/configservice" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) type Workers struct { diff --git a/server/channels/manualtesting/manual_testing.go b/server/channels/manualtesting/manual_testing.go index b17114cf73..7e07d26bd2 100644 --- a/server/channels/manualtesting/manual_testing.go +++ b/server/channels/manualtesting/manual_testing.go @@ -12,14 +12,14 @@ import ( "strconv" "time" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/api4" - "github.com/mattermost/mattermost-server/v6/server/channels/app" - "github.com/mattermost/mattermost-server/v6/server/channels/app/slashcommands" - "github.com/mattermost/mattermost-server/v6/server/channels/store" - "github.com/mattermost/mattermost-server/v6/server/channels/utils" - "github.com/mattermost/mattermost-server/v6/server/channels/web" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/api4" + "github.com/mattermost/mattermost-server/server/v8/channels/app" + "github.com/mattermost/mattermost-server/server/v8/channels/app/slashcommands" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/utils" + "github.com/mattermost/mattermost-server/server/v8/channels/web" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) // TestEnvironment is a helper struct used for tests in manualtesting. diff --git a/server/channels/manualtesting/test_autolink.go b/server/channels/manualtesting/test_autolink.go index 777c9b66dd..844b70858e 100644 --- a/server/channels/manualtesting/test_autolink.go +++ b/server/channels/manualtesting/test_autolink.go @@ -7,8 +7,8 @@ import ( "errors" "net/http" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) const linkPostText = ` diff --git a/server/channels/product/README.md b/server/channels/product/README.md index 494631f6c5..1134e7da7e 100644 --- a/server/channels/product/README.md +++ b/server/channels/product/README.md @@ -17,7 +17,7 @@ type Product interface { } ``` -The `app.Server` will take care of starting and stopping products. The product shall register itself via a function called `RegisterProduct` provided by `github.com/mattermost/mattermost-server/v6/server/app` package. To register a product, +The `app.Server` will take care of starting and stopping products. The product shall register itself via a function called `RegisterProduct` provided by `github.com/mattermost/mattermost-server/server/v8/channels/app` package. To register a product, a product initializer is required. The signature of a product initializer is defined as following: ```Go diff --git a/server/channels/product/api.go b/server/channels/product/api.go index 663bab9487..73cff0a451 100644 --- a/server/channels/product/api.go +++ b/server/channels/product/api.go @@ -8,12 +8,12 @@ import ( "github.com/gorilla/mux" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/app/request" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/filestore" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/app/request" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/filestore" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" - fb_model "github.com/mattermost/mattermost-server/v6/server/boards/model" + fb_model "github.com/mattermost/mattermost-server/server/v8/boards/model" ) // RouterService enables registering the product router to the server. After registering the diff --git a/server/channels/product/hooks.go b/server/channels/product/hooks.go index f5b5c30701..aa06b5e92f 100644 --- a/server/channels/product/hooks.go +++ b/server/channels/product/hooks.go @@ -7,8 +7,8 @@ import ( "sync" "time" - "github.com/mattermost/mattermost-server/v6/plugin" - "github.com/mattermost/mattermost-server/v6/server/channels/einterfaces" + "github.com/mattermost/mattermost-server/server/v8/channels/einterfaces" + "github.com/mattermost/mattermost-server/server/v8/plugin" ) type HooksManager struct { diff --git a/server/channels/store/layer_generators/main.go b/server/channels/store/layer_generators/main.go index cfb95abdb8..a1dac2b667 100644 --- a/server/channels/store/layer_generators/main.go +++ b/server/channels/store/layer_generators/main.go @@ -296,6 +296,8 @@ func generateLayer(name, templateFile string) ([]byte, error) { paramsWithType = append(paramsWithType, fmt.Sprintf("%s store.%s", param.Name, param.Type)) case "*UserGetByIdsOpts", "*ChannelMemberGraphQLSearchOpts", "*SidebarCategorySearchOpts": paramsWithType = append(paramsWithType, fmt.Sprintf("%s *store.%s", param.Name, strings.TrimPrefix(param.Type, "*"))) + case "...*SidebarCategorySearchOpts": + paramsWithType = append(paramsWithType, fmt.Sprintf("%s ...*store.%s", param.Name, strings.TrimPrefix(param.Type, "...*"))) default: paramsWithType = append(paramsWithType, fmt.Sprintf("%s %s", param.Name, param.Type)) } @@ -310,6 +312,8 @@ func generateLayer(name, templateFile string) ([]byte, error) { paramsWithType = append(paramsWithType, fmt.Sprintf("%s store.%s", param.Name, param.Type)) case "*UserGetByIdsOpts", "*ChannelMemberGraphQLSearchOpts", "*SidebarCategorySearchOpts": paramsWithType = append(paramsWithType, fmt.Sprintf("%s *store.%s", param.Name, strings.TrimPrefix(param.Type, "*"))) + case "...*SidebarCategorySearchOpts": + paramsWithType = append(paramsWithType, fmt.Sprintf("%s ...*store.%s", param.Name, strings.TrimPrefix(param.Type, "...*"))) default: paramsWithType = append(paramsWithType, fmt.Sprintf("%s %s", param.Name, param.Type)) } diff --git a/server/channels/store/layer_generators/opentracing_layer.go.tmpl b/server/channels/store/layer_generators/opentracing_layer.go.tmpl index af3af10ce7..0215c6489f 100644 --- a/server/channels/store/layer_generators/opentracing_layer.go.tmpl +++ b/server/channels/store/layer_generators/opentracing_layer.go.tmpl @@ -10,9 +10,9 @@ import ( "context" "time" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/platform/services/tracing" - "github.com/mattermost/mattermost-server/v6/server/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/services/tracing" + "github.com/mattermost/mattermost-server/server/v8/channels/store" "github.com/opentracing/opentracing-go/ext" spanlog "github.com/opentracing/opentracing-go/log" ) diff --git a/server/channels/store/layer_generators/retry_layer.go.tmpl b/server/channels/store/layer_generators/retry_layer.go.tmpl index 327831895a..4f192b2b7f 100644 --- a/server/channels/store/layer_generators/retry_layer.go.tmpl +++ b/server/channels/store/layer_generators/retry_layer.go.tmpl @@ -12,8 +12,8 @@ import ( "time" "github.com/lib/pq" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/channels/store" "github.com/pkg/errors" "github.com/go-sql-driver/mysql" ) diff --git a/server/channels/store/layer_generators/timer_layer.go.tmpl b/server/channels/store/layer_generators/timer_layer.go.tmpl index 6942e68fce..6549449af4 100644 --- a/server/channels/store/layer_generators/timer_layer.go.tmpl +++ b/server/channels/store/layer_generators/timer_layer.go.tmpl @@ -10,9 +10,9 @@ import ( "context" "time" - "github.com/mattermost/mattermost-server/v6/server/channels/einterfaces" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/einterfaces" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/channels/store" ) type {{.Name}} struct { diff --git a/server/channels/store/localcachelayer/channel_layer.go b/server/channels/store/localcachelayer/channel_layer.go index 3d26edaaaa..0dec2eb1bc 100644 --- a/server/channels/store/localcachelayer/channel_layer.go +++ b/server/channels/store/localcachelayer/channel_layer.go @@ -6,8 +6,8 @@ package localcachelayer import ( "bytes" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" ) type LocalCacheChannelStore struct { diff --git a/server/channels/store/localcachelayer/channel_layer_test.go b/server/channels/store/localcachelayer/channel_layer_test.go index ccbb1e4a8b..618db4cb92 100644 --- a/server/channels/store/localcachelayer/channel_layer_test.go +++ b/server/channels/store/localcachelayer/channel_layer_test.go @@ -9,9 +9,9 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store/storetest" - "github.com/mattermost/mattermost-server/v6/server/channels/store/storetest/mocks" + "github.com/mattermost/mattermost-server/server/v8/channels/store/storetest" + "github.com/mattermost/mattermost-server/server/v8/channels/store/storetest/mocks" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestChannelStore(t *testing.T) { diff --git a/server/channels/store/localcachelayer/emoji_layer.go b/server/channels/store/localcachelayer/emoji_layer.go index c552f42903..35cce34576 100644 --- a/server/channels/store/localcachelayer/emoji_layer.go +++ b/server/channels/store/localcachelayer/emoji_layer.go @@ -8,9 +8,9 @@ import ( "context" "sync" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store" - "github.com/mattermost/mattermost-server/v6/server/channels/store/sqlstore" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/store/sqlstore" + "github.com/mattermost/mattermost-server/server/v8/model" ) type LocalCacheEmojiStore struct { diff --git a/server/channels/store/localcachelayer/emoji_layer_test.go b/server/channels/store/localcachelayer/emoji_layer_test.go index 237f0ee213..8882c26ef5 100644 --- a/server/channels/store/localcachelayer/emoji_layer_test.go +++ b/server/channels/store/localcachelayer/emoji_layer_test.go @@ -10,9 +10,9 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store/storetest" - "github.com/mattermost/mattermost-server/v6/server/channels/store/storetest/mocks" + "github.com/mattermost/mattermost-server/server/v8/channels/store/storetest" + "github.com/mattermost/mattermost-server/server/v8/channels/store/storetest/mocks" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestEmojiStore(t *testing.T) { diff --git a/server/channels/store/localcachelayer/file_info_layer.go b/server/channels/store/localcachelayer/file_info_layer.go index e09d0dd9b6..45017b45f4 100644 --- a/server/channels/store/localcachelayer/file_info_layer.go +++ b/server/channels/store/localcachelayer/file_info_layer.go @@ -6,8 +6,8 @@ package localcachelayer import ( "bytes" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" ) type LocalCacheFileInfoStore struct { diff --git a/server/channels/store/localcachelayer/file_info_layer_test.go b/server/channels/store/localcachelayer/file_info_layer_test.go index fffeecd850..313a2dbfea 100644 --- a/server/channels/store/localcachelayer/file_info_layer_test.go +++ b/server/channels/store/localcachelayer/file_info_layer_test.go @@ -9,9 +9,9 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store/storetest" - "github.com/mattermost/mattermost-server/v6/server/channels/store/storetest/mocks" + "github.com/mattermost/mattermost-server/server/v8/channels/store/storetest" + "github.com/mattermost/mattermost-server/server/v8/channels/store/storetest/mocks" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestFileInfoStore(t *testing.T) { diff --git a/server/channels/store/localcachelayer/layer.go b/server/channels/store/localcachelayer/layer.go index d534b5df09..66130657a0 100644 --- a/server/channels/store/localcachelayer/layer.go +++ b/server/channels/store/localcachelayer/layer.go @@ -7,10 +7,10 @@ import ( "runtime" "time" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/einterfaces" - "github.com/mattermost/mattermost-server/v6/server/channels/store" - "github.com/mattermost/mattermost-server/v6/server/platform/services/cache" + "github.com/mattermost/mattermost-server/server/v8/channels/einterfaces" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/services/cache" ) const ( diff --git a/server/channels/store/localcachelayer/layer_test.go b/server/channels/store/localcachelayer/layer_test.go index b4ca7c1e52..4a94793ae1 100644 --- a/server/channels/store/localcachelayer/layer_test.go +++ b/server/channels/store/localcachelayer/layer_test.go @@ -8,10 +8,10 @@ import ( "sync" "testing" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store" - "github.com/mattermost/mattermost-server/v6/server/channels/store/sqlstore" - "github.com/mattermost/mattermost-server/v6/server/channels/store/storetest" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/store/sqlstore" + "github.com/mattermost/mattermost-server/server/v8/channels/store/storetest" + "github.com/mattermost/mattermost-server/server/v8/model" ) type storeType struct { diff --git a/server/channels/store/localcachelayer/main_test.go b/server/channels/store/localcachelayer/main_test.go index 649990cb69..c76f6e9cbc 100644 --- a/server/channels/store/localcachelayer/main_test.go +++ b/server/channels/store/localcachelayer/main_test.go @@ -10,13 +10,13 @@ import ( "github.com/stretchr/testify/mock" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store" - "github.com/mattermost/mattermost-server/v6/server/channels/store/sqlstore" - "github.com/mattermost/mattermost-server/v6/server/channels/store/storetest/mocks" - "github.com/mattermost/mattermost-server/v6/server/channels/testlib" - "github.com/mattermost/mattermost-server/v6/server/platform/services/cache" - cachemocks "github.com/mattermost/mattermost-server/v6/server/platform/services/cache/mocks" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/store/sqlstore" + "github.com/mattermost/mattermost-server/server/v8/channels/store/storetest/mocks" + "github.com/mattermost/mattermost-server/server/v8/channels/testlib" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/services/cache" + cachemocks "github.com/mattermost/mattermost-server/server/v8/platform/services/cache/mocks" ) var mainHelper *testlib.MainHelper diff --git a/server/channels/store/localcachelayer/post_layer.go b/server/channels/store/localcachelayer/post_layer.go index 56de5cd5c9..80e0995a7f 100644 --- a/server/channels/store/localcachelayer/post_layer.go +++ b/server/channels/store/localcachelayer/post_layer.go @@ -9,8 +9,8 @@ import ( "strconv" "strings" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" ) type LocalCachePostStore struct { diff --git a/server/channels/store/localcachelayer/post_layer_test.go b/server/channels/store/localcachelayer/post_layer_test.go index 6a1cce2e30..9d2f1c6aec 100644 --- a/server/channels/store/localcachelayer/post_layer_test.go +++ b/server/channels/store/localcachelayer/post_layer_test.go @@ -10,9 +10,9 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store/storetest" - "github.com/mattermost/mattermost-server/v6/server/channels/store/storetest/mocks" + "github.com/mattermost/mattermost-server/server/v8/channels/store/storetest" + "github.com/mattermost/mattermost-server/server/v8/channels/store/storetest/mocks" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestPostStore(t *testing.T) { diff --git a/server/channels/store/localcachelayer/reaction_layer.go b/server/channels/store/localcachelayer/reaction_layer.go index 9ef3d6142a..5dc191c2e2 100644 --- a/server/channels/store/localcachelayer/reaction_layer.go +++ b/server/channels/store/localcachelayer/reaction_layer.go @@ -6,8 +6,8 @@ package localcachelayer import ( "bytes" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" ) type LocalCacheReactionStore struct { diff --git a/server/channels/store/localcachelayer/reaction_layer_test.go b/server/channels/store/localcachelayer/reaction_layer_test.go index 377eb1a138..523bbd7d26 100644 --- a/server/channels/store/localcachelayer/reaction_layer_test.go +++ b/server/channels/store/localcachelayer/reaction_layer_test.go @@ -9,9 +9,9 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store/storetest" - "github.com/mattermost/mattermost-server/v6/server/channels/store/storetest/mocks" + "github.com/mattermost/mattermost-server/server/v8/channels/store/storetest" + "github.com/mattermost/mattermost-server/server/v8/channels/store/storetest/mocks" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestReactionStore(t *testing.T) { diff --git a/server/channels/store/localcachelayer/role_layer.go b/server/channels/store/localcachelayer/role_layer.go index 145465d84d..24525386fc 100644 --- a/server/channels/store/localcachelayer/role_layer.go +++ b/server/channels/store/localcachelayer/role_layer.go @@ -9,8 +9,8 @@ import ( "sort" "strings" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" ) type LocalCacheRoleStore struct { diff --git a/server/channels/store/localcachelayer/role_layer_test.go b/server/channels/store/localcachelayer/role_layer_test.go index 1a421ed0c4..9e709634d9 100644 --- a/server/channels/store/localcachelayer/role_layer_test.go +++ b/server/channels/store/localcachelayer/role_layer_test.go @@ -10,9 +10,9 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store/storetest" - "github.com/mattermost/mattermost-server/v6/server/channels/store/storetest/mocks" + "github.com/mattermost/mattermost-server/server/v8/channels/store/storetest" + "github.com/mattermost/mattermost-server/server/v8/channels/store/storetest/mocks" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestRoleStore(t *testing.T) { diff --git a/server/channels/store/localcachelayer/scheme_layer.go b/server/channels/store/localcachelayer/scheme_layer.go index b80837d6a4..1d32cfb5b3 100644 --- a/server/channels/store/localcachelayer/scheme_layer.go +++ b/server/channels/store/localcachelayer/scheme_layer.go @@ -6,8 +6,8 @@ package localcachelayer import ( "bytes" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" ) type LocalCacheSchemeStore struct { diff --git a/server/channels/store/localcachelayer/scheme_layer_test.go b/server/channels/store/localcachelayer/scheme_layer_test.go index 165ed4a765..414708a558 100644 --- a/server/channels/store/localcachelayer/scheme_layer_test.go +++ b/server/channels/store/localcachelayer/scheme_layer_test.go @@ -9,9 +9,9 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store/storetest" - "github.com/mattermost/mattermost-server/v6/server/channels/store/storetest/mocks" + "github.com/mattermost/mattermost-server/server/v8/channels/store/storetest" + "github.com/mattermost/mattermost-server/server/v8/channels/store/storetest/mocks" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestSchemeStore(t *testing.T) { diff --git a/server/channels/store/localcachelayer/team_layer.go b/server/channels/store/localcachelayer/team_layer.go index 16712a24c4..88ddfb974a 100644 --- a/server/channels/store/localcachelayer/team_layer.go +++ b/server/channels/store/localcachelayer/team_layer.go @@ -6,8 +6,8 @@ package localcachelayer import ( "bytes" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" ) type LocalCacheTeamStore struct { diff --git a/server/channels/store/localcachelayer/team_layer_test.go b/server/channels/store/localcachelayer/team_layer_test.go index 8be69f494e..2a32f2fdd6 100644 --- a/server/channels/store/localcachelayer/team_layer_test.go +++ b/server/channels/store/localcachelayer/team_layer_test.go @@ -9,8 +9,8 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/server/channels/store/storetest" - "github.com/mattermost/mattermost-server/v6/server/channels/store/storetest/mocks" + "github.com/mattermost/mattermost-server/server/v8/channels/store/storetest" + "github.com/mattermost/mattermost-server/server/v8/channels/store/storetest/mocks" ) func TestTeamStore(t *testing.T) { diff --git a/server/channels/store/localcachelayer/terms_of_service_layer.go b/server/channels/store/localcachelayer/terms_of_service_layer.go index bba94f3d57..4589103795 100644 --- a/server/channels/store/localcachelayer/terms_of_service_layer.go +++ b/server/channels/store/localcachelayer/terms_of_service_layer.go @@ -6,8 +6,8 @@ package localcachelayer import ( "bytes" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" ) const ( diff --git a/server/channels/store/localcachelayer/terms_of_service_layer_test.go b/server/channels/store/localcachelayer/terms_of_service_layer_test.go index 13c4575954..8a454f1385 100644 --- a/server/channels/store/localcachelayer/terms_of_service_layer_test.go +++ b/server/channels/store/localcachelayer/terms_of_service_layer_test.go @@ -9,9 +9,9 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store/storetest" - "github.com/mattermost/mattermost-server/v6/server/channels/store/storetest/mocks" + "github.com/mattermost/mattermost-server/server/v8/channels/store/storetest" + "github.com/mattermost/mattermost-server/server/v8/channels/store/storetest/mocks" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestTermsOfServiceStore(t *testing.T) { diff --git a/server/channels/store/localcachelayer/user_layer.go b/server/channels/store/localcachelayer/user_layer.go index df1d7d6dbc..a0170f1ec0 100644 --- a/server/channels/store/localcachelayer/user_layer.go +++ b/server/channels/store/localcachelayer/user_layer.go @@ -9,9 +9,9 @@ import ( "sort" "sync" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store" - "github.com/mattermost/mattermost-server/v6/server/channels/store/sqlstore" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/store/sqlstore" + "github.com/mattermost/mattermost-server/server/v8/model" ) type LocalCacheUserStore struct { diff --git a/server/channels/store/localcachelayer/user_layer_test.go b/server/channels/store/localcachelayer/user_layer_test.go index 3f50534662..f25fb84178 100644 --- a/server/channels/store/localcachelayer/user_layer_test.go +++ b/server/channels/store/localcachelayer/user_layer_test.go @@ -10,11 +10,11 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/plugin/plugintest/mock" - "github.com/mattermost/mattermost-server/v6/server/channels/store" - "github.com/mattermost/mattermost-server/v6/server/channels/store/storetest" - "github.com/mattermost/mattermost-server/v6/server/channels/store/storetest/mocks" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/store/storetest" + "github.com/mattermost/mattermost-server/server/v8/channels/store/storetest/mocks" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/plugin/plugintest/mock" ) func TestUserStore(t *testing.T) { diff --git a/server/channels/store/localcachelayer/webhook_layer.go b/server/channels/store/localcachelayer/webhook_layer.go index 7b53dd71a8..19c4617348 100644 --- a/server/channels/store/localcachelayer/webhook_layer.go +++ b/server/channels/store/localcachelayer/webhook_layer.go @@ -6,8 +6,8 @@ package localcachelayer import ( "bytes" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" ) type LocalCacheWebhookStore struct { diff --git a/server/channels/store/localcachelayer/webhook_layer_test.go b/server/channels/store/localcachelayer/webhook_layer_test.go index a09cc4cb85..b5a3ec4aca 100644 --- a/server/channels/store/localcachelayer/webhook_layer_test.go +++ b/server/channels/store/localcachelayer/webhook_layer_test.go @@ -9,9 +9,9 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store/storetest" - "github.com/mattermost/mattermost-server/v6/server/channels/store/storetest/mocks" + "github.com/mattermost/mattermost-server/server/v8/channels/store/storetest" + "github.com/mattermost/mattermost-server/server/v8/channels/store/storetest/mocks" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestWebhookStore(t *testing.T) { diff --git a/server/channels/store/opentracinglayer/opentracinglayer.go b/server/channels/store/opentracinglayer/opentracinglayer.go index 5a193bcb76..f70d14eddc 100644 --- a/server/channels/store/opentracinglayer/opentracinglayer.go +++ b/server/channels/store/opentracinglayer/opentracinglayer.go @@ -10,9 +10,9 @@ import ( "context" "time" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store" - "github.com/mattermost/mattermost-server/v6/server/platform/services/tracing" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/services/tracing" "github.com/opentracing/opentracing-go/ext" spanlog "github.com/opentracing/opentracing-go/log" ) @@ -809,7 +809,7 @@ func (s *OpenTracingLayerChannelStore) CreateInitialSidebarCategories(userID str return result, err } -func (s *OpenTracingLayerChannelStore) CreateSidebarCategory(userID string, teamID string, newCategory *model.SidebarCategoryWithChannels) (*model.SidebarCategoryWithChannels, error) { +func (s *OpenTracingLayerChannelStore) CreateSidebarCategory(userID string, teamID string, newCategory *model.SidebarCategoryWithChannels, options ...*store.SidebarCategorySearchOpts) (*model.SidebarCategoryWithChannels, error) { origCtx := s.Root.Store.Context() span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "ChannelStore.CreateSidebarCategory") s.Root.Store.SetContext(newCtx) @@ -818,7 +818,7 @@ func (s *OpenTracingLayerChannelStore) CreateSidebarCategory(userID string, team }() defer span.Finish() - result, err := s.ChannelStore.CreateSidebarCategory(userID, teamID, newCategory) + result, err := s.ChannelStore.CreateSidebarCategory(userID, teamID, newCategory, options...) if err != nil { span.LogFields(spanlog.Error(err)) ext.Error.Set(span, true) @@ -1043,6 +1043,24 @@ func (s *OpenTracingLayerChannelStore) GetAllDirectChannelsForExportAfter(limit return result, err } +func (s *OpenTracingLayerChannelStore) GetBotChannelsByUser(userID string, opts store.ChannelSearchOpts) (model.ChannelList, error) { + origCtx := s.Root.Store.Context() + span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "ChannelStore.GetBotChannelsByUser") + s.Root.Store.SetContext(newCtx) + defer func() { + s.Root.Store.SetContext(origCtx) + }() + + defer span.Finish() + result, err := s.ChannelStore.GetBotChannelsByUser(userID, opts) + if err != nil { + span.LogFields(spanlog.Error(err)) + ext.Error.Set(span, true) + } + + return result, err +} + func (s *OpenTracingLayerChannelStore) GetByName(team_id string, name string, allowFromCache bool) (*model.Channel, error) { origCtx := s.Root.Store.Context() span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "ChannelStore.GetByName") @@ -1740,7 +1758,7 @@ func (s *OpenTracingLayerChannelStore) GetSidebarCategories(userID string, opts return result, err } -func (s *OpenTracingLayerChannelStore) GetSidebarCategoriesForTeamForUser(userID string, teamID string) (*model.OrderedSidebarCategories, error) { +func (s *OpenTracingLayerChannelStore) GetSidebarCategoriesForTeamForUser(userID string, teamID string, options ...*store.SidebarCategorySearchOpts) (*model.OrderedSidebarCategories, error) { origCtx := s.Root.Store.Context() span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "ChannelStore.GetSidebarCategoriesForTeamForUser") s.Root.Store.SetContext(newCtx) @@ -1749,7 +1767,7 @@ func (s *OpenTracingLayerChannelStore) GetSidebarCategoriesForTeamForUser(userID }() defer span.Finish() - result, err := s.ChannelStore.GetSidebarCategoriesForTeamForUser(userID, teamID) + result, err := s.ChannelStore.GetSidebarCategoriesForTeamForUser(userID, teamID, options...) if err != nil { span.LogFields(spanlog.Error(err)) ext.Error.Set(span, true) @@ -1758,7 +1776,7 @@ func (s *OpenTracingLayerChannelStore) GetSidebarCategoriesForTeamForUser(userID return result, err } -func (s *OpenTracingLayerChannelStore) GetSidebarCategory(categoryID string) (*model.SidebarCategoryWithChannels, error) { +func (s *OpenTracingLayerChannelStore) GetSidebarCategory(categoryID string, options ...*store.SidebarCategorySearchOpts) (*model.SidebarCategoryWithChannels, error) { origCtx := s.Root.Store.Context() span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "ChannelStore.GetSidebarCategory") s.Root.Store.SetContext(newCtx) @@ -1767,7 +1785,7 @@ func (s *OpenTracingLayerChannelStore) GetSidebarCategory(categoryID string) (*m }() defer span.Finish() - result, err := s.ChannelStore.GetSidebarCategory(categoryID) + result, err := s.ChannelStore.GetSidebarCategory(categoryID, options...) if err != nil { span.LogFields(spanlog.Error(err)) ext.Error.Set(span, true) @@ -2600,7 +2618,7 @@ func (s *OpenTracingLayerChannelStore) UpdateMultipleMembers(members []*model.Ch return result, err } -func (s *OpenTracingLayerChannelStore) UpdateSidebarCategories(userID string, teamID string, categories []*model.SidebarCategoryWithChannels) ([]*model.SidebarCategoryWithChannels, []*model.SidebarCategoryWithChannels, error) { +func (s *OpenTracingLayerChannelStore) UpdateSidebarCategories(userID string, teamID string, categories []*model.SidebarCategoryWithChannels, options ...*store.SidebarCategorySearchOpts) ([]*model.SidebarCategoryWithChannels, []*model.SidebarCategoryWithChannels, error) { origCtx := s.Root.Store.Context() span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "ChannelStore.UpdateSidebarCategories") s.Root.Store.SetContext(newCtx) @@ -2609,7 +2627,7 @@ func (s *OpenTracingLayerChannelStore) UpdateSidebarCategories(userID string, te }() defer span.Finish() - result, resultVar1, err := s.ChannelStore.UpdateSidebarCategories(userID, teamID, categories) + result, resultVar1, err := s.ChannelStore.UpdateSidebarCategories(userID, teamID, categories, options...) if err != nil { span.LogFields(spanlog.Error(err)) ext.Error.Set(span, true) @@ -10123,6 +10141,24 @@ func (s *OpenTracingLayerThreadStore) DeleteMembershipForUser(userId string, pos return err } +func (s *OpenTracingLayerThreadStore) DeleteMembershipsForChannel(userID string, channelID string) error { + origCtx := s.Root.Store.Context() + span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "ThreadStore.DeleteMembershipsForChannel") + s.Root.Store.SetContext(newCtx) + defer func() { + s.Root.Store.SetContext(origCtx) + }() + + defer span.Finish() + err := s.ThreadStore.DeleteMembershipsForChannel(userID, channelID) + if err != nil { + span.LogFields(spanlog.Error(err)) + ext.Error.Set(span, true) + } + + return err +} + func (s *OpenTracingLayerThreadStore) DeleteOrphanedRows(limit int) (int64, error) { origCtx := s.Root.Store.Context() span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "ThreadStore.DeleteOrphanedRows") diff --git a/server/channels/store/retrylayer/retrylayer.go b/server/channels/store/retrylayer/retrylayer.go index f7ec2bfd27..37d71bd2d6 100644 --- a/server/channels/store/retrylayer/retrylayer.go +++ b/server/channels/store/retrylayer/retrylayer.go @@ -13,8 +13,8 @@ import ( "github.com/go-sql-driver/mysql" "github.com/lib/pq" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" "github.com/pkg/errors" ) @@ -871,11 +871,11 @@ func (s *RetryLayerChannelStore) CreateInitialSidebarCategories(userID string, o } -func (s *RetryLayerChannelStore) CreateSidebarCategory(userID string, teamID string, newCategory *model.SidebarCategoryWithChannels) (*model.SidebarCategoryWithChannels, error) { +func (s *RetryLayerChannelStore) CreateSidebarCategory(userID string, teamID string, newCategory *model.SidebarCategoryWithChannels, options ...*store.SidebarCategorySearchOpts) (*model.SidebarCategoryWithChannels, error) { tries := 0 for { - result, err := s.ChannelStore.CreateSidebarCategory(userID, teamID, newCategory) + result, err := s.ChannelStore.CreateSidebarCategory(userID, teamID, newCategory, options...) if err == nil { return result, nil } @@ -1144,6 +1144,27 @@ func (s *RetryLayerChannelStore) GetAllDirectChannelsForExportAfter(limit int, a } +func (s *RetryLayerChannelStore) GetBotChannelsByUser(userID string, opts store.ChannelSearchOpts) (model.ChannelList, error) { + + tries := 0 + for { + result, err := s.ChannelStore.GetBotChannelsByUser(userID, opts) + if err == nil { + return result, nil + } + if !isRepeatableError(err) { + return result, err + } + tries++ + if tries >= 3 { + err = errors.Wrap(err, "giving up after 3 consecutive repeatable transaction failures") + return result, err + } + timepkg.Sleep(100 * timepkg.Millisecond) + } + +} + func (s *RetryLayerChannelStore) GetByName(team_id string, name string, allowFromCache bool) (*model.Channel, error) { tries := 0 @@ -1948,11 +1969,11 @@ func (s *RetryLayerChannelStore) GetSidebarCategories(userID string, opts *store } -func (s *RetryLayerChannelStore) GetSidebarCategoriesForTeamForUser(userID string, teamID string) (*model.OrderedSidebarCategories, error) { +func (s *RetryLayerChannelStore) GetSidebarCategoriesForTeamForUser(userID string, teamID string, options ...*store.SidebarCategorySearchOpts) (*model.OrderedSidebarCategories, error) { tries := 0 for { - result, err := s.ChannelStore.GetSidebarCategoriesForTeamForUser(userID, teamID) + result, err := s.ChannelStore.GetSidebarCategoriesForTeamForUser(userID, teamID, options...) if err == nil { return result, nil } @@ -1969,11 +1990,11 @@ func (s *RetryLayerChannelStore) GetSidebarCategoriesForTeamForUser(userID strin } -func (s *RetryLayerChannelStore) GetSidebarCategory(categoryID string) (*model.SidebarCategoryWithChannels, error) { +func (s *RetryLayerChannelStore) GetSidebarCategory(categoryID string, options ...*store.SidebarCategorySearchOpts) (*model.SidebarCategoryWithChannels, error) { tries := 0 for { - result, err := s.ChannelStore.GetSidebarCategory(categoryID) + result, err := s.ChannelStore.GetSidebarCategory(categoryID, options...) if err == nil { return result, nil } @@ -2878,11 +2899,11 @@ func (s *RetryLayerChannelStore) UpdateMultipleMembers(members []*model.ChannelM } -func (s *RetryLayerChannelStore) UpdateSidebarCategories(userID string, teamID string, categories []*model.SidebarCategoryWithChannels) ([]*model.SidebarCategoryWithChannels, []*model.SidebarCategoryWithChannels, error) { +func (s *RetryLayerChannelStore) UpdateSidebarCategories(userID string, teamID string, categories []*model.SidebarCategoryWithChannels, options ...*store.SidebarCategorySearchOpts) ([]*model.SidebarCategoryWithChannels, []*model.SidebarCategoryWithChannels, error) { tries := 0 for { - result, resultVar1, err := s.ChannelStore.UpdateSidebarCategories(userID, teamID, categories) + result, resultVar1, err := s.ChannelStore.UpdateSidebarCategories(userID, teamID, categories, options...) if err == nil { return result, resultVar1, nil } @@ -11563,6 +11584,27 @@ func (s *RetryLayerThreadStore) DeleteMembershipForUser(userId string, postID st } +func (s *RetryLayerThreadStore) DeleteMembershipsForChannel(userID string, channelID string) error { + + tries := 0 + for { + err := s.ThreadStore.DeleteMembershipsForChannel(userID, channelID) + if err == nil { + return nil + } + if !isRepeatableError(err) { + return err + } + tries++ + if tries >= 3 { + err = errors.Wrap(err, "giving up after 3 consecutive repeatable transaction failures") + return err + } + timepkg.Sleep(100 * timepkg.Millisecond) + } + +} + func (s *RetryLayerThreadStore) DeleteOrphanedRows(limit int) (int64, error) { tries := 0 diff --git a/server/channels/store/retrylayer/retrylayer_test.go b/server/channels/store/retrylayer/retrylayer_test.go index c052b48090..511cd70a02 100644 --- a/server/channels/store/retrylayer/retrylayer_test.go +++ b/server/channels/store/retrylayer/retrylayer_test.go @@ -10,8 +10,8 @@ import ( "github.com/lib/pq" "github.com/pkg/errors" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store/storetest/mocks" + "github.com/mattermost/mattermost-server/server/v8/channels/store/storetest/mocks" + "github.com/mattermost/mattermost-server/server/v8/model" ) func genStore() *mocks.Store { diff --git a/server/channels/store/searchlayer/channel_layer.go b/server/channels/store/searchlayer/channel_layer.go index 1cd3eede1a..01022bf9d7 100644 --- a/server/channels/store/searchlayer/channel_layer.go +++ b/server/channels/store/searchlayer/channel_layer.go @@ -8,10 +8,10 @@ import ( "github.com/pkg/errors" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store" - "github.com/mattermost/mattermost-server/v6/server/platform/services/searchengine" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/services/searchengine" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) type SearchChannelStore struct { diff --git a/server/channels/store/searchlayer/file_info_layer.go b/server/channels/store/searchlayer/file_info_layer.go index 85253841aa..81d25cc1c4 100644 --- a/server/channels/store/searchlayer/file_info_layer.go +++ b/server/channels/store/searchlayer/file_info_layer.go @@ -4,10 +4,10 @@ package searchlayer import ( - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store" - "github.com/mattermost/mattermost-server/v6/server/platform/services/searchengine" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/services/searchengine" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) type SearchFileInfoStore struct { diff --git a/server/channels/store/searchlayer/layer.go b/server/channels/store/searchlayer/layer.go index e2f68f3df0..a71cd011ac 100644 --- a/server/channels/store/searchlayer/layer.go +++ b/server/channels/store/searchlayer/layer.go @@ -7,10 +7,10 @@ import ( "context" "sync/atomic" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store" - "github.com/mattermost/mattermost-server/v6/server/platform/services/searchengine" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/services/searchengine" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) type SearchStore struct { diff --git a/server/channels/store/searchlayer/layer_test.go b/server/channels/store/searchlayer/layer_test.go index 3d5948c9c2..b3e7f5a86b 100644 --- a/server/channels/store/searchlayer/layer_test.go +++ b/server/channels/store/searchlayer/layer_test.go @@ -8,12 +8,12 @@ import ( "sync" "testing" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store/searchlayer" - "github.com/mattermost/mattermost-server/v6/server/channels/store/sqlstore" - "github.com/mattermost/mattermost-server/v6/server/channels/store/storetest" - "github.com/mattermost/mattermost-server/v6/server/channels/testlib" - "github.com/mattermost/mattermost-server/v6/server/platform/services/searchengine" + "github.com/mattermost/mattermost-server/server/v8/channels/store/searchlayer" + "github.com/mattermost/mattermost-server/server/v8/channels/store/sqlstore" + "github.com/mattermost/mattermost-server/server/v8/channels/store/storetest" + "github.com/mattermost/mattermost-server/server/v8/channels/testlib" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/services/searchengine" ) // Test to verify race condition on UpdateConfig. The test must run with -race flag in order to verify diff --git a/server/channels/store/searchlayer/post_layer.go b/server/channels/store/searchlayer/post_layer.go index 451e990b2f..a7ad58da30 100644 --- a/server/channels/store/searchlayer/post_layer.go +++ b/server/channels/store/searchlayer/post_layer.go @@ -8,10 +8,10 @@ import ( "github.com/pkg/errors" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store" - "github.com/mattermost/mattermost-server/v6/server/platform/services/searchengine" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/services/searchengine" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) type SearchPostStore struct { diff --git a/server/channels/store/searchlayer/team_layer.go b/server/channels/store/searchlayer/team_layer.go index e80099752f..ed6e8bd124 100644 --- a/server/channels/store/searchlayer/team_layer.go +++ b/server/channels/store/searchlayer/team_layer.go @@ -4,8 +4,8 @@ package searchlayer import ( - model "github.com/mattermost/mattermost-server/v6/model" - store "github.com/mattermost/mattermost-server/v6/server/channels/store" + store "github.com/mattermost/mattermost-server/server/v8/channels/store" + model "github.com/mattermost/mattermost-server/server/v8/model" ) type SearchTeamStore struct { diff --git a/server/channels/store/searchlayer/user_layer.go b/server/channels/store/searchlayer/user_layer.go index fff37e0262..6de44b4213 100644 --- a/server/channels/store/searchlayer/user_layer.go +++ b/server/channels/store/searchlayer/user_layer.go @@ -9,10 +9,10 @@ import ( "github.com/pkg/errors" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store" - "github.com/mattermost/mattermost-server/v6/server/platform/services/searchengine" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/services/searchengine" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) type SearchUserStore struct { diff --git a/server/channels/store/searchtest/channel_layer.go b/server/channels/store/searchtest/channel_layer.go index e5f192412c..f27c2ec2e6 100644 --- a/server/channels/store/searchtest/channel_layer.go +++ b/server/channels/store/searchtest/channel_layer.go @@ -8,8 +8,8 @@ import ( "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" ) var searchChannelStoreTests = []searchTest{ diff --git a/server/channels/store/searchtest/file_info_layer.go b/server/channels/store/searchtest/file_info_layer.go index ff68961da2..09cab23b48 100644 --- a/server/channels/store/searchtest/file_info_layer.go +++ b/server/channels/store/searchtest/file_info_layer.go @@ -9,8 +9,8 @@ import ( "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" ) var searchFileInfoStoreTests = []searchTest{ diff --git a/server/channels/store/searchtest/helper.go b/server/channels/store/searchtest/helper.go index c43aaf8cfa..ff7cec449c 100644 --- a/server/channels/store/searchtest/helper.go +++ b/server/channels/store/searchtest/helper.go @@ -11,8 +11,8 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" ) type SearchTestHelper struct { diff --git a/server/channels/store/searchtest/post_layer.go b/server/channels/store/searchtest/post_layer.go index f152d1e751..8201666dc8 100644 --- a/server/channels/store/searchtest/post_layer.go +++ b/server/channels/store/searchtest/post_layer.go @@ -9,8 +9,8 @@ import ( "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" ) var searchPostStoreTests = []searchTest{ diff --git a/server/channels/store/searchtest/testlib.go b/server/channels/store/searchtest/testlib.go index 0678aa2f35..470caa3113 100644 --- a/server/channels/store/searchtest/testlib.go +++ b/server/channels/store/searchtest/testlib.go @@ -6,8 +6,8 @@ package searchtest import ( "testing" - "github.com/mattermost/mattermost-server/v6/server/channels/store" - "github.com/mattermost/mattermost-server/v6/server/channels/utils" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/utils" ) const ( diff --git a/server/channels/store/searchtest/user_layer.go b/server/channels/store/searchtest/user_layer.go index bb2684b011..7247a9200b 100644 --- a/server/channels/store/searchtest/user_layer.go +++ b/server/channels/store/searchtest/user_layer.go @@ -8,8 +8,8 @@ import ( "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" ) var searchUserStoreTests = []searchTest{ diff --git a/server/channels/store/sqlstore/adapters.go b/server/channels/store/sqlstore/adapters.go index bc05b93fd9..de7d55c787 100644 --- a/server/channels/store/sqlstore/adapters.go +++ b/server/channels/store/sqlstore/adapters.go @@ -10,7 +10,7 @@ import ( "strconv" "strings" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) type jsonArray []string diff --git a/server/channels/store/sqlstore/audit_store.go b/server/channels/store/sqlstore/audit_store.go index 2af2fcf0d0..9e39499646 100644 --- a/server/channels/store/sqlstore/audit_store.go +++ b/server/channels/store/sqlstore/audit_store.go @@ -7,8 +7,8 @@ import ( sq "github.com/mattermost/squirrel" "github.com/pkg/errors" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" ) type SqlAuditStore struct { diff --git a/server/channels/store/sqlstore/audit_store_test.go b/server/channels/store/sqlstore/audit_store_test.go index 19a9cf32bd..4205165717 100644 --- a/server/channels/store/sqlstore/audit_store_test.go +++ b/server/channels/store/sqlstore/audit_store_test.go @@ -6,7 +6,7 @@ package sqlstore import ( "testing" - "github.com/mattermost/mattermost-server/v6/server/channels/store/storetest" + "github.com/mattermost/mattermost-server/server/v8/channels/store/storetest" ) func TestAuditStore(t *testing.T) { diff --git a/server/channels/store/sqlstore/bot_store.go b/server/channels/store/sqlstore/bot_store.go index 5939f5a5f6..8066d90d27 100644 --- a/server/channels/store/sqlstore/bot_store.go +++ b/server/channels/store/sqlstore/bot_store.go @@ -10,9 +10,9 @@ import ( "github.com/pkg/errors" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/einterfaces" - "github.com/mattermost/mattermost-server/v6/server/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/einterfaces" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" ) // bot is a subset of the model.Bot type, omitting the model.User fields. diff --git a/server/channels/store/sqlstore/bot_store_test.go b/server/channels/store/sqlstore/bot_store_test.go index bdc29504e7..725fc814f6 100644 --- a/server/channels/store/sqlstore/bot_store_test.go +++ b/server/channels/store/sqlstore/bot_store_test.go @@ -6,7 +6,7 @@ package sqlstore import ( "testing" - "github.com/mattermost/mattermost-server/v6/server/channels/store/storetest" + "github.com/mattermost/mattermost-server/server/v8/channels/store/storetest" ) func TestBotStore(t *testing.T) { diff --git a/server/channels/store/sqlstore/channel_member_history_store.go b/server/channels/store/sqlstore/channel_member_history_store.go index 30a56352d3..23e3b7ca26 100644 --- a/server/channels/store/sqlstore/channel_member_history_store.go +++ b/server/channels/store/sqlstore/channel_member_history_store.go @@ -10,9 +10,9 @@ import ( sq "github.com/mattermost/squirrel" "github.com/pkg/errors" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) type SqlChannelMemberHistoryStore struct { diff --git a/server/channels/store/sqlstore/channel_member_history_store_test.go b/server/channels/store/sqlstore/channel_member_history_store_test.go index 325d22bfa0..645faf5f91 100644 --- a/server/channels/store/sqlstore/channel_member_history_store_test.go +++ b/server/channels/store/sqlstore/channel_member_history_store_test.go @@ -6,7 +6,7 @@ package sqlstore import ( "testing" - "github.com/mattermost/mattermost-server/v6/server/channels/store/storetest" + "github.com/mattermost/mattermost-server/server/v8/channels/store/storetest" ) func TestChannelMemberHistoryStore(t *testing.T) { diff --git a/server/channels/store/sqlstore/channel_store.go b/server/channels/store/sqlstore/channel_store.go index 76bd520457..73787b6d98 100644 --- a/server/channels/store/sqlstore/channel_store.go +++ b/server/channels/store/sqlstore/channel_store.go @@ -15,11 +15,11 @@ import ( sq "github.com/mattermost/squirrel" "github.com/pkg/errors" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/einterfaces" - "github.com/mattermost/mattermost-server/v6/server/channels/store" - "github.com/mattermost/mattermost-server/v6/server/platform/services/cache" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/einterfaces" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/services/cache" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) const ( @@ -1190,6 +1190,38 @@ func (s SqlChannelStore) GetChannelsByUser(userId string, includeDeleted bool, l return channels, nil } +func (s SqlChannelStore) GetBotChannelsByUser(userId string, opts store.ChannelSearchOpts) (model.ChannelList, error) { + query := s.getQueryBuilder(). + Select("C.*"). + From("Channels as C, ChannelMembers as CM1, ChannelMembers as CM2, Bots as B"). + Where(sq.And{ + sq.Expr("C.Id = CM1.ChannelId"), + sq.Eq{"CM1.UserId": userId}, + sq.Eq{"C.Type": model.ChannelTypeDirect}, + sq.Expr("C.Id = CM2.ChannelId"), + sq.Expr("CM2.UserId = B.UserId"), + sq.Eq{"B.DeleteAt": 0}, + }). + OrderBy("C.Id ASC") + + if !opts.IncludeDeleted { + query = query.Where(sq.Eq{"C.DeleteAt": int(0)}) + } + + sql, args, err := query.ToSql() + if err != nil { + return nil, errors.Wrap(err, "GetBotChannelsByUser_ToSql") + } + + channels := model.ChannelList{} + err = s.GetReplicaX().Select(&channels, sql, args...) + if err != nil { + return nil, errors.Wrapf(err, "failed to get bot channels with UserId=%s", userId) + } + + return channels, nil +} + func (s SqlChannelStore) GetAllChannelMembersById(channelID string) ([]string, error) { sql, args, err := s.channelMembersForTeamWithSchemeSelectQuery.Where(sq.Eq{ "ChannelId": channelID, @@ -3035,7 +3067,8 @@ func (s SqlChannelStore) Autocomplete(userID, term string, includeDeleted, isGue sq.Expr("t.id = tm.TeamId"), sq.Eq{"tm.UserId": userID}, }). - OrderBy("c.DisplayName") + OrderBy("c.DisplayName"). + Limit(model.ChannelSearchDefaultLimit) if !includeDeleted { query = query.Where(sq.And{ @@ -3073,7 +3106,7 @@ func (s SqlChannelStore) Autocomplete(userID, term string, includeDeleted, isGue channels := model.ChannelListWithTeamData{} err = s.GetReplicaX().Select(&channels, sql, args...) if err != nil { - return nil, errors.Wrapf(err, "could not find channel with term=%s", term) + return nil, errors.Wrapf(err, "could not find channel with term=%s", trimInput(term)) } return channels, nil } @@ -3186,7 +3219,7 @@ func (s SqlChannelStore) AutocompleteInTeamForSearch(teamID string, userID strin // query the database err = s.GetReplicaX().Select(&channels, sql, args...) if err != nil { - return nil, errors.Wrapf(err, "failed to find Channels with term='%s'", term) + return nil, errors.Wrapf(err, "failed to find Channels with term='%s'", trimInput(term)) } directChannels, err := s.autocompleteInTeamForSearchDirectMessages(userID, term) @@ -3242,7 +3275,7 @@ func (s SqlChannelStore) autocompleteInTeamForSearchDirectMessages(userID string // query the channel list from the database using SQLX channels := model.ChannelList{} if err := s.GetReplicaX().Select(&channels, sql, args...); err != nil { - return nil, errors.Wrapf(err, "failed to find Channels with term='%s' (%s %% %v)", term, sql, args) + return nil, errors.Wrapf(err, "failed to find Channels with term='%s'", trimInput(term)) } return channels, nil @@ -3461,7 +3494,7 @@ func (s SqlChannelStore) SearchAllChannels(term string, opts store.ChannelSearch } channels := model.ChannelListWithTeamData{} if err2 := s.GetReplicaX().Select(&channels, queryString, args...); err2 != nil { - return nil, 0, errors.Wrapf(err2, "failed to find Channels with term='%s'", term) + return nil, 0, errors.Wrapf(err2, "failed to find Channels with term='%s'", trimInput(term)) } var totalCount int64 @@ -3474,7 +3507,7 @@ func (s SqlChannelStore) SearchAllChannels(term string, opts store.ChannelSearch return nil, 0, errors.Wrap(err, "channel_tosql") } if err2 := s.GetReplicaX().Get(&totalCount, queryString, args...); err2 != nil { - return nil, 0, errors.Wrapf(err2, "failed to find Channels with term='%s'", term) + return nil, 0, errors.Wrapf(err2, "failed to find Channels with term='%s'", trimInput(term)) } } else { totalCount = int64(len(channels)) @@ -3651,7 +3684,7 @@ func (s SqlChannelStore) performSearch(searchQuery sq.SelectBuilder, term string channels := model.ChannelList{} err = s.GetReplicaX().Select(&channels, sql, args...) if err != nil { - return channels, errors.Wrapf(err, "failed to find Channels with term='%s'", term) + return channels, errors.Wrapf(err, "failed to find Channels with term='%s'", trimInput(term)) } return channels, nil @@ -3744,7 +3777,7 @@ func (s SqlChannelStore) SearchGroupChannels(userId, term string) (model.Channel groupChannels := model.ChannelList{} if err := s.GetReplicaX().Select(&groupChannels, sql, params...); err != nil { - return nil, errors.Wrapf(err, "failed to find Channels with term='%s' and userId=%s", term, userId) + return nil, errors.Wrapf(err, "failed to find Channels with term='%s' and userId=%s", trimInput(term), userId) } return groupChannels, nil } diff --git a/server/channels/store/sqlstore/channel_store_categories.go b/server/channels/store/sqlstore/channel_store_categories.go index 528bf26469..1481ae0b1b 100644 --- a/server/channels/store/sqlstore/channel_store_categories.go +++ b/server/channels/store/sqlstore/channel_store_categories.go @@ -10,8 +10,8 @@ import ( sq "github.com/mattermost/squirrel" "github.com/pkg/errors" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" ) // dbSelecter is an interface used to enable some internal store methods @@ -58,11 +58,7 @@ func (s SqlChannelStore) createInitialSidebarCategoriesT(transaction *sqlxTxWrap From("SidebarCategories"). Where(sq.Eq{ "UserId": userId, - "Type": []model.SidebarCategoryType{ - model.SidebarCategoryFavorites, - model.SidebarCategoryChannels, - model.SidebarCategoryDirectMessages, - }, + "Type": model.SystemSidebarCategories, }) if !opts.ExcludeTeam { @@ -157,6 +153,15 @@ func (s SqlChannelStore) createInitialSidebarCategoriesT(transaction *sqlxTxWrap hasInsert = true } + if opts.AppsCategoryEnabled { + teamIDs = getRequiredTeamIDs(model.SidebarCategoryApps, opts) + for _, teamID := range teamIDs { + appsCategoryId := fmt.Sprintf("%s_%s_%s", model.SidebarCategoryApps, userId, teamID) + insertBuilder = insertBuilder.Values(appsCategoryId, userId, teamID, model.DefaultSidebarSortOrderApps, model.SidebarCategorySortDefault, model.SidebarCategoryApps, "Apps" /* This will be retranslated by the client into the user's locale */, false, false) + hasInsert = true + } + } + if hasInsert { sql, args, err := insertBuilder.ToSql() if err != nil { @@ -296,7 +301,7 @@ type sidebarCategoryForJoin struct { ChannelId *string } -func (s SqlChannelStore) CreateSidebarCategory(userId, teamId string, newCategory *model.SidebarCategoryWithChannels) (_ *model.SidebarCategoryWithChannels, err error) { +func (s SqlChannelStore) CreateSidebarCategory(userId, teamId string, newCategory *model.SidebarCategoryWithChannels, options ...*store.SidebarCategorySearchOpts) (_ *model.SidebarCategoryWithChannels, err error) { transaction, err := s.GetMasterX().Beginx() if err != nil { return nil, errors.Wrap(err, "begin_transaction") @@ -304,9 +309,15 @@ func (s SqlChannelStore) CreateSidebarCategory(userId, teamId string, newCategor defer finalizeTransactionX(transaction, &err) + appsCategoryEnabled := false + if len(options) > 0 { + appsCategoryEnabled = options[0].AppsCategoryEnabled + } + opts := &store.SidebarCategorySearchOpts{ - TeamID: teamId, - ExcludeTeam: false, + TeamID: teamId, + ExcludeTeam: false, + AppsCategoryEnabled: appsCategoryEnabled, } categoriesWithOrder, err := s.getSidebarCategoriesT(transaction, userId, opts) if err != nil { @@ -335,7 +346,7 @@ func (s SqlChannelStore) CreateSidebarCategory(userId, teamId string, newCategor Id: newCategoryId, UserId: userId, TeamId: teamId, - Sorting: model.SidebarCategorySortDefault, + Sorting: newCategory.Sorting, SortOrder: int64(model.MinimalSidebarSortDistance * len(newOrder)), // first we place it at the end of the list Type: model.SidebarCategoryCustom, Muted: newCategory.Muted, @@ -418,14 +429,14 @@ func (s SqlChannelStore) CreateSidebarCategory(userId, teamId string, newCategor return result, nil } -func (s SqlChannelStore) completePopulatingCategoryChannels(category *model.SidebarCategoryWithChannels) (_ *model.SidebarCategoryWithChannels, err error) { +func (s SqlChannelStore) completePopulatingCategoryChannels(category *model.SidebarCategoryWithChannels, appsCategoryEnabled bool) (_ *model.SidebarCategoryWithChannels, err error) { transaction, err := s.GetMasterX().Beginx() if err != nil { return nil, errors.Wrap(err, "begin_transaction") } defer finalizeTransactionX(transaction, &err) - result, err := s.completePopulatingCategoryChannelsT(transaction, category) + result, err := s.completePopulatingCategoryChannelsT(transaction, category, appsCategoryEnabled) if err != nil { return nil, err } @@ -437,15 +448,38 @@ func (s SqlChannelStore) completePopulatingCategoryChannels(category *model.Side return result, nil } -func (s SqlChannelStore) completePopulatingCategoryChannelsT(db dbSelecter, category *model.SidebarCategoryWithChannels) (*model.SidebarCategoryWithChannels, error) { +func (s SqlChannelStore) completePopulatingCategoryChannelsT(db dbSelecter, category *model.SidebarCategoryWithChannels, appsCategoryEnabled bool) (*model.SidebarCategoryWithChannels, error) { if category.Type == model.SidebarCategoryCustom || category.Type == model.SidebarCategoryFavorites { return category, nil } var channelTypeFilter sq.Sqlizer - if category.Type == model.SidebarCategoryDirectMessages { - // any DM/GM channels that aren't in any category should be returned as part of the Direct Messages category - channelTypeFilter = sq.Eq{"Channels.Type": []model.ChannelType{model.ChannelTypeDirect, model.ChannelTypeGroup}} + if category.Type == model.SidebarCategoryApps || category.Type == model.SidebarCategoryDirectMessages { + botChannelsIDs := []string{} + if appsCategoryEnabled { + botChannels, err := s.SqlStore.stores.channel.GetBotChannelsByUser(category.UserId, store.ChannelSearchOpts{}) + if err != nil { + return nil, err + } + + for _, botChannel := range botChannels { + botChannelsIDs = append(botChannelsIDs, botChannel.Id) + } + } + + if category.Type == model.SidebarCategoryApps { + // any DM channels with Bots that aren't in any category should be returned as part of the Apps category + channelTypeFilter = sq.And{ + sq.Eq{"Channels.Type": model.ChannelTypeDirect}, + sq.Eq{"Channels.Id": botChannelsIDs}, + } + } else if category.Type == model.SidebarCategoryDirectMessages { + // any DM/GM channels with Users that aren't in any category should be returned as part of the Direct Messages category + channelTypeFilter = sq.And{ + sq.Eq{"Channels.Type": []model.ChannelType{model.ChannelTypeDirect, model.ChannelTypeGroup}}, + sq.NotEq{"Channels.Id": botChannelsIDs}, + } + } } else if category.Type == model.SidebarCategoryChannels { // any public/private channels that are on the current team and aren't in any category should be returned as part of the Channels category channelTypeFilter = sq.And{ @@ -468,6 +502,12 @@ func (s SqlChannelStore) completePopulatingCategoryChannelsT(db dbSelecter, cate }). Suffix(")") + if !appsCategoryEnabled { + doesNotHaveSidebarChannel = doesNotHaveSidebarChannel.Where( + sq.NotEq{"SidebarCategories.Type": model.SidebarCategoryApps}, + ) + } + channels := []string{} sql, args, err := s.getQueryBuilder(). Select("Id"). @@ -492,7 +532,7 @@ func (s SqlChannelStore) completePopulatingCategoryChannelsT(db dbSelecter, cate return category, nil } -func (s SqlChannelStore) GetSidebarCategory(categoryId string) (*model.SidebarCategoryWithChannels, error) { +func (s SqlChannelStore) GetSidebarCategory(categoryId string, options ...*store.SidebarCategorySearchOpts) (*model.SidebarCategoryWithChannels, error) { sql, args, err := s.getQueryBuilder(). Select("SidebarCategories.*", "SidebarChannels.ChannelId"). From("SidebarCategories"). @@ -521,7 +561,13 @@ func (s SqlChannelStore) GetSidebarCategory(categoryId string) (*model.SidebarCa result.Channels = append(result.Channels, *category.ChannelId) } } - return s.completePopulatingCategoryChannels(result) + + appsCategoryEnabled := false + if len(options) > 0 { + appsCategoryEnabled = options[0].AppsCategoryEnabled + } + + return s.completePopulatingCategoryChannels(result, appsCategoryEnabled) } func (s SqlChannelStore) getSidebarCategoriesT(db dbSelecter, userId string, opts *store.SidebarCategorySearchOpts) (*model.OrderedSidebarCategories, error) { @@ -553,6 +599,10 @@ func (s SqlChannelStore) getSidebarCategoriesT(db dbSelecter, userId string, opt query = query.Where(sq.Eq{"SidebarCategories.TeamId": opts.TeamID}) } + if !opts.AppsCategoryEnabled { + query = query.Where(sq.NotEq{"SidebarCategories.Type": model.SidebarCategoryApps}) + } + sql, args, err := query.ToSql() if err != nil { return nil, errors.Wrap(err, "sidebar_categories_tosql") @@ -583,7 +633,7 @@ func (s SqlChannelStore) getSidebarCategoriesT(db dbSelecter, userId string, opt } } for _, category := range oc.Categories { - if _, err := s.completePopulatingCategoryChannelsT(db, category); err != nil { + if _, err := s.completePopulatingCategoryChannelsT(db, category, opts.AppsCategoryEnabled); err != nil { return nil, err } } @@ -591,10 +641,16 @@ func (s SqlChannelStore) getSidebarCategoriesT(db dbSelecter, userId string, opt return &oc, nil } -func (s SqlChannelStore) GetSidebarCategoriesForTeamForUser(userId, teamId string) (*model.OrderedSidebarCategories, error) { +func (s SqlChannelStore) GetSidebarCategoriesForTeamForUser(userId, teamId string, options ...*store.SidebarCategorySearchOpts) (*model.OrderedSidebarCategories, error) { + appsCategoryEnabled := false + if len(options) > 0 { + appsCategoryEnabled = options[0].AppsCategoryEnabled + } + opts := &store.SidebarCategorySearchOpts{ - TeamID: teamId, - ExcludeTeam: false, + TeamID: teamId, + ExcludeTeam: false, + AppsCategoryEnabled: appsCategoryEnabled, } return s.getSidebarCategoriesT(s.GetReplicaX(), userId, opts) } @@ -688,17 +744,22 @@ func (s SqlChannelStore) UpdateSidebarCategoryOrder(userId, teamId string, categ } //nolint:unparam -func (s SqlChannelStore) UpdateSidebarCategories(userId, teamId string, categories []*model.SidebarCategoryWithChannels) (updated []*model.SidebarCategoryWithChannels, original []*model.SidebarCategoryWithChannels, err error) { +func (s SqlChannelStore) UpdateSidebarCategories(userId, teamId string, categories []*model.SidebarCategoryWithChannels, options ...*store.SidebarCategorySearchOpts) (updated []*model.SidebarCategoryWithChannels, original []*model.SidebarCategoryWithChannels, err error) { transaction, err := s.GetMasterX().Beginx() if err != nil { return nil, nil, errors.Wrap(err, "begin_transaction") } defer finalizeTransactionX(transaction, &err) + opts := &store.SidebarCategorySearchOpts{} + if len(options) > 0 { + opts = options[0] + } + updatedCategories := []*model.SidebarCategoryWithChannels{} originalCategories := []*model.SidebarCategoryWithChannels{} for _, category := range categories { - srcCategory, err2 := s.GetSidebarCategory(category.Id) + srcCategory, err2 := s.GetSidebarCategory(category.Id, opts) if err2 != nil { return nil, nil, errors.Wrap(err2, "failed to find SidebarCategories") } @@ -719,7 +780,7 @@ func (s SqlChannelStore) UpdateSidebarCategories(userId, teamId string, categori destCategory.DisplayName = srcCategory.DisplayName } - if destCategory.Type != model.SidebarCategoryDirectMessages { + if destCategory.Type != model.SidebarCategoryDirectMessages && destCategory.Type != model.SidebarCategoryApps { destCategory.Channels = make([]string, len(category.Channels)) copy(destCategory.Channels, category.Channels) @@ -746,7 +807,7 @@ func (s SqlChannelStore) UpdateSidebarCategories(userId, teamId string, categori } // if we are updating DM category, it's order can't channel order cannot be changed. - if category.Type != model.SidebarCategoryDirectMessages { + if category.Type != model.SidebarCategoryDirectMessages && destCategory.Type != model.SidebarCategoryApps { // Remove any SidebarChannels entries that were either: // - previously in this category (and any ones that are still in the category will be recreated below) // - in another category and are being added to this category @@ -843,7 +904,7 @@ func (s SqlChannelStore) UpdateSidebarCategories(userId, teamId string, categori // Ensure Channels are populated for Channels/Direct Messages category if they change for i, updatedCategory := range updatedCategories { - populated, nErr := s.completePopulatingCategoryChannelsT(transaction, updatedCategory) + populated, nErr := s.completePopulatingCategoryChannelsT(transaction, updatedCategory, opts.AppsCategoryEnabled) if nErr != nil { return nil, nil, nErr } diff --git a/server/channels/store/sqlstore/channel_store_categories_test.go b/server/channels/store/sqlstore/channel_store_categories_test.go index 180104f1fd..1514b1ac98 100644 --- a/server/channels/store/sqlstore/channel_store_categories_test.go +++ b/server/channels/store/sqlstore/channel_store_categories_test.go @@ -6,9 +6,10 @@ package sqlstore import ( "testing" - "github.com/mattermost/mattermost-server/v6/server/channels/store/storetest" + "github.com/mattermost/mattermost-server/server/v8/channels/store/storetest" ) func TestChannelStoreCategories(t *testing.T) { StoreTestWithSqlStore(t, storetest.TestChannelStoreCategories) + StoreTestWithSqlStore(t, storetest.TestChannelStoreCategoriesWithAppsCategory) } diff --git a/server/channels/store/sqlstore/channel_store_test.go b/server/channels/store/sqlstore/channel_store_test.go index f68e1573ba..d692b636ad 100644 --- a/server/channels/store/sqlstore/channel_store_test.go +++ b/server/channels/store/sqlstore/channel_store_test.go @@ -10,10 +10,10 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store" - "github.com/mattermost/mattermost-server/v6/server/channels/store/searchtest" - "github.com/mattermost/mattermost-server/v6/server/channels/store/storetest" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/store/searchtest" + "github.com/mattermost/mattermost-server/server/v8/channels/store/storetest" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestChannelStore(t *testing.T) { diff --git a/server/channels/store/sqlstore/cluster_discovery_store.go b/server/channels/store/sqlstore/cluster_discovery_store.go index 1d996bda94..ade94f3da2 100644 --- a/server/channels/store/sqlstore/cluster_discovery_store.go +++ b/server/channels/store/sqlstore/cluster_discovery_store.go @@ -7,8 +7,8 @@ import ( sq "github.com/mattermost/squirrel" "github.com/pkg/errors" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" ) type sqlClusterDiscoveryStore struct { diff --git a/server/channels/store/sqlstore/cluster_discovery_store_test.go b/server/channels/store/sqlstore/cluster_discovery_store_test.go index 8bad17d86d..b17cc39ba6 100644 --- a/server/channels/store/sqlstore/cluster_discovery_store_test.go +++ b/server/channels/store/sqlstore/cluster_discovery_store_test.go @@ -6,7 +6,7 @@ package sqlstore import ( "testing" - "github.com/mattermost/mattermost-server/v6/server/channels/store/storetest" + "github.com/mattermost/mattermost-server/server/v8/channels/store/storetest" ) func TestClusterDiscoveryStore(t *testing.T) { diff --git a/server/channels/store/sqlstore/command_store.go b/server/channels/store/sqlstore/command_store.go index 6f086b346b..aa77b6fece 100644 --- a/server/channels/store/sqlstore/command_store.go +++ b/server/channels/store/sqlstore/command_store.go @@ -10,8 +10,8 @@ import ( sq "github.com/mattermost/squirrel" "github.com/pkg/errors" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" ) type SqlCommandStore struct { diff --git a/server/channels/store/sqlstore/command_store_test.go b/server/channels/store/sqlstore/command_store_test.go index 095f0b1742..7d73561193 100644 --- a/server/channels/store/sqlstore/command_store_test.go +++ b/server/channels/store/sqlstore/command_store_test.go @@ -6,7 +6,7 @@ package sqlstore import ( "testing" - "github.com/mattermost/mattermost-server/v6/server/channels/store/storetest" + "github.com/mattermost/mattermost-server/server/v8/channels/store/storetest" ) func TestCommandStore(t *testing.T) { diff --git a/server/channels/store/sqlstore/command_webhook_store.go b/server/channels/store/sqlstore/command_webhook_store.go index c003390eb6..fd58b8ccf5 100644 --- a/server/channels/store/sqlstore/command_webhook_store.go +++ b/server/channels/store/sqlstore/command_webhook_store.go @@ -9,9 +9,9 @@ import ( sq "github.com/mattermost/squirrel" "github.com/pkg/errors" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) type SqlCommandWebhookStore struct { diff --git a/server/channels/store/sqlstore/command_webhook_store_test.go b/server/channels/store/sqlstore/command_webhook_store_test.go index dc4d4320fc..9e36d26e59 100644 --- a/server/channels/store/sqlstore/command_webhook_store_test.go +++ b/server/channels/store/sqlstore/command_webhook_store_test.go @@ -6,7 +6,7 @@ package sqlstore import ( "testing" - "github.com/mattermost/mattermost-server/v6/server/channels/store/storetest" + "github.com/mattermost/mattermost-server/server/v8/channels/store/storetest" ) func TestCommandWebhookStore(t *testing.T) { diff --git a/server/channels/store/sqlstore/compliance_store.go b/server/channels/store/sqlstore/compliance_store.go index 31d0631f11..f9a997296c 100644 --- a/server/channels/store/sqlstore/compliance_store.go +++ b/server/channels/store/sqlstore/compliance_store.go @@ -12,8 +12,8 @@ import ( sq "github.com/mattermost/squirrel" "github.com/pkg/errors" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" ) type SqlComplianceStore struct { diff --git a/server/channels/store/sqlstore/compliance_store_test.go b/server/channels/store/sqlstore/compliance_store_test.go index b042eb42cb..9e6df0304e 100644 --- a/server/channels/store/sqlstore/compliance_store_test.go +++ b/server/channels/store/sqlstore/compliance_store_test.go @@ -6,7 +6,7 @@ package sqlstore import ( "testing" - "github.com/mattermost/mattermost-server/v6/server/channels/store/storetest" + "github.com/mattermost/mattermost-server/server/v8/channels/store/storetest" ) func TestComplianceStore(t *testing.T) { diff --git a/server/channels/store/sqlstore/draft_store.go b/server/channels/store/sqlstore/draft_store.go index 7d4137a8e5..2e9c86ebfd 100644 --- a/server/channels/store/sqlstore/draft_store.go +++ b/server/channels/store/sqlstore/draft_store.go @@ -10,10 +10,10 @@ import ( sq "github.com/mattermost/squirrel" "github.com/pkg/errors" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/einterfaces" - "github.com/mattermost/mattermost-server/v6/server/channels/store" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/einterfaces" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) type SqlDraftStore struct { diff --git a/server/channels/store/sqlstore/draft_store_test.go b/server/channels/store/sqlstore/draft_store_test.go index ade2221720..f767026621 100644 --- a/server/channels/store/sqlstore/draft_store_test.go +++ b/server/channels/store/sqlstore/draft_store_test.go @@ -6,7 +6,7 @@ package sqlstore import ( "testing" - "github.com/mattermost/mattermost-server/v6/server/channels/store/storetest" + "github.com/mattermost/mattermost-server/server/v8/channels/store/storetest" ) func TestDraftStore(t *testing.T) { diff --git a/server/channels/store/sqlstore/emoji_store.go b/server/channels/store/sqlstore/emoji_store.go index 6099fb78fb..7586ee8edc 100644 --- a/server/channels/store/sqlstore/emoji_store.go +++ b/server/channels/store/sqlstore/emoji_store.go @@ -11,9 +11,9 @@ import ( "github.com/pkg/errors" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/einterfaces" - "github.com/mattermost/mattermost-server/v6/server/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/einterfaces" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" ) type SqlEmojiStore struct { diff --git a/server/channels/store/sqlstore/emoji_store_test.go b/server/channels/store/sqlstore/emoji_store_test.go index 029bb82be0..a0e5ec46dc 100644 --- a/server/channels/store/sqlstore/emoji_store_test.go +++ b/server/channels/store/sqlstore/emoji_store_test.go @@ -6,7 +6,7 @@ package sqlstore import ( "testing" - "github.com/mattermost/mattermost-server/v6/server/channels/store/storetest" + "github.com/mattermost/mattermost-server/server/v8/channels/store/storetest" ) func TestEmojiStore(t *testing.T) { diff --git a/server/channels/store/sqlstore/file_info_store.go b/server/channels/store/sqlstore/file_info_store.go index b54efbe66e..52c5164136 100644 --- a/server/channels/store/sqlstore/file_info_store.go +++ b/server/channels/store/sqlstore/file_info_store.go @@ -14,10 +14,10 @@ import ( sq "github.com/mattermost/squirrel" "github.com/pkg/errors" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/einterfaces" - "github.com/mattermost/mattermost-server/v6/server/channels/store" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/einterfaces" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) type fileInfoWithChannelID struct { @@ -681,7 +681,7 @@ func (fs SqlFileInfoStore) Search(paramsList []*model.SearchParams, userId, team items := []fileInfoWithChannelID{} err = fs.GetSearchReplicaX().Select(&items, queryString, args...) if err != nil { - mlog.Warn("Query error searching files.", mlog.Err(err)) + mlog.Warn("Query error searching files.", mlog.String("error", trimInput(err.Error()))) // Don't return the error to the caller as it is of no use to the user. Instead return an empty set of search results. } else { for _, item := range items { diff --git a/server/channels/store/sqlstore/file_info_store_test.go b/server/channels/store/sqlstore/file_info_store_test.go index 70cfd9b12a..53f67be47c 100644 --- a/server/channels/store/sqlstore/file_info_store_test.go +++ b/server/channels/store/sqlstore/file_info_store_test.go @@ -6,8 +6,8 @@ package sqlstore import ( "testing" - "github.com/mattermost/mattermost-server/v6/server/channels/store/searchtest" - "github.com/mattermost/mattermost-server/v6/server/channels/store/storetest" + "github.com/mattermost/mattermost-server/server/v8/channels/store/searchtest" + "github.com/mattermost/mattermost-server/server/v8/channels/store/storetest" ) func TestFileInfoStore(t *testing.T) { diff --git a/server/channels/store/sqlstore/group_store.go b/server/channels/store/sqlstore/group_store.go index d487b72c45..09f4bb464f 100644 --- a/server/channels/store/sqlstore/group_store.go +++ b/server/channels/store/sqlstore/group_store.go @@ -11,8 +11,8 @@ import ( sq "github.com/mattermost/squirrel" "github.com/pkg/errors" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" ) type selectType int diff --git a/server/channels/store/sqlstore/group_store_test.go b/server/channels/store/sqlstore/group_store_test.go index 7ff6286317..e03ab780af 100644 --- a/server/channels/store/sqlstore/group_store_test.go +++ b/server/channels/store/sqlstore/group_store_test.go @@ -6,7 +6,7 @@ package sqlstore import ( "testing" - "github.com/mattermost/mattermost-server/v6/server/channels/store/storetest" + "github.com/mattermost/mattermost-server/server/v8/channels/store/storetest" ) func TestGroupStore(t *testing.T) { diff --git a/server/channels/store/sqlstore/integrity.go b/server/channels/store/sqlstore/integrity.go index 7c9758b915..71c89d27f5 100644 --- a/server/channels/store/sqlstore/integrity.go +++ b/server/channels/store/sqlstore/integrity.go @@ -6,8 +6,8 @@ package sqlstore import ( sq "github.com/mattermost/squirrel" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) type relationalCheckConfig struct { diff --git a/server/channels/store/sqlstore/integrity_test.go b/server/channels/store/sqlstore/integrity_test.go index b61d325231..896c2911e8 100644 --- a/server/channels/store/sqlstore/integrity_test.go +++ b/server/channels/store/sqlstore/integrity_test.go @@ -8,8 +8,8 @@ import ( "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" ) func createAudit(ss store.Store, userId, sessionId string) *model.Audit { diff --git a/server/channels/store/sqlstore/job_store.go b/server/channels/store/sqlstore/job_store.go index 6dc1e9be85..0543fc5f6e 100644 --- a/server/channels/store/sqlstore/job_store.go +++ b/server/channels/store/sqlstore/job_store.go @@ -13,8 +13,8 @@ import ( sq "github.com/mattermost/squirrel" "github.com/pkg/errors" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" ) const ( diff --git a/server/channels/store/sqlstore/job_store_test.go b/server/channels/store/sqlstore/job_store_test.go index 4c6ae721d4..a7028984df 100644 --- a/server/channels/store/sqlstore/job_store_test.go +++ b/server/channels/store/sqlstore/job_store_test.go @@ -6,7 +6,7 @@ package sqlstore import ( "testing" - "github.com/mattermost/mattermost-server/v6/server/channels/store/storetest" + "github.com/mattermost/mattermost-server/server/v8/channels/store/storetest" ) func TestJobStore(t *testing.T) { diff --git a/server/channels/store/sqlstore/license_store.go b/server/channels/store/sqlstore/license_store.go index 649009c37e..5b8308311e 100644 --- a/server/channels/store/sqlstore/license_store.go +++ b/server/channels/store/sqlstore/license_store.go @@ -7,8 +7,8 @@ import ( sq "github.com/mattermost/squirrel" "github.com/pkg/errors" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" ) // SqlLicenseStore encapsulates the database writes and reads for diff --git a/server/channels/store/sqlstore/license_store_test.go b/server/channels/store/sqlstore/license_store_test.go index bdd0f4af4f..9b9f2aaf71 100644 --- a/server/channels/store/sqlstore/license_store_test.go +++ b/server/channels/store/sqlstore/license_store_test.go @@ -6,7 +6,7 @@ package sqlstore import ( "testing" - "github.com/mattermost/mattermost-server/v6/server/channels/store/storetest" + "github.com/mattermost/mattermost-server/server/v8/channels/store/storetest" ) func TestLicenseStore(t *testing.T) { diff --git a/server/channels/store/sqlstore/link_metadata_store.go b/server/channels/store/sqlstore/link_metadata_store.go index 81014206de..1ffdcd118b 100644 --- a/server/channels/store/sqlstore/link_metadata_store.go +++ b/server/channels/store/sqlstore/link_metadata_store.go @@ -10,8 +10,8 @@ import ( sq "github.com/mattermost/squirrel" "github.com/pkg/errors" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" ) type SqlLinkMetadataStore struct { diff --git a/server/channels/store/sqlstore/link_metadata_store_test.go b/server/channels/store/sqlstore/link_metadata_store_test.go index 4de01f0afc..f5c4dc4fc4 100644 --- a/server/channels/store/sqlstore/link_metadata_store_test.go +++ b/server/channels/store/sqlstore/link_metadata_store_test.go @@ -6,7 +6,7 @@ package sqlstore import ( "testing" - "github.com/mattermost/mattermost-server/v6/server/channels/store/storetest" + "github.com/mattermost/mattermost-server/server/v8/channels/store/storetest" ) func TestLinkMetadataStore(t *testing.T) { diff --git a/server/channels/store/sqlstore/main_test.go b/server/channels/store/sqlstore/main_test.go index 5e4a28467e..fede40f23b 100644 --- a/server/channels/store/sqlstore/main_test.go +++ b/server/channels/store/sqlstore/main_test.go @@ -6,8 +6,8 @@ package sqlstore_test import ( "testing" - "github.com/mattermost/mattermost-server/v6/server/channels/store/sqlstore" - "github.com/mattermost/mattermost-server/v6/server/channels/testlib" + "github.com/mattermost/mattermost-server/server/v8/channels/store/sqlstore" + "github.com/mattermost/mattermost-server/server/v8/channels/testlib" ) var mainHelper *testlib.MainHelper diff --git a/server/channels/store/sqlstore/notify_admin_store.go b/server/channels/store/sqlstore/notify_admin_store.go index db415ea7dc..b9b15757c1 100644 --- a/server/channels/store/sqlstore/notify_admin_store.go +++ b/server/channels/store/sqlstore/notify_admin_store.go @@ -11,8 +11,8 @@ import ( sq "github.com/mattermost/squirrel" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" ) type SqlNotifyAdminStore struct { diff --git a/server/channels/store/sqlstore/notify_admin_store_test.go b/server/channels/store/sqlstore/notify_admin_store_test.go index 2434667140..5737f3d030 100644 --- a/server/channels/store/sqlstore/notify_admin_store_test.go +++ b/server/channels/store/sqlstore/notify_admin_store_test.go @@ -6,7 +6,7 @@ package sqlstore import ( "testing" - "github.com/mattermost/mattermost-server/v6/server/channels/store/storetest" + "github.com/mattermost/mattermost-server/server/v8/channels/store/storetest" ) func TestNotifyAdminStore(t *testing.T) { diff --git a/server/channels/store/sqlstore/oauth_store.go b/server/channels/store/sqlstore/oauth_store.go index ba738b7aa8..7dc35d66b3 100644 --- a/server/channels/store/sqlstore/oauth_store.go +++ b/server/channels/store/sqlstore/oauth_store.go @@ -9,8 +9,8 @@ import ( "github.com/pkg/errors" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" ) type SqlOAuthStore struct { diff --git a/server/channels/store/sqlstore/oauth_store_test.go b/server/channels/store/sqlstore/oauth_store_test.go index 2bef6bc121..d7b528514a 100644 --- a/server/channels/store/sqlstore/oauth_store_test.go +++ b/server/channels/store/sqlstore/oauth_store_test.go @@ -6,7 +6,7 @@ package sqlstore import ( "testing" - "github.com/mattermost/mattermost-server/v6/server/channels/store/storetest" + "github.com/mattermost/mattermost-server/server/v8/channels/store/storetest" ) func TestOAuthStore(t *testing.T) { diff --git a/server/channels/store/sqlstore/plugin_store.go b/server/channels/store/sqlstore/plugin_store.go index 8d8d4884c2..01afa87455 100644 --- a/server/channels/store/sqlstore/plugin_store.go +++ b/server/channels/store/sqlstore/plugin_store.go @@ -11,8 +11,8 @@ import ( sq "github.com/mattermost/squirrel" "github.com/pkg/errors" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" ) const ( diff --git a/server/channels/store/sqlstore/plugin_store_test.go b/server/channels/store/sqlstore/plugin_store_test.go index 09effe6d65..cc5d9a3884 100644 --- a/server/channels/store/sqlstore/plugin_store_test.go +++ b/server/channels/store/sqlstore/plugin_store_test.go @@ -6,7 +6,7 @@ package sqlstore import ( "testing" - "github.com/mattermost/mattermost-server/v6/server/channels/store/storetest" + "github.com/mattermost/mattermost-server/server/v8/channels/store/storetest" ) func TestPluginStore(t *testing.T) { diff --git a/server/channels/store/sqlstore/post_acknowledgements_store.go b/server/channels/store/sqlstore/post_acknowledgements_store.go index 6635082e97..6041109d9e 100644 --- a/server/channels/store/sqlstore/post_acknowledgements_store.go +++ b/server/channels/store/sqlstore/post_acknowledgements_store.go @@ -9,8 +9,8 @@ import ( sq "github.com/mattermost/squirrel" "github.com/pkg/errors" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" ) type SqlPostAcknowledgementStore struct { diff --git a/server/channels/store/sqlstore/post_acknowledgements_store_test.go b/server/channels/store/sqlstore/post_acknowledgements_store_test.go index aa74e69768..55a80af132 100644 --- a/server/channels/store/sqlstore/post_acknowledgements_store_test.go +++ b/server/channels/store/sqlstore/post_acknowledgements_store_test.go @@ -6,7 +6,7 @@ package sqlstore import ( "testing" - "github.com/mattermost/mattermost-server/v6/server/channels/store/storetest" + "github.com/mattermost/mattermost-server/server/v8/channels/store/storetest" ) func TestPostAcknowledgementsStore(t *testing.T) { diff --git a/server/channels/store/sqlstore/post_priority_store.go b/server/channels/store/sqlstore/post_priority_store.go index 34e56488ed..9ac4ca3d0d 100644 --- a/server/channels/store/sqlstore/post_priority_store.go +++ b/server/channels/store/sqlstore/post_priority_store.go @@ -6,8 +6,8 @@ package sqlstore import ( sq "github.com/mattermost/squirrel" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" ) type SqlPostPriorityStore struct { diff --git a/server/channels/store/sqlstore/post_priority_store_test.go b/server/channels/store/sqlstore/post_priority_store_test.go index 0c77ed2f5a..093394f3e7 100644 --- a/server/channels/store/sqlstore/post_priority_store_test.go +++ b/server/channels/store/sqlstore/post_priority_store_test.go @@ -6,7 +6,7 @@ package sqlstore import ( "testing" - "github.com/mattermost/mattermost-server/v6/server/channels/store/storetest" + "github.com/mattermost/mattermost-server/server/v8/channels/store/storetest" ) func TestPostPriorityStore(t *testing.T) { diff --git a/server/channels/store/sqlstore/post_store.go b/server/channels/store/sqlstore/post_store.go index 85854fdb90..ad95fce3a9 100644 --- a/server/channels/store/sqlstore/post_store.go +++ b/server/channels/store/sqlstore/post_store.go @@ -17,12 +17,12 @@ import ( sq "github.com/mattermost/squirrel" "github.com/pkg/errors" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/einterfaces" - "github.com/mattermost/mattermost-server/v6/server/channels/store" - "github.com/mattermost/mattermost-server/v6/server/channels/store/searchlayer" - "github.com/mattermost/mattermost-server/v6/server/channels/utils" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/einterfaces" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/store/searchlayer" + "github.com/mattermost/mattermost-server/server/v8/channels/utils" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) type SqlPostStore struct { @@ -2075,7 +2075,7 @@ func (s *SqlPostStore) search(teamId string, userId string, params *model.Search var posts []*model.Post if err := s.GetSearchReplicaX().Select(&posts, searchQuery, searchQueryArgs...); err != nil { - mlog.Warn("Query error searching posts.", mlog.Err(err)) + mlog.Warn("Query error searching posts.", mlog.String("error", trimInput(err.Error()))) // Don't return the error to the caller as it is of no use to the user. Instead return an empty set of search results. } else { for _, p := range posts { diff --git a/server/channels/store/sqlstore/post_store_test.go b/server/channels/store/sqlstore/post_store_test.go index 2a4c296001..72fdc51043 100644 --- a/server/channels/store/sqlstore/post_store_test.go +++ b/server/channels/store/sqlstore/post_store_test.go @@ -8,8 +8,8 @@ import ( "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/server/channels/store/searchtest" - "github.com/mattermost/mattermost-server/v6/server/channels/store/storetest" + "github.com/mattermost/mattermost-server/server/v8/channels/store/searchtest" + "github.com/mattermost/mattermost-server/server/v8/channels/store/storetest" ) func TestPostStore(t *testing.T) { diff --git a/server/channels/store/sqlstore/preference_store.go b/server/channels/store/sqlstore/preference_store.go index db426ebc8f..e68f4a3801 100644 --- a/server/channels/store/sqlstore/preference_store.go +++ b/server/channels/store/sqlstore/preference_store.go @@ -7,9 +7,9 @@ import ( sq "github.com/mattermost/squirrel" "github.com/pkg/errors" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) type SqlPreferenceStore struct { diff --git a/server/channels/store/sqlstore/preference_store_test.go b/server/channels/store/sqlstore/preference_store_test.go index f91f1a6ce3..34e7f5fc1c 100644 --- a/server/channels/store/sqlstore/preference_store_test.go +++ b/server/channels/store/sqlstore/preference_store_test.go @@ -8,9 +8,9 @@ import ( "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store" - "github.com/mattermost/mattermost-server/v6/server/channels/store/storetest" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/store/storetest" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestPreferenceStore(t *testing.T) { diff --git a/server/channels/store/sqlstore/product_notices_store.go b/server/channels/store/sqlstore/product_notices_store.go index 4ff5bf5ca3..d1f3d2efab 100644 --- a/server/channels/store/sqlstore/product_notices_store.go +++ b/server/channels/store/sqlstore/product_notices_store.go @@ -9,8 +9,8 @@ import ( sq "github.com/mattermost/squirrel" "github.com/pkg/errors" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" ) type SqlProductNoticesStore struct { diff --git a/server/channels/store/sqlstore/product_notices_store_test.go b/server/channels/store/sqlstore/product_notices_store_test.go index 7f0f4373d7..f30f7e15a2 100644 --- a/server/channels/store/sqlstore/product_notices_store_test.go +++ b/server/channels/store/sqlstore/product_notices_store_test.go @@ -6,7 +6,7 @@ package sqlstore import ( "testing" - "github.com/mattermost/mattermost-server/v6/server/channels/store/storetest" + "github.com/mattermost/mattermost-server/server/v8/channels/store/storetest" ) func TestProductNoticesStore(t *testing.T) { diff --git a/server/channels/store/sqlstore/reaction_store.go b/server/channels/store/sqlstore/reaction_store.go index 3b66228c22..220a1d33f7 100644 --- a/server/channels/store/sqlstore/reaction_store.go +++ b/server/channels/store/sqlstore/reaction_store.go @@ -6,9 +6,9 @@ package sqlstore import ( sq "github.com/mattermost/squirrel" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" "github.com/pkg/errors" ) diff --git a/server/channels/store/sqlstore/reaction_store_test.go b/server/channels/store/sqlstore/reaction_store_test.go index 3f458b61d1..e9ceb95df4 100644 --- a/server/channels/store/sqlstore/reaction_store_test.go +++ b/server/channels/store/sqlstore/reaction_store_test.go @@ -6,7 +6,7 @@ package sqlstore import ( "testing" - "github.com/mattermost/mattermost-server/v6/server/channels/store/storetest" + "github.com/mattermost/mattermost-server/server/v8/channels/store/storetest" ) func TestReactionStore(t *testing.T) { diff --git a/server/channels/store/sqlstore/remote_cluster_store.go b/server/channels/store/sqlstore/remote_cluster_store.go index e049e197db..11c7a8c138 100644 --- a/server/channels/store/sqlstore/remote_cluster_store.go +++ b/server/channels/store/sqlstore/remote_cluster_store.go @@ -10,8 +10,8 @@ import ( sq "github.com/mattermost/squirrel" "github.com/pkg/errors" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" ) type sqlRemoteClusterStore struct { diff --git a/server/channels/store/sqlstore/remote_cluster_store_test.go b/server/channels/store/sqlstore/remote_cluster_store_test.go index a5f5cf1b21..097343c42e 100644 --- a/server/channels/store/sqlstore/remote_cluster_store_test.go +++ b/server/channels/store/sqlstore/remote_cluster_store_test.go @@ -6,7 +6,7 @@ package sqlstore import ( "testing" - "github.com/mattermost/mattermost-server/v6/server/channels/store/storetest" + "github.com/mattermost/mattermost-server/server/v8/channels/store/storetest" ) func TestRemoteClusterStore(t *testing.T) { diff --git a/server/channels/store/sqlstore/retention_policy_store.go b/server/channels/store/sqlstore/retention_policy_store.go index 8ff793eb98..cc8b6280ff 100644 --- a/server/channels/store/sqlstore/retention_policy_store.go +++ b/server/channels/store/sqlstore/retention_policy_store.go @@ -14,9 +14,9 @@ import ( sq "github.com/mattermost/squirrel" "github.com/pkg/errors" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/einterfaces" - "github.com/mattermost/mattermost-server/v6/server/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/einterfaces" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" ) type SqlRetentionPolicyStore struct { diff --git a/server/channels/store/sqlstore/retention_policy_store_test.go b/server/channels/store/sqlstore/retention_policy_store_test.go index cabc49bca6..5ea674a5ab 100644 --- a/server/channels/store/sqlstore/retention_policy_store_test.go +++ b/server/channels/store/sqlstore/retention_policy_store_test.go @@ -6,7 +6,7 @@ package sqlstore import ( "testing" - "github.com/mattermost/mattermost-server/v6/server/channels/store/storetest" + "github.com/mattermost/mattermost-server/server/v8/channels/store/storetest" ) func TestRetentionPolicyStore(t *testing.T) { diff --git a/server/channels/store/sqlstore/role_store.go b/server/channels/store/sqlstore/role_store.go index 50f46c0304..df6095a40c 100644 --- a/server/channels/store/sqlstore/role_store.go +++ b/server/channels/store/sqlstore/role_store.go @@ -12,8 +12,8 @@ import ( sq "github.com/mattermost/squirrel" "github.com/pkg/errors" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" ) type SqlRoleStore struct { diff --git a/server/channels/store/sqlstore/role_store_test.go b/server/channels/store/sqlstore/role_store_test.go index 63d0639bbd..c96bcb7dc1 100644 --- a/server/channels/store/sqlstore/role_store_test.go +++ b/server/channels/store/sqlstore/role_store_test.go @@ -6,7 +6,7 @@ package sqlstore import ( "testing" - "github.com/mattermost/mattermost-server/v6/server/channels/store/storetest" + "github.com/mattermost/mattermost-server/server/v8/channels/store/storetest" ) func TestRoleStore(t *testing.T) { diff --git a/server/channels/store/sqlstore/scheme_store.go b/server/channels/store/sqlstore/scheme_store.go index 99abeb220d..3a4541688f 100644 --- a/server/channels/store/sqlstore/scheme_store.go +++ b/server/channels/store/sqlstore/scheme_store.go @@ -10,8 +10,8 @@ import ( sq "github.com/mattermost/squirrel" "github.com/pkg/errors" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" ) const ( diff --git a/server/channels/store/sqlstore/scheme_store_test.go b/server/channels/store/sqlstore/scheme_store_test.go index 2b9b440b7d..cef9352193 100644 --- a/server/channels/store/sqlstore/scheme_store_test.go +++ b/server/channels/store/sqlstore/scheme_store_test.go @@ -6,7 +6,7 @@ package sqlstore import ( "testing" - "github.com/mattermost/mattermost-server/v6/server/channels/store/storetest" + "github.com/mattermost/mattermost-server/server/v8/channels/store/storetest" ) func TestSchemeStore(t *testing.T) { diff --git a/server/channels/store/sqlstore/session_store.go b/server/channels/store/sqlstore/session_store.go index 851336dbc6..474742feb8 100644 --- a/server/channels/store/sqlstore/session_store.go +++ b/server/channels/store/sqlstore/session_store.go @@ -12,8 +12,8 @@ import ( sq "github.com/mattermost/squirrel" "github.com/pkg/errors" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" ) const ( diff --git a/server/channels/store/sqlstore/session_store_test.go b/server/channels/store/sqlstore/session_store_test.go index c25c443f84..52d94b98f3 100644 --- a/server/channels/store/sqlstore/session_store_test.go +++ b/server/channels/store/sqlstore/session_store_test.go @@ -6,7 +6,7 @@ package sqlstore import ( "testing" - "github.com/mattermost/mattermost-server/v6/server/channels/store/storetest" + "github.com/mattermost/mattermost-server/server/v8/channels/store/storetest" ) func TestSessionStore(t *testing.T) { diff --git a/server/channels/store/sqlstore/shared_channel_store.go b/server/channels/store/sqlstore/shared_channel_store.go index f8afdfa4b2..85a6583fa4 100644 --- a/server/channels/store/sqlstore/shared_channel_store.go +++ b/server/channels/store/sqlstore/shared_channel_store.go @@ -8,8 +8,8 @@ import ( "fmt" "strings" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" sq "github.com/mattermost/squirrel" "github.com/pkg/errors" diff --git a/server/channels/store/sqlstore/shared_channel_store_test.go b/server/channels/store/sqlstore/shared_channel_store_test.go index 95532f1654..1133184659 100644 --- a/server/channels/store/sqlstore/shared_channel_store_test.go +++ b/server/channels/store/sqlstore/shared_channel_store_test.go @@ -6,7 +6,7 @@ package sqlstore import ( "testing" - "github.com/mattermost/mattermost-server/v6/server/channels/store/storetest" + "github.com/mattermost/mattermost-server/server/v8/channels/store/storetest" ) func TestSharedChannelStore(t *testing.T) { diff --git a/server/channels/store/sqlstore/sqlx_wrapper.go b/server/channels/store/sqlstore/sqlx_wrapper.go index 3e21ef3ab3..e8d771cada 100644 --- a/server/channels/store/sqlstore/sqlx_wrapper.go +++ b/server/channels/store/sqlstore/sqlx_wrapper.go @@ -6,17 +6,20 @@ package sqlstore import ( "context" "database/sql" + "errors" + "net" "regexp" "strconv" "strings" + "sync/atomic" "time" "unicode" "github.com/jmoiron/sqlx" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store/storetest" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/store/storetest" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) type StoreTestWrapper struct { @@ -66,14 +69,18 @@ type sqlxDBWrapper struct { *sqlx.DB queryTimeout time.Duration trace bool + isOnline *atomic.Bool } func newSqlxDBWrapper(db *sqlx.DB, timeout time.Duration, trace bool) *sqlxDBWrapper { - return &sqlxDBWrapper{ + w := &sqlxDBWrapper{ DB: db, queryTimeout: timeout, trace: trace, + isOnline: &atomic.Bool{}, } + w.isOnline.Store(true) + return w } func (w *sqlxDBWrapper) Stats() sql.DBStats { @@ -83,19 +90,19 @@ func (w *sqlxDBWrapper) Stats() sql.DBStats { func (w *sqlxDBWrapper) Beginx() (*sqlxTxWrapper, error) { tx, err := w.DB.Beginx() if err != nil { - return nil, err + return nil, w.checkErr(err) } - return newSqlxTxWrapper(tx, w.queryTimeout, w.trace), nil + return newSqlxTxWrapper(tx, w.queryTimeout, w.trace, w), nil } func (w *sqlxDBWrapper) BeginXWithIsolation(opts *sql.TxOptions) (*sqlxTxWrapper, error) { tx, err := w.DB.BeginTxx(context.Background(), opts) if err != nil { - return nil, err + return nil, w.checkErr(err) } - return newSqlxTxWrapper(tx, w.queryTimeout, w.trace), nil + return newSqlxTxWrapper(tx, w.queryTimeout, w.trace, w), nil } func (w *sqlxDBWrapper) Get(dest any, query string, args ...any) error { @@ -109,7 +116,7 @@ func (w *sqlxDBWrapper) Get(dest any, query string, args ...any) error { }(time.Now()) } - return w.DB.GetContext(ctx, dest, query, args...) + return w.checkErr(w.DB.GetContext(ctx, dest, query, args...)) } func (w *sqlxDBWrapper) GetBuilder(dest any, builder Builder) error { @@ -134,7 +141,7 @@ func (w *sqlxDBWrapper) NamedExec(query string, arg any) (sql.Result, error) { }(time.Now()) } - return w.DB.NamedExecContext(ctx, query, arg) + return w.checkErrWithResult(w.DB.NamedExecContext(ctx, query, arg)) } func (w *sqlxDBWrapper) Exec(query string, args ...any) (sql.Result, error) { @@ -161,7 +168,7 @@ func (w *sqlxDBWrapper) ExecNoTimeout(query string, args ...any) (sql.Result, er }(time.Now()) } - return w.DB.ExecContext(context.Background(), query, args...) + return w.checkErrWithResult(w.DB.ExecContext(context.Background(), query, args...)) } // ExecRaw is like Exec but without any rebinding of params. You need to pass @@ -176,7 +183,7 @@ func (w *sqlxDBWrapper) ExecRaw(query string, args ...any) (sql.Result, error) { }(time.Now()) } - return w.DB.ExecContext(ctx, query, args...) + return w.checkErrWithResult(w.DB.ExecContext(ctx, query, args...)) } func (w *sqlxDBWrapper) NamedQuery(query string, arg any) (*sqlx.Rows, error) { @@ -192,7 +199,7 @@ func (w *sqlxDBWrapper) NamedQuery(query string, arg any) (*sqlx.Rows, error) { }(time.Now()) } - return w.DB.NamedQueryContext(ctx, query, arg) + return w.checkErrWithRows(w.DB.NamedQueryContext(ctx, query, arg)) } func (w *sqlxDBWrapper) QueryRowX(query string, args ...any) *sqlx.Row { @@ -220,7 +227,7 @@ func (w *sqlxDBWrapper) QueryX(query string, args ...any) (*sqlx.Rows, error) { }(time.Now()) } - return w.DB.QueryxContext(ctx, query, args) + return w.checkErrWithRows(w.DB.QueryxContext(ctx, query, args)) } func (w *sqlxDBWrapper) Select(dest any, query string, args ...any) error { @@ -238,7 +245,7 @@ func (w *sqlxDBWrapper) SelectCtx(ctx context.Context, dest any, query string, a }(time.Now()) } - return w.DB.SelectContext(ctx, dest, query, args...) + return w.checkErr(w.DB.SelectContext(ctx, dest, query, args...)) } func (w *sqlxDBWrapper) SelectBuilder(dest any, builder Builder) error { @@ -254,13 +261,15 @@ type sqlxTxWrapper struct { *sqlx.Tx queryTimeout time.Duration trace bool + dbw *sqlxDBWrapper } -func newSqlxTxWrapper(tx *sqlx.Tx, timeout time.Duration, trace bool) *sqlxTxWrapper { +func newSqlxTxWrapper(tx *sqlx.Tx, timeout time.Duration, trace bool, dbw *sqlxDBWrapper) *sqlxTxWrapper { return &sqlxTxWrapper{ Tx: tx, queryTimeout: timeout, trace: trace, + dbw: dbw, } } @@ -275,7 +284,7 @@ func (w *sqlxTxWrapper) Get(dest any, query string, args ...any) error { }(time.Now()) } - return w.Tx.GetContext(ctx, dest, query, args...) + return w.dbw.checkErr(w.Tx.GetContext(ctx, dest, query, args...)) } func (w *sqlxTxWrapper) GetBuilder(dest any, builder Builder) error { @@ -284,13 +293,13 @@ func (w *sqlxTxWrapper) GetBuilder(dest any, builder Builder) error { return err } - return w.Get(dest, query, args...) + return w.dbw.checkErr(w.Get(dest, query, args...)) } func (w *sqlxTxWrapper) Exec(query string, args ...any) (sql.Result, error) { query = w.Tx.Rebind(query) - return w.ExecRaw(query, args...) + return w.dbw.checkErrWithResult(w.ExecRaw(query, args...)) } func (w *sqlxTxWrapper) ExecNoTimeout(query string, args ...any) (sql.Result, error) { @@ -302,7 +311,7 @@ func (w *sqlxTxWrapper) ExecNoTimeout(query string, args ...any) (sql.Result, er }(time.Now()) } - return w.Tx.ExecContext(context.Background(), query, args...) + return w.dbw.checkErrWithResult(w.Tx.ExecContext(context.Background(), query, args...)) } func (w *sqlxTxWrapper) ExecBuilder(builder Builder) (sql.Result, error) { @@ -326,7 +335,7 @@ func (w *sqlxTxWrapper) ExecRaw(query string, args ...any) (sql.Result, error) { }(time.Now()) } - return w.Tx.ExecContext(ctx, query, args...) + return w.dbw.checkErrWithResult(w.Tx.ExecContext(ctx, query, args...)) } func (w *sqlxTxWrapper) NamedExec(query string, arg any) (sql.Result, error) { @@ -342,7 +351,7 @@ func (w *sqlxTxWrapper) NamedExec(query string, arg any) (sql.Result, error) { }(time.Now()) } - return w.Tx.NamedExecContext(ctx, query, arg) + return w.dbw.checkErrWithResult(w.Tx.NamedExecContext(ctx, query, arg)) } func (w *sqlxTxWrapper) NamedQuery(query string, arg any) (*sqlx.Rows, error) { @@ -386,7 +395,7 @@ func (w *sqlxTxWrapper) NamedQuery(query string, arg any) (*sqlx.Rows, error) { } } - return res.rows, res.err + return res.rows, w.dbw.checkErr(res.err) } func (w *sqlxTxWrapper) QueryRowX(query string, args ...any) *sqlx.Row { @@ -414,7 +423,7 @@ func (w *sqlxTxWrapper) QueryX(query string, args ...any) (*sqlx.Rows, error) { }(time.Now()) } - return w.Tx.QueryxContext(ctx, query, args) + return w.dbw.checkErrWithRows(w.Tx.QueryxContext(ctx, query, args)) } func (w *sqlxTxWrapper) Select(dest any, query string, args ...any) error { @@ -428,7 +437,7 @@ func (w *sqlxTxWrapper) Select(dest any, query string, args ...any) error { }(time.Now()) } - return w.Tx.SelectContext(ctx, dest, query, args...) + return w.dbw.checkErr(w.Tx.SelectContext(ctx, dest, query, args...)) } func (w *sqlxTxWrapper) SelectBuilder(dest any, builder Builder) error { @@ -459,3 +468,23 @@ func printArgs(query string, dur time.Duration, args ...any) { } mlog.Debug(query, fields...) } + +func (w *sqlxDBWrapper) checkErrWithResult(res sql.Result, err error) (sql.Result, error) { + return res, w.checkErr(err) +} + +func (w *sqlxDBWrapper) checkErrWithRows(res *sqlx.Rows, err error) (*sqlx.Rows, error) { + return res, w.checkErr(err) +} + +func (w *sqlxDBWrapper) checkErr(err error) error { + var netError *net.OpError + if errors.As(err, &netError) && (!netError.Temporary() && !netError.Timeout()) { + w.isOnline.Store(false) + } + return err +} + +func (w *sqlxDBWrapper) Online() bool { + return w.isOnline.Load() +} diff --git a/server/channels/store/sqlstore/sqlx_wrapper_test.go b/server/channels/store/sqlstore/sqlx_wrapper_test.go index 53490199c8..c03d228935 100644 --- a/server/channels/store/sqlstore/sqlx_wrapper_test.go +++ b/server/channels/store/sqlstore/sqlx_wrapper_test.go @@ -6,12 +6,13 @@ package sqlstore import ( "context" "strings" + "sync" "testing" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestSqlX(t *testing.T) { @@ -28,12 +29,14 @@ func TestSqlX(t *testing.T) { } *settings.QueryTimeout = 1 store := &SqlStore{ - rrCounter: 0, - srCounter: 0, - settings: settings, + rrCounter: 0, + srCounter: 0, + settings: settings, + quitMonitor: make(chan struct{}), + wgMonitor: &sync.WaitGroup{}, } - store.initConnection() + require.NoError(t, store.initConnection()) defer store.Close() diff --git a/server/channels/store/sqlstore/status_store.go b/server/channels/store/sqlstore/status_store.go index 820db064eb..5791a6816a 100644 --- a/server/channels/store/sqlstore/status_store.go +++ b/server/channels/store/sqlstore/status_store.go @@ -11,8 +11,8 @@ import ( sq "github.com/mattermost/squirrel" "github.com/pkg/errors" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" ) type SqlStatusStore struct { diff --git a/server/channels/store/sqlstore/status_store_test.go b/server/channels/store/sqlstore/status_store_test.go index 6d2f34c018..a40b93c9a6 100644 --- a/server/channels/store/sqlstore/status_store_test.go +++ b/server/channels/store/sqlstore/status_store_test.go @@ -6,7 +6,7 @@ package sqlstore import ( "testing" - "github.com/mattermost/mattermost-server/v6/server/channels/store/storetest" + "github.com/mattermost/mattermost-server/server/v8/channels/store/storetest" ) func TestStatusStore(t *testing.T) { diff --git a/server/channels/store/sqlstore/store.go b/server/channels/store/sqlstore/store.go index 8000384e95..acd02b0853 100644 --- a/server/channels/store/sqlstore/store.go +++ b/server/channels/store/sqlstore/store.go @@ -30,11 +30,11 @@ import ( mbindata "github.com/mattermost/morph/sources/embedded" "github.com/pkg/errors" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/db" - "github.com/mattermost/mattermost-server/v6/server/channels/einterfaces" - "github.com/mattermost/mattermost-server/v6/server/channels/store" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/db" + "github.com/mattermost/mattermost-server/server/v8/channels/einterfaces" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) type migrationDirection string @@ -49,7 +49,7 @@ const ( MySQLForeignKeyViolationErrorCode = 1452 PGDuplicateObjectErrorCode = "42710" MySQLDuplicateObjectErrorCode = 1022 - DBPingAttempts = 18 + DBPingAttempts = 5 DBPingTimeoutSecs = 10 // This is a numerical version string by postgres. The format is // 2 characters for major, minor, and patch version prior to 10. @@ -117,15 +117,15 @@ type SqlStoreStores struct { type SqlStore struct { // rrCounter and srCounter should be kept first. - // See https://github.com/mattermost/mattermost-server/v6/server/channels/pull/7281 + // See https://github.com/mattermost/mattermost-server/server/v8/channels/pull/7281 rrCounter int64 srCounter int64 masterX *sqlxDBWrapper - ReplicaXs []*sqlxDBWrapper + ReplicaXs []*atomic.Pointer[sqlxDBWrapper] - searchReplicaXs []*sqlxDBWrapper + searchReplicaXs []*atomic.Pointer[sqlxDBWrapper] replicaLagHandles []*dbsql.DB stores SqlStoreStores @@ -138,17 +138,28 @@ type SqlStore struct { isBinaryParam bool pgDefaultTextSearchConfig string + + quitMonitor chan struct{} + wgMonitor *sync.WaitGroup } func New(settings model.SqlSettings, metrics einterfaces.MetricsInterface) *SqlStore { store := &SqlStore{ - rrCounter: 0, - srCounter: 0, - settings: &settings, - metrics: metrics, + rrCounter: 0, + srCounter: 0, + settings: &settings, + metrics: metrics, + quitMonitor: make(chan struct{}), + wgMonitor: &sync.WaitGroup{}, } - store.initConnection() + err := store.initConnection() + if err != nil { + mlog.Fatal("Error setting up connections", mlog.Err(err)) + } + + store.wgMonitor.Add(1) + go store.monitorReplicas() ver, err := store.GetDbVersion(true) if err != nil { @@ -230,29 +241,28 @@ func New(settings model.SqlSettings, metrics einterfaces.MetricsInterface) *SqlS // SetupConnection sets up the connection to the database and pings it to make sure it's alive. // It also applies any database configuration settings that are required. -func SetupConnection(connType string, dataSource string, settings *model.SqlSettings) *dbsql.DB { +func SetupConnection(connType string, dataSource string, settings *model.SqlSettings, attempts int) (*dbsql.DB, error) { db, err := dbsql.Open(*settings.DriverName, dataSource) if err != nil { - mlog.Fatal("Failed to open SQL connection to err.", mlog.Err(err)) + return nil, errors.Wrap(err, "failed to open SQL connection") } - for i := 0; i < DBPingAttempts; i++ { + for i := 0; i < attempts; i++ { // At this point, we have passed sql.Open, so we deliberately ignore any errors. sanitized, _ := SanitizeDataSource(*settings.DriverName, dataSource) mlog.Info("Pinging SQL", mlog.String("database", connType), mlog.String("dataSource", sanitized)) ctx, cancel := context.WithTimeout(context.Background(), DBPingTimeoutSecs*time.Second) defer cancel() err = db.PingContext(ctx) - if err == nil { - break - } else { - if i == DBPingAttempts-1 { - mlog.Fatal("Failed to ping DB, server will exit.", mlog.Err(err)) - } else { - mlog.Error("Failed to ping DB", mlog.Err(err), mlog.Int("retrying in seconds", DBPingTimeoutSecs)) - time.Sleep(DBPingTimeoutSecs * time.Second) + if err != nil { + if i == attempts-1 { + return nil, err } + mlog.Error("Failed to ping DB", mlog.Err(err), mlog.Int("retrying in seconds", DBPingTimeoutSecs)) + time.Sleep(DBPingTimeoutSecs * time.Second) + continue } + break } if strings.HasPrefix(connType, replicaLagPrefix) { @@ -272,7 +282,7 @@ func SetupConnection(connType string, dataSource string, settings *model.SqlSett db.SetConnMaxLifetime(time.Duration(*settings.ConnMaxLifetimeMilliseconds) * time.Millisecond) db.SetConnMaxIdleTime(time.Duration(*settings.ConnMaxIdleTimeMilliseconds) * time.Millisecond) - return db + return db, nil } func (ss *SqlStore) SetContext(context context.Context) { @@ -285,7 +295,7 @@ func (ss *SqlStore) Context() context.Context { func noOpMapper(s string) string { return s } -func (ss *SqlStore) initConnection() { +func (ss *SqlStore) initConnection() error { dataSource := *ss.settings.DataSource if ss.DriverName() == model.DatabaseDriverMysql { // TODO: We ignore the readTimeout datasource parameter for MySQL since QueryTimeout @@ -294,11 +304,14 @@ func (ss *SqlStore) initConnection() { var err error dataSource, err = ResetReadTimeout(dataSource) if err != nil { - mlog.Fatal("Failed to reset read timeout from datasource.", mlog.Err(err), mlog.String("src", dataSource)) + return errors.Wrap(err, "failed to reset read timeout from datasource") } } - handle := SetupConnection("master", dataSource, ss.settings) + handle, err := SetupConnection("master", dataSource, ss.settings, DBPingAttempts) + if err != nil { + return err + } ss.masterX = newSqlxDBWrapper(sqlx.NewDb(handle, ss.DriverName()), time.Duration(*ss.settings.QueryTimeout)*time.Second, *ss.settings.Trace) @@ -310,34 +323,32 @@ func (ss *SqlStore) initConnection() { } if len(ss.settings.DataSourceReplicas) > 0 { - ss.ReplicaXs = make([]*sqlxDBWrapper, len(ss.settings.DataSourceReplicas)) + ss.ReplicaXs = make([]*atomic.Pointer[sqlxDBWrapper], len(ss.settings.DataSourceReplicas)) for i, replica := range ss.settings.DataSourceReplicas { - handle := SetupConnection(fmt.Sprintf("replica-%v", i), replica, ss.settings) - ss.ReplicaXs[i] = newSqlxDBWrapper(sqlx.NewDb(handle, ss.DriverName()), - time.Duration(*ss.settings.QueryTimeout)*time.Second, - *ss.settings.Trace) - if ss.DriverName() == model.DatabaseDriverMysql { - ss.ReplicaXs[i].MapperFunc(noOpMapper) - } - if ss.metrics != nil { - ss.metrics.RegisterDBCollector(ss.ReplicaXs[i].DB.DB, "replica-"+strconv.Itoa(i)) + ss.ReplicaXs[i] = &atomic.Pointer[sqlxDBWrapper]{} + handle, err = SetupConnection(fmt.Sprintf("replica-%v", i), replica, ss.settings, DBPingAttempts) + if err != nil { + // Initializing to be offline + ss.ReplicaXs[i].Store(&sqlxDBWrapper{isOnline: &atomic.Bool{}}) + mlog.Warn("Failed to setup connection. Skipping..", mlog.String("db", fmt.Sprintf("replica-%v", i)), mlog.Err(err)) + continue } + ss.setDB(ss.ReplicaXs[i], handle, "replica-"+strconv.Itoa(i)) } } if len(ss.settings.DataSourceSearchReplicas) > 0 { - ss.searchReplicaXs = make([]*sqlxDBWrapper, len(ss.settings.DataSourceSearchReplicas)) + ss.searchReplicaXs = make([]*atomic.Pointer[sqlxDBWrapper], len(ss.settings.DataSourceSearchReplicas)) for i, replica := range ss.settings.DataSourceSearchReplicas { - handle := SetupConnection(fmt.Sprintf("search-replica-%v", i), replica, ss.settings) - ss.searchReplicaXs[i] = newSqlxDBWrapper(sqlx.NewDb(handle, ss.DriverName()), - time.Duration(*ss.settings.QueryTimeout)*time.Second, - *ss.settings.Trace) - if ss.DriverName() == model.DatabaseDriverMysql { - ss.searchReplicaXs[i].MapperFunc(noOpMapper) - } - if ss.metrics != nil { - ss.metrics.RegisterDBCollector(ss.searchReplicaXs[i].DB.DB, "searchreplica-"+strconv.Itoa(i)) + ss.searchReplicaXs[i] = &atomic.Pointer[sqlxDBWrapper]{} + handle, err = SetupConnection(fmt.Sprintf("search-replica-%v", i), replica, ss.settings, DBPingAttempts) + if err != nil { + // Initializing to be offline + ss.searchReplicaXs[i].Store(&sqlxDBWrapper{isOnline: &atomic.Bool{}}) + mlog.Warn("Failed to setup connection. Skipping..", mlog.String("db", fmt.Sprintf("search-replica-%v", i)), mlog.Err(err)) + continue } + ss.setDB(ss.searchReplicaXs[i], handle, "searchreplica-"+strconv.Itoa(i)) } } @@ -347,9 +358,14 @@ func (ss *SqlStore) initConnection() { if src.DataSource == nil { continue } - ss.replicaLagHandles[i] = SetupConnection(fmt.Sprintf(replicaLagPrefix+"-%d", i), *src.DataSource, ss.settings) + ss.replicaLagHandles[i], err = SetupConnection(fmt.Sprintf(replicaLagPrefix+"-%d", i), *src.DataSource, ss.settings, DBPingAttempts) + if err != nil { + mlog.Warn("Failed to setup replica lag handle. Skipping..", mlog.String("db", fmt.Sprintf(replicaLagPrefix+"-%d", i)), mlog.Err(err)) + continue + } } } + return nil } func (ss *SqlStore) DriverName() string { @@ -455,8 +471,15 @@ func (ss *SqlStore) GetSearchReplicaX() *sqlxDBWrapper { return ss.GetReplicaX() } - rrNum := atomic.AddInt64(&ss.srCounter, 1) % int64(len(ss.searchReplicaXs)) - return ss.searchReplicaXs[rrNum] + for i := 0; i < len(ss.searchReplicaXs); i++ { + rrNum := atomic.AddInt64(&ss.srCounter, 1) % int64(len(ss.searchReplicaXs)) + if ss.searchReplicaXs[rrNum].Load().Online() { + return ss.searchReplicaXs[rrNum].Load() + } + } + + // If all search replicas are down, then go with replica. + return ss.GetReplicaX() } func (ss *SqlStore) GetReplicaX() *sqlxDBWrapper { @@ -464,23 +487,64 @@ func (ss *SqlStore) GetReplicaX() *sqlxDBWrapper { return ss.GetMasterX() } - rrNum := atomic.AddInt64(&ss.rrCounter, 1) % int64(len(ss.ReplicaXs)) - return ss.ReplicaXs[rrNum] -} - -func (ss *SqlStore) GetInternalReplicaDBs() []*sql.DB { - if len(ss.settings.DataSourceReplicas) == 0 || ss.lockedToMaster || !ss.hasLicense() { - return []*sql.DB{ - ss.GetMasterX().DB.DB, + for i := 0; i < len(ss.ReplicaXs); i++ { + rrNum := atomic.AddInt64(&ss.rrCounter, 1) % int64(len(ss.ReplicaXs)) + if ss.ReplicaXs[rrNum].Load().Online() { + return ss.ReplicaXs[rrNum].Load() } } - dbs := make([]*sql.DB, len(ss.ReplicaXs)) - for i, rx := range ss.ReplicaXs { - dbs[i] = rx.DB.DB - } + // If all replicas are down, then go with master. + return ss.GetMasterX() +} - return dbs +func (ss *SqlStore) monitorReplicas() { + t := time.NewTicker(time.Duration(*ss.settings.ReplicaMonitorIntervalSeconds) * time.Second) + defer func() { + t.Stop() + ss.wgMonitor.Done() + }() + for { + select { + case <-ss.quitMonitor: + return + case <-t.C: + setupReplica := func(r *atomic.Pointer[sqlxDBWrapper], dsn, name string) { + if r.Load().Online() { + return + } + + handle, err := SetupConnection(name, dsn, ss.settings, 1) + if err != nil { + mlog.Warn("Failed to setup connection. Skipping..", mlog.String("db", name), mlog.Err(err)) + return + } + if ss.metrics != nil && r.Load() != nil && r.Load().DB != nil { + ss.metrics.UnregisterDBCollector(r.Load().DB.DB, name) + } + ss.setDB(r, handle, name) + } + for i, replica := range ss.ReplicaXs { + setupReplica(replica, ss.settings.DataSourceReplicas[i], "replica-"+strconv.Itoa(i)) + } + + for i, replica := range ss.searchReplicaXs { + setupReplica(replica, ss.settings.DataSourceSearchReplicas[i], "search-replica-"+strconv.Itoa(i)) + } + } + } +} + +func (ss *SqlStore) setDB(replica *atomic.Pointer[sqlxDBWrapper], handle *dbsql.DB, name string) { + replica.Store(newSqlxDBWrapper(sqlx.NewDb(handle, ss.DriverName()), + time.Duration(*ss.settings.QueryTimeout)*time.Second, + *ss.settings.Trace)) + if ss.DriverName() == model.DatabaseDriverMysql { + replica.Load().MapperFunc(noOpMapper) + } + if ss.metrics != nil { + ss.metrics.RegisterDBCollector(replica.Load().DB.DB, name) + } } func (ss *SqlStore) GetInternalReplicaDB() *sql.DB { @@ -489,7 +553,7 @@ func (ss *SqlStore) GetInternalReplicaDB() *sql.DB { } rrNum := atomic.AddInt64(&ss.rrCounter, 1) % int64(len(ss.ReplicaXs)) - return ss.ReplicaXs[rrNum].DB.DB + return ss.ReplicaXs[rrNum].Load().DB.DB } func (ss *SqlStore) TotalMasterDbConnections() int { @@ -541,7 +605,10 @@ func (ss *SqlStore) TotalReadDbConnections() int { count := 0 for _, db := range ss.ReplicaXs { - count = count + db.Stats().OpenConnections + if !db.Load().Online() { + continue + } + count = count + db.Load().Stats().OpenConnections } return count @@ -554,7 +621,10 @@ func (ss *SqlStore) TotalSearchDbConnections() int { count := 0 for _, db := range ss.searchReplicaXs { - count = count + db.Stats().OpenConnections + if !db.Load().Online() { + continue + } + count = count + db.Load().Stats().OpenConnections } return count @@ -782,9 +852,14 @@ func IsUniqueConstraintError(err error, indexName []string) bool { } func (ss *SqlStore) GetAllConns() []*sqlxDBWrapper { - all := make([]*sqlxDBWrapper, len(ss.ReplicaXs)+1) - copy(all, ss.ReplicaXs) - all[len(ss.ReplicaXs)] = ss.masterX + all := make([]*sqlxDBWrapper, 0, len(ss.ReplicaXs)+1) + for i := range ss.ReplicaXs { + if !ss.ReplicaXs[i].Load().Online() { + continue + } + all = append(all, ss.ReplicaXs[i].Load()) + } + all = append(all, ss.masterX) return all } @@ -807,11 +882,24 @@ func (ss *SqlStore) RecycleDBConnections(d time.Duration) { func (ss *SqlStore) Close() { ss.masterX.Close() + // Closing monitor and waiting for it to be done. + // This needs to be done before closing the replica handles. + close(ss.quitMonitor) + ss.wgMonitor.Wait() + for _, replica := range ss.ReplicaXs { - replica.Close() + if replica.Load().Online() { + replica.Load().Close() + } } for _, replica := range ss.searchReplicaXs { + if replica.Load().Online() { + replica.Load().Close() + } + } + + for _, replica := range ss.replicaLagHandles { replica.Close() } } @@ -993,6 +1081,7 @@ func (ss *SqlStore) TrueUpReview() store.TrueUpReviewStore { } func (ss *SqlStore) DropAllTables() { + var tableSchemaFn string if ss.DriverName() == model.DatabaseDriverPostgres { ss.masterX.Exec(`DO $func$ @@ -1002,18 +1091,57 @@ func (ss *SqlStore) DropAllTables() { FROM pg_class WHERE relkind = 'r' -- only tables AND relnamespace = 'public'::regnamespace - AND NOT relname = 'db_migrations' + AND NOT ( + relname = 'db_migrations' OR + relname = 'focalboard_schema_migrations' OR + relname = 'focalboard_boards' OR + relname = 'focalboard_blocks' + ) ); END $func$;`) + tableSchemaFn = "current_schema()" } else { tables := []string{} ss.masterX.Select(&tables, `show tables`) for _, t := range tables { - if t != "db_migrations" { + if t != "db_migrations" && + t != "focalboard_schema_migrations" && + t != "focalboard_boards" && + t != "focalboard_blocks" { ss.masterX.Exec(`TRUNCATE TABLE ` + t) + } } + tableSchemaFn = "DATABASE()" + } + + var boardsTableCount int + err := ss.masterX.Get(&boardsTableCount, ` + SELECT COUNT(*) + FROM INFORMATION_SCHEMA.TABLES + WHERE TABLE_SCHEMA = `+tableSchemaFn+` + AND TABLE_NAME = 'focalboard_schema_migrations'`) + if err != nil { + panic(errors.Wrap(err, "Error dropping all tables. Cannot query INFORMATION_SCHEMA table to check for focalboard_schema_migrations table")) + } + + if boardsTableCount != 0 { + _, blErr := ss.masterX.Exec(` + DELETE FROM focalboard_blocks + WHERE board_id IN ( + SELECT id + FROM focalboard_boards + WHERE NOT is_template + )`) + if blErr != nil { + panic(errors.Wrap(blErr, "Error deleting all non-template blocks")) + } + + _, boErr := ss.masterX.Exec(`DELETE FROM focalboard_boards WHERE NOT is_template`) + if boErr != nil { + panic(errors.Wrap(boErr, "Error delegint all non-template boards")) + } } } @@ -1092,7 +1220,10 @@ func (ss *SqlStore) migrate(direction migrationDirection) error { if err != nil { return err } - db := SetupConnection("master", dataSource, ss.settings) + db, err2 := SetupConnection("master", dataSource, ss.settings, DBPingAttempts) + if err2 != nil { + return err2 + } driver, err = ms.WithInstance(db) defer db.Close() case model.DatabaseDriverPostgres: diff --git a/server/channels/store/sqlstore/store_test.go b/server/channels/store/sqlstore/store_test.go index ba30e863f6..699ee53e98 100644 --- a/server/channels/store/sqlstore/store_test.go +++ b/server/channels/store/sqlstore/store_test.go @@ -21,13 +21,13 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/plugin/plugintest/mock" - "github.com/mattermost/mattermost-server/v6/server/channels/db" - "github.com/mattermost/mattermost-server/v6/server/channels/einterfaces/mocks" - "github.com/mattermost/mattermost-server/v6/server/channels/store" - "github.com/mattermost/mattermost-server/v6/server/channels/store/searchtest" - "github.com/mattermost/mattermost-server/v6/server/channels/store/storetest" + "github.com/mattermost/mattermost-server/server/v8/channels/db" + "github.com/mattermost/mattermost-server/server/v8/channels/einterfaces/mocks" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/store/searchtest" + "github.com/mattermost/mattermost-server/server/v8/channels/store/storetest" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/plugin/plugintest/mock" ) type storeType struct { @@ -761,13 +761,15 @@ func TestReplicaLagQuery(t *testing.T) { mockMetrics.On("RegisterDBCollector", mock.AnythingOfType("*sql.DB"), "master") store := &SqlStore{ - rrCounter: 0, - srCounter: 0, - settings: settings, - metrics: mockMetrics, + rrCounter: 0, + srCounter: 0, + settings: settings, + metrics: mockMetrics, + quitMonitor: make(chan struct{}), + wgMonitor: &sync.WaitGroup{}, } - store.initConnection() + require.NoError(t, store.initConnection()) store.stores.post = newSqlPostStore(store, mockMetrics) err = store.migrate(migrationsDirectionUp) require.NoError(t, err) @@ -839,9 +841,11 @@ func TestMySQLReadTimeout(t *testing.T) { settings.DataSource = &dataSource store := &SqlStore{ - settings: settings, + settings: settings, + quitMonitor: make(chan struct{}), + wgMonitor: &sync.WaitGroup{}, } - store.initConnection() + require.NoError(t, store.initConnection()) defer store.Close() _, err = store.GetMasterX().ExecNoTimeout(`SELECT SLEEP(3)`) diff --git a/server/channels/store/sqlstore/system_store.go b/server/channels/store/sqlstore/system_store.go index 5fcc45c0ac..c3006f13d6 100644 --- a/server/channels/store/sqlstore/system_store.go +++ b/server/channels/store/sqlstore/system_store.go @@ -13,9 +13,9 @@ import ( sq "github.com/mattermost/squirrel" "github.com/pkg/errors" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store" - "github.com/mattermost/mattermost-server/v6/server/channels/utils" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/utils" + "github.com/mattermost/mattermost-server/server/v8/model" ) type SqlSystemStore struct { diff --git a/server/channels/store/sqlstore/system_store_test.go b/server/channels/store/sqlstore/system_store_test.go index fdc9e22304..8ac69416ea 100644 --- a/server/channels/store/sqlstore/system_store_test.go +++ b/server/channels/store/sqlstore/system_store_test.go @@ -6,7 +6,7 @@ package sqlstore import ( "testing" - "github.com/mattermost/mattermost-server/v6/server/channels/store/storetest" + "github.com/mattermost/mattermost-server/server/v8/channels/store/storetest" ) func TestSystemStore(t *testing.T) { diff --git a/server/channels/store/sqlstore/team_store.go b/server/channels/store/sqlstore/team_store.go index dd1262fbbf..ace7c4a7f5 100644 --- a/server/channels/store/sqlstore/team_store.go +++ b/server/channels/store/sqlstore/team_store.go @@ -12,9 +12,9 @@ import ( sq "github.com/mattermost/squirrel" "github.com/pkg/errors" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store" - "github.com/mattermost/mattermost-server/v6/server/channels/utils" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/utils" + "github.com/mattermost/mattermost-server/server/v8/model" ) const ( diff --git a/server/channels/store/sqlstore/team_store_test.go b/server/channels/store/sqlstore/team_store_test.go index 6aad9928f7..639c57b43b 100644 --- a/server/channels/store/sqlstore/team_store_test.go +++ b/server/channels/store/sqlstore/team_store_test.go @@ -9,8 +9,8 @@ import ( "github.com/stretchr/testify/assert" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store/storetest" + "github.com/mattermost/mattermost-server/server/v8/channels/store/storetest" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestTeamStore(t *testing.T) { diff --git a/server/channels/store/sqlstore/terms_of_service_store.go b/server/channels/store/sqlstore/terms_of_service_store.go index a40602a22d..41ebc7c86b 100644 --- a/server/channels/store/sqlstore/terms_of_service_store.go +++ b/server/channels/store/sqlstore/terms_of_service_store.go @@ -8,9 +8,9 @@ import ( "github.com/pkg/errors" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/einterfaces" - "github.com/mattermost/mattermost-server/v6/server/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/einterfaces" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" ) type SqlTermsOfServiceStore struct { diff --git a/server/channels/store/sqlstore/terms_of_service_store_test.go b/server/channels/store/sqlstore/terms_of_service_store_test.go index 080c7c57cc..a9b209adf8 100644 --- a/server/channels/store/sqlstore/terms_of_service_store_test.go +++ b/server/channels/store/sqlstore/terms_of_service_store_test.go @@ -6,7 +6,7 @@ package sqlstore import ( "testing" - "github.com/mattermost/mattermost-server/v6/server/channels/store/storetest" + "github.com/mattermost/mattermost-server/server/v8/channels/store/storetest" ) func TestTermsOfServiceStore(t *testing.T) { diff --git a/server/channels/store/sqlstore/thread_store.go b/server/channels/store/sqlstore/thread_store.go index 6a3e9ed4f8..66ce1f42a1 100644 --- a/server/channels/store/sqlstore/thread_store.go +++ b/server/channels/store/sqlstore/thread_store.go @@ -13,9 +13,9 @@ import ( "github.com/pkg/errors" "golang.org/x/sync/errgroup" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store" - "github.com/mattermost/mattermost-server/v6/server/channels/utils" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/utils" + "github.com/mattermost/mattermost-server/server/v8/model" ) // JoinedThread allows querying the Threads + Posts table in a single query, before looking up @@ -688,6 +688,28 @@ func (s *SqlThreadStore) UpdateMembership(membership *model.ThreadMembership) (* return s.updateMembership(s.GetMasterX(), membership) } +func (s *SqlThreadStore) DeleteMembershipsForChannel(userID, channelID string) error { + subQuery := s.getSubQueryBuilder(). + Select("1"). + From("Threads"). + Where(sq.And{ + sq.Expr("Threads.PostId = ThreadMemberships.PostId"), + sq.Eq{"Threads.ChannelId": channelID}, + }) + + query := s.getQueryBuilder(). + Delete("ThreadMemberships"). + Where(sq.Eq{"UserId": userID}). + Where(sq.Expr("EXISTS (?)", subQuery)) + + _, err := s.GetMasterX().ExecBuilder(query) + if err != nil { + return errors.Wrapf(err, "failed to remove thread memberships with userid=%s channelid=%s", userID, channelID) + } + + return nil +} + func (s *SqlThreadStore) updateMembership(ex sqlxExecutor, membership *model.ThreadMembership) (*model.ThreadMembership, error) { query := s.getQueryBuilder(). Update("ThreadMemberships"). @@ -712,7 +734,14 @@ func (s *SqlThreadStore) GetMembershipsForUser(userId, teamId string) ([]*model. memberships := []*model.ThreadMembership{} query := s.getQueryBuilder(). - Select("ThreadMemberships.*"). + Select( + "ThreadMemberships.PostId", + "ThreadMemberships.UserId", + "ThreadMemberships.Following", + "ThreadMemberships.LastUpdated", + "ThreadMemberships.LastViewed", + "ThreadMemberships.UnreadMentions", + ). Join("Threads ON Threads.PostId = ThreadMemberships.PostId"). From("ThreadMemberships"). Where(sq.Or{sq.Eq{"Threads.ThreadTeamId": teamId}, sq.Eq{"Threads.ThreadTeamId": ""}}). @@ -732,7 +761,14 @@ func (s *SqlThreadStore) GetMembershipForUser(userId, postId string) (*model.Thr func (s *SqlThreadStore) getMembershipForUser(ex sqlxExecutor, userId, postId string) (*model.ThreadMembership, error) { var membership model.ThreadMembership query := s.getQueryBuilder(). - Select("*"). + Select( + "PostId", + "UserId", + "Following", + "LastUpdated", + "LastViewed", + "UnreadMentions", + ). From("ThreadMemberships"). Where(sq.And{ sq.Eq{"PostId": postId}, diff --git a/server/channels/store/sqlstore/thread_store_test.go b/server/channels/store/sqlstore/thread_store_test.go index 89ee4ccc9f..ded1cdc88c 100644 --- a/server/channels/store/sqlstore/thread_store_test.go +++ b/server/channels/store/sqlstore/thread_store_test.go @@ -6,7 +6,7 @@ package sqlstore import ( "testing" - "github.com/mattermost/mattermost-server/v6/server/channels/store/storetest" + "github.com/mattermost/mattermost-server/server/v8/channels/store/storetest" ) func TestThreadStore(t *testing.T) { diff --git a/server/channels/store/sqlstore/tokens_store.go b/server/channels/store/sqlstore/tokens_store.go index dd7614d318..d96d1ab44c 100644 --- a/server/channels/store/sqlstore/tokens_store.go +++ b/server/channels/store/sqlstore/tokens_store.go @@ -10,9 +10,9 @@ import ( sq "github.com/mattermost/squirrel" "github.com/pkg/errors" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) type SqlTokenStore struct { diff --git a/server/channels/store/sqlstore/tokens_store_test.go b/server/channels/store/sqlstore/tokens_store_test.go index 67ecaf0a9b..b8a35a9415 100644 --- a/server/channels/store/sqlstore/tokens_store_test.go +++ b/server/channels/store/sqlstore/tokens_store_test.go @@ -6,7 +6,7 @@ package sqlstore import ( "testing" - "github.com/mattermost/mattermost-server/v6/server/channels/store/storetest" + "github.com/mattermost/mattermost-server/server/v8/channels/store/storetest" ) func TestTokensStore(t *testing.T) { diff --git a/server/channels/store/sqlstore/true_up_review_store.go b/server/channels/store/sqlstore/true_up_review_store.go index 2226e09a53..cc11fee86d 100644 --- a/server/channels/store/sqlstore/true_up_review_store.go +++ b/server/channels/store/sqlstore/true_up_review_store.go @@ -10,8 +10,8 @@ import ( sq "github.com/mattermost/squirrel" "github.com/pkg/errors" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" ) // SqlLicenseStore encapsulates the database writes and reads for diff --git a/server/channels/store/sqlstore/true_up_review_store_test.go b/server/channels/store/sqlstore/true_up_review_store_test.go index 7a886f6b03..2f824b20cf 100644 --- a/server/channels/store/sqlstore/true_up_review_store_test.go +++ b/server/channels/store/sqlstore/true_up_review_store_test.go @@ -6,7 +6,7 @@ package sqlstore import ( "testing" - "github.com/mattermost/mattermost-server/v6/server/channels/store/storetest" + "github.com/mattermost/mattermost-server/server/v8/channels/store/storetest" ) func TestTrueUpReviewStore(t *testing.T) { diff --git a/server/channels/store/sqlstore/upload_session_store.go b/server/channels/store/sqlstore/upload_session_store.go index 69f67a4c9b..5ee8eda235 100644 --- a/server/channels/store/sqlstore/upload_session_store.go +++ b/server/channels/store/sqlstore/upload_session_store.go @@ -10,8 +10,8 @@ import ( sq "github.com/mattermost/squirrel" "github.com/pkg/errors" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" ) type SqlUploadSessionStore struct { diff --git a/server/channels/store/sqlstore/upload_session_store_test.go b/server/channels/store/sqlstore/upload_session_store_test.go index bcf1b56125..2db3de136c 100644 --- a/server/channels/store/sqlstore/upload_session_store_test.go +++ b/server/channels/store/sqlstore/upload_session_store_test.go @@ -6,7 +6,7 @@ package sqlstore import ( "testing" - "github.com/mattermost/mattermost-server/v6/server/channels/store/storetest" + "github.com/mattermost/mattermost-server/server/v8/channels/store/storetest" ) func TestUploadSessionStore(t *testing.T) { diff --git a/server/channels/store/sqlstore/user_access_token_store.go b/server/channels/store/sqlstore/user_access_token_store.go index de9cce52e3..04dac62367 100644 --- a/server/channels/store/sqlstore/user_access_token_store.go +++ b/server/channels/store/sqlstore/user_access_token_store.go @@ -9,8 +9,8 @@ import ( "github.com/pkg/errors" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" ) type SqlUserAccessTokenStore struct { diff --git a/server/channels/store/sqlstore/user_access_token_store_test.go b/server/channels/store/sqlstore/user_access_token_store_test.go index 93cebf1960..61ad42c429 100644 --- a/server/channels/store/sqlstore/user_access_token_store_test.go +++ b/server/channels/store/sqlstore/user_access_token_store_test.go @@ -6,7 +6,7 @@ package sqlstore import ( "testing" - "github.com/mattermost/mattermost-server/v6/server/channels/store/storetest" + "github.com/mattermost/mattermost-server/server/v8/channels/store/storetest" ) func TestUserAccessTokenStore(t *testing.T) { diff --git a/server/channels/store/sqlstore/user_store.go b/server/channels/store/sqlstore/user_store.go index b99b56ab49..c915bc332f 100644 --- a/server/channels/store/sqlstore/user_store.go +++ b/server/channels/store/sqlstore/user_store.go @@ -16,10 +16,10 @@ import ( "github.com/pkg/errors" "golang.org/x/sync/errgroup" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/einterfaces" - "github.com/mattermost/mattermost-server/v6/server/channels/store" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/einterfaces" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) const ( @@ -285,7 +285,7 @@ func (us SqlUserStore) UpdateLastPictureUpdate(userId string) error { func (us SqlUserStore) ResetLastPictureUpdate(userId string) error { curTime := model.GetMillis() - if _, err := us.GetMasterX().Exec("UPDATE Users SET LastPictureUpdate = ?, UpdateAt = ? WHERE Id = ?", 0, curTime, userId); err != nil { + if _, err := us.GetMasterX().Exec("UPDATE Users SET LastPictureUpdate = ?, UpdateAt = ? WHERE Id = ?", -curTime, curTime, userId); err != nil { return errors.Wrapf(err, "failed to update User with userId=%s", userId) } diff --git a/server/channels/store/sqlstore/user_store_test.go b/server/channels/store/sqlstore/user_store_test.go index eabbbd93d2..56076ab1e5 100644 --- a/server/channels/store/sqlstore/user_store_test.go +++ b/server/channels/store/sqlstore/user_store_test.go @@ -6,8 +6,8 @@ package sqlstore import ( "testing" - "github.com/mattermost/mattermost-server/v6/server/channels/store/searchtest" - "github.com/mattermost/mattermost-server/v6/server/channels/store/storetest" + "github.com/mattermost/mattermost-server/server/v8/channels/store/searchtest" + "github.com/mattermost/mattermost-server/server/v8/channels/store/storetest" ) func TestUserStore(t *testing.T) { diff --git a/server/channels/store/sqlstore/user_terms_of_service.go b/server/channels/store/sqlstore/user_terms_of_service.go index 1b8d5cf2b3..7c0a5b584f 100644 --- a/server/channels/store/sqlstore/user_terms_of_service.go +++ b/server/channels/store/sqlstore/user_terms_of_service.go @@ -8,8 +8,8 @@ import ( "github.com/pkg/errors" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" ) type SqlUserTermsOfServiceStore struct { diff --git a/server/channels/store/sqlstore/user_terms_of_service_store_test.go b/server/channels/store/sqlstore/user_terms_of_service_store_test.go index 3192749a2d..d14a74eead 100644 --- a/server/channels/store/sqlstore/user_terms_of_service_store_test.go +++ b/server/channels/store/sqlstore/user_terms_of_service_store_test.go @@ -6,7 +6,7 @@ package sqlstore import ( "testing" - "github.com/mattermost/mattermost-server/v6/server/channels/store/storetest" + "github.com/mattermost/mattermost-server/server/v8/channels/store/storetest" ) func TestUserTermsOfServiceStore(t *testing.T) { diff --git a/server/channels/store/sqlstore/utils.go b/server/channels/store/sqlstore/utils.go index 5242f0c527..753d5d3933 100644 --- a/server/channels/store/sqlstore/utils.go +++ b/server/channels/store/sqlstore/utils.go @@ -14,8 +14,8 @@ import ( "github.com/wiggin77/merror" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" "github.com/go-sql-driver/mysql" ) @@ -233,3 +233,14 @@ func SanitizeDataSource(driverName, dataSource string) (string, error) { return "", errors.New("invalid drivername. Not postgres or mysql.") } } + +const maxTokenSize = 50 + +// trimInput limits the string to a max size to prevent clogging up disk space +// while logging +func trimInput(input string) string { + if len(input) > maxTokenSize { + input = input[:maxTokenSize] + "..." + } + return input +} diff --git a/server/channels/store/sqlstore/utils_test.go b/server/channels/store/sqlstore/utils_test.go index 96468323bb..61e11e0cf5 100644 --- a/server/channels/store/sqlstore/utils_test.go +++ b/server/channels/store/sqlstore/utils_test.go @@ -6,7 +6,7 @@ package sqlstore import ( "testing" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/server/channels/store/sqlstore/webhook_store.go b/server/channels/store/sqlstore/webhook_store.go index e40a8a1845..e2d0ed18da 100644 --- a/server/channels/store/sqlstore/webhook_store.go +++ b/server/channels/store/sqlstore/webhook_store.go @@ -9,9 +9,9 @@ import ( sq "github.com/mattermost/squirrel" "github.com/pkg/errors" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/einterfaces" - "github.com/mattermost/mattermost-server/v6/server/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/einterfaces" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" ) type SqlWebhookStore struct { diff --git a/server/channels/store/sqlstore/webhook_store_test.go b/server/channels/store/sqlstore/webhook_store_test.go index d887786cb6..e03720dd63 100644 --- a/server/channels/store/sqlstore/webhook_store_test.go +++ b/server/channels/store/sqlstore/webhook_store_test.go @@ -6,7 +6,7 @@ package sqlstore import ( "testing" - "github.com/mattermost/mattermost-server/v6/server/channels/store/storetest" + "github.com/mattermost/mattermost-server/server/v8/channels/store/storetest" ) func TestWebhookStore(t *testing.T) { diff --git a/server/channels/store/store.go b/server/channels/store/store.go index 52774d2e71..f9738bcf44 100644 --- a/server/channels/store/store.go +++ b/server/channels/store/store.go @@ -10,8 +10,8 @@ import ( "database/sql" "time" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/product" + "github.com/mattermost/mattermost-server/server/v8/channels/product" + "github.com/mattermost/mattermost-server/server/v8/model" ) type StoreResult struct { @@ -72,10 +72,7 @@ type Store interface { // GetInternalMasterDB allows access to the raw master DB // handle for the multi-product architecture. GetInternalMasterDB() *sql.DB - // GetInternalReplicaDBs allows access to the raw replica DB - // handles for the multi-product architecture. GetInternalReplicaDB() *sql.DB - GetInternalReplicaDBs() []*sql.DB TotalMasterDbConnections() int TotalReadDbConnections() int TotalSearchDbConnections() int @@ -200,6 +197,7 @@ type ChannelStore interface { GetChannels(teamID, userID string, opts *model.ChannelSearchOpts) (model.ChannelList, error) GetChannelsWithCursor(teamId string, userId string, opts *model.ChannelSearchOpts, afterChannelID string) (model.ChannelList, error) GetChannelsByUser(userID string, includeDeleted bool, lastDeleteAt, pageSize int, fromChannelID string) (model.ChannelList, error) + GetBotChannelsByUser(userID string, opts ChannelSearchOpts) (model.ChannelList, error) GetAllChannelMembersById(id string) ([]string, error) GetAllChannels(page, perPage int, opts ChannelSearchOpts) (model.ChannelListWithTeamData, error) GetAllChannelsCount(opts ChannelSearchOpts) (int64, error) @@ -274,13 +272,13 @@ type ChannelStore interface { ResetAllChannelSchemes() error ClearAllCustomRoleAssignments() error CreateInitialSidebarCategories(userID string, opts *SidebarCategorySearchOpts) (*model.OrderedSidebarCategories, error) - GetSidebarCategoriesForTeamForUser(userID, teamID string) (*model.OrderedSidebarCategories, error) + GetSidebarCategoriesForTeamForUser(userID, teamID string, options ...*SidebarCategorySearchOpts) (*model.OrderedSidebarCategories, error) GetSidebarCategories(userID string, opts *SidebarCategorySearchOpts) (*model.OrderedSidebarCategories, error) - GetSidebarCategory(categoryID string) (*model.SidebarCategoryWithChannels, error) + GetSidebarCategory(categoryID string, options ...*SidebarCategorySearchOpts) (*model.SidebarCategoryWithChannels, error) GetSidebarCategoryOrder(userID, teamID string) ([]string, error) - CreateSidebarCategory(userID, teamID string, newCategory *model.SidebarCategoryWithChannels) (*model.SidebarCategoryWithChannels, error) + CreateSidebarCategory(userID, teamID string, newCategory *model.SidebarCategoryWithChannels, options ...*SidebarCategorySearchOpts) (*model.SidebarCategoryWithChannels, error) UpdateSidebarCategoryOrder(userID, teamID string, categoryOrder []string) error - UpdateSidebarCategories(userID, teamID string, categories []*model.SidebarCategoryWithChannels) ([]*model.SidebarCategoryWithChannels, []*model.SidebarCategoryWithChannels, error) + UpdateSidebarCategories(userID, teamID string, categories []*model.SidebarCategoryWithChannels, options ...*SidebarCategorySearchOpts) ([]*model.SidebarCategoryWithChannels, []*model.SidebarCategoryWithChannels, error) UpdateSidebarChannelsByPreferences(preferences model.Preferences) error DeleteSidebarChannelsByPreferences(preferences model.Preferences) error DeleteSidebarCategory(categoryID string) error @@ -347,6 +345,7 @@ type ThreadStore interface { PermanentDeleteBatchThreadMembershipsForRetentionPolicies(now, globalPolicyEndTime, limit int64, cursor model.RetentionPolicyCursor) (int64, model.RetentionPolicyCursor, error) DeleteOrphanedRows(limit int) (deleted int64, err error) GetThreadUnreadReplyCount(threadMembership *model.ThreadMembership) (int64, error) + DeleteMembershipsForChannel(userID, channelID string) error // Insights - threads GetTopThreadsForTeamSince(teamID string, userID string, since int64, offset int, limit int) (*model.TopThreadList, error) @@ -1093,8 +1092,9 @@ type PostReminderMetadata struct { // SidebarCategorySearchOpts contains the options for a graphQL query // to get the sidebar categories. type SidebarCategorySearchOpts struct { - TeamID string - ExcludeTeam bool + TeamID string + ExcludeTeam bool + AppsCategoryEnabled bool } // Ensure store service adapter implements `product.StoreService` diff --git a/server/channels/store/storetest/audit_store.go b/server/channels/store/storetest/audit_store.go index bbc7a41b94..f7e2fe3a10 100644 --- a/server/channels/store/storetest/audit_store.go +++ b/server/channels/store/storetest/audit_store.go @@ -10,8 +10,8 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestAuditStore(t *testing.T, ss store.Store) { diff --git a/server/channels/store/storetest/bot_store.go b/server/channels/store/storetest/bot_store.go index 4451456a54..cea0d1dd3f 100644 --- a/server/channels/store/storetest/bot_store.go +++ b/server/channels/store/storetest/bot_store.go @@ -9,8 +9,8 @@ import ( "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" ) func makeBotWithUser(t *testing.T, ss store.Store, bot *model.Bot) (*model.Bot, *model.User) { diff --git a/server/channels/store/storetest/channel_member_history_store.go b/server/channels/store/storetest/channel_member_history_store.go index 37192c9133..e4092dbe58 100644 --- a/server/channels/store/storetest/channel_member_history_store.go +++ b/server/channels/store/storetest/channel_member_history_store.go @@ -11,8 +11,8 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestChannelMemberHistoryStore(t *testing.T, ss store.Store) { diff --git a/server/channels/store/storetest/channel_store.go b/server/channels/store/storetest/channel_store.go index 3d30089e17..baffe97abd 100644 --- a/server/channels/store/storetest/channel_store.go +++ b/server/channels/store/storetest/channel_store.go @@ -18,10 +18,10 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store" - "github.com/mattermost/mattermost-server/v6/server/channels/utils" - "github.com/mattermost/mattermost-server/v6/server/platform/services/timezones" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/utils" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/services/timezones" ) type SqlStore interface { @@ -115,7 +115,7 @@ func TestChannelStore(t *testing.T, ss store.Store, s SqlStore) { t.Run("GetGuestCount", func(t *testing.T) { testGetGuestCount(t, ss) }) t.Run("SearchMore", func(t *testing.T) { testChannelStoreSearchMore(t, ss) }) t.Run("SearchInTeam", func(t *testing.T) { testChannelStoreSearchInTeam(t, ss) }) - t.Run("Autocomplete", func(t *testing.T) { testAutocomplete(t, ss) }) + t.Run("Autocomplete", func(t *testing.T) { testAutocomplete(t, ss, s) }) t.Run("SearchArchivedInTeam", func(t *testing.T) { testChannelStoreSearchArchivedInTeam(t, ss, s) }) t.Run("SearchForUserInTeam", func(t *testing.T) { testChannelStoreSearchForUserInTeam(t, ss) }) t.Run("SearchAllChannels", func(t *testing.T) { testChannelStoreSearchAllChannels(t, ss) }) @@ -5986,7 +5986,7 @@ func testChannelStoreSearchInTeam(t *testing.T, ss store.Store) { } } -func testAutocomplete(t *testing.T, ss store.Store) { +func testAutocomplete(t *testing.T, ss store.Store, s SqlStore) { t1 := &model.Team{ DisplayName: "t1", Name: NewTestId(), @@ -6165,9 +6165,9 @@ func testAutocomplete(t *testing.T, ss store.Store) { } for _, testCase := range testCases { - t.Run("Autocomplete/"+testCase.Description, func(t *testing.T) { - channels, err := ss.Channel().Autocomplete(testCase.UserID, testCase.Term, testCase.IncludeDeleted, testCase.IsGuest) - require.NoError(t, err) + t.Run(testCase.Description, func(t *testing.T) { + channels, err2 := ss.Channel().Autocomplete(testCase.UserID, testCase.Term, testCase.IncludeDeleted, testCase.IsGuest) + require.NoError(t, err2) var gotChannelIds []string var gotTeamNames []string for _, ch := range channels { @@ -6178,6 +6178,24 @@ func testAutocomplete(t *testing.T, ss store.Store) { require.ElementsMatch(t, testCase.ExpectedTeamNames, gotTeamNames, "team names are not as expected") }) } + + t.Run("Limit", func(t *testing.T) { + for i := 0; i < model.ChannelSearchDefaultLimit+10; i++ { + _, err = ss.Channel().Save(&model.Channel{ + TeamId: teamID, + DisplayName: "Channel " + strconv.Itoa(i), + Name: NewTestId(), + Type: model.ChannelTypeOpen, + }, -1) + require.NoError(t, err) + } + channels, err := ss.Channel().Autocomplete(m1.UserId, "Chann", false, false) + require.NoError(t, err) + assert.Len(t, channels, model.ChannelSearchDefaultLimit) + }) + + // Manually truncate Channels table until testlib can handle cleanups + s.GetMasterX().Exec("TRUNCATE Channels") } func testChannelStoreSearchForUserInTeam(t *testing.T, ss store.Store) { diff --git a/server/channels/store/storetest/channel_store_categories.go b/server/channels/store/storetest/channel_store_categories.go index 6b88cdff4a..6ba934f45b 100644 --- a/server/channels/store/storetest/channel_store_categories.go +++ b/server/channels/store/storetest/channel_store_categories.go @@ -12,8 +12,8 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestChannelStoreCategories(t *testing.T, ss store.Store, s SqlStore) { @@ -672,6 +672,38 @@ func testCreateSidebarCategory(t *testing.T, ss store.Store) { require.NoError(t, err) assert.Equal(t, []string{}, res2.Channels) }) + + t.Run("should store the correct sorting value", func(t *testing.T) { + userId := model.NewId() + + team := setupTeam(t, ss, userId) + + opts := &store.SidebarCategorySearchOpts{ + TeamID: team.Id, + ExcludeTeam: false, + } + res, nErr := ss.Channel().CreateInitialSidebarCategories(userId, opts) + require.NoError(t, nErr) + require.NotEmpty(t, res) + // Create the category + created, err := ss.Channel().CreateSidebarCategory(userId, team.Id, &model.SidebarCategoryWithChannels{ + SidebarCategory: model.SidebarCategory{ + DisplayName: model.NewId(), + Sorting: model.SidebarCategorySortManual, + }, + }) + require.NoError(t, err) + + // Confirm that sorting value is correct + res, err = ss.Channel().GetSidebarCategoriesForTeamForUser(userId, team.Id) + require.NoError(t, err) + require.Len(t, res.Categories, 4) + // first category will be favorites and second will be newly created + assert.Equal(t, model.SidebarCategoryCustom, res.Categories[1].Type) + assert.Equal(t, created.Id, res.Categories[1].Id) + assert.Equal(t, model.SidebarCategorySortManual, res.Categories[1].Sorting) + assert.Equal(t, model.SidebarCategorySortManual, created.Sorting) + }) } func testGetSidebarCategory(t *testing.T, ss store.Store, s SqlStore) { diff --git a/server/channels/store/storetest/channel_store_categories_with_apps_category.go b/server/channels/store/storetest/channel_store_categories_with_apps_category.go new file mode 100644 index 0000000000..550085f8f7 --- /dev/null +++ b/server/channels/store/storetest/channel_store_categories_with_apps_category.go @@ -0,0 +1,2681 @@ +// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. +// See LICENSE.txt for license information. + +package storetest + +import ( + "database/sql" + "errors" + "sync" + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" +) + +func TestChannelStoreCategoriesWithAppsCategory(t *testing.T, ss store.Store, s SqlStore) { + t.Run("CreateInitialSidebarCategoriesWithAppsCategory", func(t *testing.T) { testCreateInitialSidebarCategoriesWithAppsCategory(t, ss) }) + t.Run("CreateSidebarCategoryWithAppsCategory", func(t *testing.T) { testCreateSidebarCategoryWithAppsCategory(t, ss) }) + t.Run("GetSidebarCategoryWithAppsCategory", func(t *testing.T) { testGetSidebarCategoryWithAppsCategory(t, ss, s) }) + t.Run("GetSidebarCategoriesWithAppsCategory", func(t *testing.T) { testGetSidebarCategoriesWithAppsCategory(t, ss) }) + t.Run("UpdateSidebarCategoriesWithAppsCategory", func(t *testing.T) { testUpdateSidebarCategoriesWithAppsCategory(t, ss) }) + t.Run("ClearSidebarOnTeamLeaveWithAppsCategory", func(t *testing.T) { testClearSidebarOnTeamLeaveWithAppsCategory(t, ss, s) }) + t.Run("DeleteSidebarCategoryWithAppsCategory", func(t *testing.T) { testDeleteSidebarCategoryWithAppsCategory(t, ss, s) }) + t.Run("UpdateSidebarChannelsByPreferencesWithAppsCategory", func(t *testing.T) { testUpdateSidebarChannelsByPreferencesWithAppsCategory(t, ss) }) + t.Run("SidebarCategoryDeadlockWithAppsCategory", func(t *testing.T) { testSidebarCategoryDeadlockWithAppsCategory(t, ss) }) +} + +func testCreateInitialSidebarCategoriesWithAppsCategory(t *testing.T, ss store.Store) { + t.Run("should create initial favorites/channels/DMs/apps categories", func(t *testing.T) { + userId := model.NewId() + + team := setupTeam(t, ss, userId) + + opts := &store.SidebarCategorySearchOpts{ + TeamID: team.Id, + ExcludeTeam: false, + AppsCategoryEnabled: true, + } + + res, nErr := ss.Channel().CreateInitialSidebarCategories(userId, opts) + assert.NoError(t, nErr) + require.Len(t, res.Categories, 4) + assert.Equal(t, model.SidebarCategoryFavorites, res.Categories[0].Type) + assert.Equal(t, model.SidebarCategoryChannels, res.Categories[1].Type) + assert.Equal(t, model.SidebarCategoryDirectMessages, res.Categories[2].Type) + assert.Equal(t, model.SidebarCategoryApps, res.Categories[3].Type) + + res2, err := ss.Channel().GetSidebarCategoriesForTeamForUser(userId, team.Id, opts) + assert.NoError(t, err) + assert.Equal(t, res, res2) + }) + + t.Run("should create initial favorites/channels/DMs/apps categories for multiple users", func(t *testing.T) { + userId := model.NewId() + userId2 := model.NewId() + + team := setupTeam(t, ss, userId, userId2) + + opts := &store.SidebarCategorySearchOpts{ + TeamID: team.Id, + ExcludeTeam: false, + AppsCategoryEnabled: true, + } + res, nErr := ss.Channel().CreateInitialSidebarCategories(userId, opts) + require.NoError(t, nErr) + require.NotEmpty(t, res) + + res, nErr = ss.Channel().CreateInitialSidebarCategories(userId2, opts) + assert.NoError(t, nErr) + assert.Len(t, res.Categories, 4) + assert.Equal(t, model.SidebarCategoryFavorites, res.Categories[0].Type) + assert.Equal(t, model.SidebarCategoryChannels, res.Categories[1].Type) + assert.Equal(t, model.SidebarCategoryDirectMessages, res.Categories[2].Type) + assert.Equal(t, model.SidebarCategoryApps, res.Categories[3].Type) + + res2, err := ss.Channel().GetSidebarCategoriesForTeamForUser(userId2, team.Id, opts) + assert.NoError(t, err) + assert.Equal(t, res, res2) + }) + + t.Run("should create initial favorites/channels/DMs/apps categories on different teams", func(t *testing.T) { + userId := model.NewId() + + team := setupTeam(t, ss, userId) + team2 := setupTeam(t, ss, userId) + + opts := &store.SidebarCategorySearchOpts{ + TeamID: team.Id, + ExcludeTeam: false, + AppsCategoryEnabled: true, + } + res, nErr := ss.Channel().CreateInitialSidebarCategories(userId, opts) + require.NoError(t, nErr) + require.NotEmpty(t, res) + + opts = &store.SidebarCategorySearchOpts{ + TeamID: team2.Id, + ExcludeTeam: false, + AppsCategoryEnabled: true, + } + res, nErr = ss.Channel().CreateInitialSidebarCategories(userId, opts) + assert.NoError(t, nErr) + assert.Len(t, res.Categories, 4) + assert.Equal(t, model.SidebarCategoryFavorites, res.Categories[0].Type) + assert.Equal(t, model.SidebarCategoryChannels, res.Categories[1].Type) + assert.Equal(t, model.SidebarCategoryDirectMessages, res.Categories[2].Type) + assert.Equal(t, model.SidebarCategoryApps, res.Categories[3].Type) + + res2, err := ss.Channel().GetSidebarCategoriesForTeamForUser(userId, team2.Id, opts) + assert.NoError(t, err) + assert.Equal(t, res, res2) + }) + + t.Run("shouldn't create additional categories when ones already exist", func(t *testing.T) { + userId := model.NewId() + + team := setupTeam(t, ss, userId) + + opts := &store.SidebarCategorySearchOpts{ + TeamID: team.Id, + ExcludeTeam: false, + AppsCategoryEnabled: true, + } + res, nErr := ss.Channel().CreateInitialSidebarCategories(userId, opts) + require.NoError(t, nErr) + require.NotEmpty(t, res) + + initialCategories, err := ss.Channel().GetSidebarCategoriesForTeamForUser(userId, team.Id, opts) + require.NoError(t, err) + require.Equal(t, res, initialCategories) + + // Calling CreateInitialSidebarCategories a second time shouldn't create any new categories + res, nErr = ss.Channel().CreateInitialSidebarCategories(userId, opts) + assert.NoError(t, nErr) + assert.NotEmpty(t, res) + + res, err = ss.Channel().GetSidebarCategoriesForTeamForUser(userId, team.Id, opts) + assert.NoError(t, err) + assert.Equal(t, initialCategories.Categories, res.Categories) + }) + + t.Run("shouldn't create additional categories when ones already exist even when ran simultaneously", func(t *testing.T) { + userId := model.NewId() + + team := setupTeam(t, ss, userId) + + opts := &store.SidebarCategorySearchOpts{ + TeamID: team.Id, + ExcludeTeam: false, + AppsCategoryEnabled: true, + } + + var wg sync.WaitGroup + + for i := 0; i < 10; i++ { + wg.Add(1) + + go func() { + defer wg.Done() + + _, _ = ss.Channel().CreateInitialSidebarCategories(userId, opts) + }() + } + + wg.Wait() + + res, err := ss.Channel().GetSidebarCategoriesForTeamForUser(userId, team.Id, opts) + assert.NoError(t, err) + assert.Len(t, res.Categories, 4) + }) + + t.Run("should populate the Favorites category with regular channels", func(t *testing.T) { + userId := model.NewId() + + team := setupTeam(t, ss, userId) + + // Set up two channels, one favorited and one not + channel1, nErr := ss.Channel().Save(&model.Channel{ + TeamId: team.Id, + Type: model.ChannelTypeOpen, + Name: "channel1", + }, 1000) + require.NoError(t, nErr) + _, err := ss.Channel().SaveMember(&model.ChannelMember{ + ChannelId: channel1.Id, + UserId: userId, + NotifyProps: model.GetDefaultChannelNotifyProps(), + }) + require.NoError(t, err) + + channel2, nErr := ss.Channel().Save(&model.Channel{ + TeamId: team.Id, + Type: model.ChannelTypeOpen, + Name: "channel2", + }, 1000) + require.NoError(t, nErr) + _, err = ss.Channel().SaveMember(&model.ChannelMember{ + ChannelId: channel2.Id, + UserId: userId, + NotifyProps: model.GetDefaultChannelNotifyProps(), + }) + require.NoError(t, err) + + nErr = ss.Preference().Save(model.Preferences{ + { + UserId: userId, + Category: model.PreferenceCategoryFavoriteChannel, + Name: channel1.Id, + Value: "true", + }, + }) + require.NoError(t, nErr) + + // Create the categories + opts := &store.SidebarCategorySearchOpts{ + TeamID: team.Id, + ExcludeTeam: false, + AppsCategoryEnabled: true, + } + categories, nErr := ss.Channel().CreateInitialSidebarCategories(userId, opts) + require.NoError(t, nErr) + require.Len(t, categories.Categories, 4) + assert.Equal(t, model.SidebarCategoryFavorites, categories.Categories[0].Type) + assert.Equal(t, []string{channel1.Id}, categories.Categories[0].Channels) + assert.Equal(t, model.SidebarCategoryChannels, categories.Categories[1].Type) + assert.Equal(t, []string{channel2.Id}, categories.Categories[1].Channels) + + // Get and check the categories for channels + categories2, nErr := ss.Channel().GetSidebarCategoriesForTeamForUser(userId, team.Id, opts) + require.NoError(t, nErr) + require.Equal(t, categories, categories2) + }) + + t.Run("should populate the Favorites category in alphabetical order", func(t *testing.T) { + userId := model.NewId() + + team := setupTeam(t, ss, userId) + + // Set up two channels + channel1, nErr := ss.Channel().Save(&model.Channel{ + TeamId: team.Id, + Type: model.ChannelTypeOpen, + Name: "channel1", + DisplayName: "zebra", + }, 1000) + require.NoError(t, nErr) + _, err := ss.Channel().SaveMember(&model.ChannelMember{ + ChannelId: channel1.Id, + UserId: userId, + NotifyProps: model.GetDefaultChannelNotifyProps(), + }) + require.NoError(t, err) + + channel2, nErr := ss.Channel().Save(&model.Channel{ + TeamId: team.Id, + Type: model.ChannelTypeOpen, + Name: "channel2", + DisplayName: "aardvark", + }, 1000) + require.NoError(t, nErr) + _, err = ss.Channel().SaveMember(&model.ChannelMember{ + ChannelId: channel2.Id, + UserId: userId, + NotifyProps: model.GetDefaultChannelNotifyProps(), + }) + require.NoError(t, err) + + nErr = ss.Preference().Save(model.Preferences{ + { + UserId: userId, + Category: model.PreferenceCategoryFavoriteChannel, + Name: channel1.Id, + Value: "true", + }, + { + UserId: userId, + Category: model.PreferenceCategoryFavoriteChannel, + Name: channel2.Id, + Value: "true", + }, + }) + require.NoError(t, nErr) + + // Create the categories + opts := &store.SidebarCategorySearchOpts{ + TeamID: team.Id, + ExcludeTeam: false, + AppsCategoryEnabled: true, + } + categories, nErr := ss.Channel().CreateInitialSidebarCategories(userId, opts) + require.NoError(t, nErr) + require.Len(t, categories.Categories, 4) + assert.Equal(t, model.SidebarCategoryFavorites, categories.Categories[0].Type) + assert.Equal(t, []string{channel2.Id, channel1.Id}, categories.Categories[0].Channels) + + // Get and check the categories for channels + categories2, nErr := ss.Channel().GetSidebarCategoriesForTeamForUser(userId, team.Id, opts) + require.NoError(t, nErr) + require.Equal(t, categories, categories2) + }) + + t.Run("should populate the Favorites category with DMs and GMs", func(t *testing.T) { + userId := model.NewId() + + team := setupTeam(t, ss, userId) + + otherUserId1 := model.NewId() + otherUserId2 := model.NewId() + + // Set up two direct channels, one favorited and one not + dmChannel1, err := ss.Channel().SaveDirectChannel( + &model.Channel{ + Name: model.GetDMNameFromIds(userId, otherUserId1), + Type: model.ChannelTypeDirect, + }, + &model.ChannelMember{ + UserId: userId, + NotifyProps: model.GetDefaultChannelNotifyProps(), + }, + &model.ChannelMember{ + UserId: otherUserId1, + NotifyProps: model.GetDefaultChannelNotifyProps(), + }, + ) + require.NoError(t, err) + + dmChannel2, err := ss.Channel().SaveDirectChannel( + &model.Channel{ + Name: model.GetDMNameFromIds(userId, otherUserId2), + Type: model.ChannelTypeDirect, + }, + &model.ChannelMember{ + UserId: userId, + NotifyProps: model.GetDefaultChannelNotifyProps(), + }, + &model.ChannelMember{ + UserId: otherUserId2, + NotifyProps: model.GetDefaultChannelNotifyProps(), + }, + ) + require.NoError(t, err) + + err = ss.Preference().Save(model.Preferences{ + { + UserId: userId, + Category: model.PreferenceCategoryFavoriteChannel, + Name: dmChannel1.Id, + Value: "true", + }, + }) + require.NoError(t, err) + + // Create the categories + opts := &store.SidebarCategorySearchOpts{ + TeamID: team.Id, + ExcludeTeam: false, + AppsCategoryEnabled: true, + } + categories, nErr := ss.Channel().CreateInitialSidebarCategories(userId, opts) + require.NoError(t, nErr) + require.Len(t, categories.Categories, 4) + assert.Equal(t, model.SidebarCategoryFavorites, categories.Categories[0].Type) + assert.Equal(t, []string{dmChannel1.Id}, categories.Categories[0].Channels) + assert.Equal(t, model.SidebarCategoryDirectMessages, categories.Categories[2].Type) + assert.Equal(t, []string{dmChannel2.Id}, categories.Categories[2].Channels) + + // Get and check the categories for channels + categories2, err := ss.Channel().GetSidebarCategoriesForTeamForUser(userId, team.Id, opts) + require.NoError(t, err) + require.Equal(t, categories, categories2) + }) + + t.Run("should not populate the Favorites category with channels from other teams", func(t *testing.T) { + userId := model.NewId() + + team := setupTeam(t, ss, userId) + team2 := setupTeam(t, ss, userId) + + // Set up a channel on another team and favorite it + channel1, nErr := ss.Channel().Save(&model.Channel{ + TeamId: team2.Id, + Type: model.ChannelTypeOpen, + Name: "channel1", + }, 1000) + require.NoError(t, nErr) + _, err := ss.Channel().SaveMember(&model.ChannelMember{ + ChannelId: channel1.Id, + UserId: userId, + NotifyProps: model.GetDefaultChannelNotifyProps(), + }) + require.NoError(t, err) + + nErr = ss.Preference().Save(model.Preferences{ + { + UserId: userId, + Category: model.PreferenceCategoryFavoriteChannel, + Name: channel1.Id, + Value: "true", + }, + }) + require.NoError(t, nErr) + + // Create the categories + opts := &store.SidebarCategorySearchOpts{ + TeamID: team.Id, + ExcludeTeam: false, + AppsCategoryEnabled: true, + } + categories, nErr := ss.Channel().CreateInitialSidebarCategories(userId, opts) + require.NoError(t, nErr) + require.Len(t, categories.Categories, 4) + assert.Equal(t, model.SidebarCategoryFavorites, categories.Categories[0].Type) + assert.Equal(t, []string{}, categories.Categories[0].Channels) + assert.Equal(t, model.SidebarCategoryChannels, categories.Categories[1].Type) + assert.Equal(t, []string{}, categories.Categories[1].Channels) + + // Get and check the categories for channels + categories2, nErr := ss.Channel().GetSidebarCategoriesForTeamForUser(userId, team.Id, opts) + require.NoError(t, nErr) + require.Equal(t, categories, categories2) + }) + + t.Run("graphQL path to create initial favorites/channels/DMs categories on different teams", func(t *testing.T) { + userId := model.NewId() + + t1 := &model.Team{ + DisplayName: "DisplayName", + Name: NewTestId(), + Email: MakeEmail(), + Type: model.TeamOpen, + InviteId: model.NewId(), + } + t1, err := ss.Team().Save(t1) + require.NoError(t, err) + + m1 := &model.TeamMember{TeamId: t1.Id, UserId: userId} + _, nErr := ss.Team().SaveMember(m1, -1) + require.NoError(t, nErr) + + t2 := &model.Team{ + DisplayName: "DisplayName2", + Name: NewTestId(), + Email: MakeEmail(), + Type: model.TeamOpen, + InviteId: model.NewId(), + } + t2, err = ss.Team().Save(t2) + require.NoError(t, err) + + m2 := &model.TeamMember{TeamId: t2.Id, UserId: userId} + _, nErr = ss.Team().SaveMember(m2, -1) + require.NoError(t, nErr) + + opts := &store.SidebarCategorySearchOpts{ + TeamID: t1.Id, + ExcludeTeam: true, + AppsCategoryEnabled: true, + } + res, nErr := ss.Channel().CreateInitialSidebarCategories(userId, opts) + require.NoError(t, nErr) + require.NotEmpty(t, res) + + for _, cat := range res.Categories { + assert.Equal(t, t2.Id, cat.TeamId) + } + }) +} + +func testCreateSidebarCategoryWithAppsCategory(t *testing.T, ss store.Store) { + t.Run("Creating category without initial categories should fail", func(t *testing.T) { + userId := model.NewId() + teamId := model.NewId() + + opts := &store.SidebarCategorySearchOpts{ + AppsCategoryEnabled: true, + } + + // Create the category + created, err := ss.Channel().CreateSidebarCategory(userId, teamId, &model.SidebarCategoryWithChannels{ + SidebarCategory: model.SidebarCategory{ + DisplayName: model.NewId(), + }, + }, + opts, + ) + require.Error(t, err) + var errNotFound *store.ErrNotFound + require.ErrorAs(t, err, &errNotFound) + require.Nil(t, created) + }) + + t.Run("should place the new category second if Favorites comes first", func(t *testing.T) { + userId := model.NewId() + + team := setupTeam(t, ss, userId) + + opts := &store.SidebarCategorySearchOpts{ + TeamID: team.Id, + ExcludeTeam: false, + AppsCategoryEnabled: true, + } + res, nErr := ss.Channel().CreateInitialSidebarCategories(userId, opts) + require.NoError(t, nErr) + require.NotEmpty(t, res) + + // Create the category + created, err := ss.Channel().CreateSidebarCategory(userId, team.Id, &model.SidebarCategoryWithChannels{ + SidebarCategory: model.SidebarCategory{ + DisplayName: model.NewId(), + }, + }, + opts, + ) + require.NoError(t, err) + + // Confirm that it comes second + res, err = ss.Channel().GetSidebarCategoriesForTeamForUser(userId, team.Id, opts) + require.NoError(t, err) + require.Len(t, res.Categories, 5) + assert.Equal(t, model.SidebarCategoryFavorites, res.Categories[0].Type) + assert.Equal(t, model.SidebarCategoryCustom, res.Categories[1].Type) + assert.Equal(t, created.Id, res.Categories[1].Id) + }) + + t.Run("should place the new category first if Favorites is not first", func(t *testing.T) { + userId := model.NewId() + + team := setupTeam(t, ss, userId) + + opts := &store.SidebarCategorySearchOpts{ + TeamID: team.Id, + ExcludeTeam: false, + AppsCategoryEnabled: true, + } + res, nErr := ss.Channel().CreateInitialSidebarCategories(userId, opts) + require.NoError(t, nErr) + require.NotEmpty(t, res) + + // Re-arrange the categories so that Favorites comes last + categories, err := ss.Channel().GetSidebarCategoriesForTeamForUser(userId, team.Id, opts) + require.NoError(t, err) + require.Len(t, categories.Categories, 4) + require.Equal(t, model.SidebarCategoryFavorites, categories.Categories[0].Type) + + err = ss.Channel().UpdateSidebarCategoryOrder(userId, team.Id, []string{ + categories.Categories[1].Id, + categories.Categories[2].Id, + categories.Categories[3].Id, + categories.Categories[0].Id, + }) + require.NoError(t, err) + + // Create the category + created, err := ss.Channel().CreateSidebarCategory(userId, team.Id, &model.SidebarCategoryWithChannels{ + SidebarCategory: model.SidebarCategory{ + DisplayName: model.NewId(), + }, + }, + opts, + ) + require.NoError(t, err) + + // Confirm that it comes first + res, err = ss.Channel().GetSidebarCategoriesForTeamForUser(userId, team.Id, opts) + require.NoError(t, err) + require.Len(t, res.Categories, 5) + assert.Equal(t, model.SidebarCategoryCustom, res.Categories[0].Type) + assert.Equal(t, created.Id, res.Categories[0].Id) + }) + + t.Run("should create the category with its channels", func(t *testing.T) { + userId := model.NewId() + team := setupTeam(t, ss, userId) + + opts := &store.SidebarCategorySearchOpts{ + TeamID: team.Id, + ExcludeTeam: false, + AppsCategoryEnabled: true, + } + res, nErr := ss.Channel().CreateInitialSidebarCategories(userId, opts) + require.NoError(t, nErr) + require.NotEmpty(t, res) + + // Create some channels + channel1, err := ss.Channel().Save(&model.Channel{ + Type: model.ChannelTypeOpen, + TeamId: team.Id, + Name: model.NewId(), + }, 100) + require.NoError(t, err) + channel2, err := ss.Channel().Save(&model.Channel{ + Type: model.ChannelTypeOpen, + TeamId: team.Id, + Name: model.NewId(), + }, 100) + require.NoError(t, err) + + // Create the category + created, err := ss.Channel().CreateSidebarCategory(userId, team.Id, &model.SidebarCategoryWithChannels{ + SidebarCategory: model.SidebarCategory{ + DisplayName: model.NewId(), + }, + Channels: []string{channel2.Id, channel1.Id}, + }, + opts, + ) + require.NoError(t, err) + assert.Equal(t, []string{channel2.Id, channel1.Id}, created.Channels) + + // Get the channel again to ensure that the SidebarChannels were saved correctly + res2, err := ss.Channel().GetSidebarCategory(created.Id, opts) + require.NoError(t, err) + assert.Equal(t, []string{channel2.Id, channel1.Id}, res2.Channels) + }) + + t.Run("should remove any channels from their previous categories", func(t *testing.T) { + userId := model.NewId() + team := setupTeam(t, ss, userId) + + opts := &store.SidebarCategorySearchOpts{ + TeamID: team.Id, + ExcludeTeam: false, + AppsCategoryEnabled: true, + } + res, nErr := ss.Channel().CreateInitialSidebarCategories(userId, opts) + require.NoError(t, nErr) + require.NotEmpty(t, res) + + categories, err := ss.Channel().GetSidebarCategoriesForTeamForUser(userId, team.Id, opts) + require.NoError(t, err) + require.Len(t, categories.Categories, 4) + + favoritesCategory := categories.Categories[0] + require.Equal(t, model.SidebarCategoryFavorites, favoritesCategory.Type) + channelsCategory := categories.Categories[1] + require.Equal(t, model.SidebarCategoryChannels, channelsCategory.Type) + + // Create some channels + channel1, nErr := ss.Channel().Save(&model.Channel{ + Type: model.ChannelTypeOpen, + TeamId: team.Id, + Name: model.NewId(), + }, 100) + require.NoError(t, nErr) + channel2, nErr := ss.Channel().Save(&model.Channel{ + Type: model.ChannelTypeOpen, + TeamId: team.Id, + Name: model.NewId(), + }, 100) + require.NoError(t, nErr) + + // Assign them to categories + favoritesCategory.Channels = []string{channel1.Id} + channelsCategory.Channels = []string{channel2.Id} + _, _, err = ss.Channel().UpdateSidebarCategories(userId, team.Id, []*model.SidebarCategoryWithChannels{ + favoritesCategory, + channelsCategory, + }, + opts, + ) + require.NoError(t, err) + + // Create the category + created, err := ss.Channel().CreateSidebarCategory(userId, team.Id, &model.SidebarCategoryWithChannels{ + SidebarCategory: model.SidebarCategory{ + DisplayName: model.NewId(), + }, + Channels: []string{channel2.Id, channel1.Id}, + }, + opts, + ) + require.NoError(t, err) + assert.Equal(t, []string{channel2.Id, channel1.Id}, created.Channels) + + // Confirm that the channels were removed from their original categories + res2, err := ss.Channel().GetSidebarCategory(favoritesCategory.Id, opts) + require.NoError(t, err) + assert.Equal(t, []string{}, res2.Channels) + + res2, err = ss.Channel().GetSidebarCategory(channelsCategory.Id, opts) + require.NoError(t, err) + assert.Equal(t, []string{}, res2.Channels) + }) +} + +func testGetSidebarCategoryWithAppsCategory(t *testing.T, ss store.Store, s SqlStore) { + t.Run("should return a custom category with its Channels field set", func(t *testing.T) { + userId := model.NewId() + team := setupTeam(t, ss, userId) + + channelId1 := model.NewId() + channelId2 := model.NewId() + channelId3 := model.NewId() + + opts := &store.SidebarCategorySearchOpts{ + TeamID: team.Id, + ExcludeTeam: false, + AppsCategoryEnabled: true, + } + res, nErr := ss.Channel().CreateInitialSidebarCategories(userId, opts) + require.NoError(t, nErr) + require.NotEmpty(t, res) + + // Create a category and assign some channels to it + created, err := ss.Channel().CreateSidebarCategory(userId, team.Id, &model.SidebarCategoryWithChannels{ + SidebarCategory: model.SidebarCategory{ + UserId: userId, + TeamId: team.Id, + DisplayName: model.NewId(), + }, + Channels: []string{channelId1, channelId2, channelId3}, + }, + opts, + ) + require.NoError(t, err) + require.NotNil(t, created) + + // Ensure that they're returned in order + res2, err := ss.Channel().GetSidebarCategory(created.Id, opts) + assert.NoError(t, err) + assert.Equal(t, created.Id, res2.Id) + assert.Equal(t, model.SidebarCategoryCustom, res2.Type) + assert.Equal(t, created.DisplayName, res2.DisplayName) + assert.Equal(t, []string{channelId1, channelId2, channelId3}, res2.Channels) + }) + + t.Run("should return any orphaned channels with the Channels category", func(t *testing.T) { + userId := model.NewId() + team := setupTeam(t, ss, userId) + + // Create the initial categories and find the channels category + opts := &store.SidebarCategorySearchOpts{ + TeamID: team.Id, + ExcludeTeam: false, + AppsCategoryEnabled: true, + } + res, nErr := ss.Channel().CreateInitialSidebarCategories(userId, opts) + require.NoError(t, nErr) + require.NotEmpty(t, res) + + categories, err := ss.Channel().GetSidebarCategoriesForTeamForUser(userId, team.Id, opts) + require.NoError(t, err) + + channelsCategory := categories.Categories[1] + require.Equal(t, model.SidebarCategoryChannels, channelsCategory.Type) + + // Join some channels + channel1, nErr := ss.Channel().Save(&model.Channel{ + Name: "channel1", + DisplayName: "DEF", + TeamId: team.Id, + Type: model.ChannelTypePrivate, + }, 10) + require.NoError(t, nErr) + _, nErr = ss.Channel().SaveMember(&model.ChannelMember{ + UserId: userId, + ChannelId: channel1.Id, + NotifyProps: model.GetDefaultChannelNotifyProps(), + }) + require.NoError(t, nErr) + + channel2, nErr := ss.Channel().Save(&model.Channel{ + Name: "channel2", + DisplayName: "ABC", + TeamId: team.Id, + Type: model.ChannelTypeOpen, + }, 10) + require.NoError(t, nErr) + _, nErr = ss.Channel().SaveMember(&model.ChannelMember{ + UserId: userId, + ChannelId: channel2.Id, + NotifyProps: model.GetDefaultChannelNotifyProps(), + }) + require.NoError(t, nErr) + + // Confirm that they're not in the Channels category in the DB + var count int64 + countErr := s.GetMasterX().Get(&count, ` + SELECT + COUNT(*) + FROM + SidebarChannels + WHERE + CategoryId = ?`, channelsCategory.Id) + require.NoError(t, countErr) + assert.Equal(t, int64(0), count) + + // Ensure that the Channels are returned in alphabetical order + res2, err := ss.Channel().GetSidebarCategory(channelsCategory.Id, opts) + assert.NoError(t, err) + assert.Equal(t, channelsCategory.Id, res2.Id) + assert.Equal(t, model.SidebarCategoryChannels, channelsCategory.Type) + assert.Equal(t, []string{channel2.Id, channel1.Id}, res2.Channels) + }) + + t.Run("shouldn't return orphaned channels on another team with the Channels category", func(t *testing.T) { + userId := model.NewId() + team := setupTeam(t, ss, userId) + + // Create the initial categories and find the channels category + opts := &store.SidebarCategorySearchOpts{ + TeamID: team.Id, + ExcludeTeam: false, + AppsCategoryEnabled: true, + } + res, nErr := ss.Channel().CreateInitialSidebarCategories(userId, opts) + require.NoError(t, nErr) + require.NotEmpty(t, res) + + categories, err := ss.Channel().GetSidebarCategoriesForTeamForUser(userId, team.Id, opts) + require.NoError(t, err) + require.Equal(t, model.SidebarCategoryChannels, categories.Categories[1].Type) + + channelsCategory := categories.Categories[1] + + // Join a channel on another team + channel1, nErr := ss.Channel().Save(&model.Channel{ + Name: "abc", + TeamId: model.NewId(), + Type: model.ChannelTypeOpen, + }, 10) + require.NoError(t, nErr) + defer ss.Channel().PermanentDelete(channel1.Id) + + _, nErr = ss.Channel().SaveMember(&model.ChannelMember{ + UserId: userId, + ChannelId: channel1.Id, + NotifyProps: model.GetDefaultChannelNotifyProps(), + }) + require.NoError(t, nErr) + + // Ensure that no channels are returned + res2, err := ss.Channel().GetSidebarCategory(channelsCategory.Id, opts) + assert.NoError(t, err) + assert.Equal(t, channelsCategory.Id, res2.Id) + assert.Equal(t, model.SidebarCategoryChannels, channelsCategory.Type) + assert.Len(t, res2.Channels, 0) + }) + + t.Run("shouldn't return non-orphaned channels with the Channels category", func(t *testing.T) { + userId := model.NewId() + team := setupTeam(t, ss, userId) + + opts := &store.SidebarCategorySearchOpts{ + TeamID: team.Id, + ExcludeTeam: false, + AppsCategoryEnabled: true, + } + // Create the initial categories and find the channels category + res, nErr := ss.Channel().CreateInitialSidebarCategories(userId, opts) + require.NoError(t, nErr) + require.NotEmpty(t, res) + + categories, err := ss.Channel().GetSidebarCategoriesForTeamForUser(userId, team.Id, opts) + require.NoError(t, err) + + favoritesCategory := categories.Categories[0] + require.Equal(t, model.SidebarCategoryFavorites, favoritesCategory.Type) + channelsCategory := categories.Categories[1] + require.Equal(t, model.SidebarCategoryChannels, channelsCategory.Type) + + // Join some channels + channel1, nErr := ss.Channel().Save(&model.Channel{ + Name: "channel1", + DisplayName: "DEF", + TeamId: team.Id, + Type: model.ChannelTypePrivate, + }, 10) + require.NoError(t, nErr) + _, nErr = ss.Channel().SaveMember(&model.ChannelMember{ + UserId: userId, + ChannelId: channel1.Id, + NotifyProps: model.GetDefaultChannelNotifyProps(), + }) + require.NoError(t, nErr) + + channel2, nErr := ss.Channel().Save(&model.Channel{ + Name: "channel2", + DisplayName: "ABC", + TeamId: team.Id, + Type: model.ChannelTypeOpen, + }, 10) + require.NoError(t, nErr) + _, nErr = ss.Channel().SaveMember(&model.ChannelMember{ + UserId: userId, + ChannelId: channel2.Id, + NotifyProps: model.GetDefaultChannelNotifyProps(), + }) + require.NoError(t, nErr) + + // And assign one to another category + _, _, err = ss.Channel().UpdateSidebarCategories(userId, team.Id, []*model.SidebarCategoryWithChannels{ + { + SidebarCategory: favoritesCategory.SidebarCategory, + Channels: []string{channel2.Id}, + }, + }, + opts, + ) + require.NoError(t, err) + + // Ensure that the correct channel is returned in the Channels category + res2, err := ss.Channel().GetSidebarCategory(channelsCategory.Id, opts) + assert.NoError(t, err) + assert.Equal(t, channelsCategory.Id, res2.Id) + assert.Equal(t, model.SidebarCategoryChannels, channelsCategory.Type) + assert.Equal(t, []string{channel1.Id}, res2.Channels) + }) + + t.Run("should return any orphaned DM channels with the Direct Messages category", func(t *testing.T) { + userId := model.NewId() + team := setupTeam(t, ss, userId) + + // Create the initial categories and find the DMs category + opts := &store.SidebarCategorySearchOpts{ + TeamID: team.Id, + ExcludeTeam: false, + AppsCategoryEnabled: true, + } + res, nErr := ss.Channel().CreateInitialSidebarCategories(userId, opts) + require.NoError(t, nErr) + require.NotEmpty(t, res) + + categories, err := ss.Channel().GetSidebarCategoriesForTeamForUser(userId, team.Id, opts) + require.NoError(t, err) + require.Equal(t, model.SidebarCategoryDirectMessages, categories.Categories[2].Type) + + dmsCategory := categories.Categories[2] + + // Create a DM + otherUserId := model.NewId() + dmChannel, nErr := ss.Channel().SaveDirectChannel( + &model.Channel{ + Name: model.GetDMNameFromIds(userId, otherUserId), + Type: model.ChannelTypeDirect, + }, + &model.ChannelMember{ + UserId: userId, + NotifyProps: model.GetDefaultChannelNotifyProps(), + }, + &model.ChannelMember{ + UserId: otherUserId, + NotifyProps: model.GetDefaultChannelNotifyProps(), + }, + ) + require.NoError(t, nErr) + + // Ensure that the DM is returned + res2, err := ss.Channel().GetSidebarCategory(dmsCategory.Id, opts) + assert.NoError(t, err) + assert.Equal(t, dmsCategory.Id, res2.Id) + assert.Equal(t, model.SidebarCategoryDirectMessages, res2.Type) + assert.Equal(t, []string{dmChannel.Id}, res2.Channels) + }) + + t.Run("should return any orphaned GM channels with the Direct Messages category", func(t *testing.T) { + userId := model.NewId() + team := setupTeam(t, ss, userId) + + // Create the initial categories and find the DMs category + opts := &store.SidebarCategorySearchOpts{ + TeamID: team.Id, + ExcludeTeam: false, + AppsCategoryEnabled: true, + } + res, nErr := ss.Channel().CreateInitialSidebarCategories(userId, opts) + require.NoError(t, nErr) + require.NotEmpty(t, res) + + categories, err := ss.Channel().GetSidebarCategoriesForTeamForUser(userId, team.Id, opts) + require.NoError(t, err) + require.Equal(t, model.SidebarCategoryDirectMessages, categories.Categories[2].Type) + + dmsCategory := categories.Categories[2] + + // Create a GM + gmChannel, nErr := ss.Channel().Save(&model.Channel{ + Name: "abc", + TeamId: "", + Type: model.ChannelTypeGroup, + }, 10) + require.NoError(t, nErr) + defer ss.Channel().PermanentDelete(gmChannel.Id) + _, nErr = ss.Channel().SaveMember(&model.ChannelMember{ + UserId: userId, + ChannelId: gmChannel.Id, + NotifyProps: model.GetDefaultChannelNotifyProps(), + }) + require.NoError(t, nErr) + + // Ensure that the DM is returned + res2, err := ss.Channel().GetSidebarCategory(dmsCategory.Id, opts) + assert.NoError(t, err) + assert.Equal(t, dmsCategory.Id, res2.Id) + assert.Equal(t, model.SidebarCategoryDirectMessages, res2.Type) + assert.Equal(t, []string{gmChannel.Id}, res2.Channels) + }) + + t.Run("should return orphaned DM channels in the DMs category which are in a custom category on another team", func(t *testing.T) { + userId := model.NewId() + team := setupTeam(t, ss, userId) + + // Create the initial categories and find the DMs category + opts := &store.SidebarCategorySearchOpts{ + TeamID: team.Id, + ExcludeTeam: false, + AppsCategoryEnabled: true, + } + res, nErr := ss.Channel().CreateInitialSidebarCategories(userId, opts) + require.NoError(t, nErr) + require.NotEmpty(t, res) + + categories, err := ss.Channel().GetSidebarCategoriesForTeamForUser(userId, team.Id, opts) + require.NoError(t, err) + require.Equal(t, model.SidebarCategoryDirectMessages, categories.Categories[2].Type) + + dmsCategory := categories.Categories[2] + + // Create a DM + otherUserId := model.NewId() + dmChannel, nErr := ss.Channel().SaveDirectChannel( + &model.Channel{ + Name: model.GetDMNameFromIds(userId, otherUserId), + Type: model.ChannelTypeDirect, + }, + &model.ChannelMember{ + UserId: userId, + NotifyProps: model.GetDefaultChannelNotifyProps(), + }, + &model.ChannelMember{ + UserId: otherUserId, + NotifyProps: model.GetDefaultChannelNotifyProps(), + }, + ) + require.NoError(t, nErr) + + // Create another team and assign the DM to a custom category on that team + otherTeam := setupTeam(t, ss, userId) + opts = &store.SidebarCategorySearchOpts{ + TeamID: otherTeam.Id, + ExcludeTeam: false, + AppsCategoryEnabled: true, + } + res, nErr = ss.Channel().CreateInitialSidebarCategories(userId, opts) + require.NoError(t, nErr) + require.NotEmpty(t, res) + + _, err = ss.Channel().CreateSidebarCategory(userId, otherTeam.Id, &model.SidebarCategoryWithChannels{ + SidebarCategory: model.SidebarCategory{ + UserId: userId, + TeamId: team.Id, + }, + Channels: []string{dmChannel.Id}, + }, + opts, + ) + require.NoError(t, err) + + // Ensure that the DM is returned with the DMs category on the original team + res2, err := ss.Channel().GetSidebarCategory(dmsCategory.Id, opts) + assert.NoError(t, err) + assert.Equal(t, dmsCategory.Id, res2.Id) + assert.Equal(t, model.SidebarCategoryDirectMessages, res2.Type) + assert.Equal(t, []string{dmChannel.Id}, res2.Channels) + }) + + t.Run("should return any orphaned DM Bot channels with the Apps category", func(t *testing.T) { + userId := model.NewId() + team := setupTeam(t, ss, userId) + + // Create the initial categories and find the DMs category + opts := &store.SidebarCategorySearchOpts{ + TeamID: team.Id, + ExcludeTeam: false, + AppsCategoryEnabled: true, + } + res, nErr := ss.Channel().CreateInitialSidebarCategories(userId, opts) + require.NoError(t, nErr) + require.NotEmpty(t, res) + + categories, err := ss.Channel().GetSidebarCategoriesForTeamForUser(userId, team.Id, opts) + require.NoError(t, err) + require.Equal(t, model.SidebarCategoryApps, categories.Categories[3].Type) + + appsCategory := categories.Categories[3] + + // Create a Bot user + botId := model.NewId() + botUser, _ := makeBotWithUser(t, ss, &model.Bot{ + Username: botId + "somebot", + Description: "a bot", + OwnerId: botId, + LastIconUpdate: model.GetMillis(), + }) + + // Create a DM with Bot + dmChannel, nErr := ss.Channel().SaveDirectChannel( + &model.Channel{ + Name: model.GetDMNameFromIds(userId, botUser.UserId), + Type: model.ChannelTypeDirect, + }, + &model.ChannelMember{ + UserId: userId, + NotifyProps: model.GetDefaultChannelNotifyProps(), + }, + &model.ChannelMember{ + UserId: botUser.UserId, + NotifyProps: model.GetDefaultChannelNotifyProps(), + }, + ) + require.NoError(t, nErr) + + // Ensure that the DM Bot is returned + res2, err := ss.Channel().GetSidebarCategory(appsCategory.Id, opts) + assert.NoError(t, err) + assert.Equal(t, appsCategory.Id, res2.Id) + assert.Equal(t, model.SidebarCategoryApps, res2.Type) + assert.Equal(t, []string{dmChannel.Id}, res2.Channels) + }) + + t.Run("should return orphaned DM Bot channels in the Apps category which are in a custom category on another team", func(t *testing.T) { + userId := model.NewId() + team := setupTeam(t, ss, userId) + + // Create the initial categories and find the DMs category + opts := &store.SidebarCategorySearchOpts{ + TeamID: team.Id, + ExcludeTeam: false, + AppsCategoryEnabled: true, + } + res, nErr := ss.Channel().CreateInitialSidebarCategories(userId, opts) + require.NoError(t, nErr) + require.NotEmpty(t, res) + + categories, err := ss.Channel().GetSidebarCategoriesForTeamForUser(userId, team.Id, opts) + require.NoError(t, err) + require.Equal(t, model.SidebarCategoryApps, categories.Categories[3].Type) + + appsCategory := categories.Categories[3] + + // Create a Bot user + botId := model.NewId() + botUser, _ := makeBotWithUser(t, ss, &model.Bot{ + Username: botId + "somebot", + Description: "a bot", + OwnerId: botId, + LastIconUpdate: model.GetMillis(), + }) + + // Create a DM with Bot + dmChannel, nErr := ss.Channel().SaveDirectChannel( + &model.Channel{ + Name: model.GetDMNameFromIds(userId, botUser.UserId), + Type: model.ChannelTypeDirect, + }, + &model.ChannelMember{ + UserId: userId, + NotifyProps: model.GetDefaultChannelNotifyProps(), + }, + &model.ChannelMember{ + UserId: botUser.UserId, + NotifyProps: model.GetDefaultChannelNotifyProps(), + }, + ) + require.NoError(t, nErr) + + // Create another team and assign the DM Bot to a custom category on that team + otherTeam := setupTeam(t, ss, userId) + opts = &store.SidebarCategorySearchOpts{ + TeamID: otherTeam.Id, + ExcludeTeam: false, + AppsCategoryEnabled: true, + } + res, nErr = ss.Channel().CreateInitialSidebarCategories(userId, opts) + require.NoError(t, nErr) + require.NotEmpty(t, res) + + _, err = ss.Channel().CreateSidebarCategory(userId, otherTeam.Id, &model.SidebarCategoryWithChannels{ + SidebarCategory: model.SidebarCategory{ + UserId: userId, + TeamId: team.Id, + }, + Channels: []string{dmChannel.Id}, + }, + opts, + ) + require.NoError(t, err) + + // Ensure that the DM is returned with the DMs category on the original team + res2, err := ss.Channel().GetSidebarCategory(appsCategory.Id, opts) + assert.NoError(t, err) + assert.Equal(t, appsCategory.Id, res2.Id) + assert.Equal(t, model.SidebarCategoryApps, res2.Type) + assert.Equal(t, []string{dmChannel.Id}, res2.Channels) + }) +} + +func testGetSidebarCategoriesWithAppsCategory(t *testing.T, ss store.Store) { + t.Run("should return channels in the same order between different ways of getting categories", func(t *testing.T) { + userId := model.NewId() + team := setupTeam(t, ss, userId) + + opts := &store.SidebarCategorySearchOpts{ + TeamID: team.Id, + ExcludeTeam: false, + AppsCategoryEnabled: true, + } + res, nErr := ss.Channel().CreateInitialSidebarCategories(userId, opts) + require.NoError(t, nErr) + require.NotEmpty(t, res) + + channelIds := []string{ + model.NewId(), + model.NewId(), + model.NewId(), + } + + newCategory, err := ss.Channel().CreateSidebarCategory(userId, team.Id, &model.SidebarCategoryWithChannels{ + Channels: channelIds, + }, + opts, + ) + require.NoError(t, err) + require.NotNil(t, newCategory) + + gotCategory, err := ss.Channel().GetSidebarCategory(newCategory.Id, opts) + require.NoError(t, err) + + res, err = ss.Channel().GetSidebarCategoriesForTeamForUser(userId, team.Id, opts) + require.NoError(t, err) + require.Len(t, res.Categories, 5) + + require.Equal(t, model.SidebarCategoryCustom, res.Categories[1].Type) + + // This looks unnecessary, but I was getting different results from some of these before + assert.Equal(t, newCategory.Channels, res.Categories[1].Channels) + assert.Equal(t, gotCategory.Channels, res.Categories[1].Channels) + assert.Equal(t, channelIds, res.Categories[1].Channels) + }) + t.Run("should not return categories for teams deleted, or no longer a member", func(t *testing.T) { + userId := model.NewId() + + teamMember1 := setupTeam(t, ss, userId) + teamMember2 := setupTeam(t, ss, userId) + teamDeleted := setupTeam(t, ss, userId) + teamDeleted.DeleteAt = model.GetMillis() + ss.Team().Update(teamDeleted) + teamNotMember := setupTeam(t, ss) + teamDeletedMember := setupTeam(t, ss, userId) + + members, err := ss.Team().GetMembersByIds(teamDeletedMember.Id, []string{userId}, nil) + require.NoError(t, err) + require.NotEmpty(t, members) + member := members[0] + member.DeleteAt = model.GetMillis() + ss.Team().UpdateMember(member) + + teamIds := []string{ + teamMember1.Id, + teamMember2.Id, + teamDeleted.Id, + teamNotMember.Id, + teamDeletedMember.Id, + } + + for _, id := range teamIds { + res, nErr := ss.Channel().CreateInitialSidebarCategories(userId, &store.SidebarCategorySearchOpts{TeamID: id, AppsCategoryEnabled: true}) + require.NoError(t, nErr) + require.NotEmpty(t, res) + } + + opts := &store.SidebarCategorySearchOpts{ + TeamID: teamMember1.Id, + ExcludeTeam: false, + AppsCategoryEnabled: true, + } + + // Team member and not exclude + res, err := ss.Channel().GetSidebarCategories(userId, opts) + require.NoError(t, err) + assert.Equal(t, 4, len(res.Categories)) + + // No team member and not exclude + opts.TeamID = teamDeleted.Id + res, err = ss.Channel().GetSidebarCategories(userId, opts) + require.NoError(t, err) + assert.Equal(t, 0, len(res.Categories)) + + // No team member and exclude + opts.ExcludeTeam = true + res, err = ss.Channel().GetSidebarCategories(userId, opts) + require.NoError(t, err) + assert.Equal(t, 8, len(res.Categories)) + + // Team member and exclude + opts.TeamID = teamMember1.Id + res, err = ss.Channel().GetSidebarCategories(userId, opts) + require.NoError(t, err) + assert.Equal(t, 4, len(res.Categories)) + }) +} + +func testUpdateSidebarCategoriesWithAppsCategory(t *testing.T, ss store.Store) { + t.Run("ensure the query to update SidebarCategories hasn't been polluted by UpdateSidebarCategoryOrder", func(t *testing.T) { + userId := model.NewId() + team := setupTeam(t, ss, userId) + + // Create the initial categories + opts := &store.SidebarCategorySearchOpts{ + TeamID: team.Id, + ExcludeTeam: false, + AppsCategoryEnabled: true, + } + res, err := ss.Channel().CreateInitialSidebarCategories(userId, opts) + require.NoError(t, err) + require.NotEmpty(t, res) + + initialCategories, err := ss.Channel().GetSidebarCategoriesForTeamForUser(userId, team.Id, opts) + require.NoError(t, err) + + favoritesCategory := initialCategories.Categories[0] + channelsCategory := initialCategories.Categories[1] + dmsCategory := initialCategories.Categories[2] + appsCategory := initialCategories.Categories[3] + + // And then update one of them + updated, _, err := ss.Channel().UpdateSidebarCategories(userId, team.Id, []*model.SidebarCategoryWithChannels{ + channelsCategory, + }, + opts, + ) + require.NoError(t, err) + assert.Equal(t, channelsCategory, updated[0]) + assert.Equal(t, "Channels", updated[0].DisplayName) + + // And then reorder the categories + err = ss.Channel().UpdateSidebarCategoryOrder(userId, team.Id, []string{dmsCategory.Id, favoritesCategory.Id, channelsCategory.Id, appsCategory.Id}) + require.NoError(t, err) + + // Which somehow blanks out stuff because ??? + got, err := ss.Channel().GetSidebarCategory(favoritesCategory.Id, opts) + require.NoError(t, err) + assert.Equal(t, "Favorites", got.DisplayName) + }) + + t.Run("categories should be returned in their original order", func(t *testing.T) { + userId := model.NewId() + team := setupTeam(t, ss, userId) + + // Create the initial categories + opts := &store.SidebarCategorySearchOpts{ + TeamID: team.Id, + ExcludeTeam: false, + AppsCategoryEnabled: true, + } + res, err := ss.Channel().CreateInitialSidebarCategories(userId, opts) + require.NoError(t, err) + require.NotEmpty(t, res) + + initialCategories, err := ss.Channel().GetSidebarCategoriesForTeamForUser(userId, team.Id, opts) + require.NoError(t, err) + + favoritesCategory := initialCategories.Categories[0] + channelsCategory := initialCategories.Categories[1] + dmsCategory := initialCategories.Categories[2] + appsCategory := initialCategories.Categories[3] + + // And then update them + updatedCategories, _, err := ss.Channel().UpdateSidebarCategories(userId, team.Id, []*model.SidebarCategoryWithChannels{ + favoritesCategory, + channelsCategory, + dmsCategory, + appsCategory, + }) + assert.NoError(t, err) + assert.Equal(t, favoritesCategory.Id, updatedCategories[0].Id) + assert.Equal(t, channelsCategory.Id, updatedCategories[1].Id) + assert.Equal(t, dmsCategory.Id, updatedCategories[2].Id) + assert.Equal(t, appsCategory.Id, updatedCategories[3].Id) + }) + + t.Run("should silently fail to update read only fields", func(t *testing.T) { + userId := model.NewId() + team := setupTeam(t, ss, userId) + + opts := &store.SidebarCategorySearchOpts{ + TeamID: team.Id, + ExcludeTeam: false, + AppsCategoryEnabled: true, + } + res, nErr := ss.Channel().CreateInitialSidebarCategories(userId, opts) + require.NoError(t, nErr) + require.NotEmpty(t, res) + + initialCategories, err := ss.Channel().GetSidebarCategoriesForTeamForUser(userId, team.Id, opts) + require.NoError(t, err) + + favoritesCategory := initialCategories.Categories[0] + channelsCategory := initialCategories.Categories[1] + dmsCategory := initialCategories.Categories[2] + appsCategory := initialCategories.Categories[3] + + customCategory, err := ss.Channel().CreateSidebarCategory(userId, team.Id, &model.SidebarCategoryWithChannels{}, opts) + require.NoError(t, err) + + categoriesToUpdate := []*model.SidebarCategoryWithChannels{ + // Try to change the type of Favorites + { + SidebarCategory: model.SidebarCategory{ + Id: favoritesCategory.Id, + DisplayName: "something else", + }, + Channels: favoritesCategory.Channels, + }, + // Try to change the type of Channels + { + SidebarCategory: model.SidebarCategory{ + Id: channelsCategory.Id, + Type: model.SidebarCategoryDirectMessages, + }, + Channels: channelsCategory.Channels, + }, + // Try to change the Channels of DMs + { + SidebarCategory: dmsCategory.SidebarCategory, + Channels: []string{"fakechannel"}, + }, + // Try to change the Channels of Apps + { + SidebarCategory: appsCategory.SidebarCategory, + Channels: []string{"fakechannel"}, + }, + // Try to change the UserId/TeamId of a custom category + { + SidebarCategory: model.SidebarCategory{ + Id: customCategory.Id, + UserId: model.NewId(), + TeamId: model.NewId(), + Sorting: customCategory.Sorting, + DisplayName: customCategory.DisplayName, + }, + Channels: customCategory.Channels, + }, + } + + updatedCategories, _, err := ss.Channel().UpdateSidebarCategories(userId, team.Id, categoriesToUpdate, opts) + assert.NoError(t, err) + + assert.NotEqual(t, "Favorites", categoriesToUpdate[0].DisplayName) + assert.Equal(t, "Favorites", updatedCategories[0].DisplayName) + assert.NotEqual(t, model.SidebarCategoryChannels, categoriesToUpdate[1].Type) + assert.Equal(t, model.SidebarCategoryChannels, updatedCategories[1].Type) + assert.NotEqual(t, []string{}, categoriesToUpdate[2].Channels) + assert.Equal(t, []string{}, updatedCategories[2].Channels) + assert.NotEqual(t, []string{}, categoriesToUpdate[3].Channels) + assert.Equal(t, []string{}, updatedCategories[3].Channels) + assert.NotEqual(t, userId, categoriesToUpdate[4].UserId) + assert.Equal(t, userId, updatedCategories[4].UserId) + }) + + t.Run("should add and remove favorites preferences based on the Favorites category", func(t *testing.T) { + userId := model.NewId() + team := setupTeam(t, ss, userId) + + // Create the initial categories and find the favorites category + opts := &store.SidebarCategorySearchOpts{ + TeamID: team.Id, + ExcludeTeam: false, + AppsCategoryEnabled: true, + } + res, nErr := ss.Channel().CreateInitialSidebarCategories(userId, opts) + require.NoError(t, nErr) + require.NotEmpty(t, res) + + categories, err := ss.Channel().GetSidebarCategoriesForTeamForUser(userId, team.Id, opts) + require.NoError(t, err) + + favoritesCategory := categories.Categories[0] + require.Equal(t, model.SidebarCategoryFavorites, favoritesCategory.Type) + + // Join a channel + channel, nErr := ss.Channel().Save(&model.Channel{ + Name: "channel", + Type: model.ChannelTypeOpen, + TeamId: team.Id, + }, 10) + require.NoError(t, nErr) + _, nErr = ss.Channel().SaveMember(&model.ChannelMember{ + UserId: userId, + ChannelId: channel.Id, + NotifyProps: model.GetDefaultChannelNotifyProps(), + }) + require.NoError(t, nErr) + + // Assign it to favorites + _, _, err = ss.Channel().UpdateSidebarCategories(userId, team.Id, []*model.SidebarCategoryWithChannels{ + { + SidebarCategory: favoritesCategory.SidebarCategory, + Channels: []string{channel.Id}, + }, + }, + opts, + ) + assert.NoError(t, err) + + res2, nErr := ss.Preference().Get(userId, model.PreferenceCategoryFavoriteChannel, channel.Id) + assert.NoError(t, nErr) + assert.NotNil(t, res2) + assert.Equal(t, "true", res2.Value) + + // And then remove it + channelsCategory := categories.Categories[1] + require.Equal(t, model.SidebarCategoryChannels, channelsCategory.Type) + + _, _, err = ss.Channel().UpdateSidebarCategories(userId, team.Id, []*model.SidebarCategoryWithChannels{ + { + SidebarCategory: channelsCategory.SidebarCategory, + Channels: []string{channel.Id}, + }, + }, + opts, + ) + assert.NoError(t, err) + + res2, nErr = ss.Preference().Get(userId, model.PreferenceCategoryFavoriteChannel, channel.Id) + assert.Error(t, nErr) + assert.True(t, errors.Is(nErr, sql.ErrNoRows)) + assert.Nil(t, res2) + }) + + t.Run("should add and remove favorites preferences for DMs", func(t *testing.T) { + userId := model.NewId() + team := setupTeam(t, ss, userId) + + // Create the initial categories and find the favorites category + opts := &store.SidebarCategorySearchOpts{ + TeamID: team.Id, + ExcludeTeam: false, + AppsCategoryEnabled: true, + } + res, nErr := ss.Channel().CreateInitialSidebarCategories(userId, opts) + require.NoError(t, nErr) + require.NotEmpty(t, res) + + categories, err := ss.Channel().GetSidebarCategoriesForTeamForUser(userId, team.Id, opts) + require.NoError(t, err) + + favoritesCategory := categories.Categories[0] + require.Equal(t, model.SidebarCategoryFavorites, favoritesCategory.Type) + + // Create a direct channel + otherUserId := model.NewId() + + dmChannel, nErr := ss.Channel().SaveDirectChannel( + &model.Channel{ + Name: model.GetDMNameFromIds(userId, otherUserId), + Type: model.ChannelTypeDirect, + }, + &model.ChannelMember{ + UserId: userId, + NotifyProps: model.GetDefaultChannelNotifyProps(), + }, + &model.ChannelMember{ + UserId: otherUserId, + NotifyProps: model.GetDefaultChannelNotifyProps(), + }, + ) + assert.NoError(t, nErr) + + // Assign it to favorites + _, _, err = ss.Channel().UpdateSidebarCategories(userId, team.Id, []*model.SidebarCategoryWithChannels{ + { + SidebarCategory: favoritesCategory.SidebarCategory, + Channels: []string{dmChannel.Id}, + }, + }, + opts, + ) + assert.NoError(t, err) + + res2, nErr := ss.Preference().Get(userId, model.PreferenceCategoryFavoriteChannel, dmChannel.Id) + assert.NoError(t, nErr) + assert.NotNil(t, res2) + assert.Equal(t, "true", res2.Value) + + // And then remove it + dmsCategory := categories.Categories[2] + require.Equal(t, model.SidebarCategoryDirectMessages, dmsCategory.Type) + + _, _, err = ss.Channel().UpdateSidebarCategories(userId, team.Id, []*model.SidebarCategoryWithChannels{ + { + SidebarCategory: dmsCategory.SidebarCategory, + Channels: []string{dmChannel.Id}, + }, + }, + opts, + ) + assert.NoError(t, err) + + res2, nErr = ss.Preference().Get(userId, model.PreferenceCategoryFavoriteChannel, dmChannel.Id) + assert.Error(t, nErr) + assert.True(t, errors.Is(nErr, sql.ErrNoRows)) + assert.Nil(t, res2) + }) + + t.Run("should add and remove favorites preferences, even if the channel is already favorited in preferences", func(t *testing.T) { + userId := model.NewId() + team := setupTeam(t, ss, userId) + team2 := setupTeam(t, ss, userId) + + // Create the initial categories and find the favorites categories in each team + opts := &store.SidebarCategorySearchOpts{ + TeamID: team.Id, + ExcludeTeam: false, + AppsCategoryEnabled: true, + } + res, nErr := ss.Channel().CreateInitialSidebarCategories(userId, opts) + require.NoError(t, nErr) + require.NotEmpty(t, res) + + categories, err := ss.Channel().GetSidebarCategoriesForTeamForUser(userId, team.Id, opts) + require.NoError(t, err) + + favoritesCategory := categories.Categories[0] + require.Equal(t, model.SidebarCategoryFavorites, favoritesCategory.Type) + + opts = &store.SidebarCategorySearchOpts{ + TeamID: team2.Id, + ExcludeTeam: false, + AppsCategoryEnabled: true, + } + res, nErr = ss.Channel().CreateInitialSidebarCategories(userId, opts) + require.NoError(t, nErr) + require.NotEmpty(t, res) + + categories2, err := ss.Channel().GetSidebarCategoriesForTeamForUser(userId, team2.Id, opts) + require.NoError(t, err) + + favoritesCategory2 := categories2.Categories[0] + require.Equal(t, model.SidebarCategoryFavorites, favoritesCategory2.Type) + + // Create a direct channel + otherUserId := model.NewId() + + dmChannel, nErr := ss.Channel().SaveDirectChannel( + &model.Channel{ + Name: model.GetDMNameFromIds(userId, otherUserId), + Type: model.ChannelTypeDirect, + }, + &model.ChannelMember{ + UserId: userId, + NotifyProps: model.GetDefaultChannelNotifyProps(), + }, + &model.ChannelMember{ + UserId: otherUserId, + NotifyProps: model.GetDefaultChannelNotifyProps(), + }, + ) + assert.NoError(t, nErr) + + // Assign it to favorites on the first team. The favorites preference gets set for all teams. + _, _, err = ss.Channel().UpdateSidebarCategories(userId, team.Id, []*model.SidebarCategoryWithChannels{ + { + SidebarCategory: favoritesCategory.SidebarCategory, + Channels: []string{dmChannel.Id}, + }, + }, + opts, + ) + assert.NoError(t, err) + + res2, nErr := ss.Preference().Get(userId, model.PreferenceCategoryFavoriteChannel, dmChannel.Id) + assert.NoError(t, nErr) + assert.NotNil(t, res2) + assert.Equal(t, "true", res2.Value) + + // Assign it to favorites on the second team. The favorites preference is already set. + updated, _, err := ss.Channel().UpdateSidebarCategories(userId, team.Id, []*model.SidebarCategoryWithChannels{ + { + SidebarCategory: favoritesCategory2.SidebarCategory, + Channels: []string{dmChannel.Id}, + }, + }, + opts, + ) + assert.NoError(t, err) + assert.Equal(t, []string{dmChannel.Id}, updated[0].Channels) + + res2, nErr = ss.Preference().Get(userId, model.PreferenceCategoryFavoriteChannel, dmChannel.Id) + assert.NoError(t, nErr) + assert.NotNil(t, res2) + assert.Equal(t, "true", res2.Value) + + // Remove it from favorites on the first team. This clears the favorites preference for all teams. + _, _, err = ss.Channel().UpdateSidebarCategories(userId, team.Id, []*model.SidebarCategoryWithChannels{ + { + SidebarCategory: favoritesCategory.SidebarCategory, + Channels: []string{}, + }, + }, + opts, + ) + assert.NoError(t, err) + + res2, nErr = ss.Preference().Get(userId, model.PreferenceCategoryFavoriteChannel, dmChannel.Id) + require.Error(t, nErr) + assert.Nil(t, res2) + + // Remove it from favorites on the second team. The favorites preference was already deleted. + _, _, err = ss.Channel().UpdateSidebarCategories(userId, team.Id, []*model.SidebarCategoryWithChannels{ + { + SidebarCategory: favoritesCategory2.SidebarCategory, + Channels: []string{}, + }, + }, + opts, + ) + assert.NoError(t, err) + + res2, nErr = ss.Preference().Get(userId, model.PreferenceCategoryFavoriteChannel, dmChannel.Id) + require.Error(t, nErr) + assert.Nil(t, res2) + }) + + t.Run("should not affect other users' favorites preferences", func(t *testing.T) { + userId := model.NewId() + userId2 := model.NewId() + team := setupTeam(t, ss, userId, userId2) + + // Create the initial categories and find the favorites category + opts := &store.SidebarCategorySearchOpts{ + TeamID: team.Id, + ExcludeTeam: false, + AppsCategoryEnabled: true, + } + res, nErr := ss.Channel().CreateInitialSidebarCategories(userId, opts) + require.NoError(t, nErr) + require.NotEmpty(t, res) + + categories, err := ss.Channel().GetSidebarCategoriesForTeamForUser(userId, team.Id, opts) + require.NoError(t, err) + + favoritesCategory := categories.Categories[0] + require.Equal(t, model.SidebarCategoryFavorites, favoritesCategory.Type) + channelsCategory := categories.Categories[1] + require.Equal(t, model.SidebarCategoryChannels, channelsCategory.Type) + + // Create the other users' categories + res, nErr = ss.Channel().CreateInitialSidebarCategories(userId2, opts) + require.NoError(t, nErr) + require.NotEmpty(t, res) + + categories2, err := ss.Channel().GetSidebarCategoriesForTeamForUser(userId2, team.Id, opts) + require.NoError(t, err) + + favoritesCategory2 := categories2.Categories[0] + require.Equal(t, model.SidebarCategoryFavorites, favoritesCategory2.Type) + channelsCategory2 := categories2.Categories[1] + require.Equal(t, model.SidebarCategoryChannels, channelsCategory2.Type) + + // Have both users join a channel + channel, nErr := ss.Channel().Save(&model.Channel{ + Name: "channel", + Type: model.ChannelTypeOpen, + TeamId: team.Id, + }, 10) + require.NoError(t, nErr) + _, nErr = ss.Channel().SaveMember(&model.ChannelMember{ + UserId: userId, + ChannelId: channel.Id, + NotifyProps: model.GetDefaultChannelNotifyProps(), + }) + require.NoError(t, nErr) + _, nErr = ss.Channel().SaveMember(&model.ChannelMember{ + UserId: userId2, + ChannelId: channel.Id, + NotifyProps: model.GetDefaultChannelNotifyProps(), + }) + require.NoError(t, nErr) + + // Have user1 favorite it + _, _, err = ss.Channel().UpdateSidebarCategories(userId, team.Id, []*model.SidebarCategoryWithChannels{ + { + SidebarCategory: favoritesCategory.SidebarCategory, + Channels: []string{channel.Id}, + }, + { + SidebarCategory: channelsCategory.SidebarCategory, + Channels: []string{}, + }, + }, + opts, + ) + assert.NoError(t, err) + + res2, nErr := ss.Preference().Get(userId, model.PreferenceCategoryFavoriteChannel, channel.Id) + assert.NoError(t, nErr) + assert.NotNil(t, res2) + assert.Equal(t, "true", res2.Value) + + res2, nErr = ss.Preference().Get(userId2, model.PreferenceCategoryFavoriteChannel, channel.Id) + assert.True(t, errors.Is(nErr, sql.ErrNoRows)) + assert.Nil(t, res2) + + // And user2 favorite it + _, _, err = ss.Channel().UpdateSidebarCategories(userId2, team.Id, []*model.SidebarCategoryWithChannels{ + { + SidebarCategory: favoritesCategory2.SidebarCategory, + Channels: []string{channel.Id}, + }, + { + SidebarCategory: channelsCategory2.SidebarCategory, + Channels: []string{}, + }, + }, + opts, + ) + assert.NoError(t, err) + + res2, nErr = ss.Preference().Get(userId, model.PreferenceCategoryFavoriteChannel, channel.Id) + assert.NoError(t, nErr) + assert.NotNil(t, res2) + assert.Equal(t, "true", res2.Value) + + res2, nErr = ss.Preference().Get(userId2, model.PreferenceCategoryFavoriteChannel, channel.Id) + assert.NoError(t, nErr) + assert.NotNil(t, res2) + assert.Equal(t, "true", res2.Value) + + // And then user1 unfavorite it + _, _, err = ss.Channel().UpdateSidebarCategories(userId, team.Id, []*model.SidebarCategoryWithChannels{ + { + SidebarCategory: channelsCategory.SidebarCategory, + Channels: []string{channel.Id}, + }, + { + SidebarCategory: favoritesCategory.SidebarCategory, + Channels: []string{}, + }, + }, + opts, + ) + assert.NoError(t, err) + + res2, nErr = ss.Preference().Get(userId, model.PreferenceCategoryFavoriteChannel, channel.Id) + assert.True(t, errors.Is(nErr, sql.ErrNoRows)) + assert.Nil(t, res2) + + res2, nErr = ss.Preference().Get(userId2, model.PreferenceCategoryFavoriteChannel, channel.Id) + assert.NoError(t, nErr) + assert.NotNil(t, res2) + assert.Equal(t, "true", res2.Value) + + // And finally user2 favorite it + _, _, err = ss.Channel().UpdateSidebarCategories(userId2, team.Id, []*model.SidebarCategoryWithChannels{ + { + SidebarCategory: channelsCategory2.SidebarCategory, + Channels: []string{channel.Id}, + }, + { + SidebarCategory: favoritesCategory2.SidebarCategory, + Channels: []string{}, + }, + }, + opts, + ) + assert.NoError(t, err) + + res2, nErr = ss.Preference().Get(userId, model.PreferenceCategoryFavoriteChannel, channel.Id) + assert.True(t, errors.Is(nErr, sql.ErrNoRows)) + assert.Nil(t, res2) + + res2, nErr = ss.Preference().Get(userId2, model.PreferenceCategoryFavoriteChannel, channel.Id) + assert.True(t, errors.Is(nErr, sql.ErrNoRows)) + assert.Nil(t, res2) + }) + + t.Run("channels removed from Channels or DMs categories should be re-added", func(t *testing.T) { + userId := model.NewId() + team := setupTeam(t, ss, userId) + + // Create some channels + channel, nErr := ss.Channel().Save(&model.Channel{ + Name: "channel", + Type: model.ChannelTypeOpen, + TeamId: team.Id, + }, 10) + require.NoError(t, nErr) + _, err := ss.Channel().SaveMember(&model.ChannelMember{ + UserId: userId, + ChannelId: channel.Id, + NotifyProps: model.GetDefaultChannelNotifyProps(), + }) + require.NoError(t, err) + + otherUserId := model.NewId() + dmChannel, nErr := ss.Channel().SaveDirectChannel( + &model.Channel{ + Name: model.GetDMNameFromIds(userId, otherUserId), + Type: model.ChannelTypeDirect, + }, + &model.ChannelMember{ + UserId: userId, + NotifyProps: model.GetDefaultChannelNotifyProps(), + }, + &model.ChannelMember{ + UserId: otherUserId, + NotifyProps: model.GetDefaultChannelNotifyProps(), + }, + ) + require.NoError(t, nErr) + + opts := &store.SidebarCategorySearchOpts{ + TeamID: team.Id, + ExcludeTeam: false, + AppsCategoryEnabled: true, + } + res, nErr := ss.Channel().CreateInitialSidebarCategories(userId, opts) + require.NoError(t, nErr) + require.NotEmpty(t, res) + + // And some categories + initialCategories, nErr := ss.Channel().GetSidebarCategoriesForTeamForUser(userId, team.Id, opts) + require.NoError(t, nErr) + + channelsCategory := initialCategories.Categories[1] + dmsCategory := initialCategories.Categories[2] + + require.Equal(t, []string{channel.Id}, channelsCategory.Channels) + require.Equal(t, []string{dmChannel.Id}, dmsCategory.Channels) + + // Try to save the categories with no channels in them + categoriesToUpdate := []*model.SidebarCategoryWithChannels{ + { + SidebarCategory: channelsCategory.SidebarCategory, + Channels: []string{}, + }, + { + SidebarCategory: dmsCategory.SidebarCategory, + Channels: []string{}, + }, + } + + updatedCategories, _, nErr := ss.Channel().UpdateSidebarCategories(userId, team.Id, categoriesToUpdate, opts) + assert.NoError(t, nErr) + + // The channels should still exist in the category because they would otherwise be orphaned + assert.Equal(t, []string{channel.Id}, updatedCategories[0].Channels) + assert.Equal(t, []string{dmChannel.Id}, updatedCategories[1].Channels) + }) + + t.Run("should be able to move DMs into and out of custom categories", func(t *testing.T) { + userId := model.NewId() + team := setupTeam(t, ss, userId) + + otherUserId := model.NewId() + dmChannel, nErr := ss.Channel().SaveDirectChannel( + &model.Channel{ + Name: model.GetDMNameFromIds(userId, otherUserId), + Type: model.ChannelTypeDirect, + }, + &model.ChannelMember{ + UserId: userId, + NotifyProps: model.GetDefaultChannelNotifyProps(), + }, + &model.ChannelMember{ + UserId: otherUserId, + NotifyProps: model.GetDefaultChannelNotifyProps(), + }, + ) + require.NoError(t, nErr) + + opts := &store.SidebarCategorySearchOpts{ + TeamID: team.Id, + ExcludeTeam: false, + AppsCategoryEnabled: true, + } + res, nErr := ss.Channel().CreateInitialSidebarCategories(userId, opts) + require.NoError(t, nErr) + require.NotEmpty(t, res) + + // The DM should start in the DMs category + initialCategories, err := ss.Channel().GetSidebarCategoriesForTeamForUser(userId, team.Id, opts) + require.NoError(t, err) + + dmsCategory := initialCategories.Categories[2] + require.Equal(t, []string{dmChannel.Id}, dmsCategory.Channels) + + // Now move the DM into a custom category + customCategory, err := ss.Channel().CreateSidebarCategory(userId, team.Id, &model.SidebarCategoryWithChannels{}, opts) + require.NoError(t, err) + + categoriesToUpdate := []*model.SidebarCategoryWithChannels{ + { + SidebarCategory: dmsCategory.SidebarCategory, + Channels: []string{}, + }, + { + SidebarCategory: customCategory.SidebarCategory, + Channels: []string{dmChannel.Id}, + }, + } + + updatedCategories, _, err := ss.Channel().UpdateSidebarCategories(userId, team.Id, categoriesToUpdate) + assert.NoError(t, err) + assert.Equal(t, dmsCategory.Id, updatedCategories[0].Id) + assert.Equal(t, []string{}, updatedCategories[0].Channels) + assert.Equal(t, customCategory.Id, updatedCategories[1].Id) + assert.Equal(t, []string{dmChannel.Id}, updatedCategories[1].Channels) + + updatedDmsCategory, err := ss.Channel().GetSidebarCategory(dmsCategory.Id, opts) + require.NoError(t, err) + assert.Equal(t, []string{}, updatedDmsCategory.Channels) + + updatedCustomCategory, err := ss.Channel().GetSidebarCategory(customCategory.Id, opts) + require.NoError(t, err) + assert.Equal(t, []string{dmChannel.Id}, updatedCustomCategory.Channels) + + // And move it back out of the custom category + categoriesToUpdate = []*model.SidebarCategoryWithChannels{ + { + SidebarCategory: dmsCategory.SidebarCategory, + Channels: []string{dmChannel.Id}, + }, + { + SidebarCategory: customCategory.SidebarCategory, + Channels: []string{}, + }, + } + + updatedCategories, _, err = ss.Channel().UpdateSidebarCategories(userId, team.Id, categoriesToUpdate, opts) + assert.NoError(t, err) + assert.Equal(t, dmsCategory.Id, updatedCategories[0].Id) + assert.Equal(t, []string{dmChannel.Id}, updatedCategories[0].Channels) + assert.Equal(t, customCategory.Id, updatedCategories[1].Id) + assert.Equal(t, []string{}, updatedCategories[1].Channels) + + updatedDmsCategory, err = ss.Channel().GetSidebarCategory(dmsCategory.Id, opts) + require.NoError(t, err) + assert.Equal(t, []string{dmChannel.Id}, updatedDmsCategory.Channels) + + updatedCustomCategory, err = ss.Channel().GetSidebarCategory(customCategory.Id, opts) + require.NoError(t, err) + assert.Equal(t, []string{}, updatedCustomCategory.Channels) + }) + + t.Run("should successfully move channels between categories", func(t *testing.T) { + userId := model.NewId() + team := setupTeam(t, ss, userId) + + // Join a channel + channel, nErr := ss.Channel().Save(&model.Channel{ + Name: "channel", + Type: model.ChannelTypeOpen, + TeamId: team.Id, + }, 10) + require.NoError(t, nErr) + _, err := ss.Channel().SaveMember(&model.ChannelMember{ + UserId: userId, + ChannelId: channel.Id, + NotifyProps: model.GetDefaultChannelNotifyProps(), + }) + require.NoError(t, err) + + // And then create the initial categories so that it includes the channel + opts := &store.SidebarCategorySearchOpts{ + TeamID: team.Id, + ExcludeTeam: false, + AppsCategoryEnabled: true, + } + res, nErr := ss.Channel().CreateInitialSidebarCategories(userId, opts) + require.NoError(t, nErr) + require.NotEmpty(t, res) + + initialCategories, nErr := ss.Channel().GetSidebarCategoriesForTeamForUser(userId, team.Id, opts) + require.NoError(t, nErr) + + channelsCategory := initialCategories.Categories[1] + require.Equal(t, []string{channel.Id}, channelsCategory.Channels) + + customCategory, nErr := ss.Channel().CreateSidebarCategory(userId, team.Id, &model.SidebarCategoryWithChannels{}, opts) + require.NoError(t, nErr) + + // Move the channel one way + updatedCategories, _, nErr := ss.Channel().UpdateSidebarCategories(userId, team.Id, []*model.SidebarCategoryWithChannels{ + { + SidebarCategory: channelsCategory.SidebarCategory, + Channels: []string{}, + }, + { + SidebarCategory: customCategory.SidebarCategory, + Channels: []string{channel.Id}, + }, + }, + opts, + ) + assert.NoError(t, nErr) + + assert.Equal(t, []string{}, updatedCategories[0].Channels) + assert.Equal(t, []string{channel.Id}, updatedCategories[1].Channels) + + // And then the other + updatedCategories, _, nErr = ss.Channel().UpdateSidebarCategories(userId, team.Id, []*model.SidebarCategoryWithChannels{ + { + SidebarCategory: channelsCategory.SidebarCategory, + Channels: []string{channel.Id}, + }, + { + SidebarCategory: customCategory.SidebarCategory, + Channels: []string{}, + }, + }, + opts, + ) + assert.NoError(t, nErr) + assert.Equal(t, []string{channel.Id}, updatedCategories[0].Channels) + assert.Equal(t, []string{}, updatedCategories[1].Channels) + }) + + t.Run("should correctly return the original categories that were modified", func(t *testing.T) { + userId := model.NewId() + team := setupTeam(t, ss, userId) + + // Join a channel + channel, nErr := ss.Channel().Save(&model.Channel{ + Name: "channel", + Type: model.ChannelTypeOpen, + TeamId: team.Id, + }, 10) + require.NoError(t, nErr) + _, err := ss.Channel().SaveMember(&model.ChannelMember{ + UserId: userId, + ChannelId: channel.Id, + NotifyProps: model.GetDefaultChannelNotifyProps(), + }) + require.NoError(t, err) + + // And then create the initial categories so that Channels includes the channel + opts := &store.SidebarCategorySearchOpts{ + TeamID: team.Id, + ExcludeTeam: false, + AppsCategoryEnabled: true, + } + res, nErr := ss.Channel().CreateInitialSidebarCategories(userId, opts) + require.NoError(t, nErr) + require.NotEmpty(t, res) + + initialCategories, nErr := ss.Channel().GetSidebarCategoriesForTeamForUser(userId, team.Id, opts) + require.NoError(t, nErr) + + channelsCategory := initialCategories.Categories[1] + require.Equal(t, []string{channel.Id}, channelsCategory.Channels) + + customCategory, nErr := ss.Channel().CreateSidebarCategory(userId, team.Id, &model.SidebarCategoryWithChannels{ + SidebarCategory: model.SidebarCategory{ + DisplayName: "originalName", + }, + }, + opts, + ) + require.NoError(t, nErr) + + // Rename the custom category + updatedCategories, originalCategories, nErr := ss.Channel().UpdateSidebarCategories(userId, team.Id, []*model.SidebarCategoryWithChannels{ + { + SidebarCategory: model.SidebarCategory{ + Id: customCategory.Id, + DisplayName: "updatedName", + }, + }, + }, + opts, + ) + require.NoError(t, nErr) + require.Equal(t, len(updatedCategories), len(originalCategories)) + assert.Equal(t, "originalName", originalCategories[0].DisplayName) + assert.Equal(t, "updatedName", updatedCategories[0].DisplayName) + + // Move a channel + updatedCategories, originalCategories, nErr = ss.Channel().UpdateSidebarCategories(userId, team.Id, []*model.SidebarCategoryWithChannels{ + { + SidebarCategory: channelsCategory.SidebarCategory, + Channels: []string{}, + }, + { + SidebarCategory: customCategory.SidebarCategory, + Channels: []string{channel.Id}, + }, + }, + opts, + ) + require.NoError(t, nErr) + require.Equal(t, len(updatedCategories), len(originalCategories)) + require.Equal(t, updatedCategories[0].Id, originalCategories[0].Id) + require.Equal(t, updatedCategories[1].Id, originalCategories[1].Id) + + assert.Equal(t, []string{channel.Id}, originalCategories[0].Channels) + assert.Equal(t, []string{}, updatedCategories[0].Channels) + assert.Equal(t, []string{}, originalCategories[1].Channels) + assert.Equal(t, []string{channel.Id}, updatedCategories[1].Channels) + }) +} + +func setupInitialSidebarCategoriesWithAppsCategory(t *testing.T, ss store.Store) (string, string) { + userId := model.NewId() + team := setupTeam(t, ss, userId) + + opts := &store.SidebarCategorySearchOpts{ + TeamID: team.Id, + ExcludeTeam: false, + AppsCategoryEnabled: true, + } + res, nErr := ss.Channel().CreateInitialSidebarCategories(userId, opts) + require.NoError(t, nErr) + require.NotEmpty(t, res) + + res, err := ss.Channel().GetSidebarCategoriesForTeamForUser(userId, team.Id, opts) + require.NoError(t, err) + require.Len(t, res.Categories, 4) + + return userId, team.Id +} + +func testClearSidebarOnTeamLeaveWithAppsCategory(t *testing.T, ss store.Store, s SqlStore) { + t.Run("should delete all sidebar categories and channels on the team", func(t *testing.T) { + userId, teamId := setupInitialSidebarCategoriesWithAppsCategory(t, ss) + + user := &model.User{ + Id: userId, + } + + // Create some channels and assign them to a custom category + channel1, nErr := ss.Channel().Save(&model.Channel{ + Name: model.NewId(), + TeamId: teamId, + Type: model.ChannelTypeOpen, + }, 1000) + require.NoError(t, nErr) + + dmChannel1, nErr := ss.Channel().CreateDirectChannel(user, &model.User{ + Id: model.NewId(), + }) + require.NoError(t, nErr) + + opts := &store.SidebarCategorySearchOpts{ + AppsCategoryEnabled: true, + } + + _, err := ss.Channel().CreateSidebarCategory(userId, teamId, &model.SidebarCategoryWithChannels{ + Channels: []string{channel1.Id, dmChannel1.Id}, + }, + opts, + ) + require.NoError(t, err) + + // Confirm that we start with the right number of categories and SidebarChannels entries + var count int64 + err = s.GetMasterX().Get(&count, "SELECT COUNT(*) FROM SidebarCategories WHERE UserId = ?", userId) + require.NoError(t, err) + require.Equal(t, int64(5), count) + + err = s.GetMasterX().Get(&count, "SELECT COUNT(*) FROM SidebarChannels WHERE UserId = ?", userId) + require.NoError(t, err) + require.Equal(t, int64(2), count) + + // Leave the team + err = ss.Channel().ClearSidebarOnTeamLeave(userId, teamId) + assert.NoError(t, err) + + // Confirm that all the categories and SidebarChannel entries have been deleted + err = s.GetMasterX().Get(&count, "SELECT COUNT(*) FROM SidebarCategories WHERE UserId = ?", userId) + require.NoError(t, err) + assert.Equal(t, int64(0), count) + + err = s.GetMasterX().Get(&count, "SELECT COUNT(*) FROM SidebarChannels WHERE UserId = ?", userId) + require.NoError(t, err) + assert.Equal(t, int64(0), count) + }) + + t.Run("should not delete sidebar categories and channels on another the team", func(t *testing.T) { + userId, teamId := setupInitialSidebarCategoriesWithAppsCategory(t, ss) + + user := &model.User{ + Id: userId, + } + + // Create some channels and assign them to a custom category + channel1, nErr := ss.Channel().Save(&model.Channel{ + Name: model.NewId(), + TeamId: teamId, + Type: model.ChannelTypeOpen, + }, 1000) + require.NoError(t, nErr) + + dmChannel1, nErr := ss.Channel().CreateDirectChannel(user, &model.User{ + Id: model.NewId(), + }) + require.NoError(t, nErr) + + opts := &store.SidebarCategorySearchOpts{ + AppsCategoryEnabled: true, + } + + _, err := ss.Channel().CreateSidebarCategory(userId, teamId, &model.SidebarCategoryWithChannels{ + Channels: []string{channel1.Id, dmChannel1.Id}, + }, + opts, + ) + require.NoError(t, err) + + // Confirm that we start with the right number of categories and SidebarChannels entries + var count int64 + err = s.GetMasterX().Get(&count, "SELECT COUNT(*) FROM SidebarCategories WHERE UserId = ?", userId) + require.NoError(t, err) + require.Equal(t, int64(5), count) + + err = s.GetMasterX().Get(&count, "SELECT COUNT(*) FROM SidebarChannels WHERE UserId = ?", userId) + require.NoError(t, err) + require.Equal(t, int64(2), count) + + // Leave another team + err = ss.Channel().ClearSidebarOnTeamLeave(userId, model.NewId()) + assert.NoError(t, err) + + // Confirm that nothing has been deleted + err = s.GetMasterX().Get(&count, "SELECT COUNT(*) FROM SidebarCategories WHERE UserId = ?", userId) + require.NoError(t, err) + assert.Equal(t, int64(5), count) + + err = s.GetMasterX().Get(&count, "SELECT COUNT(*) FROM SidebarChannels WHERE UserId = ?", userId) + require.NoError(t, err) + assert.Equal(t, int64(2), count) + }) + + t.Run("MM-30314 should not delete channels on another team under specific circumstances", func(t *testing.T) { + userId, teamId := setupInitialSidebarCategoriesWithAppsCategory(t, ss) + + user := &model.User{ + Id: userId, + } + user2 := &model.User{ + Id: model.NewId(), + } + + // Create a second team and set up the sidebar categories for it + team2 := setupTeam(t, ss, userId) + + opts := &store.SidebarCategorySearchOpts{ + TeamID: team2.Id, + ExcludeTeam: false, + AppsCategoryEnabled: true, + } + res, err := ss.Channel().CreateInitialSidebarCategories(userId, opts) + require.NoError(t, err) + require.NotEmpty(t, res) + + res, err = ss.Channel().GetSidebarCategoriesForTeamForUser(userId, team2.Id, opts) + require.NoError(t, err) + require.Len(t, res.Categories, 4) + + // On the first team, create some channels and assign them to a custom category + channel1, nErr := ss.Channel().Save(&model.Channel{ + Name: model.NewId(), + TeamId: teamId, + Type: model.ChannelTypeOpen, + }, 1000) + require.NoError(t, nErr) + + dmChannel1, nErr := ss.Channel().CreateDirectChannel(user, user2) + require.NoError(t, nErr) + + _, err = ss.Channel().CreateSidebarCategory(userId, teamId, &model.SidebarCategoryWithChannels{ + Channels: []string{channel1.Id, dmChannel1.Id}, + }, + opts, + ) + require.NoError(t, err) + + // Do the same on the second team + channel2, nErr := ss.Channel().Save(&model.Channel{ + Name: model.NewId(), + TeamId: team2.Id, + Type: model.ChannelTypeOpen, + }, 1000) + require.NoError(t, nErr) + + _, err = ss.Channel().CreateSidebarCategory(userId, team2.Id, &model.SidebarCategoryWithChannels{ + Channels: []string{channel2.Id, dmChannel1.Id}, + }, + opts, + ) + require.NoError(t, err) + + // Confirm that we start with the right number of categories and SidebarChannels entries + var count int64 + err = s.GetMasterX().Get(&count, "SELECT COUNT(*) FROM SidebarCategories WHERE UserId = ?", userId) + require.NoError(t, err) + require.Equal(t, int64(10), count) + + err = s.GetMasterX().Get(&count, "SELECT COUNT(*) FROM SidebarChannels WHERE UserId = ?", userId) + require.NoError(t, err) + require.Equal(t, int64(4), count) + + // Leave the first team + err = ss.Channel().ClearSidebarOnTeamLeave(userId, teamId) + assert.NoError(t, err) + + // Confirm that we have the correct number of categories and SidebarChannels entries left over + err = s.GetMasterX().Get(&count, "SELECT COUNT(*) FROM SidebarCategories WHERE UserId = ?", userId) + require.NoError(t, err) + assert.Equal(t, int64(5), count) + + err = s.GetMasterX().Get(&count, "SELECT COUNT(*) FROM SidebarChannels WHERE UserId = ?", userId) + require.NoError(t, err) + assert.Equal(t, int64(2), count) + + // Confirm that the categories on the second team are unchanged + res, err = ss.Channel().GetSidebarCategoriesForTeamForUser(userId, team2.Id, &store.SidebarCategorySearchOpts{ + AppsCategoryEnabled: true, + }) + require.NoError(t, err) + assert.Len(t, res.Categories, 5) + + assert.Equal(t, model.SidebarCategoryCustom, res.Categories[1].Type) + assert.Equal(t, []string{channel2.Id, dmChannel1.Id}, res.Categories[1].Channels) + }) +} + +func testDeleteSidebarCategoryWithAppsCategory(t *testing.T, ss store.Store, s SqlStore) { + t.Run("should correctly remove an empty category", func(t *testing.T) { + userId, teamId := setupInitialSidebarCategoriesWithAppsCategory(t, ss) + defer ss.User().PermanentDelete(userId) + + opts := &store.SidebarCategorySearchOpts{ + AppsCategoryEnabled: true, + } + + newCategory, err := ss.Channel().CreateSidebarCategory(userId, teamId, &model.SidebarCategoryWithChannels{}, opts) + require.NoError(t, err) + require.NotNil(t, newCategory) + + // Ensure that the category was created properly + res, err := ss.Channel().GetSidebarCategoriesForTeamForUser(userId, teamId, opts) + require.NoError(t, err) + require.Len(t, res.Categories, 5) + + // Then delete it and confirm that was done correctly + err = ss.Channel().DeleteSidebarCategory(newCategory.Id) + assert.NoError(t, err) + + res, err = ss.Channel().GetSidebarCategoriesForTeamForUser(userId, teamId, opts) + require.NoError(t, err) + require.Len(t, res.Categories, 4) + }) + + t.Run("should correctly remove a category and its channels", func(t *testing.T) { + userId, teamId := setupInitialSidebarCategoriesWithAppsCategory(t, ss) + defer ss.User().PermanentDelete(userId) + + opts := &store.SidebarCategorySearchOpts{ + AppsCategoryEnabled: true, + } + + user := &model.User{ + Id: userId, + } + + // Create some channels + channel1, nErr := ss.Channel().Save(&model.Channel{ + Name: model.NewId(), + TeamId: teamId, + Type: model.ChannelTypeOpen, + }, 1000) + require.NoError(t, nErr) + defer ss.Channel().PermanentDelete(channel1.Id) + + channel2, nErr := ss.Channel().Save(&model.Channel{ + Name: model.NewId(), + TeamId: teamId, + Type: model.ChannelTypePrivate, + }, 1000) + require.NoError(t, nErr) + defer ss.Channel().PermanentDelete(channel2.Id) + + dmChannel1, nErr := ss.Channel().CreateDirectChannel(user, &model.User{ + Id: model.NewId(), + }) + require.NoError(t, nErr) + defer ss.Channel().PermanentDelete(dmChannel1.Id) + + // Assign some of those channels to a custom category + newCategory, err := ss.Channel().CreateSidebarCategory(userId, teamId, &model.SidebarCategoryWithChannels{ + Channels: []string{channel1.Id, channel2.Id, dmChannel1.Id}, + }, + opts, + ) + require.NoError(t, err) + require.NotNil(t, newCategory) + + // Ensure that the categories are set up correctly + res, err := ss.Channel().GetSidebarCategoriesForTeamForUser(userId, teamId, opts) + require.NoError(t, err) + require.Len(t, res.Categories, 5) + + require.Equal(t, model.SidebarCategoryCustom, res.Categories[1].Type) + require.Equal(t, []string{channel1.Id, channel2.Id, dmChannel1.Id}, res.Categories[1].Channels) + + // Actually delete the channel + err = ss.Channel().DeleteSidebarCategory(newCategory.Id) + assert.NoError(t, err) + + // Confirm that the category was deleted... + res, err = ss.Channel().GetSidebarCategoriesForTeamForUser(userId, teamId, opts) + assert.NoError(t, err) + assert.Len(t, res.Categories, 4) + + // ...and that the corresponding SidebarChannel entries were deleted + var count int64 + countErr := s.GetMasterX().Get(&count, ` + SELECT + COUNT(*) + FROM + SidebarChannels + WHERE + CategoryId = ?`, newCategory.Id) + require.NoError(t, countErr) + assert.Equal(t, int64(0), count) + }) + + t.Run("should not allow you to remove non-custom categories", func(t *testing.T) { + userId, teamId := setupInitialSidebarCategoriesWithAppsCategory(t, ss) + defer ss.User().PermanentDelete(userId) + res, err := ss.Channel().GetSidebarCategoriesForTeamForUser(userId, teamId, &store.SidebarCategorySearchOpts{ + AppsCategoryEnabled: true, + }) + require.NoError(t, err) + require.Len(t, res.Categories, 4) + require.Equal(t, model.SidebarCategoryFavorites, res.Categories[0].Type) + require.Equal(t, model.SidebarCategoryChannels, res.Categories[1].Type) + require.Equal(t, model.SidebarCategoryDirectMessages, res.Categories[2].Type) + require.Equal(t, model.SidebarCategoryApps, res.Categories[3].Type) + + err = ss.Channel().DeleteSidebarCategory(res.Categories[0].Id) + assert.Error(t, err) + + err = ss.Channel().DeleteSidebarCategory(res.Categories[1].Id) + assert.Error(t, err) + + err = ss.Channel().DeleteSidebarCategory(res.Categories[2].Id) + assert.Error(t, err) + + err = ss.Channel().DeleteSidebarCategory(res.Categories[3].Id) + assert.Error(t, err) + }) +} + +func testUpdateSidebarChannelsByPreferencesWithAppsCategory(t *testing.T, ss store.Store) { + t.Run("Should be able to update sidebar channels", func(t *testing.T) { + userId := model.NewId() + teamId := model.NewId() + + opts := &store.SidebarCategorySearchOpts{ + TeamID: teamId, + ExcludeTeam: false, + AppsCategoryEnabled: true, + } + res, nErr := ss.Channel().CreateInitialSidebarCategories(userId, opts) + require.NoError(t, nErr) + require.NotEmpty(t, res) + + channel, nErr := ss.Channel().Save(&model.Channel{ + Name: "channel", + Type: model.ChannelTypeOpen, + TeamId: teamId, + }, 10) + require.NoError(t, nErr) + + err := ss.Channel().UpdateSidebarChannelsByPreferences(model.Preferences{ + model.Preference{ + Name: channel.Id, + Category: model.PreferenceCategoryFavoriteChannel, + Value: "true", + }, + }) + assert.NoError(t, err) + }) + + t.Run("Should not panic if channel is not found", func(t *testing.T) { + userId := model.NewId() + teamId := model.NewId() + + opts := &store.SidebarCategorySearchOpts{ + TeamID: teamId, + ExcludeTeam: false, + AppsCategoryEnabled: true, + } + res, nErr := ss.Channel().CreateInitialSidebarCategories(userId, opts) + assert.NoError(t, nErr) + require.NotEmpty(t, res) + + require.NotPanics(t, func() { + _ = ss.Channel().UpdateSidebarChannelsByPreferences(model.Preferences{ + model.Preference{ + Name: "fakeid", + Category: model.PreferenceCategoryFavoriteChannel, + Value: "true", + }, + }) + }) + }) +} + +func testSidebarCategoryDeadlockWithAppsCategory(t *testing.T, ss store.Store) { + userID := model.NewId() + team := setupTeam(t, ss, userID) + + // Join a channel + channel, err := ss.Channel().Save(&model.Channel{ + Name: "channel", + Type: model.ChannelTypeOpen, + TeamId: team.Id, + }, 10) + require.NoError(t, err) + _, err = ss.Channel().SaveMember(&model.ChannelMember{ + UserId: userID, + ChannelId: channel.Id, + NotifyProps: model.GetDefaultChannelNotifyProps(), + }) + require.NoError(t, err) + + // And then create the initial categories so that it includes the channel + opts := &store.SidebarCategorySearchOpts{ + TeamID: team.Id, + ExcludeTeam: false, + AppsCategoryEnabled: true, + } + res, err := ss.Channel().CreateInitialSidebarCategories(userID, opts) + require.NoError(t, err) + require.NotEmpty(t, res) + + initialCategories, err := ss.Channel().GetSidebarCategoriesForTeamForUser(userID, team.Id, opts) + require.NoError(t, err) + + channelsCategory := initialCategories.Categories[1] + require.Equal(t, []string{channel.Id}, channelsCategory.Channels) + + customCategory, err := ss.Channel().CreateSidebarCategory(userID, team.Id, &model.SidebarCategoryWithChannels{}, opts) + require.NoError(t, err) + + var wg sync.WaitGroup + wg.Add(2) + + go func() { + defer wg.Done() + _, _, err := ss.Channel().UpdateSidebarCategories(userID, team.Id, []*model.SidebarCategoryWithChannels{ + { + SidebarCategory: channelsCategory.SidebarCategory, + Channels: []string{}, + }, + { + SidebarCategory: customCategory.SidebarCategory, + Channels: []string{channel.Id}, + }, + }) + if err != nil { + var nfErr *store.ErrNotFound + require.True(t, errors.As(err, &nfErr)) + } + }() + + go func() { + defer wg.Done() + err := ss.Channel().DeleteSidebarCategory(customCategory.Id) + require.NoError(t, err) + }() + + wg.Wait() +} diff --git a/server/channels/store/storetest/cluster_discovery_store.go b/server/channels/store/storetest/cluster_discovery_store.go index 5bea96960a..559c156dce 100644 --- a/server/channels/store/storetest/cluster_discovery_store.go +++ b/server/channels/store/storetest/cluster_discovery_store.go @@ -10,8 +10,8 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestClusterDiscoveryStore(t *testing.T, ss store.Store) { diff --git a/server/channels/store/storetest/command_store.go b/server/channels/store/storetest/command_store.go index 05e182e8d7..1b73543853 100644 --- a/server/channels/store/storetest/command_store.go +++ b/server/channels/store/storetest/command_store.go @@ -9,8 +9,8 @@ import ( "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestCommandStore(t *testing.T, ss store.Store) { diff --git a/server/channels/store/storetest/command_webhook_store.go b/server/channels/store/storetest/command_webhook_store.go index c809e238ad..88a1b6240a 100644 --- a/server/channels/store/storetest/command_webhook_store.go +++ b/server/channels/store/storetest/command_webhook_store.go @@ -10,8 +10,8 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestCommandWebhookStore(t *testing.T, ss store.Store) { diff --git a/server/channels/store/storetest/compliance_store.go b/server/channels/store/storetest/compliance_store.go index b80a20509c..2840c39d89 100644 --- a/server/channels/store/storetest/compliance_store.go +++ b/server/channels/store/storetest/compliance_store.go @@ -12,8 +12,8 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" ) func cleanupStoreState(t *testing.T, ss store.Store) { diff --git a/server/channels/store/storetest/draft_store.go b/server/channels/store/storetest/draft_store.go index 45eb33cae9..57a8d5654f 100644 --- a/server/channels/store/storetest/draft_store.go +++ b/server/channels/store/storetest/draft_store.go @@ -9,8 +9,8 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestDraftStore(t *testing.T, ss store.Store, s SqlStore) { diff --git a/server/channels/store/storetest/emoji_store.go b/server/channels/store/storetest/emoji_store.go index b5c9b6e770..6d0c6d44b2 100644 --- a/server/channels/store/storetest/emoji_store.go +++ b/server/channels/store/storetest/emoji_store.go @@ -8,8 +8,8 @@ import ( "testing" "time" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/server/channels/store/storetest/file_info_store.go b/server/channels/store/storetest/file_info_store.go index 21d65f649d..c5ba12acf6 100644 --- a/server/channels/store/storetest/file_info_store.go +++ b/server/channels/store/storetest/file_info_store.go @@ -9,9 +9,9 @@ import ( "testing" "time" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store" - "github.com/mattermost/mattermost-server/v6/server/channels/utils" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/utils" + "github.com/mattermost/mattermost-server/server/v8/model" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/server/channels/store/storetest/group_store.go b/server/channels/store/storetest/group_store.go index fedcf5030a..0bbb39b494 100644 --- a/server/channels/store/storetest/group_store.go +++ b/server/channels/store/storetest/group_store.go @@ -15,9 +15,9 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store" - "github.com/mattermost/mattermost-server/v6/server/channels/utils" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/utils" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestGroupStore(t *testing.T, ss store.Store) { diff --git a/server/channels/store/storetest/job_store.go b/server/channels/store/storetest/job_store.go index 5f3fae9051..22f91f098e 100644 --- a/server/channels/store/storetest/job_store.go +++ b/server/channels/store/storetest/job_store.go @@ -12,8 +12,8 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestJobStore(t *testing.T, ss store.Store) { diff --git a/server/channels/store/storetest/license_store.go b/server/channels/store/storetest/license_store.go index 43d5a404fc..f2e1d54bf5 100644 --- a/server/channels/store/storetest/license_store.go +++ b/server/channels/store/storetest/license_store.go @@ -8,8 +8,8 @@ import ( "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestLicenseStore(t *testing.T, ss store.Store) { diff --git a/server/channels/store/storetest/link_metadata_store.go b/server/channels/store/storetest/link_metadata_store.go index 0250123d8d..d6abe09a96 100644 --- a/server/channels/store/storetest/link_metadata_store.go +++ b/server/channels/store/storetest/link_metadata_store.go @@ -13,8 +13,8 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" ) // These tests are ran on the same store instance, so this provides easier unique, valid timestamps diff --git a/server/channels/store/storetest/mocks/AuditStore.go b/server/channels/store/storetest/mocks/AuditStore.go index a5d6e361c5..f254e47f75 100644 --- a/server/channels/store/storetest/mocks/AuditStore.go +++ b/server/channels/store/storetest/mocks/AuditStore.go @@ -5,7 +5,7 @@ package mocks import ( - model "github.com/mattermost/mattermost-server/v6/model" + model "github.com/mattermost/mattermost-server/server/v8/model" mock "github.com/stretchr/testify/mock" ) diff --git a/server/channels/store/storetest/mocks/BotStore.go b/server/channels/store/storetest/mocks/BotStore.go index 857405adc3..2ee3f78efa 100644 --- a/server/channels/store/storetest/mocks/BotStore.go +++ b/server/channels/store/storetest/mocks/BotStore.go @@ -5,7 +5,7 @@ package mocks import ( - model "github.com/mattermost/mattermost-server/v6/model" + model "github.com/mattermost/mattermost-server/server/v8/model" mock "github.com/stretchr/testify/mock" ) diff --git a/server/channels/store/storetest/mocks/ChannelMemberHistoryStore.go b/server/channels/store/storetest/mocks/ChannelMemberHistoryStore.go index 6835c8c94e..6c2fe00f98 100644 --- a/server/channels/store/storetest/mocks/ChannelMemberHistoryStore.go +++ b/server/channels/store/storetest/mocks/ChannelMemberHistoryStore.go @@ -5,7 +5,7 @@ package mocks import ( - model "github.com/mattermost/mattermost-server/v6/model" + model "github.com/mattermost/mattermost-server/server/v8/model" mock "github.com/stretchr/testify/mock" ) diff --git a/server/channels/store/storetest/mocks/ChannelStore.go b/server/channels/store/storetest/mocks/ChannelStore.go index 97160c46c6..4725785785 100644 --- a/server/channels/store/storetest/mocks/ChannelStore.go +++ b/server/channels/store/storetest/mocks/ChannelStore.go @@ -7,10 +7,10 @@ package mocks import ( context "context" - model "github.com/mattermost/mattermost-server/v6/model" + model "github.com/mattermost/mattermost-server/server/v8/model" mock "github.com/stretchr/testify/mock" - store "github.com/mattermost/mattermost-server/v6/server/channels/store" + store "github.com/mattermost/mattermost-server/server/v8/channels/store" time "time" ) @@ -298,25 +298,32 @@ func (_m *ChannelStore) CreateInitialSidebarCategories(userID string, opts *stor return r0, r1 } -// CreateSidebarCategory provides a mock function with given fields: userID, teamID, newCategory -func (_m *ChannelStore) CreateSidebarCategory(userID string, teamID string, newCategory *model.SidebarCategoryWithChannels) (*model.SidebarCategoryWithChannels, error) { - ret := _m.Called(userID, teamID, newCategory) +// CreateSidebarCategory provides a mock function with given fields: userID, teamID, newCategory, options +func (_m *ChannelStore) CreateSidebarCategory(userID string, teamID string, newCategory *model.SidebarCategoryWithChannels, options ...*store.SidebarCategorySearchOpts) (*model.SidebarCategoryWithChannels, error) { + _va := make([]interface{}, len(options)) + for _i := range options { + _va[_i] = options[_i] + } + var _ca []interface{} + _ca = append(_ca, userID, teamID, newCategory) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) var r0 *model.SidebarCategoryWithChannels var r1 error - if rf, ok := ret.Get(0).(func(string, string, *model.SidebarCategoryWithChannels) (*model.SidebarCategoryWithChannels, error)); ok { - return rf(userID, teamID, newCategory) + if rf, ok := ret.Get(0).(func(string, string, *model.SidebarCategoryWithChannels, ...*store.SidebarCategorySearchOpts) (*model.SidebarCategoryWithChannels, error)); ok { + return rf(userID, teamID, newCategory, options...) } - if rf, ok := ret.Get(0).(func(string, string, *model.SidebarCategoryWithChannels) *model.SidebarCategoryWithChannels); ok { - r0 = rf(userID, teamID, newCategory) + if rf, ok := ret.Get(0).(func(string, string, *model.SidebarCategoryWithChannels, ...*store.SidebarCategorySearchOpts) *model.SidebarCategoryWithChannels); ok { + r0 = rf(userID, teamID, newCategory, options...) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.SidebarCategoryWithChannels) } } - if rf, ok := ret.Get(1).(func(string, string, *model.SidebarCategoryWithChannels) error); ok { - r1 = rf(userID, teamID, newCategory) + if rf, ok := ret.Get(1).(func(string, string, *model.SidebarCategoryWithChannels, ...*store.SidebarCategorySearchOpts) error); ok { + r1 = rf(userID, teamID, newCategory, options...) } else { r1 = ret.Error(1) } @@ -598,6 +605,32 @@ func (_m *ChannelStore) GetAllDirectChannelsForExportAfter(limit int, afterID st return r0, r1 } +// GetBotChannelsByUser provides a mock function with given fields: userID, opts +func (_m *ChannelStore) GetBotChannelsByUser(userID string, opts store.ChannelSearchOpts) (model.ChannelList, error) { + ret := _m.Called(userID, opts) + + var r0 model.ChannelList + var r1 error + if rf, ok := ret.Get(0).(func(string, store.ChannelSearchOpts) (model.ChannelList, error)); ok { + return rf(userID, opts) + } + if rf, ok := ret.Get(0).(func(string, store.ChannelSearchOpts) model.ChannelList); ok { + r0 = rf(userID, opts) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(model.ChannelList) + } + } + + if rf, ok := ret.Get(1).(func(string, store.ChannelSearchOpts) error); ok { + r1 = rf(userID, opts) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + // GetByName provides a mock function with given fields: team_id, name, allowFromCache func (_m *ChannelStore) GetByName(team_id string, name string, allowFromCache bool) (*model.Channel, error) { ret := _m.Called(team_id, name, allowFromCache) @@ -1592,25 +1625,32 @@ func (_m *ChannelStore) GetSidebarCategories(userID string, opts *store.SidebarC return r0, r1 } -// GetSidebarCategoriesForTeamForUser provides a mock function with given fields: userID, teamID -func (_m *ChannelStore) GetSidebarCategoriesForTeamForUser(userID string, teamID string) (*model.OrderedSidebarCategories, error) { - ret := _m.Called(userID, teamID) +// GetSidebarCategoriesForTeamForUser provides a mock function with given fields: userID, teamID, options +func (_m *ChannelStore) GetSidebarCategoriesForTeamForUser(userID string, teamID string, options ...*store.SidebarCategorySearchOpts) (*model.OrderedSidebarCategories, error) { + _va := make([]interface{}, len(options)) + for _i := range options { + _va[_i] = options[_i] + } + var _ca []interface{} + _ca = append(_ca, userID, teamID) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) var r0 *model.OrderedSidebarCategories var r1 error - if rf, ok := ret.Get(0).(func(string, string) (*model.OrderedSidebarCategories, error)); ok { - return rf(userID, teamID) + if rf, ok := ret.Get(0).(func(string, string, ...*store.SidebarCategorySearchOpts) (*model.OrderedSidebarCategories, error)); ok { + return rf(userID, teamID, options...) } - if rf, ok := ret.Get(0).(func(string, string) *model.OrderedSidebarCategories); ok { - r0 = rf(userID, teamID) + if rf, ok := ret.Get(0).(func(string, string, ...*store.SidebarCategorySearchOpts) *model.OrderedSidebarCategories); ok { + r0 = rf(userID, teamID, options...) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.OrderedSidebarCategories) } } - if rf, ok := ret.Get(1).(func(string, string) error); ok { - r1 = rf(userID, teamID) + if rf, ok := ret.Get(1).(func(string, string, ...*store.SidebarCategorySearchOpts) error); ok { + r1 = rf(userID, teamID, options...) } else { r1 = ret.Error(1) } @@ -1618,25 +1658,32 @@ func (_m *ChannelStore) GetSidebarCategoriesForTeamForUser(userID string, teamID return r0, r1 } -// GetSidebarCategory provides a mock function with given fields: categoryID -func (_m *ChannelStore) GetSidebarCategory(categoryID string) (*model.SidebarCategoryWithChannels, error) { - ret := _m.Called(categoryID) +// GetSidebarCategory provides a mock function with given fields: categoryID, options +func (_m *ChannelStore) GetSidebarCategory(categoryID string, options ...*store.SidebarCategorySearchOpts) (*model.SidebarCategoryWithChannels, error) { + _va := make([]interface{}, len(options)) + for _i := range options { + _va[_i] = options[_i] + } + var _ca []interface{} + _ca = append(_ca, categoryID) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) var r0 *model.SidebarCategoryWithChannels var r1 error - if rf, ok := ret.Get(0).(func(string) (*model.SidebarCategoryWithChannels, error)); ok { - return rf(categoryID) + if rf, ok := ret.Get(0).(func(string, ...*store.SidebarCategorySearchOpts) (*model.SidebarCategoryWithChannels, error)); ok { + return rf(categoryID, options...) } - if rf, ok := ret.Get(0).(func(string) *model.SidebarCategoryWithChannels); ok { - r0 = rf(categoryID) + if rf, ok := ret.Get(0).(func(string, ...*store.SidebarCategorySearchOpts) *model.SidebarCategoryWithChannels); ok { + r0 = rf(categoryID, options...) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.SidebarCategoryWithChannels) } } - if rf, ok := ret.Get(1).(func(string) error); ok { - r1 = rf(categoryID) + if rf, ok := ret.Get(1).(func(string, ...*store.SidebarCategorySearchOpts) error); ok { + r1 = rf(categoryID, options...) } else { r1 = ret.Error(1) } @@ -2582,34 +2629,41 @@ func (_m *ChannelStore) UpdateMultipleMembers(members []*model.ChannelMember) ([ return r0, r1 } -// UpdateSidebarCategories provides a mock function with given fields: userID, teamID, categories -func (_m *ChannelStore) UpdateSidebarCategories(userID string, teamID string, categories []*model.SidebarCategoryWithChannels) ([]*model.SidebarCategoryWithChannels, []*model.SidebarCategoryWithChannels, error) { - ret := _m.Called(userID, teamID, categories) +// UpdateSidebarCategories provides a mock function with given fields: userID, teamID, categories, options +func (_m *ChannelStore) UpdateSidebarCategories(userID string, teamID string, categories []*model.SidebarCategoryWithChannels, options ...*store.SidebarCategorySearchOpts) ([]*model.SidebarCategoryWithChannels, []*model.SidebarCategoryWithChannels, error) { + _va := make([]interface{}, len(options)) + for _i := range options { + _va[_i] = options[_i] + } + var _ca []interface{} + _ca = append(_ca, userID, teamID, categories) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) var r0 []*model.SidebarCategoryWithChannels var r1 []*model.SidebarCategoryWithChannels var r2 error - if rf, ok := ret.Get(0).(func(string, string, []*model.SidebarCategoryWithChannels) ([]*model.SidebarCategoryWithChannels, []*model.SidebarCategoryWithChannels, error)); ok { - return rf(userID, teamID, categories) + if rf, ok := ret.Get(0).(func(string, string, []*model.SidebarCategoryWithChannels, ...*store.SidebarCategorySearchOpts) ([]*model.SidebarCategoryWithChannels, []*model.SidebarCategoryWithChannels, error)); ok { + return rf(userID, teamID, categories, options...) } - if rf, ok := ret.Get(0).(func(string, string, []*model.SidebarCategoryWithChannels) []*model.SidebarCategoryWithChannels); ok { - r0 = rf(userID, teamID, categories) + if rf, ok := ret.Get(0).(func(string, string, []*model.SidebarCategoryWithChannels, ...*store.SidebarCategorySearchOpts) []*model.SidebarCategoryWithChannels); ok { + r0 = rf(userID, teamID, categories, options...) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]*model.SidebarCategoryWithChannels) } } - if rf, ok := ret.Get(1).(func(string, string, []*model.SidebarCategoryWithChannels) []*model.SidebarCategoryWithChannels); ok { - r1 = rf(userID, teamID, categories) + if rf, ok := ret.Get(1).(func(string, string, []*model.SidebarCategoryWithChannels, ...*store.SidebarCategorySearchOpts) []*model.SidebarCategoryWithChannels); ok { + r1 = rf(userID, teamID, categories, options...) } else { if ret.Get(1) != nil { r1 = ret.Get(1).([]*model.SidebarCategoryWithChannels) } } - if rf, ok := ret.Get(2).(func(string, string, []*model.SidebarCategoryWithChannels) error); ok { - r2 = rf(userID, teamID, categories) + if rf, ok := ret.Get(2).(func(string, string, []*model.SidebarCategoryWithChannels, ...*store.SidebarCategorySearchOpts) error); ok { + r2 = rf(userID, teamID, categories, options...) } else { r2 = ret.Error(2) } diff --git a/server/channels/store/storetest/mocks/ClusterDiscoveryStore.go b/server/channels/store/storetest/mocks/ClusterDiscoveryStore.go index 4616e646ed..d637ca27e4 100644 --- a/server/channels/store/storetest/mocks/ClusterDiscoveryStore.go +++ b/server/channels/store/storetest/mocks/ClusterDiscoveryStore.go @@ -5,7 +5,7 @@ package mocks import ( - model "github.com/mattermost/mattermost-server/v6/model" + model "github.com/mattermost/mattermost-server/server/v8/model" mock "github.com/stretchr/testify/mock" ) diff --git a/server/channels/store/storetest/mocks/CommandStore.go b/server/channels/store/storetest/mocks/CommandStore.go index 9b5f365ab5..fd323ae70c 100644 --- a/server/channels/store/storetest/mocks/CommandStore.go +++ b/server/channels/store/storetest/mocks/CommandStore.go @@ -5,7 +5,7 @@ package mocks import ( - model "github.com/mattermost/mattermost-server/v6/model" + model "github.com/mattermost/mattermost-server/server/v8/model" mock "github.com/stretchr/testify/mock" ) diff --git a/server/channels/store/storetest/mocks/CommandWebhookStore.go b/server/channels/store/storetest/mocks/CommandWebhookStore.go index 09cae9b925..70e7055fc1 100644 --- a/server/channels/store/storetest/mocks/CommandWebhookStore.go +++ b/server/channels/store/storetest/mocks/CommandWebhookStore.go @@ -5,7 +5,7 @@ package mocks import ( - model "github.com/mattermost/mattermost-server/v6/model" + model "github.com/mattermost/mattermost-server/server/v8/model" mock "github.com/stretchr/testify/mock" ) diff --git a/server/channels/store/storetest/mocks/ComplianceStore.go b/server/channels/store/storetest/mocks/ComplianceStore.go index f2e91037e7..1dd0e774b2 100644 --- a/server/channels/store/storetest/mocks/ComplianceStore.go +++ b/server/channels/store/storetest/mocks/ComplianceStore.go @@ -7,7 +7,7 @@ package mocks import ( context "context" - model "github.com/mattermost/mattermost-server/v6/model" + model "github.com/mattermost/mattermost-server/server/v8/model" mock "github.com/stretchr/testify/mock" ) diff --git a/server/channels/store/storetest/mocks/DraftStore.go b/server/channels/store/storetest/mocks/DraftStore.go index d7236b44a0..ff1c915bbc 100644 --- a/server/channels/store/storetest/mocks/DraftStore.go +++ b/server/channels/store/storetest/mocks/DraftStore.go @@ -5,7 +5,7 @@ package mocks import ( - model "github.com/mattermost/mattermost-server/v6/model" + model "github.com/mattermost/mattermost-server/server/v8/model" mock "github.com/stretchr/testify/mock" ) diff --git a/server/channels/store/storetest/mocks/EmojiStore.go b/server/channels/store/storetest/mocks/EmojiStore.go index fc0fbf71e1..6058ee3a17 100644 --- a/server/channels/store/storetest/mocks/EmojiStore.go +++ b/server/channels/store/storetest/mocks/EmojiStore.go @@ -7,7 +7,7 @@ package mocks import ( context "context" - model "github.com/mattermost/mattermost-server/v6/model" + model "github.com/mattermost/mattermost-server/server/v8/model" mock "github.com/stretchr/testify/mock" ) diff --git a/server/channels/store/storetest/mocks/FileInfoStore.go b/server/channels/store/storetest/mocks/FileInfoStore.go index f9529ca258..b514fe2e31 100644 --- a/server/channels/store/storetest/mocks/FileInfoStore.go +++ b/server/channels/store/storetest/mocks/FileInfoStore.go @@ -5,7 +5,7 @@ package mocks import ( - model "github.com/mattermost/mattermost-server/v6/model" + model "github.com/mattermost/mattermost-server/server/v8/model" mock "github.com/stretchr/testify/mock" ) diff --git a/server/channels/store/storetest/mocks/GroupStore.go b/server/channels/store/storetest/mocks/GroupStore.go index 65bfbf2703..c29e8a6a0f 100644 --- a/server/channels/store/storetest/mocks/GroupStore.go +++ b/server/channels/store/storetest/mocks/GroupStore.go @@ -5,7 +5,7 @@ package mocks import ( - model "github.com/mattermost/mattermost-server/v6/model" + model "github.com/mattermost/mattermost-server/server/v8/model" mock "github.com/stretchr/testify/mock" ) diff --git a/server/channels/store/storetest/mocks/JobStore.go b/server/channels/store/storetest/mocks/JobStore.go index 1b51098ecf..3b927281b3 100644 --- a/server/channels/store/storetest/mocks/JobStore.go +++ b/server/channels/store/storetest/mocks/JobStore.go @@ -5,7 +5,7 @@ package mocks import ( - model "github.com/mattermost/mattermost-server/v6/model" + model "github.com/mattermost/mattermost-server/server/v8/model" mock "github.com/stretchr/testify/mock" ) diff --git a/server/channels/store/storetest/mocks/LicenseStore.go b/server/channels/store/storetest/mocks/LicenseStore.go index b0a7947169..e0bb342cd6 100644 --- a/server/channels/store/storetest/mocks/LicenseStore.go +++ b/server/channels/store/storetest/mocks/LicenseStore.go @@ -5,7 +5,7 @@ package mocks import ( - model "github.com/mattermost/mattermost-server/v6/model" + model "github.com/mattermost/mattermost-server/server/v8/model" mock "github.com/stretchr/testify/mock" ) diff --git a/server/channels/store/storetest/mocks/LinkMetadataStore.go b/server/channels/store/storetest/mocks/LinkMetadataStore.go index 5bf135f9d2..be97f3003a 100644 --- a/server/channels/store/storetest/mocks/LinkMetadataStore.go +++ b/server/channels/store/storetest/mocks/LinkMetadataStore.go @@ -5,7 +5,7 @@ package mocks import ( - model "github.com/mattermost/mattermost-server/v6/model" + model "github.com/mattermost/mattermost-server/server/v8/model" mock "github.com/stretchr/testify/mock" ) diff --git a/server/channels/store/storetest/mocks/NotifyAdminStore.go b/server/channels/store/storetest/mocks/NotifyAdminStore.go index eceb2be8d9..e2f98f9ce2 100644 --- a/server/channels/store/storetest/mocks/NotifyAdminStore.go +++ b/server/channels/store/storetest/mocks/NotifyAdminStore.go @@ -5,7 +5,7 @@ package mocks import ( - model "github.com/mattermost/mattermost-server/v6/model" + model "github.com/mattermost/mattermost-server/server/v8/model" mock "github.com/stretchr/testify/mock" ) diff --git a/server/channels/store/storetest/mocks/OAuthStore.go b/server/channels/store/storetest/mocks/OAuthStore.go index e368215b67..d333b42a8f 100644 --- a/server/channels/store/storetest/mocks/OAuthStore.go +++ b/server/channels/store/storetest/mocks/OAuthStore.go @@ -5,7 +5,7 @@ package mocks import ( - model "github.com/mattermost/mattermost-server/v6/model" + model "github.com/mattermost/mattermost-server/server/v8/model" mock "github.com/stretchr/testify/mock" ) diff --git a/server/channels/store/storetest/mocks/PluginStore.go b/server/channels/store/storetest/mocks/PluginStore.go index d44435d8db..72229eba60 100644 --- a/server/channels/store/storetest/mocks/PluginStore.go +++ b/server/channels/store/storetest/mocks/PluginStore.go @@ -5,7 +5,7 @@ package mocks import ( - model "github.com/mattermost/mattermost-server/v6/model" + model "github.com/mattermost/mattermost-server/server/v8/model" mock "github.com/stretchr/testify/mock" ) diff --git a/server/channels/store/storetest/mocks/PostAcknowledgementStore.go b/server/channels/store/storetest/mocks/PostAcknowledgementStore.go index 267ebf0bcf..5bff12cfab 100644 --- a/server/channels/store/storetest/mocks/PostAcknowledgementStore.go +++ b/server/channels/store/storetest/mocks/PostAcknowledgementStore.go @@ -5,7 +5,7 @@ package mocks import ( - model "github.com/mattermost/mattermost-server/v6/model" + model "github.com/mattermost/mattermost-server/server/v8/model" mock "github.com/stretchr/testify/mock" ) diff --git a/server/channels/store/storetest/mocks/PostPriorityStore.go b/server/channels/store/storetest/mocks/PostPriorityStore.go index 5fc302066d..2697dbad92 100644 --- a/server/channels/store/storetest/mocks/PostPriorityStore.go +++ b/server/channels/store/storetest/mocks/PostPriorityStore.go @@ -5,7 +5,7 @@ package mocks import ( - model "github.com/mattermost/mattermost-server/v6/model" + model "github.com/mattermost/mattermost-server/server/v8/model" mock "github.com/stretchr/testify/mock" ) diff --git a/server/channels/store/storetest/mocks/PostStore.go b/server/channels/store/storetest/mocks/PostStore.go index 2d16e519d6..434fd864e9 100644 --- a/server/channels/store/storetest/mocks/PostStore.go +++ b/server/channels/store/storetest/mocks/PostStore.go @@ -7,10 +7,10 @@ package mocks import ( context "context" - model "github.com/mattermost/mattermost-server/v6/model" + model "github.com/mattermost/mattermost-server/server/v8/model" mock "github.com/stretchr/testify/mock" - store "github.com/mattermost/mattermost-server/v6/server/channels/store" + store "github.com/mattermost/mattermost-server/server/v8/channels/store" ) // PostStore is an autogenerated mock type for the PostStore type diff --git a/server/channels/store/storetest/mocks/PreferenceStore.go b/server/channels/store/storetest/mocks/PreferenceStore.go index 2d8c9a8dae..ed5db59dc4 100644 --- a/server/channels/store/storetest/mocks/PreferenceStore.go +++ b/server/channels/store/storetest/mocks/PreferenceStore.go @@ -5,7 +5,7 @@ package mocks import ( - model "github.com/mattermost/mattermost-server/v6/model" + model "github.com/mattermost/mattermost-server/server/v8/model" mock "github.com/stretchr/testify/mock" ) diff --git a/server/channels/store/storetest/mocks/ProductNoticesStore.go b/server/channels/store/storetest/mocks/ProductNoticesStore.go index 15230fa626..4563f48379 100644 --- a/server/channels/store/storetest/mocks/ProductNoticesStore.go +++ b/server/channels/store/storetest/mocks/ProductNoticesStore.go @@ -5,7 +5,7 @@ package mocks import ( - model "github.com/mattermost/mattermost-server/v6/model" + model "github.com/mattermost/mattermost-server/server/v8/model" mock "github.com/stretchr/testify/mock" ) diff --git a/server/channels/store/storetest/mocks/ReactionStore.go b/server/channels/store/storetest/mocks/ReactionStore.go index d1d7247921..f295676495 100644 --- a/server/channels/store/storetest/mocks/ReactionStore.go +++ b/server/channels/store/storetest/mocks/ReactionStore.go @@ -5,7 +5,7 @@ package mocks import ( - model "github.com/mattermost/mattermost-server/v6/model" + model "github.com/mattermost/mattermost-server/server/v8/model" mock "github.com/stretchr/testify/mock" ) diff --git a/server/channels/store/storetest/mocks/RemoteClusterStore.go b/server/channels/store/storetest/mocks/RemoteClusterStore.go index 8f144e3572..caacd9a062 100644 --- a/server/channels/store/storetest/mocks/RemoteClusterStore.go +++ b/server/channels/store/storetest/mocks/RemoteClusterStore.go @@ -5,7 +5,7 @@ package mocks import ( - model "github.com/mattermost/mattermost-server/v6/model" + model "github.com/mattermost/mattermost-server/server/v8/model" mock "github.com/stretchr/testify/mock" ) diff --git a/server/channels/store/storetest/mocks/RetentionPolicyStore.go b/server/channels/store/storetest/mocks/RetentionPolicyStore.go index 3af57249ff..46a68cb49a 100644 --- a/server/channels/store/storetest/mocks/RetentionPolicyStore.go +++ b/server/channels/store/storetest/mocks/RetentionPolicyStore.go @@ -5,7 +5,7 @@ package mocks import ( - model "github.com/mattermost/mattermost-server/v6/model" + model "github.com/mattermost/mattermost-server/server/v8/model" mock "github.com/stretchr/testify/mock" ) diff --git a/server/channels/store/storetest/mocks/RoleStore.go b/server/channels/store/storetest/mocks/RoleStore.go index 29a7d1b303..fd4ca2232d 100644 --- a/server/channels/store/storetest/mocks/RoleStore.go +++ b/server/channels/store/storetest/mocks/RoleStore.go @@ -7,7 +7,7 @@ package mocks import ( context "context" - model "github.com/mattermost/mattermost-server/v6/model" + model "github.com/mattermost/mattermost-server/server/v8/model" mock "github.com/stretchr/testify/mock" ) diff --git a/server/channels/store/storetest/mocks/SchemeStore.go b/server/channels/store/storetest/mocks/SchemeStore.go index 4b20742404..e6a7e35b84 100644 --- a/server/channels/store/storetest/mocks/SchemeStore.go +++ b/server/channels/store/storetest/mocks/SchemeStore.go @@ -5,7 +5,7 @@ package mocks import ( - model "github.com/mattermost/mattermost-server/v6/model" + model "github.com/mattermost/mattermost-server/server/v8/model" mock "github.com/stretchr/testify/mock" ) diff --git a/server/channels/store/storetest/mocks/SessionStore.go b/server/channels/store/storetest/mocks/SessionStore.go index 034313ba8d..acb486fe7c 100644 --- a/server/channels/store/storetest/mocks/SessionStore.go +++ b/server/channels/store/storetest/mocks/SessionStore.go @@ -7,7 +7,7 @@ package mocks import ( context "context" - model "github.com/mattermost/mattermost-server/v6/model" + model "github.com/mattermost/mattermost-server/server/v8/model" mock "github.com/stretchr/testify/mock" ) diff --git a/server/channels/store/storetest/mocks/SharedChannelStore.go b/server/channels/store/storetest/mocks/SharedChannelStore.go index 33d2599b47..c8e39da2c6 100644 --- a/server/channels/store/storetest/mocks/SharedChannelStore.go +++ b/server/channels/store/storetest/mocks/SharedChannelStore.go @@ -5,7 +5,7 @@ package mocks import ( - model "github.com/mattermost/mattermost-server/v6/model" + model "github.com/mattermost/mattermost-server/server/v8/model" mock "github.com/stretchr/testify/mock" ) diff --git a/server/channels/store/storetest/mocks/StatusStore.go b/server/channels/store/storetest/mocks/StatusStore.go index 9959fa23cf..5f7deb0441 100644 --- a/server/channels/store/storetest/mocks/StatusStore.go +++ b/server/channels/store/storetest/mocks/StatusStore.go @@ -5,7 +5,7 @@ package mocks import ( - model "github.com/mattermost/mattermost-server/v6/model" + model "github.com/mattermost/mattermost-server/server/v8/model" mock "github.com/stretchr/testify/mock" ) diff --git a/server/channels/store/storetest/mocks/Store.go b/server/channels/store/storetest/mocks/Store.go index c41ca9d1a9..bca15c95e0 100644 --- a/server/channels/store/storetest/mocks/Store.go +++ b/server/channels/store/storetest/mocks/Store.go @@ -7,12 +7,12 @@ package mocks import ( context "context" - model "github.com/mattermost/mattermost-server/v6/model" + model "github.com/mattermost/mattermost-server/server/v8/model" mock "github.com/stretchr/testify/mock" sql "database/sql" - store "github.com/mattermost/mattermost-server/v6/server/channels/store" + store "github.com/mattermost/mattermost-server/server/v8/channels/store" time "time" ) @@ -346,22 +346,6 @@ func (_m *Store) GetInternalReplicaDB() *sql.DB { return r0 } -// GetInternalReplicaDBs provides a mock function with given fields: -func (_m *Store) GetInternalReplicaDBs() []*sql.DB { - ret := _m.Called() - - var r0 []*sql.DB - if rf, ok := ret.Get(0).(func() []*sql.DB); ok { - r0 = rf() - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).([]*sql.DB) - } - } - - return r0 -} - // Group provides a mock function with given fields: func (_m *Store) Group() store.GroupStore { ret := _m.Called() diff --git a/server/channels/store/storetest/mocks/SystemStore.go b/server/channels/store/storetest/mocks/SystemStore.go index d84a3ad0ee..ff41ada483 100644 --- a/server/channels/store/storetest/mocks/SystemStore.go +++ b/server/channels/store/storetest/mocks/SystemStore.go @@ -5,7 +5,7 @@ package mocks import ( - model "github.com/mattermost/mattermost-server/v6/model" + model "github.com/mattermost/mattermost-server/server/v8/model" mock "github.com/stretchr/testify/mock" ) diff --git a/server/channels/store/storetest/mocks/TeamStore.go b/server/channels/store/storetest/mocks/TeamStore.go index 5cf83f077e..7c8f038a0e 100644 --- a/server/channels/store/storetest/mocks/TeamStore.go +++ b/server/channels/store/storetest/mocks/TeamStore.go @@ -7,7 +7,7 @@ package mocks import ( context "context" - model "github.com/mattermost/mattermost-server/v6/model" + model "github.com/mattermost/mattermost-server/server/v8/model" mock "github.com/stretchr/testify/mock" ) diff --git a/server/channels/store/storetest/mocks/TermsOfServiceStore.go b/server/channels/store/storetest/mocks/TermsOfServiceStore.go index 17093293d2..2de7fbe85c 100644 --- a/server/channels/store/storetest/mocks/TermsOfServiceStore.go +++ b/server/channels/store/storetest/mocks/TermsOfServiceStore.go @@ -5,7 +5,7 @@ package mocks import ( - model "github.com/mattermost/mattermost-server/v6/model" + model "github.com/mattermost/mattermost-server/server/v8/model" mock "github.com/stretchr/testify/mock" ) diff --git a/server/channels/store/storetest/mocks/ThreadStore.go b/server/channels/store/storetest/mocks/ThreadStore.go index b969e81460..661194a935 100644 --- a/server/channels/store/storetest/mocks/ThreadStore.go +++ b/server/channels/store/storetest/mocks/ThreadStore.go @@ -5,8 +5,8 @@ package mocks import ( - model "github.com/mattermost/mattermost-server/v6/model" - store "github.com/mattermost/mattermost-server/v6/server/channels/store" + store "github.com/mattermost/mattermost-server/server/v8/channels/store" + model "github.com/mattermost/mattermost-server/server/v8/model" mock "github.com/stretchr/testify/mock" ) @@ -29,6 +29,20 @@ func (_m *ThreadStore) DeleteMembershipForUser(userId string, postID string) err return r0 } +// DeleteMembershipsForChannel provides a mock function with given fields: userID, channelID +func (_m *ThreadStore) DeleteMembershipsForChannel(userID string, channelID string) error { + ret := _m.Called(userID, channelID) + + var r0 error + if rf, ok := ret.Get(0).(func(string, string) error); ok { + r0 = rf(userID, channelID) + } else { + r0 = ret.Error(0) + } + + return r0 +} + // DeleteOrphanedRows provides a mock function with given fields: limit func (_m *ThreadStore) DeleteOrphanedRows(limit int) (int64, error) { ret := _m.Called(limit) diff --git a/server/channels/store/storetest/mocks/TokenStore.go b/server/channels/store/storetest/mocks/TokenStore.go index 5f3f14922f..11d97ef20f 100644 --- a/server/channels/store/storetest/mocks/TokenStore.go +++ b/server/channels/store/storetest/mocks/TokenStore.go @@ -5,7 +5,7 @@ package mocks import ( - model "github.com/mattermost/mattermost-server/v6/model" + model "github.com/mattermost/mattermost-server/server/v8/model" mock "github.com/stretchr/testify/mock" ) diff --git a/server/channels/store/storetest/mocks/TrueUpReviewStore.go b/server/channels/store/storetest/mocks/TrueUpReviewStore.go index f71c1a8eb3..153d12c9f0 100644 --- a/server/channels/store/storetest/mocks/TrueUpReviewStore.go +++ b/server/channels/store/storetest/mocks/TrueUpReviewStore.go @@ -5,7 +5,7 @@ package mocks import ( - model "github.com/mattermost/mattermost-server/v6/model" + model "github.com/mattermost/mattermost-server/server/v8/model" mock "github.com/stretchr/testify/mock" ) diff --git a/server/channels/store/storetest/mocks/UploadSessionStore.go b/server/channels/store/storetest/mocks/UploadSessionStore.go index 8a4ea35009..43000d811b 100644 --- a/server/channels/store/storetest/mocks/UploadSessionStore.go +++ b/server/channels/store/storetest/mocks/UploadSessionStore.go @@ -7,7 +7,7 @@ package mocks import ( context "context" - model "github.com/mattermost/mattermost-server/v6/model" + model "github.com/mattermost/mattermost-server/server/v8/model" mock "github.com/stretchr/testify/mock" ) diff --git a/server/channels/store/storetest/mocks/UserAccessTokenStore.go b/server/channels/store/storetest/mocks/UserAccessTokenStore.go index 8ebac229cc..685582502e 100644 --- a/server/channels/store/storetest/mocks/UserAccessTokenStore.go +++ b/server/channels/store/storetest/mocks/UserAccessTokenStore.go @@ -5,7 +5,7 @@ package mocks import ( - model "github.com/mattermost/mattermost-server/v6/model" + model "github.com/mattermost/mattermost-server/server/v8/model" mock "github.com/stretchr/testify/mock" ) diff --git a/server/channels/store/storetest/mocks/UserStore.go b/server/channels/store/storetest/mocks/UserStore.go index 0e7698809e..dd1e851456 100644 --- a/server/channels/store/storetest/mocks/UserStore.go +++ b/server/channels/store/storetest/mocks/UserStore.go @@ -7,10 +7,10 @@ package mocks import ( context "context" - model "github.com/mattermost/mattermost-server/v6/model" + model "github.com/mattermost/mattermost-server/server/v8/model" mock "github.com/stretchr/testify/mock" - store "github.com/mattermost/mattermost-server/v6/server/channels/store" + store "github.com/mattermost/mattermost-server/server/v8/channels/store" ) // UserStore is an autogenerated mock type for the UserStore type diff --git a/server/channels/store/storetest/mocks/UserTermsOfServiceStore.go b/server/channels/store/storetest/mocks/UserTermsOfServiceStore.go index 41fc7925e2..6280d63e35 100644 --- a/server/channels/store/storetest/mocks/UserTermsOfServiceStore.go +++ b/server/channels/store/storetest/mocks/UserTermsOfServiceStore.go @@ -5,7 +5,7 @@ package mocks import ( - model "github.com/mattermost/mattermost-server/v6/model" + model "github.com/mattermost/mattermost-server/server/v8/model" mock "github.com/stretchr/testify/mock" ) diff --git a/server/channels/store/storetest/mocks/WebhookStore.go b/server/channels/store/storetest/mocks/WebhookStore.go index e78e63ec0a..3bbee2ff5c 100644 --- a/server/channels/store/storetest/mocks/WebhookStore.go +++ b/server/channels/store/storetest/mocks/WebhookStore.go @@ -5,7 +5,7 @@ package mocks import ( - model "github.com/mattermost/mattermost-server/v6/model" + model "github.com/mattermost/mattermost-server/server/v8/model" mock "github.com/stretchr/testify/mock" ) diff --git a/server/channels/store/storetest/notify_admin_store.go b/server/channels/store/storetest/notify_admin_store.go index f235e71cff..3951fb0955 100644 --- a/server/channels/store/storetest/notify_admin_store.go +++ b/server/channels/store/storetest/notify_admin_store.go @@ -9,8 +9,8 @@ import ( "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" ) const PluginIdJenkins = "jenkins" diff --git a/server/channels/store/storetest/oauth_store.go b/server/channels/store/storetest/oauth_store.go index 6f6008c218..9893d436fb 100644 --- a/server/channels/store/storetest/oauth_store.go +++ b/server/channels/store/storetest/oauth_store.go @@ -10,8 +10,8 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestOAuthStore(t *testing.T, ss store.Store) { diff --git a/server/channels/store/storetest/plugin_store.go b/server/channels/store/storetest/plugin_store.go index 04b1c8ec62..c3cc614cb6 100644 --- a/server/channels/store/storetest/plugin_store.go +++ b/server/channels/store/storetest/plugin_store.go @@ -10,8 +10,8 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestPluginStore(t *testing.T, ss store.Store, s SqlStore) { diff --git a/server/channels/store/storetest/post_acknowledgements_store.go b/server/channels/store/storetest/post_acknowledgements_store.go index f34f042294..8e9ef9f2e7 100644 --- a/server/channels/store/storetest/post_acknowledgements_store.go +++ b/server/channels/store/storetest/post_acknowledgements_store.go @@ -8,8 +8,8 @@ import ( "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestPostAcknowledgementsStore(t *testing.T, ss store.Store, s SqlStore) { diff --git a/server/channels/store/storetest/post_priority_store.go b/server/channels/store/storetest/post_priority_store.go index 447fff7cd1..0fd5f87071 100644 --- a/server/channels/store/storetest/post_priority_store.go +++ b/server/channels/store/storetest/post_priority_store.go @@ -11,8 +11,8 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestPostPriorityStore(t *testing.T, ss store.Store, s SqlStore) { diff --git a/server/channels/store/storetest/post_store.go b/server/channels/store/storetest/post_store.go index a718eb76ac..8de594072a 100644 --- a/server/channels/store/storetest/post_store.go +++ b/server/channels/store/storetest/post_store.go @@ -15,9 +15,9 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store" - "github.com/mattermost/mattermost-server/v6/server/channels/utils" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/utils" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestPostStore(t *testing.T, ss store.Store, s SqlStore) { diff --git a/server/channels/store/storetest/preference_store.go b/server/channels/store/storetest/preference_store.go index 1f0b4ff14e..7816b0b7ae 100644 --- a/server/channels/store/storetest/preference_store.go +++ b/server/channels/store/storetest/preference_store.go @@ -9,8 +9,8 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestPreferenceStore(t *testing.T, ss store.Store) { diff --git a/server/channels/store/storetest/product_notices_store.go b/server/channels/store/storetest/product_notices_store.go index ecb4e8ffda..9dbf43f011 100644 --- a/server/channels/store/storetest/product_notices_store.go +++ b/server/channels/store/storetest/product_notices_store.go @@ -8,8 +8,8 @@ import ( "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestProductNoticesStore(t *testing.T, ss store.Store) { diff --git a/server/channels/store/storetest/reaction_store.go b/server/channels/store/storetest/reaction_store.go index 3b7c589c9f..f52ee6ac4a 100644 --- a/server/channels/store/storetest/reaction_store.go +++ b/server/channels/store/storetest/reaction_store.go @@ -13,9 +13,9 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store" - "github.com/mattermost/mattermost-server/v6/server/channels/store/retrylayer" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/store/retrylayer" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestReactionStore(t *testing.T, ss store.Store, s SqlStore) { diff --git a/server/channels/store/storetest/remote_cluster_store.go b/server/channels/store/storetest/remote_cluster_store.go index 2ff7885c38..b1d53f8611 100644 --- a/server/channels/store/storetest/remote_cluster_store.go +++ b/server/channels/store/storetest/remote_cluster_store.go @@ -7,8 +7,8 @@ import ( "strings" "testing" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/server/channels/store/storetest/retention_policy_store.go b/server/channels/store/storetest/retention_policy_store.go index 2223a41894..2ccb13916f 100644 --- a/server/channels/store/storetest/retention_policy_store.go +++ b/server/channels/store/storetest/retention_policy_store.go @@ -10,8 +10,8 @@ import ( "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestRetentionPolicyStore(t *testing.T, ss store.Store, s SqlStore) { diff --git a/server/channels/store/storetest/role_store.go b/server/channels/store/storetest/role_store.go index ba4e220369..70fb09b422 100644 --- a/server/channels/store/storetest/role_store.go +++ b/server/channels/store/storetest/role_store.go @@ -11,8 +11,8 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestRoleStore(t *testing.T, ss store.Store, s SqlStore) { diff --git a/server/channels/store/storetest/scheme_store.go b/server/channels/store/storetest/scheme_store.go index 66f489b4f0..4d0607740a 100644 --- a/server/channels/store/storetest/scheme_store.go +++ b/server/channels/store/storetest/scheme_store.go @@ -10,8 +10,8 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestSchemeStore(t *testing.T, ss store.Store) { diff --git a/server/channels/store/storetest/session_store.go b/server/channels/store/storetest/session_store.go index 3c8fba5504..8275d1e57c 100644 --- a/server/channels/store/storetest/session_store.go +++ b/server/channels/store/storetest/session_store.go @@ -10,8 +10,8 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" ) const ( diff --git a/server/channels/store/storetest/settings.go b/server/channels/store/storetest/settings.go index 3a289e3408..0104b950bb 100644 --- a/server/channels/store/storetest/settings.go +++ b/server/channels/store/storetest/settings.go @@ -17,8 +17,8 @@ import ( _ "github.com/lib/pq" "github.com/pkg/errors" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) const ( @@ -261,6 +261,7 @@ func MakeSqlSettings(driver string, withReplica bool) *model.SqlSettings { } log("Created temporary " + driver + " database " + dbName) + settings.ReplicaMonitorIntervalSeconds = model.NewInt(5) return settings } diff --git a/server/channels/store/storetest/shared_channel_store.go b/server/channels/store/storetest/shared_channel_store.go index b5f0c6f6a4..58d82bba48 100644 --- a/server/channels/store/storetest/shared_channel_store.go +++ b/server/channels/store/storetest/shared_channel_store.go @@ -11,8 +11,8 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestSharedChannelStore(t *testing.T, ss store.Store, s SqlStore) { diff --git a/server/channels/store/storetest/status_store.go b/server/channels/store/storetest/status_store.go index 16c60991e2..ac14cc196f 100644 --- a/server/channels/store/storetest/status_store.go +++ b/server/channels/store/storetest/status_store.go @@ -9,8 +9,8 @@ import ( "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestStatusStore(t *testing.T, ss store.Store) { diff --git a/server/channels/store/storetest/store.go b/server/channels/store/storetest/store.go index 1e35da7bfb..3883f7344b 100644 --- a/server/channels/store/storetest/store.go +++ b/server/channels/store/storetest/store.go @@ -10,9 +10,9 @@ import ( "github.com/stretchr/testify/mock" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store" - "github.com/mattermost/mattermost-server/v6/server/channels/store/storetest/mocks" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/store/storetest/mocks" + "github.com/mattermost/mattermost-server/server/v8/model" ) // Store can be used to provide mock stores for testing. diff --git a/server/channels/store/storetest/storetestlib.go b/server/channels/store/storetest/storetestlib.go index a0a2f9fdb0..f72115732e 100644 --- a/server/channels/store/storetest/storetestlib.go +++ b/server/channels/store/storetest/storetestlib.go @@ -4,7 +4,7 @@ package storetest import ( - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) func MakeEmail() string { diff --git a/server/channels/store/storetest/system_store.go b/server/channels/store/storetest/system_store.go index c6c233af94..7b8a06a5b5 100644 --- a/server/channels/store/storetest/system_store.go +++ b/server/channels/store/storetest/system_store.go @@ -10,8 +10,8 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestSystemStore(t *testing.T, ss store.Store) { diff --git a/server/channels/store/storetest/team_store.go b/server/channels/store/storetest/team_store.go index b0d9b855d8..b7eef90aa5 100644 --- a/server/channels/store/storetest/team_store.go +++ b/server/channels/store/storetest/team_store.go @@ -13,8 +13,8 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" ) func cleanupTeamStore(t *testing.T, ss store.Store) { diff --git a/server/channels/store/storetest/terms_of_service_store.go b/server/channels/store/storetest/terms_of_service_store.go index e58a4388a1..4977e47125 100644 --- a/server/channels/store/storetest/terms_of_service_store.go +++ b/server/channels/store/storetest/terms_of_service_store.go @@ -9,8 +9,8 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestTermsOfServiceStore(t *testing.T, ss store.Store) { diff --git a/server/channels/store/storetest/thread_store.go b/server/channels/store/storetest/thread_store.go index 7ba2baef19..efbc74d3ac 100644 --- a/server/channels/store/storetest/thread_store.go +++ b/server/channels/store/storetest/thread_store.go @@ -12,8 +12,8 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestThreadStore(t *testing.T, ss store.Store, s SqlStore) { @@ -29,6 +29,7 @@ func TestThreadStore(t *testing.T, ss store.Store, s SqlStore) { t.Run("MarkAllAsReadByChannels", func(t *testing.T) { testMarkAllAsReadByChannels(t, ss) }) t.Run("GetTopThreads", func(t *testing.T) { testGetTopThreads(t, ss) }) t.Run("MarkAllAsReadByTeam", func(t *testing.T) { testMarkAllAsReadByTeam(t, ss) }) + t.Run("DeleteMembershipsForChannel", func(t *testing.T) { testDeleteMembershipsForChannel(t, ss) }) } func testThreadStorePopulation(t *testing.T, ss store.Store) { @@ -1914,3 +1915,121 @@ func testMarkAllAsReadByTeam(t *testing.T, ss store.Store) { assertThreadReplyCount(t, userBID, team2.Id, 1, "expected 1 unread message in team2 for userB") }) } + +func testDeleteMembershipsForChannel(t *testing.T, ss store.Store) { + createThreadMembership := func(userID, postID string) (*model.ThreadMembership, func()) { + t.Helper() + opts := store.ThreadMembershipOpts{ + Following: true, + IncrementMentions: false, + UpdateFollowing: true, + UpdateViewedTimestamp: false, + UpdateParticipants: false, + } + mem, err := ss.Thread().MaintainMembership(userID, postID, opts) + require.NoError(t, err) + + return mem, func() { + err := ss.Thread().DeleteMembershipForUser(userID, postID) + require.NoError(t, err) + } + } + + postingUserID := model.NewId() + userAID := model.NewId() + userBID := model.NewId() + + team, err := ss.Team().Save(&model.Team{ + DisplayName: "DisplayName", + Name: "team" + model.NewId(), + Email: MakeEmail(), + Type: model.TeamOpen, + }) + require.NoError(t, err) + + channel1, err := ss.Channel().Save(&model.Channel{ + TeamId: team.Id, + DisplayName: "DisplayName", + Name: "channel1" + model.NewId(), + Type: model.ChannelTypeOpen, + }, -1) + require.NoError(t, err) + channel2, err := ss.Channel().Save(&model.Channel{ + TeamId: team.Id, + DisplayName: "DisplayName2", + Name: "channel2" + model.NewId(), + Type: model.ChannelTypeOpen, + }, -1) + require.NoError(t, err) + + rootPost1, err := ss.Post().Save(&model.Post{ + ChannelId: channel1.Id, + UserId: postingUserID, + Message: model.NewRandomString(10), + }) + require.NoError(t, err) + + _, err = ss.Post().Save(&model.Post{ + ChannelId: channel1.Id, + UserId: postingUserID, + Message: model.NewRandomString(10), + RootId: rootPost1.Id, + }) + require.NoError(t, err) + + rootPost2, err := ss.Post().Save(&model.Post{ + ChannelId: channel2.Id, + UserId: postingUserID, + Message: model.NewRandomString(10), + }) + require.NoError(t, err) + _, err = ss.Post().Save(&model.Post{ + ChannelId: channel2.Id, + UserId: postingUserID, + Message: model.NewRandomString(10), + RootId: rootPost2.Id, + }) + require.NoError(t, err) + + t.Run("should return memberships for user", func(t *testing.T) { + memA1, cleanupA1 := createThreadMembership(userAID, rootPost1.Id) + defer cleanupA1() + memA2, cleanupA2 := createThreadMembership(userAID, rootPost2.Id) + defer cleanupA2() + + membershipsA, err := ss.Thread().GetMembershipsForUser(userAID, team.Id) + require.NoError(t, err) + + require.Len(t, membershipsA, 2) + require.ElementsMatch(t, []*model.ThreadMembership{memA1, memA2}, membershipsA) + }) + + t.Run("should delete memberships for user for channel", func(t *testing.T) { + _, cleanupA1 := createThreadMembership(userAID, rootPost1.Id) + defer cleanupA1() + memA2, cleanupA2 := createThreadMembership(userAID, rootPost2.Id) + defer cleanupA2() + + ss.Thread().DeleteMembershipsForChannel(userAID, channel1.Id) + membershipsA, err := ss.Thread().GetMembershipsForUser(userAID, team.Id) + require.NoError(t, err) + + require.Len(t, membershipsA, 1) + require.ElementsMatch(t, []*model.ThreadMembership{memA2}, membershipsA) + }) + + t.Run("deleting memberships for channel for userA should not affect userB", func(t *testing.T) { + _, cleanupA1 := createThreadMembership(userAID, rootPost1.Id) + defer cleanupA1() + _, cleanupA2 := createThreadMembership(userAID, rootPost2.Id) + defer cleanupA2() + memB1, cleanupB2 := createThreadMembership(userBID, rootPost1.Id) + defer cleanupB2() + + membershipsB, err := ss.Thread().GetMembershipsForUser(userBID, team.Id) + require.NoError(t, err) + + require.Len(t, membershipsB, 1) + require.ElementsMatch(t, []*model.ThreadMembership{memB1}, membershipsB) + }) +} diff --git a/server/channels/store/storetest/tokens_store.go b/server/channels/store/storetest/tokens_store.go index e89e2e3b24..78b026ba70 100644 --- a/server/channels/store/storetest/tokens_store.go +++ b/server/channels/store/storetest/tokens_store.go @@ -9,8 +9,8 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestTokensStore(t *testing.T, ss store.Store) { diff --git a/server/channels/store/storetest/true_up_review_store.go b/server/channels/store/storetest/true_up_review_store.go index 7ef149fa11..62491fb8b3 100644 --- a/server/channels/store/storetest/true_up_review_store.go +++ b/server/channels/store/storetest/true_up_review_store.go @@ -9,9 +9,9 @@ import ( "github.com/stretchr/testify/assert" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store" - "github.com/mattermost/mattermost-server/v6/server/channels/utils" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/utils" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestTrueUpReviewStatusStore(t *testing.T, ss store.Store, s SqlStore) { diff --git a/server/channels/store/storetest/upload_session_store.go b/server/channels/store/storetest/upload_session_store.go index 1629dff9f4..979b7036f1 100644 --- a/server/channels/store/storetest/upload_session_store.go +++ b/server/channels/store/storetest/upload_session_store.go @@ -10,8 +10,8 @@ import ( "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestUploadSessionStore(t *testing.T, ss store.Store) { diff --git a/server/channels/store/storetest/user_access_token_store.go b/server/channels/store/storetest/user_access_token_store.go index d66ac38e41..5dc8d3e120 100644 --- a/server/channels/store/storetest/user_access_token_store.go +++ b/server/channels/store/storetest/user_access_token_store.go @@ -9,8 +9,8 @@ import ( "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestUserAccessTokenStore(t *testing.T, ss store.Store) { diff --git a/server/channels/store/storetest/user_store.go b/server/channels/store/storetest/user_store.go index 9481c11ef7..3ea5410eb3 100644 --- a/server/channels/store/storetest/user_store.go +++ b/server/channels/store/storetest/user_store.go @@ -13,8 +13,8 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" ) const ( @@ -5969,6 +5969,7 @@ func testDeactivateGuests(t *testing.T, ss store.Store) { } func testUserStoreResetLastPictureUpdate(t *testing.T, ss store.Store) { + startTime := model.GetMillis() u1 := &model.User{} u1.Email = MakeEmail() _, err := ss.User().Save(u1) @@ -5983,8 +5984,7 @@ func testUserStoreResetLastPictureUpdate(t *testing.T, ss store.Store) { user, err := ss.User().Get(context.Background(), u1.Id) require.NoError(t, err) - assert.NotZero(t, user.LastPictureUpdate) - assert.NotZero(t, user.UpdateAt) + assert.GreaterOrEqual(t, user.LastPictureUpdate, startTime) // Ensure update at timestamp changes time.Sleep(time.Millisecond) @@ -5997,8 +5997,8 @@ func testUserStoreResetLastPictureUpdate(t *testing.T, ss store.Store) { user2, err := ss.User().Get(context.Background(), u1.Id) require.NoError(t, err) - assert.True(t, user2.UpdateAt > user.UpdateAt) - assert.Zero(t, user2.LastPictureUpdate) + assert.Greater(t, user2.UpdateAt, user.UpdateAt) + assert.Less(t, user2.LastPictureUpdate, -startTime) } func testGetKnownUsers(t *testing.T, ss store.Store) { diff --git a/server/channels/store/storetest/user_terms_of_service.go b/server/channels/store/storetest/user_terms_of_service.go index e219dd8d0c..0aaaf32b46 100644 --- a/server/channels/store/storetest/user_terms_of_service.go +++ b/server/channels/store/storetest/user_terms_of_service.go @@ -10,8 +10,8 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestUserTermsOfServiceStore(t *testing.T, ss store.Store) { diff --git a/server/channels/store/storetest/utils.go b/server/channels/store/storetest/utils.go index 7b8f06c3fb..60704b0f52 100644 --- a/server/channels/store/storetest/utils.go +++ b/server/channels/store/storetest/utils.go @@ -4,7 +4,7 @@ package storetest import ( - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) // This function has a copy of it in app/helper_test diff --git a/server/channels/store/storetest/webhook_store.go b/server/channels/store/storetest/webhook_store.go index b08a88e823..7c25472302 100644 --- a/server/channels/store/storetest/webhook_store.go +++ b/server/channels/store/storetest/webhook_store.go @@ -10,8 +10,8 @@ import ( "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestWebhookStore(t *testing.T, ss store.Store) { diff --git a/server/channels/store/timerlayer/timerlayer.go b/server/channels/store/timerlayer/timerlayer.go index 7c8c64a033..815b215305 100644 --- a/server/channels/store/timerlayer/timerlayer.go +++ b/server/channels/store/timerlayer/timerlayer.go @@ -10,9 +10,9 @@ import ( "context" "time" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/einterfaces" - "github.com/mattermost/mattermost-server/v6/server/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/einterfaces" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" ) type TimerLayer struct { @@ -774,10 +774,10 @@ func (s *TimerLayerChannelStore) CreateInitialSidebarCategories(userID string, o return result, err } -func (s *TimerLayerChannelStore) CreateSidebarCategory(userID string, teamID string, newCategory *model.SidebarCategoryWithChannels) (*model.SidebarCategoryWithChannels, error) { +func (s *TimerLayerChannelStore) CreateSidebarCategory(userID string, teamID string, newCategory *model.SidebarCategoryWithChannels, options ...*store.SidebarCategorySearchOpts) (*model.SidebarCategoryWithChannels, error) { start := time.Now() - result, err := s.ChannelStore.CreateSidebarCategory(userID, teamID, newCategory) + result, err := s.ChannelStore.CreateSidebarCategory(userID, teamID, newCategory, options...) elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { @@ -982,6 +982,22 @@ func (s *TimerLayerChannelStore) GetAllDirectChannelsForExportAfter(limit int, a return result, err } +func (s *TimerLayerChannelStore) GetBotChannelsByUser(userID string, opts store.ChannelSearchOpts) (model.ChannelList, error) { + start := time.Now() + + result, err := s.ChannelStore.GetBotChannelsByUser(userID, opts) + + elapsed := float64(time.Since(start)) / float64(time.Second) + if s.Root.Metrics != nil { + success := "false" + if err == nil { + success = "true" + } + s.Root.Metrics.ObserveStoreMethodDuration("ChannelStore.GetBotChannelsByUser", success, elapsed) + } + return result, err +} + func (s *TimerLayerChannelStore) GetByName(team_id string, name string, allowFromCache bool) (*model.Channel, error) { start := time.Now() @@ -1606,10 +1622,10 @@ func (s *TimerLayerChannelStore) GetSidebarCategories(userID string, opts *store return result, err } -func (s *TimerLayerChannelStore) GetSidebarCategoriesForTeamForUser(userID string, teamID string) (*model.OrderedSidebarCategories, error) { +func (s *TimerLayerChannelStore) GetSidebarCategoriesForTeamForUser(userID string, teamID string, options ...*store.SidebarCategorySearchOpts) (*model.OrderedSidebarCategories, error) { start := time.Now() - result, err := s.ChannelStore.GetSidebarCategoriesForTeamForUser(userID, teamID) + result, err := s.ChannelStore.GetSidebarCategoriesForTeamForUser(userID, teamID, options...) elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { @@ -1622,10 +1638,10 @@ func (s *TimerLayerChannelStore) GetSidebarCategoriesForTeamForUser(userID strin return result, err } -func (s *TimerLayerChannelStore) GetSidebarCategory(categoryID string) (*model.SidebarCategoryWithChannels, error) { +func (s *TimerLayerChannelStore) GetSidebarCategory(categoryID string, options ...*store.SidebarCategorySearchOpts) (*model.SidebarCategoryWithChannels, error) { start := time.Now() - result, err := s.ChannelStore.GetSidebarCategory(categoryID) + result, err := s.ChannelStore.GetSidebarCategory(categoryID, options...) elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { @@ -2399,10 +2415,10 @@ func (s *TimerLayerChannelStore) UpdateMultipleMembers(members []*model.ChannelM return result, err } -func (s *TimerLayerChannelStore) UpdateSidebarCategories(userID string, teamID string, categories []*model.SidebarCategoryWithChannels) ([]*model.SidebarCategoryWithChannels, []*model.SidebarCategoryWithChannels, error) { +func (s *TimerLayerChannelStore) UpdateSidebarCategories(userID string, teamID string, categories []*model.SidebarCategoryWithChannels, options ...*store.SidebarCategorySearchOpts) ([]*model.SidebarCategoryWithChannels, []*model.SidebarCategoryWithChannels, error) { start := time.Now() - result, resultVar1, err := s.ChannelStore.UpdateSidebarCategories(userID, teamID, categories) + result, resultVar1, err := s.ChannelStore.UpdateSidebarCategories(userID, teamID, categories, options...) elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { @@ -9112,6 +9128,22 @@ func (s *TimerLayerThreadStore) DeleteMembershipForUser(userId string, postID st return err } +func (s *TimerLayerThreadStore) DeleteMembershipsForChannel(userID string, channelID string) error { + start := time.Now() + + err := s.ThreadStore.DeleteMembershipsForChannel(userID, channelID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + if s.Root.Metrics != nil { + success := "false" + if err == nil { + success = "true" + } + s.Root.Metrics.ObserveStoreMethodDuration("ThreadStore.DeleteMembershipsForChannel", success, elapsed) + } + return err +} + func (s *TimerLayerThreadStore) DeleteOrphanedRows(limit int) (int64, error) { start := time.Now() diff --git a/server/channels/testlib/cluster.go b/server/channels/testlib/cluster.go index ed41d61418..76cf134d13 100644 --- a/server/channels/testlib/cluster.go +++ b/server/channels/testlib/cluster.go @@ -6,8 +6,8 @@ package testlib import ( "sync" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/einterfaces" + "github.com/mattermost/mattermost-server/server/v8/channels/einterfaces" + "github.com/mattermost/mattermost-server/server/v8/model" ) type FakeClusterInterface struct { diff --git a/server/channels/testlib/helper.go b/server/channels/testlib/helper.go index 7618d6cfab..f4e5d2bed6 100644 --- a/server/channels/testlib/helper.go +++ b/server/channels/testlib/helper.go @@ -13,13 +13,13 @@ import ( "github.com/pkg/errors" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store" - "github.com/mattermost/mattermost-server/v6/server/channels/store/searchlayer" - "github.com/mattermost/mattermost-server/v6/server/channels/store/sqlstore" - "github.com/mattermost/mattermost-server/v6/server/channels/store/storetest" - "github.com/mattermost/mattermost-server/v6/server/channels/utils" - "github.com/mattermost/mattermost-server/v6/server/platform/services/searchengine" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/store/searchlayer" + "github.com/mattermost/mattermost-server/server/v8/channels/store/sqlstore" + "github.com/mattermost/mattermost-server/server/v8/channels/store/storetest" + "github.com/mattermost/mattermost-server/server/v8/channels/utils" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/services/searchengine" ) type MainHelper struct { @@ -41,6 +41,11 @@ type HelperOptions struct { } func NewMainHelper() *MainHelper { + // Ignore any globally defined datasource if a test dsn defined + if os.Getenv("TEST_DATABASE_MYSQL_DSN") != "" || os.Getenv("TEST_DATABASE_POSTGRESQL_DSN") != "" { + os.Unsetenv("MM_SQLSETTINGS_DATASOURCE") + } + return NewMainHelperWithOptions(&HelperOptions{ EnableStore: true, EnableResources: true, @@ -48,6 +53,16 @@ func NewMainHelper() *MainHelper { } func NewMainHelperWithOptions(options *HelperOptions) *MainHelper { + // Ignore any globally defined datasource if a test dsn defined + if os.Getenv("TEST_DATABASE_MYSQL_DSN") != "" || os.Getenv("TEST_DATABASE_POSTGRESQL_DSN") != "" { + os.Unsetenv("MM_SQLSETTINGS_DATASOURCE") + } + + // Unset environment variables commonly set for development that interfere with tests. + os.Unsetenv("MM_SERVICESETTINGS_SITEURL") + os.Unsetenv("MM_SERVICESETTINGS_LISTENADDRESS") + os.Unsetenv("MM_SERVICESETTINGS_ENABLEDEVELOPER") + var mainHelper MainHelper flag.Parse() @@ -153,6 +168,7 @@ func (h *MainHelper) setupResources() { func (h *MainHelper) PreloadMigrations() { var buf []byte var err error + basePath := os.Getenv("MM_SERVER_PATH") if basePath == "" { basePath = "mattermost-server/server" @@ -177,6 +193,62 @@ func (h *MainHelper) PreloadMigrations() { if err != nil { panic(errors.Wrap(err, "Error preloading migrations. Check if you have &multiStatements=true in your DSN if you are using MySQL. Or perhaps the schema changed? If yes, then update the warmup files accordingly")) } + + h.PreloadBoardsMigrationsIfNeeded() +} + +// PreloadBoardsMigrationsIfNeeded loads boards migrations if the +// focalboard_schema_migrations table exists already. +// Besides this, the same compatibility and breaking conditions that +// PreloadMigrations has apply here. +// +// Re-generate the files with: +// pg_dump -a -h localhost -U mmuser -d <> --no-comments --inserts -t focalboard_system_settings +// mysqldump -u root -p <> --no-create-info --extended-insert=FALSE focalboard_system_settings +func (h *MainHelper) PreloadBoardsMigrationsIfNeeded() { + tableSchemaFn := "current_schema()" + if *h.Settings.DriverName == model.DatabaseDriverMysql { + tableSchemaFn = "DATABASE()" + } + + basePath := os.Getenv("MM_SERVER_PATH") + if basePath == "" { + basePath = "mattermost-server/server" + } + relPath := "channels/testlib/testdata" + + handle := h.SQLStore.GetMasterX() + var boardsTableCount int + gErr := handle.Get(&boardsTableCount, ` + SELECT COUNT(*) + FROM INFORMATION_SCHEMA.TABLES + WHERE TABLE_SCHEMA = `+tableSchemaFn+` + AND TABLE_NAME = 'focalboard_schema_migrations'`) + if gErr != nil { + panic(errors.Wrap(gErr, "Error preloading migrations. Cannot query INFORMATION_SCHEMA table to check for focalboard_schema_migrations table")) + } + + var buf []byte + var err error + if boardsTableCount != 0 { + switch *h.Settings.DriverName { + case model.DatabaseDriverPostgres: + boardsFinalPath := filepath.Join(basePath, relPath, "boards_postgres_migration_warmup.sql") + buf, err = os.ReadFile(boardsFinalPath) + if err != nil { + panic(fmt.Errorf("cannot read file: %v", err)) + } + case model.DatabaseDriverMysql: + boardsFinalPath := filepath.Join(basePath, relPath, "boards_mysql_migration_warmup.sql") + buf, err = os.ReadFile(boardsFinalPath) + if err != nil { + panic(fmt.Errorf("cannot read file: %v", err)) + } + } + if _, err := handle.Exec(string(buf)); err != nil { + panic(errors.Wrap(err, "Error preloading boards migrations. Check if you have &multiStatements=true in your DSN if you are using MySQL. Or perhaps the schema changed? If yes, then update the warmup files accordingly")) + } + } } func (h *MainHelper) Close() error { @@ -264,7 +336,7 @@ func (h *MainHelper) SetReplicationLagForTesting(seconds int) error { func (h *MainHelper) execOnEachReplica(query string, args ...any) error { for _, replica := range h.SQLStore.ReplicaXs { - _, err := replica.Exec(query, args...) + _, err := replica.Load().Exec(query, args...) if err != nil { return err } diff --git a/server/channels/testlib/resources.go b/server/channels/testlib/resources.go index 9d015d151a..7142b965e5 100644 --- a/server/channels/testlib/resources.go +++ b/server/channels/testlib/resources.go @@ -12,10 +12,10 @@ import ( "github.com/pkg/errors" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/utils" - "github.com/mattermost/mattermost-server/v6/server/channels/utils/fileutils" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/filestore" + "github.com/mattermost/mattermost-server/server/v8/channels/utils" + "github.com/mattermost/mattermost-server/server/v8/channels/utils/fileutils" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/filestore" ) const ( diff --git a/server/channels/testlib/store.go b/server/channels/testlib/store.go index bcd45a4f61..c8c9067562 100644 --- a/server/channels/testlib/store.go +++ b/server/channels/testlib/store.go @@ -7,10 +7,10 @@ import ( "net/http" "strconv" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/plugin/plugintest/mock" - "github.com/mattermost/mattermost-server/v6/server/channels/store" - "github.com/mattermost/mattermost-server/v6/server/channels/store/storetest/mocks" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/store/storetest/mocks" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/plugin/plugintest/mock" ) type TestStore struct { @@ -72,6 +72,7 @@ func GetMockStoreForSetupFunctions() *mocks.Store { systemStore.On("GetByName", model.MigrationKeyAddCustomUserGroupsPermissionRestore).Return(&model.System{Name: model.MigrationKeyAddCustomUserGroupsPermissionRestore, Value: "true"}, nil) systemStore.On("GetByName", "CustomGroupAdminRoleCreationMigrationComplete").Return(&model.System{Name: model.MigrationKeyAddPlayboosksManageRolesPermissions, Value: "true"}, nil) systemStore.On("GetByName", "products_boards").Return(&model.System{Name: "products_boards", Value: "true"}, nil) + systemStore.On("GetByName", "elasticsearch_fix_channel_index_migration_complete").Return(&model.System{Name: "elasticsearch_fix_channel_index_migration_complete", Value: "true"}, nil) systemStore.On("InsertIfExists", mock.AnythingOfType("*model.System")).Return(&model.System{}, nil).Once() systemStore.On("Save", mock.AnythingOfType("*model.System")).Return(nil) @@ -101,6 +102,9 @@ func GetMockStoreForSetupFunctions() *mocks.Store { oAuthStore := mocks.OAuthStore{} groupStore := mocks.GroupStore{} + pluginStore := mocks.PluginStore{} + pluginStore.On("List", mock.Anything, mock.Anything, mock.Anything).Return([]string{}, nil) + mockStore.On("System").Return(&systemStore) mockStore.On("User").Return(&userStore) mockStore.On("Post").Return(&postStore) @@ -116,6 +120,7 @@ func GetMockStoreForSetupFunctions() *mocks.Store { mockStore.On("OAuth").Return(&oAuthStore) mockStore.On("Group").Return(&groupStore) mockStore.On("GetDBSchemaVersion").Return(1, nil) + mockStore.On("Plugin").Return(&pluginStore) return &mockStore } diff --git a/server/channels/testlib/testdata/boards_mysql_migration_warmup.sql b/server/channels/testlib/testdata/boards_mysql_migration_warmup.sql new file mode 100644 index 0000000000..d279598e92 --- /dev/null +++ b/server/channels/testlib/testdata/boards_mysql_migration_warmup.sql @@ -0,0 +1,41 @@ +-- MySQL dump 10.13 Distrib 5.7.12, for Linux (x86_64) +-- +-- Host: localhost Database: mattermost_test +-- ------------------------------------------------------ +-- Server version 5.7.12 + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; + +-- +-- Dumping data for table `focalboard_system_settings` +-- + +LOCK TABLES `focalboard_system_settings` WRITE; +/*!40000 ALTER TABLE `focalboard_system_settings` DISABLE KEYS */; +INSERT INTO `focalboard_system_settings` VALUES ('CategoryUuidIdMigrationComplete','true'); +INSERT INTO `focalboard_system_settings` VALUES ('DeDuplicateCategoryBoardTableComplete','true'); +INSERT INTO `focalboard_system_settings` VALUES ('DeletedMembershipBoardsMigrationComplete','true'); +INSERT INTO `focalboard_system_settings` VALUES ('TeamLessBoardsMigrationComplete','true'); +INSERT INTO `focalboard_system_settings` VALUES ('UniqueIDsMigrationComplete','true'); +/*!40000 ALTER TABLE `focalboard_system_settings` ENABLE KEYS */; +UNLOCK TABLES; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +-- Dump completed on 2023-03-31 11:37:35 diff --git a/server/channels/testlib/testdata/boards_postgres_migration_warmup.sql b/server/channels/testlib/testdata/boards_postgres_migration_warmup.sql new file mode 100644 index 0000000000..7519e8076a --- /dev/null +++ b/server/channels/testlib/testdata/boards_postgres_migration_warmup.sql @@ -0,0 +1,26 @@ +-- +-- PostgreSQL database dump +-- + +-- Dumped from database version 10.20 (Debian 10.20-1.pgdg90+1) +-- Dumped by pg_dump version 14.7 + +SET statement_timeout = 0; +SET lock_timeout = 0; +SET idle_in_transaction_session_timeout = 0; +SET client_encoding = 'UTF8'; + +-- +-- Data for Name: focalboard_system_settings; Type: TABLE DATA; Schema: public; Owner: mmuser +-- + +INSERT INTO public.focalboard_system_settings VALUES ('UniqueIDsMigrationComplete', 'true'); +INSERT INTO public.focalboard_system_settings VALUES ('TeamLessBoardsMigrationComplete', 'true'); +INSERT INTO public.focalboard_system_settings VALUES ('DeletedMembershipBoardsMigrationComplete', 'true'); +INSERT INTO public.focalboard_system_settings VALUES ('CategoryUuidIdMigrationComplete', 'true'); +INSERT INTO public.focalboard_system_settings VALUES ('DeDuplicateCategoryBoardTableComplete', 'true'); + + +-- +-- PostgreSQL database dump complete +-- diff --git a/server/channels/testlib/testdata/mysql_migration_warmup.sql b/server/channels/testlib/testdata/mysql_migration_warmup.sql index 070dae56f6..eaafb2d368 100644 --- a/server/channels/testlib/testdata/mysql_migration_warmup.sql +++ b/server/channels/testlib/testdata/mysql_migration_warmup.sql @@ -81,14 +81,14 @@ INSERT INTO `Roles` VALUES ('hkcrew7wttb5fbuw3ime6g7nzc','system_read_only_admin INSERT INTO `Roles` VALUES ('iiwt9pt6wiyb9e1enixtxs5yme','run_admin','authentication.roles.run_admin.name','authentication.roles.run_admin.description',1662271985864,1662271986932,0,' run_manage_properties run_manage_members',1,1); INSERT INTO `Roles` VALUES ('jg1f1xfh3bb73pua938orwg9ie','system_guest','authentication.roles.global_guest.name','authentication.roles.global_guest.description',1605167829015,1662271986937,0,' create_direct_channel create_group_channel',1,1); INSERT INTO `Roles` VALUES ('k891n5tpd3n9peue79azejjocy','system_post_all_public','authentication.roles.system_post_all_public.name','authentication.roles.system_post_all_public.description',0,1662271986941,0,' use_channel_mentions create_post_public',0,1); -INSERT INTO `Roles` VALUES ('kb6r9i58x7dxdb3srfohd66sse','system_admin','authentication.roles.global_admin.name','authentication.roles.global_admin.description',0,1662271986948,0,' list_public_teams edit_brand manage_private_channel_properties sysconsole_read_user_management_teams playbook_public_create manage_others_bots invalidate_caches manage_shared_channels sysconsole_write_environment_logging manage_others_outgoing_webhooks sysconsole_read_reporting_team_statistics sysconsole_read_plugins list_team_channels use_group_mentions sysconsole_read_site_users_and_teams sysconsole_write_site_localization get_analytics sysconsole_read_experimental_bleve manage_team_roles sysconsole_read_site_localization use_slash_commands edit_post sysconsole_write_user_management_channels test_elasticsearch list_private_teams add_ldap_public_cert join_public_teams manage_slash_commands manage_others_incoming_webhooks manage_public_channel_members sysconsole_read_environment_elasticsearch sysconsole_write_site_customization delete_others_emojis run_manage_members create_emojis sysconsole_write_authentication_email sysconsole_write_compliance_compliance_export add_saml_private_cert create_bot sysconsole_write_environment_rate_limiting add_saml_public_cert edit_other_users sysconsole_write_integrations_integration_management read_user_access_token create_elasticsearch_post_indexing_job sysconsole_write_user_management_users assign_system_admin_role sysconsole_write_user_management_groups sysconsole_read_authentication_guest_access sysconsole_write_about_edition_and_license sysconsole_read_authentication_ldap sysconsole_read_experimental_feature_flags sysconsole_read_integrations_cors sysconsole_read_user_management_groups join_public_channels sysconsole_read_experimental_features test_ldap sysconsole_write_environment_elasticsearch sysconsole_write_reporting_server_logs sysconsole_read_environment_image_proxy sysconsole_read_site_announcement_banner sysconsole_read_reporting_site_statistics sysconsole_write_authentication_mfa sysconsole_read_authentication_openid purge_bleve_indexes playbook_public_manage_members delete_emojis sysconsole_write_environment_file_storage sysconsole_write_reporting_site_statistics playbook_private_manage_members import_team sysconsole_write_environment_web_server sysconsole_write_authentication_password read_public_channel_groups create_compliance_export_job sysconsole_read_authentication_password list_users_without_team sysconsole_read_authentication_mfa add_ldap_private_cert create_data_retention_job read_license_information sysconsole_write_authentication_signup sysconsole_read_environment_push_notification_server edit_others_posts download_compliance_export_result create_ldap_sync_job sysconsole_write_authentication_ldap sysconsole_write_plugins read_data_retention_job sysconsole_write_compliance_data_retention_policy sysconsole_read_site_public_links manage_bots manage_system sysconsole_write_compliance_custom_terms_of_service playbook_public_manage_roles playbook_public_manage_properties playbook_private_create sysconsole_write_experimental_bleve sysconsole_read_authentication_email promote_guest get_saml_cert_status add_user_to_team sysconsole_write_site_users_and_teams create_custom_group manage_private_channel_members read_jobs sysconsole_write_experimental_features read_other_users_teams sysconsole_write_reporting_team_statistics sysconsole_read_environment_file_storage create_post_bleve_indexes_job sysconsole_read_site_file_sharing_and_downloads playbook_private_make_public playbook_public_view create_user_access_token create_public_channel read_channel sysconsole_read_user_management_channels sysconsole_read_user_management_permissions read_public_channel sysconsole_read_compliance_custom_terms_of_service sysconsole_write_site_emoji sysconsole_read_integrations_gif sysconsole_read_site_customization sysconsole_write_integrations_cors invite_user create_direct_channel sysconsole_write_user_management_teams run_create manage_custom_group_members read_ldap_sync_job sysconsole_read_site_notifications playbook_private_manage_properties sysconsole_read_integrations_bot_accounts convert_public_channel_to_private invalidate_email_invite reload_config get_saml_metadata_from_idp manage_secure_connections delete_private_channel sysconsole_read_about_edition_and_license convert_private_channel_to_public sysconsole_read_environment_developer recycle_database_connections remove_saml_private_cert manage_oauth sysconsole_write_environment_database sysconsole_write_site_notifications sysconsole_write_authentication_guest_access sysconsole_write_compliance_compliance_monitoring sysconsole_write_environment_image_proxy create_post_public manage_jobs remove_user_from_team delete_others_posts create_post_ephemeral playbook_private_view create_elasticsearch_post_aggregation_job remove_reaction add_reaction sysconsole_write_environment_high_availability sysconsole_write_authentication_openid sysconsole_write_user_management_permissions add_saml_idp_cert sysconsole_read_site_posts view_members sysconsole_write_environment_smtp sysconsole_read_authentication_saml create_post use_channel_mentions create_team playbook_private_manage_roles get_public_link sysconsole_write_billing manage_system_wide_oauth sysconsole_read_environment_database sysconsole_write_environment_session_lengths run_manage_properties sysconsole_write_authentication_saml sysconsole_read_environment_web_server sysconsole_read_environment_rate_limiting manage_public_channel_properties create_group_channel sysconsole_read_compliance_data_retention_policy sysconsole_read_environment_high_availability manage_others_slash_commands sysconsole_read_compliance_compliance_export delete_custom_group sysconsole_read_user_management_system_roles purge_elasticsearch_indexes view_team sysconsole_read_environment_performance_monitoring manage_channel_roles playbook_public_make_private remove_saml_public_cert demote_to_guest sysconsole_write_environment_performance_monitoring read_audits sysconsole_write_site_announcement_banner upload_file revoke_user_access_token read_others_bots test_email read_elasticsearch_post_aggregation_job sysconsole_read_compliance_compliance_monitoring join_private_teams delete_post sysconsole_write_site_public_links manage_team edit_custom_group sysconsole_write_experimental_feature_flags sysconsole_write_user_management_system_roles remove_others_reactions manage_license_information sysconsole_read_authentication_signup read_compliance_export_job sysconsole_write_environment_developer remove_saml_idp_cert manage_incoming_webhooks sysconsole_read_site_emoji assign_bot sysconsole_write_integrations_gif sysconsole_read_user_management_users delete_public_channel manage_outgoing_webhooks sysconsole_write_site_posts remove_ldap_private_cert sysconsole_write_site_file_sharing_and_downloads sysconsole_read_integrations_integration_management sysconsole_read_environment_logging test_site_url sysconsole_read_environment_session_lengths read_elasticsearch_post_indexing_job sysconsole_read_billing sysconsole_read_site_notices sysconsole_read_reporting_server_logs sysconsole_write_integrations_bot_accounts sysconsole_write_site_notices create_private_channel read_private_channel_groups run_view read_bots manage_roles test_s3 sysconsole_write_environment_push_notification_server get_logs invite_guest remove_ldap_public_cert sysconsole_read_environment_smtp',1,1); +INSERT INTO `Roles` VALUES ('kb6r9i58x7dxdb3srfohd66sse','system_admin','authentication.roles.global_admin.name','authentication.roles.global_admin.description',0,1662271986948,0,' list_public_teams edit_brand manage_private_channel_properties sysconsole_read_user_management_teams playbook_public_create manage_others_bots invalidate_caches manage_shared_channels sysconsole_write_environment_logging manage_others_outgoing_webhooks sysconsole_read_reporting_team_statistics sysconsole_read_plugins list_team_channels use_group_mentions sysconsole_read_site_users_and_teams sysconsole_write_site_localization get_analytics sysconsole_read_experimental_bleve manage_team_roles sysconsole_read_site_localization edit_post sysconsole_write_user_management_channels test_elasticsearch list_private_teams add_ldap_public_cert join_public_teams manage_slash_commands manage_others_incoming_webhooks manage_public_channel_members sysconsole_read_environment_elasticsearch sysconsole_write_site_customization delete_others_emojis run_manage_members create_emojis sysconsole_write_authentication_email sysconsole_write_compliance_compliance_export add_saml_private_cert create_bot sysconsole_write_environment_rate_limiting add_saml_public_cert edit_other_users sysconsole_write_integrations_integration_management read_user_access_token create_elasticsearch_post_indexing_job sysconsole_write_user_management_users assign_system_admin_role sysconsole_write_user_management_groups sysconsole_read_authentication_guest_access sysconsole_write_about_edition_and_license sysconsole_read_authentication_ldap sysconsole_read_experimental_feature_flags sysconsole_read_integrations_cors sysconsole_read_user_management_groups join_public_channels sysconsole_read_experimental_features test_ldap sysconsole_write_environment_elasticsearch sysconsole_write_reporting_server_logs sysconsole_read_environment_image_proxy sysconsole_read_site_announcement_banner sysconsole_read_reporting_site_statistics sysconsole_write_authentication_mfa sysconsole_read_authentication_openid purge_bleve_indexes playbook_public_manage_members delete_emojis sysconsole_write_environment_file_storage sysconsole_write_reporting_site_statistics playbook_private_manage_members import_team sysconsole_write_environment_web_server sysconsole_write_authentication_password read_public_channel_groups create_compliance_export_job sysconsole_read_authentication_password list_users_without_team sysconsole_read_authentication_mfa add_ldap_private_cert create_data_retention_job read_license_information sysconsole_write_authentication_signup sysconsole_read_environment_push_notification_server edit_others_posts download_compliance_export_result create_ldap_sync_job sysconsole_write_authentication_ldap sysconsole_write_plugins read_data_retention_job sysconsole_write_compliance_data_retention_policy sysconsole_read_site_public_links manage_bots manage_system sysconsole_write_compliance_custom_terms_of_service playbook_public_manage_roles playbook_public_manage_properties playbook_private_create sysconsole_write_experimental_bleve sysconsole_read_authentication_email promote_guest get_saml_cert_status add_user_to_team sysconsole_write_site_users_and_teams create_custom_group manage_private_channel_members read_jobs sysconsole_write_experimental_features read_other_users_teams sysconsole_write_reporting_team_statistics sysconsole_read_environment_file_storage create_post_bleve_indexes_job sysconsole_read_site_file_sharing_and_downloads playbook_private_make_public playbook_public_view create_user_access_token create_public_channel read_channel sysconsole_read_user_management_channels sysconsole_read_user_management_permissions read_public_channel sysconsole_read_compliance_custom_terms_of_service sysconsole_write_site_emoji sysconsole_read_integrations_gif sysconsole_read_site_customization sysconsole_write_integrations_cors invite_user create_direct_channel sysconsole_write_user_management_teams run_create manage_custom_group_members read_ldap_sync_job sysconsole_read_site_notifications playbook_private_manage_properties sysconsole_read_integrations_bot_accounts convert_public_channel_to_private invalidate_email_invite reload_config get_saml_metadata_from_idp manage_secure_connections delete_private_channel sysconsole_read_about_edition_and_license convert_private_channel_to_public sysconsole_read_environment_developer recycle_database_connections remove_saml_private_cert manage_oauth sysconsole_write_environment_database sysconsole_write_site_notifications sysconsole_write_authentication_guest_access sysconsole_write_compliance_compliance_monitoring sysconsole_write_environment_image_proxy create_post_public manage_jobs remove_user_from_team delete_others_posts create_post_ephemeral playbook_private_view create_elasticsearch_post_aggregation_job remove_reaction add_reaction sysconsole_write_environment_high_availability sysconsole_write_authentication_openid sysconsole_write_user_management_permissions add_saml_idp_cert sysconsole_read_site_posts view_members sysconsole_write_environment_smtp sysconsole_read_authentication_saml create_post use_channel_mentions create_team playbook_private_manage_roles get_public_link sysconsole_write_billing manage_system_wide_oauth sysconsole_read_environment_database sysconsole_write_environment_session_lengths run_manage_properties sysconsole_write_authentication_saml sysconsole_read_environment_web_server sysconsole_read_environment_rate_limiting manage_public_channel_properties create_group_channel sysconsole_read_compliance_data_retention_policy sysconsole_read_environment_high_availability manage_others_slash_commands sysconsole_read_compliance_compliance_export delete_custom_group sysconsole_read_user_management_system_roles purge_elasticsearch_indexes view_team sysconsole_read_environment_performance_monitoring manage_channel_roles playbook_public_make_private remove_saml_public_cert demote_to_guest sysconsole_write_environment_performance_monitoring read_audits sysconsole_write_site_announcement_banner upload_file revoke_user_access_token read_others_bots test_email read_elasticsearch_post_aggregation_job sysconsole_read_compliance_compliance_monitoring join_private_teams delete_post sysconsole_write_site_public_links manage_team edit_custom_group sysconsole_write_experimental_feature_flags sysconsole_write_user_management_system_roles remove_others_reactions manage_license_information sysconsole_read_authentication_signup read_compliance_export_job sysconsole_write_environment_developer remove_saml_idp_cert manage_incoming_webhooks sysconsole_read_site_emoji assign_bot sysconsole_write_integrations_gif sysconsole_read_user_management_users delete_public_channel manage_outgoing_webhooks sysconsole_write_site_posts remove_ldap_private_cert sysconsole_write_site_file_sharing_and_downloads sysconsole_read_integrations_integration_management sysconsole_read_environment_logging test_site_url sysconsole_read_environment_session_lengths read_elasticsearch_post_indexing_job sysconsole_read_billing sysconsole_read_site_notices sysconsole_read_reporting_server_logs sysconsole_write_integrations_bot_accounts sysconsole_write_site_notices create_private_channel read_private_channel_groups run_view read_bots manage_roles test_s3 sysconsole_write_environment_push_notification_server get_logs invite_guest remove_ldap_public_cert sysconsole_read_environment_smtp',1,1); INSERT INTO `Roles` VALUES ('km7kijhdtjbajquwu36uqneyoc','system_post_all','authentication.roles.system_post_all.name','authentication.roles.system_post_all.description',0,1662271986953,0,' create_post use_channel_mentions',0,1); INSERT INTO `Roles` VALUES ('no7s4436sjbzzqjpupg85mszty','custom_group_user','authentication.roles.custom_group_user.name','authentication.roles.custom_group_user.description',1662271985801,1662271986956,0,'',0,0); INSERT INTO `Roles` VALUES ('qo7e17c1m3rezyjqx5iq9dpmxe','system_manager','authentication.roles.system_manager.name','authentication.roles.system_manager.description',0,1662271986960,0,' sysconsole_write_environment_image_proxy sysconsole_read_environment_developer read_ldap_sync_job sysconsole_read_reporting_team_statistics recycle_database_connections get_logs read_private_channel_groups test_elasticsearch sysconsole_read_environment_logging purge_elasticsearch_indexes sysconsole_write_site_posts sysconsole_read_environment_database sysconsole_read_environment_performance_monitoring manage_team sysconsole_read_authentication_password sysconsole_write_site_users_and_teams sysconsole_read_user_management_channels sysconsole_write_environment_rate_limiting sysconsole_write_site_notifications read_license_information edit_brand sysconsole_read_plugins sysconsole_read_environment_high_availability sysconsole_read_environment_file_storage sysconsole_read_environment_elasticsearch sysconsole_write_environment_web_server sysconsole_write_environment_smtp sysconsole_write_environment_performance_monitoring sysconsole_write_environment_session_lengths sysconsole_write_user_management_groups convert_private_channel_to_public manage_private_channel_properties sysconsole_read_site_posts list_private_teams sysconsole_read_authentication_ldap sysconsole_read_authentication_guest_access sysconsole_read_site_emoji sysconsole_write_integrations_integration_management convert_public_channel_to_private manage_private_channel_members read_elasticsearch_post_aggregation_job manage_team_roles sysconsole_write_site_file_sharing_and_downloads read_channel read_public_channel sysconsole_read_authentication_openid add_user_to_team sysconsole_write_environment_developer sysconsole_write_site_localization sysconsole_read_about_edition_and_license test_s3 reload_config sysconsole_write_environment_elasticsearch test_site_url sysconsole_write_site_announcement_banner get_analytics sysconsole_read_environment_push_notification_server sysconsole_read_authentication_signup test_email sysconsole_write_integrations_bot_accounts sysconsole_write_integrations_cors view_team sysconsole_write_integrations_gif sysconsole_read_site_notices sysconsole_read_environment_image_proxy sysconsole_read_integrations_cors sysconsole_write_environment_push_notification_server join_public_teams test_ldap create_elasticsearch_post_aggregation_job sysconsole_read_environment_session_lengths sysconsole_write_environment_file_storage manage_public_channel_members sysconsole_write_site_customization sysconsole_read_site_announcement_banner sysconsole_read_environment_smtp sysconsole_write_user_management_teams delete_public_channel sysconsole_write_environment_logging read_public_channel_groups sysconsole_read_site_users_and_teams sysconsole_read_reporting_site_statistics sysconsole_read_site_localization sysconsole_read_site_customization sysconsole_read_environment_rate_limiting sysconsole_read_environment_web_server sysconsole_write_user_management_permissions sysconsole_read_site_file_sharing_and_downloads sysconsole_write_site_public_links sysconsole_read_site_public_links sysconsole_read_authentication_email read_elasticsearch_post_indexing_job sysconsole_read_authentication_saml remove_user_from_team delete_private_channel sysconsole_write_user_management_channels sysconsole_read_reporting_server_logs sysconsole_read_integrations_bot_accounts sysconsole_read_user_management_teams list_public_teams create_elasticsearch_post_indexing_job sysconsole_write_site_emoji invalidate_caches sysconsole_read_integrations_integration_management sysconsole_write_environment_high_availability sysconsole_read_user_management_permissions join_private_teams manage_channel_roles sysconsole_write_site_notices manage_public_channel_properties sysconsole_write_environment_database sysconsole_read_site_notifications sysconsole_read_user_management_groups sysconsole_read_integrations_gif sysconsole_read_authentication_mfa',0,1); INSERT INTO `Roles` VALUES ('rkr97ikkh7fixy86qsoo5rqm4c','system_user_access_token','authentication.roles.system_user_access_token.name','authentication.roles.system_user_access_token.description',0,1662271986965,0,' create_user_access_token read_user_access_token revoke_user_access_token',0,1); INSERT INTO `Roles` VALUES ('rxzdk5irm7rcffcfej9e33kqeo','team_user','authentication.roles.team_user.name','authentication.roles.team_user.description',0,1662271986968,0,' invite_user view_team read_public_channel playbook_public_create add_user_to_team playbook_private_create create_private_channel list_team_channels create_public_channel join_public_channels',1,1); -INSERT INTO `Roles` VALUES ('x768jnyzw3rkfx7xb66ehcac6o','channel_user','authentication.roles.channel_user.name','authentication.roles.channel_user.description',0,1662271986972,0,' manage_public_channel_properties create_post manage_private_channel_properties delete_public_channel manage_private_channel_members get_public_link delete_post delete_private_channel upload_file edit_post remove_reaction use_channel_mentions add_reaction read_channel use_slash_commands manage_public_channel_members',1,1); -INSERT INTO `Roles` VALUES ('ynn8aynsn7n1trtbuq6p4cyzhe','channel_guest','authentication.roles.channel_guest.name','authentication.roles.channel_guest.description',1605167829001,1662271986975,0,' read_channel add_reaction remove_reaction upload_file edit_post create_post use_channel_mentions use_slash_commands',1,1); +INSERT INTO `Roles` VALUES ('x768jnyzw3rkfx7xb66ehcac6o','channel_user','authentication.roles.channel_user.name','authentication.roles.channel_user.description',0,1662271986972,0,' manage_public_channel_properties create_post manage_private_channel_properties delete_public_channel manage_private_channel_members get_public_link delete_post delete_private_channel upload_file edit_post remove_reaction use_channel_mentions add_reaction read_channel manage_public_channel_members',1,1); +INSERT INTO `Roles` VALUES ('ynn8aynsn7n1trtbuq6p4cyzhe','channel_guest','authentication.roles.channel_guest.name','authentication.roles.channel_guest.description',1605167829001,1662271986975,0,' read_channel add_reaction remove_reaction upload_file edit_post create_post use_channel_mentions',1,1); INSERT INTO `Roles` VALUES ('yqyby79r9jggxg7a9dnenuawmo','run_member','authentication.roles.run_member.name','authentication.roles.run_member.description',1662271985813,1662271986979,0,' run_view',1,1); INSERT INTO `Roles` VALUES ('zzehkfnp67bg5g1owh6eptdcxc','system_user','authentication.roles.global_user.name','authentication.roles.global_user.description',0,1662271986983,0,' create_emojis join_public_teams list_public_teams edit_custom_group delete_emojis create_team create_group_channel manage_custom_group_members view_members delete_custom_group create_custom_group create_direct_channel',1,1); /*!40000 ALTER TABLE `Roles` ENABLE KEYS */; diff --git a/server/channels/testlib/testdata/postgres_migration_warmup.sql b/server/channels/testlib/testdata/postgres_migration_warmup.sql index 4dc1481c3a..b58b54e62e 100644 --- a/server/channels/testlib/testdata/postgres_migration_warmup.sql +++ b/server/channels/testlib/testdata/postgres_migration_warmup.sql @@ -17,7 +17,7 @@ SET client_encoding = 'UTF8'; INSERT INTO public.roles VALUES ('gkegg9mqi3rgbm9u444mnxkmbc', 'team_post_all_public', 'authentication.roles.team_post_all_public.name', 'authentication.roles.team_post_all_public.description', 0, 1662230812026, 0, ' create_post_public use_channel_mentions', false, true); INSERT INTO public.roles VALUES ('7ta1wfbacjy3zxid54n3cqjzqw', 'system_post_all_public', 'authentication.roles.system_post_all_public.name', 'authentication.roles.system_post_all_public.description', 0, 1662230812027, 0, ' create_post_public use_channel_mentions', false, true); INSERT INTO public.roles VALUES ('xf95ytghtjfsfd543dum68uzua', 'system_user_access_token', 'authentication.roles.system_user_access_token.name', 'authentication.roles.system_user_access_token.description', 0, 1662230812027, 0, ' create_user_access_token read_user_access_token revoke_user_access_token', false, true); -INSERT INTO public.roles VALUES ('nh5i9ik1u78hdcny9usdoixkuo', 'channel_user', 'authentication.roles.channel_user.name', 'authentication.roles.channel_user.description', 0, 1662230812029, 0, ' delete_post delete_public_channel use_channel_mentions manage_private_channel_properties manage_public_channel_properties delete_private_channel upload_file read_channel use_slash_commands get_public_link remove_reaction create_post add_reaction manage_private_channel_members edit_post manage_public_channel_members', true, true); +INSERT INTO public.roles VALUES ('nh5i9ik1u78hdcny9usdoixkuo', 'channel_user', 'authentication.roles.channel_user.name', 'authentication.roles.channel_user.description', 0, 1662230812029, 0, ' delete_post delete_public_channel use_channel_mentions manage_private_channel_properties manage_public_channel_properties delete_private_channel upload_file read_channel get_public_link remove_reaction create_post add_reaction manage_private_channel_members edit_post manage_public_channel_members', true, true); INSERT INTO public.roles VALUES ('peooyqpsq7g5bfnfo45zb1jiro', 'system_guest', 'authentication.roles.global_guest.name', 'authentication.roles.global_guest.description', 1605163387739, 1662230812021, 0, ' create_group_channel create_direct_channel', true, true); INSERT INTO public.roles VALUES ('96whs8mg73dszp7cz4u7sdbd7c', 'team_guest', 'authentication.roles.team_guest.name', 'authentication.roles.team_guest.description', 1605163387741, 1662230812022, 0, ' view_team', true, true); INSERT INTO public.roles VALUES ('rfc1w7z71pnzurkhpb1jgrbmdh', 'team_user', 'authentication.roles.team_user.name', 'authentication.roles.team_user.description', 1605163387747, 1662230812023, 0, ' playbook_public_create view_team invite_user playbook_private_create list_team_channels join_public_channels create_private_channel add_user_to_team read_public_channel create_public_channel', true, true); @@ -26,14 +26,14 @@ INSERT INTO public.roles VALUES ('wxat9mo53tg79xdzn55kdq148w', 'channel_admin', INSERT INTO public.roles VALUES ('13kpq8iaqffmdf9qkrfqmpby9h', 'team_admin', 'authentication.roles.team_admin.name', 'authentication.roles.team_admin.description', 0, 1662230812024, 0, ' manage_incoming_webhooks manage_others_incoming_webhooks import_team manage_others_outgoing_webhooks manage_team_roles remove_user_from_team manage_team manage_outgoing_webhooks manage_slash_commands convert_public_channel_to_private playbook_public_manage_roles manage_others_slash_commands delete_others_posts delete_post manage_channel_roles convert_private_channel_to_public playbook_private_manage_roles', true, true); INSERT INTO public.roles VALUES ('tj3atgnwjfrt7emz8pgqmh5z4c', 'team_post_all', 'authentication.roles.team_post_all.name', 'authentication.roles.team_post_all.description', 0, 1662230812030, 0, ' create_post use_channel_mentions', false, true); INSERT INTO public.roles VALUES ('d54xjt4sat8h7dqwu6i35jocuy', 'system_user', 'authentication.roles.global_user.name', 'authentication.roles.global_user.description', 0, 1662230812030, 0, ' create_emojis edit_custom_group manage_custom_group_members view_members create_custom_group create_team create_direct_channel delete_custom_group list_public_teams delete_emojis create_group_channel join_public_teams', true, true); -INSERT INTO public.roles VALUES ('mrejpofuoffiiynqcsi98es9ya', 'channel_guest', 'authentication.roles.channel_guest.name', 'authentication.roles.channel_guest.description', 0, 1662230812026, 0, ' upload_file edit_post create_post use_channel_mentions use_slash_commands read_channel add_reaction remove_reaction', true, true); +INSERT INTO public.roles VALUES ('mrejpofuoffiiynqcsi98es9ya', 'channel_guest', 'authentication.roles.channel_guest.name', 'authentication.roles.channel_guest.description', 0, 1662230812026, 0, ' upload_file edit_post create_post use_channel_mentions read_channel add_reaction remove_reaction', true, true); INSERT INTO public.roles VALUES ('4fk7nq4jgi8t7n1re79eb7i96c', 'custom_group_user', 'authentication.roles.custom_group_user.name', 'authentication.roles.custom_group_user.description', 1662230811506, 1662230812031, 0, '', false, false); INSERT INTO public.roles VALUES ('qmagi7t1ifbjuy5r1pp53eoryo', 'playbook_admin', 'authentication.roles.playbook_admin.name', 'authentication.roles.playbook_admin.description', 1662230811507, 1662230812032, 0, ' playbook_public_manage_roles playbook_public_manage_properties playbook_private_manage_members playbook_private_manage_roles playbook_private_manage_properties playbook_public_make_private playbook_public_manage_members', true, true); INSERT INTO public.roles VALUES ('ozgjpnirx7fdjp3i1i8jrg1kwc', 'system_custom_group_admin', 'authentication.roles.system_custom_group_admin.name', 'authentication.roles.system_custom_group_admin.description', 1662230811510, 1662230812032, 0, ' create_custom_group edit_custom_group delete_custom_group manage_custom_group_members', false, true); INSERT INTO public.roles VALUES ('pfnwpqmbmjrexgqbxdu61wfd3w', 'playbook_member', 'authentication.roles.playbook_member.name', 'authentication.roles.playbook_member.description', 1662230811533, 1662230812034, 0, ' playbook_public_view playbook_public_manage_members playbook_public_manage_properties playbook_private_view playbook_private_manage_members playbook_private_manage_properties run_create', true, true); INSERT INTO public.roles VALUES ('dj5zm9bxbidi9ritmana9t1sxh', 'run_admin', 'authentication.roles.run_admin.name', 'authentication.roles.run_admin.description', 1662230811534, 1662230812035, 0, ' run_manage_members run_manage_properties', true, true); INSERT INTO public.roles VALUES ('abrocgnx8pni7esbrmb4pjxhoe', 'run_member', 'authentication.roles.run_member.name', 'authentication.roles.run_member.description', 1662230811534, 1662230812036, 0, ' run_view', true, true); -INSERT INTO public.roles VALUES ('ha8u9qxwx3dm8mnbq8sfi7ugdc', 'system_admin', 'authentication.roles.global_admin.name', 'authentication.roles.global_admin.description', 0, 1662230812038, 0, ' read_public_channel_groups manage_public_channel_properties create_post_ephemeral sysconsole_write_site_localization sysconsole_write_billing sysconsole_read_site_file_sharing_and_downloads playbook_public_manage_roles sysconsole_read_integrations_gif delete_emojis sysconsole_write_experimental_features sysconsole_write_site_posts add_ldap_private_cert use_group_mentions sysconsole_read_authentication_openid add_user_to_team sysconsole_read_user_management_channels sysconsole_write_environment_high_availability sysconsole_write_site_announcement_banner sysconsole_read_site_notices sysconsole_write_user_management_teams convert_public_channel_to_private sysconsole_read_reporting_server_logs manage_system_wide_oauth revoke_user_access_token invalidate_caches sysconsole_write_environment_push_notification_server sysconsole_read_site_emoji remove_others_reactions sysconsole_write_reporting_server_logs sysconsole_write_user_management_permissions sysconsole_read_site_posts assign_bot sysconsole_write_authentication_password add_saml_private_cert manage_jobs sysconsole_write_environment_developer use_channel_mentions add_ldap_public_cert purge_bleve_indexes playbook_public_manage_properties sysconsole_read_authentication_mfa read_public_channel sysconsole_read_environment_image_proxy import_team sysconsole_read_reporting_team_statistics sysconsole_write_user_management_channels list_private_teams sysconsole_read_user_management_groups join_private_teams sysconsole_read_compliance_data_retention_policy list_public_teams sysconsole_read_site_localization sysconsole_write_authentication_guest_access sysconsole_read_compliance_compliance_monitoring sysconsole_read_environment_developer edit_others_posts sysconsole_read_experimental_bleve read_audits sysconsole_write_authentication_email sysconsole_write_experimental_bleve sysconsole_read_environment_push_notification_server read_elasticsearch_post_aggregation_job remove_ldap_private_cert manage_team manage_bots sysconsole_write_environment_session_lengths sysconsole_write_user_management_users sysconsole_write_environment_file_storage invite_user join_public_channels create_direct_channel sysconsole_read_site_users_and_teams manage_slash_commands playbook_public_view sysconsole_write_compliance_custom_terms_of_service purge_elasticsearch_indexes sysconsole_read_authentication_email test_ldap sysconsole_write_plugins manage_outgoing_webhooks create_bot create_compliance_export_job get_logs create_private_channel get_saml_metadata_from_idp read_elasticsearch_post_indexing_job get_analytics manage_incoming_webhooks sysconsole_read_authentication_saml invite_guest manage_shared_channels create_public_channel sysconsole_write_site_file_sharing_and_downloads sysconsole_read_environment_rate_limiting manage_public_channel_members sysconsole_read_environment_file_storage sysconsole_read_environment_performance_monitoring sysconsole_write_environment_performance_monitoring sysconsole_write_integrations_gif create_post_public playbook_public_manage_members upload_file sysconsole_write_reporting_team_statistics manage_team_roles sysconsole_read_site_notifications delete_public_channel sysconsole_write_compliance_compliance_monitoring create_ldap_sync_job create_data_retention_job sysconsole_write_environment_smtp manage_custom_group_members manage_others_slash_commands read_ldap_sync_job sysconsole_read_integrations_bot_accounts read_others_bots read_bots sysconsole_read_authentication_ldap demote_to_guest remove_saml_public_cert create_post_bleve_indexes_job sysconsole_read_user_management_teams sysconsole_write_about_edition_and_license remove_ldap_public_cert read_channel sysconsole_read_environment_database sysconsole_write_authentication_signup test_s3 sysconsole_read_environment_high_availability manage_roles sysconsole_write_site_notifications run_view sysconsole_write_authentication_saml invalidate_email_invite playbook_private_view read_compliance_export_job list_users_without_team sysconsole_read_compliance_compliance_export sysconsole_write_integrations_cors promote_guest manage_oauth read_data_retention_job sysconsole_write_experimental_feature_flags sysconsole_read_environment_session_lengths manage_license_information sysconsole_write_authentication_ldap assign_system_admin_role create_post read_private_channel_groups add_saml_idp_cert playbook_private_create manage_private_channel_properties sysconsole_read_compliance_custom_terms_of_service sysconsole_read_integrations_integration_management sysconsole_read_billing sysconsole_read_authentication_password delete_private_channel sysconsole_write_site_notices create_elasticsearch_post_indexing_job test_email sysconsole_write_environment_database recycle_database_connections edit_brand sysconsole_write_authentication_mfa remove_user_from_team sysconsole_write_user_management_system_roles add_reaction remove_saml_private_cert sysconsole_read_environment_web_server run_create sysconsole_read_authentication_guest_access sysconsole_read_about_edition_and_license run_manage_properties create_user_access_token manage_others_incoming_webhooks create_elasticsearch_post_aggregation_job sysconsole_write_user_management_groups sysconsole_read_experimental_feature_flags create_team sysconsole_read_environment_elasticsearch join_public_teams sysconsole_read_user_management_users sysconsole_read_integrations_cors sysconsole_read_environment_smtp manage_secure_connections manage_channel_roles edit_other_users delete_others_emojis sysconsole_write_site_users_and_teams add_saml_public_cert sysconsole_read_site_announcement_banner create_custom_group download_compliance_export_result create_group_channel get_saml_cert_status sysconsole_read_site_public_links manage_system create_emojis sysconsole_read_authentication_signup sysconsole_write_environment_image_proxy list_team_channels remove_saml_idp_cert sysconsole_read_plugins sysconsole_read_site_customization sysconsole_write_site_customization use_slash_commands playbook_private_manage_roles delete_custom_group delete_others_posts sysconsole_write_compliance_data_retention_policy sysconsole_write_environment_logging test_elasticsearch playbook_public_make_private sysconsole_write_site_public_links edit_post playbook_private_make_public sysconsole_write_environment_elasticsearch test_site_url sysconsole_write_compliance_compliance_export playbook_private_manage_members delete_post reload_config edit_custom_group sysconsole_read_user_management_system_roles sysconsole_write_reporting_site_statistics sysconsole_write_site_emoji read_user_access_token sysconsole_write_environment_rate_limiting view_members sysconsole_write_integrations_bot_accounts manage_others_bots manage_others_outgoing_webhooks sysconsole_read_environment_logging sysconsole_read_experimental_features sysconsole_write_authentication_openid manage_private_channel_members read_jobs sysconsole_write_environment_web_server read_license_information sysconsole_read_user_management_permissions view_team convert_private_channel_to_public sysconsole_read_reporting_site_statistics get_public_link read_other_users_teams sysconsole_write_integrations_integration_management run_manage_members playbook_public_create remove_reaction playbook_private_manage_properties', true, true); +INSERT INTO public.roles VALUES ('ha8u9qxwx3dm8mnbq8sfi7ugdc', 'system_admin', 'authentication.roles.global_admin.name', 'authentication.roles.global_admin.description', 0, 1662230812038, 0, ' read_public_channel_groups manage_public_channel_properties create_post_ephemeral sysconsole_write_site_localization sysconsole_write_billing sysconsole_read_site_file_sharing_and_downloads playbook_public_manage_roles sysconsole_read_integrations_gif delete_emojis sysconsole_write_experimental_features sysconsole_write_site_posts add_ldap_private_cert use_group_mentions sysconsole_read_authentication_openid add_user_to_team sysconsole_read_user_management_channels sysconsole_write_environment_high_availability sysconsole_write_site_announcement_banner sysconsole_read_site_notices sysconsole_write_user_management_teams convert_public_channel_to_private sysconsole_read_reporting_server_logs manage_system_wide_oauth revoke_user_access_token invalidate_caches sysconsole_write_environment_push_notification_server sysconsole_read_site_emoji remove_others_reactions sysconsole_write_reporting_server_logs sysconsole_write_user_management_permissions sysconsole_read_site_posts assign_bot sysconsole_write_authentication_password add_saml_private_cert manage_jobs sysconsole_write_environment_developer use_channel_mentions add_ldap_public_cert purge_bleve_indexes playbook_public_manage_properties sysconsole_read_authentication_mfa read_public_channel sysconsole_read_environment_image_proxy import_team sysconsole_read_reporting_team_statistics sysconsole_write_user_management_channels list_private_teams sysconsole_read_user_management_groups join_private_teams sysconsole_read_compliance_data_retention_policy list_public_teams sysconsole_read_site_localization sysconsole_write_authentication_guest_access sysconsole_read_compliance_compliance_monitoring sysconsole_read_environment_developer edit_others_posts sysconsole_read_experimental_bleve read_audits sysconsole_write_authentication_email sysconsole_write_experimental_bleve sysconsole_read_environment_push_notification_server read_elasticsearch_post_aggregation_job remove_ldap_private_cert manage_team manage_bots sysconsole_write_environment_session_lengths sysconsole_write_user_management_users sysconsole_write_environment_file_storage invite_user join_public_channels create_direct_channel sysconsole_read_site_users_and_teams manage_slash_commands playbook_public_view sysconsole_write_compliance_custom_terms_of_service purge_elasticsearch_indexes sysconsole_read_authentication_email test_ldap sysconsole_write_plugins manage_outgoing_webhooks create_bot create_compliance_export_job get_logs create_private_channel get_saml_metadata_from_idp read_elasticsearch_post_indexing_job get_analytics manage_incoming_webhooks sysconsole_read_authentication_saml invite_guest manage_shared_channels create_public_channel sysconsole_write_site_file_sharing_and_downloads sysconsole_read_environment_rate_limiting manage_public_channel_members sysconsole_read_environment_file_storage sysconsole_read_environment_performance_monitoring sysconsole_write_environment_performance_monitoring sysconsole_write_integrations_gif create_post_public playbook_public_manage_members upload_file sysconsole_write_reporting_team_statistics manage_team_roles sysconsole_read_site_notifications delete_public_channel sysconsole_write_compliance_compliance_monitoring create_ldap_sync_job create_data_retention_job sysconsole_write_environment_smtp manage_custom_group_members manage_others_slash_commands read_ldap_sync_job sysconsole_read_integrations_bot_accounts read_others_bots read_bots sysconsole_read_authentication_ldap demote_to_guest remove_saml_public_cert create_post_bleve_indexes_job sysconsole_read_user_management_teams sysconsole_write_about_edition_and_license remove_ldap_public_cert read_channel sysconsole_read_environment_database sysconsole_write_authentication_signup test_s3 sysconsole_read_environment_high_availability manage_roles sysconsole_write_site_notifications run_view sysconsole_write_authentication_saml invalidate_email_invite playbook_private_view read_compliance_export_job list_users_without_team sysconsole_read_compliance_compliance_export sysconsole_write_integrations_cors promote_guest manage_oauth read_data_retention_job sysconsole_write_experimental_feature_flags sysconsole_read_environment_session_lengths manage_license_information sysconsole_write_authentication_ldap assign_system_admin_role create_post read_private_channel_groups add_saml_idp_cert playbook_private_create manage_private_channel_properties sysconsole_read_compliance_custom_terms_of_service sysconsole_read_integrations_integration_management sysconsole_read_billing sysconsole_read_authentication_password delete_private_channel sysconsole_write_site_notices create_elasticsearch_post_indexing_job test_email sysconsole_write_environment_database recycle_database_connections edit_brand sysconsole_write_authentication_mfa remove_user_from_team sysconsole_write_user_management_system_roles add_reaction remove_saml_private_cert sysconsole_read_environment_web_server run_create sysconsole_read_authentication_guest_access sysconsole_read_about_edition_and_license run_manage_properties create_user_access_token manage_others_incoming_webhooks create_elasticsearch_post_aggregation_job sysconsole_write_user_management_groups sysconsole_read_experimental_feature_flags create_team sysconsole_read_environment_elasticsearch join_public_teams sysconsole_read_user_management_users sysconsole_read_integrations_cors sysconsole_read_environment_smtp manage_secure_connections manage_channel_roles edit_other_users delete_others_emojis sysconsole_write_site_users_and_teams add_saml_public_cert sysconsole_read_site_announcement_banner create_custom_group download_compliance_export_result create_group_channel get_saml_cert_status sysconsole_read_site_public_links manage_system create_emojis sysconsole_read_authentication_signup sysconsole_write_environment_image_proxy list_team_channels remove_saml_idp_cert sysconsole_read_plugins sysconsole_read_site_customization sysconsole_write_site_customization playbook_private_manage_roles delete_custom_group delete_others_posts sysconsole_write_compliance_data_retention_policy sysconsole_write_environment_logging test_elasticsearch playbook_public_make_private sysconsole_write_site_public_links edit_post playbook_private_make_public sysconsole_write_environment_elasticsearch test_site_url sysconsole_write_compliance_compliance_export playbook_private_manage_members delete_post reload_config edit_custom_group sysconsole_read_user_management_system_roles sysconsole_write_reporting_site_statistics sysconsole_write_site_emoji read_user_access_token sysconsole_write_environment_rate_limiting view_members sysconsole_write_integrations_bot_accounts manage_others_bots manage_others_outgoing_webhooks sysconsole_read_environment_logging sysconsole_read_experimental_features sysconsole_write_authentication_openid manage_private_channel_members read_jobs sysconsole_write_environment_web_server read_license_information sysconsole_read_user_management_permissions view_team convert_private_channel_to_public sysconsole_read_reporting_site_statistics get_public_link read_other_users_teams sysconsole_write_integrations_integration_management run_manage_members playbook_public_create remove_reaction playbook_private_manage_properties', true, true); INSERT INTO public.roles VALUES ('hm1bxei8b3d68e4j95tqnndppw', 'system_manager', 'authentication.roles.system_manager.name', 'authentication.roles.system_manager.description', 0, 1662230812025, 0, ' manage_private_channel_members join_public_teams sysconsole_write_site_announcement_banner sysconsole_write_site_emoji manage_public_channel_members purge_elasticsearch_indexes sysconsole_read_authentication_openid sysconsole_read_about_edition_and_license edit_brand sysconsole_read_reporting_team_statistics sysconsole_read_site_file_sharing_and_downloads sysconsole_read_user_management_teams read_private_channel_groups delete_public_channel sysconsole_read_site_customization sysconsole_write_site_notices sysconsole_read_authentication_email sysconsole_write_environment_file_storage sysconsole_read_user_management_permissions sysconsole_read_reporting_site_statistics test_s3 sysconsole_write_user_management_permissions sysconsole_read_environment_rate_limiting read_license_information sysconsole_read_environment_file_storage sysconsole_write_environment_elasticsearch invalidate_caches sysconsole_read_integrations_cors sysconsole_write_user_management_teams add_user_to_team sysconsole_read_environment_performance_monitoring get_logs sysconsole_write_environment_high_availability sysconsole_read_authentication_signup manage_public_channel_properties sysconsole_write_integrations_integration_management read_elasticsearch_post_indexing_job sysconsole_read_user_management_groups view_team sysconsole_write_environment_rate_limiting sysconsole_read_authentication_guest_access sysconsole_read_environment_elasticsearch manage_team reload_config manage_team_roles test_ldap sysconsole_read_site_public_links sysconsole_read_authentication_saml sysconsole_write_integrations_cors read_public_channel_groups sysconsole_write_site_users_and_teams sysconsole_read_integrations_gif get_analytics create_elasticsearch_post_indexing_job sysconsole_read_authentication_ldap sysconsole_read_site_announcement_banner test_site_url sysconsole_read_site_localization sysconsole_write_environment_push_notification_server sysconsole_write_integrations_bot_accounts sysconsole_write_environment_performance_monitoring sysconsole_write_site_posts sysconsole_read_environment_logging read_elasticsearch_post_aggregation_job sysconsole_write_site_localization sysconsole_write_environment_database sysconsole_read_site_posts sysconsole_write_environment_developer sysconsole_read_site_emoji sysconsole_read_plugins create_elasticsearch_post_aggregation_job manage_channel_roles sysconsole_write_user_management_groups remove_user_from_team read_ldap_sync_job sysconsole_write_site_notifications recycle_database_connections test_email sysconsole_read_site_notifications list_public_teams sysconsole_write_site_customization sysconsole_read_environment_smtp sysconsole_read_authentication_mfa sysconsole_read_integrations_integration_management sysconsole_read_user_management_channels sysconsole_read_reporting_server_logs sysconsole_write_site_public_links test_elasticsearch sysconsole_write_environment_smtp sysconsole_read_environment_push_notification_server sysconsole_write_environment_web_server sysconsole_write_environment_logging sysconsole_read_environment_session_lengths sysconsole_read_site_notices sysconsole_read_environment_high_availability join_private_teams sysconsole_read_authentication_password sysconsole_read_environment_developer delete_private_channel sysconsole_read_integrations_bot_accounts sysconsole_write_environment_session_lengths convert_private_channel_to_public sysconsole_read_environment_database sysconsole_read_environment_image_proxy convert_public_channel_to_private manage_private_channel_properties sysconsole_write_site_file_sharing_and_downloads read_public_channel list_private_teams sysconsole_write_integrations_gif sysconsole_read_environment_web_server sysconsole_read_site_users_and_teams sysconsole_write_user_management_channels read_channel sysconsole_write_environment_image_proxy', false, true); INSERT INTO public.roles VALUES ('f9drbz6cyjdmb8jof6smiqya7h', 'system_user_manager', 'authentication.roles.system_user_manager.name', 'authentication.roles.system_user_manager.description', 0, 1662230812028, 0, ' manage_team_roles sysconsole_read_authentication_saml manage_public_channel_members manage_channel_roles add_user_to_team sysconsole_read_authentication_ldap read_public_channel_groups join_public_teams convert_private_channel_to_public join_private_teams sysconsole_read_user_management_teams list_public_teams sysconsole_read_authentication_email list_private_teams sysconsole_read_authentication_signup read_public_channel sysconsole_read_authentication_mfa sysconsole_read_authentication_guest_access test_ldap manage_private_channel_members sysconsole_read_user_management_permissions read_channel remove_user_from_team delete_public_channel sysconsole_write_user_management_channels delete_private_channel sysconsole_read_authentication_openid sysconsole_write_user_management_teams manage_team sysconsole_read_user_management_groups view_team sysconsole_write_user_management_groups sysconsole_read_user_management_channels manage_public_channel_properties manage_private_channel_properties sysconsole_read_authentication_password read_ldap_sync_job convert_public_channel_to_private read_private_channel_groups', false, true); INSERT INTO public.roles VALUES ('tkioqq1sgtribqgjbzwop1846c', 'system_read_only_admin', 'authentication.roles.system_read_only_admin.name', 'authentication.roles.system_read_only_admin.description', 0, 1662230812033, 0, ' sysconsole_read_integrations_bot_accounts sysconsole_read_authentication_openid sysconsole_read_user_management_users sysconsole_read_authentication_saml read_ldap_sync_job read_other_users_teams sysconsole_read_user_management_permissions download_compliance_export_result sysconsole_read_environment_smtp sysconsole_read_site_localization read_public_channel read_audits sysconsole_read_compliance_custom_terms_of_service read_data_retention_job sysconsole_read_site_emoji sysconsole_read_compliance_data_retention_policy sysconsole_read_environment_developer sysconsole_read_site_file_sharing_and_downloads sysconsole_read_user_management_channels read_elasticsearch_post_indexing_job sysconsole_read_authentication_mfa sysconsole_read_compliance_compliance_monitoring sysconsole_read_authentication_signup sysconsole_read_authentication_ldap sysconsole_read_authentication_password get_analytics sysconsole_read_site_posts sysconsole_read_environment_performance_monitoring sysconsole_read_compliance_compliance_export sysconsole_read_integrations_integration_management test_ldap sysconsole_read_environment_file_storage sysconsole_read_environment_logging sysconsole_read_user_management_groups sysconsole_read_environment_high_availability sysconsole_read_environment_database sysconsole_read_environment_elasticsearch sysconsole_read_environment_push_notification_server sysconsole_read_site_notices read_compliance_export_job read_license_information sysconsole_read_environment_session_lengths read_private_channel_groups sysconsole_read_integrations_gif read_elasticsearch_post_aggregation_job sysconsole_read_experimental_bleve sysconsole_read_reporting_team_statistics sysconsole_read_about_edition_and_license sysconsole_read_environment_image_proxy sysconsole_read_site_customization sysconsole_read_environment_rate_limiting view_team sysconsole_read_site_announcement_banner sysconsole_read_environment_web_server get_logs sysconsole_read_experimental_feature_flags sysconsole_read_integrations_cors sysconsole_read_authentication_guest_access sysconsole_read_plugins read_channel list_public_teams sysconsole_read_user_management_teams sysconsole_read_reporting_server_logs sysconsole_read_experimental_features sysconsole_read_authentication_email sysconsole_read_site_notifications sysconsole_read_site_users_and_teams sysconsole_read_reporting_site_statistics read_public_channel_groups list_private_teams sysconsole_read_site_public_links', false, true); diff --git a/server/channels/utils/api.go b/server/channels/utils/api.go index 4da0c301f8..5b9684b5c9 100644 --- a/server/channels/utils/api.go +++ b/server/channels/utils/api.go @@ -14,8 +14,8 @@ import ( "path" "strings" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/i18n" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/i18n" ) func CheckOrigin(r *http.Request, allowedOrigins string) bool { diff --git a/server/channels/utils/api_test.go b/server/channels/utils/api_test.go index d475ef5067..8624da2fd0 100644 --- a/server/channels/utils/api_test.go +++ b/server/channels/utils/api_test.go @@ -19,7 +19,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestRenderWebError(t *testing.T) { diff --git a/server/channels/utils/archive_test.go b/server/channels/utils/archive_test.go index a3797dfdf1..ae769a0f2b 100644 --- a/server/channels/utils/archive_test.go +++ b/server/channels/utils/archive_test.go @@ -12,7 +12,7 @@ import ( "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/server/channels/utils/fileutils" + "github.com/mattermost/mattermost-server/server/v8/channels/utils/fileutils" ) func TestSanitizePath(t *testing.T) { diff --git a/server/channels/utils/i18n.go b/server/channels/utils/i18n.go index 0fa5398561..5e75445ec6 100644 --- a/server/channels/utils/i18n.go +++ b/server/channels/utils/i18n.go @@ -8,8 +8,8 @@ import ( "os" "path/filepath" - "github.com/mattermost/mattermost-server/v6/server/channels/utils/fileutils" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/i18n" + "github.com/mattermost/mattermost-server/server/v8/channels/utils/fileutils" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/i18n" ) // this functions loads translations from filesystem if they are not diff --git a/server/channels/utils/imgutils/gif_test.go b/server/channels/utils/imgutils/gif_test.go index b1b08d71a8..5a560982a2 100644 --- a/server/channels/utils/imgutils/gif_test.go +++ b/server/channels/utils/imgutils/gif_test.go @@ -12,7 +12,7 @@ import ( "path/filepath" "testing" - "github.com/mattermost/mattermost-server/v6/server/channels/utils/fileutils" + "github.com/mattermost/mattermost-server/server/v8/channels/utils/fileutils" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/server/channels/utils/jsonutils/json_test.go b/server/channels/utils/jsonutils/json_test.go index 0027a725bf..30ed5f7104 100644 --- a/server/channels/utils/jsonutils/json_test.go +++ b/server/channels/utils/jsonutils/json_test.go @@ -11,7 +11,7 @@ import ( "github.com/pkg/errors" "github.com/stretchr/testify/assert" - "github.com/mattermost/mattermost-server/v6/server/channels/utils/jsonutils" + "github.com/mattermost/mattermost-server/server/v8/channels/utils/jsonutils" ) func TestHumanizeJsonError(t *testing.T) { diff --git a/server/channels/utils/license-public-key-test.txt b/server/channels/utils/license-public-key-test.txt index 23c8800db3..720b2eb1f1 100644 --- a/server/channels/utils/license-public-key-test.txt +++ b/server/channels/utils/license-public-key-test.txt @@ -1,9 +1,9 @@ -----BEGIN PUBLIC KEY----- -MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAyZmShlU8Z8HdG0IWSZ8r -tSyzyxrXkJjsFUf0Ke7bm/TLtIggRdqOcUF3XEWqQk5RGD5vuq7Rlg1zZqMEBk8N -EZeRhkxyaZW8pLjxwuBUOnXfJew31+gsTNdKZzRjrvPumKr3EtkleuoxNdoatu4E -HrKmR/4Yi71EqAvkhk7ZjQFuF0osSWJMEEGGCSUYQnTEqUzcZSh1BhVpkIkeu8Kk -1wCtptODixvEujgqVe+SrE3UlZjBmPjC/CL+3cYmufpSNgcEJm2mwsdaXp2OPpfn -a0v85XL6i9ote2P+fLZ3wX9EoioHzgdgB7arOxY50QRJO7OyCqpKFKv6lRWTXuSt -hwIDAQAB +MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwVMaUtQMFtQsRoa2FQd+ +17+acMRMqzPsFTJEix7n+tA8ieCAX0lvNBOjVh8lrt/AUe7B3ZJ0HE6v8xuKj9YA +zUqV8R27UmnIxf5TCXFWrt+fnzX31yLjqK4Fd6JmiDheUatd1hG+gkScMAPuj+Xw +4O+V5sMwaVusytVgmehqcVKYrKpDyhBDUEbDRbKKbP4YAHbmNs3AzlGBbQtvc1fi +0ww7oNKs9cZVcCIeNdwbkXmf8pK5zSXqVsmyPyH3Ue8M6JMNGuPGh1fyHRhFdIiD +lxd7LBKSh7BTjbRtG9DEt1dyMnYQDgRVAdpururuK/otowCowr6X/Etnk2NNeXcZ +4QIDAQAB -----END PUBLIC KEY----- diff --git a/server/channels/utils/license.go b/server/channels/utils/license.go index e1e940cbf2..43f1f8a0ba 100644 --- a/server/channels/utils/license.go +++ b/server/channels/utils/license.go @@ -17,9 +17,9 @@ import ( "path/filepath" "strconv" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/utils/fileutils" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/utils/fileutils" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) var LicenseValidator LicenseValidatorIface @@ -210,7 +210,6 @@ func GetSanitizedClientLicense(l map[string]string) map[string]string { delete(sanitizedLicense, "StartsAt") delete(sanitizedLicense, "ExpiresAt") delete(sanitizedLicense, "SkuName") - delete(sanitizedLicense, "SkuShortName") return sanitizedLicense } diff --git a/server/channels/utils/license_public_key_test_env.go b/server/channels/utils/license_public_key_test_env.go index 8bbed6ebc6..52644ae774 100644 --- a/server/channels/utils/license_public_key_test_env.go +++ b/server/channels/utils/license_public_key_test_env.go @@ -6,8 +6,5 @@ package utils import _ "embed" -// TODO: license-public-key-test.txt currently has the contents of the prod public key. -// Change to the test public key when ready for dev images to use test license key. - //go:embed license-public-key-test.txt var publicKey []byte diff --git a/server/channels/utils/merge_test.go b/server/channels/utils/merge_test.go index 57d92b5cac..bc3ceb3419 100644 --- a/server/channels/utils/merge_test.go +++ b/server/channels/utils/merge_test.go @@ -11,7 +11,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/server/channels/utils" + "github.com/mattermost/mattermost-server/server/v8/channels/utils" ) // Test merging maps alone. This isolates the complexity of merging maps from merging maps recursively in diff --git a/server/channels/utils/mocks/LicenseValidatorIface.go b/server/channels/utils/mocks/LicenseValidatorIface.go index ae7196b201..9abb3e9302 100644 --- a/server/channels/utils/mocks/LicenseValidatorIface.go +++ b/server/channels/utils/mocks/LicenseValidatorIface.go @@ -5,7 +5,7 @@ package mocks import ( - model "github.com/mattermost/mattermost-server/v6/model" + model "github.com/mattermost/mattermost-server/server/v8/model" mock "github.com/stretchr/testify/mock" ) diff --git a/server/channels/utils/subpath.go b/server/channels/utils/subpath.go index cfa47d4467..e254a05991 100644 --- a/server/channels/utils/subpath.go +++ b/server/channels/utils/subpath.go @@ -16,9 +16,9 @@ import ( "github.com/pkg/errors" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/utils/fileutils" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/utils/fileutils" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) // getSubpathScript renders the inline script that defines window.publicPath to change how webpack loads assets. diff --git a/server/channels/utils/subpath_test.go b/server/channels/utils/subpath_test.go index 6af6af1006..28cc23ea0c 100644 --- a/server/channels/utils/subpath_test.go +++ b/server/channels/utils/subpath_test.go @@ -12,8 +12,8 @@ import ( "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/utils" + "github.com/mattermost/mattermost-server/server/v8/channels/utils" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestUpdateAssetsSubpathFromConfig(t *testing.T) { diff --git a/server/channels/utils/testutils/static_config_service.go b/server/channels/utils/testutils/static_config_service.go index 6a4d4d2034..c6ea8b7bba 100644 --- a/server/channels/utils/testutils/static_config_service.go +++ b/server/channels/utils/testutils/static_config_service.go @@ -6,7 +6,7 @@ package testutils import ( "crypto/ecdsa" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) type StaticConfigService struct { diff --git a/server/channels/utils/testutils/testutils.go b/server/channels/utils/testutils/testutils.go index cb31ac0f56..9d766e23a1 100644 --- a/server/channels/utils/testutils/testutils.go +++ b/server/channels/utils/testutils/testutils.go @@ -14,9 +14,9 @@ import ( "strconv" "time" - "github.com/mattermost/mattermost-server/v6/server/channels/utils" + "github.com/mattermost/mattermost-server/server/v8/channels/utils" - "github.com/mattermost/mattermost-server/v6/server/channels/utils/fileutils" + "github.com/mattermost/mattermost-server/server/v8/channels/utils/fileutils" ) func ReadTestFile(name string) ([]byte, error) { diff --git a/server/channels/utils/utils.go b/server/channels/utils/utils.go index cf53e19f55..cc98e5dadb 100644 --- a/server/channels/utils/utils.go +++ b/server/channels/utils/utils.go @@ -13,7 +13,7 @@ import ( "github.com/pkg/errors" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) func StringInSlice(a string, slice []string) bool { @@ -107,16 +107,15 @@ func GetIPAddress(r *http.Request, trustedProxyIPHeader []string) string { } } - if address != "" { + if address != "" && net.ParseIP(address) != nil { return address } + } - if address == "" { - address, _, _ = net.SplitHostPort(r.RemoteAddr) - } + host, _, _ := net.SplitHostPort(r.RemoteAddr) - return address + return host } func GetHostnameFromSiteURL(siteURL string) string { diff --git a/server/channels/utils/utils_test.go b/server/channels/utils/utils_test.go index 6f275dd23a..0c9784f8d6 100644 --- a/server/channels/utils/utils_test.go +++ b/server/channels/utils/utils_test.go @@ -50,119 +50,150 @@ func TestStringSliceDiff(t *testing.T) { } func TestGetIPAddress(t *testing.T) { - // Test with a single IP in the X-Forwarded-For - httpRequest1 := http.Request{ - Header: http.Header{ - "X-Forwarded-For": []string{"10.0.0.1"}, - "X-Real-Ip": []string{"10.1.0.1"}, - }, - RemoteAddr: "10.2.0.1:12345", - } + t.Run("Single IP in the X-Forwarded-For", func(t *testing.T) { + httpRequest1 := http.Request{ + Header: http.Header{ + "X-Forwarded-For": []string{"10.0.0.1"}, + "X-Real-Ip": []string{"10.1.0.1"}, + }, + RemoteAddr: "10.2.0.1:12345", + } - assert.Equal(t, "10.0.0.1", GetIPAddress(&httpRequest1, []string{"X-Forwarded-For"})) + assert.Equal(t, "10.0.0.1", GetIPAddress(&httpRequest1, []string{"X-Forwarded-For"})) + }) - // Test with multiple IPs in the X-Forwarded-For - httpRequest2 := http.Request{ - Header: http.Header{ - "X-Forwarded-For": []string{"10.0.0.1, 10.0.0.2, 10.0.0.3"}, - "X-Real-Ip": []string{"10.1.0.1"}, - }, - RemoteAddr: "10.2.0.1:12345", - } + t.Run("Multiple IPs in the X-Forwarded-For", func(t *testing.T) { + httpRequest2 := http.Request{ + Header: http.Header{ + "X-Forwarded-For": []string{"10.0.0.1, 10.0.0.2, 10.0.0.3"}, + "X-Real-Ip": []string{"10.1.0.1"}, + }, + RemoteAddr: "10.2.0.1:12345", + } - assert.Equal(t, "10.0.0.1", GetIPAddress(&httpRequest2, []string{"X-Forwarded-For"})) + assert.Equal(t, "10.0.0.1", GetIPAddress(&httpRequest2, []string{"X-Forwarded-For"})) + }) - // Test with an empty X-Forwarded-For - httpRequest3 := http.Request{ - Header: http.Header{ - "X-Forwarded-For": []string{""}, - "X-Real-Ip": []string{"10.1.0.1"}, - }, - RemoteAddr: "10.2.0.1:12345", - } + t.Run("Empty X-Forwarded-For", func(t *testing.T) { + httpRequest3 := http.Request{ + Header: http.Header{ + "X-Forwarded-For": []string{""}, + "X-Real-Ip": []string{"10.1.0.1"}, + }, + RemoteAddr: "10.2.0.1:12345", + } - assert.Equal(t, "10.1.0.1", GetIPAddress(&httpRequest3, []string{"X-Forwarded-For", "X-Real-Ip"})) + assert.Equal(t, "10.1.0.1", GetIPAddress(&httpRequest3, []string{"X-Forwarded-For", "X-Real-Ip"})) + }) - // Test without an X-Forwarded-For - httpRequest4 := http.Request{ - Header: http.Header{ - "X-Real-Ip": []string{"10.1.0.1"}, - }, - RemoteAddr: "10.2.0.1:12345", - } + t.Run("Without an X-Forwarded-For", func(t *testing.T) { + httpRequest4 := http.Request{ + Header: http.Header{ + "X-Real-Ip": []string{"10.1.0.1"}, + }, + RemoteAddr: "10.2.0.1:12345", + } - assert.Equal(t, "10.1.0.1", GetIPAddress(&httpRequest4, []string{"X-Forwarded-For", "X-Real-Ip"})) + assert.Equal(t, "10.1.0.1", GetIPAddress(&httpRequest4, []string{"X-Forwarded-For", "X-Real-Ip"})) + }) - // Test without any headers - httpRequest5 := http.Request{ - RemoteAddr: "10.2.0.1:12345", - } + t.Run("Without any headers", func(t *testing.T) { + httpRequest5 := http.Request{ + RemoteAddr: "10.2.0.1:12345", + } - assert.Equal(t, "10.2.0.1", GetIPAddress(&httpRequest5, []string{"X-Forwarded-For", "X-Real-Ip"})) + assert.Equal(t, "10.2.0.1", GetIPAddress(&httpRequest5, []string{"X-Forwarded-For", "X-Real-Ip"})) + }) - // Test with both headers, but both untrusted - httpRequest6 := http.Request{ - Header: http.Header{ - "X-Forwarded-For": []string{"10.3.0.1"}, - "X-Real-Ip": []string{"10.1.0.1"}, - }, - RemoteAddr: "10.2.0.1:12345", - } + t.Run("Two headers, but both untrusted", func(t *testing.T) { + httpRequest6 := http.Request{ + Header: http.Header{ + "X-Forwarded-For": []string{"10.3.0.1"}, + "X-Real-Ip": []string{"10.1.0.1"}, + }, + RemoteAddr: "10.2.0.1:12345", + } - assert.Equal(t, "10.2.0.1", GetIPAddress(&httpRequest6, nil)) + assert.Equal(t, "10.2.0.1", GetIPAddress(&httpRequest6, nil)) + }) - // Test with both headers, but only X-Real-Ip trusted - httpRequest7 := http.Request{ - Header: http.Header{ - "X-Forwarded-For": []string{"10.3.0.1"}, - "X-Real-Ip": []string{"10.1.0.1"}, - }, - RemoteAddr: "10.2.0.1:12345", - } + t.Run("Two headers, but only X-Real-Ip trusted", func(t *testing.T) { + httpRequest7 := http.Request{ + Header: http.Header{ + "X-Forwarded-For": []string{"10.3.0.1"}, + "X-Real-Ip": []string{"10.1.0.1"}, + }, + RemoteAddr: "10.2.0.1:12345", + } - assert.Equal(t, "10.1.0.1", GetIPAddress(&httpRequest7, []string{"X-Real-Ip"})) + assert.Equal(t, "10.1.0.1", GetIPAddress(&httpRequest7, []string{"X-Real-Ip"})) + }) - // Test with X-Forwarded-For, comma separated, untrusted - httpRequest8 := http.Request{ - Header: http.Header{ - "X-Forwarded-For": []string{"10.3.0.1, 10.1.0.1"}, - }, - RemoteAddr: "10.2.0.1:12345", - } + t.Run("X-Forwarded-For, comma separated, untrusted", func(t *testing.T) { + httpRequest8 := http.Request{ + Header: http.Header{ + "X-Forwarded-For": []string{"10.3.0.1, 10.1.0.1"}, + }, + RemoteAddr: "10.2.0.1:12345", + } - assert.Equal(t, "10.2.0.1", GetIPAddress(&httpRequest8, nil)) + assert.Equal(t, "10.2.0.1", GetIPAddress(&httpRequest8, nil)) + }) - // Test with X-Forwarded-For, comma separated, untrusted - httpRequest9 := http.Request{ - Header: http.Header{ - "X-Forwarded-For": []string{"10.3.0.1, 10.1.0.1"}, - }, - RemoteAddr: "10.2.0.1:12345", - } + t.Run("X-Forwarded-For, comma separated, untrusted", func(t *testing.T) { + httpRequest9 := http.Request{ + Header: http.Header{ + "X-Forwarded-For": []string{"10.3.0.1, 10.1.0.1"}, + }, + RemoteAddr: "10.2.0.1:12345", + } - assert.Equal(t, "10.3.0.1", GetIPAddress(&httpRequest9, []string{"X-Forwarded-For"})) + assert.Equal(t, "10.3.0.1", GetIPAddress(&httpRequest9, []string{"X-Forwarded-For"})) + }) - // Test with both headers, both allowed, first one in trusted used - httpRequest10 := http.Request{ - Header: http.Header{ - "X-Forwarded-For": []string{"10.3.0.1"}, - "X-Real-Ip": []string{"10.1.0.1"}, - }, - RemoteAddr: "10.2.0.1:12345", - } + t.Run("Two headers, both allowed, first one in trusted used", func(t *testing.T) { + httpRequest10 := http.Request{ + Header: http.Header{ + "X-Forwarded-For": []string{"10.3.0.1"}, + "X-Real-Ip": []string{"10.1.0.1"}, + }, + RemoteAddr: "10.2.0.1:12345", + } - assert.Equal(t, "10.1.0.1", GetIPAddress(&httpRequest10, []string{"X-Real-Ip", "X-Forwarded-For"})) + assert.Equal(t, "10.1.0.1", GetIPAddress(&httpRequest10, []string{"X-Real-Ip", "X-Forwarded-For"})) + }) - // Test with multiple IPs in the X-Forwarded-For with no spaces - httpRequest11 := http.Request{ - Header: http.Header{ - "X-Forwarded-For": []string{"10.0.0.1,10.0.0.2,10.0.0.3"}, - "X-Real-Ip": []string{"10.1.0.1"}, - }, - RemoteAddr: "10.2.0.1:12345", - } + t.Run("Multiple IPs in the X-Forwarded-For with no spaces", func(t *testing.T) { + httpRequest11 := http.Request{ + Header: http.Header{ + "X-Forwarded-For": []string{"10.0.0.1,10.0.0.2,10.0.0.3"}, + "X-Real-Ip": []string{"10.1.0.1"}, + }, + RemoteAddr: "10.2.0.1:12345", + } - assert.Equal(t, "10.0.0.1", GetIPAddress(&httpRequest11, []string{"X-Forwarded-For"})) + assert.Equal(t, "10.0.0.1", GetIPAddress(&httpRequest11, []string{"X-Forwarded-For"})) + }) + + t.Run("Make sure that the parsed value from headers only accept IP Addresses", func(t *testing.T) { + httpRequest12 := http.Request{ + Header: http.Header{ + "X-Forwarded-For": []string{"127.0.0.1"}, + }, + RemoteAddr: "10.2.0.1:12345", + } + + assert.Equal(t, "127.0.0.1", GetIPAddress(&httpRequest12, []string{"X-Forwarded-For"})) + + httpRequest13 := http.Request{ + Header: http.Header{ + "X-Forwarded-For": []string{"localhost"}, + }, + RemoteAddr: "10.2.0.1:12345", + } + + assert.Equal(t, "10.2.0.1", GetIPAddress(&httpRequest13, []string{"X-Forwarded-For"})) + }) } func TestRemoveStringFromSlice(t *testing.T) { diff --git a/server/channels/web/context.go b/server/channels/web/context.go index 46384a851e..1fbf57bb33 100644 --- a/server/channels/web/context.go +++ b/server/channels/web/context.go @@ -9,13 +9,13 @@ import ( "regexp" "strings" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/app" - "github.com/mattermost/mattermost-server/v6/server/channels/app/request" - "github.com/mattermost/mattermost-server/v6/server/channels/audit" - "github.com/mattermost/mattermost-server/v6/server/channels/utils" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/i18n" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/app" + "github.com/mattermost/mattermost-server/server/v8/channels/app/request" + "github.com/mattermost/mattermost-server/server/v8/channels/audit" + "github.com/mattermost/mattermost-server/server/v8/channels/utils" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/i18n" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) type Context struct { diff --git a/server/channels/web/context_test.go b/server/channels/web/context_test.go index a2850ba2e9..60a9ef0579 100644 --- a/server/channels/web/context_test.go +++ b/server/channels/web/context_test.go @@ -11,9 +11,9 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/plugin/plugintest/mock" - "github.com/mattermost/mattermost-server/v6/server/channels/store/storetest/mocks" + "github.com/mattermost/mattermost-server/server/v8/channels/store/storetest/mocks" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/plugin/plugintest/mock" ) func TestRequireHookId(t *testing.T) { diff --git a/server/channels/web/handlers.go b/server/channels/web/handlers.go index 466619b61a..d10c085021 100644 --- a/server/channels/web/handlers.go +++ b/server/channels/web/handlers.go @@ -20,15 +20,15 @@ import ( "github.com/opentracing/opentracing-go/ext" spanlog "github.com/opentracing/opentracing-go/log" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/app" - app_opentracing "github.com/mattermost/mattermost-server/v6/server/channels/app/opentracing" - "github.com/mattermost/mattermost-server/v6/server/channels/app/request" - "github.com/mattermost/mattermost-server/v6/server/channels/store/opentracinglayer" - "github.com/mattermost/mattermost-server/v6/server/channels/utils" - "github.com/mattermost/mattermost-server/v6/server/platform/services/tracing" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/i18n" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/app" + app_opentracing "github.com/mattermost/mattermost-server/server/v8/channels/app/opentracing" + "github.com/mattermost/mattermost-server/server/v8/channels/app/request" + "github.com/mattermost/mattermost-server/server/v8/channels/store/opentracinglayer" + "github.com/mattermost/mattermost-server/server/v8/channels/utils" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/services/tracing" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/i18n" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) func GetHandlerName(h func(*Context, http.ResponseWriter, *http.Request)) string { diff --git a/server/channels/web/handlers_test.go b/server/channels/web/handlers_test.go index f94c03548a..842e062151 100644 --- a/server/channels/web/handlers_test.go +++ b/server/channels/web/handlers_test.go @@ -11,11 +11,11 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/plugin/plugintest/mock" - "github.com/mattermost/mattermost-server/v6/server/channels/app" - "github.com/mattermost/mattermost-server/v6/server/channels/store/storetest/mocks" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/app" + "github.com/mattermost/mattermost-server/server/v8/channels/store/storetest/mocks" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/plugin/plugintest/mock" ) func handlerForHTTPErrors(c *Context, w http.ResponseWriter, r *http.Request) { diff --git a/server/channels/web/main_test.go b/server/channels/web/main_test.go index 8ed6c63a8c..06e4b6935a 100644 --- a/server/channels/web/main_test.go +++ b/server/channels/web/main_test.go @@ -6,7 +6,7 @@ package web import ( "testing" - "github.com/mattermost/mattermost-server/v6/server/channels/testlib" + "github.com/mattermost/mattermost-server/server/v8/channels/testlib" ) var mainHelper *testlib.MainHelper diff --git a/server/channels/web/oauth.go b/server/channels/web/oauth.go index 9d98ce8c27..fe6e4ece8e 100644 --- a/server/channels/web/oauth.go +++ b/server/channels/web/oauth.go @@ -11,13 +11,13 @@ import ( "path/filepath" "strings" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/app" - "github.com/mattermost/mattermost-server/v6/server/channels/audit" - "github.com/mattermost/mattermost-server/v6/server/channels/utils" - "github.com/mattermost/mattermost-server/v6/server/channels/utils/fileutils" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/i18n" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/app" + "github.com/mattermost/mattermost-server/server/v8/channels/audit" + "github.com/mattermost/mattermost-server/server/v8/channels/utils" + "github.com/mattermost/mattermost-server/server/v8/channels/utils/fileutils" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/i18n" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) func (w *Web) InitOAuth() { diff --git a/server/channels/web/oauth_test.go b/server/channels/web/oauth_test.go index 874c22d2c2..03838789fd 100644 --- a/server/channels/web/oauth_test.go +++ b/server/channels/web/oauth_test.go @@ -17,11 +17,11 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/einterfaces" - "github.com/mattermost/mattermost-server/v6/server/channels/utils" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/i18n" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/einterfaces" + "github.com/mattermost/mattermost-server/server/v8/channels/utils" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/i18n" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) func TestOAuthComplete_AccessDenied(t *testing.T) { diff --git a/server/channels/web/params.go b/server/channels/web/params.go index 64e8227119..7dd205dc93 100644 --- a/server/channels/web/params.go +++ b/server/channels/web/params.go @@ -11,7 +11,7 @@ import ( "github.com/gorilla/mux" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) const ( diff --git a/server/channels/web/params_test.go b/server/channels/web/params_test.go index e95e8b6140..010714e252 100644 --- a/server/channels/web/params_test.go +++ b/server/channels/web/params_test.go @@ -10,7 +10,7 @@ import ( "github.com/gorilla/mux" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestGetPerPageFromQuery(t *testing.T) { diff --git a/server/channels/web/saml.go b/server/channels/web/saml.go index 438cf490e1..55bcfdfee0 100644 --- a/server/channels/web/saml.go +++ b/server/channels/web/saml.go @@ -10,10 +10,10 @@ import ( "strconv" "strings" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/audit" - "github.com/mattermost/mattermost-server/v6/server/channels/utils" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/audit" + "github.com/mattermost/mattermost-server/server/v8/channels/utils" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) const maxSAMLResponseSize = 2 * 1024 * 1024 // 2MB diff --git a/server/channels/web/static.go b/server/channels/web/static.go index bd091841a9..e8e111dbb5 100644 --- a/server/channels/web/static.go +++ b/server/channels/web/static.go @@ -15,11 +15,11 @@ import ( "github.com/mattermost/gziphandler" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/utils" - "github.com/mattermost/mattermost-server/v6/server/channels/utils/fileutils" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/templates" + "github.com/mattermost/mattermost-server/server/v8/channels/utils" + "github.com/mattermost/mattermost-server/server/v8/channels/utils/fileutils" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/templates" ) var robotsTxt = []byte("User-agent: *\nDisallow: /\n") diff --git a/server/channels/web/unsupported_browser.go b/server/channels/web/unsupported_browser.go index eea9fc93c3..fc3ea2fe26 100644 --- a/server/channels/web/unsupported_browser.go +++ b/server/channels/web/unsupported_browser.go @@ -8,8 +8,8 @@ import ( "github.com/avct/uasurfer" - "github.com/mattermost/mattermost-server/v6/server/channels/app/request" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/templates" + "github.com/mattermost/mattermost-server/server/v8/channels/app/request" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/templates" ) // MattermostApp describes downloads for the Mattermost App diff --git a/server/channels/web/web.go b/server/channels/web/web.go index 64ff0221bf..1bae301a83 100644 --- a/server/channels/web/web.go +++ b/server/channels/web/web.go @@ -11,10 +11,10 @@ import ( "github.com/avct/uasurfer" "github.com/gorilla/mux" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/app" - "github.com/mattermost/mattermost-server/v6/server/channels/utils" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/app" + "github.com/mattermost/mattermost-server/server/v8/channels/utils" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) type Web struct { diff --git a/server/channels/web/web_test.go b/server/channels/web/web_test.go index 3fcddc2023..c6d9d46fbd 100644 --- a/server/channels/web/web_test.go +++ b/server/channels/web/web_test.go @@ -17,15 +17,15 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/plugin" - "github.com/mattermost/mattermost-server/v6/server/channels/app" - "github.com/mattermost/mattermost-server/v6/server/channels/app/request" - "github.com/mattermost/mattermost-server/v6/server/channels/store/localcachelayer" - "github.com/mattermost/mattermost-server/v6/server/channels/store/storetest/mocks" - "github.com/mattermost/mattermost-server/v6/server/channels/utils" - "github.com/mattermost/mattermost-server/v6/server/config" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/app" + "github.com/mattermost/mattermost-server/server/v8/channels/app/request" + "github.com/mattermost/mattermost-server/server/v8/channels/store/localcachelayer" + "github.com/mattermost/mattermost-server/server/v8/channels/store/storetest/mocks" + "github.com/mattermost/mattermost-server/server/v8/channels/utils" + "github.com/mattermost/mattermost-server/server/v8/config" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/plugin" ) var apiClient *model.Client4 @@ -55,7 +55,7 @@ func SetupWithStoreMock(tb testing.TB) *TestHelper { tb.SkipNow() } - th := setupTestHelper(tb, false) + th := setupTestHelper(tb, false, []app.Option{app.SkipProductsInitialization()}) emptyMockStore := mocks.Store{} emptyMockStore.On("Close").Return(nil) th.App.Srv().SetStore(&emptyMockStore) @@ -68,17 +68,18 @@ func Setup(tb testing.TB) *TestHelper { } store := mainHelper.GetStore() store.DropAllTables() - return setupTestHelper(tb, true) + mainHelper.PreloadBoardsMigrationsIfNeeded() + return setupTestHelper(tb, true, nil) } -func setupTestHelper(tb testing.TB, includeCacheLayer bool) *TestHelper { +func setupTestHelper(tb testing.TB, includeCacheLayer bool, options []app.Option) *TestHelper { memoryStore := config.NewTestMemoryStore() newConfig := memoryStore.Get().Clone() + newConfig.SqlSettings = *mainHelper.GetSQLSettings() *newConfig.AnnouncementSettings.AdminNoticesEnabled = false *newConfig.AnnouncementSettings.UserNoticesEnabled = false *newConfig.PluginSettings.AutomaticPrepackagedPlugins = false memoryStore.Set(newConfig) - var options []app.Option options = append(options, app.ConfigStore(memoryStore)) options = append(options, app.StoreOverride(mainHelper.Store)) @@ -204,7 +205,7 @@ func TestStaticFilesRequest(t *testing.T) { package main import ( - "github.com/mattermost/mattermost-server/v6/plugin" + "github.com/mattermost/mattermost-server/server/v8/plugin" ) type MyPlugin struct { @@ -282,7 +283,7 @@ func TestPublicFilesRequest(t *testing.T) { defer os.RemoveAll(pluginDir) defer os.RemoveAll(webappPluginDir) - env, err := plugin.NewEnvironment(th.NewPluginAPI, app.NewDriverImpl(th.Server), pluginDir, webappPluginDir, false, th.App.Log(), nil) + env, err := plugin.NewEnvironment(th.NewPluginAPI, app.NewDriverImpl(th.Server), pluginDir, webappPluginDir, th.App.Log(), nil) require.NoError(t, err) pluginID := "com.mattermost.sample" @@ -291,7 +292,7 @@ func TestPublicFilesRequest(t *testing.T) { package main import ( - "github.com/mattermost/mattermost-server/v6/plugin" + "github.com/mattermost/mattermost-server/server/v8/plugin" ) type MyPlugin struct { diff --git a/server/channels/web/webhook.go b/server/channels/web/webhook.go index 84a23b83b5..d75c98e94b 100644 --- a/server/channels/web/webhook.go +++ b/server/channels/web/webhook.go @@ -13,8 +13,8 @@ import ( "github.com/gorilla/mux" "github.com/gorilla/schema" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) func (w *Web) InitWebhooks() { diff --git a/server/channels/web/webhook_test.go b/server/channels/web/webhook_test.go index e0cd792c1e..17f5dbe718 100644 --- a/server/channels/web/webhook_test.go +++ b/server/channels/web/webhook_test.go @@ -13,7 +13,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestIncomingWebhook(t *testing.T) { diff --git a/server/channels/wsapi/api.go b/server/channels/wsapi/api.go index 9da2d79ba5..fcfa5b07fd 100644 --- a/server/channels/wsapi/api.go +++ b/server/channels/wsapi/api.go @@ -4,8 +4,8 @@ package wsapi import ( - "github.com/mattermost/mattermost-server/v6/server/channels/app" - "github.com/mattermost/mattermost-server/v6/server/channels/app/platform" + "github.com/mattermost/mattermost-server/server/v8/channels/app" + "github.com/mattermost/mattermost-server/server/v8/channels/app/platform" ) type API struct { diff --git a/server/channels/wsapi/status.go b/server/channels/wsapi/status.go index 375f65367e..db52eb50dd 100644 --- a/server/channels/wsapi/status.go +++ b/server/channels/wsapi/status.go @@ -4,8 +4,8 @@ package wsapi import ( - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) func (api *API) InitStatus() { diff --git a/server/channels/wsapi/system.go b/server/channels/wsapi/system.go index e119505f80..634df691b7 100644 --- a/server/channels/wsapi/system.go +++ b/server/channels/wsapi/system.go @@ -4,7 +4,7 @@ package wsapi import ( - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) func (api *API) InitSystem() { diff --git a/server/channels/wsapi/user.go b/server/channels/wsapi/user.go index 6389a99aea..940c2ae64a 100644 --- a/server/channels/wsapi/user.go +++ b/server/channels/wsapi/user.go @@ -4,8 +4,8 @@ package wsapi import ( - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/app/request" + "github.com/mattermost/mattermost-server/server/v8/channels/app/request" + "github.com/mattermost/mattermost-server/server/v8/model" ) func (api *API) InitUser() { diff --git a/server/channels/wsapi/websocket_handler.go b/server/channels/wsapi/websocket_handler.go index 9ceb7354bb..4cd7d68bec 100644 --- a/server/channels/wsapi/websocket_handler.go +++ b/server/channels/wsapi/websocket_handler.go @@ -6,11 +6,11 @@ package wsapi import ( "net/http" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/app" - "github.com/mattermost/mattermost-server/v6/server/channels/app/platform" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/i18n" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/app" + "github.com/mattermost/mattermost-server/server/v8/channels/app/platform" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/i18n" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) func (api *API) APIWebSocketHandler(wh func(*model.WebSocketRequest) (map[string]any, *model.AppError)) webSocketHandler { diff --git a/server/cmd/mattermost/commands/cmdtestlib.go b/server/cmd/mattermost/commands/cmdtestlib.go index 9b526f18e6..1d57b71367 100644 --- a/server/cmd/mattermost/commands/cmdtestlib.go +++ b/server/cmd/mattermost/commands/cmdtestlib.go @@ -17,10 +17,10 @@ import ( "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/api4" - "github.com/mattermost/mattermost-server/v6/server/channels/store/storetest/mocks" - "github.com/mattermost/mattermost-server/v6/server/channels/testlib" + "github.com/mattermost/mattermost-server/server/v8/channels/api4" + "github.com/mattermost/mattermost-server/server/v8/channels/store/storetest/mocks" + "github.com/mattermost/mattermost-server/server/v8/channels/testlib" + "github.com/mattermost/mattermost-server/server/v8/model" ) var coverprofileCounters map[string]int = make(map[string]int) diff --git a/server/cmd/mattermost/commands/db.go b/server/cmd/mattermost/commands/db.go index 4174f77c75..387d203d80 100644 --- a/server/cmd/mattermost/commands/db.go +++ b/server/cmd/mattermost/commands/db.go @@ -10,10 +10,10 @@ import ( "github.com/pkg/errors" "github.com/spf13/cobra" - "github.com/mattermost/mattermost-server/v6/server/channels/app" - "github.com/mattermost/mattermost-server/v6/server/channels/audit" - "github.com/mattermost/mattermost-server/v6/server/channels/store/sqlstore" - "github.com/mattermost/mattermost-server/v6/server/config" + "github.com/mattermost/mattermost-server/server/v8/channels/app" + "github.com/mattermost/mattermost-server/server/v8/channels/audit" + "github.com/mattermost/mattermost-server/server/v8/channels/store/sqlstore" + "github.com/mattermost/mattermost-server/server/v8/config" ) var DbCmd = &cobra.Command{ diff --git a/server/cmd/mattermost/commands/export.go b/server/cmd/mattermost/commands/export.go index 90cfa317b7..70593379b2 100644 --- a/server/cmd/mattermost/commands/export.go +++ b/server/cmd/mattermost/commands/export.go @@ -10,10 +10,10 @@ import ( "path/filepath" "time" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/app" - "github.com/mattermost/mattermost-server/v6/server/channels/app/request" - "github.com/mattermost/mattermost-server/v6/server/channels/audit" + "github.com/mattermost/mattermost-server/server/v8/channels/app" + "github.com/mattermost/mattermost-server/server/v8/channels/app/request" + "github.com/mattermost/mattermost-server/server/v8/channels/audit" + "github.com/mattermost/mattermost-server/server/v8/model" "github.com/pkg/errors" "github.com/spf13/cobra" diff --git a/server/cmd/mattermost/commands/export_test.go b/server/cmd/mattermost/commands/export_test.go index f6ebfeffb6..b2456d60cd 100644 --- a/server/cmd/mattermost/commands/export_test.go +++ b/server/cmd/mattermost/commands/export_test.go @@ -8,7 +8,7 @@ import ( "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) // There are no tests that actually run the Message Export job, because it can take a long time to complete depending diff --git a/server/cmd/mattermost/commands/import.go b/server/cmd/mattermost/commands/import.go index a140af37aa..ecfcca5781 100644 --- a/server/cmd/mattermost/commands/import.go +++ b/server/cmd/mattermost/commands/import.go @@ -10,10 +10,10 @@ import ( "github.com/spf13/cobra" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/app" - "github.com/mattermost/mattermost-server/v6/server/channels/app/request" - "github.com/mattermost/mattermost-server/v6/server/channels/audit" + "github.com/mattermost/mattermost-server/server/v8/channels/app" + "github.com/mattermost/mattermost-server/server/v8/channels/app/request" + "github.com/mattermost/mattermost-server/server/v8/channels/audit" + "github.com/mattermost/mattermost-server/server/v8/model" ) var ImportCmd = &cobra.Command{ diff --git a/server/cmd/mattermost/commands/init.go b/server/cmd/mattermost/commands/init.go index fa747ba99f..bae1181fa2 100644 --- a/server/cmd/mattermost/commands/init.go +++ b/server/cmd/mattermost/commands/init.go @@ -6,12 +6,12 @@ package commands import ( "github.com/spf13/cobra" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/app" - "github.com/mattermost/mattermost-server/v6/server/channels/app/request" - "github.com/mattermost/mattermost-server/v6/server/channels/utils" - "github.com/mattermost/mattermost-server/v6/server/config" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/i18n" + "github.com/mattermost/mattermost-server/server/v8/channels/app" + "github.com/mattermost/mattermost-server/server/v8/channels/app/request" + "github.com/mattermost/mattermost-server/server/v8/channels/utils" + "github.com/mattermost/mattermost-server/server/v8/config" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/i18n" ) func initDBCommandContextCobra(command *cobra.Command, readOnlyConfigStore bool, options ...app.Option) (*app.App, error) { diff --git a/server/cmd/mattermost/commands/jobserver.go b/server/cmd/mattermost/commands/jobserver.go index 0f5663426c..206b660a9f 100644 --- a/server/cmd/mattermost/commands/jobserver.go +++ b/server/cmd/mattermost/commands/jobserver.go @@ -10,10 +10,10 @@ import ( "github.com/spf13/cobra" - "github.com/mattermost/mattermost-server/v6/server/channels/app" - "github.com/mattermost/mattermost-server/v6/server/channels/audit" - "github.com/mattermost/mattermost-server/v6/server/config" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/app" + "github.com/mattermost/mattermost-server/server/v8/channels/audit" + "github.com/mattermost/mattermost-server/server/v8/config" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) var JobserverCmd = &cobra.Command{ diff --git a/server/cmd/mattermost/commands/main_test.go b/server/cmd/mattermost/commands/main_test.go index 2a7df0a3c4..ace5a637db 100644 --- a/server/cmd/mattermost/commands/main_test.go +++ b/server/cmd/mattermost/commands/main_test.go @@ -8,9 +8,9 @@ import ( "os" "testing" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/api4" - "github.com/mattermost/mattermost-server/v6/server/channels/testlib" + "github.com/mattermost/mattermost-server/server/v8/channels/api4" + "github.com/mattermost/mattermost-server/server/v8/channels/testlib" + "github.com/mattermost/mattermost-server/server/v8/model" ) // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. diff --git a/server/cmd/mattermost/commands/server.go b/server/cmd/mattermost/commands/server.go index ecb25552d2..3501047332 100644 --- a/server/cmd/mattermost/commands/server.go +++ b/server/cmd/mattermost/commands/server.go @@ -15,14 +15,14 @@ import ( "github.com/pkg/errors" "github.com/spf13/cobra" - "github.com/mattermost/mattermost-server/v6/server/channels/api4" - "github.com/mattermost/mattermost-server/v6/server/channels/app" - "github.com/mattermost/mattermost-server/v6/server/channels/manualtesting" - "github.com/mattermost/mattermost-server/v6/server/channels/utils" - "github.com/mattermost/mattermost-server/v6/server/channels/web" - "github.com/mattermost/mattermost-server/v6/server/channels/wsapi" - "github.com/mattermost/mattermost-server/v6/server/config" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/api4" + "github.com/mattermost/mattermost-server/server/v8/channels/app" + "github.com/mattermost/mattermost-server/server/v8/channels/manualtesting" + "github.com/mattermost/mattermost-server/server/v8/channels/utils" + "github.com/mattermost/mattermost-server/server/v8/channels/web" + "github.com/mattermost/mattermost-server/server/v8/channels/wsapi" + "github.com/mattermost/mattermost-server/server/v8/config" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) var serverCmd = &cobra.Command{ diff --git a/server/cmd/mattermost/commands/server_test.go b/server/cmd/mattermost/commands/server_test.go index eef8af50e7..d8eaf66e8f 100644 --- a/server/cmd/mattermost/commands/server_test.go +++ b/server/cmd/mattermost/commands/server_test.go @@ -11,8 +11,8 @@ import ( "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/server/channels/jobs" - "github.com/mattermost/mattermost-server/v6/server/config" + "github.com/mattermost/mattermost-server/server/v8/channels/jobs" + "github.com/mattermost/mattermost-server/server/v8/config" ) const ( @@ -65,6 +65,7 @@ func TestRunServerSuccess(t *testing.T) { // Use non-default listening port in case another server instance is already running. cfg := configStore.Get() *cfg.ServiceSettings.ListenAddress = unitTestListeningPort + cfg.SqlSettings = *mainHelper.GetSQLSettings() configStore.Set(cfg) err := runServer(configStore, th.interruptChan) @@ -117,6 +118,7 @@ func TestRunServerSystemdNotification(t *testing.T) { // Use non-default listening port in case another server instance is already running. cfg := configStore.Get() *cfg.ServiceSettings.ListenAddress = unitTestListeningPort + cfg.SqlSettings = *mainHelper.GetSQLSettings() configStore.Set(cfg) // Start and stop the server @@ -142,6 +144,7 @@ func TestRunServerNoSystemd(t *testing.T) { // Use non-default listening port in case another server instance is already running. cfg := configStore.Get() *cfg.ServiceSettings.ListenAddress = unitTestListeningPort + cfg.SqlSettings = *mainHelper.GetSQLSettings() configStore.Set(cfg) err := runServer(configStore, th.interruptChan) diff --git a/server/cmd/mattermost/commands/test.go b/server/cmd/mattermost/commands/test.go index abacaa1163..a525f2bbdc 100644 --- a/server/cmd/mattermost/commands/test.go +++ b/server/cmd/mattermost/commands/test.go @@ -13,11 +13,11 @@ import ( "github.com/spf13/cobra" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/api4" - "github.com/mattermost/mattermost-server/v6/server/channels/app" - "github.com/mattermost/mattermost-server/v6/server/channels/wsapi" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/i18n" + "github.com/mattermost/mattermost-server/server/v8/channels/api4" + "github.com/mattermost/mattermost-server/server/v8/channels/app" + "github.com/mattermost/mattermost-server/server/v8/channels/wsapi" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/i18n" ) var TestCmd = &cobra.Command{ diff --git a/server/cmd/mattermost/commands/utils.go b/server/cmd/mattermost/commands/utils.go index fb7a56d262..d09def41fc 100644 --- a/server/cmd/mattermost/commands/utils.go +++ b/server/cmd/mattermost/commands/utils.go @@ -14,7 +14,7 @@ import ( "github.com/spf13/cobra" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) const CustomDefaultsEnvVar = "MM_CUSTOM_DEFAULTS_PATH" diff --git a/server/cmd/mattermost/commands/version.go b/server/cmd/mattermost/commands/version.go index 2c318a72e2..daea544066 100644 --- a/server/cmd/mattermost/commands/version.go +++ b/server/cmd/mattermost/commands/version.go @@ -6,7 +6,7 @@ package commands import ( "github.com/spf13/cobra" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) var VersionCmd = &cobra.Command{ diff --git a/server/cmd/mattermost/main.go b/server/cmd/mattermost/main.go index d0577694bf..a0b31a2dc2 100644 --- a/server/cmd/mattermost/main.go +++ b/server/cmd/mattermost/main.go @@ -6,14 +6,18 @@ package main import ( "os" - "github.com/mattermost/mattermost-server/v6/server/cmd/mattermost/commands" + "github.com/mattermost/mattermost-server/server/v8/cmd/mattermost/commands" // Import and register app layer slash commands - _ "github.com/mattermost/mattermost-server/v6/server/channels/app/slashcommands" + _ "github.com/mattermost/mattermost-server/server/v8/channels/app/slashcommands" // Plugins - _ "github.com/mattermost/mattermost-server/v6/model/oauthproviders/gitlab" + _ "github.com/mattermost/mattermost-server/server/v8/model/oauthproviders/gitlab" // Enterprise Imports - _ "github.com/mattermost/mattermost-server/v6/server/channels/imports" + _ "github.com/mattermost/mattermost-server/server/v8/channels/imports" + + // Blank imports for each product to register themselves + _ "github.com/mattermost/mattermost-server/server/v8/boards/product" + _ "github.com/mattermost/mattermost-server/server/v8/playbooks/product" ) func main() { diff --git a/server/config/client.go b/server/config/client.go index df004b381f..a4541dd32e 100644 --- a/server/config/client.go +++ b/server/config/client.go @@ -8,7 +8,7 @@ import ( "strconv" "strings" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) // GenerateClientConfig renders the given configuration for a client. @@ -94,6 +94,8 @@ func GenerateClientConfig(c *model.Config, telemetryID string, license *model.Li props["CWSURL"] = *c.CloudSettings.CWSURL + props["DisableRefetchingOnBrowserFocus"] = strconv.FormatBool(*c.ExperimentalSettings.DisableRefetchingOnBrowserFocus) + // Set default values for all options that require a license. props["ExperimentalEnableAuthenticationTransfer"] = "true" props["LdapNicknameAttributeSet"] = "false" @@ -134,6 +136,7 @@ func GenerateClientConfig(c *model.Config, telemetryID string, license *model.Li props["InsightsEnabled"] = strconv.FormatBool(c.FeatureFlags.InsightsEnabled) props["PostPriority"] = strconv.FormatBool(*c.ServiceSettings.PostPriority) props["AllowSyncedDrafts"] = strconv.FormatBool(*c.ServiceSettings.AllowSyncedDrafts) + props["DelayChannelAutocomplete"] = strconv.FormatBool(*c.ExperimentalSettings.DelayChannelAutocomplete) if license != nil { props["ExperimentalEnableAuthenticationTransfer"] = strconv.FormatBool(*c.ServiceSettings.ExperimentalEnableAuthenticationTransfer) diff --git a/server/config/client_test.go b/server/config/client_test.go index 9c92cfe329..4c3d3c9968 100644 --- a/server/config/client_test.go +++ b/server/config/client_test.go @@ -9,7 +9,7 @@ import ( "github.com/stretchr/testify/assert" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestGetClientConfig(t *testing.T) { diff --git a/server/config/common_test.go b/server/config/common_test.go index 06e4f90057..e601e63352 100644 --- a/server/config/common_test.go +++ b/server/config/common_test.go @@ -10,7 +10,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) var emptyConfig, readOnlyConfig, minimalConfig, minimalConfigNoFF, invalidConfig, fixesRequiredConfig, ldapConfig, testConfig, customConfigDefaults *model.Config diff --git a/server/config/database.go b/server/config/database.go index dd508d9c4f..58966e9d9e 100644 --- a/server/config/database.go +++ b/server/config/database.go @@ -25,9 +25,9 @@ import ( "github.com/mattermost/morph" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store/sqlstore" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/store/sqlstore" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" "github.com/mattermost/morph/drivers" ms "github.com/mattermost/morph/drivers/mysql" diff --git a/server/config/database_test.go b/server/config/database_test.go index 6954461a08..d1fb8e18c4 100644 --- a/server/config/database_test.go +++ b/server/config/database_test.go @@ -16,7 +16,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) func getDsn(driver string, source string) string { diff --git a/server/config/diff.go b/server/config/diff.go index ac418ec8a6..d10025d4bd 100644 --- a/server/config/diff.go +++ b/server/config/diff.go @@ -7,7 +7,7 @@ import ( "fmt" "reflect" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) type ConfigDiffs []ConfigDiff diff --git a/server/config/diff_test.go b/server/config/diff_test.go index bf1a79ab37..36e3b2402b 100644 --- a/server/config/diff_test.go +++ b/server/config/diff_test.go @@ -6,7 +6,7 @@ package config import ( "testing" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" "github.com/stretchr/testify/require" ) diff --git a/server/config/emitter.go b/server/config/emitter.go index 80f8c72065..bd5b36d794 100644 --- a/server/config/emitter.go +++ b/server/config/emitter.go @@ -6,8 +6,8 @@ package config import ( "sync" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) // Listener is a callback function invoked when the configuration changes. diff --git a/server/config/emitter_test.go b/server/config/emitter_test.go index 6700088b3b..417a168be2 100644 --- a/server/config/emitter_test.go +++ b/server/config/emitter_test.go @@ -8,8 +8,8 @@ import ( "github.com/stretchr/testify/assert" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) func TestEmitter(t *testing.T) { diff --git a/server/config/environment.go b/server/config/environment.go index 4ded8d7399..17ad38f34e 100644 --- a/server/config/environment.go +++ b/server/config/environment.go @@ -10,7 +10,7 @@ import ( "strconv" "strings" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) func GetEnvironment() map[string]string { diff --git a/server/config/environment_test.go b/server/config/environment_test.go index e86bcc36e9..b45107ad39 100644 --- a/server/config/environment_test.go +++ b/server/config/environment_test.go @@ -8,7 +8,7 @@ import ( "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) func modifiedDefault(modify func(*model.Config)) *model.Config { diff --git a/server/config/file.go b/server/config/file.go index 79d71bc6f1..082d77c9f9 100644 --- a/server/config/file.go +++ b/server/config/file.go @@ -11,9 +11,9 @@ import ( "github.com/pkg/errors" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/utils/fileutils" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/utils/fileutils" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) var ( diff --git a/server/config/file_test.go b/server/config/file_test.go index 9094a2b200..51df708992 100644 --- a/server/config/file_test.go +++ b/server/config/file_test.go @@ -15,8 +15,8 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/utils" + "github.com/mattermost/mattermost-server/server/v8/channels/utils" + "github.com/mattermost/mattermost-server/server/v8/model" ) func setupConfigFile(t *testing.T, cfg *model.Config) (string, func()) { diff --git a/server/config/logconfigsrc.go b/server/config/logconfigsrc.go index 8f75d62b44..dce35f6f24 100644 --- a/server/config/logconfigsrc.go +++ b/server/config/logconfigsrc.go @@ -10,7 +10,7 @@ import ( "strings" "sync" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) type LogSrcListener func(old, new mlog.LoggerConfiguration) diff --git a/server/config/logger.go b/server/config/logger.go index 36b6374603..ec64b98dc8 100644 --- a/server/config/logger.go +++ b/server/config/logger.go @@ -9,9 +9,9 @@ import ( "path/filepath" "strings" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/utils/fileutils" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/utils/fileutils" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) const ( diff --git a/server/config/logger_test.go b/server/config/logger_test.go index c28f769d06..acd7fefe1e 100644 --- a/server/config/logger_test.go +++ b/server/config/logger_test.go @@ -10,8 +10,8 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) func TestMloggerConfigFromAuditConfig(t *testing.T) { diff --git a/server/config/main_test.go b/server/config/main_test.go index 09b38815d9..9a0979589b 100644 --- a/server/config/main_test.go +++ b/server/config/main_test.go @@ -11,8 +11,8 @@ import ( "github.com/lib/pq" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/testlib" + "github.com/mattermost/mattermost-server/server/v8/channels/testlib" + "github.com/mattermost/mattermost-server/server/v8/model" ) var mainHelper *testlib.MainHelper diff --git a/server/config/memory.go b/server/config/memory.go index d59b34bec8..7067f3bd55 100644 --- a/server/config/memory.go +++ b/server/config/memory.go @@ -8,7 +8,7 @@ import ( "github.com/pkg/errors" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) // MemoryStore implements the Store interface. It is meant primarily for testing. diff --git a/server/config/migrate_test.go b/server/config/migrate_test.go index 27a1b9ccda..a8f3565811 100644 --- a/server/config/migrate_test.go +++ b/server/config/migrate_test.go @@ -11,7 +11,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) type cleanUpFn func(store *Store) diff --git a/server/config/store.go b/server/config/store.go index b5fb315444..ca9cfca815 100644 --- a/server/config/store.go +++ b/server/config/store.go @@ -11,9 +11,9 @@ import ( "github.com/pkg/errors" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/utils/jsonutils" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/i18n" + "github.com/mattermost/mattermost-server/server/v8/channels/utils/jsonutils" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/i18n" ) var ( diff --git a/server/config/utils.go b/server/config/utils.go index f247ea4a43..d76fe55d52 100644 --- a/server/config/utils.go +++ b/server/config/utils.go @@ -10,10 +10,10 @@ import ( "reflect" "strings" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/utils" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/i18n" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/utils" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/i18n" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) // marshalConfig converts the given configuration into JSON bytes for persistence. diff --git a/server/config/utils_test.go b/server/config/utils_test.go index 9c8de20d23..50585eb550 100644 --- a/server/config/utils_test.go +++ b/server/config/utils_test.go @@ -9,8 +9,8 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/utils" + "github.com/mattermost/mattermost-server/server/v8/channels/utils" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestDesanitize(t *testing.T) { diff --git a/go.mod b/server/go.mod similarity index 73% rename from go.mod rename to server/go.mod index bc262ccf09..20e82eb78b 100644 --- a/go.mod +++ b/server/go.mod @@ -1,15 +1,15 @@ -module github.com/mattermost/mattermost-server/v6 +module github.com/mattermost/mattermost-server/server/v8 go 1.19 require ( code.sajari.com/docconv v1.3.5 - github.com/Masterminds/semver/v3 v3.2.0 - github.com/Masterminds/squirrel v1.5.3 + github.com/Masterminds/semver/v3 v3.2.1 + github.com/Masterminds/squirrel v1.5.4 github.com/avct/uasurfer v0.0.0-20191028135549-26b5daa857f1 - github.com/aws/aws-sdk-go v1.44.173 + github.com/aws/aws-sdk-go v1.44.240 github.com/blang/semver v3.5.1+incompatible - github.com/blevesearch/bleve/v2 v2.3.6 + github.com/blevesearch/bleve/v2 v2.3.7 github.com/cespare/xxhash/v2 v2.2.0 github.com/dgrijalva/jwt-go v3.2.0+incompatible github.com/dgryski/dgoogauth v0.0.0-20190221195224-5a805980a5f3 @@ -17,7 +17,7 @@ require ( github.com/dyatlov/go-opengraph/opengraph v0.0.0-20220524092352-606d7b1e5f8a github.com/francoispqt/gojay v1.2.13 github.com/fsnotify/fsnotify v1.6.0 - github.com/getsentry/sentry-go v0.16.0 + github.com/getsentry/sentry-go v0.20.0 github.com/go-sql-driver/mysql v1.7.0 github.com/golang-migrate/migrate/v4 v4.15.2 github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 @@ -31,9 +31,9 @@ require ( github.com/graph-gophers/dataloader/v7 v7.1.0 github.com/graph-gophers/graphql-go v1.5.1-0.20230110080634-edea822f558a github.com/h2non/go-is-svg v0.0.0-20160927212452-35e8c4b0612c - github.com/hashicorp/go-hclog v1.4.0 - github.com/hashicorp/go-plugin v1.4.8 - github.com/jaytaylor/html2text v0.0.0-20211105163654-bc68cce691ba + github.com/hashicorp/go-hclog v1.5.0 + github.com/hashicorp/go-plugin v1.4.9 + github.com/jaytaylor/html2text v0.0.0-20230321000545-74c2419ad056 github.com/jmoiron/sqlx v1.3.5 github.com/krolaw/zipstream v0.0.0-20180621105154-0a2661891f94 github.com/ledongthuc/pdf v0.0.0-20220302134840-0c2507a12d80 @@ -47,26 +47,26 @@ require ( github.com/mattermost/squirrel v0.2.0 github.com/mgdelacroix/foundation v0.0.0-20220812143423-0bfc18f73538 github.com/mholt/archiver/v3 v3.5.1 - github.com/microcosm-cc/bluemonday v1.0.21 - github.com/minio/minio-go/v7 v7.0.45 - github.com/mitchellh/mapstructure v1.4.3 + github.com/microcosm-cc/bluemonday v1.0.23 + github.com/minio/minio-go/v7 v7.0.51 + github.com/mitchellh/mapstructure v1.5.0 github.com/oklog/run v1.1.0 github.com/oov/psd v0.0.0-20220121172623-5db5eafcecbb github.com/opentracing/opentracing-go v1.2.0 github.com/pborman/uuid v1.2.1 github.com/pkg/errors v0.9.1 - github.com/prometheus/client_golang v1.12.1 + github.com/prometheus/client_golang v1.14.0 github.com/reflog/dateconstraints v0.2.1 - github.com/rivo/uniseg v0.4.3 + github.com/rivo/uniseg v0.4.4 github.com/rs/cors v1.8.3 github.com/rudderlabs/analytics-go v3.3.3+incompatible github.com/rwcarlsen/goexif v0.0.0-20190401172101-9e8deecbddbd - github.com/sergi/go-diff v1.2.0 + github.com/sergi/go-diff v1.3.1 github.com/sirupsen/logrus v1.9.0 - github.com/spf13/cobra v1.6.1 - github.com/spf13/viper v1.10.1 - github.com/splitio/go-client/v6 v6.2.1 - github.com/stretchr/testify v1.8.1 + github.com/spf13/cobra v1.7.0 + github.com/spf13/viper v1.15.0 + github.com/splitio/go-client/v6 v6.3.1 + github.com/stretchr/testify v1.8.2 github.com/throttled/throttled v2.2.5+incompatible github.com/tinylib/msgp v1.1.8 github.com/uber/jaeger-client-go v2.30.0+incompatible @@ -75,14 +75,14 @@ require ( github.com/wiggin77/merror v1.0.4 github.com/writeas/go-strip-markdown v2.0.1+incompatible github.com/xtgo/uuid v0.0.0-20140804021211-a0b114877d4c - github.com/yuin/goldmark v1.5.3 - golang.org/x/crypto v0.5.0 - golang.org/x/image v0.3.0 - golang.org/x/net v0.8.0 - golang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b + github.com/yuin/goldmark v1.5.4 + golang.org/x/crypto v0.8.0 + golang.org/x/image v0.7.0 + golang.org/x/net v0.9.0 + golang.org/x/oauth2 v0.7.0 golang.org/x/sync v0.1.0 - golang.org/x/text v0.8.0 - golang.org/x/tools v0.6.0 + golang.org/x/text v0.9.0 + golang.org/x/tools v0.8.0 gopkg.in/guregu/null.v4 v4.0.0 gopkg.in/mail.v2 v2.3.1 gopkg.in/yaml.v2 v2.4.0 @@ -92,15 +92,15 @@ require ( require ( github.com/HdrHistogram/hdrhistogram-go v0.9.0 // indirect github.com/JalfResi/justext v0.0.0-20221106200834-be571e3e3052 // indirect - github.com/PuerkitoBio/goquery v1.8.0 // indirect - github.com/RoaringBitmap/roaring v1.2.1 // indirect + github.com/PuerkitoBio/goquery v1.8.1 // indirect + github.com/RoaringBitmap/roaring v1.2.3 // indirect github.com/advancedlogic/GoOse v0.0.0-20210820140952-9d5822d4a625 // indirect - github.com/andybalholm/brotli v1.0.4 // indirect + github.com/andybalholm/brotli v1.0.5 // indirect github.com/andybalholm/cascadia v1.3.1 // indirect github.com/araddon/dateparse v0.0.0-20210429162001-6b43995a97de // indirect github.com/aymerick/douceur v0.2.0 // indirect github.com/beorn7/perks v1.0.1 // indirect - github.com/bits-and-blooms/bitset v1.4.0 // indirect + github.com/bits-and-blooms/bitset v1.5.0 // indirect github.com/bits-and-blooms/bloom/v3 v3.3.1 // indirect github.com/blevesearch/bleve_index_api v1.0.5 // indirect github.com/blevesearch/geo v0.1.17 // indirect @@ -116,20 +116,19 @@ require ( github.com/blevesearch/zapx/v12 v12.3.7 // indirect github.com/blevesearch/zapx/v13 v13.3.7 // indirect github.com/blevesearch/zapx/v14 v14.3.7 // indirect - github.com/blevesearch/zapx/v15 v15.3.8 // indirect + github.com/blevesearch/zapx/v15 v15.3.9 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect github.com/dsnet/compress v0.0.2-0.20210315054119-f66993602bf5 // indirect - github.com/dustin/go-humanize v1.0.0 // indirect - github.com/fatih/color v1.13.0 // indirect + github.com/dustin/go-humanize v1.0.1 // indirect + github.com/fatih/color v1.15.0 // indirect github.com/fatih/set v0.2.1 // indirect github.com/felixge/httpsnoop v1.0.3 // indirect github.com/gigawattio/window v0.0.0-20180317192513-0f5467e35573 // indirect github.com/go-asn1-ber/asn1-ber v1.5.4 // indirect - github.com/go-redis/redis/v8 v8.11.5 // indirect github.com/go-resty/resty/v2 v2.7.0 // indirect - github.com/golang/geo v0.0.0-20210211234256-740aa86cb551 // indirect - github.com/golang/protobuf v1.5.2 // indirect + github.com/golang/geo v0.0.0-20230404232722-c4acd7a044dc // indirect + github.com/golang/protobuf v1.5.3 // indirect github.com/golang/snappy v0.0.4 // indirect github.com/gomodule/redigo v2.0.0+incompatible // indirect github.com/google/uuid v1.3.0 // indirect @@ -142,18 +141,17 @@ require ( github.com/jmespath/go-jmespath v0.4.0 // indirect github.com/json-iterator/go v1.1.12 // indirect github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect - github.com/klauspost/compress v1.15.14 // indirect - github.com/klauspost/cpuid/v2 v2.2.3 // indirect + github.com/klauspost/compress v1.16.4 // indirect + github.com/klauspost/cpuid/v2 v2.2.4 // indirect github.com/klauspost/pgzip v1.2.5 // indirect github.com/lann/builder v0.0.0-20180802200727-47ae307949d0 // indirect github.com/lann/ps v0.0.0-20150810152359-62de8c46ede0 // indirect github.com/levigross/exp-html v0.0.0-20120902181939-8df60c69a8f5 // indirect - github.com/magiconair/properties v1.8.6 // indirect + github.com/magiconair/properties v1.8.7 // indirect github.com/mattn/go-colorable v0.1.13 // indirect - github.com/mattn/go-isatty v0.0.17 // indirect + github.com/mattn/go-isatty v0.0.18 // indirect github.com/mattn/go-runewidth v0.0.14 // indirect - github.com/mattn/go-sqlite3 v2.0.3+incompatible // indirect - github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect + github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect github.com/minio/md5-simd v1.1.2 // indirect github.com/minio/sha256-simd v1.0.0 // indirect github.com/mitchellh/go-testing-interface v1.14.1 // indirect @@ -164,26 +162,28 @@ require ( github.com/olekukonko/tablewriter v0.0.5 // indirect github.com/otiai10/gosseract/v2 v2.4.0 // indirect github.com/pelletier/go-toml v1.9.5 // indirect + github.com/pelletier/go-toml/v2 v2.0.7 // indirect github.com/philhofer/fwd v1.1.2 // indirect github.com/pierrec/lz4/v4 v4.1.17 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - github.com/prometheus/client_model v0.2.0 // indirect - github.com/prometheus/common v0.33.0 // indirect - github.com/prometheus/procfs v0.7.3 // indirect - github.com/remyoudompheng/bigfft v0.0.0-20220927061507-ef77025ab5aa // indirect + github.com/prometheus/client_model v0.3.0 // indirect + github.com/prometheus/common v0.42.0 // indirect + github.com/prometheus/procfs v0.9.0 // indirect + github.com/redis/go-redis/v9 v9.0.3 // indirect + github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect github.com/richardlehane/mscfb v1.0.4 // indirect github.com/richardlehane/msoleps v1.0.3 // indirect github.com/rs/xid v1.4.0 // indirect github.com/segmentio/backo-go v1.0.1 // indirect - github.com/spf13/afero v1.8.2 // indirect - github.com/spf13/cast v1.4.1 // indirect + github.com/spf13/afero v1.9.5 // indirect + github.com/spf13/cast v1.5.0 // indirect github.com/spf13/jwalterweatherman v1.1.0 // indirect github.com/spf13/pflag v1.0.5 // indirect - github.com/splitio/go-split-commons/v4 v4.2.3 // indirect - github.com/splitio/go-toolkit/v5 v5.2.2 // indirect + github.com/splitio/go-split-commons/v4 v4.3.1 // indirect + github.com/splitio/go-toolkit/v5 v5.3.0 // indirect github.com/ssor/bom v0.0.0-20170718123548-6386211fdfcf // indirect github.com/stretchr/objx v0.5.0 // indirect - github.com/subosito/gotenv v1.2.0 // indirect + github.com/subosito/gotenv v1.4.2 // indirect github.com/tidwall/gjson v1.14.4 // indirect github.com/tidwall/match v1.1.1 // indirect github.com/tidwall/pretty v1.2.1 // indirect @@ -191,25 +191,25 @@ require ( github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect github.com/wiggin77/srslog v1.0.1 // indirect github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8 // indirect - go.etcd.io/bbolt v1.3.6 // indirect + go.etcd.io/bbolt v1.3.7 // indirect go.uber.org/atomic v1.10.0 // indirect - golang.org/x/mod v0.8.0 // indirect - golang.org/x/sys v0.6.0 // indirect + golang.org/x/mod v0.10.0 // indirect + golang.org/x/sys v0.7.0 // indirect google.golang.org/appengine v1.6.7 // indirect - google.golang.org/genproto v0.0.0-20230104163317-caabf589fcbf // indirect - google.golang.org/grpc v1.51.0 // indirect - google.golang.org/protobuf v1.28.1 // indirect + google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 // indirect + google.golang.org/grpc v1.54.0 // indirect + google.golang.org/protobuf v1.30.0 // indirect gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc // indirect gopkg.in/ini.v1 v1.67.0 // indirect - gopkg.in/natefinch/lumberjack.v2 v2.0.0 // indirect - lukechampine.com/uint128 v1.2.0 // indirect + gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect + lukechampine.com/uint128 v1.3.0 // indirect modernc.org/cc/v3 v3.40.0 // indirect modernc.org/ccgo/v3 v3.16.13 // indirect - modernc.org/libc v1.22.2 // indirect + modernc.org/libc v1.22.3 // indirect modernc.org/mathutil v1.5.0 // indirect modernc.org/memory v1.5.0 // indirect modernc.org/opt v0.1.3 // indirect - modernc.org/sqlite v1.20.1 // indirect + modernc.org/sqlite v1.21.1 // indirect modernc.org/strutil v1.1.3 // indirect modernc.org/token v1.1.0 // indirect ) diff --git a/go.sum b/server/go.sum similarity index 95% rename from go.sum rename to server/go.sum index 852b686451..67c290126e 100644 --- a/go.sum +++ b/server/go.sum @@ -87,7 +87,6 @@ github.com/Azure/go-autorest/logger v0.2.0/go.mod h1:T9E3cAhj2VqvPOtCYAvby9aBXkZ github.com/Azure/go-autorest/logger v0.2.1/go.mod h1:T9E3cAhj2VqvPOtCYAvby9aBXkZmbF5NWuPV8+WeEW8= github.com/Azure/go-autorest/tracing v0.6.0/go.mod h1:+vhtPC754Xsa23ID7GlGsrdKBpUA79WCAKPPZVC2DeU= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/BurntSushi/toml v1.2.0 h1:Rt8g24XnyGTyglgET/PRUNlrUeu9F5L+7FilkXfZgs0= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/ClickHouse/clickhouse-go v1.4.3/go.mod h1:EaI/sW7Azgz9UATzd5ZdZHRUhHgv5+JMS9NSr2smCJI= github.com/HdrHistogram/hdrhistogram-go v0.9.0 h1:dpujRju0R4M/QZzcnR1LH1qm+TVG3UzkWdp5tH1WMcg= @@ -95,10 +94,10 @@ github.com/HdrHistogram/hdrhistogram-go v0.9.0/go.mod h1:nxrse8/Tzg2tg3DZcZjm6qE github.com/JalfResi/justext v0.0.0-20170829062021-c0282dea7198/go.mod h1:0SURuH1rsE8aVWvutuMZghRNrNrYEUzibzJfhEYR8L0= github.com/JalfResi/justext v0.0.0-20221106200834-be571e3e3052 h1:8T2zMbhLBbH9514PIQVHdsGhypMrsB4CxwbldKA9sBA= github.com/JalfResi/justext v0.0.0-20221106200834-be571e3e3052/go.mod h1:0SURuH1rsE8aVWvutuMZghRNrNrYEUzibzJfhEYR8L0= -github.com/Masterminds/semver/v3 v3.2.0 h1:3MEsd0SM6jqZojhjLWWeBY+Kcjy9i6MQAeY7YgDP83g= -github.com/Masterminds/semver/v3 v3.2.0/go.mod h1:qvl/7zhW3nngYb5+80sSMF+FG2BjYrf8m9wsX0PNOMQ= -github.com/Masterminds/squirrel v1.5.3 h1:YPpoceAcxuzIljlr5iWpNKaql7hLeG1KLSrhvdHpkZc= -github.com/Masterminds/squirrel v1.5.3/go.mod h1:NNaOrjSoIDfDA40n7sr2tPNZRfjzjA400rg+riTZj10= +github.com/Masterminds/semver/v3 v3.2.1 h1:RN9w6+7QoMeJVGyfmbcgs28Br8cvmnucEXnY0rYXWg0= +github.com/Masterminds/semver/v3 v3.2.1/go.mod h1:qvl/7zhW3nngYb5+80sSMF+FG2BjYrf8m9wsX0PNOMQ= +github.com/Masterminds/squirrel v1.5.4 h1:uUcX/aBc8O7Fg9kaISIUsHXdKuqehiXAMQTYX8afzqM= +github.com/Masterminds/squirrel v1.5.4/go.mod h1:NNaOrjSoIDfDA40n7sr2tPNZRfjzjA400rg+riTZj10= github.com/Microsoft/go-winio v0.4.11/go.mod h1:VhR8bwka0BXejwEJY73c50VrPtXAaKcyvVC4A4RozmA= github.com/Microsoft/go-winio v0.4.14/go.mod h1:qXqCSQ3Xa7+6tgxaGTIe4Kpcdsi+P8jBhyzoq1bpyYA= github.com/Microsoft/go-winio v0.4.15-0.20190919025122-fc70bd9a86b5/go.mod h1:tTuCMEN+UleMWgg9dVx4Hu52b1bJo+59jBh3ajtinzw= @@ -127,14 +126,14 @@ github.com/NYTimes/gziphandler v1.1.1/go.mod h1:n/CVRwUEOgIxrgPvAQhUUr9oeUtvrhMo github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/PuerkitoBio/goquery v1.4.1/go.mod h1:T9ezsOHcCrDCgA8aF1Cqr3sSYbO/xgdy8/R/XiIMAhA= github.com/PuerkitoBio/goquery v1.5.1/go.mod h1:GsLWisAFVj4WgDibEWF4pvYnkVQBpKBKeU+7zCJoLcc= -github.com/PuerkitoBio/goquery v1.8.0 h1:PJTF7AmFCFKk1N6V6jmKfrNH9tV5pNE6lZMkG0gta/U= -github.com/PuerkitoBio/goquery v1.8.0/go.mod h1:ypIiRMtY7COPGk+I/YbZLbxsxn9g5ejnI2HSMtkjZvI= +github.com/PuerkitoBio/goquery v1.8.1 h1:uQxhNlArOIdbrH1tr0UXwdVFgDcZDrZVdcpygAcwmWM= +github.com/PuerkitoBio/goquery v1.8.1/go.mod h1:Q8ICL1kNUJ2sXGoAhPGUdYDJvgQgHzJsnnd3H7Ho5jQ= github.com/PuerkitoBio/purell v1.0.0/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= github.com/PuerkitoBio/urlesc v0.0.0-20160726150825-5bd2802263f2/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE= github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE= -github.com/RoaringBitmap/roaring v1.2.1 h1:58/LJlg/81wfEHd5L9qsHduznOIhyv4qb1yWcSvVq9A= -github.com/RoaringBitmap/roaring v1.2.1/go.mod h1:icnadbWcNyfEHlYdr+tDlOTih1Bf/h+rzPpv4sbomAA= +github.com/RoaringBitmap/roaring v1.2.3 h1:yqreLINqIrX22ErkKI0vY47/ivtJr6n+kMhVOVmhWBY= +github.com/RoaringBitmap/roaring v1.2.3/go.mod h1:plvDsJQpxOC5bw8LRteu/MLWHsHez/3y6cubLI4/1yE= github.com/Shopify/logrus-bugsnag v0.0.0-20171204204709-577dee27f20d/go.mod h1:HI8ITrYtUY+O+ZhtlqUnD8+KwNPOyugEhfP9fdUIaEQ= github.com/advancedlogic/GoOse v0.0.0-20191112112754-e742535969c1/go.mod h1:f3HCSN1fBWjcpGtXyM119MJgeQl838v6so/PQOqvE1w= github.com/advancedlogic/GoOse v0.0.0-20210820140952-9d5822d4a625 h1:LZIP5Bj5poWWRZ8fcL4ZwCupb4FwcTFK2RCTxkGnCX8= @@ -148,8 +147,8 @@ github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk5 github.com/alexflint/go-filemutex v0.0.0-20171022225611-72bdc8eae2ae/go.mod h1:CgnQgUtFrFz9mxFNtED3jI5tLDjKlOM+oUF/sTk6ps0= github.com/alexflint/go-filemutex v1.1.0/go.mod h1:7P4iRhttt/nUvUOrYIhcpMzv2G6CY9UnI16Z+UJqRyk= github.com/andybalholm/brotli v1.0.1/go.mod h1:loMXtMfwqflxFJPmdbJO0a3KNoPuLBgiu3qAvBg8x/Y= -github.com/andybalholm/brotli v1.0.4 h1:V7DdXeJtZscaqfNuAdSRuRFzuiKlHSC/Zh3zl9qY3JY= -github.com/andybalholm/brotli v1.0.4/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig= +github.com/andybalholm/brotli v1.0.5 h1:8uQZIdzKmjc/iuPu7O2ioW48L81FgatrcpfFmiq/cCs= +github.com/andybalholm/brotli v1.0.5/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig= github.com/andybalholm/cascadia v1.0.0/go.mod h1:GsXiBklL0woXo1j/WYWtSYYC4ouU9PqHO0sqidkEA4Y= github.com/andybalholm/cascadia v1.1.0/go.mod h1:GsXiBklL0woXo1j/WYWtSYYC4ouU9PqHO0sqidkEA4Y= github.com/andybalholm/cascadia v1.2.0/go.mod h1:YCyR8vOZT9aZ1CHEd8ap0gMVm2aFgxBp0T0eFw1RUQY= @@ -172,8 +171,8 @@ github.com/avct/uasurfer v0.0.0-20191028135549-26b5daa857f1 h1:9h8f71kuF1pqovnn9 github.com/avct/uasurfer v0.0.0-20191028135549-26b5daa857f1/go.mod h1:noBAuukeYOXa0aXGqxr24tADqkwDO2KRD15FsuaZ5a8= github.com/aws/aws-sdk-go v1.15.11/go.mod h1:mFuSZ37Z9YOHbQEwBWztmVzqXrEkub65tZoCYDt7FT0= github.com/aws/aws-sdk-go v1.17.7/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= -github.com/aws/aws-sdk-go v1.44.173 h1:8kXIxvQnBpGhmR3Eof6SnCKgR0q5/L/3Qbv9vAC5wic= -github.com/aws/aws-sdk-go v1.44.173/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI= +github.com/aws/aws-sdk-go v1.44.240 h1:38f1qBTuzotDC6bgSNLw1vrrYaoWL8MNNzwTsGjP6TY= +github.com/aws/aws-sdk-go v1.44.240/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI= github.com/aws/aws-sdk-go-v2 v1.8.0/go.mod h1:xEFuWz+3TYdlPRuo+CqATbeDWIWyaT5uAPwPaWtgse0= github.com/aws/aws-sdk-go-v2 v1.9.2/go.mod h1:cK/D0BBs0b/oWPIcX/Z/obahJK1TT7IPVjy53i/mX/4= github.com/aws/aws-sdk-go-v2/config v1.6.0/go.mod h1:TNtBVmka80lRPk5+S9ZqVfFszOQAGJJ9KbT3EM3CHNU= @@ -213,8 +212,8 @@ github.com/bitly/go-hostpool v0.0.0-20171023180738-a3a6125de932/go.mod h1:NOuUCS github.com/bitly/go-simplejson v0.5.0/go.mod h1:cXHtHw4XUPsvGaxgjIAn8PhEWG9NfngEKAMDJEczWVA= github.com/bits-and-blooms/bitset v1.2.0/go.mod h1:gIdJ4wp64HaoK2YrL1Q5/N7Y16edYb8uY+O0FJTyyDA= github.com/bits-and-blooms/bitset v1.3.1/go.mod h1:gIdJ4wp64HaoK2YrL1Q5/N7Y16edYb8uY+O0FJTyyDA= -github.com/bits-and-blooms/bitset v1.4.0 h1:+YZ8ePm+He2pU3dZlIZiOeAKfrBkXi1lSrXJ/Xzgbu8= -github.com/bits-and-blooms/bitset v1.4.0/go.mod h1:gIdJ4wp64HaoK2YrL1Q5/N7Y16edYb8uY+O0FJTyyDA= +github.com/bits-and-blooms/bitset v1.5.0 h1:NpE8frKRLGHIcEzkR+gZhiioW1+WbYV6fKwD6ZIpQT8= +github.com/bits-and-blooms/bitset v1.5.0/go.mod h1:gIdJ4wp64HaoK2YrL1Q5/N7Y16edYb8uY+O0FJTyyDA= github.com/bits-and-blooms/bloom/v3 v3.3.1 h1:K2+A19bXT8gJR5mU7y+1yW6hsKfNCjcP2uNfLFKncjQ= github.com/bits-and-blooms/bloom/v3 v3.3.1/go.mod h1:bhUUknWd5khVbTe4UgMCSiOOVJzr3tMoijSK3WwvW90= github.com/bkaradzic/go-lz4 v1.0.0/go.mod h1:0YdlkowM3VswSROI7qDxhRvJ3sLhlFrRRwjwegp5jy4= @@ -222,8 +221,8 @@ github.com/bketelsen/crypt v0.0.3-0.20200106085610-5cbc8cc4026c/go.mod h1:MKsuJm github.com/blang/semver v3.1.0+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk= github.com/blang/semver v3.5.1+incompatible h1:cQNTCjp13qL8KC3Nbxr/y2Bqb63oX6wdnnjpJbkM4JQ= github.com/blang/semver v3.5.1+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk= -github.com/blevesearch/bleve/v2 v2.3.6 h1:NlntUHcV5CSWIhpugx4d/BRMGCiaoI8ZZXrXlahzNq4= -github.com/blevesearch/bleve/v2 v2.3.6/go.mod h1:JM2legf1cKVkdV8Ehu7msKIOKC0McSw0Q16Fmv9vsW4= +github.com/blevesearch/bleve/v2 v2.3.7 h1:nIfIrhv28tvgBpbVF8Dq7/U1zW/YiwSqg/PBgE3x8bo= +github.com/blevesearch/bleve/v2 v2.3.7/go.mod h1:2tToYD6mDeseIA13jcZiEEqYrVLg6xdk0v6+F7dWquU= github.com/blevesearch/bleve_index_api v1.0.5 h1:Lc986kpC4Z0/n1g3gg8ul7H+lxgOQPcXb9SxvQGu+tw= github.com/blevesearch/bleve_index_api v1.0.5/go.mod h1:YXMDwaXFFXwncRS8UobWs7nvo0DmusriM1nztTlj1ms= github.com/blevesearch/geo v0.1.17 h1:AguzI6/5mHXapzB0gE9IKWo+wWPHZmXZoscHcjFgAFA= @@ -252,13 +251,15 @@ github.com/blevesearch/zapx/v13 v13.3.7 h1:igIQg5eKmjw168I7av0Vtwedf7kHnQro/M+ub github.com/blevesearch/zapx/v13 v13.3.7/go.mod h1:yyrB4kJ0OT75UPZwT/zS+Ru0/jYKorCOOSY5dBzAy+s= github.com/blevesearch/zapx/v14 v14.3.7 h1:gfe+fbWslDWP/evHLtp/GOvmNM3sw1BbqD7LhycBX20= github.com/blevesearch/zapx/v14 v14.3.7/go.mod h1:9J/RbOkqZ1KSjmkOes03AkETX7hrXT0sFMpWH4ewC4w= -github.com/blevesearch/zapx/v15 v15.3.8 h1:q4uMngBHzL1IIhRc8AJUEkj6dGOE3u1l3phLu7hq8uk= -github.com/blevesearch/zapx/v15 v15.3.8/go.mod h1:m7Y6m8soYUvS7MjN9eKlz1xrLCcmqfFadmu7GhWIrLY= +github.com/blevesearch/zapx/v15 v15.3.9 h1:/s9zqKxFaZKQTTcMO2b/Tup0ch5MSztlvw+frVDfIBk= +github.com/blevesearch/zapx/v15 v15.3.9/go.mod h1:m7Y6m8soYUvS7MjN9eKlz1xrLCcmqfFadmu7GhWIrLY= github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869 h1:DDGfHa7BWjL4YnC6+E63dPcxHo2sUxDIu8g3QgEJdRY= github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869/go.mod h1:Ekp36dRnpXw/yCqJaO+ZrUyxD+3VXMFFr56k5XYrpB4= github.com/boombuler/barcode v1.0.0/go.mod h1:paBWMcWSl3LHKBqUq+rly7CNSldXjb2rDl3JlRe0mD8= github.com/bradfitz/go-smtpd v0.0.0-20170404230938-deb6d6237625/go.mod h1:HYsPBTaaSFSlLx/70C2HPIMNZpVV8+vt/A+FMnYP11g= github.com/bshuster-repo/logrus-logstash-hook v0.4.1/go.mod h1:zsTqEiSzDgAa/8GZR7E1qaXrhYNDKBYy5/dWPTIflbk= +github.com/bsm/ginkgo/v2 v2.7.0 h1:ItPMPH90RbmZJt5GtkcNvIRuGEdwlBItdNVoyzaNQao= +github.com/bsm/gomega v1.26.0 h1:LhQm+AFcgV2M0WyKroMASzAzCAJVpAxQXv4SaI9a69Y= github.com/buger/jsonparser v0.0.0-20180808090653-f4dd9f5a6b44/go.mod h1:bbYlZJ7hK1yFx9hf58LP0zeX7UjIGs20ufpu3evjr+s= github.com/buger/jsonparser v0.0.0-20181115193947-bf1c66bbce23/go.mod h1:bbYlZJ7hK1yFx9hf58LP0zeX7UjIGs20ufpu3evjr+s= github.com/buger/jsonparser v1.1.1/go.mod h1:6RYKKt7H4d4+iWqouImQ9R2FZql3VbhNgx27UK13J/0= @@ -473,8 +474,9 @@ github.com/dsnet/compress v0.0.2-0.20210315054119-f66993602bf5 h1:iFaUwBSo5Svw6L github.com/dsnet/compress v0.0.2-0.20210315054119-f66993602bf5/go.mod h1:qssHWj60/X5sZFNxpG4HBPDHVqxNm4DfnCKgrbZOT+s= github.com/dsnet/golib v0.0.0-20171103203638-1ea166775780/go.mod h1:Lj+Z9rebOhdfkVLjJ8T6VcRQv3SXugXy999NBtR9aFY= github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= -github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo= github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= +github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY= +github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto= github.com/dyatlov/go-opengraph/opengraph v0.0.0-20220524092352-606d7b1e5f8a h1:etIrTD8BQqzColk9nKRusM9um5+1q0iOEJLqfBMIK64= github.com/dyatlov/go-opengraph/opengraph v0.0.0-20220524092352-606d7b1e5f8a/go.mod h1:emQhSYTXqB0xxjLITTw4EaWZ+8IIQYw+kx9GqNUKdLg= github.com/edsrzf/mmap-go v0.0.0-20170320065105-0bce6a688712/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= @@ -496,8 +498,9 @@ github.com/evanphx/json-patch v4.9.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLi github.com/evanphx/json-patch v4.11.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fatih/color v1.10.0/go.mod h1:ELkj/draVOlAH/xkhN6mQ50Qd0MPOk5AAr3maGEBuJM= -github.com/fatih/color v1.13.0 h1:8LOYc1KYPPmyKMuN8QV2DNRWNbLo6LZ0iLs8+mlH53w= github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= +github.com/fatih/color v1.15.0 h1:kOqh6YHBtK8aywxGerMG2Eq3H6Qgoqeo13Bk2Mv/nBs= +github.com/fatih/color v1.15.0/go.mod h1:0h5ZqXfHYED7Bhv2ZJamyIOUej9KtShiJESRwBDUSsw= github.com/fatih/set v0.2.1 h1:nn2CaJyknWE/6txyUDGwysr3G5QC6xWB/PtVjPBbeaA= github.com/fatih/set v0.2.1/go.mod h1:+RKtMCH+favT2+3YecHGxcc0b4KyVWA1QWWJUs4E0CI= github.com/felixge/httpsnoop v1.0.1/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= @@ -512,6 +515,7 @@ github.com/form3tech-oss/jwt-go v3.2.5+incompatible/go.mod h1:pbq4aXjuKjdthFRnoD github.com/francoispqt/gojay v1.2.13 h1:d2m3sFjloqoIUQU3TsHBgj6qg/BVGlTBeHDUmyJnXKk= github.com/francoispqt/gojay v1.2.13/go.mod h1:ehT5mTG4ua4581f1++1WLG0vPdaA9HaiDsoyrBGkyDY= github.com/frankban/quicktest v1.11.3/go.mod h1:wRf/ReqHper53s+kmmSZizM8NamnL3IM0I9ntUbOk+k= +github.com/frankban/quicktest v1.14.3 h1:FJKSZTDHjyhriyC81FLQ0LY93eSai0ZyR/ZIkd3ZUKE= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY= @@ -522,8 +526,8 @@ github.com/gabriel-vasile/mimetype v1.3.1/go.mod h1:fA8fi6KUiG7MgQQ+mEWotXoEOvmx github.com/gabriel-vasile/mimetype v1.4.0/go.mod h1:fA8fi6KUiG7MgQQ+mEWotXoEOvmxRtOJlERCzSmRvr8= github.com/garyburd/redigo v0.0.0-20150301180006-535138d7bcd7/go.mod h1:NR3MbYisc3/PwhQ00EMzDiPmrwpPxAn5GI05/YaO1SY= github.com/getsentry/raven-go v0.2.0/go.mod h1:KungGk8q33+aIAZUIVWZDr2OfAEBsO49PX4NzFV5kcQ= -github.com/getsentry/sentry-go v0.16.0 h1:owk+S+5XcgJLlGR/3+3s6N4d+uKwqYvh/eS0AIMjPWo= -github.com/getsentry/sentry-go v0.16.0/go.mod h1:ZXCloQLj0pG7mja5NK6NPf2V4A88YJ4pNlc2mOHwh6Y= +github.com/getsentry/sentry-go v0.20.0 h1:bwXW98iMRIWxn+4FgPW7vMrjmbym6HblXALmhjHmQaQ= +github.com/getsentry/sentry-go v0.20.0/go.mod h1:lc76E2QywIyW8WuBnwl8Lc4bkmQH4+w1gwTf25trprY= github.com/ghodss/yaml v0.0.0-20150909031657-73d445a93680/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/gigawattio/window v0.0.0-20180317192513-0f5467e35573 h1:u8AQ9bPa9oC+8/A/jlWouakhIvkFfuxgIIRjiy8av7I= @@ -545,12 +549,10 @@ github.com/go-ini/ini v1.25.4/go.mod h1:ByCAeIL28uOIIG0E3PJtZPDL8WnHpFKFOtgjp+3I github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY= -github.com/go-kit/log v0.2.0/go.mod h1:NwTd00d/i8cPZ3xOwwiv2PO5MOcx78fFErGNcVmBjv0= github.com/go-latex/latex v0.0.0-20210118124228-b3d85cf34e07/go.mod h1:CO1AlKB2CSIqUrmQPqA0gdRIlnLEY0gK5JGjh37zN5U= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= -github.com/go-logfmt/logfmt v0.5.1/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs= github.com/go-logr/logr v0.1.0/go.mod h1:ixOQHD9gLJUVQQ2ZOR7zLEifBX6tGkNJF4QyIY7sIas= github.com/go-logr/logr v0.2.0/go.mod h1:z6/tIYblkpsD+a4lm/fGIIU9mZ+XfAiaFtq7xTgseGU= github.com/go-logr/logr v0.4.0/go.mod h1:z6/tIYblkpsD+a4lm/fGIIU9mZ+XfAiaFtq7xTgseGU= @@ -574,8 +576,6 @@ github.com/go-openapi/swag v0.0.0-20160704191624-1d0bd113de87/go.mod h1:DXUve3Dp github.com/go-openapi/swag v0.19.2/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= github.com/go-openapi/swag v0.19.14/go.mod h1:QYRuS/SOXUCsnplDa677K7+DxSOj6IPNl/eQntq43wQ= -github.com/go-redis/redis/v8 v8.11.5 h1:AcZZR7igkdvfVmQTPnu9WE37LRrO/YrBH5zWyjDC0oI= -github.com/go-redis/redis/v8 v8.11.5/go.mod h1:gREzHqY1hg6oD9ngVRbLStwAWKhA0FEgq8Jd4h5lpwo= github.com/go-resty/resty/v2 v2.0.0/go.mod h1:dZGr0i9PLlaaTD4H/hoZIDjQ+r6xq8mgbRzHZf7f2J8= github.com/go-resty/resty/v2 v2.3.0/go.mod h1:UpN9CgLZNsv4e9XG50UU8xdI0F43UQ4HmxLBDwaroHU= github.com/go-resty/resty/v2 v2.7.0 h1:me+K9p3uhSmXtrBZ4k9jcEAfJmuC8IivWHwaLZwPrFY= @@ -636,8 +636,8 @@ github.com/golang-migrate/migrate/v4 v4.15.2/go.mod h1:f2toGLkYqD3JH+Todi4aZ2Zdb github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe/go.mod h1:8vg3r2VgvsThLBIFL93Qb5yWzgyZWhEmBwUJWevAkK0= github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 h1:DACJavvAHhabrF08vX0COfcOBJRhZ8lUbR+ZWIs0Y5g= github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k= -github.com/golang/geo v0.0.0-20210211234256-740aa86cb551 h1:gtexQ/VGyN+VVFRXSFiguSNcXmS6rkKT+X7FdIrTtfo= -github.com/golang/geo v0.0.0-20210211234256-740aa86cb551/go.mod h1:QZ0nwyI2jOfgRAoBvP+ab5aRr7c9x7lhGEJrKvBwjWI= +github.com/golang/geo v0.0.0-20230404232722-c4acd7a044dc h1:WkAZHSmcnJhZyutVoVXe7lDSQBbISxITcm57tYf22PE= +github.com/golang/geo v0.0.0-20230404232722-c4acd7a044dc/go.mod h1:8wI0hitZ3a1IxZfeH3/5I97CI8i5cLGsYe7xNhQGs9U= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= @@ -673,8 +673,9 @@ github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.1/go.mod h1:DopwsBzvsk0Fs44TXzsVbJyPhcCPeIwnvohx4u74HPM= -github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= +github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/golang/snappy v0.0.0-20170215233205-553a64147049/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.2/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= @@ -726,7 +727,6 @@ github.com/google/pprof v0.0.0-20201203190320-1bf35d6f28c2/go.mod h1:kpwsk12EmLe github.com/google/pprof v0.0.0-20201218002935-b9804c9f04c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20210122040257-d980be63207e/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20210226084205-cbba55b83ad5/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20210601050228-01bbb1931b22/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20210609004039-a478d1d731e9/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= @@ -794,16 +794,16 @@ github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brv github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I= github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= -github.com/hashicorp/go-hclog v1.4.0 h1:ctuWFGrhFha8BnnzxqeRGidlEcQkDyL5u8J8t5eA11I= -github.com/hashicorp/go-hclog v1.4.0/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M= +github.com/hashicorp/go-hclog v1.5.0 h1:bI2ocEMgcVlz55Oj1xZNBsVi900c7II+fWDyV9o+13c= +github.com/hashicorp/go-hclog v1.5.0/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M= github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM= github.com/hashicorp/go-multierror v0.0.0-20161216184304-ed905158d874/go.mod h1:JMRHfdO9jKNzS/+BTlxCjKNQHg/jZAft8U7LloJvN7I= github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo= github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM= -github.com/hashicorp/go-plugin v1.4.8 h1:CHGwpxYDOttQOY7HOWgETU9dyVjOXzniXDqJcYJE1zM= -github.com/hashicorp/go-plugin v1.4.8/go.mod h1:viDMjcLJuDui6pXb8U4HVfb8AamCWhHGUjr2IrTF67s= +github.com/hashicorp/go-plugin v1.4.9 h1:ESiK220/qE0aGxWdzKIvRH69iLiuN/PjoLTm69RoWtU= +github.com/hashicorp/go-plugin v1.4.9/go.mod h1:viDMjcLJuDui6pXb8U4HVfb8AamCWhHGUjr2IrTF67s= github.com/hashicorp/go-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU= github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU= github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4= @@ -832,7 +832,6 @@ github.com/imdario/mergo v0.3.10/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH github.com/imdario/mergo v0.3.11/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= github.com/imdario/mergo v0.3.12/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= -github.com/inconshreveable/mousetrap v1.0.1/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/intel/goresctrl v0.2.0/go.mod h1:+CZdzouYFn5EsxgqAQTEzMfwKwuc0fVdMrT9FCCAVRQ= @@ -883,8 +882,8 @@ github.com/jackc/puddle v1.1.1/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dv github.com/jackc/puddle v1.1.3/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= github.com/jaytaylor/html2text v0.0.0-20180606194806-57d518f124b0/go.mod h1:CVKlgaMiht+LXvHG173ujK6JUhZXKb2u/BQtjPDIvyk= github.com/jaytaylor/html2text v0.0.0-20200412013138-3577fbdbcff7/go.mod h1:CVKlgaMiht+LXvHG173ujK6JUhZXKb2u/BQtjPDIvyk= -github.com/jaytaylor/html2text v0.0.0-20211105163654-bc68cce691ba h1:QFQpJdgbON7I0jr2hYW7Bs+XV0qjc3d5tZoDnRFnqTg= -github.com/jaytaylor/html2text v0.0.0-20211105163654-bc68cce691ba/go.mod h1:CVKlgaMiht+LXvHG173ujK6JUhZXKb2u/BQtjPDIvyk= +github.com/jaytaylor/html2text v0.0.0-20230321000545-74c2419ad056 h1:iCHtR9CQyktQ5+f3dMVZfwD2KWJUgm7M0gdL9NGr8KA= +github.com/jaytaylor/html2text v0.0.0-20230321000545-74c2419ad056/go.mod h1:CVKlgaMiht+LXvHG173ujK6JUhZXKb2u/BQtjPDIvyk= github.com/jellevandenhooff/dkim v0.0.0-20150330215556-f50fe3d243e1/go.mod h1:E0B/fFc00Y+Rasa88328GlI/XbtyysCtTHZS8h7IrBU= github.com/jhump/protoreflect v1.6.0 h1:h5jfMVslIg6l29nsMs0D8Wj17RDVdNYti0vDN/PZZoE= github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc= @@ -938,13 +937,13 @@ github.com/klauspost/compress v1.11.13/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdY github.com/klauspost/compress v1.13.1/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8eO+e+Dq5Gzg= github.com/klauspost/compress v1.13.4/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8eO+e+Dq5Gzg= github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= -github.com/klauspost/compress v1.15.14 h1:i7WCKDToww0wA+9qrUZ1xOjp218vfFo3nTU6UHp+gOc= -github.com/klauspost/compress v1.15.14/go.mod h1:QPwzmACJjUTFsnSHH934V6woptycfrDDJnH7hvFVbGM= +github.com/klauspost/compress v1.16.4 h1:91KN02FnsOYhuunwU4ssRe8lc2JosWmizWa91B5v1PU= +github.com/klauspost/compress v1.16.4/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE= github.com/klauspost/cpuid v1.2.0/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= github.com/klauspost/cpuid/v2 v2.0.1/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= github.com/klauspost/cpuid/v2 v2.0.4/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= -github.com/klauspost/cpuid/v2 v2.2.3 h1:sxCkb+qR91z4vsqw4vGGZlDgPz3G7gjaLyK3V8y70BU= -github.com/klauspost/cpuid/v2 v2.2.3/go.mod h1:RVVoqg1df56z8g3pUjL/3lE5UfnlrJX8tyFgg4nqhuY= +github.com/klauspost/cpuid/v2 v2.2.4 h1:acbojRNwl3o09bUq+yDCtZFc1aiwaAAxtcn8YkZXnvk= +github.com/klauspost/cpuid/v2 v2.2.4/go.mod h1:RVVoqg1df56z8g3pUjL/3lE5UfnlrJX8tyFgg4nqhuY= github.com/klauspost/pgzip v1.2.5 h1:qnWYvvKqedOF2ulHpMG72XQol4ILEJ8k2wwRl/Km8oE= github.com/klauspost/pgzip v1.2.5/go.mod h1:Ch1tH69qFZu15pkjo5kYi6mth2Zzwzt50oCQKQE9RUs= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= @@ -954,8 +953,8 @@ github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= -github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI= github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= +github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/pty v1.1.3/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/pty v1.1.5/go.mod h1:9r2w37qlBe7rQ6e1fg1S/9xpWHSnaqNdHD3WcMdbPDA= @@ -987,8 +986,8 @@ github.com/lunixbochs/vtclean v1.0.0/go.mod h1:pHhQNgMf3btfWnGBVipUOjRYhoOsdGqdm github.com/lyft/protoc-gen-star v0.5.3/go.mod h1:V0xaHgaf5oCCqmcxYcWiDfTiKsZsRc87/1qhoTACD8w= github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= -github.com/magiconair/properties v1.8.6 h1:5ibWZ6iY0NctNGWo87LalDlEZ6R41TqbbDamhfG/Qzo= -github.com/magiconair/properties v1.8.6/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPKd5NZ3oSwXrF60= +github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY= +github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= github.com/mailru/easyjson v0.0.0-20160728113105-d5b7844b561a/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= github.com/mailru/easyjson v0.0.0-20190312143242-1de009706dbe/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= @@ -1032,8 +1031,8 @@ github.com/mattn/go-isatty v0.0.9/go.mod h1:YNRxwqDuOph6SZLI9vUUz6OYw3QyUt7WiY2y github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= -github.com/mattn/go-isatty v0.0.17 h1:BTarxUcIeDqL27Mc+vyvdWYSL28zpIhv3RoTdsLMPng= -github.com/mattn/go-isatty v0.0.17/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= +github.com/mattn/go-isatty v0.0.18 h1:DOKFKCQ7FNG2L1rbrmstDN4QVRdS89Nkh85u68Uwp98= +github.com/mattn/go-isatty v0.0.18/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= github.com/mattn/go-runewidth v0.0.3/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= github.com/mattn/go-runewidth v0.0.7/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= @@ -1048,25 +1047,25 @@ github.com/mattn/go-sqlite3 v1.9.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOq github.com/mattn/go-sqlite3 v1.14.6/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU= github.com/mattn/go-sqlite3 v1.14.10/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU= github.com/mattn/go-sqlite3 v1.14.12/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU= -github.com/mattn/go-sqlite3 v2.0.3+incompatible h1:gXHsfypPkaMZrKbD5209QV9jbUTJKjyR5WD3HYQSd+U= -github.com/mattn/go-sqlite3 v2.0.3+incompatible/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc= +github.com/mattn/go-sqlite3 v1.14.16 h1:yOQRA0RpS5PFz/oikGwBEqvAWhWg5ufRz4ETLjwpU1Y= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= -github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 h1:I0XW9+e1XWDxdcEniV4rQAIOPUGDq67JSCiRCgGCZLI= github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= +github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo= +github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= github.com/maxbrunsfeld/counterfeiter/v6 v6.2.2/go.mod h1:eD9eIE7cdwcMi9rYluz88Jz2VyhSmden33/aXg4oVIY= github.com/mgdelacroix/foundation v0.0.0-20220812143423-0bfc18f73538 h1:6mFhRD89wtsxh7g8V6og9DR4y/UGlzzehc1c3O9tbMQ= github.com/mgdelacroix/foundation v0.0.0-20220812143423-0bfc18f73538/go.mod h1:ZwobEfNHde7sU2pGybCWEnSlQ2r+MGrHGOKLphHZ42g= github.com/mholt/archiver/v3 v3.5.1 h1:rDjOBX9JSF5BvoJGvjqK479aL70qh9DIpZCl+k7Clwo= github.com/mholt/archiver/v3 v3.5.1/go.mod h1:e3dqJ7H78uzsRSEACH1joayhuSyhnonssnDhppzS1L4= github.com/microcosm-cc/bluemonday v1.0.1/go.mod h1:hsXNsILzKxV+sX77C5b8FSuKF00vh2OMYv+xgHpAMF4= -github.com/microcosm-cc/bluemonday v1.0.21 h1:dNH3e4PSyE4vNX+KlRGHT5KrSvjeUkoNPwEORjffHJg= -github.com/microcosm-cc/bluemonday v1.0.21/go.mod h1:ytNkv4RrDrLJ2pqlsSI46O6IVXmZOBBD4SaJyDwwTkM= +github.com/microcosm-cc/bluemonday v1.0.23 h1:SMZe2IGa0NuHvnVNAZ+6B38gsTbi5e4sViiWJyDDqFY= +github.com/microcosm-cc/bluemonday v1.0.23/go.mod h1:mN70sk7UkkF8TUr2IGBpNN0jAgStuPzlK76QuruE/z4= github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= github.com/miekg/pkcs11 v1.0.3/go.mod h1:XsNlhZGX73bx86s2hdc/FuaLm2CPZJemRLMA+WTFxgs= github.com/minio/md5-simd v1.1.2 h1:Gdi1DZK69+ZVMoNHRXJyNcxrMA4dSxoYHZSQbirFg34= github.com/minio/md5-simd v1.1.2/go.mod h1:MzdKDxYpY2BT9XQFocsiZf/NKVtR7nkE4RoEpN+20RM= -github.com/minio/minio-go/v7 v7.0.45 h1:g4IeM9M9pW/Lo8AGGNOjBZYlvmtlE1N5TQEYWXRWzIs= -github.com/minio/minio-go/v7 v7.0.45/go.mod h1:nCrRzjoSUQh8hgKKtu3Y708OLvRLtuASMg2/nvmbarw= +github.com/minio/minio-go/v7 v7.0.51 h1:eSewrwc23TqUDEH8aw8Bwp4f+JDdozRrPWcKR7DZhmY= +github.com/minio/minio-go/v7 v7.0.51/go.mod h1:IbbodHyjUAguneyucUaahv+VMNs/EOTV9du7A7/Z3HU= github.com/minio/sha256-simd v1.0.0 h1:v1ta+49hkWZyvaKwrQB8elexRqm6Y0aMLjCNsrYxo6g= github.com/minio/sha256-simd v1.0.0/go.mod h1:OuYzVNI5vcoYIAmbIvHPl3N3jUzVedXbKy5RFepssQM= github.com/mistifyio/go-zfs v2.1.2-0.20190413222219-f784269be439+incompatible/go.mod h1:8AuVvqP/mXw1px98n46wfvcGfQ4ci2FwoAjKYxuo3Z4= @@ -1081,8 +1080,8 @@ github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0Qu github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/mitchellh/mapstructure v0.0.0-20180220230111-00c29f56e238/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= -github.com/mitchellh/mapstructure v1.4.3 h1:OVowDSCllw/YjdLkam3/sm7wEtOy59d8ndGgCcyj8cs= -github.com/mitchellh/mapstructure v1.4.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= +github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/mitchellh/osext v0.0.0-20151018003038-5e2d6d41470f/go.mod h1:OkQIRizQZAeMln+1tSwduZz7+Af5oFlKirV/MSYes2A= github.com/moby/locker v1.0.1/go.mod h1:S7SDdo5zpBK84bzzVlKr2V0hz+7x9hWbYC/kq7oQppc= github.com/moby/spdystream v0.2.0/go.mod h1:f7i0iNDQJ059oMTcWxx8MA/zKFIuD/lY+0GqbN2Wy8c= @@ -1123,7 +1122,6 @@ github.com/nwaples/rardecode v1.1.0/go.mod h1:5DzqNKiOdpKKBH87u8VlvAnPZMXcGRhxWk github.com/nwaples/rardecode v1.1.3 h1:cWCaZwfM5H7nAD6PyEdcVnczzV8i/JtotnyW/dD9lEc= github.com/nwaples/rardecode v1.1.3/go.mod h1:5DzqNKiOdpKKBH87u8VlvAnPZMXcGRhxWkRpHbbfGS0= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= -github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= github.com/oklog/run v1.1.0 h1:GEenZ1cK0+q0+wsJew9qUg/DyD8k3JzYsZAi5gYi2mA= github.com/oklog/run v1.1.0/go.mod h1:sVPdnTZT1zYwAJeCMu2Th4T21pA3FPOQRfWjQlk7DVU= @@ -1145,9 +1143,6 @@ github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108 github.com/onsi/ginkgo v1.13.0/go.mod h1:+REjRxOmWfHCjfv9TTWB1jD1Frx4XydAD3zm1lskyM0= github.com/onsi/ginkgo v1.14.0/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY= github.com/onsi/ginkgo v1.16.4/go.mod h1:dX+/inL/fNMqNlz0e9LfyB9TswhZpCVdJM/Z6Vvnwo0= -github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE= -github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU= -github.com/onsi/ginkgo/v2 v2.0.0/go.mod h1:vw5CSIxN1JObi/U8gcbwft7ZxR2dgaR70JSE3/PpL4c= github.com/onsi/gomega v0.0.0-20151007035656-2152b45fa28a/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA= github.com/onsi/gomega v0.0.0-20170829124025-dcabb60a477c/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA= github.com/onsi/gomega v1.5.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= @@ -1157,9 +1152,6 @@ github.com/onsi/gomega v1.9.0/go.mod h1:Ho0h+IUsWyvy1OpqCwxlQ/21gkhVunqlU8fDGcoT github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= github.com/onsi/gomega v1.10.3/go.mod h1:V9xEwhxec5O8UDM77eCW8vLymOMltsqPVYWrpDsH8xc= github.com/onsi/gomega v1.15.0/go.mod h1:cIuvLEne0aoVhAgh/O6ac0Op8WWw9H6eYCriF+tEHG0= -github.com/onsi/gomega v1.17.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAlGdZY= -github.com/onsi/gomega v1.18.1 h1:M1GfJqGRrBrrGGsbxzV5dqM2U2ApXefZCQpkukxYRLE= -github.com/onsi/gomega v1.18.1/go.mod h1:0q+aL8jAiMXy9hbwj2mr5GziHiwhAIQpFmmtT5hitRs= github.com/oov/psd v0.0.0-20220121172623-5db5eafcecbb h1:JF9kOhBBk4WPF7luXFu5yR+WgaFm9L/KiHJHhU9vDwA= github.com/oov/psd v0.0.0-20220121172623-5db5eafcecbb/go.mod h1:GHI1bnmAcbp96z6LNfBJvtrjxhaXGkbsk967utPlvL8= github.com/opencontainers/go-digest v0.0.0-20170106003457-a6d0ee40d420/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s= @@ -1211,6 +1203,8 @@ github.com/pelletier/go-toml v1.8.1/go.mod h1:T2/BmBdy8dvIRq1a/8aqjN41wvWlN4lrap github.com/pelletier/go-toml v1.9.3/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8= github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= +github.com/pelletier/go-toml/v2 v2.0.7 h1:muncTPStnKRos5dpVKULv2FVd4bMOhNePj9CjgDb8Us= +github.com/pelletier/go-toml/v2 v2.0.7/go.mod h1:eumQOmlWiOPt5WriQQqoM5y18pDHwha2N+QD+EUNTek= github.com/peterbourgon/diskv v2.0.1+incompatible/go.mod h1:uqqh8zWWbv1HBMNONnaR/tNboyR3/BZd58JJSHlUSCU= github.com/philhofer/fwd v1.1.2 h1:bnDivRJ1EWPjUIRXV5KfORO897HTbpFAQddBdE8t7Gw= github.com/philhofer/fwd v1.1.2/go.mod h1:qkPdfjR2SIEbspLqpe1tO4n5yICnr2DY7mqEx2tUTP0= @@ -1243,14 +1237,15 @@ github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5Fsn github.com/prometheus/client_golang v1.1.0/go.mod h1:I1FGZT9+L76gKKOs5djB6ezCbFQP1xR9D75/vuwEF3g= github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= github.com/prometheus/client_golang v1.11.0/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0= -github.com/prometheus/client_golang v1.12.1 h1:ZiaPsmm9uiBeaSMRznKsCDNtPCS0T3JVDGF+06gjBzk= -github.com/prometheus/client_golang v1.12.1/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrbd179Rt297l4aS6nDY= +github.com/prometheus/client_golang v1.14.0 h1:nJdhIvne2eSX/XRAFV9PcvFFRbrjbcTUj0VP62TMhnw= +github.com/prometheus/client_golang v1.14.0/go.mod h1:8vpkKitgIVNcqrRBWh1C4TIUQgYNtG/XQE4E/Zae36Y= github.com/prometheus/client_model v0.0.0-20171117100541-99fa1f4be8e5/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/client_model v0.2.0 h1:uq5h0d+GuxiXLJLNABMgp2qUWDPiLvgCzz2dUR+/W/M= github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/client_model v0.3.0 h1:UBgGFHqYdG/TPFD1B1ogZywDqEkwp3fBMvqdiQ7Xew4= +github.com/prometheus/client_model v0.3.0/go.mod h1:LDGWKZIo7rky3hgvBe+caln+Dr3dPggB5dvjtD7w9+w= github.com/prometheus/common v0.0.0-20180110214958-89604d197083/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= github.com/prometheus/common v0.0.0-20180801064454-c7de2306084e/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= @@ -1260,9 +1255,8 @@ github.com/prometheus/common v0.6.0/go.mod h1:eBmuwkDJBwy6iBfxCBob6t6dR6ENT/y+J+ github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc= github.com/prometheus/common v0.30.0/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls= -github.com/prometheus/common v0.32.1/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls= -github.com/prometheus/common v0.33.0 h1:rHgav/0a6+uYgGdNt3jwz8FNSesO/Hsang3O0T9A5SE= -github.com/prometheus/common v0.33.0/go.mod h1:gB3sOl7P0TvJabZpLY5uQMpUqRCPPCyRLCZYc7JZTNE= +github.com/prometheus/common v0.42.0 h1:EKsfXEYo4JpWMHH5cg+KOUWeuJSov1Id8zGR8eeI1YM= +github.com/prometheus/common v0.42.0/go.mod h1:xBwqVerjNdUDjgODMpudtOMwlOwf2SaTr1yjz4b7Zbc= github.com/prometheus/procfs v0.0.0-20180125133057-cb4147076ac7/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20180725123919-05ee40e3a273/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= @@ -1275,15 +1269,18 @@ github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+Gx github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= github.com/prometheus/procfs v0.2.0/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= -github.com/prometheus/procfs v0.7.3 h1:4jVXhlkAyzOScmCkXBTOLRLTz8EeU+eyjrwB/EPq0VU= github.com/prometheus/procfs v0.7.3/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= +github.com/prometheus/procfs v0.9.0 h1:wzCHvIvM5SxWqYvwgVL7yJY8Lz3PKn49KQtpgMYJfhI= +github.com/prometheus/procfs v0.9.0/go.mod h1:+pB4zwohETzFnmlpe6yd2lSc+0/46IYZRB/chUwxUZY= github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= +github.com/redis/go-redis/v9 v9.0.3 h1:+7mmR26M0IvyLxGZUHxu4GiBkJkVDid0Un+j4ScYu4k= +github.com/redis/go-redis/v9 v9.0.3/go.mod h1:WqMKv5vnQbRuZstUwxQI195wHy+t4PuXDOjzMvcuQHk= github.com/reflog/dateconstraints v0.2.1 h1:Hz1n2Q1vEm0Rj5gciDQcCN1iPBwfFjxUJy32NknGP/s= github.com/reflog/dateconstraints v0.2.1/go.mod h1:Ax8AxTBcJc3E/oVS2hd2j7RDM/5MDtuPwuR7lIHtPLo= github.com/remyoudompheng/bigfft v0.0.0-20190728182440-6a916e37a237/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo= github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo= -github.com/remyoudompheng/bigfft v0.0.0-20220927061507-ef77025ab5aa h1:tEkEyxYeZ43TR55QU/hsIt9aRGBxbgGuz9CGykjvogY= -github.com/remyoudompheng/bigfft v0.0.0-20220927061507-ef77025ab5aa/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo= +github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec h1:W09IVJc94icq4NjY3clb7Lk8O1qJ8BdBEF8z0ibU0rE= +github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo= github.com/richardlehane/mscfb v1.0.3/go.mod h1:YzVpcZg9czvAuhk9T+a3avCpcFPMUWm7gK3DypaEsUk= github.com/richardlehane/mscfb v1.0.4 h1:WULscsljNPConisD5hR0+OyZjwK46Pfyr6mPu5ZawpM= github.com/richardlehane/mscfb v1.0.4/go.mod h1:YzVpcZg9czvAuhk9T+a3avCpcFPMUWm7gK3DypaEsUk= @@ -1292,13 +1289,14 @@ github.com/richardlehane/msoleps v1.0.3 h1:aznSZzrwYRl3rLKRT3gUk9am7T/mLNSnJINvN github.com/richardlehane/msoleps v1.0.3/go.mod h1:BWev5JBpU9Ko2WAgmZEuiz4/u3ZYTKbjLycmwiWUfWg= github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= -github.com/rivo/uniseg v0.4.3 h1:utMvzDsuh3suAEnhH0RdHmoPbU648o6CvXxTx4SBMOw= -github.com/rivo/uniseg v0.4.3/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= +github.com/rivo/uniseg v0.4.4 h1:8TfxU8dW6PdqD27gjM8MVNuicgxIjxpm4K7x4jp8sis= +github.com/rivo/uniseg v0.4.4/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/go-internal v1.1.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rogpeppe/go-internal v1.2.2/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +github.com/rogpeppe/go-internal v1.6.1 h1:/FiVV8dS/e+YqF2JvO3yXRFbBLTIuSDkuC7aBOAvL+k= github.com/rs/cors v1.8.3 h1:O+qNyWn7Z+F9M0ILBHgMVPuB1xTOucVd5gtaYyXBpRo= github.com/rs/cors v1.8.3/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU= github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ= @@ -1327,8 +1325,8 @@ github.com/seccomp/libseccomp-golang v0.9.2-0.20210429002308-3879420cc921/go.mod github.com/segmentio/backo-go v1.0.1 h1:68RQccglxZeyURy93ASB/2kc9QudzgIDexJ927N++y4= github.com/segmentio/backo-go v1.0.1/go.mod h1:9/Rh6yILuLysoQnZ2oNooD2g7aBnvM7r/fNVxRNWfBc= github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= -github.com/sergi/go-diff v1.2.0 h1:XU+rvMAioB0UC3q1MFrIQy4Vo5/4VsRDQQXHsEya6xQ= -github.com/sergi/go-diff v1.2.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= +github.com/sergi/go-diff v1.3.1 h1:xkr+Oxo4BOQKmkn/B9eMK0g5Kg/983T9DqqPHwYqD+8= +github.com/sergi/go-diff v1.3.1/go.mod h1:aMJSSKb2lpPvRNec0+w3fl7LP9IOFzdc9Pa4NFbPK1I= github.com/shopspring/decimal v0.0.0-20180709203117-cd690d0c9e24/go.mod h1:M+9NzErvs504Cn4c5DxATwIqPbtswREoFCre64PpcG4= github.com/shopspring/decimal v0.0.0-20200227202807-02e2044944cc/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= @@ -1380,17 +1378,17 @@ github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B github.com/spf13/afero v1.2.2/go.mod h1:9ZxEEn6pIJ8Rxe320qSDBk6AsU0r9pR7Q4OcevTdifk= github.com/spf13/afero v1.3.3/go.mod h1:5KUK8ByomD5Ti5Artl0RtHeI5pTF7MIDuXL3yY520V4= github.com/spf13/afero v1.6.0/go.mod h1:Ai8FlHk4v/PARR026UzYexafAt9roJ7LcLMAmO6Z93I= -github.com/spf13/afero v1.8.2 h1:xehSyVa0YnHWsJ49JFljMpg1HX19V6NDZ1fkm1Xznbo= -github.com/spf13/afero v1.8.2/go.mod h1:CtAatgMJh6bJEIs48Ay/FOnkljP3WeGUG0MC1RfAqwo= +github.com/spf13/afero v1.9.5 h1:stMpOSZFs//0Lv29HduCmli3GUfpFoF3Y1Q/aXj/wVM= +github.com/spf13/afero v1.9.5/go.mod h1:UBogFpq8E9Hx+xc5CNTTEpTnuHVmXDwZcZcE1eb/UhQ= github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= -github.com/spf13/cast v1.4.1 h1:s0hze+J0196ZfEMTs80N7UlFt0BDuQ7Q+JDnHiMWKdA= -github.com/spf13/cast v1.4.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= +github.com/spf13/cast v1.5.0 h1:rj3WzYc11XZaIZMPKmwP96zkFEnnAmV8s6XbB2aY32w= +github.com/spf13/cast v1.5.0/go.mod h1:SpXXQ5YoyJw6s3/6cMTQuxvgRl3PCJiyaX9p6b155UU= github.com/spf13/cobra v0.0.2-0.20171109065643-2da4a54c5cee/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= github.com/spf13/cobra v1.0.0/go.mod h1:/6GTrnGXV9HjY+aR4k0oJ5tcvakLuG6EuKReYlHNrgE= github.com/spf13/cobra v1.1.3/go.mod h1:pGADOWyqRD/YMrPZigI/zbliZ2wVD/23d+is3pSWzOo= -github.com/spf13/cobra v1.6.1 h1:o94oiPyS4KD1mPy2fmcYYHHfCxLqYjJOhGsCHFZtEzA= -github.com/spf13/cobra v1.6.1/go.mod h1:IOw/AERYS7UzyrGinqmz6HLUo219MORXGxhbaJUqzrY= +github.com/spf13/cobra v1.7.0 h1:hyqWnYt1ZQShIddO5kBpj3vu05/++x6tJ6dg8EC572I= +github.com/spf13/cobra v1.7.0/go.mod h1:uLxZILRyS/50WlhOIKD7W6V5bgeIt+4sICxh6uRMrb0= github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= github.com/spf13/jwalterweatherman v1.1.0 h1:ue6voC5bR5F8YxI5S67j9i582FU4Qvo2bmqnqMYADFk= github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0EXowPYD95IqWIGo= @@ -1402,15 +1400,14 @@ github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spf13/viper v1.4.0/go.mod h1:PTJ7Z/lr49W6bUbkmS1V3by4uWynFiR9p7+dSq/yZzE= github.com/spf13/viper v1.7.0/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg= -github.com/spf13/viper v1.10.1 h1:nuJZuYpG7gTj/XqiUwg8bA0cp1+M2mC3J4g5luUYBKk= -github.com/spf13/viper v1.10.1/go.mod h1:IGlFPqhNAPKRxohIzWpI5QEy4kuI7tcl5WvR+8qy1rU= -github.com/splitio/go-client/v6 v6.2.1 h1:EH3xYH7fr2c0I0ZtYvsyn7DjC9ZmoNAFLoKoT3BmQFU= -github.com/splitio/go-client/v6 v6.2.1/go.mod h1:+HnGMevmSUk56va2egs9W2s9mJ7LW9IXiDPB1ExOi+k= -github.com/splitio/go-split-commons/v4 v4.2.0/go.mod h1:mzanM00PV8t1FL6IHc2UXepIH2z79d49ArZ2LoJHGrY= -github.com/splitio/go-split-commons/v4 v4.2.3 h1:/bQg8Z0eCkF9RHl7Dh1SJ8j7Ci024bgtkZEWwEKXywc= -github.com/splitio/go-split-commons/v4 v4.2.3/go.mod h1:mzanM00PV8t1FL6IHc2UXepIH2z79d49ArZ2LoJHGrY= -github.com/splitio/go-toolkit/v5 v5.2.2 h1:VHSJoIH9tsRt2cCzGKN4WG3BoGCr0tCPZIl8APtJ4bw= -github.com/splitio/go-toolkit/v5 v5.2.2/go.mod h1:SYi/svhhtEgdMSb5tNcDcMjOSUH/7XVkvjp5dPL+nBE= +github.com/spf13/viper v1.15.0 h1:js3yy885G8xwJa6iOISGFwd+qlUo5AvyXb7CiihdtiU= +github.com/spf13/viper v1.15.0/go.mod h1:fFcTBJxvhhzSJiZy8n+PeW6t8l+KeT/uTARa0jHOQLA= +github.com/splitio/go-client/v6 v6.3.1 h1:HtIVILFZotiT2AE1gTElWehrdy71kh8kDux3M3IuKjA= +github.com/splitio/go-client/v6 v6.3.1/go.mod h1:B7mq//ds3MiYjbY1amIESSR8qKcSWjOJJBzVgSAqlLE= +github.com/splitio/go-split-commons/v4 v4.3.1 h1:+BaNoyuxOWopYN603Pbk1etiysHaEz8EghVx20CbwDk= +github.com/splitio/go-split-commons/v4 v4.3.1/go.mod h1:tjtSYwuIMDGTEifO1dMcKk9UYf0Q2gz0xypkT//cdLc= +github.com/splitio/go-toolkit/v5 v5.3.0 h1:NSUBIkyRwyMQ6ruPOiG1Kl1pni/pW3Gqiu7L+11mIMw= +github.com/splitio/go-toolkit/v5 v5.3.0/go.mod h1:yn9f3Bmka+97BNnNnnlM1V484jMqu7MNoM/RBZLbZZs= github.com/ssor/bom v0.0.0-20170718123548-6386211fdfcf h1:pvbZ0lM0XWPBqUKqFU8cmavspvIl9nulOYwdy6IFRRo= github.com/ssor/bom v0.0.0-20170718123548-6386211fdfcf/go.mod h1:RJID2RhlZKId02nZ62WenDCkgHFerpIOmW0iT7GKmXM= github.com/stefanberger/go-pkcs11uri v0.0.0-20201008174630-78d3cae3a980/go.mod h1:AO3tvPzVZ/ayst6UlUKUv6rcPQInYe3IknH3jYhAKu8= @@ -1432,10 +1429,12 @@ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s= +github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= +github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= +github.com/subosito/gotenv v1.4.2 h1:X1TuBLAMDFbaTAChgCBLu3DU3UPyELpnF2jjJ2cz/S8= +github.com/subosito/gotenv v1.4.2/go.mod h1:ayKnFf/c6rvx/2iiLrJUk1e6plDbT3edrFNGqEflhK0= github.com/syndtr/gocapability v0.0.0-20170704070218-db04d3cc01c8/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww= github.com/syndtr/gocapability v0.0.0-20180916011248-d98352740cb2/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww= github.com/syndtr/gocapability v0.0.0-20200815063812-42c35b437635/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww= @@ -1514,8 +1513,8 @@ github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9de github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= -github.com/yuin/goldmark v1.5.3 h1:3HUJmBFbQW9fhQOzMgseU134xfi6hU+mjWywx5Ty+/M= -github.com/yuin/goldmark v1.5.3/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= +github.com/yuin/goldmark v1.5.4 h1:2uY/xC0roWy8IBEGLgB1ywIoEJFGmRrX21YQcvGZzjU= +github.com/yuin/goldmark v1.5.4/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= github.com/yvasiyarov/go-metrics v0.0.0-20140926110328-57bccd1ccd43/go.mod h1:aX5oPXxHm3bOH+xeAttToC8pqch2ScQN/JoXYupl6xs= github.com/yvasiyarov/gorelic v0.0.0-20141212073537-a9bba5b9ab50/go.mod h1:NUSPSUX/bi6SeDMUh6brw0nXpxHnc96TguQh0+r/ssA= github.com/yvasiyarov/newrelic_platform_go v0.0.0-20140908184405-b21fdbd4370f/go.mod h1:GlGEuHIJweS1mbCqG+7vt2nvWLzLLnRHbXz5JKd/Qbg= @@ -1524,8 +1523,9 @@ gitlab.com/nyarla/go-crypt v0.0.0-20160106005555-d9a5dc2b789b/go.mod h1:T3BPAOm2 go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= go.etcd.io/bbolt v1.3.5/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ= -go.etcd.io/bbolt v1.3.6 h1:/ecaJf0sk1l4l6V4awd65v2C3ILy7MSj+s/x1ADCIMU= go.etcd.io/bbolt v1.3.6/go.mod h1:qXsaaIqmgQH0T+OPdb99Bf+PKfBBQVAdyD6TY9G8XM4= +go.etcd.io/bbolt v1.3.7 h1:j+zJOnnEjF/kyHlDDgGnVL/AIqIJPq8UoB2GSNfkUfQ= +go.etcd.io/bbolt v1.3.7/go.mod h1:N9Mkw9X8x5fupy0IKsmuqVtoGDyxsaDlbk4Rd05IAQw= go.etcd.io/etcd v0.5.0-alpha.5.0.20200910180754-dd1b699fc489/go.mod h1:yVHk9ub3CSBatqGNg7GRmsnfLWtoW60w4eDYfh7vHDg= go.etcd.io/etcd/api/v3 v3.5.0/go.mod h1:cbVKeC6lCfl7j/8jBhAK6aIYO9XOjdptoxU/nLQcPvs= go.etcd.io/etcd/client/pkg/v3 v3.5.0/go.mod h1:IJHfcCEKxYu1Os13ZdwCwIUTUVGYTSAM3YSwc9/Ac1g= @@ -1611,9 +1611,9 @@ golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= golang.org/x/crypto v0.0.0-20210817164053-32db794688a5/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.5.0 h1:U/0M97KRkSFvyD/3FSmdP5W5swImpNgle/EHFhOsQPE= -golang.org/x/crypto v0.5.0/go.mod h1:NK/OQwhpMQP3MwtdjgLlYHnH9ebylxKWv3e0fK+mkQU= +golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= +golang.org/x/crypto v0.8.0 h1:pd9TJtTueMTVQXzk8E2XESSMQDj/U7OUu0PqJqPXQjQ= +golang.org/x/crypto v0.8.0/go.mod h1:mRqEX+O9/h5TFCrQhkgjo2yKi0yYA+9ecGkdQoHrywE= golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -1638,8 +1638,8 @@ golang.org/x/image v0.0.0-20200430140353-33d19683fad8/go.mod h1:FeLwcggjj3mMvU+o golang.org/x/image v0.0.0-20200618115811-c13761719519/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/image v0.0.0-20201208152932-35266b937fa6/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/image v0.0.0-20210216034530-4410531fe030/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= -golang.org/x/image v0.3.0 h1:HTDXbdK9bjfSWkPzDJIw89W8CAtfFGduujWs33NLLsg= -golang.org/x/image v0.3.0/go.mod h1:fXd9211C/0VTlYuAcOhW8dY/RtEJqODXOWBDpmYBf+A= +golang.org/x/image v0.7.0 h1:gzS29xtG1J5ybQlv0PuyfE3nmc6R4qB73m6LUUmvFuw= +golang.org/x/image v0.7.0/go.mod h1:nd/q4ef1AKKYl/4kft7g+6UyGbdiqWqTP1ZAbRoV7Rg= golang.org/x/lint v0.0.0-20180702182130-06c8688daad7/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= @@ -1667,8 +1667,9 @@ golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.5.0/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.7.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/mod v0.8.0 h1:LUYupSeNrTNCGzR/hVBk2NHZO4hXcVaW1k4Qx7rjPx8= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/mod v0.10.0 h1:lFO9qtOdlre5W1jxS3r/4szv2/6iXxScdzjoBMXNhYk= +golang.org/x/mod v0.10.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/net v0.0.0-20180218175443-cbe0f9307d01/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -1736,17 +1737,19 @@ golang.org/x/net v0.0.0-20210813160813-60bc85c4be6d/go.mod h1:9nx3DQGgdP8bBQD5qx golang.org/x/net v0.0.0-20210825183410-e898025ed96a/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210916014120-12bc252f5db8/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211029224645-99673261e6eb/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211209124913-491a49abca63/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211216030914-fe4d6282115f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220111093109-d55c255bac03/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220520000938-2e3eb7b945c2/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= golang.org/x/net v0.3.0/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE= -golang.org/x/net v0.8.0 h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ= -golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= +golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= +golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= +golang.org/x/net v0.9.0 h1:aWJ/m6xSmxWBx+V0XRHTlrYrPG56jKsLdTFmsSsCzOM= +golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns= golang.org/x/oauth2 v0.0.0-20180227000427-d7d64896b5ff/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20181017192945-9dcd33a902f4/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= @@ -1767,8 +1770,8 @@ golang.org/x/oauth2 v0.0.0-20210628180205-a41e5a781914/go.mod h1:KelEdhl1UZF7XfJ golang.org/x/oauth2 v0.0.0-20210805134026-6f1e6394065a/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210819190943-2bc19b11175f/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b h1:clP8eMhB30EHdc0bd2Twtq6kgU7yl5ub2cQLSdrv1Dg= -golang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc= +golang.org/x/oauth2 v0.7.0 h1:qe6s0zUXlPX80/dITx3440hWZ7GwMwgDDyrSGTPJG/g= +golang.org/x/oauth2 v0.7.0/go.mod h1:hPLQkd9LyjfXTiRohC/41GhcFqxisoUQ99sCUOHO9x4= golang.org/x/perf v0.0.0-20180704124530-6e6d33e29852/go.mod h1:JLpeXjPJfIyPr5TlbXLkXWLhP8nz10XfvxElABhCtcw= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -1910,7 +1913,6 @@ golang.org/x/sys v0.0.0-20211205182925-97ca703d548d/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20211210111614-af8b64212486/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220111092808-5a964db01320/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220128215802-99c3d69c2c27/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220317061510-51cd9980dadf/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -1922,8 +1924,10 @@ golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ= +golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.7.0 h1:3jlCCIQZPdOYu1h8BkNvLz8Kgwtae2cagcG/VamtZRU= +golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= @@ -1931,6 +1935,7 @@ golang.org/x/term v0.0.0-20210615171337-6886f2dfbf5b/go.mod h1:jbD1KX2456YbFQfuX golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.3.0/go.mod h1:q750SLmJuPmVoN1blW3UFBPREJfb1KmY3vwxfr+nFDA= +golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -1942,9 +1947,9 @@ golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.5.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.6.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.8.0 h1:57P1ETyNKtuIjB4SRd15iJxuhj8Gc416Y78H3qgMh68= -golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE= +golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -2037,8 +2042,9 @@ golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/tools v0.4.0/go.mod h1:UE5sM2OK9E/d67R0ANs2xJizIymRP5gJU295PvKXxjQ= -golang.org/x/tools v0.6.0 h1:BOw41kyTf3PuCW1pVQf8+Cyg8pMlkYB1oo9iJ6D/lKM= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= +golang.org/x/tools v0.8.0 h1:vSDcovVPld282ceKgDimkRSC8kpaH1dgyc9UMzlt84Y= +golang.org/x/tools v0.8.0/go.mod h1:JxBZ99ISMI5ViVkT1tr6tdNmXeTrcpVSD3vZ1RsRdN4= golang.org/x/xerrors v0.0.0-20190410155217-1f06c39b4373/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20190513163551-3ee3066db522/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -2179,8 +2185,8 @@ google.golang.org/genproto v0.0.0-20220111164026-67b88f271998/go.mod h1:5CzLGKJ6 google.golang.org/genproto v0.0.0-20220126215142-9970aeb2e350/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/genproto v0.0.0-20220207164111-0872dc986b00/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/genproto v0.0.0-20220314164441-57ef72a4c106/go.mod h1:hAL49I2IFola2sVEjAn7MEwsja0xp51I0tlGAf9hz4E= -google.golang.org/genproto v0.0.0-20230104163317-caabf589fcbf h1:/JqRexUvugu6JURQ0O7RfV1EnvgrOxUV4tSjuAv0Sr0= -google.golang.org/genproto v0.0.0-20230104163317-caabf589fcbf/go.mod h1:RGgjbofJ8xD9Sq1VVhDM1Vok1vRONV+rg+CjzG4SZKM= +google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 h1:KpwkzHKEF7B9Zxg18WzOa7djJ+Ha5DzthMyZYQfEn2A= +google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1/go.mod h1:nKE/iIaLqn2bQwXBg8f1g2Ylh6r5MN5CmZvuzZCgsCU= google.golang.org/grpc v0.0.0-20160317175043-d3ddb4469d5a/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= google.golang.org/grpc v1.14.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= google.golang.org/grpc v1.16.0/go.mod h1:0JHn/cJsOMiMfNA9+DeHDlAU7KAAB5GDlYFpa9MZMio= @@ -2218,8 +2224,8 @@ google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ5 google.golang.org/grpc v1.43.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= google.golang.org/grpc v1.44.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ= -google.golang.org/grpc v1.51.0 h1:E1eGv1FTqoLIdnBCZufiSHgKjlqG6fKFf6pPWtMTh8U= -google.golang.org/grpc v1.51.0/go.mod h1:wgNDFcnuBGmxLKI/qn4T+m5BtEBYXJPvibbUPsAIPww= +google.golang.org/grpc v1.54.0 h1:EhTqbhiYeixwWQtAEZAxmV9MGqcjEU2mFx52xCzNyag= +google.golang.org/grpc v1.54.0/go.mod h1:PUSEXI6iWghWaB6lXM4knEgpJNu2qUcKfDtNci3EC2g= google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= @@ -2235,8 +2241,8 @@ google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp0 google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w= -google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng= +google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/airbrake/gobrake.v2 v2.0.9/go.mod h1:/h5ZAUhDkGaJfjzjKLSjv6zCL6O0LLBxU4K+aSYdM/U= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc h1:2gGKlE2+asNV9m7xrywl36YYNnBG5ZQ0r/BOOxqPpmk= @@ -2262,13 +2268,13 @@ gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/mail.v2 v2.3.1 h1:WYFn/oANrAGP2C0dcV6/pbkPzv8yGzqTjPmTeO7qoXk= gopkg.in/mail.v2 v2.3.1/go.mod h1:htwXN1Qh09vZJ1NVKxQqHPBaCBbzKhp5GzuJEA4VJWw= gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22/go.mod h1:yeKp02qBN3iKW1OzL3MGk2IdtZzaj7SFntXj72NppTA= -gopkg.in/natefinch/lumberjack.v2 v2.0.0 h1:1Lc07Kr7qY4U2YPouBjpCLxpiyxIVoxqXgkXLknAOE8= gopkg.in/natefinch/lumberjack.v2 v2.0.0/go.mod h1:l0ndWWf7gzL7RNwBG7wST/UCcT4T24xpD6X8LsfU/+k= +gopkg.in/natefinch/lumberjack.v2 v2.2.1 h1:bBRl1b0OH9s/DuPhuXpNl+VtCaJXFZ5/uEFST95x9zc= +gopkg.in/natefinch/lumberjack.v2 v2.2.1/go.mod h1:YD8tP3GAjkrDg1eZH7EGmyESg/lsYskCTPBJVb9jqSc= gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= gopkg.in/square/go-jose.v2 v2.2.2/go.mod h1:M9dMgbHiYLoDGQrXy7OpJDJWiKiU//h+vD76mk0e1AI= gopkg.in/square/go-jose.v2 v2.3.1/go.mod h1:M9dMgbHiYLoDGQrXy7OpJDJWiKiU//h+vD76mk0e1AI= gopkg.in/square/go-jose.v2 v2.5.1/go.mod h1:M9dMgbHiYLoDGQrXy7OpJDJWiKiU//h+vD76mk0e1AI= -gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= @@ -2346,8 +2352,8 @@ k8s.io/utils v0.0.0-20201110183641-67b214c5f920/go.mod h1:jPW/WVKK9YHAvNhRxK0md/ k8s.io/utils v0.0.0-20210819203725-bdf08cb9a70a/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA= k8s.io/utils v0.0.0-20210930125809-cb0fa318a74b/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA= lukechampine.com/uint128 v1.1.1/go.mod h1:c4eWIwlEGaxC/+H1VguhU4PHXNWDCDMUlWdIWl2j1gk= -lukechampine.com/uint128 v1.2.0 h1:mBi/5l91vocEN8otkC5bDLhi2KdCticRiwbdB0O+rjI= -lukechampine.com/uint128 v1.2.0/go.mod h1:c4eWIwlEGaxC/+H1VguhU4PHXNWDCDMUlWdIWl2j1gk= +lukechampine.com/uint128 v1.3.0 h1:cDdUVfRwDUDovz610ABgFD17nXD4/uDgVHl2sC3+sbo= +lukechampine.com/uint128 v1.3.0/go.mod h1:c4eWIwlEGaxC/+H1VguhU4PHXNWDCDMUlWdIWl2j1gk= modernc.org/b v1.0.0/go.mod h1:uZWcZfRj1BpYzfN9JTerzlNUnnPsV9O2ZA8JsRcubNg= modernc.org/cc/v3 v3.32.4/go.mod h1:0R6jl1aZlIl2avnYfbfHBS1QB6/f+16mihBObaBC878= modernc.org/cc/v3 v3.36.0/go.mod h1:NFUHyPn4ekoC/JHeZFfZurN6ixxawE1BnVonP/oahEI= @@ -2375,8 +2381,8 @@ modernc.org/libc v1.9.5/go.mod h1:U1eq8YWr/Kc1RWCMFUWEdkTg8OTcfLw2kY8EDwl039w= modernc.org/libc v1.16.0/go.mod h1:N4LD6DBE9cf+Dzf9buBlzVJndKr/iJHG97vGLHYnb5A= modernc.org/libc v1.16.1/go.mod h1:JjJE0eu4yeK7tab2n4S1w8tlWd9MxXLRzheaRnAKymU= modernc.org/libc v1.16.7/go.mod h1:hYIV5VZczAmGZAnG15Vdngn5HSF5cSkbvfz2B7GRuVU= -modernc.org/libc v1.22.2 h1:4U7v51GyhlWqQmwCHj28Rdq2Yzwk55ovjFrdPjs8Hb0= -modernc.org/libc v1.22.2/go.mod h1:uvQavJ1pZ0hIoC/jfqNoMLURIMhKzINIWypNM17puug= +modernc.org/libc v1.22.3 h1:D/g6O5ftAfavceqlLOFwaZuA5KYafKwmr30A6iSqoyY= +modernc.org/libc v1.22.3/go.mod h1:MQrloYP209xa2zHome2a8HLiLm6k0UT8CoHpV74tOFw= modernc.org/lldb v1.0.0/go.mod h1:jcRvJGWfCGodDZz8BPwiKMJxGJngQ/5DrRapkQnLob8= modernc.org/mathutil v1.0.0/go.mod h1:wU0vUrJsVWBZ4P6e7xtFJEhFSNsfRLJ8H458uRjg03k= modernc.org/mathutil v1.1.1/go.mod h1:mZW8CKdRPY1v87qxC/wUdX5O1qDzXMP5TH3wjfpga6E= @@ -2395,15 +2401,15 @@ modernc.org/ql v1.0.0/go.mod h1:xGVyrLIatPcO2C1JvI/Co8c0sr6y91HKFNy4pt9JXEY= modernc.org/sortutil v1.1.0/go.mod h1:ZyL98OQHJgH9IEfN71VsamvJgrtRX9Dj2gX+vH86L1k= modernc.org/sqlite v1.10.6/go.mod h1:Z9FEjUtZP4qFEg6/SiADg9XCER7aYy9a/j7Pg9P7CPs= modernc.org/sqlite v1.18.0/go.mod h1:B9fRWZacNxJBHoCJZQr1R54zhVn3fjfl0aszflrTSxY= -modernc.org/sqlite v1.20.1 h1:z6qRLw72B0VfRrJjs3l6hWkzYDx1bo0WGVrBGP4ohhM= -modernc.org/sqlite v1.20.1/go.mod h1:fODt+bFmc/j8LcoCbMSkAuKuGmhxjG45KGc25N2705M= +modernc.org/sqlite v1.21.1 h1:GyDFqNnESLOhwwDRaHGdp2jKLDzpyT/rNLglX3ZkMSU= +modernc.org/sqlite v1.21.1/go.mod h1:XwQ0wZPIh1iKb5mkvCJ3szzbhk+tykC8ZWqTRTgYRwI= modernc.org/strutil v1.1.0/go.mod h1:lstksw84oURvj9y3tn8lGvRxyRC1S2+g5uuIzNfIOBs= modernc.org/strutil v1.1.1/go.mod h1:DE+MQQ/hjKBZS2zNInV5hhcipt5rLPWkmpbGeW5mmdw= modernc.org/strutil v1.1.3 h1:fNMm+oJklMGYfU9Ylcywl0CO5O6nTfaowNsh2wpPjzY= modernc.org/strutil v1.1.3/go.mod h1:MEHNA7PdEnEwLvspRMtWTNnp2nnyvMfkimT1NKNAGbw= modernc.org/tcl v1.5.2/go.mod h1:pmJYOLgpiys3oI4AeAafkcUfE+TKKilminxNyU/+Zlo= modernc.org/tcl v1.13.1/go.mod h1:XOLfOwzhkljL4itZkK6T72ckMgvj0BDsnKNdZVUOecw= -modernc.org/tcl v1.15.0 h1:oY+JeD11qVVSgVvodMJsu7Edf8tr5E/7tuhF5cNYz34= +modernc.org/tcl v1.15.1 h1:mOQwiEK4p7HruMZcwKTZPw/aqtGM4aY00uzWhlKKYws= modernc.org/token v1.0.0/go.mod h1:UGzOrNV1mAFSEB63lOFHIpNRUVMvYTc6yu1SMY/XTDM= modernc.org/token v1.1.0 h1:Xl7Ap9dKaEs5kLoOQeQmPWevfnk/DM5qcLcYlA8ys6Y= modernc.org/token v1.1.0/go.mod h1:UGzOrNV1mAFSEB63lOFHIpNRUVMvYTc6yu1SMY/XTDM= diff --git a/server/i18n/bg.json b/server/i18n/bg.json index f9fa12c015..00b110c3b1 100644 --- a/server/i18n/bg.json +++ b/server/i18n/bg.json @@ -1927,10 +1927,6 @@ "id": "ent.elasticsearch.start.create_bulk_processor_failed.app_error", "translation": "Неуспешно създаване на групов процесор Elasticsearch." }, - { - "id": "ent.elasticsearch.start.already_started.app_error", - "translation": "Elasticsearch вече е стартиран." - }, { "id": "ent.elasticsearch.search_users.unmarshall_user_failed", "translation": "Неуспешно декодиране на резултатите от търсенето" diff --git a/server/i18n/de.json b/server/i18n/de.json index 3e7aed88f5..3ab54fbf66 100644 --- a/server/i18n/de.json +++ b/server/i18n/de.json @@ -3135,10 +3135,6 @@ "id": "ent.elasticsearch.search_posts.unmarshall_post_failed", "translation": "Konnte Suchergebnisse nicht dekodieren" }, - { - "id": "ent.elasticsearch.start.already_started.app_error", - "translation": "Elasticsearch ist bereits gestartet." - }, { "id": "ent.elasticsearch.start.create_bulk_processor_failed.app_error", "translation": "Fehler beim Erstellen der Elasticsearch-Massenverarbeitung." @@ -10165,5 +10161,25 @@ { "id": "worktemplate.companywide.create_project.board", "translation": "Verwend eine Kanban-Board, um deine Projektaufgaben und -fortschritte zu definieren und zu verfolgen." + }, + { + "id": "model.license_record.is_valid.bytes.app_error", + "translation": "Ungültiger Wert für Bytes beim Hochladen einer Lizenz." + }, + { + "id": "ent.elasticsearch.max_version.app_error", + "translation": "Elasticsearch Version {{.Version}} ist höher als die maximal unterstützte Version von {{.MaxVersion}}" + }, + { + "id": "app.plugin.skip_installation.app_error", + "translation": "Überspringe die Installation des Plugins {{.Id}}, da die vorhandene Version gleich oder neuer ist." + }, + { + "id": "app.plugin.blocked.app_error", + "translation": "Das Plugin {{.Id}} steht auf der Blockierliste. Einige Plugins sind blockiert, weil sie in diese Version von Mattermost eingebaut sind." + }, + { + "id": "api.server.cws.subscribe_to_newsletter.app_error", + "translation": "CWS Server kann den Newsletter nicht abonnieren." } ] diff --git a/server/i18n/en.json b/server/i18n/en.json index 3fe949e85f..335394a236 100644 --- a/server/i18n/en.json +++ b/server/i18n/en.json @@ -1777,6 +1777,10 @@ "id": "api.error_get_first_admin_visit_marketplace_status", "translation": "Error trying to retrieve the first admin visit marketplace status from the store." }, + { + "id": "api.error_no_organization_name_provided_for_self_hosted_onboarding", + "translation": "Error no organization name provided for self hosted onboarding." + }, { "id": "api.error_set_first_admin_complete_setup", "translation": "Error trying to save first admin complete setup in the store." @@ -2089,6 +2093,10 @@ "id": "api.license.true_up_review.create_error", "translation": "Could not create true up status record" }, + { + "id": "api.license.true_up_review.failed_to_submit", + "translation": "Failed to submit true up review profile to CWS." + }, { "id": "api.license.true_up_review.get_status_error", "translation": "Could not get true up status records" @@ -5935,6 +5943,10 @@ "id": "app.oauth.update_app.updating.app_error", "translation": "We encountered an error updating the app." }, + { + "id": "app.plugin.blocked.app_error", + "translation": "Plugin {{.Id}} is on the block list. Some plugins are blocked because they are built into this version of Mattermost." + }, { "id": "app.plugin.cluster.save_config.app_error", "translation": "The plugin configuration in your config.json file must be updated manually when using ReadOnlyConfig with clustering enabled." @@ -6067,6 +6079,10 @@ "id": "app.plugin.signature_decode.app_error", "translation": "Unable to decode base64 signature." }, + { + "id": "app.plugin.skip_installation.app_error", + "translation": "Skipping installation of plugin {{.Id}} since existing version is equal or newer." + }, { "id": "app.plugin.store_bundle.app_error", "translation": "Unable to store the plugin to the configured file store." @@ -7791,6 +7807,10 @@ "id": "ent.elasticsearch.indexer.index_batch.nothing_left_to_index.error", "translation": "Trying to index a new batch when all the entities are completed" }, + { + "id": "ent.elasticsearch.max_version.app_error", + "translation": "Elasticsearch version {{.Version}} is higher than max supported version of {{.MaxVersion}}" + }, { "id": "ent.elasticsearch.not_started.error", "translation": "Elasticsearch is not started" @@ -7859,10 +7879,6 @@ "id": "ent.elasticsearch.search_users.unmarshall_user_failed", "translation": "Failed to decode search results" }, - { - "id": "ent.elasticsearch.start.already_started.app_error", - "translation": "Elasticsearch is already started." - }, { "id": "ent.elasticsearch.start.create_bulk_processor_failed.app_error", "translation": "Failed to create Elasticsearch bulk processor." @@ -8447,6 +8463,10 @@ "id": "model.channel.is_valid.update_at.app_error", "translation": "Update at must be a valid time." }, + { + "id": "model.channel_member.is_valid.channel_auto_follow_threads_value.app_error", + "translation": "Invalid channel-auto-follow-threads value." + }, { "id": "model.channel_member.is_valid.channel_id.app_error", "translation": "Invalid channel id." @@ -8799,6 +8819,10 @@ "id": "model.config.is_valid.listen_address.app_error", "translation": "Invalid listen address for service settings Must be set." }, + { + "id": "model.config.is_valid.local_mode_socket.app_error", + "translation": "Unable to locate local socket file directory." + }, { "id": "model.config.is_valid.localization.available_locales.app_error", "translation": "Available Languages must contain Default Client Language." diff --git a/server/i18n/en_AU.json b/server/i18n/en_AU.json index 8a71e91c0d..bb53e81dcf 100644 --- a/server/i18n/en_AU.json +++ b/server/i18n/en_AU.json @@ -3291,10 +3291,6 @@ "id": "ent.elasticsearch.start.create_bulk_processor_failed.app_error", "translation": "Failed to create Elasticsearch bulk processor." }, - { - "id": "ent.elasticsearch.start.already_started.app_error", - "translation": "Elasticsearch is already started." - }, { "id": "ent.elasticsearch.search_users.unmarshall_user_failed", "translation": "Failed to decode search results" @@ -9837,5 +9833,337 @@ { "id": "api.templates.license_up_for_renewal_contact_sales", "translation": "Contact Sales" + }, + { + "id": "worktemplate.product_teams.sprint_planning.integration", + "translation": "Increase productivity in your channel by integrating your most commonly used tools such as Zoom. These will be downloaded for you." + }, + { + "id": "worktemplate.product_teams.sprint_planning.channel", + "translation": "Chat with your team in a channel that connects easily with your boards and integrations." + }, + { + "id": "worktemplate.product_teams.sprint_planning.board", + "translation": "Track your team's progress toward weekly goals with sprint breakdowns, prioritisation, owner assignment and comments." + }, + { + "id": "worktemplate.product_teams.product_roadmap.channel", + "translation": "Chat with your team about your customers' feedback, prioritisation and get aligned on progress together." + }, + { + "id": "worktemplate.product_teams.product_roadmap.board", + "translation": "Use the Product Roadmap board to manage user feedback, assign resources, view deliverables in a calendar view and prioritise issues." + }, + { + "id": "worktemplate.product_teams.goals_and_okrs.integration", + "translation": "Increase productivity in your channel by integrating your most commonly used tools such as Zoom to facilitate easy collaboration. These will be downloaded for you." + }, + { + "id": "worktemplate.product_teams.goals_and_okrs.channel", + "translation": "Chat about your goals and progress with your team, async or real-time and stay up to date with changes in a single channel." + }, + { + "id": "worktemplate.product_teams.goals_and_okrs.board", + "translation": "Track your team's progress toward organisational goals with the Goals and OKR board. Keep meetings on track with the Meeting Agenda board." + }, + { + "id": "worktemplate.product_teams.feature_release.description.board", + "translation": "Keep meetings on track with the Meeting Agenda board. Manage your workload with the Project Tasks board." + }, + { + "id": "worktemplate.product_teams.bug_bash.playbook", + "translation": "Use checklists to assign testing areas and automated tasks to run a comprehensive bug bash process. Use a retrospective to review your process and improve it for next time." + }, + { + "id": "worktemplate.product_teams.bug_bash.integration", + "translation": "Increase productivity in your channel by integrating your most commonly used tools such as Jira to track your bug bash progress. These will be downloaded for you." + }, + { + "id": "worktemplate.product_teams.bug_bash.channel", + "translation": "Plan and manage bug reports and resolutions in a single channel that’s easily accessible to your team and organisation." + }, + { + "id": "worktemplate.leadership.goals_and_okrs.integration", + "translation": "Increase productivity in your channel by integrating your most commonly used tools such as Zoom to facilitate easy collaboration. These will be downloaded for you." + }, + { + "id": "worktemplate.leadership.goals_and_okrs.channel", + "translation": "Chat about your goals and progress with your team, async or real-time and stay up to date with changes in a single channel." + }, + { + "id": "worktemplate.leadership.goals_and_okrs.board", + "translation": "Track your team's progress toward organisational goals with the Goals and OKR board. Keep meetings on track with the Meeting Agenda board." + }, + { + "id": "worktemplate.devops.product_release.playbook", + "translation": "Create repeatable workflows that are easy to follow and implement so product releases are reliable and on time." + }, + { + "id": "worktemplate.devops.product_release.channel", + "translation": "Chat with your team about daily milestones, any blockers and changes to deliverables, easily and quickly." + }, + { + "id": "worktemplate.devops.product_release.board", + "translation": "Use the Product Release board to support your release timeframe and process, ensuring everyone knows which tasks are due." + }, + { + "id": "worktemplate.devops.incident_resolution.description.playbook", + "translation": "Use checklists and automation to bring in key team members and share how your incident is tracking toward resolution." + }, + { + "id": "worktemplate.devops.incident_resolution.description.channel", + "translation": "Chat with your team about priorities, add stakeholders, provide updates and work toward a resolution in a single channel." + }, + { + "id": "worktemplate.devops.incident_resolution.description.board", + "translation": "Use the Incident Resolution board to support repeatable processes and assign defined tasks across the team." + }, + { + "id": "worktemplate.companywide.goals_and_okrs.integration", + "translation": "Increase productivity in your channel by integrating your most commonly used tools such as Zoom to facilitate easy collaboration. These will be downloaded for you." + }, + { + "id": "worktemplate.companywide.goals_and_okrs.channel", + "translation": "Chat about your goals and progress with your team, async or real-time and stay up to date with changes in a single channel." + }, + { + "id": "worktemplate.companywide.goals_and_okrs.board", + "translation": "Track your team's progress toward organisational goals with the Goals and OKR board. Keep meetings on track with the Meeting Agenda board." + }, + { + "id": "worktemplate.companywide.create_project.integration", + "translation": "Increase productivity in your channel by integrating your most commonly used tools. These will be downloaded for you." + }, + { + "id": "worktemplate.companywide.create_project.channel", + "translation": "Chat with your team about your new project and decide how you’re going to structure it in a collaborative channel." + }, + { + "id": "worktemplate.companywide.create_project.board", + "translation": "Use a Kanban board to define and track your project tasks and progress." + }, + { + "id": "model.license_record.is_valid.bytes.app_error", + "translation": "Invalid value for bytes when uploading a licence." + }, + { + "id": "app.user.run.update_status.title", + "translation": "Status update" + }, + { + "id": "app.user.run.update_status.submit_label", + "translation": "Update status" + }, + { + "id": "app.user.run.update_status.reminder_for_next_update", + "translation": "Reminder for next update" + }, + { + "id": "app.user.run.update_status.num_channel", + "translation": { + "one": "Provide an update to the stakeholders. This post will be broadcasted to {{.Count}} channel.", + "other": "Provide an update to the stakeholders. This post will be broadcasted to {{.Count}} channels." + } + }, + { + "id": "app.user.run.update_status.finish_run.placeholder", + "translation": "Also mark the run as finished" + }, + { + "id": "app.user.run.update_status.finish_run", + "translation": "Finish run" + }, + { + "id": "app.user.run.update_status.change_since_last_update", + "translation": "Change since last update" + }, + { + "id": "app.user.run.status_enable", + "translation": "@{{.Username}} enabled the status updates for [{{.RunName}}]({{.RunURL}})" + }, + { + "id": "app.user.run.status_disable", + "translation": "@{{.Username}} disabled the status updates for [{{.RunName}}]({{.RunURL}})" + }, + { + "id": "app.user.run.request_update", + "translation": "@here — @{{.Name}} requested a status update for [{{.RunName}}]({{.RunURL}}). \n" + }, + { + "id": "app.user.run.request_join_channel", + "translation": "@{{.Name}} is a run participant and wants join this channel. Any member of the channel can invite them.\n" + }, + { + "id": "app.user.run.confirm_finish.title", + "translation": "Confirm finish run" + }, + { + "id": "app.user.run.confirm_finish.submit_label", + "translation": "Finish run" + }, + { + "id": "app.user.run.confirm_finish.num_outstanding", + "translation": { + "one": "There is **{{.Count}} outstanding task**. Are you sure you want to finish the run *{{.RunName}}* for all participants?", + "other": "There are **{{.Count}} outstanding tasks**. Are you sure you want to finish the run *{{.RunName}}* for all participants?" + } + }, + { + "id": "app.user.run.add_to_timeline.title", + "translation": "Add to run timeline" + }, + { + "id": "app.user.run.add_to_timeline.summary.placeholder", + "translation": "Short summary shown in the timeline" + }, + { + "id": "app.user.run.add_to_timeline.summary.help", + "translation": "Max 64 characters" + }, + { + "id": "app.user.run.add_to_timeline.summary", + "translation": "Summary" + }, + { + "id": "app.user.run.add_to_timeline.submit_label", + "translation": "Add to run timeline" + }, + { + "id": "app.user.run.add_to_timeline.playbook_run", + "translation": "Playbook Run" + }, + { + "id": "app.user.run.add_checklist_item.title", + "translation": "Add new task" + }, + { + "id": "app.user.run.add_checklist_item.submit_label", + "translation": "Add task" + }, + { + "id": "app.user.run.add_checklist_item.name", + "translation": "Name" + }, + { + "id": "app.user.run.add_checklist_item.description", + "translation": "Description" + }, + { + "id": "app.user.new_run.title", + "translation": "Run playbook" + }, + { + "id": "app.user.new_run.submit_label", + "translation": "Start run" + }, + { + "id": "app.user.new_run.run_name", + "translation": "Run name" + }, + { + "id": "app.user.new_run.playbook", + "translation": "Playbook" + }, + { + "id": "app.user.new_run.intro", + "translation": "**Owner** {{.Username}}" + }, + { + "id": "app.user.digest.tasks.zero_assigned", + "translation": "You have 0 assigned tasks." + }, + { + "id": "app.user.digest.tasks.num_assigned_due_until_today", + "translation": { + "one": "You have {{.Count}} assigned task that is now due:", + "other": "You have {{.Count}} assigned tasks that are now due:" + } + }, + { + "id": "app.user.digest.tasks.num_assigned", + "translation": { + "one": "You have {{.Count}} assigned task:", + "other": "You have {{.Count}} total assigned tasks:" + } + }, + { + "id": "app.user.digest.tasks.heading", + "translation": "Your assigned tasks" + }, + { + "id": "app.user.digest.tasks.due_yesterday", + "translation": "Due yesterday" + }, + { + "id": "app.user.digest.tasks.due_x_days_ago", + "translation": "Due {{.Count}} days ago" + }, + { + "id": "app.user.digest.tasks.due_today", + "translation": "Due today" + }, + { + "id": "app.user.digest.tasks.due_in_x_days", + "translation": { + "one": "Due in {{.Count}} day", + "other": "Due in {{.Count}} days" + } + }, + { + "id": "app.user.digest.tasks.due_after_today", + "translation": { + "one": "You have **{{.Count}} assigned task due after today**.", + "other": "You have **{{.Count}} assigned tasks due after today**." + } + }, + { + "id": "app.user.digest.tasks.all_tasks_command", + "translation": "Please use `/playbook todo` to see all your tasks." + }, + { + "id": "app.user.digest.runs_in_progress.zero_in_progress", + "translation": "You have 0 runs currently in progress." + }, + { + "id": "app.user.digest.runs_in_progress.num_in_progress", + "translation": { + "one": "You have {{.Count}} run currently in progress:", + "other": "You have {{.Count}} runs currently in progress:" + } + }, + { + "id": "app.user.digest.runs_in_progress.heading", + "translation": "Runs in Progress" + }, + { + "id": "app.user.digest.overdue_status_updates.zero_overdue", + "translation": "You have 0 runs overdue." + }, + { + "id": "app.user.digest.overdue_status_updates.num_overdue", + "translation": { + "one": "You have {{.Count}} run overdue for a status update:", + "other": "You have {{.Count}} runs overdue for a status update:" + } + }, + { + "id": "app.user.digest.overdue_status_updates.heading", + "translation": "Overdue Status Updates" + }, + { + "id": "app.oauth.remove_auth_data_by_client_id.app_error", + "translation": "Unable to remove OAuth data." + }, + { + "id": "app.command.execute.error", + "translation": "Unable to execute command." + }, + { + "id": "api.server.cws.subscribe_to_newsletter.app_error", + "translation": "CWS Server failed to subscribe to newsletter." + }, + { + "id": "api.license.request-trial.bad-request.business-email", + "translation": "Invalid business email for trial" } ] diff --git a/server/i18n/es.json b/server/i18n/es.json index 6a8f3c43ce..f919a013e4 100644 --- a/server/i18n/es.json +++ b/server/i18n/es.json @@ -3139,10 +3139,6 @@ "id": "ent.elasticsearch.search_posts.unmarshall_post_failed", "translation": "No pudo decodificar los resultados de búsqueda" }, - { - "id": "ent.elasticsearch.start.already_started.app_error", - "translation": "Elasticsearch ya fue iniciado." - }, { "id": "ent.elasticsearch.start.create_bulk_processor_failed.app_error", "translation": "No se pudo crear el procesador a granel de Elasticsearch." diff --git a/server/i18n/fa.json b/server/i18n/fa.json index f9d6cb94df..529465d842 100644 --- a/server/i18n/fa.json +++ b/server/i18n/fa.json @@ -1959,10 +1959,6 @@ "id": "ent.elasticsearch.start.create_bulk_processor_failed.app_error", "translation": "پردازنده انبوه جستجوی الاستیک ایجاد نشد." }, - { - "id": "ent.elasticsearch.start.already_started.app_error", - "translation": "جستجوی الاستیک در حال حاضر آغاز شده است." - }, { "id": "ent.elasticsearch.search_users.unmarshall_user_failed", "translation": "رمزگشایی نتایج جستجو انجام نشد" diff --git a/server/i18n/fr.json b/server/i18n/fr.json index 77720df20d..5a15ff6ff4 100644 --- a/server/i18n/fr.json +++ b/server/i18n/fr.json @@ -3139,10 +3139,6 @@ "id": "ent.elasticsearch.search_posts.unmarshall_post_failed", "translation": "Impossible de décoder les résultats de recherche" }, - { - "id": "ent.elasticsearch.start.already_started.app_error", - "translation": "Elasticsearch est déjà démarré" - }, { "id": "ent.elasticsearch.start.create_bulk_processor_failed.app_error", "translation": "Impossible de créer le processeur d'opérations en masse d'Elasticsearch (Elasticsearch bulk processor)" diff --git a/server/i18n/hu.json b/server/i18n/hu.json index e66cb9ae7f..4f48f7723a 100644 --- a/server/i18n/hu.json +++ b/server/i18n/hu.json @@ -3331,10 +3331,6 @@ "id": "ent.elasticsearch.start.create_bulk_processor_failed.app_error", "translation": "Nem sikerült létrehozni az Elasticsearch tömeges feldolgozót." }, - { - "id": "ent.elasticsearch.start.already_started.app_error", - "translation": "Az Elasticsearch már elindult." - }, { "id": "ent.elasticsearch.search_users.unmarshall_user_failed", "translation": "Nem sikerült dekódolni a keresési eredményeket" diff --git a/server/i18n/it.json b/server/i18n/it.json index 0129b143eb..24c1fd89a4 100644 --- a/server/i18n/it.json +++ b/server/i18n/it.json @@ -3139,10 +3139,6 @@ "id": "ent.elasticsearch.search_posts.unmarshall_post_failed", "translation": "Impossibile decodificare i risultati della ricerca" }, - { - "id": "ent.elasticsearch.start.already_started.app_error", - "translation": "Elasticsearch è già in esecuzione." - }, { "id": "ent.elasticsearch.start.create_bulk_processor_failed.app_error", "translation": "Impossibile creare il processore massivo Elasticsearch." diff --git a/server/i18n/ja.json b/server/i18n/ja.json index 58aa66d022..e3151fe5a4 100644 --- a/server/i18n/ja.json +++ b/server/i18n/ja.json @@ -3131,10 +3131,6 @@ "id": "ent.elasticsearch.search_posts.unmarshall_post_failed", "translation": "検索結果をデコードできませんでした" }, - { - "id": "ent.elasticsearch.start.already_started.app_error", - "translation": "Elasticsearchは既に起動しています。" - }, { "id": "ent.elasticsearch.start.create_bulk_processor_failed.app_error", "translation": "Elasticsearch Bulk Processorを生成することが出来ませんでした。" @@ -9601,7 +9597,7 @@ }, { "id": "worktemplate.category.product_teams", - "translation": "製品チーム" + "translation": "プロダクト" }, { "id": "model.draft.is_valid.priority.app_error", @@ -10026,5 +10022,149 @@ { "id": "api.templates.license_up_for_renewal_contact_sales", "translation": "営業に問い合わせる" + }, + { + "id": "worktemplate.product_teams.sprint_planning.integration", + "translation": "Zoomなどのよく使われるツールと統合し、チャンネルでの生産性を高めていきましょう。これらはあなたのためにダウンロードされます。" + }, + { + "id": "worktemplate.product_teams.sprint_planning.channel", + "translation": "Boardsや統合機能と簡単に連携できるチャンネルで、チームと会話しましょう。" + }, + { + "id": "worktemplate.product_teams.sprint_planning.board", + "translation": "週次目標に向けてスプリントへの分解、優先順位付け、オーナー割り当て、コメントなどを行い、チームの進捗を追跡しましょう。" + }, + { + "id": "worktemplate.product_teams.product_roadmap.channel", + "translation": "利用者からのフィードバックや優先順位についてチームで会話し、一緒に進捗を確認しましょう。" + }, + { + "id": "worktemplate.product_teams.product_roadmap.board", + "translation": "プロダクトロードマップBoardを使用して、ユーザーフィードバックの管理、リソースの割り当て、カレンダービューでの成果物の表示、課題の優先順位付などを行いましょう。" + }, + { + "id": "worktemplate.product_teams.goals_and_okrs.integration", + "translation": "簡単にコラボレーションできるようにするためにZoomなどのよく使うツールを統合し、チャンネルの生産性を向上しましょう。これらのツールは、あなたのためにダウンロードされます。" + }, + { + "id": "worktemplate.product_teams.goals_and_okrs.channel", + "translation": "目標や進捗についてチームと会話し、一つのチャンネルで最新の状況が把握することができるようにしましょう。" + }, + { + "id": "worktemplate.product_teams.goals_and_okrs.board", + "translation": "GoalsやOKRのBoardを使って、組織目標の達成に向けたチームの進捗を確認しましょう。ミーティングアジェンダBoardを使い、ミーティングを計画的に進めましょう。" + }, + { + "id": "worktemplate.product_teams.feature_release.description.playbook", + "translation": "機能開発プロセスをサポートするタスクチェックリストと自動化機能により、部門を超えたコラボレーションを促進しましょう。開発が完了したら、レトロスペクティブを実施し、次のリリースに向けて改善しましょう。" + }, + { + "id": "worktemplate.product_teams.feature_release.description.integration", + "translation": "機能のリリースをサポートするGitHubなどのよく使うツールを統合し、チャンネルの生産性を向上しましょう。これらのツールは、あなたのためにダウンロードされます。" + }, + { + "id": "worktemplate.product_teams.feature_release.description.channel", + "translation": "Boards、Playbooks、その他の統合機能と簡単に連携できるチャンネルで、リリースに向けた問題点や変更点についてチームで会話しましょう。" + }, + { + "id": "worktemplate.product_teams.feature_release.description.board", + "translation": "ミーティングアジェンダBoardで会議を滞りなく進めましょう。また、プロジェクトタスクBoardで仕事量を管理しましょう。" + }, + { + "id": "worktemplate.product_teams.bug_bash.playbook", + "translation": "チェックリストを使ってテスト担当領域を割り当て、自動タスクを使って包括的なバグバッシュプロセスを遂行しましょう。レトロスペクティブを利用して、プロセスの見直しを行い、次回に向けて改善しましょう。" + }, + { + "id": "worktemplate.product_teams.bug_bash.integration", + "translation": "Bug bashの進捗を追跡するためにJiraなどのよく使うツールを統合し、チャンネルの生産性を向上しましょう。これらのツールは、あなたのためにダウンロードされます。" + }, + { + "id": "worktemplate.product_teams.bug_bash.channel", + "translation": "チームが簡単にアクセスできるチャンネルで、バグ報告や解決策を計画・管理しましょう。" + }, + { + "id": "worktemplate.leadership.goals_and_okrs.integration", + "translation": "簡単にコラボレーションできるようにするためにZoomなどのよく使うツールを統合し、チャンネルの生産性を向上しましょう。これらのツールは、あなたのためにダウンロードされます。" + }, + { + "id": "worktemplate.leadership.goals_and_okrs.channel", + "translation": "目標や進捗についてチームと会話し、一つのチャンネルで最新の状況が把握することができるようにしましょう。" + }, + { + "id": "worktemplate.leadership.goals_and_okrs.board", + "translation": "GoalsやOKRのBoardを使って、組織目標の達成に向けたチームの進捗を確認しましょう。ミーティングアジェンダBoardを使い、ミーティングを計画的に進めましょう。" + }, + { + "id": "worktemplate.devops.product_release.playbook", + "translation": "プロダクトのリリースを確実かつ予定通りに行うために、簡単に実行可能な再現性のあるワークフローを作成しましょう。" + }, + { + "id": "worktemplate.devops.product_release.channel", + "translation": "日々のマイルストーンや問題点、成果物に対する変更について簡潔かつ素早くチームで会話しましょう。" + }, + { + "id": "worktemplate.devops.product_release.board", + "translation": "プロダクトリリースBoardを使って、リリースに向けた期間やプロセスを把握し、全員がどのタスクに期限があるかを把握できるようにしましょう。" + }, + { + "id": "worktemplate.devops.incident_resolution.description.playbook", + "translation": "チェックリストや、主要なチームメンバーを集める自動化を利用して、インシデント解決に向けた作業状況を共有しましょう。" + }, + { + "id": "worktemplate.devops.incident_resolution.description.channel", + "translation": "一つのチャンネルの中で優先順位についてチームで会話し、関係者を追加し、最新情報を提供し、課題解決に向けて作業しましょう。" + }, + { + "id": "worktemplate.devops.incident_resolution.description.board", + "translation": "インシデント解決Boardを使用して、チーム全体で再現性のあるプロセスをサポートし、定義済みのタスクを割り当てます。" + }, + { + "id": "worktemplate.companywide.goals_and_okrs.integration", + "translation": "簡単にコラボレーションできるようにするためにZoomなどのよく使うツールを統合し、チャンネルの生産性を向上しましょう。これらのツールは、あなたのためにダウンロードされます。" + }, + { + "id": "worktemplate.companywide.goals_and_okrs.channel", + "translation": "目標や進捗についてチームと会話し、一つのチャンネルで最新の状況が把握することができるようにしましょう。" + }, + { + "id": "worktemplate.companywide.goals_and_okrs.board", + "translation": "GoalsやOKRのBoardを使って、組織目標の達成に向けたチームの進捗を確認しましょう。ミーティングアジェンダBoardを使い、ミーティングを計画的に進めましょう。" + }, + { + "id": "worktemplate.companywide.create_project.integration", + "translation": "よく使われるツールと統合し、チャンネルでの生産性を高めていきましょう。これらはあなたのためにダウンロードされます。" + }, + { + "id": "worktemplate.companywide.create_project.channel", + "translation": "共同作業を行うためのチャンネルで新しいプロジェクトについてチームと会話し、どのように進めていくか決定してきましょう。" + }, + { + "id": "worktemplate.companywide.create_project.board", + "translation": "カンバンボードを使用してタスクと進捗を定義し、追跡しましょう。" + }, + { + "id": "model.license_record.is_valid.bytes.app_error", + "translation": "ライセンスをアップロードする際の bytes が不正な値です。" + }, + { + "id": "ent.elasticsearch.max_version.app_error", + "translation": "Elasticsearch バージョン{{.Version}}は、サポートされている最新バージョン{{.MaxVersion}}より高いバージョンです" + }, + { + "id": "app.plugin.skip_installation.app_error", + "translation": "プラグイン {{.Id}} は、既存のバージョンと同じかより新しいため、インストールをスキップします。" + }, + { + "id": "app.plugin.blocked.app_error", + "translation": "プラグイン {{.Id}} はブロックリストに登録されています。いくつかのプラグインは、このバージョンの Mattermost に組み込まれているためブロックされています。" + }, + { + "id": "api.server.cws.subscribe_to_newsletter.app_error", + "translation": "CWSサーバーがニュースレターを購読できませんでした。" + }, + { + "id": "api.license.request-trial.bad-request.business-email", + "translation": "トライアル用のビジネス用電子メールが不正です" } ] diff --git a/server/i18n/ko.json b/server/i18n/ko.json index ddd30b9753..97296dcbdb 100644 --- a/server/i18n/ko.json +++ b/server/i18n/ko.json @@ -3131,10 +3131,6 @@ "id": "ent.elasticsearch.search_posts.unmarshall_post_failed", "translation": "검색 결과를 디코딩하지 못했습니다" }, - { - "id": "ent.elasticsearch.start.already_started.app_error", - "translation": "Elasticsearch가 이미 시작되었습니다." - }, { "id": "ent.elasticsearch.start.create_bulk_processor_failed.app_error", "translation": "Failed to create Elasticsearch bulk processor" diff --git a/server/i18n/nl.json b/server/i18n/nl.json index 95097c7095..0c4cd3ac01 100644 --- a/server/i18n/nl.json +++ b/server/i18n/nl.json @@ -3135,10 +3135,6 @@ "id": "ent.elasticsearch.search_posts.unmarshall_post_failed", "translation": "Fout bij decoderen van zoekresultaten" }, - { - "id": "ent.elasticsearch.start.already_started.app_error", - "translation": "Elasticsearch is reeds gestart." - }, { "id": "ent.elasticsearch.start.create_bulk_processor_failed.app_error", "translation": "Aanmaken van Elasticsearch-bulkprocessor is mislukt." @@ -9829,5 +9825,225 @@ { "id": "api.templates.license_up_for_renewal_contact_sales", "translation": "Contacteer de verkoopsafdeling" + }, + { + "id": "app.user.digest.tasks.due_today", + "translation": "Vandaag te voldoen" + }, + { + "id": "app.user.digest.tasks.all_tasks_command", + "translation": "Gebruik `/playbook todo` om al je taken te zien." + }, + { + "id": "app.user.digest.runs_in_progress.zero_in_progress", + "translation": "Je hebt momenteel 0 runs lopen." + }, + { + "id": "app.user.digest.runs_in_progress.heading", + "translation": "Runs in uitvoering" + }, + { + "id": "app.user.digest.overdue_status_updates.zero_overdue", + "translation": "Je hebt 0 runs achterstand." + }, + { + "id": "app.user.digest.overdue_status_updates.heading", + "translation": "Achterstallige statusupdates" + }, + { + "id": "app.command.execute.error", + "translation": "Kan commando niet uitvoeren." + }, + { + "id": "api.server.cws.subscribe_to_newsletter.app_error", + "translation": "CWS-server kan zich niet abonneren op nieuwsbrief." + }, + { + "id": "api.server.cws.needs_enterprise_edition", + "translation": "Dienst alleen beschikbaar in Mattermost Enterprise editie" + }, + { + "id": "api.license.request-trial.bad-request.business-email", + "translation": "Ongeldig zakelijk e-mailadres voor proefperiode" + }, + { + "id": "app.user.run.add_to_timeline.playbook_run", + "translation": "Playbook Uitvoering" + }, + { + "id": "app.user.run.add_checklist_item.title", + "translation": "Nieuwe taak toevoegen" + }, + { + "id": "app.user.run.add_checklist_item.submit_label", + "translation": "Taak toevoegen" + }, + { + "id": "app.user.run.add_checklist_item.name", + "translation": "Naam" + }, + { + "id": "app.user.run.add_checklist_item.description", + "translation": "Omschrijving" + }, + { + "id": "app.user.new_run.title", + "translation": "Playbook uitvoeren" + }, + { + "id": "app.user.new_run.submit_label", + "translation": "Uitvoering starten" + }, + { + "id": "app.user.new_run.run_name", + "translation": "Naam van de uitvoering" + }, + { + "id": "app.user.new_run.playbook", + "translation": "Playbook" + }, + { + "id": "app.user.new_run.intro", + "translation": "**Eigenaar** {{.Username}}" + }, + { + "id": "app.user.digest.tasks.zero_assigned", + "translation": "Je hebt 0 toegewezen taken." + }, + { + "id": "app.user.digest.tasks.num_assigned_due_until_today", + "translation": { + "one": "Je hebt {{.Count}} taak toegewezen gekregen die nu verloopt:", + "other": "Je hebt {{.Count}} taken toegewezen gekregen die nu verlopen:" + } + }, + { + "id": "app.user.digest.tasks.num_assigned", + "translation": { + "one": "Je hebt {{.Count}} toegewezen taak:", + "other": "Je hebt {{.Count}} toegewezen taken:" + } + }, + { + "id": "app.user.digest.tasks.heading", + "translation": "Jouw toegewezen taken" + }, + { + "id": "app.user.digest.tasks.due_yesterday", + "translation": "Verliep gisteren" + }, + { + "id": "app.user.digest.tasks.due_x_days_ago", + "translation": "Verliep {{.Count}} dagen geleden" + }, + { + "id": "app.user.digest.tasks.due_in_x_days", + "translation": { + "one": "Verloopt binnen {{.Count}} dag", + "other": "Verloopt binnen {{.Count}} dagen" + } + }, + { + "id": "app.user.digest.tasks.due_after_today", + "translation": { + "one": "Je hebt **{.Count}} taak toegewezen gekregen die verloopt na vandaag**.", + "other": "Je hebt **{.Count}} taken toegewezen gekregen die verlopen na vandaag**." + } + }, + { + "id": "app.user.digest.runs_in_progress.num_in_progress", + "translation": { + "one": "Je hebt {{.Count}} uitvoering lopen:", + "other": "Je hebt {{.Count}} uitvoeringen lopen:" + } + }, + { + "id": "app.user.digest.overdue_status_updates.num_overdue", + "translation": { + "one": "Je hebt {{.Count}} uitvoering die een statusupdate nodig hebben:", + "other": "Je hebt {{.Count}} uitvoeringen die een statusupdate nodig hebben:" + } + }, + { + "id": "app.plugin.skip_installation.app_error", + "translation": "De installatie van plugin {{.Id}} wordt overgeslagen omdat de bestaande versie gelijk is of nieuwer." + }, + { + "id": "app.plugin.blocked.app_error", + "translation": "Plugin {{.Id}} staat op de lijst met geblokkeerde apps. Sommige plugins worden geblokkeerd omdat ze nu ingebouwd zijn in deze versie van Mattermost." + }, + { + "id": "app.user.run.add_to_timeline.summary", + "translation": "Samenvatting" + }, + { + "id": "app.user.run.add_to_timeline.submit_label", + "translation": "Toevoegen aan de uitvoeringstijdlijn" + }, + { + "id": "app.user.run.update_status.reminder_for_next_update", + "translation": "Herinnering voor de volgende update" + }, + { + "id": "app.user.run.update_status.num_channel", + "translation": { + "one": "Geef een update aan de belanghebbenden. Dit bericht zal verstuurd worden naar {{.Count}} kanaal.", + "other": "Geef een update aan de belanghebbenden. Dit bericht zal verstuurd worden naar {{.Count}} kanalen." + } + }, + { + "id": "app.user.run.update_status.finish_run.placeholder", + "translation": "Markeer ook de uitvoering als beëindigd" + }, + { + "id": "app.user.run.update_status.finish_run", + "translation": "Uitvoering beëindigen" + }, + { + "id": "app.user.run.update_status.change_since_last_update", + "translation": "Wijziging sinds laatste update" + }, + { + "id": "app.user.run.status_enable", + "translation": "@{.Username}} heeft de statusupdates voor [{{.RunName}}]({{.RunURL}}) uitgeschakeld" + }, + { + "id": "app.user.run.status_disable", + "translation": "@{{.Username}} heeft de statusupdates voor [{{.RunName}}]({{.RunURL}}) uitgeschakeld" + }, + { + "id": "app.user.run.request_update", + "translation": "@here - @{{.Name}} vroeg een statusupdate aan voor [{{.RunName}}]({{.RunURL}}). \n" + }, + { + "id": "app.user.run.request_join_channel", + "translation": "@{{.Name}} is een deelnemer aan de uitvoering en wil lid worden van dit kanaal. Elk lid van het kanaal kan hen uitnodigen.\n" + }, + { + "id": "app.user.run.confirm_finish.title", + "translation": "Bevestig beëindigen uitvoering" + }, + { + "id": "app.user.run.confirm_finish.submit_label", + "translation": "Uitvoering beëindigen" + }, + { + "id": "app.user.run.confirm_finish.num_outstanding", + "translation": { + "one": "Er is **{.Count}} openstaande taak**. Weet je zeker dat je de uitvoering *{.RunName}}* voor alle deelnemers wilt beëindigen?", + "other": "Er is **{.Count}} openstaande taken**. Weet je zeker dat je de uitvoering *{.RunName}}* voor alle deelnemer wilt beëindigen?" + } + }, + { + "id": "app.user.run.add_to_timeline.title", + "translation": "Toevoegen aan de uitvoeringstijdlijn" + }, + { + "id": "app.user.run.add_to_timeline.summary.placeholder", + "translation": "Korte samenvatting weergeven in de tijdlijn" + }, + { + "id": "app.user.run.add_to_timeline.summary.help", + "translation": "Maximaal 64 tekens" } ] diff --git a/server/i18n/pl.json b/server/i18n/pl.json index 339c00b48b..0dd6c16644 100644 --- a/server/i18n/pl.json +++ b/server/i18n/pl.json @@ -3139,10 +3139,6 @@ "id": "ent.elasticsearch.search_posts.unmarshall_post_failed", "translation": "Błąd w dekodowaniu wyników wyszukiwania" }, - { - "id": "ent.elasticsearch.start.already_started.app_error", - "translation": "Elasticsearch jest obecnie uruchomiony." - }, { "id": "ent.elasticsearch.start.create_bulk_processor_failed.app_error", "translation": "Nie udało się utworzyć procesora zbiorczego Elasticsearch." @@ -10050,5 +10046,149 @@ { "id": "app.user.run.add_to_timeline.title", "translation": "Dodaj do osi czasu uruchomienia" + }, + { + "id": "worktemplate.companywide.goals_and_okrs.board", + "translation": "Śledź postępy swojego zespołu w realizacji celów organizacji dzięki tablicy Cele i OKR. Utrzymuj spotkania na właściwym torze dzięki tablicy Agenda spotkań." + }, + { + "id": "worktemplate.companywide.create_project.integration", + "translation": "Zwiększ produktywność na swoim kanale, integrując najczęściej używane narzędzia. Zostaną one pobrane za Ciebie." + }, + { + "id": "worktemplate.companywide.create_project.channel", + "translation": "Porozmawiaj ze swoim zespołem o nowym projekcie i zdecyduj, jak zamierzasz go ustrukturyzować, na kanale współpracy." + }, + { + "id": "worktemplate.companywide.create_project.board", + "translation": "Użyj tablicy Kanban, aby zdefiniować i śledzić zadania i postępy w projekcie." + }, + { + "id": "model.license_record.is_valid.bytes.app_error", + "translation": "Nieprawidłowa wartość dla bajtów podczas wgrywania licencji." + }, + { + "id": "ent.elasticsearch.max_version.app_error", + "translation": "Wersja Elasticsearch {{.Version}} jest wyższa niż maksymalnie obsługiwana wersja {{.MaxVersion}}" + }, + { + "id": "app.plugin.skip_installation.app_error", + "translation": "Pomijanie instalacji wtyczki {{.Id}}, ponieważ istniejąca wersja jest równa lub nowsza." + }, + { + "id": "app.plugin.blocked.app_error", + "translation": "Wtyczka {{.Id}} jest na liście blokowanych. Niektóre wtyczki są zablokowane, ponieważ są wbudowane w tę wersję Mattermost." + }, + { + "id": "api.server.cws.subscribe_to_newsletter.app_error", + "translation": "Serwer CWS nie zdołał zapisać się do newslettera." + }, + { + "id": "api.license.request-trial.bad-request.business-email", + "translation": "Nieprawidłowy e-mail służbowy dla wersji testowej" + }, + { + "id": "worktemplate.product_teams.sprint_planning.integration", + "translation": "Zwiększ produktywność swojego kanału poprzez integrację najczęściej używanych narzędzi, takich jak Zoom. Zostaną one pobrane za Ciebie." + }, + { + "id": "worktemplate.product_teams.sprint_planning.channel", + "translation": "Czatuj ze swoim zespołem w kanale, który łatwo łączy się z Twoimi tablicami i integracjami." + }, + { + "id": "worktemplate.product_teams.sprint_planning.board", + "translation": "Śledź postępy swojego zespołu w realizacji tygodniowych celów dzięki podziałom na sprinty, ustalaniu priorytetów, przypisywaniu właścicieli i komentarzom." + }, + { + "id": "worktemplate.product_teams.product_roadmap.channel", + "translation": "Porozmawiaj ze swoim zespołem o opiniach klientów, ustal priorytety i wspólnie ustalcie postępy." + }, + { + "id": "worktemplate.product_teams.product_roadmap.board", + "translation": "Wykorzystaj tablicę Product Roadmap do zarządzania opiniami użytkowników, przydzielania zasobów, przeglądania zadań w widoku kalendarza i nadawania priorytetów." + }, + { + "id": "worktemplate.product_teams.goals_and_okrs.integration", + "translation": "Zwiększ produktywność swojego kanału, integrując najczęściej używane narzędzia, takie jak Zoom, aby ułatwić współpracę. Zostaną one pobrane za Ciebie." + }, + { + "id": "worktemplate.product_teams.goals_and_okrs.channel", + "translation": "Czatuj o swoich celach i postępach ze swoim zespołem, asynchronicznie lub w czasie rzeczywistym, i bądź na bieżąco ze zmianami na jednym kanale." + }, + { + "id": "worktemplate.product_teams.goals_and_okrs.board", + "translation": "Śledź postępy swojego zespołu w realizacji celów organizacyjnych dzięki tablicy Cele i OKR. Utrzymuj spotkania na właściwym torze dzięki tablicy Agenda spotkań." + }, + { + "id": "worktemplate.product_teams.feature_release.description.playbook", + "translation": "Usprawnij współpracę międzyfunkcyjnego zespołu dzięki listom kontrolnym zadań i automatyzacji, które wspierają proces tworzenia funkcji. Kiedy skończysz, przeprowadź retrospektywę i wprowadź ulepszenia do następnego wydania." + }, + { + "id": "worktemplate.product_teams.feature_release.description.integration", + "translation": "Zwiększ wydajność na swoim kanale, integrując najczęściej używane narzędzia do obsługi wydania funkcji, takie jak GitHub. Zostaną one pobrane za Ciebie." + }, + { + "id": "worktemplate.product_teams.feature_release.description.channel", + "translation": "Czatuj ze swoim zespołem na temat wszelkich blokad wydania i zmian w kanale, który łatwo łączy się z tablicami, playbookami i innymi integracjami." + }, + { + "id": "worktemplate.product_teams.feature_release.description.board", + "translation": "Utrzymuj spotkania na właściwym torze dzięki tablicy Agenda spotkań. Zarządzaj swoim obciążeniem pracą dzięki tablicy Zadania projektowe." + }, + { + "id": "worktemplate.product_teams.bug_bash.playbook", + "translation": "Użyj list kontrolnych, aby przypisać obszary testowe i zautomatyzowane zadania, aby uruchomić kompleksowy proces bug bash. Użyj retrospektywy, aby przejrzeć swój proces i poprawić go na następny raz." + }, + { + "id": "worktemplate.product_teams.bug_bash.integration", + "translation": "Zwiększ produktywność w swoim kanale, integrując swoje najczęściej używane narzędzia, takie jak Jira, aby śledzić postępy w bug bashu. Zostaną one pobrane za Ciebie." + }, + { + "id": "worktemplate.product_teams.bug_bash.channel", + "translation": "Planuj i zarządzaj raportami o błędach i rozwiązaniami w jednym kanale, który jest łatwo dostępny dla Twojego zespołu i organizacji." + }, + { + "id": "worktemplate.leadership.goals_and_okrs.integration", + "translation": "Zwiększ produktywność swojego kanału, integrując najczęściej używane narzędzia, takie jak Zoom, aby ułatwić współpracę. Zostaną one pobrane za Ciebie." + }, + { + "id": "worktemplate.leadership.goals_and_okrs.channel", + "translation": "Czatuj o swoich celach i postępach ze swoim zespołem, asynchronicznie lub w czasie rzeczywistym, i bądź na bieżąco ze zmianami w jednym kanale." + }, + { + "id": "worktemplate.leadership.goals_and_okrs.board", + "translation": "Śledź postępy swojego zespołu w realizacji celów organizacyjnych dzięki tablicy Cele i OKR. Utrzymuj spotkania na właściwym torze dzięki tablicy Agenda spotkań." + }, + { + "id": "worktemplate.devops.product_release.playbook", + "translation": "Stwórz powtarzalne przepływy pracy, które są łatwe do naśladowania i wdrożenia, aby wydania produktów były niezawodne i terminowe." + }, + { + "id": "worktemplate.devops.product_release.channel", + "translation": "Rozmawiaj ze swoim zespołem o codziennych kamieniach milowych, wszelkich blokadach i zmianach w produktach - łatwo i szybko." + }, + { + "id": "worktemplate.devops.product_release.board", + "translation": "Użyj tablicy Product Release, aby wesprzeć ramy czasowe i proces wydawania produktów, upewniając się, że wszyscy wiedzą, które zadania są wymagalne." + }, + { + "id": "worktemplate.devops.incident_resolution.description.playbook", + "translation": "Użyj list kontrolnych i automatyzacji, aby wprowadzić kluczowych członków zespołu, i podziel się tym, jak twój incydent jest śledzony w kierunku rozwiązania." + }, + { + "id": "worktemplate.devops.incident_resolution.description.channel", + "translation": "Rozmawiaj ze swoim zespołem o priorytetach, dodawaj interesariuszy, dostarczaj aktualizacje i pracuj nad rozwiązaniem na jednym kanale." + }, + { + "id": "worktemplate.devops.incident_resolution.description.board", + "translation": "Użyj tablicy rozwiązywania incydentów, aby wspierać powtarzalne procesy i przypisywać zdefiniowane zadania w całym zespole." + }, + { + "id": "worktemplate.companywide.goals_and_okrs.integration", + "translation": "Zwiększ produktywność swojego kanału, integrując najczęściej używane narzędzia, takie jak Zoom, aby ułatwić współpracę. Zostaną one pobrane za Ciebie." + }, + { + "id": "worktemplate.companywide.goals_and_okrs.channel", + "translation": "Czatuj o swoich celach i postępach ze swoim zespołem, asynchronicznie lub w czasie rzeczywistym, i bądź na bieżąco ze zmianami w jednym kanale." } ] diff --git a/server/i18n/pt-BR.json b/server/i18n/pt-BR.json index 48f679a2be..cedc2e535b 100644 --- a/server/i18n/pt-BR.json +++ b/server/i18n/pt-BR.json @@ -649,7 +649,7 @@ }, { "id": "api.command_invite.hint", - "translation": "@[username] ~[channel]" + "translation": "@[username] ~[channel]..." }, { "id": "api.command_invite.missing_message.app_error", @@ -3139,10 +3139,6 @@ "id": "ent.elasticsearch.search_posts.unmarshall_post_failed", "translation": "Falha ao decodificar os resultados da pesquisa" }, - { - "id": "ent.elasticsearch.start.already_started.app_error", - "translation": "Elasticsearch já está iniciado." - }, { "id": "ent.elasticsearch.start.create_bulk_processor_failed.app_error", "translation": "Erro ao criar o bulk processor do Elastisearch." @@ -4365,7 +4361,7 @@ }, { "id": "model.post.is_valid.type.app_error", - "translation": "Tipo inválido" + "translation": "Tipo inválido." }, { "id": "model.post.is_valid.update_at.app_error", @@ -4373,23 +4369,23 @@ }, { "id": "model.post.is_valid.user_id.app_error", - "translation": "Id de usuário inválido" + "translation": "Id de usuário inválido." }, { "id": "model.preference.is_valid.category.app_error", - "translation": "Categoria inválida" + "translation": "Categoria inválida." }, { "id": "model.preference.is_valid.id.app_error", - "translation": "Id de usuário inválido" + "translation": "Id de usuário inválido." }, { "id": "model.preference.is_valid.name.app_error", - "translation": "Nome inválido" + "translation": "Nome inválido." }, { "id": "model.preference.is_valid.theme.app_error", - "translation": "Tema inválido" + "translation": "Tema inválido." }, { "id": "model.preference.is_valid.value.app_error", @@ -4401,23 +4397,23 @@ }, { "id": "model.reaction.is_valid.emoji_name.app_error", - "translation": "Nome do emoji inválido" + "translation": "Nome do emoji inválido." }, { "id": "model.reaction.is_valid.post_id.app_error", - "translation": "Id da publicação inválida" + "translation": "Id da publicação inválida." }, { "id": "model.reaction.is_valid.user_id.app_error", - "translation": "Id do usuário inválido" + "translation": "Id do usuário inválido." }, { "id": "model.team.is_valid.characters.app_error", - "translation": "Nome deve ter 2 ou mais caracteres alfanuméricos em minúsculas" + "translation": "Nome deve ter 2 ou mais caracteres alfanuméricos em minúsculas." }, { "id": "model.team.is_valid.company.app_error", - "translation": "Nome da empresa inválido" + "translation": "Nome da empresa inválido." }, { "id": "model.team.is_valid.create_at.app_error", @@ -4425,23 +4421,23 @@ }, { "id": "model.team.is_valid.description.app_error", - "translation": "Descrição inválida" + "translation": "Descrição inválida." }, { "id": "model.team.is_valid.domains.app_error", - "translation": "Domínios permitidos inválidos" + "translation": "Domínios permitidos inválidos." }, { "id": "model.team.is_valid.email.app_error", - "translation": "Email inválido" + "translation": "E-mail inválido." }, { "id": "model.team.is_valid.id.app_error", - "translation": "ID inválida" + "translation": "ID inválida." }, { "id": "model.team.is_valid.name.app_error", - "translation": "Nome inválido" + "translation": "Nome inválido." }, { "id": "model.team.is_valid.reserved.app_error", @@ -4449,7 +4445,7 @@ }, { "id": "model.team.is_valid.type.app_error", - "translation": "Tipo inválido" + "translation": "Tipo inválido." }, { "id": "model.team.is_valid.update_at.app_error", @@ -4457,15 +4453,15 @@ }, { "id": "model.team.is_valid.url.app_error", - "translation": "Identificador URL inválida" + "translation": "Identificador URL inválida." }, { "id": "model.team_member.is_valid.team_id.app_error", - "translation": "ID da equipe inválido" + "translation": "ID da equipe inválido." }, { "id": "model.team_member.is_valid.user_id.app_error", - "translation": "Id de usuário inválido" + "translation": "Id de usuário inválido." }, { "id": "model.token.is_valid.expiry", @@ -4549,23 +4545,23 @@ }, { "id": "model.user_access_token.is_valid.description.app_error", - "translation": "Descrição inválida, deve ter 255 caracteres ou menos" + "translation": "Descrição inválida, deve ter 255 caracteres ou menos." }, { "id": "model.user_access_token.is_valid.id.app_error", - "translation": "Valor inválido para id" + "translation": "Valor inválido para id." }, { "id": "model.user_access_token.is_valid.token.app_error", - "translation": "Token de acesso inválido" + "translation": "Token de acesso inválido." }, { "id": "model.user_access_token.is_valid.user_id.app_error", - "translation": "Id do usuário inválido" + "translation": "Id do usuário inválido." }, { "id": "model.utils.decode_json.app_error", - "translation": "não foi possível decodificar" + "translation": "não foi possível decodificar." }, { "id": "model.websocket_client.connect_fail.app_error", @@ -4581,7 +4577,7 @@ }, { "id": "plugin_api.get_file_link.disabled.app_error", - "translation": "Links públicos foram desabilitados" + "translation": "Links públicos foram desabilitados." }, { "id": "plugin_api.get_file_link.no_post.app_error", @@ -4857,7 +4853,7 @@ }, { "id": "model.user.is_valid.id.app_error", - "translation": "Id do usuário inválido" + "translation": "Id do usuário inválido." }, { "id": "model.user.is_valid.first_name.app_error", diff --git a/server/i18n/ro.json b/server/i18n/ro.json index a7ec824541..2b51862302 100644 --- a/server/i18n/ro.json +++ b/server/i18n/ro.json @@ -3139,10 +3139,6 @@ "id": "ent.elasticsearch.search_posts.unmarshall_post_failed", "translation": "Nu a reuşit să decodeze rezultatele cautării" }, - { - "id": "ent.elasticsearch.start.already_started.app_error", - "translation": "Elasticsearch este deja pornit." - }, { "id": "ent.elasticsearch.start.create_bulk_processor_failed.app_error", "translation": "Nu s-a putut crea procesorul în bloc Elasticsearch." diff --git a/server/i18n/ru.json b/server/i18n/ru.json index 452811806c..d2a3876411 100644 --- a/server/i18n/ru.json +++ b/server/i18n/ru.json @@ -3139,10 +3139,6 @@ "id": "ent.elasticsearch.search_posts.unmarshall_post_failed", "translation": "Не удалось декодировать результаты поиска" }, - { - "id": "ent.elasticsearch.start.already_started.app_error", - "translation": "Elasticsearch уже запущен." - }, { "id": "ent.elasticsearch.start.create_bulk_processor_failed.app_error", "translation": "Не удалось создать массовый обработчик Elasticsearch." @@ -9834,5 +9830,365 @@ { "id": "app.oauth.remove_auth_data_by_client_id.app_error", "translation": "Невозможно удалить данные oauth." + }, + { + "id": "app.user.digest.tasks.due_after_today", + "translation": { + "few": "У вас есть **{{.Count}} назначенных задачи, которые необходимо выполнить после сегодняшнего дня**.", + "many": "У вас есть **{{.Count}} назначенных задач, которые необходимо выполнить после сегодняшнего дня**.", + "one": "У вас есть **{{.Count}} назначенная задача, которую необходимо выполнить после сегодняшнего дня**." + } + }, + { + "id": "app.user.digest.tasks.all_tasks_command", + "translation": "Пожалуйста, используйте `/playbook todo`, чтобы увидеть все свои задачи." + }, + { + "id": "app.user.digest.runs_in_progress.zero_in_progress", + "translation": "В настоящее время у вас нет запусков." + }, + { + "id": "app.user.digest.runs_in_progress.num_in_progress", + "translation": { + "few": "У вас запущено {{.Count}}:", + "many": "У вас запущены {{.Count}}:", + "one": "У вас запущен {{.Count}}:" + } + }, + { + "id": "app.user.digest.runs_in_progress.heading", + "translation": "Выполняется" + }, + { + "id": "app.user.digest.overdue_status_updates.zero_overdue", + "translation": "У вас просрочено 0 запусков." + }, + { + "id": "app.user.digest.overdue_status_updates.num_overdue", + "translation": { + "few": "У вас есть {{.Count}} просроченных запуска для обновления статуса:", + "many": "У вас есть {{.Count}} просроченных запусков для обновления статуса:", + "one": "У вас есть {{.Count}} просроченный запуск для обновления статуса:" + } + }, + { + "id": "app.user.digest.overdue_status_updates.heading", + "translation": "Просроченные обновления статуса" + }, + { + "id": "app.command.execute.error", + "translation": "Невозможно выполнить команду." + }, + { + "id": "api.server.cws.subscribe_to_newsletter.app_error", + "translation": "Серверу CWS не удалось подписаться на рассылку новостей." + }, + { + "id": "api.license.request-trial.bad-request.business-email", + "translation": "Недействительный рабочий адрес электронной почты для пробной версии" + }, + { + "id": "app.user.digest.tasks.due_in_x_days", + "translation": { + "few": "Срок исполнения - {{.Count}} дня", + "many": "Срок исполнения - {{.Count}} дней", + "one": "Срок исполнения - {{.Count}} день" + } + }, + { + "id": "app.plugin.skip_installation.app_error", + "translation": "Пропуск установки плагина {{.Id}}, поскольку существующая версия плагина идентична текущей или более новая." + }, + { + "id": "app.plugin.blocked.app_error", + "translation": "Плагин {{.Id}} находится в списке блокировки. Некоторые плагины заблокированы, потому что они встроены в данную версию Mattermost." + }, + { + "id": "app.user.run.confirm_finish.title", + "translation": "Подтвердить завершение запуска" + }, + { + "id": "app.user.run.confirm_finish.submit_label", + "translation": "Завершить запуск" + }, + { + "id": "app.user.run.confirm_finish.num_outstanding", + "translation": { + "few": "Есть **{{.Count}} невыполненные задачи**. Вы уверены, что хотите завершить запуск *{{.RunName}}* для всех участников?", + "many": "Есть **{{.Count}} невыполненных задач**. Вы уверены, что хотите завершить запуск *{{.RunName}}* для всех участников?", + "one": "Есть **{{.Count}} невыполненная задача**. Вы уверены, что хотите завершить запуск *{{.RunName}}* для всех участников?" + } + }, + { + "id": "app.user.run.add_to_timeline.title", + "translation": "Добавить на временную шкалу" + }, + { + "id": "app.user.run.add_to_timeline.summary", + "translation": "Сводка" + }, + { + "id": "app.user.run.add_to_timeline.summary.placeholder", + "translation": "Краткая сводка, отображаемая на временной шкале" + }, + { + "id": "app.user.run.add_to_timeline.summary.help", + "translation": "Максимум 64 символа" + }, + { + "id": "app.user.run.add_to_timeline.submit_label", + "translation": "Добавить на временную шкалу" + }, + { + "id": "app.user.run.add_to_timeline.playbook_run", + "translation": "Запуск сценария" + }, + { + "id": "app.user.run.add_checklist_item.title", + "translation": "Добавить новую задачу" + }, + { + "id": "app.user.run.add_checklist_item.submit_label", + "translation": "Добавить задачу" + }, + { + "id": "app.user.run.add_checklist_item.name", + "translation": "Имя" + }, + { + "id": "app.user.run.add_checklist_item.description", + "translation": "Описание" + }, + { + "id": "app.user.new_run.title", + "translation": "Запустить сценарий" + }, + { + "id": "app.user.new_run.submit_label", + "translation": "Запустить" + }, + { + "id": "app.user.new_run.run_name", + "translation": "Название запуска" + }, + { + "id": "app.user.new_run.playbook", + "translation": "Сценарий" + }, + { + "id": "app.user.new_run.intro", + "translation": "**Владелец** {{.Username}}" + }, + { + "id": "app.user.digest.tasks.num_assigned", + "translation": { + "few": "Вам поручено {{.Count}} задачи:", + "many": "Вам поручено {{.Count}} задач:", + "one": "Вам поручена {{.Count}} задача:" + } + }, + { + "id": "app.user.digest.tasks.num_assigned_due_until_today", + "translation": { + "few": "Вы получили {{.Count}} задачи, срок выполнения которых:", + "many": "Вы получили {{.Count}} задач, срок выполнения которых:", + "one": "Вы получили {{.Count}} задачу, срок выполнения которой:" + } + }, + { + "id": "app.user.digest.tasks.zero_assigned", + "translation": "У вас нет назначенных задач." + }, + { + "id": "app.user.digest.tasks.heading", + "translation": "Ваши назначенные задачи" + }, + { + "id": "app.user.digest.tasks.due_yesterday", + "translation": "Вчера" + }, + { + "id": "app.user.digest.tasks.due_x_days_ago", + "translation": "Срок исполнения {{.Count}} дн. назад" + }, + { + "id": "app.user.digest.tasks.due_today", + "translation": "Сегодня" + }, + { + "id": "app.user.run.status_enable", + "translation": "@{{.Username}} включил обновление статуса для [{{.RunName}}]({{.RunURL}})" + }, + { + "id": "app.user.run.status_disable", + "translation": "@{{.Username}} отключил обновление статуса для [{{.RunName}}]({{.RunURL}})" + }, + { + "id": "app.user.run.request_update", + "translation": "@here — @{{.Name}} запросил обновление статуса для [{{.RunName}}]({{.RunURL}}). \n" + }, + { + "id": "app.user.run.request_join_channel", + "translation": "@{{.Name}} является участником запуска и хочет присоединиться к этому каналу. Любой участник канала может пригласить его.\n" + }, + { + "id": "worktemplate.product_teams.product_roadmap.channel", + "translation": "Обсудите со своей командой отзывы клиентов, расставьте приоритеты и вместе согласуйте прогресс и планы." + }, + { + "id": "worktemplate.product_teams.product_roadmap.board", + "translation": "Используйте доску \"Дорожная карта продукта\" (Product Roadmap) для управления отзывами пользователей, назначения ресурсов, просмотра результатов в календарном режиме и определения приоритетности проблем." + }, + { + "id": "worktemplate.product_teams.goals_and_okrs.integration", + "translation": "Повысьте производительность вашего канала, интегрировав наиболее часто используемые инструменты, такие как Zoom, для облегчения совместной работы. Они будут загружены для вас." + }, + { + "id": "worktemplate.product_teams.goals_and_okrs.channel", + "translation": "Общайтесь о своих целях и прогрессе работ с командой в режиме асинхронного или реального времени и будьте в курсе всех изменений в едином канале." + }, + { + "id": "worktemplate.product_teams.goals_and_okrs.board", + "translation": "Отслеживайте прогресс вашей команды в достижении организационных целей с помощью доски \"Цели и ОКР\" (OKR board). Следите за ходом совещаний с помощью доски \"Повестка совещания\" (Meeting Agenda)." + }, + { + "id": "worktemplate.product_teams.feature_release.description.playbook", + "translation": "Усильте межфункциональное сотрудничество команды с помощью контрольных списков задач и автоматизации, которые поддерживают процесс разработки функций. После завершения работы проведите ретроспективу и внесите улучшения в следующий релиз." + }, + { + "id": "worktemplate.product_teams.feature_release.description.integration", + "translation": "Повысьте производительность вашего канала, интегрировав наиболее часто используемые инструменты для поддержки выпуска функций, например GitHub. Они будут загружены для вас." + }, + { + "id": "worktemplate.product_teams.feature_release.description.channel", + "translation": "Общайтесь со своей командой о любых блокировках релиза и изменениях в канале, который легко подключается к вашим доскам, плейбукам и другим интеграциям." + }, + { + "id": "worktemplate.product_teams.feature_release.description.board", + "translation": "Ведите совещания по плану с помощью доски \"Повестка совещания\" (Meeting Agenda). Управляйте своей рабочей нагрузкой с помощью доски \"Задачи проекта\" (Project Tasks)." + }, + { + "id": "worktemplate.product_teams.bug_bash.playbook", + "translation": "Используйте контрольные списки для распределения областей тестирования и автоматизации задач для проведения комплексного процесса устранения ошибок. Используйте ретроспективу, чтобы проанализировать свой процесс и улучшить его для следующего раза." + }, + { + "id": "worktemplate.product_teams.bug_bash.integration", + "translation": "Повысьте продуктивность вашего канала, интегрировав наиболее часто используемые инструменты, такие как Jira, для отслеживания хода работы над ошибками. Они будут загружены для вас." + }, + { + "id": "worktemplate.product_teams.bug_bash.channel", + "translation": "Планируйте и управляйте сообщениями об ошибках и решениями в едином канале, который легко доступен для вашей команды и организации." + }, + { + "id": "worktemplate.leadership.goals_and_okrs.integration", + "translation": "Повысьте производительность вашего канала, интегрировав наиболее часто используемые инструменты, такие как Zoom, для облегчения совместной работы. Они будут загружены для вас." + }, + { + "id": "worktemplate.leadership.goals_and_okrs.channel", + "translation": "Общайтесь о своих целях и прогрессе работ с командой в режиме асинхронного или реального времени и будьте в курсе всех изменений в едином канале." + }, + { + "id": "worktemplate.leadership.goals_and_okrs.board", + "translation": "Отслеживайте прогресс вашей команды в достижении организационных целей с помощью доски \"Цели и ОКР\" (OKR board). Следите за ходом совещаний с помощью доски \"Повестка совещания\" (Meeting Agenda)." + }, + { + "id": "worktemplate.devops.product_release.playbook", + "translation": "Создайте повторяющиеся рабочие процессы, которые легко соблюдать и внедрять, чтобы выпуск продукции был надежным и своевременным." + }, + { + "id": "worktemplate.devops.product_release.channel", + "translation": "Легко и быстро общайтесь со своей командой по поводу ежедневных этапов, любых блокирующих факторов и изменений в результатах работы." + }, + { + "id": "worktemplate.devops.product_release.board", + "translation": "Используйте доску релиза продукта (Product Release) для поддержки сроков и процесса выпуска, чтобы каждый знал, какие задачи подлежат выполнению." + }, + { + "id": "worktemplate.devops.incident_resolution.description.playbook", + "translation": "Используйте контрольные списки и автоматизацию, чтобы привлечь ключевых членов команды, и расскажите, как продвигается процесс разрешения инцидента." + }, + { + "id": "worktemplate.devops.incident_resolution.description.channel", + "translation": "Общайтесь со своей командой о приоритетах, добавляйте заинтересованные стороны, предоставляйте обновления и работайте над решением в едином канале." + }, + { + "id": "worktemplate.devops.incident_resolution.description.board", + "translation": "Используйте доску по разрешению инцидентов для поддержки повторяющихся процессов и назначения определенных задач для всей команды." + }, + { + "id": "worktemplate.companywide.goals_and_okrs.integration", + "translation": "Повысьте производительность вашего канала, интегрировав наиболее часто используемые инструменты, такие как Zoom, для облегчения совместной работы. Они будут загружены для вас." + }, + { + "id": "worktemplate.companywide.goals_and_okrs.channel", + "translation": "Общайтесь о своих целях и прогрессе работ с командой в режиме асинхронного или реального времени и будьте в курсе всех изменений в едином канале." + }, + { + "id": "worktemplate.companywide.goals_and_okrs.board", + "translation": "Отслеживайте прогресс вашей команды в достижении организационных целей с помощью доски \"Цели и ОКР\". Следите за ходом совещаний с помощью доски \"Повестка совещания\"." + }, + { + "id": "worktemplate.companywide.create_project.integration", + "translation": "Повысьте производительность вашего канала, интегрировав наиболее часто используемые инструменты. Они будут загружены для вас." + }, + { + "id": "worktemplate.companywide.create_project.channel", + "translation": "Обсудите со своей командой новый проект и решите, как вы собираетесь его структурировать, в канале совместной работы." + }, + { + "id": "worktemplate.companywide.create_project.board", + "translation": "Используйте доску Kanban для определения и отслеживания задач и хода выполнения проекта." + }, + { + "id": "model.license_record.is_valid.bytes.app_error", + "translation": "Недопустимое значение для байтов при загрузке лицензии." + }, + { + "id": "ent.elasticsearch.max_version.app_error", + "translation": "Версия Elasticsearch {{.Version}} выше максимально поддерживаемой версии {{.MaxVersion}}" + }, + { + "id": "app.user.run.update_status.title", + "translation": "Статус обновлен" + }, + { + "id": "app.user.run.update_status.submit_label", + "translation": "Обновить статус" + }, + { + "id": "app.user.run.update_status.reminder_for_next_update", + "translation": "Напоминание для следующего обновления" + }, + { + "id": "app.user.run.update_status.num_channel", + "translation": { + "few": "Предоставьте заинтересованным сторонам обновленную информацию. Этот пост будет транслироваться на {{.Count}} канала.", + "many": "Предоставьте заинтересованным сторонам обновленную информацию. Этот пост будет транслироваться на {{.Count}} каналов.", + "one": "Предоставьте заинтересованным сторонам обновленную информацию. Этот пост будет транслироваться на {{.Count}} канал." + } + }, + { + "id": "app.user.run.update_status.finish_run.placeholder", + "translation": "Отметьте запуск как завершенный" + }, + { + "id": "app.user.run.update_status.finish_run", + "translation": "Завершить запуск" + }, + { + "id": "app.user.run.update_status.change_since_last_update", + "translation": "Изменения с последнего обновления" + }, + { + "id": "worktemplate.product_teams.sprint_planning.integration", + "translation": "Повысьте производительность вашего канала за счет интеграции наиболее часто используемых инструментов, таких как Zoom. Они будут загружены для вас." + }, + { + "id": "worktemplate.product_teams.sprint_planning.channel", + "translation": "Общайтесь со своей командой в канале, который легко подключается к вашим доскам и интеграциям." + }, + { + "id": "worktemplate.product_teams.sprint_planning.board", + "translation": "Отслеживайте прогресс вашей команды в достижении еженедельных целей с помощью разбивки спринтов, определения приоритетов, назначения владельцев и комментариев." } ] diff --git a/server/i18n/sv.json b/server/i18n/sv.json index f63afba27a..d7d06969ec 100644 --- a/server/i18n/sv.json +++ b/server/i18n/sv.json @@ -3079,10 +3079,6 @@ "id": "ent.elasticsearch.start.create_bulk_processor_failed.app_error", "translation": "Misslyckades att skapa Elasticsearch bulk processor." }, - { - "id": "ent.elasticsearch.start.already_started.app_error", - "translation": "Elasticsearch är redan startat." - }, { "id": "ent.elasticsearch.search_users.unmarshall_user_failed", "translation": "Kunde inte avkoda sökresultaten" @@ -9532,7 +9528,7 @@ }, { "id": "worktemplate.category.product_teams", - "translation": "Produkt-team" + "translation": "Produkt" }, { "id": "model.draft.is_valid.user_id.app_error", @@ -10041,5 +10037,69 @@ { "id": "app.command.execute.error", "translation": "Kunde inte utföra kommandot." + }, + { + "id": "worktemplate.devops.incident_resolution.description.channel", + "translation": "Chatta med ditt team om prioriteringar, lägg till intressenter, ge uppdateringar och arbeta mot en lösning i en och samma kanal." + }, + { + "id": "worktemplate.devops.incident_resolution.description.board", + "translation": "Använd Incident Resolution tavlan för att stödja upprepbara processer och fördela definierade uppgifter i hela teamet." + }, + { + "id": "worktemplate.companywide.goals_and_okrs.integration", + "translation": "Öka produktiviteten i din kanal genom att integrera dina mest använda verktyg, exempelvis Zoom, för att underlätta samarbetet. Dessa kommer att laddas ner åt dig." + }, + { + "id": "worktemplate.companywide.goals_and_okrs.channel", + "translation": "Chatta om dina mål och framsteg med ditt team, asynkront eller i realtid, och håll dig uppdaterad om förändringar i en och samma kanal." + }, + { + "id": "worktemplate.companywide.goals_and_okrs.board", + "translation": "Håll koll på teamets steg mot de organisatoriska målen med OKR-tavlan. Håll möten på rätt spår med hjälp av Mötesagenda-tavlan." + }, + { + "id": "worktemplate.companywide.create_project.integration", + "translation": "Öka produktiviteten i din kanal genom att integrera dina mest använda verktyg. Dessa kommer att laddas ner åt dig." + }, + { + "id": "worktemplate.companywide.create_project.channel", + "translation": "Chatta med ditt team om ditt nya projekt och bestäm hur ni ska strukturera det i en samarbetskanal." + }, + { + "id": "worktemplate.companywide.create_project.board", + "translation": "Använd en Kanban-tavla för att definiera och hålla koll på dina uppgifter och framsteg i projekt." + }, + { + "id": "model.license_record.is_valid.bytes.app_error", + "translation": "Felaktigt värde för bytes licensen laddas upp." + }, + { + "id": "ent.elasticsearch.max_version.app_error", + "translation": "Elasticsearch-versionen {{.Version}} är högre än {{.MaxVersion}} som är den högsta versionen som stöds" + }, + { + "id": "app.plugin.skip_installation.app_error", + "translation": "Hoppar över installationen av plugin {{.Id}} eftersom den befintliga versionen är samma eller nyare." + }, + { + "id": "app.plugin.blocked.app_error", + "translation": "Plugin {{.Id}} finns på blocklistan. Vissa plugins är blockerade eftersom de är inbyggda i den här versionen av Mattermost." + }, + { + "id": "api.server.cws.subscribe_to_newsletter.app_error", + "translation": "CWS Server misslyckades med att prenumerera på nyhetsbrev." + }, + { + "id": "api.license.true_up_review.failed_to_submit", + "translation": "Har inte skickat in en korrekt granskningsprofil till CWS." + }, + { + "id": "api.license.request-trial.bad-request.business-email", + "translation": "Felaktig företagsmejl för prova på-period" + }, + { + "id": "api.error_no_organization_name_provided_for_self_hosted_onboarding", + "translation": "Fel: inget organisationsnamn har angetts för egen onboarding." } ] diff --git a/server/i18n/tr.json b/server/i18n/tr.json index 218846ffc4..58af066bbd 100644 --- a/server/i18n/tr.json +++ b/server/i18n/tr.json @@ -1505,7 +1505,7 @@ }, { "id": "api.slackimport.slack_add_channels.added", - "translation": "\nKanallar eklendi:\n" + "translation": "\nEklenen kanallar:\n" }, { "id": "api.slackimport.slack_add_channels.failed_to_add_user", @@ -1521,7 +1521,7 @@ }, { "id": "api.slackimport.slack_add_users.created", - "translation": "\nKullanıcılar eklendi:\n" + "translation": "\nEklenen kullanıcılar:\n" }, { "id": "api.slackimport.slack_add_users.email_pwd", @@ -3135,10 +3135,6 @@ "id": "ent.elasticsearch.search_posts.unmarshall_post_failed", "translation": "Arama sonuçlarının kodu çözülemedi" }, - { - "id": "ent.elasticsearch.start.already_started.app_error", - "translation": "Elasticsearch zaten başlatılmış." - }, { "id": "ent.elasticsearch.start.create_bulk_processor_failed.app_error", "translation": "Elasticsearch toplu işlemi oluşturulamadı." @@ -9508,7 +9504,7 @@ }, { "id": "worktemplate.category.product_teams", - "translation": "Ürün takımları" + "translation": "Ürün" }, { "id": "model.draft.is_valid.user_id.app_error", @@ -9833,5 +9829,345 @@ { "id": "api.command_templates.desc", "translation": "Kalıptan oluştur penceresini aç" + }, + { + "id": "worktemplate.product_teams.sprint_planning.board", + "translation": "Acil sorunlar, önceliklendirme, sahip atama ve yorumlarla ekibinizin haftalık hedeflere doğru ilerlemesini izleyin." + }, + { + "id": "worktemplate.product_teams.sprint_planning.integration", + "translation": "Zoom gibi sık kullandığınız araçlar ile bütünleştirerek kanalınızdaki üretkenliği artırın. Bunlar sizin için indirilir." + }, + { + "id": "worktemplate.product_teams.sprint_planning.channel", + "translation": "Panolarınız ve bütünleştirmelerinizle kolayca bağlantı kuran bir kanalda ekibinizle sohbet edin." + }, + { + "id": "worktemplate.product_teams.product_roadmap.channel", + "translation": "Müşterilerinizin geri bildirimleri ve önceliklendirme hakkında ekibinizle sohbet ederek birlikte ilerleme kaydedin." + }, + { + "id": "worktemplate.product_teams.product_roadmap.board", + "translation": "Kullanıcı geri bildirimlerini yönetmek, kaynak atamak, çıktıları takvimde görüntülemek ve sorunları önceliklendirmek için ürün yol haritası panosunu kullanın." + }, + { + "id": "worktemplate.product_teams.goals_and_okrs.integration", + "translation": "İşbirliğini kolaylaştırmak için Zoom gibi sık kullandığınız araçları bütünleştirin ve kanalınızdaki üretkenliği artırın. Bunlar sizin için indirilir." + }, + { + "id": "worktemplate.product_teams.goals_and_okrs.channel", + "translation": "Hedefleriniz ve ilerlemeniz hakkında ekibinizle farklı zamanlarda ya da gerçek zamanlı olarak sohbet edin ve değişiklikleri tek bir kanaldan izleyerek güncel kalın." + }, + { + "id": "worktemplate.product_teams.goals_and_okrs.board", + "translation": "Amaçlar ve anahtar sonuçlar (OKR) panosu ile ekibinizin kurumsal hedeflere doğru ilerlemesini izleyin. Toplantı gündemi panosu ile toplantıları izleyin." + }, + { + "id": "worktemplate.product_teams.feature_release.description.playbook", + "translation": "Özellik geliştirme sürecinizi destekleyen görev kontrol listeleri ve otomasyon ile işlevsel ekipler arasında işbirliğini artırın. İşiniz bittiğinde bir geçmiş değerlendirmesi yaparak ve süreci bir sonraki sürümünüz için iyileştirin." + }, + { + "id": "worktemplate.product_teams.feature_release.description.integration", + "translation": "Özellikleri yayınlamak için GitHub gibi sık kullandığınız araçları bütünleştirin ve kanalınızdaki üretkenliği artırın. Bunlar sizin için indirilir." + }, + { + "id": "worktemplate.product_teams.feature_release.description.channel", + "translation": "Panolarınıza, senaryolarınıza ve diğer bütünleştirmelere kolayca bağlanan bir kanalda sürüm engelleyicileri ve değişiklikler hakkında ekibinizle sohbet edin." + }, + { + "id": "worktemplate.product_teams.feature_release.description.board", + "translation": "Toplantı gündemi panosu ile toplantıları izleyin. Proje görevleri panosu ile iş yükünüzü yönetin." + }, + { + "id": "worktemplate.product_teams.bug_bash.playbook", + "translation": "Kapsamlı bir hata ayıklama süreci yürütmek için deneme alanları ve otomatik görevler atamak üzere kontrol listeleri kullanın. Sürecinizi gözden geçirmek ve gelecek sefer daha iyi olmasını sağlamak için bir geçmiş değerlendirmesi yapın." + }, + { + "id": "worktemplate.product_teams.bug_bash.integration", + "translation": "Hata ayıklama işlerinizi kolaylaştırmak için Jira gibi sık kullandığınız araçları bütünleştirin ve kanalınızdaki üretkenliği artırın. Bunlar sizin için indirilir." + }, + { + "id": "worktemplate.product_teams.bug_bash.channel", + "translation": "Hata raporlarını ve çözümlerini ekibinizin ve kuruluşunuzun kolayca erişebileceği tek bir kanalda planlayın ve yönetin." + }, + { + "id": "worktemplate.leadership.goals_and_okrs.integration", + "translation": "İşbirliğini kolaylaştırmak için Zoom gibi sık kullandığınız araçları bütünleştirin ve kanalınızdaki üretkenliği artırın. Bunlar sizin için indirilir." + }, + { + "id": "worktemplate.leadership.goals_and_okrs.channel", + "translation": "Hedefleriniz ve ilerlemeniz hakkında ekibinizle farklı zamanlarda ya da gerçek zamanlı olarak sohbet edin ve değişiklikleri tek bir kanaldan izleyerek güncel kalın." + }, + { + "id": "worktemplate.leadership.goals_and_okrs.board", + "translation": "Amaçlar ve anahtar sonuçlar (OKR) panosu ile ekibinizin kurumsal hedeflere doğru ilerlemesini izleyin. Toplantı gündemi panosu ile toplantıları izleyin." + }, + { + "id": "worktemplate.devops.product_release.playbook", + "translation": "Ürün çıkışlarının güvenilir ve zamanında olması için izlenmesi ve uygulanması kolay, yinelenebilir iş akışları oluşturun." + }, + { + "id": "worktemplate.devops.product_release.channel", + "translation": "Ekibinizle günlük kilometre taşları, engeller ve çıktılardaki değişiklikler hakkında kolay ve hızlı bir şekilde sohbet edin." + }, + { + "id": "worktemplate.devops.product_release.board", + "translation": "Sürüm zaman çerçevenizi ve sürecinizi desteklemek için ürün çıkarma panosunu kullanın ve herkesin hangi görevlerin bitiş zamanının geldiğini bilmesini sağlayın." + }, + { + "id": "worktemplate.devops.incident_resolution.description.playbook", + "translation": "Kilit ekip üyelerini bir araya getirmek için kontrol listeleri ve otomasyon kullanarak olayın çözüme doğru ilerlemesini paylaşın." + }, + { + "id": "worktemplate.devops.incident_resolution.description.channel", + "translation": "Ekibinizle tek bir kanal kullanarak öncelikler hakkında sohbet edin, paydaşlar ekleyin, güncellemeler yayınlayın ve çözüm için çalışın." + }, + { + "id": "worktemplate.devops.incident_resolution.description.board", + "translation": "Yinelenebilen süreçleri desteklemek ve ekip genelinde tanımlanmış görevler atamak için olay çözümleme panosunu kullanın." + }, + { + "id": "worktemplate.companywide.goals_and_okrs.integration", + "translation": "İşbirliğini kolaylaştırmak için Zoom gibi sık kullandığınız araçları bütünleştirin ve kanalınızdaki üretkenliği artırın. Bunlar sizin için indirilir." + }, + { + "id": "worktemplate.companywide.goals_and_okrs.channel", + "translation": "Hedefleriniz ve ilerlemeniz hakkında ekibinizle farklı zamanlarda ya da gerçek zamanlı olarak sohbet edin ve değişiklikleri tek bir kanaldan izleyerek güncel kalın." + }, + { + "id": "worktemplate.companywide.goals_and_okrs.board", + "translation": "Amaçlar ve anahtar sonuçlar (OKR) panosu ile ekibinizin kurumsal hedeflere doğru ilerlemesini izleyin. Toplantı gündemi panosu ile toplantıları izleyin." + }, + { + "id": "model.license_record.is_valid.bytes.app_error", + "translation": "Bir lisans yüklenirken bayt değeri geçersiz." + }, + { + "id": "worktemplate.companywide.create_project.integration", + "translation": "Sık kullandığınız araçlar ile bütünleştirerek kanalınızdaki üretkenliği artırın. Bunlar sizin için indirilir." + }, + { + "id": "worktemplate.companywide.create_project.channel", + "translation": "Ekibinizle yeni projeniz üzerine sohbet edin ve işbirlikli bir kanalda projeyi nasıl yapılandıracağınıza karar verin." + }, + { + "id": "worktemplate.companywide.create_project.board", + "translation": "Proje görevlerinizi ve ilerlemenizi tanımlamak ve izlemek için bir Kanban panosu kullanın." + }, + { + "id": "app.user.run.update_status.title", + "translation": "Durum güncellemesi" + }, + { + "id": "app.user.run.update_status.submit_label", + "translation": "Durumu güncelle" + }, + { + "id": "app.user.run.update_status.reminder_for_next_update", + "translation": "Sonraki güncelleme anımsatıcısı" + }, + { + "id": "app.user.run.update_status.num_channel", + "translation": { + "one": "Paydaşlara bir güncelleme duyurun. Bu gönderi {{.Count}} kanalında yayınlanacak.", + "other": "Paydaşlara bir güncelleme duyurun. Bu gönderi {{.Count}} kanalında yayınlanacak." + } + }, + { + "id": "app.user.run.update_status.finish_run.placeholder", + "translation": "Ayrıca oyunu da tamamlanmış olarak işaretle" + }, + { + "id": "app.user.run.update_status.finish_run", + "translation": "Oyunu tamamla" + }, + { + "id": "app.user.run.update_status.change_since_last_update", + "translation": "Son güncellemeden sonraki değişiklik" + }, + { + "id": "app.user.run.status_enable", + "translation": "@{{.Username}}, [{{.RunName}}]({{.RunURL}}) için durum güncellemelerini etkinleştirdi" + }, + { + "id": "app.user.run.status_disable", + "translation": "@{{.Username}}, [{{.RunName}}]({{.RunURL}}) için durum güncellemelerini devre dışı bıraktı" + }, + { + "id": "app.user.run.request_update", + "translation": "@here — @{{.Name}}, [{{.RunName}}]({{.RunURL}}) için bir durum güncellemesi istedi. \n" + }, + { + "id": "app.user.run.request_join_channel", + "translation": "@{{.Name}} bir oyun katılımcısı ve bu kanala katılmak istiyor. Kanalın herhangi bir üyesi onu çağırabilir.\n" + }, + { + "id": "app.user.run.confirm_finish.title", + "translation": "Oyunu tamamlamayı onayla" + }, + { + "id": "app.user.run.confirm_finish.submit_label", + "translation": "Oyunu tamamla" + }, + { + "id": "app.user.run.confirm_finish.num_outstanding", + "translation": { + "one": "Bekleyen **{{.Count}} görev** var. *{{.RunName}}* oyununu tüm katılımcılar için tamamlamak istediğinize emin misiniz?", + "other": "Bekleyen **{{.Count}} görev** var. *{{.RunName}}* oyununu tüm katılımcılar için tamamlamak istediğinize emin misiniz?" + } + }, + { + "id": "app.user.run.add_to_timeline.title", + "translation": "Oyun zaman akışına ekle" + }, + { + "id": "app.user.run.add_to_timeline.summary.placeholder", + "translation": "Zaman akışında görüntülenecek kısa açıklama" + }, + { + "id": "app.user.run.add_to_timeline.summary.help", + "translation": "En fazla 64 karakter" + }, + { + "id": "app.user.run.add_to_timeline.summary", + "translation": "Özet" + }, + { + "id": "app.user.run.add_to_timeline.submit_label", + "translation": "Oyun zaman akışına ekle" + }, + { + "id": "app.user.run.add_to_timeline.playbook_run", + "translation": "Senaryo oyunu" + }, + { + "id": "app.user.run.add_checklist_item.title", + "translation": "Yeni görev ekle" + }, + { + "id": "app.user.run.add_checklist_item.submit_label", + "translation": "Görev ekle" + }, + { + "id": "app.user.run.add_checklist_item.name", + "translation": "Ad" + }, + { + "id": "app.user.run.add_checklist_item.description", + "translation": "Açıklama" + }, + { + "id": "app.user.new_run.title", + "translation": "Senaryoyu oyna" + }, + { + "id": "app.user.new_run.submit_label", + "translation": "Oyunu başlat" + }, + { + "id": "app.user.new_run.run_name", + "translation": "Oyun adı" + }, + { + "id": "app.user.new_run.playbook", + "translation": "Senaryo" + }, + { + "id": "app.user.new_run.intro", + "translation": "**Sahibi** {{.Username}}" + }, + { + "id": "app.user.digest.tasks.zero_assigned", + "translation": "Size atanmış bir görev yok." + }, + { + "id": "app.user.digest.tasks.num_assigned_due_until_today", + "translation": { + "one": "Süresi dolmuş {{.Count}} atanmış göreviniz var:", + "other": "Süresi dolmuş {{.Count}} atanmış göreviniz var:" + } + }, + { + "id": "app.user.digest.tasks.num_assigned", + "translation": { + "one": "{{.Count}} atanmış göreviniz var:", + "other": "{{.Count}} atanmış göreviniz var:" + } + }, + { + "id": "app.user.digest.tasks.heading", + "translation": "Atanmış görevleriniz" + }, + { + "id": "app.user.digest.tasks.due_yesterday", + "translation": "Süresi dün doldu" + }, + { + "id": "app.user.digest.tasks.due_x_days_ago", + "translation": "Süresi {{.Count}} gün önce doldu" + }, + { + "id": "app.user.digest.tasks.due_today", + "translation": "Süresi bugün dolacak" + }, + { + "id": "app.user.digest.tasks.due_in_x_days", + "translation": { + "one": "{{.Count}} gün içinde süresi dolacak", + "other": "{{.Count}} gün içinde süresi dolacak" + } + }, + { + "id": "app.user.digest.tasks.due_after_today", + "translation": { + "one": "Bugünden sonra süresi dolacak **{{.Count}} göreviniz var**.", + "other": "Bugünden sonra süresi dolacak **{{.Count}} göreviniz var**." + } + }, + { + "id": "app.user.digest.tasks.all_tasks_command", + "translation": "Tüm görevlerinizi görüntülemek için `/playbook todo` kullanın." + }, + { + "id": "app.user.digest.runs_in_progress.zero_in_progress", + "translation": "Süren bir oyununuz yok." + }, + { + "id": "app.user.digest.runs_in_progress.num_in_progress", + "translation": { + "one": "Süren {{.Count}} oyununuz var:", + "other": "Süren {{.Count}} oyununuz var:" + } + }, + { + "id": "app.user.digest.runs_in_progress.heading", + "translation": "Süren oyunlar" + }, + { + "id": "app.user.digest.overdue_status_updates.zero_overdue", + "translation": "Gecikmiş bir oyununuz yok." + }, + { + "id": "app.user.digest.overdue_status_updates.num_overdue", + "translation": { + "one": "Bir durum güncellemesi için {{.Count}} oyun gecikmeniz var:", + "other": "Bir durum güncellemesi için {{.Count}} oyun gecikmeniz var:" + } + }, + { + "id": "app.user.digest.overdue_status_updates.heading", + "translation": "Gecikmiş durum güncellemeleri" + }, + { + "id": "app.command.execute.error", + "translation": "Komut yürütülemedi." + }, + { + "id": "api.server.cws.subscribe_to_newsletter.app_error", + "translation": "CWS sunucusu duyurulara abone olamadı." + }, + { + "id": "api.license.request-trial.bad-request.business-email", + "translation": "Deneme için iş e-postası geçersiz" } ] diff --git a/server/i18n/uk.json b/server/i18n/uk.json index b63779f26f..de5501e1a6 100644 --- a/server/i18n/uk.json +++ b/server/i18n/uk.json @@ -3139,10 +3139,6 @@ "id": "ent.elasticsearch.search_posts.unmarshall_post_failed", "translation": "Не вдається розшифрувати результати пошуку" }, - { - "id": "ent.elasticsearch.start.already_started.app_error", - "translation": "Еластичний пошук не запускається" - }, { "id": "ent.elasticsearch.start.create_bulk_processor_failed.app_error", "translation": "Не вдалося створити масовий процесор Elasticsearch" diff --git a/server/i18n/zh-CN.json b/server/i18n/zh-CN.json index bbf95c2889..314e3c6bb6 100644 --- a/server/i18n/zh-CN.json +++ b/server/i18n/zh-CN.json @@ -3131,10 +3131,6 @@ "id": "ent.elasticsearch.search_posts.unmarshall_post_failed", "translation": "解码搜索结果失败" }, - { - "id": "ent.elasticsearch.start.already_started.app_error", - "translation": "ElasticSearch 已启动。" - }, { "id": "ent.elasticsearch.start.create_bulk_processor_failed.app_error", "translation": "创建 Elasticsearch 批量处理器失败。" diff --git a/server/i18n/zh-TW.json b/server/i18n/zh-TW.json index e677cec709..4f759a4290 100644 --- a/server/i18n/zh-TW.json +++ b/server/i18n/zh-TW.json @@ -3131,10 +3131,6 @@ "id": "ent.elasticsearch.search_posts.unmarshall_post_failed", "translation": "無法解碼搜尋結果" }, - { - "id": "ent.elasticsearch.start.already_started.app_error", - "translation": "Elasticsearch 已啟動" - }, { "id": "ent.elasticsearch.start.create_bulk_processor_failed.app_error", "translation": "建立 Elasticsearch 批次處理器時失敗" diff --git a/model/access.go b/server/model/access.go similarity index 100% rename from model/access.go rename to server/model/access.go diff --git a/model/access_test.go b/server/model/access_test.go similarity index 100% rename from model/access_test.go rename to server/model/access_test.go diff --git a/model/analytics_row.go b/server/model/analytics_row.go similarity index 100% rename from model/analytics_row.go rename to server/model/analytics_row.go diff --git a/model/audit.go b/server/model/audit.go similarity index 100% rename from model/audit.go rename to server/model/audit.go diff --git a/model/auditconv.go b/server/model/auditconv.go similarity index 100% rename from model/auditconv.go rename to server/model/auditconv.go diff --git a/model/auditconv_test.go b/server/model/auditconv_test.go similarity index 100% rename from model/auditconv_test.go rename to server/model/auditconv_test.go diff --git a/model/audits.go b/server/model/audits.go similarity index 100% rename from model/audits.go rename to server/model/audits.go diff --git a/model/authorize.go b/server/model/authorize.go similarity index 100% rename from model/authorize.go rename to server/model/authorize.go diff --git a/model/authorize_test.go b/server/model/authorize_test.go similarity index 100% rename from model/authorize_test.go rename to server/model/authorize_test.go diff --git a/model/bot.go b/server/model/bot.go similarity index 100% rename from model/bot.go rename to server/model/bot.go diff --git a/model/bot_test.go b/server/model/bot_test.go similarity index 100% rename from model/bot_test.go rename to server/model/bot_test.go diff --git a/model/builtin.go b/server/model/builtin.go similarity index 100% rename from model/builtin.go rename to server/model/builtin.go diff --git a/model/bulk_export.go b/server/model/bulk_export.go similarity index 100% rename from model/bulk_export.go rename to server/model/bulk_export.go diff --git a/model/bundle_info.go b/server/model/bundle_info.go similarity index 92% rename from model/bundle_info.go rename to server/model/bundle_info.go index e602cc5daf..cfac1c8eb3 100644 --- a/model/bundle_info.go +++ b/server/model/bundle_info.go @@ -4,7 +4,7 @@ package model import ( - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) type BundleInfo struct { diff --git a/model/bundle_info_test.go b/server/model/bundle_info_test.go similarity index 100% rename from model/bundle_info_test.go rename to server/model/bundle_info_test.go diff --git a/model/channel.go b/server/model/channel.go similarity index 100% rename from model/channel.go rename to server/model/channel.go diff --git a/model/channel_count.go b/server/model/channel_count.go similarity index 100% rename from model/channel_count.go rename to server/model/channel_count.go diff --git a/model/channel_data.go b/server/model/channel_data.go similarity index 100% rename from model/channel_data.go rename to server/model/channel_data.go diff --git a/model/channel_list.go b/server/model/channel_list.go similarity index 100% rename from model/channel_list.go rename to server/model/channel_list.go diff --git a/model/channel_member.go b/server/model/channel_member.go similarity index 91% rename from model/channel_member.go rename to server/model/channel_member.go index dbe0014eac..23768bb6c1 100644 --- a/model/channel_member.go +++ b/server/model/channel_member.go @@ -19,6 +19,9 @@ const ( IgnoreChannelMentionsOff = "off" IgnoreChannelMentionsOn = "on" IgnoreChannelMentionsNotifyProp = "ignore_channel_mentions" + ChannelAutoFollowThreadsOff = "off" + ChannelAutoFollowThreadsOn = "on" + ChannelAutoFollowThreads = "channel_auto_follow_threads" ) type ChannelUnread struct { @@ -172,6 +175,12 @@ func (o *ChannelMember) IsValid() *AppError { } } + if channelAutoFollowThreads, ok := o.NotifyProps[ChannelAutoFollowThreads]; ok { + if len(channelAutoFollowThreads) > 3 || !IsChannelAutoFollowThreadsValid(channelAutoFollowThreads) { + return NewAppError("ChannelMember.IsValid", "model.channel_member.is_valid.channel_auto_follow_threads_value.app_error", nil, "channel_auto_follow_threads="+channelAutoFollowThreads, http.StatusBadRequest) + } + } + if len(o.Roles) > UserRolesMaxLength { return NewAppError("ChannelMember.IsValid", "model.channel_member.is_valid.roles_limit.app_error", map[string]any{"Limit": UserRolesMaxLength}, "", http.StatusBadRequest) @@ -223,6 +232,10 @@ func IsIgnoreChannelMentionsValid(ignoreChannelMentions string) bool { return ignoreChannelMentions == IgnoreChannelMentionsOn || ignoreChannelMentions == IgnoreChannelMentionsOff || ignoreChannelMentions == IgnoreChannelMentionsDefault } +func IsChannelAutoFollowThreadsValid(channelAutoFollowThreads string) bool { + return channelAutoFollowThreads == ChannelAutoFollowThreadsOn || channelAutoFollowThreads == ChannelAutoFollowThreadsOff +} + func GetDefaultChannelNotifyProps() StringMap { return StringMap{ DesktopNotifyProp: ChannelNotifyDefault, @@ -230,5 +243,6 @@ func GetDefaultChannelNotifyProps() StringMap { PushNotifyProp: ChannelNotifyDefault, EmailNotifyProp: ChannelNotifyDefault, IgnoreChannelMentionsNotifyProp: IgnoreChannelMentionsDefault, + ChannelAutoFollowThreads: ChannelAutoFollowThreadsOff, } } diff --git a/model/channel_member_history.go b/server/model/channel_member_history.go similarity index 100% rename from model/channel_member_history.go rename to server/model/channel_member_history.go diff --git a/model/channel_member_history_result.go b/server/model/channel_member_history_result.go similarity index 100% rename from model/channel_member_history_result.go rename to server/model/channel_member_history_result.go diff --git a/model/channel_member_test.go b/server/model/channel_member_test.go similarity index 100% rename from model/channel_member_test.go rename to server/model/channel_member_test.go diff --git a/model/channel_mentions.go b/server/model/channel_mentions.go similarity index 100% rename from model/channel_mentions.go rename to server/model/channel_mentions.go diff --git a/model/channel_search.go b/server/model/channel_search.go similarity index 100% rename from model/channel_search.go rename to server/model/channel_search.go diff --git a/model/channel_sidebar.go b/server/model/channel_sidebar.go similarity index 91% rename from model/channel_sidebar.go rename to server/model/channel_sidebar.go index e8b5a6a215..2e2c3612c1 100644 --- a/model/channel_sidebar.go +++ b/server/model/channel_sidebar.go @@ -13,11 +13,12 @@ type SidebarCategoryType string type SidebarCategorySorting string const ( - // Each sidebar category has a 'type'. System categories are Channels, Favorites and DMs + // Each sidebar category has a 'type'. System categories are Channels, Favorites, DMs and Apps // All user-created categories will have type Custom SidebarCategoryChannels SidebarCategoryType = "channels" SidebarCategoryDirectMessages SidebarCategoryType = "direct_messages" SidebarCategoryFavorites SidebarCategoryType = "favorites" + SidebarCategoryApps SidebarCategoryType = "apps" SidebarCategoryCustom SidebarCategoryType = "custom" // Increment to use when adding/reordering things in the sidebar MinimalSidebarSortDistance = 10 @@ -25,6 +26,7 @@ const ( DefaultSidebarSortOrderFavorites = 0 DefaultSidebarSortOrderChannels = DefaultSidebarSortOrderFavorites + MinimalSidebarSortDistance DefaultSidebarSortOrderDMs = DefaultSidebarSortOrderChannels + MinimalSidebarSortDistance + DefaultSidebarSortOrderApps = DefaultSidebarSortOrderDMs + MinimalSidebarSortDistance // Sorting modes // default for all categories except DMs (behaves like manual) SidebarCategorySortDefault SidebarCategorySorting = "" @@ -36,6 +38,13 @@ const ( SidebarCategorySortAlphabetical SidebarCategorySorting = "alpha" ) +var SystemSidebarCategories = []SidebarCategoryType{ + SidebarCategoryChannels, + SidebarCategoryDirectMessages, + SidebarCategoryFavorites, + SidebarCategoryApps, +} + // SidebarCategory represents the corresponding DB table type SidebarCategory struct { Id string `json:"id"` @@ -77,7 +86,7 @@ type SidebarChannel struct { type SidebarChannels []*SidebarChannel type SidebarCategoriesWithChannels []*SidebarCategoryWithChannels -var categoryIdPattern = regexp.MustCompile("(favorites|channels|direct_messages)_[a-z0-9]{26}_[a-z0-9]{26}") +var categoryIdPattern = regexp.MustCompile("(favorites|channels|direct_messages|apps)_[a-z0-9]{26}_[a-z0-9]{26}") func IsValidCategoryId(s string) bool { // Category IDs can either be regular IDs diff --git a/model/channel_sidebar_test.go b/server/model/channel_sidebar_test.go similarity index 100% rename from model/channel_sidebar_test.go rename to server/model/channel_sidebar_test.go diff --git a/model/channel_stats.go b/server/model/channel_stats.go similarity index 100% rename from model/channel_stats.go rename to server/model/channel_stats.go diff --git a/model/channel_test.go b/server/model/channel_test.go similarity index 100% rename from model/channel_test.go rename to server/model/channel_test.go diff --git a/model/channel_view.go b/server/model/channel_view.go similarity index 100% rename from model/channel_view.go rename to server/model/channel_view.go diff --git a/model/client4.go b/server/model/client4.go similarity index 99% rename from model/client4.go rename to server/model/client4.go index d6cc62ba0f..74b65948b0 100644 --- a/model/client4.go +++ b/server/model/client4.go @@ -8803,3 +8803,17 @@ func (c *Client4) GetWorkTemplatesByCategory(category string) ([]*WorkTemplate, err = json.NewDecoder(r.Body).Decode(&templates) return templates, BuildResponse(r), err } + +func (c *Client4) SubmitTrueUpReview(req map[string]any) (*Response, error) { + reqBytes, err := json.Marshal(req) + if err != nil { + return nil, NewAppError("SubmitTrueUpReview", "api.marshal_error", nil, "", http.StatusInternalServerError).Wrap(err) + } + r, err := c.DoAPIPostBytes(c.licenseRoute()+"/review", reqBytes) + if err != nil { + return BuildResponse(r), nil + } + defer closeBody(r) + + return BuildResponse(r), nil +} diff --git a/model/client4_test.go b/server/model/client4_test.go similarity index 97% rename from model/client4_test.go rename to server/model/client4_test.go index 71a374fae6..bb9db34997 100644 --- a/model/client4_test.go +++ b/server/model/client4_test.go @@ -26,7 +26,7 @@ func TestClient4TrimTrailingSlash(t *testing.T) { } } -// https://github.com/mattermost/mattermost-server/v6/server/channels/issues/8205 +// https://github.com/mattermost/mattermost-server/server/v8/channels/issues/8205 func TestClient4CreatePost(t *testing.T) { post := &Post{ Props: map[string]any{ diff --git a/model/cloud.go b/server/model/cloud.go similarity index 98% rename from model/cloud.go rename to server/model/cloud.go index c8dd738b96..1efad1878c 100644 --- a/model/cloud.go +++ b/server/model/cloud.go @@ -179,6 +179,7 @@ type Subscription struct { DelinquentSince *int64 `json:"delinquent_since"` OriginallyLicensedSeats int `json:"originally_licensed_seats"` ComplianceBlocked string `json:"compliance_blocked"` + BillingType string `json:"billing_type"` } // Subscription History model represents true up event in a yearly subscription @@ -274,7 +275,7 @@ type SubscriptionChange struct { // TODO remove BoardsLimits. // It is not used for real. // Focalboard has some lingering code using this struct -// https://github.com/mattermost/mattermost-server/v6/server/boards/blob/fd4cf95f8ac9ba616864b25bf91bb1e4ec21335a/server/app/cloud.go#L86 +// https://github.com/mattermost/mattermost-server/server/v8/boards/blob/fd4cf95f8ac9ba616864b25bf91bb1e4ec21335a/server/app/cloud.go#L86 // we should remove this struct once that code is removed. type BoardsLimits struct { Cards *int `json:"cards"` @@ -297,7 +298,7 @@ type ProductLimits struct { // TODO remove Boards property. // It is not used for real. // Focalboard has some lingering code using this property - // https://github.com/mattermost/mattermost-server/v6/server/boards/blob/fd4cf95f8ac9ba616864b25bf91bb1e4ec21335a/server/app/cloud.go#L86 + // https://github.com/mattermost/mattermost-server/server/v8/boards/blob/fd4cf95f8ac9ba616864b25bf91bb1e4ec21335a/server/app/cloud.go#L86 // we should remove this property once that code is removed. Boards *BoardsLimits `json:"boards,omitempty"` Files *FilesLimits `json:"files,omitempty"` diff --git a/model/cluster_discovery.go b/server/model/cluster_discovery.go similarity index 100% rename from model/cluster_discovery.go rename to server/model/cluster_discovery.go diff --git a/model/cluster_discovery_test.go b/server/model/cluster_discovery_test.go similarity index 100% rename from model/cluster_discovery_test.go rename to server/model/cluster_discovery_test.go diff --git a/model/cluster_info.go b/server/model/cluster_info.go similarity index 100% rename from model/cluster_info.go rename to server/model/cluster_info.go diff --git a/model/cluster_message.go b/server/model/cluster_message.go similarity index 100% rename from model/cluster_message.go rename to server/model/cluster_message.go diff --git a/model/cluster_stats.go b/server/model/cluster_stats.go similarity index 100% rename from model/cluster_stats.go rename to server/model/cluster_stats.go diff --git a/model/collection.go b/server/model/collection.go similarity index 100% rename from model/collection.go rename to server/model/collection.go diff --git a/model/command.go b/server/model/command.go similarity index 100% rename from model/command.go rename to server/model/command.go diff --git a/model/command_args.go b/server/model/command_args.go similarity index 96% rename from model/command_args.go rename to server/model/command_args.go index a01b5db87a..6b147af0df 100644 --- a/model/command_args.go +++ b/server/model/command_args.go @@ -4,7 +4,7 @@ package model import ( - "github.com/mattermost/mattermost-server/v6/server/platform/shared/i18n" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/i18n" ) type CommandArgs struct { diff --git a/model/command_args_test.go b/server/model/command_args_test.go similarity index 100% rename from model/command_args_test.go rename to server/model/command_args_test.go diff --git a/model/command_autocomplete.go b/server/model/command_autocomplete.go similarity index 100% rename from model/command_autocomplete.go rename to server/model/command_autocomplete.go diff --git a/model/command_autocomplete_test.go b/server/model/command_autocomplete_test.go similarity index 100% rename from model/command_autocomplete_test.go rename to server/model/command_autocomplete_test.go diff --git a/model/command_request.go b/server/model/command_request.go similarity index 100% rename from model/command_request.go rename to server/model/command_request.go diff --git a/model/command_response.go b/server/model/command_response.go similarity index 96% rename from model/command_response.go rename to server/model/command_response.go index cc5111506c..4fd810f373 100644 --- a/model/command_response.go +++ b/server/model/command_response.go @@ -8,7 +8,7 @@ import ( "io" "strings" - "github.com/mattermost/mattermost-server/v6/server/channels/utils/jsonutils" + "github.com/mattermost/mattermost-server/server/v8/channels/utils/jsonutils" ) const ( diff --git a/model/command_response_test.go b/server/model/command_response_test.go similarity index 100% rename from model/command_response_test.go rename to server/model/command_response_test.go diff --git a/model/command_test.go b/server/model/command_test.go similarity index 100% rename from model/command_test.go rename to server/model/command_test.go diff --git a/model/command_webhook.go b/server/model/command_webhook.go similarity index 100% rename from model/command_webhook.go rename to server/model/command_webhook.go diff --git a/model/command_webhook_test.go b/server/model/command_webhook_test.go similarity index 100% rename from model/command_webhook_test.go rename to server/model/command_webhook_test.go diff --git a/model/compliance.go b/server/model/compliance.go similarity index 100% rename from model/compliance.go rename to server/model/compliance.go diff --git a/model/compliance_post.go b/server/model/compliance_post.go similarity index 100% rename from model/compliance_post.go rename to server/model/compliance_post.go diff --git a/model/compliance_post_test.go b/server/model/compliance_post_test.go similarity index 100% rename from model/compliance_post_test.go rename to server/model/compliance_post_test.go diff --git a/model/config.go b/server/model/config.go similarity index 99% rename from model/config.go rename to server/model/config.go index a91ac29c40..39ab83f4af 100644 --- a/model/config.go +++ b/server/model/config.go @@ -12,6 +12,7 @@ import ( "net/http" "net/url" "os" + "path/filepath" "reflect" "regexp" "strconv" @@ -20,8 +21,8 @@ import ( "github.com/mattermost/ldap" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/filestore" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/filestore" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) const ( @@ -239,12 +240,10 @@ const ( Office365SettingsDefaultTokenEndpoint = "https://login.microsoftonline.com/common/oauth2/v2.0/token" Office365SettingsDefaultUserAPIEndpoint = "https://graph.microsoft.com/v1.0/me" - CloudSettingsDefaultCwsURL = "https://customers.cloud.mattermost.com" - CloudSettingsDefaultCwsAPIURL = "https://portal.internal.prod.cloud.mattermost.com" - // TODO: update to "https://portal.test.cloud.mattermost.com" when ready to use test license key - CloudSettingsDefaultCwsURLTest = "https://customers.cloud.mattermost.com" - // TODO: update to // "https://api.internal.test.cloud.mattermost.com" when ready to use test license key - CloudSettingsDefaultCwsAPIURLTest = "https://portal.internal.prod.cloud.mattermost.com" + CloudSettingsDefaultCwsURL = "https://customers.mattermost.com" + CloudSettingsDefaultCwsAPIURL = "https://portal.internal.prod.cloud.mattermost.com" + CloudSettingsDefaultCwsURLTest = "https://portal.test.cloud.mattermost.com" + CloudSettingsDefaultCwsAPIURLTest = "https://api.internal.test.cloud.mattermost.com" OpenidSettingsDefaultScope = "profile openid email" @@ -390,7 +389,6 @@ type ServiceSettings struct { EnableCustomGroups *bool `access:"site_users_and_teams"` SelfHostedPurchase *bool `access:"write_restrictable,cloud_restrictable"` AllowSyncedDrafts *bool `access:"site_posts"` - SelfHostedExpansion *bool `access:"write_restrictable,cloud_restrictable"` } func (s *ServiceSettings) SetDefaults(isUpdate bool) { @@ -863,10 +861,6 @@ func (s *ServiceSettings) SetDefaults(isUpdate bool) { if s.SelfHostedPurchase == nil { s.SelfHostedPurchase = NewBool(true) } - - if s.SelfHostedExpansion == nil { - s.SelfHostedExpansion = NewBool(false) - } } type ClusterSettings struct { @@ -978,7 +972,8 @@ type ExperimentalSettings struct { EnableSharedChannels *bool `access:"experimental_features"` EnableRemoteClusterService *bool `access:"experimental_features"` EnableAppBar *bool `access:"experimental_features"` - PatchPluginsReactDOM *bool `access:"experimental_features"` + DisableRefetchingOnBrowserFocus *bool `access:"experimental_features"` + DelayChannelAutocomplete *bool `access:"experimental_features"` } func (s *ExperimentalSettings) SetDefaults() { @@ -1014,8 +1009,12 @@ func (s *ExperimentalSettings) SetDefaults() { s.EnableAppBar = NewBool(false) } - if s.PatchPluginsReactDOM == nil { - s.PatchPluginsReactDOM = NewBool(false) + if s.DisableRefetchingOnBrowserFocus == nil { + s.DisableRefetchingOnBrowserFocus = NewBool(false) + } + + if s.DelayChannelAutocomplete == nil { + s.DelayChannelAutocomplete = NewBool(false) } } @@ -1168,6 +1167,7 @@ type SqlSettings struct { DisableDatabaseSearch *bool `access:"environment_database,write_restrictable,cloud_restrictable"` MigrationsStatementTimeoutSeconds *int `access:"environment_database,write_restrictable,cloud_restrictable"` ReplicaLagSettings []*ReplicaLagSettings `access:"environment_database,write_restrictable,cloud_restrictable"` // telemetry: none + ReplicaMonitorIntervalSeconds *int `access:"environment_database,write_restrictable,cloud_restrictable"` } func (s *SqlSettings) SetDefaults(isUpdate bool) { @@ -1232,6 +1232,10 @@ func (s *SqlSettings) SetDefaults(isUpdate bool) { if s.ReplicaLagSettings == nil { s.ReplicaLagSettings = []*ReplicaLagSettings{} } + + if s.ReplicaMonitorIntervalSeconds == nil { + s.ReplicaMonitorIntervalSeconds = NewInt(5) + } } type LogSettings struct { @@ -3746,6 +3750,16 @@ func (s *ServiceSettings) isValid() *AppError { return NewAppError("Config.IsValid", "model.config.is_valid.collapsed_threads.app_error", nil, "", http.StatusBadRequest) } + // we check if file has a valid parent, the server will try to create the socket + // file if it doesn't exist, but we need to be sure if the directory exist or not + if *s.EnableLocalMode { + parent := filepath.Dir(*s.LocalModeSocketLocation) + _, err := os.Stat(parent) + if err != nil { + return NewAppError("Config.IsValid", "model.config.is_valid.local_mode_socket.app_error", nil, err.Error(), http.StatusBadRequest) + } + } + return nil } diff --git a/model/config_test.go b/server/model/config_test.go similarity index 93% rename from model/config_test.go rename to server/model/config_test.go index cedffbcb08..7477fbb5ef 100644 --- a/model/config_test.go +++ b/server/model/config_test.go @@ -316,41 +316,6 @@ func TestConfigDefaultNPSPluginState(t *testing.T) { }) } -func TestConfigDefaultPlaybooksPluginState(t *testing.T) { - t.Run("should enable Playbooks plugin by default on enterprise-ready builds", func(t *testing.T) { - BuildEnterpriseReady = "true" - c1 := Config{} - c1.SetDefaults() - - assert.True(t, c1.PluginSettings.PluginStates["playbooks"].Enable) - }) - - t.Run("should enable Playbooks plugin by default on non-enterprise-ready builds", func(t *testing.T) { - BuildEnterpriseReady = "" - c1 := Config{} - c1.SetDefaults() - - assert.True(t, c1.PluginSettings.PluginStates["playbooks"].Enable) - }) - - t.Run("should not re-enable Playbooks plugin after it has been disabled", func(t *testing.T) { - BuildEnterpriseReady = "" - c1 := Config{ - PluginSettings: PluginSettings{ - PluginStates: map[string]*PluginState{ - "playbooks": { - Enable: false, - }, - }, - }, - } - - c1.SetDefaults() - - assert.False(t, c1.PluginSettings.PluginStates["playbooks"].Enable) - }) -} - func TestConfigDefaultChannelExportPluginState(t *testing.T) { t.Run("should enable ChannelExport plugin by default on enterprise-ready builds", func(t *testing.T) { BuildEnterpriseReady = "true" @@ -386,30 +351,6 @@ func TestConfigDefaultChannelExportPluginState(t *testing.T) { }) } -func TestConfigDefaultFocalboardPluginState(t *testing.T) { - t.Run("should enable Focalboard plugin by default", func(t *testing.T) { - c1 := Config{} - c1.SetDefaults() - - assert.True(t, c1.PluginSettings.PluginStates["focalboard"].Enable) - }) - - t.Run("should not re-enable focalboard plugin after it has been disabled", func(t *testing.T) { - c1 := Config{ - PluginSettings: PluginSettings{ - PluginStates: map[string]*PluginState{ - "focalboard": { - Enable: false, - }, - }, - }, - } - - c1.SetDefaults() - assert.False(t, c1.PluginSettings.PluginStates["focalboard"].Enable) - }) -} - func TestTeamSettingsIsValidSiteNameEmpty(t *testing.T) { c1 := Config{} c1.SetDefaults() @@ -1468,40 +1409,63 @@ func TestConfigExportSettingsIsValid(t *testing.T) { } func TestConfigServiceSettingsIsValid(t *testing.T) { - cfg := Config{} - cfg.SetDefaults() + t.Run("local socket file should exist if local mode enabled", func(t *testing.T) { + cfg := Config{} + cfg.SetDefaults() - appErr := cfg.ServiceSettings.isValid() - require.Nil(t, appErr) + appErr := cfg.ServiceSettings.isValid() + require.Nil(t, appErr) - *cfg.ServiceSettings.CollapsedThreads = CollapsedThreadsDisabled - appErr = cfg.ServiceSettings.isValid() - require.Nil(t, appErr) + *cfg.ServiceSettings.EnableLocalMode = false + // we don't need to check as local mode is not enabled + *cfg.ServiceSettings.LocalModeSocketLocation = "an_invalid_path.socket" + appErr = cfg.ServiceSettings.isValid() + require.Nil(t, appErr) - *cfg.ServiceSettings.ThreadAutoFollow = false - appErr = cfg.ServiceSettings.isValid() - require.Nil(t, appErr) + // now we can check if the file exist or not + *cfg.ServiceSettings.EnableLocalMode = true + *cfg.ServiceSettings.LocalModeSocketLocation = "/invalid_directory/mattermost_local.socket" + appErr = cfg.ServiceSettings.isValid() + require.NotNil(t, appErr) + require.Equal(t, "model.config.is_valid.local_mode_socket.app_error", appErr.Id) + }) - *cfg.ServiceSettings.CollapsedThreads = CollapsedThreadsDefaultOff - appErr = cfg.ServiceSettings.isValid() - require.NotNil(t, appErr) - require.Equal(t, "model.config.is_valid.collapsed_threads.autofollow.app_error", appErr.Id) + t.Run("CRT settings should have consistent values", func(t *testing.T) { + cfg := Config{} + cfg.SetDefaults() - *cfg.ServiceSettings.CollapsedThreads = CollapsedThreadsDefaultOn - appErr = cfg.ServiceSettings.isValid() - require.NotNil(t, appErr) - require.Equal(t, "model.config.is_valid.collapsed_threads.autofollow.app_error", appErr.Id) + appErr := cfg.ServiceSettings.isValid() + require.Nil(t, appErr) - *cfg.ServiceSettings.CollapsedThreads = CollapsedThreadsAlwaysOn - appErr = cfg.ServiceSettings.isValid() - require.NotNil(t, appErr) - require.Equal(t, "model.config.is_valid.collapsed_threads.autofollow.app_error", appErr.Id) + *cfg.ServiceSettings.CollapsedThreads = CollapsedThreadsDisabled + appErr = cfg.ServiceSettings.isValid() + require.Nil(t, appErr) - *cfg.ServiceSettings.ThreadAutoFollow = true - *cfg.ServiceSettings.CollapsedThreads = "test_status" - appErr = cfg.ServiceSettings.isValid() - require.NotNil(t, appErr) - require.Equal(t, "model.config.is_valid.collapsed_threads.app_error", appErr.Id) + *cfg.ServiceSettings.ThreadAutoFollow = false + appErr = cfg.ServiceSettings.isValid() + require.Nil(t, appErr) + + *cfg.ServiceSettings.CollapsedThreads = CollapsedThreadsDefaultOff + appErr = cfg.ServiceSettings.isValid() + require.NotNil(t, appErr) + require.Equal(t, "model.config.is_valid.collapsed_threads.autofollow.app_error", appErr.Id) + + *cfg.ServiceSettings.CollapsedThreads = CollapsedThreadsDefaultOn + appErr = cfg.ServiceSettings.isValid() + require.NotNil(t, appErr) + require.Equal(t, "model.config.is_valid.collapsed_threads.autofollow.app_error", appErr.Id) + + *cfg.ServiceSettings.CollapsedThreads = CollapsedThreadsAlwaysOn + appErr = cfg.ServiceSettings.isValid() + require.NotNil(t, appErr) + require.Equal(t, "model.config.is_valid.collapsed_threads.autofollow.app_error", appErr.Id) + + *cfg.ServiceSettings.ThreadAutoFollow = true + *cfg.ServiceSettings.CollapsedThreads = "test_status" + appErr = cfg.ServiceSettings.isValid() + require.NotNil(t, appErr) + require.Equal(t, "model.config.is_valid.collapsed_threads.app_error", appErr.Id) + }) } func TestConfigDefaultCallsPluginState(t *testing.T) { diff --git a/model/custom_status.go b/server/model/custom_status.go similarity index 100% rename from model/custom_status.go rename to server/model/custom_status.go diff --git a/model/data_retention_policy.go b/server/model/data_retention_policy.go similarity index 100% rename from model/data_retention_policy.go rename to server/model/data_retention_policy.go diff --git a/model/draft.go b/server/model/draft.go similarity index 100% rename from model/draft.go rename to server/model/draft.go diff --git a/model/draft_test.go b/server/model/draft_test.go similarity index 100% rename from model/draft_test.go rename to server/model/draft_test.go diff --git a/model/emoji.go b/server/model/emoji.go similarity index 100% rename from model/emoji.go rename to server/model/emoji.go diff --git a/model/emoji_data.go b/server/model/emoji_data.go similarity index 100% rename from model/emoji_data.go rename to server/model/emoji_data.go diff --git a/model/emoji_search.go b/server/model/emoji_search.go similarity index 100% rename from model/emoji_search.go rename to server/model/emoji_search.go diff --git a/model/emoji_test.go b/server/model/emoji_test.go similarity index 100% rename from model/emoji_test.go rename to server/model/emoji_test.go diff --git a/model/feature_flags.go b/server/model/feature_flags.go similarity index 100% rename from model/feature_flags.go rename to server/model/feature_flags.go diff --git a/model/feature_flags_test.go b/server/model/feature_flags_test.go similarity index 100% rename from model/feature_flags_test.go rename to server/model/feature_flags_test.go diff --git a/model/file.go b/server/model/file.go similarity index 100% rename from model/file.go rename to server/model/file.go diff --git a/model/file_info.go b/server/model/file_info.go similarity index 99% rename from model/file_info.go rename to server/model/file_info.go index 554ad2e588..99d9af8fed 100644 --- a/model/file_info.go +++ b/server/model/file_info.go @@ -11,7 +11,7 @@ import ( "path/filepath" "strings" - "github.com/mattermost/mattermost-server/v6/server/channels/utils/imgutils" + "github.com/mattermost/mattermost-server/server/v8/channels/utils/imgutils" ) const ( diff --git a/model/file_info_list.go b/server/model/file_info_list.go similarity index 100% rename from model/file_info_list.go rename to server/model/file_info_list.go diff --git a/model/file_info_search_results.go b/server/model/file_info_search_results.go similarity index 100% rename from model/file_info_search_results.go rename to server/model/file_info_search_results.go diff --git a/model/file_info_test.go b/server/model/file_info_test.go similarity index 100% rename from model/file_info_test.go rename to server/model/file_info_test.go diff --git a/model/github_release.go b/server/model/github_release.go similarity index 100% rename from model/github_release.go rename to server/model/github_release.go diff --git a/model/gitlab.go b/server/model/gitlab.go similarity index 100% rename from model/gitlab.go rename to server/model/gitlab.go diff --git a/model/group.go b/server/model/group.go similarity index 100% rename from model/group.go rename to server/model/group.go diff --git a/model/group_member.go b/server/model/group_member.go similarity index 100% rename from model/group_member.go rename to server/model/group_member.go diff --git a/model/group_syncable.go b/server/model/group_syncable.go similarity index 100% rename from model/group_syncable.go rename to server/model/group_syncable.go diff --git a/model/group_syncable_test.go b/server/model/group_syncable_test.go similarity index 100% rename from model/group_syncable_test.go rename to server/model/group_syncable_test.go diff --git a/model/guest_invite.go b/server/model/guest_invite.go similarity index 100% rename from model/guest_invite.go rename to server/model/guest_invite.go diff --git a/model/hosted_customer.go b/server/model/hosted_customer.go similarity index 85% rename from model/hosted_customer.go rename to server/model/hosted_customer.go index 608892e5e5..0b40f69c32 100644 --- a/model/hosted_customer.go +++ b/server/model/hosted_customer.go @@ -35,8 +35,9 @@ type SelfHostedCustomerForm struct { } type SelfHostedConfirmPaymentMethodRequest struct { - StripeSetupIntentID string `json:"stripe_setup_intent_id"` - Subscription CreateSubscriptionRequest `json:"subscription"` + StripeSetupIntentID string `json:"stripe_setup_intent_id"` + Subscription *CreateSubscriptionRequest `json:"subscription"` + ExpandRequest *SelfHostedExpansionRequest `json:"expand_request"` } // SelfHostedSignupPaymentResponse contains feels needed for self hosted signup to confirm payment and receive license. @@ -65,3 +66,8 @@ type SelfHostedBillingAccessRequest struct { type SelfHostedBillingAccessResponse struct { Token string `json:"token"` } + +type SelfHostedExpansionRequest struct { + Seats int `json:"seats"` + LicenseId string `json:"license_id"` +} diff --git a/model/incoming_webhook.go b/server/model/incoming_webhook.go similarity index 100% rename from model/incoming_webhook.go rename to server/model/incoming_webhook.go diff --git a/model/incoming_webhook_test.go b/server/model/incoming_webhook_test.go similarity index 100% rename from model/incoming_webhook_test.go rename to server/model/incoming_webhook_test.go diff --git a/model/initial_load.go b/server/model/initial_load.go similarity index 100% rename from model/initial_load.go rename to server/model/initial_load.go diff --git a/model/insights.go b/server/model/insights.go similarity index 100% rename from model/insights.go rename to server/model/insights.go diff --git a/model/insights_test.go b/server/model/insights_test.go similarity index 100% rename from model/insights_test.go rename to server/model/insights_test.go diff --git a/model/integration_action.go b/server/model/integration_action.go similarity index 100% rename from model/integration_action.go rename to server/model/integration_action.go diff --git a/model/integration_action_test.go b/server/model/integration_action_test.go similarity index 100% rename from model/integration_action_test.go rename to server/model/integration_action_test.go diff --git a/model/integrity.go b/server/model/integrity.go similarity index 100% rename from model/integrity.go rename to server/model/integrity.go diff --git a/model/job.go b/server/model/job.go similarity index 98% rename from model/job.go rename to server/model/job.go index a9c4c6f4a0..3801e1f01b 100644 --- a/model/job.go +++ b/server/model/job.go @@ -13,6 +13,7 @@ const ( JobTypeMessageExport = "message_export" JobTypeElasticsearchPostIndexing = "elasticsearch_post_indexing" JobTypeElasticsearchPostAggregation = "elasticsearch_post_aggregation" + JobTypeElasticsearchFixChannelIndex = "elasticsearch_fix_channel_index" JobTypeBlevePostIndexing = "bleve_post_indexing" JobTypeLdapSync = "ldap_sync" JobTypeMigrations = "migrations" diff --git a/model/job_test.go b/server/model/job_test.go similarity index 100% rename from model/job_test.go rename to server/model/job_test.go diff --git a/model/ldap.go b/server/model/ldap.go similarity index 100% rename from model/ldap.go rename to server/model/ldap.go diff --git a/model/license.go b/server/model/license.go similarity index 100% rename from model/license.go rename to server/model/license.go diff --git a/model/license_key.go b/server/model/license_key.go similarity index 100% rename from model/license_key.go rename to server/model/license_key.go diff --git a/model/license_key_test_env.go b/server/model/license_key_test_env.go similarity index 100% rename from model/license_key_test_env.go rename to server/model/license_key_test_env.go diff --git a/model/license_test.go b/server/model/license_test.go similarity index 100% rename from model/license_test.go rename to server/model/license_test.go diff --git a/model/link_metadata.go b/server/model/link_metadata.go similarity index 100% rename from model/link_metadata.go rename to server/model/link_metadata.go diff --git a/model/link_metadata_test.go b/server/model/link_metadata_test.go similarity index 100% rename from model/link_metadata_test.go rename to server/model/link_metadata_test.go diff --git a/model/manifest.go b/server/model/manifest.go similarity index 100% rename from model/manifest.go rename to server/model/manifest.go diff --git a/model/manifest_test.go b/server/model/manifest_test.go similarity index 100% rename from model/manifest_test.go rename to server/model/manifest_test.go diff --git a/model/marketplace_plugin.go b/server/model/marketplace_plugin.go similarity index 100% rename from model/marketplace_plugin.go rename to server/model/marketplace_plugin.go diff --git a/model/member_invite.go b/server/model/member_invite.go similarity index 100% rename from model/member_invite.go rename to server/model/member_invite.go diff --git a/model/mention_map.go b/server/model/mention_map.go similarity index 100% rename from model/mention_map.go rename to server/model/mention_map.go diff --git a/model/mention_map_test.go b/server/model/mention_map_test.go similarity index 100% rename from model/mention_map_test.go rename to server/model/mention_map_test.go diff --git a/model/message_export.go b/server/model/message_export.go similarity index 100% rename from model/message_export.go rename to server/model/message_export.go diff --git a/model/mfa_secret.go b/server/model/mfa_secret.go similarity index 100% rename from model/mfa_secret.go rename to server/model/mfa_secret.go diff --git a/model/migration.go b/server/model/migration.go similarity index 96% rename from model/migration.go rename to server/model/migration.go index 766e51598a..3369851479 100644 --- a/model/migration.go +++ b/server/model/migration.go @@ -40,4 +40,5 @@ const ( MigrationKeyAddPlayboosksManageRolesPermissions = "playbooks_manage_roles" MigrationKeyAddProductsBoardsPermissions = "products_boards" MigrationKeyAddCustomUserGroupsPermissionRestore = "custom_groups_permission_restore" + MigrationKeyElasticsearchFixChannelIndex = "elasticsearch_fix_channel_index_migration_complete" ) diff --git a/model/modeltestlib_test.go b/server/model/modeltestlib_test.go similarity index 100% rename from model/modeltestlib_test.go rename to server/model/modeltestlib_test.go diff --git a/model/notify_admin.go b/server/model/notify_admin.go similarity index 100% rename from model/notify_admin.go rename to server/model/notify_admin.go diff --git a/model/oauth.go b/server/model/oauth.go similarity index 100% rename from model/oauth.go rename to server/model/oauth.go diff --git a/model/oauth_test.go b/server/model/oauth_test.go similarity index 100% rename from model/oauth_test.go rename to server/model/oauth_test.go diff --git a/model/oauthproviders/gitlab/gitlab.go b/server/model/oauthproviders/gitlab/gitlab.go similarity index 95% rename from model/oauthproviders/gitlab/gitlab.go rename to server/model/oauthproviders/gitlab/gitlab.go index 01b2aee728..8e41124b9d 100644 --- a/model/oauthproviders/gitlab/gitlab.go +++ b/server/model/oauthproviders/gitlab/gitlab.go @@ -10,8 +10,8 @@ import ( "strconv" "strings" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/einterfaces" + "github.com/mattermost/mattermost-server/server/v8/channels/einterfaces" + "github.com/mattermost/mattermost-server/server/v8/model" ) type GitLabProvider struct { diff --git a/model/onboarding.go b/server/model/onboarding.go similarity index 89% rename from model/onboarding.go rename to server/model/onboarding.go index 797bea7c1d..0fe5e91ffa 100644 --- a/model/onboarding.go +++ b/server/model/onboarding.go @@ -10,6 +10,7 @@ import ( // CompleteOnboardingRequest describes parameters of the requested plugin. type CompleteOnboardingRequest struct { + Organization string `json:"organization"` // Organization is the name of the organization InstallPlugins []string `json:"install_plugins"` // InstallPlugins is a list of plugins to be installed } diff --git a/model/outgoing_webhook.go b/server/model/outgoing_webhook.go similarity index 100% rename from model/outgoing_webhook.go rename to server/model/outgoing_webhook.go diff --git a/model/outgoing_webhook_test.go b/server/model/outgoing_webhook_test.go similarity index 100% rename from model/outgoing_webhook_test.go rename to server/model/outgoing_webhook_test.go diff --git a/model/permalink.go b/server/model/permalink.go similarity index 100% rename from model/permalink.go rename to server/model/permalink.go diff --git a/model/permission.go b/server/model/permission.go similarity index 99% rename from model/permission.go rename to server/model/permission.go index a44a566964..e91809127e 100644 --- a/model/permission.go +++ b/server/model/permission.go @@ -21,7 +21,6 @@ type Permission struct { var PermissionInviteUser *Permission var PermissionAddUserToTeam *Permission -var PermissionUseSlashCommands *Permission var PermissionManageSlashCommands *Permission var PermissionManageOthersSlashCommands *Permission var PermissionCreatePublicChannel *Permission @@ -390,12 +389,6 @@ func initializePermissions() { "authentication.permissions.add_user_to_team.description", PermissionScopeTeam, } - PermissionUseSlashCommands = &Permission{ - "use_slash_commands", - "authentication.permissions.team_use_slash_commands.name", - "authentication.permissions.team_use_slash_commands.description", - PermissionScopeChannel, - } PermissionManageSlashCommands = &Permission{ "manage_slash_commands", "authentication.permissions.manage_slash_commands.name", @@ -2315,7 +2308,6 @@ func initializePermissions() { } ChannelScopedPermissions := []*Permission{ - PermissionUseSlashCommands, PermissionManagePublicChannelMembers, PermissionManagePrivateChannelMembers, PermissionManageChannelRoles, diff --git a/model/plugin_cluster_event.go b/server/model/plugin_cluster_event.go similarity index 100% rename from model/plugin_cluster_event.go rename to server/model/plugin_cluster_event.go diff --git a/model/plugin_constants.go b/server/model/plugin_constants.go similarity index 100% rename from model/plugin_constants.go rename to server/model/plugin_constants.go diff --git a/model/plugin_event_data.go b/server/model/plugin_event_data.go similarity index 100% rename from model/plugin_event_data.go rename to server/model/plugin_event_data.go diff --git a/model/plugin_key_value.go b/server/model/plugin_key_value.go similarity index 100% rename from model/plugin_key_value.go rename to server/model/plugin_key_value.go diff --git a/model/plugin_key_value_test.go b/server/model/plugin_key_value_test.go similarity index 100% rename from model/plugin_key_value_test.go rename to server/model/plugin_key_value_test.go diff --git a/model/plugin_kvset_options.go b/server/model/plugin_kvset_options.go similarity index 100% rename from model/plugin_kvset_options.go rename to server/model/plugin_kvset_options.go diff --git a/model/plugin_on_install_event.go b/server/model/plugin_on_install_event.go similarity index 100% rename from model/plugin_on_install_event.go rename to server/model/plugin_on_install_event.go diff --git a/model/plugin_status.go b/server/model/plugin_status.go similarity index 100% rename from model/plugin_status.go rename to server/model/plugin_status.go diff --git a/model/plugin_valid.go b/server/model/plugin_valid.go similarity index 100% rename from model/plugin_valid.go rename to server/model/plugin_valid.go diff --git a/model/plugin_valid_test.go b/server/model/plugin_valid_test.go similarity index 100% rename from model/plugin_valid_test.go rename to server/model/plugin_valid_test.go diff --git a/model/plugins_response.go b/server/model/plugins_response.go similarity index 100% rename from model/plugins_response.go rename to server/model/plugins_response.go diff --git a/model/post.go b/server/model/post.go similarity index 99% rename from model/post.go rename to server/model/post.go index 7447c91214..d047216735 100644 --- a/model/post.go +++ b/server/model/post.go @@ -15,7 +15,7 @@ import ( "sync" "unicode/utf8" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/markdown" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/markdown" ) const ( diff --git a/model/post_acknowledgement.go b/server/model/post_acknowledgement.go similarity index 100% rename from model/post_acknowledgement.go rename to server/model/post_acknowledgement.go diff --git a/model/post_embed.go b/server/model/post_embed.go similarity index 100% rename from model/post_embed.go rename to server/model/post_embed.go diff --git a/model/post_info.go b/server/model/post_info.go similarity index 100% rename from model/post_info.go rename to server/model/post_info.go diff --git a/model/post_list.go b/server/model/post_list.go similarity index 100% rename from model/post_list.go rename to server/model/post_list.go diff --git a/model/post_list_test.go b/server/model/post_list_test.go similarity index 100% rename from model/post_list_test.go rename to server/model/post_list_test.go diff --git a/model/post_metadata.go b/server/model/post_metadata.go similarity index 100% rename from model/post_metadata.go rename to server/model/post_metadata.go diff --git a/model/post_search_results.go b/server/model/post_search_results.go similarity index 100% rename from model/post_search_results.go rename to server/model/post_search_results.go diff --git a/model/post_test.go b/server/model/post_test.go similarity index 100% rename from model/post_test.go rename to server/model/post_test.go diff --git a/model/preference.go b/server/model/preference.go similarity index 100% rename from model/preference.go rename to server/model/preference.go diff --git a/model/preference_test.go b/server/model/preference_test.go similarity index 100% rename from model/preference_test.go rename to server/model/preference_test.go diff --git a/model/product_notices.go b/server/model/product_notices.go similarity index 100% rename from model/product_notices.go rename to server/model/product_notices.go diff --git a/model/push_notification.go b/server/model/push_notification.go similarity index 100% rename from model/push_notification.go rename to server/model/push_notification.go diff --git a/model/push_notification_test.go b/server/model/push_notification_test.go similarity index 100% rename from model/push_notification_test.go rename to server/model/push_notification_test.go diff --git a/model/push_response.go b/server/model/push_response.go similarity index 100% rename from model/push_response.go rename to server/model/push_response.go diff --git a/model/push_response_test.go b/server/model/push_response_test.go similarity index 100% rename from model/push_response_test.go rename to server/model/push_response_test.go diff --git a/model/reaction.go b/server/model/reaction.go similarity index 100% rename from model/reaction.go rename to server/model/reaction.go diff --git a/model/reaction_test.go b/server/model/reaction_test.go similarity index 100% rename from model/reaction_test.go rename to server/model/reaction_test.go diff --git a/model/remote_cluster.go b/server/model/remote_cluster.go similarity index 100% rename from model/remote_cluster.go rename to server/model/remote_cluster.go diff --git a/model/remote_cluster_test.go b/server/model/remote_cluster_test.go similarity index 100% rename from model/remote_cluster_test.go rename to server/model/remote_cluster_test.go diff --git a/model/role.go b/server/model/role.go similarity index 99% rename from model/role.go rename to server/model/role.go index 2c7a8fbf7b..4fba0c64f7 100644 --- a/model/role.go +++ b/server/model/role.go @@ -755,7 +755,6 @@ func MakeDefaultRoles() map[string]*Role { PermissionEditPost.Id, PermissionCreatePost.Id, PermissionUseChannelMentions.Id, - PermissionUseSlashCommands.Id, }, SchemeManaged: true, BuiltIn: true, @@ -774,7 +773,6 @@ func MakeDefaultRoles() map[string]*Role { PermissionGetPublicLink.Id, PermissionCreatePost.Id, PermissionUseChannelMentions.Id, - PermissionUseSlashCommands.Id, PermissionManagePublicChannelProperties.Id, PermissionDeletePublicChannel.Id, PermissionManagePrivateChannelProperties.Id, diff --git a/model/role_test.go b/server/model/role_test.go similarity index 99% rename from model/role_test.go rename to server/model/role_test.go index 431a3286f1..d6142841dc 100644 --- a/model/role_test.go +++ b/server/model/role_test.go @@ -71,7 +71,6 @@ func TestRolePatchFromChannelModerationsPatch(t *testing.T) { PermissionManagePublicChannelMembers.Id, PermissionUploadFile.Id, PermissionGetPublicLink.Id, - PermissionUseSlashCommands.Id, } baseModeratedPermissions := []string{ diff --git a/model/saml.go b/server/model/saml.go similarity index 100% rename from model/saml.go rename to server/model/saml.go diff --git a/model/scheduled_task.go b/server/model/scheduled_task.go similarity index 100% rename from model/scheduled_task.go rename to server/model/scheduled_task.go diff --git a/model/scheduled_task_test.go b/server/model/scheduled_task_test.go similarity index 100% rename from model/scheduled_task_test.go rename to server/model/scheduled_task_test.go diff --git a/model/scheme.go b/server/model/scheme.go similarity index 100% rename from model/scheme.go rename to server/model/scheme.go diff --git a/model/search_params.go b/server/model/search_params.go similarity index 100% rename from model/search_params.go rename to server/model/search_params.go diff --git a/model/search_params_test.go b/server/model/search_params_test.go similarity index 100% rename from model/search_params_test.go rename to server/model/search_params_test.go diff --git a/model/security_bulletin.go b/server/model/security_bulletin.go similarity index 100% rename from model/security_bulletin.go rename to server/model/security_bulletin.go diff --git a/model/session.go b/server/model/session.go similarity index 98% rename from model/session.go rename to server/model/session.go index d3f878004c..a41a018bfe 100644 --- a/model/session.go +++ b/server/model/session.go @@ -8,7 +8,7 @@ import ( "strconv" "strings" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) const ( diff --git a/model/session_serial_gen.go b/server/model/session_serial_gen.go similarity index 100% rename from model/session_serial_gen.go rename to server/model/session_serial_gen.go diff --git a/model/session_test.go b/server/model/session_test.go similarity index 100% rename from model/session_test.go rename to server/model/session_test.go diff --git a/model/shared_channel.go b/server/model/shared_channel.go similarity index 100% rename from model/shared_channel.go rename to server/model/shared_channel.go diff --git a/model/shared_channel_test.go b/server/model/shared_channel_test.go similarity index 100% rename from model/shared_channel_test.go rename to server/model/shared_channel_test.go diff --git a/model/slack_attachment.go b/server/model/slack_attachment.go similarity index 100% rename from model/slack_attachment.go rename to server/model/slack_attachment.go diff --git a/model/slack_attachment_test.go b/server/model/slack_attachment_test.go similarity index 100% rename from model/slack_attachment_test.go rename to server/model/slack_attachment_test.go diff --git a/model/slack_compatibility.go b/server/model/slack_compatibility.go similarity index 100% rename from model/slack_compatibility.go rename to server/model/slack_compatibility.go diff --git a/model/slack_compatibility_test.go b/server/model/slack_compatibility_test.go similarity index 100% rename from model/slack_compatibility_test.go rename to server/model/slack_compatibility_test.go diff --git a/model/status.go b/server/model/status.go similarity index 100% rename from model/status.go rename to server/model/status.go diff --git a/model/status_test.go b/server/model/status_test.go similarity index 100% rename from model/status_test.go rename to server/model/status_test.go diff --git a/model/suggest_command.go b/server/model/suggest_command.go similarity index 100% rename from model/suggest_command.go rename to server/model/suggest_command.go diff --git a/model/switch_request.go b/server/model/switch_request.go similarity index 100% rename from model/switch_request.go rename to server/model/switch_request.go diff --git a/model/system.go b/server/model/system.go similarity index 99% rename from model/system.go rename to server/model/system.go index fbc2aaa684..24b4fce9c9 100644 --- a/model/system.go +++ b/server/model/system.go @@ -16,6 +16,7 @@ const ( SystemAsymmetricSigningKeyKey = "AsymmetricSigningKey" SystemPostActionCookieSecretKey = "PostActionCookieSecret" SystemInstallationDateKey = "InstallationDate" + SystemOrganizationName = "OrganizationName" SystemFirstServerRunTimestampKey = "FirstServerRunTimestamp" SystemClusterEncryptionKey = "ClusterEncryptionKey" SystemUpgradedFromTeId = "UpgradedFromTE" diff --git a/model/team.go b/server/model/team.go similarity index 100% rename from model/team.go rename to server/model/team.go diff --git a/model/team_member.go b/server/model/team_member.go similarity index 100% rename from model/team_member.go rename to server/model/team_member.go diff --git a/model/team_member_serial_gen.go b/server/model/team_member_serial_gen.go similarity index 100% rename from model/team_member_serial_gen.go rename to server/model/team_member_serial_gen.go diff --git a/model/team_member_test.go b/server/model/team_member_test.go similarity index 100% rename from model/team_member_test.go rename to server/model/team_member_test.go diff --git a/model/team_search.go b/server/model/team_search.go similarity index 100% rename from model/team_search.go rename to server/model/team_search.go diff --git a/model/team_stats.go b/server/model/team_stats.go similarity index 100% rename from model/team_stats.go rename to server/model/team_stats.go diff --git a/model/team_test.go b/server/model/team_test.go similarity index 100% rename from model/team_test.go rename to server/model/team_test.go diff --git a/model/terms_of_service.go b/server/model/terms_of_service.go similarity index 100% rename from model/terms_of_service.go rename to server/model/terms_of_service.go diff --git a/model/terms_of_service_test.go b/server/model/terms_of_service_test.go similarity index 100% rename from model/terms_of_service_test.go rename to server/model/terms_of_service_test.go diff --git a/model/testdata/markdown-sample-with-rewritten-image-urls.md b/server/model/testdata/markdown-sample-with-rewritten-image-urls.md similarity index 100% rename from model/testdata/markdown-sample-with-rewritten-image-urls.md rename to server/model/testdata/markdown-sample-with-rewritten-image-urls.md diff --git a/model/testdata/markdown-sample.md b/server/model/testdata/markdown-sample.md similarity index 100% rename from model/testdata/markdown-sample.md rename to server/model/testdata/markdown-sample.md diff --git a/model/thread.go b/server/model/thread.go similarity index 100% rename from model/thread.go rename to server/model/thread.go diff --git a/model/token.go b/server/model/token.go similarity index 100% rename from model/token.go rename to server/model/token.go diff --git a/model/true_up_review_profile.go b/server/model/true_up_review_profile.go similarity index 100% rename from model/true_up_review_profile.go rename to server/model/true_up_review_profile.go diff --git a/model/typing_request.go b/server/model/typing_request.go similarity index 100% rename from model/typing_request.go rename to server/model/typing_request.go diff --git a/model/upload_session.go b/server/model/upload_session.go similarity index 100% rename from model/upload_session.go rename to server/model/upload_session.go diff --git a/model/upload_session_test.go b/server/model/upload_session_test.go similarity index 100% rename from model/upload_session_test.go rename to server/model/upload_session_test.go diff --git a/model/usage.go b/server/model/usage.go similarity index 100% rename from model/usage.go rename to server/model/usage.go diff --git a/model/user.go b/server/model/user.go similarity index 99% rename from model/user.go rename to server/model/user.go index 9466343bc6..5fbbd47d6f 100644 --- a/model/user.go +++ b/server/model/user.go @@ -17,8 +17,8 @@ import ( "golang.org/x/crypto/bcrypt" "golang.org/x/text/language" - "github.com/mattermost/mattermost-server/v6/server/platform/services/timezones" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/platform/services/timezones" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) const ( diff --git a/model/user_access_token.go b/server/model/user_access_token.go similarity index 100% rename from model/user_access_token.go rename to server/model/user_access_token.go diff --git a/model/user_access_token_search.go b/server/model/user_access_token_search.go similarity index 100% rename from model/user_access_token_search.go rename to server/model/user_access_token_search.go diff --git a/model/user_access_token_test.go b/server/model/user_access_token_test.go similarity index 100% rename from model/user_access_token_test.go rename to server/model/user_access_token_test.go diff --git a/model/user_autocomplete.go b/server/model/user_autocomplete.go similarity index 100% rename from model/user_autocomplete.go rename to server/model/user_autocomplete.go diff --git a/model/user_count.go b/server/model/user_count.go similarity index 100% rename from model/user_count.go rename to server/model/user_count.go diff --git a/model/user_get.go b/server/model/user_get.go similarity index 100% rename from model/user_get.go rename to server/model/user_get.go diff --git a/model/user_search.go b/server/model/user_search.go similarity index 100% rename from model/user_search.go rename to server/model/user_search.go diff --git a/model/user_serial_gen.go b/server/model/user_serial_gen.go similarity index 100% rename from model/user_serial_gen.go rename to server/model/user_serial_gen.go diff --git a/model/user_terms_of_service.go b/server/model/user_terms_of_service.go similarity index 100% rename from model/user_terms_of_service.go rename to server/model/user_terms_of_service.go diff --git a/model/user_terms_of_service_test.go b/server/model/user_terms_of_service_test.go similarity index 100% rename from model/user_terms_of_service_test.go rename to server/model/user_terms_of_service_test.go diff --git a/model/user_test.go b/server/model/user_test.go similarity index 100% rename from model/user_test.go rename to server/model/user_test.go diff --git a/model/users_stats.go b/server/model/users_stats.go similarity index 100% rename from model/users_stats.go rename to server/model/users_stats.go diff --git a/model/utils.go b/server/model/utils.go similarity index 97% rename from model/utils.go rename to server/model/utils.go index 51ae486a6d..fb1068e053 100644 --- a/model/utils.go +++ b/server/model/utils.go @@ -25,7 +25,7 @@ import ( "github.com/pborman/uuid" "github.com/pkg/errors" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/i18n" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/i18n" ) const ( @@ -41,8 +41,26 @@ const ( var ErrMaxPropSizeExceeded = fmt.Errorf("max prop size of %d exceeded", maxPropSizeBytes) type StringInterface map[string]any +type StringSet map[string]struct{} type StringArray []string +func (ss StringSet) Has(val string) bool { + _, ok := ss[val] + return ok +} + +func (ss StringSet) Add(val string) { + ss[val] = struct{}{} +} + +func (ss StringSet) Val() []string { + keys := make([]string, 0, len(ss)) + for k := range ss { + keys = append(keys, k) + } + return keys +} + func (sa StringArray) Remove(input string) StringArray { for index := range sa { if sa[index] == input { @@ -251,6 +269,8 @@ type AppError struct { wrapped error } +const maxErrorLength = 1024 + func (er *AppError) Error() string { var sb strings.Builder @@ -276,7 +296,11 @@ func (er *AppError) Error() string { sb.WriteString(err.Error()) } - return sb.String() + res := sb.String() + if len(res) > maxErrorLength { + res = res[:maxErrorLength] + "..." + } + return res } func (er *AppError) Translate(T i18n.TranslateFunc) { diff --git a/model/utils_test.go b/server/model/utils_test.go similarity index 98% rename from model/utils_test.go rename to server/model/utils_test.go index 606477d750..7b5e099e96 100644 --- a/model/utils_test.go +++ b/server/model/utils_test.go @@ -116,6 +116,13 @@ func TestAppErrorRender(t *testing.T) { aerr := NewAppError("here", "message", nil, "details", http.StatusTeapot).Wrap(fmt.Errorf("my error (%w)", fmt.Errorf("inner error"))) assert.EqualError(t, aerr, "here: message, details, my error (inner error)") }) + + t.Run("MaxLength", func(t *testing.T) { + str := strings.Repeat("error", 65536) + msg := "msg" + aerr := NewAppError("id", msg, nil, str, http.StatusTeapot).Wrap(errors.New(str)) + assert.Len(t, aerr.Error(), maxErrorLength+len(msg)) + }) } func TestAppErrorSerialize(t *testing.T) { diff --git a/model/version.go b/server/model/version.go similarity index 99% rename from model/version.go rename to server/model/version.go index 1683e810d5..51b6257e7f 100644 --- a/model/version.go +++ b/server/model/version.go @@ -13,6 +13,7 @@ import ( // It should be maintained in chronological order with most current // release at the front of the list. var versions = []string{ + "7.11.0", "7.10.0", "7.9.0", "7.8.0", diff --git a/model/version_test.go b/server/model/version_test.go similarity index 100% rename from model/version_test.go rename to server/model/version_test.go diff --git a/model/websocket_client.go b/server/model/websocket_client.go similarity index 99% rename from model/websocket_client.go rename to server/model/websocket_client.go index fa1ce5ffc1..58f6d62c58 100644 --- a/model/websocket_client.go +++ b/server/model/websocket_client.go @@ -11,7 +11,7 @@ import ( "sync/atomic" "time" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" "github.com/gorilla/websocket" "github.com/vmihailenco/msgpack/v5" diff --git a/model/websocket_client_test.go b/server/model/websocket_client_test.go similarity index 100% rename from model/websocket_client_test.go rename to server/model/websocket_client_test.go diff --git a/model/websocket_message.go b/server/model/websocket_message.go similarity index 100% rename from model/websocket_message.go rename to server/model/websocket_message.go diff --git a/model/websocket_message_test.go b/server/model/websocket_message_test.go similarity index 100% rename from model/websocket_message_test.go rename to server/model/websocket_message_test.go diff --git a/model/websocket_request.go b/server/model/websocket_request.go similarity index 94% rename from model/websocket_request.go rename to server/model/websocket_request.go index 5ba72d8367..1abea988cb 100644 --- a/model/websocket_request.go +++ b/server/model/websocket_request.go @@ -4,7 +4,7 @@ package model import ( - "github.com/mattermost/mattermost-server/v6/server/platform/shared/i18n" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/i18n" "github.com/vmihailenco/msgpack/v5" ) diff --git a/model/worktemplate.go b/server/model/worktemplate.go similarity index 97% rename from model/worktemplate.go rename to server/model/worktemplate.go index b0c4262784..73857524bb 100644 --- a/model/worktemplate.go +++ b/server/model/worktemplate.go @@ -69,7 +69,8 @@ type WorkTemplatePlaybook struct { } type WorkTemplateIntegration struct { - ID string `json:"id"` + ID string `json:"id"` + Recommended bool `json:"recommended"` } type WorkTemplateContent struct { diff --git a/server/platform/services/awsmeter/awsmeter.go b/server/platform/services/awsmeter/awsmeter.go index e0034cdfb9..7d506ba183 100644 --- a/server/platform/services/awsmeter/awsmeter.go +++ b/server/platform/services/awsmeter/awsmeter.go @@ -17,9 +17,9 @@ import ( "github.com/aws/aws-sdk-go/service/marketplacemetering/marketplacemeteringiface" "github.com/pkg/errors" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) type AwsMeter struct { diff --git a/server/platform/services/awsmeter/awsmeter_test.go b/server/platform/services/awsmeter/awsmeter_test.go index 6fdbce2898..2fbbdc8284 100644 --- a/server/platform/services/awsmeter/awsmeter_test.go +++ b/server/platform/services/awsmeter/awsmeter_test.go @@ -13,9 +13,9 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/plugin/plugintest/mock" - "github.com/mattermost/mattermost-server/v6/server/channels/store/storetest/mocks" + "github.com/mattermost/mattermost-server/server/v8/channels/store/storetest/mocks" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/plugin/plugintest/mock" ) type mockMarketplaceMeteringClient struct { diff --git a/server/platform/services/cache/cache.go b/server/platform/services/cache/cache.go index 54323b2e97..60d003e93b 100644 --- a/server/platform/services/cache/cache.go +++ b/server/platform/services/cache/cache.go @@ -7,7 +7,7 @@ import ( "errors" "time" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) // ErrKeyNotFound is the error when the given key is not found diff --git a/server/platform/services/cache/lru.go b/server/platform/services/cache/lru.go index 08852f02c4..ba7d6f98f2 100644 --- a/server/platform/services/cache/lru.go +++ b/server/platform/services/cache/lru.go @@ -11,7 +11,7 @@ import ( "github.com/tinylib/msgp/msgp" "github.com/vmihailenco/msgpack/v5" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) // LRU is a thread-safe fixed size LRU cache. diff --git a/server/platform/services/cache/lru_striped.go b/server/platform/services/cache/lru_striped.go index 5ce231b0c4..aecd89ffa7 100644 --- a/server/platform/services/cache/lru_striped.go +++ b/server/platform/services/cache/lru_striped.go @@ -10,7 +10,7 @@ import ( "github.com/cespare/xxhash/v2" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) // LRUStriped keeps LRU caches in buckets in order to lower mutex contention. diff --git a/server/platform/services/cache/lru_striped_bench_test.go b/server/platform/services/cache/lru_striped_bench_test.go index 42fbc9f35b..8b88accf0b 100644 --- a/server/platform/services/cache/lru_striped_bench_test.go +++ b/server/platform/services/cache/lru_striped_bench_test.go @@ -11,7 +11,7 @@ import ( "github.com/cespare/xxhash/v2" - "github.com/mattermost/mattermost-server/v6/server/platform/services/cache" + "github.com/mattermost/mattermost-server/server/v8/platform/services/cache" ) const ( diff --git a/server/platform/services/cache/lru_striped_test.go b/server/platform/services/cache/lru_striped_test.go index fe541c5b52..030b010e55 100644 --- a/server/platform/services/cache/lru_striped_test.go +++ b/server/platform/services/cache/lru_striped_test.go @@ -12,7 +12,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) func makeLRUPredictableTestData(num int) [][2]string { diff --git a/server/platform/services/cache/lru_test.go b/server/platform/services/cache/lru_test.go index 54b3cf814a..ecf03e1446 100644 --- a/server/platform/services/cache/lru_test.go +++ b/server/platform/services/cache/lru_test.go @@ -12,7 +12,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestLRU(t *testing.T) { diff --git a/server/platform/services/cache/mocks/Provider.go b/server/platform/services/cache/mocks/Provider.go index 0e96ceb618..3fb26fb355 100644 --- a/server/platform/services/cache/mocks/Provider.go +++ b/server/platform/services/cache/mocks/Provider.go @@ -5,7 +5,7 @@ package mocks import ( mock "github.com/stretchr/testify/mock" - cache "github.com/mattermost/mattermost-server/v6/server/platform/services/cache" + cache "github.com/mattermost/mattermost-server/server/v8/platform/services/cache" ) // Provider is an autogenerated mock type for the Provider type diff --git a/server/platform/services/cache/provider.go b/server/platform/services/cache/provider.go index a55dabf429..586a1265d8 100644 --- a/server/platform/services/cache/provider.go +++ b/server/platform/services/cache/provider.go @@ -6,7 +6,7 @@ package cache import ( "time" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) // CacheOptions contains options for initializing a cache diff --git a/server/platform/services/cache/provider_test.go b/server/platform/services/cache/provider_test.go index 9f9a4debb1..af5f86cbeb 100644 --- a/server/platform/services/cache/provider_test.go +++ b/server/platform/services/cache/provider_test.go @@ -9,7 +9,7 @@ import ( "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestNewCache(t *testing.T) { diff --git a/server/platform/services/configservice/configservice.go b/server/platform/services/configservice/configservice.go index 6bf2fb420e..82a4cc106b 100644 --- a/server/platform/services/configservice/configservice.go +++ b/server/platform/services/configservice/configservice.go @@ -4,7 +4,7 @@ package configservice import ( - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) // An interface representing something that contains a Config, such as the app.App struct diff --git a/server/platform/services/docextractor/combine.go b/server/platform/services/docextractor/combine.go index f77be14938..209e36cbba 100644 --- a/server/platform/services/docextractor/combine.go +++ b/server/platform/services/docextractor/combine.go @@ -6,7 +6,7 @@ package docextractor import ( "io" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) type combineExtractor struct { diff --git a/server/platform/services/docextractor/docextractor_test.go b/server/platform/services/docextractor/docextractor_test.go index 71cdc1da33..aa17f1fbb8 100644 --- a/server/platform/services/docextractor/docextractor_test.go +++ b/server/platform/services/docextractor/docextractor_test.go @@ -13,7 +13,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/server/channels/utils/testutils" + "github.com/mattermost/mattermost-server/server/v8/channels/utils/testutils" ) func TestExtract(t *testing.T) { diff --git a/server/platform/services/docextractor/pdf_test.go b/server/platform/services/docextractor/pdf_test.go index 65ca72603f..b6eea1a410 100644 --- a/server/platform/services/docextractor/pdf_test.go +++ b/server/platform/services/docextractor/pdf_test.go @@ -9,7 +9,7 @@ import ( "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/server/channels/utils/testutils" + "github.com/mattermost/mattermost-server/server/v8/channels/utils/testutils" ) func TestPdfEmptyFile(t *testing.T) { diff --git a/server/platform/services/httpservice/httpservice.go b/server/platform/services/httpservice/httpservice.go index 36bfbd0fbc..6572b0f1b9 100644 --- a/server/platform/services/httpservice/httpservice.go +++ b/server/platform/services/httpservice/httpservice.go @@ -10,7 +10,7 @@ import ( "time" "unicode" - "github.com/mattermost/mattermost-server/v6/server/platform/services/configservice" + "github.com/mattermost/mattermost-server/server/v8/platform/services/configservice" ) // HTTPService wraps the functionality for making http requests to provide some improvements to the default client diff --git a/server/platform/services/imageproxy/atmos_camo_test.go b/server/platform/services/imageproxy/atmos_camo_test.go index 8b5d321b51..aefd882a02 100644 --- a/server/platform/services/imageproxy/atmos_camo_test.go +++ b/server/platform/services/imageproxy/atmos_camo_test.go @@ -13,9 +13,9 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/utils/testutils" - "github.com/mattermost/mattermost-server/v6/server/platform/services/httpservice" + "github.com/mattermost/mattermost-server/server/v8/channels/utils/testutils" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/services/httpservice" ) func makeTestAtmosCamoProxy() *ImageProxy { diff --git a/server/platform/services/imageproxy/imageproxy.go b/server/platform/services/imageproxy/imageproxy.go index a2b63229e7..87a7f2a6d4 100644 --- a/server/platform/services/imageproxy/imageproxy.go +++ b/server/platform/services/imageproxy/imageproxy.go @@ -11,10 +11,10 @@ import ( "strings" "sync" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/platform/services/configservice" - "github.com/mattermost/mattermost-server/v6/server/platform/services/httpservice" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/services/configservice" + "github.com/mattermost/mattermost-server/server/v8/platform/services/httpservice" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) var ErrNotEnabled = Error{errors.New("imageproxy.ImageProxy: image proxy not enabled")} diff --git a/server/platform/services/imageproxy/local.go b/server/platform/services/imageproxy/local.go index 03e8271b13..4a45079260 100644 --- a/server/platform/services/imageproxy/local.go +++ b/server/platform/services/imageproxy/local.go @@ -19,7 +19,7 @@ import ( "strings" "time" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) var imageContentTypes = []string{ diff --git a/server/platform/services/imageproxy/local_test.go b/server/platform/services/imageproxy/local_test.go index b7681cdcf9..e97bad1bcd 100644 --- a/server/platform/services/imageproxy/local_test.go +++ b/server/platform/services/imageproxy/local_test.go @@ -13,9 +13,9 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/utils/testutils" - "github.com/mattermost/mattermost-server/v6/server/platform/services/httpservice" + "github.com/mattermost/mattermost-server/server/v8/channels/utils/testutils" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/services/httpservice" ) func makeTestLocalProxy() *ImageProxy { diff --git a/server/platform/services/marketplace/client.go b/server/platform/services/marketplace/client.go index 37e6568d30..3003952792 100644 --- a/server/platform/services/marketplace/client.go +++ b/server/platform/services/marketplace/client.go @@ -12,8 +12,8 @@ import ( "github.com/pkg/errors" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/platform/services/httpservice" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/services/httpservice" ) // Client is the programmatic interface to the marketplace server API. diff --git a/server/platform/services/remotecluster/invitation.go b/server/platform/services/remotecluster/invitation.go index 73cbeb4fa2..3667470038 100644 --- a/server/platform/services/remotecluster/invitation.go +++ b/server/platform/services/remotecluster/invitation.go @@ -8,7 +8,7 @@ import ( "errors" "fmt" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) // AcceptInvitation is called when accepting an invitation to connect with a remote cluster. diff --git a/server/platform/services/remotecluster/mocks_test.go b/server/platform/services/remotecluster/mocks_test.go index 5e97f60a5d..83896b343b 100644 --- a/server/platform/services/remotecluster/mocks_test.go +++ b/server/platform/services/remotecluster/mocks_test.go @@ -6,12 +6,12 @@ package remotecluster import ( "context" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/plugin/plugintest/mock" - "github.com/mattermost/mattermost-server/v6/server/channels/einterfaces" - "github.com/mattermost/mattermost-server/v6/server/channels/store" - "github.com/mattermost/mattermost-server/v6/server/channels/store/storetest/mocks" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/einterfaces" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/store/storetest/mocks" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/plugin/plugintest/mock" ) type mockServer struct { diff --git a/server/platform/services/remotecluster/ping.go b/server/platform/services/remotecluster/ping.go index f12e759faf..18d3f6f196 100644 --- a/server/platform/services/remotecluster/ping.go +++ b/server/platform/services/remotecluster/ping.go @@ -8,8 +8,8 @@ import ( "fmt" "time" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) // pingLoop periodically sends a ping to all remote clusters. diff --git a/server/platform/services/remotecluster/ping_test.go b/server/platform/services/remotecluster/ping_test.go index 71e953b803..8e60cc98f0 100644 --- a/server/platform/services/remotecluster/ping_test.go +++ b/server/platform/services/remotecluster/ping_test.go @@ -16,7 +16,7 @@ import ( "github.com/stretchr/testify/require" "github.com/wiggin77/merror" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) const ( diff --git a/server/platform/services/remotecluster/recv.go b/server/platform/services/remotecluster/recv.go index 8eb9b95b44..39c30aab84 100644 --- a/server/platform/services/remotecluster/recv.go +++ b/server/platform/services/remotecluster/recv.go @@ -6,8 +6,8 @@ package remotecluster import ( "fmt" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) // ReceiveIncomingMsg is called by the Rest API layer, or websocket layer (future), when a Remote Cluster diff --git a/server/platform/services/remotecluster/send_test.go b/server/platform/services/remotecluster/send_test.go index 6d00b6e3c5..489bef0a74 100644 --- a/server/platform/services/remotecluster/send_test.go +++ b/server/platform/services/remotecluster/send_test.go @@ -18,7 +18,7 @@ import ( "github.com/stretchr/testify/require" "github.com/wiggin77/merror" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) const ( diff --git a/server/platform/services/remotecluster/sendfile.go b/server/platform/services/remotecluster/sendfile.go index dcc9c4a0e6..dec27083d7 100644 --- a/server/platform/services/remotecluster/sendfile.go +++ b/server/platform/services/remotecluster/sendfile.go @@ -13,9 +13,9 @@ import ( "path" "time" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/filestore" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/filestore" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) type SendFileResultFunc func(us *model.UploadSession, rc *model.RemoteCluster, resp *Response, err error) diff --git a/server/platform/services/remotecluster/sendmsg.go b/server/platform/services/remotecluster/sendmsg.go index e4d708ec66..d31f172d28 100644 --- a/server/platform/services/remotecluster/sendmsg.go +++ b/server/platform/services/remotecluster/sendmsg.go @@ -17,8 +17,8 @@ import ( "github.com/wiggin77/merror" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) type SendMsgResultFunc func(msg model.RemoteClusterMsg, rc *model.RemoteCluster, resp *Response, err error) diff --git a/server/platform/services/remotecluster/sendprofileImage.go b/server/platform/services/remotecluster/sendprofileImage.go index 1a8891a9fe..6a852111ea 100644 --- a/server/platform/services/remotecluster/sendprofileImage.go +++ b/server/platform/services/remotecluster/sendprofileImage.go @@ -14,8 +14,8 @@ import ( "path" "time" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) type SendProfileImageResultFunc func(userId string, rc *model.RemoteCluster, resp *Response, err error) diff --git a/server/platform/services/remotecluster/sendprofileImage_test.go b/server/platform/services/remotecluster/sendprofileImage_test.go index 48e7b3301f..7c09570aac 100644 --- a/server/platform/services/remotecluster/sendprofileImage_test.go +++ b/server/platform/services/remotecluster/sendprofileImage_test.go @@ -18,7 +18,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) const ( diff --git a/server/platform/services/remotecluster/service.go b/server/platform/services/remotecluster/service.go index 8db28f7f42..ee6fb68ebe 100644 --- a/server/platform/services/remotecluster/service.go +++ b/server/platform/services/remotecluster/service.go @@ -10,10 +10,10 @@ import ( "sync" "time" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/einterfaces" - "github.com/mattermost/mattermost-server/v6/server/channels/store" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/einterfaces" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) const ( diff --git a/server/platform/services/remotecluster/service_test.go b/server/platform/services/remotecluster/service_test.go index 1e9bbd5b63..7b543757cc 100644 --- a/server/platform/services/remotecluster/service_test.go +++ b/server/platform/services/remotecluster/service_test.go @@ -10,7 +10,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestService_AddTopicListener(t *testing.T) { diff --git a/server/platform/services/searchengine/bleveengine/bleve.go b/server/platform/services/searchengine/bleveengine/bleve.go index d26acd17cc..1b2efc7944 100644 --- a/server/platform/services/searchengine/bleveengine/bleve.go +++ b/server/platform/services/searchengine/bleveengine/bleve.go @@ -17,8 +17,8 @@ import ( "github.com/blevesearch/bleve/v2/analysis/analyzer/standard" "github.com/blevesearch/bleve/v2/mapping" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) const ( diff --git a/server/platform/services/searchengine/bleveengine/bleve_test.go b/server/platform/services/searchengine/bleveengine/bleve_test.go index e33163f567..128db17e48 100644 --- a/server/platform/services/searchengine/bleveengine/bleve_test.go +++ b/server/platform/services/searchengine/bleveengine/bleve_test.go @@ -11,13 +11,13 @@ import ( "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store/searchlayer" - "github.com/mattermost/mattermost-server/v6/server/channels/store/searchtest" - "github.com/mattermost/mattermost-server/v6/server/channels/store/sqlstore" - "github.com/mattermost/mattermost-server/v6/server/channels/store/storetest" - "github.com/mattermost/mattermost-server/v6/server/channels/testlib" - "github.com/mattermost/mattermost-server/v6/server/platform/services/searchengine" + "github.com/mattermost/mattermost-server/server/v8/channels/store/searchlayer" + "github.com/mattermost/mattermost-server/server/v8/channels/store/searchtest" + "github.com/mattermost/mattermost-server/server/v8/channels/store/sqlstore" + "github.com/mattermost/mattermost-server/server/v8/channels/store/storetest" + "github.com/mattermost/mattermost-server/server/v8/channels/testlib" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/services/searchengine" ) type BleveEngineTestSuite struct { diff --git a/server/platform/services/searchengine/bleveengine/common.go b/server/platform/services/searchengine/bleveengine/common.go index 7bd1fee7df..fed7992bc8 100644 --- a/server/platform/services/searchengine/bleveengine/common.go +++ b/server/platform/services/searchengine/bleveengine/common.go @@ -6,8 +6,8 @@ package bleveengine import ( "strings" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/platform/services/searchengine" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/services/searchengine" ) type BLVChannel struct { diff --git a/server/platform/services/searchengine/bleveengine/indexer/indexing_job.go b/server/platform/services/searchengine/bleveengine/indexer/indexing_job.go index 4eefe7b9b0..1dbdfc9a44 100644 --- a/server/platform/services/searchengine/bleveengine/indexer/indexing_job.go +++ b/server/platform/services/searchengine/bleveengine/indexer/indexing_job.go @@ -10,10 +10,10 @@ import ( "sync/atomic" "time" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/jobs" - "github.com/mattermost/mattermost-server/v6/server/platform/services/searchengine/bleveengine" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/jobs" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/services/searchengine/bleveengine" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) const ( diff --git a/server/platform/services/searchengine/bleveengine/indexer/indexing_job_test.go b/server/platform/services/searchengine/bleveengine/indexer/indexing_job_test.go index 19f01e49e5..afe96b5283 100644 --- a/server/platform/services/searchengine/bleveengine/indexer/indexing_job_test.go +++ b/server/platform/services/searchengine/bleveengine/indexer/indexing_job_test.go @@ -10,11 +10,11 @@ import ( "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/jobs" - "github.com/mattermost/mattermost-server/v6/server/channels/store/storetest" - "github.com/mattermost/mattermost-server/v6/server/channels/utils/testutils" - "github.com/mattermost/mattermost-server/v6/server/platform/services/searchengine/bleveengine" + "github.com/mattermost/mattermost-server/server/v8/channels/jobs" + "github.com/mattermost/mattermost-server/server/v8/channels/store/storetest" + "github.com/mattermost/mattermost-server/server/v8/channels/utils/testutils" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/services/searchengine/bleveengine" ) func TestBleveIndexer(t *testing.T) { diff --git a/server/platform/services/searchengine/bleveengine/search.go b/server/platform/services/searchengine/bleveengine/search.go index 069f1c6433..5c993c7fde 100644 --- a/server/platform/services/searchengine/bleveengine/search.go +++ b/server/platform/services/searchengine/bleveengine/search.go @@ -10,8 +10,8 @@ import ( "github.com/blevesearch/bleve/v2" "github.com/blevesearch/bleve/v2/search/query" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) const DeletePostsBatchSize = 500 diff --git a/server/platform/services/searchengine/bleveengine/testlib.go b/server/platform/services/searchengine/bleveengine/testlib.go index 5c03856bb2..73b98b0d62 100644 --- a/server/platform/services/searchengine/bleveengine/testlib.go +++ b/server/platform/services/searchengine/bleveengine/testlib.go @@ -6,7 +6,7 @@ package bleveengine import ( "fmt" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) func createPost(userId string, channelId string) *model.Post { diff --git a/server/platform/services/searchengine/interface.go b/server/platform/services/searchengine/interface.go index ed83a0e5b3..2c2cf3f726 100644 --- a/server/platform/services/searchengine/interface.go +++ b/server/platform/services/searchengine/interface.go @@ -6,7 +6,7 @@ package searchengine import ( "time" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) type SearchEngineInterface interface { diff --git a/server/platform/services/searchengine/mocks/SearchEngineInterface.go b/server/platform/services/searchengine/mocks/SearchEngineInterface.go index db9ddfcb97..bed0ef16f2 100644 --- a/server/platform/services/searchengine/mocks/SearchEngineInterface.go +++ b/server/platform/services/searchengine/mocks/SearchEngineInterface.go @@ -5,7 +5,7 @@ package mocks import ( - model "github.com/mattermost/mattermost-server/v6/model" + model "github.com/mattermost/mattermost-server/server/v8/model" mock "github.com/stretchr/testify/mock" time "time" diff --git a/server/platform/services/searchengine/searchengine.go b/server/platform/services/searchengine/searchengine.go index 55948e98e8..a80defd6f3 100644 --- a/server/platform/services/searchengine/searchengine.go +++ b/server/platform/services/searchengine/searchengine.go @@ -4,7 +4,7 @@ package searchengine import ( - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) func NewBroker(cfg *model.Config) *Broker { @@ -45,8 +45,19 @@ func (seb *Broker) GetActiveEngines() []SearchEngineInterface { if seb.ElasticsearchEngine != nil && seb.ElasticsearchEngine.IsActive() { engines = append(engines, seb.ElasticsearchEngine) } - if seb.BleveEngine != nil && seb.BleveEngine.IsActive() { + if seb.BleveEngine != nil && seb.BleveEngine.IsActive() && seb.BleveEngine.IsIndexingEnabled() { engines = append(engines, seb.BleveEngine) } return engines } + +func (seb *Broker) ActiveEngine() string { + activeEngines := seb.GetActiveEngines() + if len(activeEngines) > 0 { + return activeEngines[0].GetName() + } + if *seb.cfg.SqlSettings.DisableDatabaseSearch { + return "none" + } + return "database" +} diff --git a/server/platform/services/searchengine/searchengine_test.go b/server/platform/services/searchengine/searchengine_test.go new file mode 100644 index 0000000000..6672b7c575 --- /dev/null +++ b/server/platform/services/searchengine/searchengine_test.go @@ -0,0 +1,42 @@ +// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. +// See LICENSE.txt for license information. + +package searchengine + +import ( + "testing" + + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/services/searchengine/mocks" + "github.com/stretchr/testify/assert" +) + +func TestActiveEngine(t *testing.T) { + cfg := &model.Config{} + cfg.SetDefaults() + + b := NewBroker(cfg) + + esMock := &mocks.SearchEngineInterface{} + esMock.On("IsActive").Return(true) + esMock.On("GetName").Return("elasticsearch") + + bleveMock := &mocks.SearchEngineInterface{} + bleveMock.On("IsActive").Return(true) + bleveMock.On("IsIndexingEnabled").Return(true) + bleveMock.On("GetName").Return("bleve") + + assert.Equal(t, "database", b.ActiveEngine()) + + b.ElasticsearchEngine = esMock + assert.Equal(t, "elasticsearch", b.ActiveEngine()) + + b.ElasticsearchEngine = nil + b.BleveEngine = bleveMock + assert.Equal(t, "bleve", b.ActiveEngine()) + + b.BleveEngine = nil + *b.cfg.SqlSettings.DisableDatabaseSearch = true + + assert.Equal(t, "none", b.ActiveEngine()) +} diff --git a/server/platform/services/searchengine/utils.go b/server/platform/services/searchengine/utils.go index 71e3c4f3f4..4e19c698e9 100644 --- a/server/platform/services/searchengine/utils.go +++ b/server/platform/services/searchengine/utils.go @@ -7,7 +7,7 @@ import ( "regexp" "strings" - "github.com/mattermost/mattermost-server/v6/server/channels/utils" + "github.com/mattermost/mattermost-server/server/v8/channels/utils" ) var EmailRegex = regexp.MustCompile(`^[^\s"]+@[^\s"]+$`) diff --git a/server/platform/services/sharedchannel/attachment.go b/server/platform/services/sharedchannel/attachment.go index cd922f720e..951a821f8a 100644 --- a/server/platform/services/sharedchannel/attachment.go +++ b/server/platform/services/sharedchannel/attachment.go @@ -10,10 +10,10 @@ import ( "fmt" "sync" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/app/request" - "github.com/mattermost/mattermost-server/v6/server/platform/services/remotecluster" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/app/request" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/services/remotecluster" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) // postsToAttachments returns the file attachments for a slice of posts that need to be synchronized. diff --git a/server/platform/services/sharedchannel/channelinvite.go b/server/platform/services/sharedchannel/channelinvite.go index 2116da3a66..041434ba4e 100644 --- a/server/platform/services/sharedchannel/channelinvite.go +++ b/server/platform/services/sharedchannel/channelinvite.go @@ -9,10 +9,10 @@ import ( "fmt" "strings" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/app/request" - "github.com/mattermost/mattermost-server/v6/server/platform/services/remotecluster" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/app/request" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/services/remotecluster" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) // channelInviteMsg represents an invitation for a remote cluster to start sharing a channel. diff --git a/server/platform/services/sharedchannel/channelinvite_test.go b/server/platform/services/sharedchannel/channelinvite_test.go index aa813d510b..74e55d68e7 100644 --- a/server/platform/services/sharedchannel/channelinvite_test.go +++ b/server/platform/services/sharedchannel/channelinvite_test.go @@ -13,10 +13,10 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/plugin/plugintest/mock" - "github.com/mattermost/mattermost-server/v6/server/channels/store/storetest/mocks" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/store/storetest/mocks" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/plugin/plugintest/mock" ) func TestOnReceiveChannelInvite(t *testing.T) { diff --git a/server/platform/services/sharedchannel/mock_AppIface_test.go b/server/platform/services/sharedchannel/mock_AppIface_test.go index eddbedf08a..a6f67f82ac 100644 --- a/server/platform/services/sharedchannel/mock_AppIface_test.go +++ b/server/platform/services/sharedchannel/mock_AppIface_test.go @@ -5,12 +5,12 @@ package sharedchannel import ( - filestore "github.com/mattermost/mattermost-server/v6/server/platform/shared/filestore" + filestore "github.com/mattermost/mattermost-server/server/v8/platform/shared/filestore" mock "github.com/stretchr/testify/mock" - model "github.com/mattermost/mattermost-server/v6/model" + model "github.com/mattermost/mattermost-server/server/v8/model" - request "github.com/mattermost/mattermost-server/v6/server/channels/app/request" + request "github.com/mattermost/mattermost-server/server/v8/channels/app/request" ) // MockAppIface is an autogenerated mock type for the AppIface type diff --git a/server/platform/services/sharedchannel/mock_ServerIface_test.go b/server/platform/services/sharedchannel/mock_ServerIface_test.go index 9643eef0a0..214943a098 100644 --- a/server/platform/services/sharedchannel/mock_ServerIface_test.go +++ b/server/platform/services/sharedchannel/mock_ServerIface_test.go @@ -5,14 +5,14 @@ package sharedchannel import ( - mlog "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + mlog "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" mock "github.com/stretchr/testify/mock" - model "github.com/mattermost/mattermost-server/v6/model" + model "github.com/mattermost/mattermost-server/server/v8/model" - remotecluster "github.com/mattermost/mattermost-server/v6/server/platform/services/remotecluster" + remotecluster "github.com/mattermost/mattermost-server/server/v8/platform/services/remotecluster" - store "github.com/mattermost/mattermost-server/v6/server/channels/store" + store "github.com/mattermost/mattermost-server/server/v8/channels/store" ) // MockServerIface is an autogenerated mock type for the ServerIface type diff --git a/server/platform/services/sharedchannel/msg.go b/server/platform/services/sharedchannel/msg.go index 90d76d2c7e..a7f3b46665 100644 --- a/server/platform/services/sharedchannel/msg.go +++ b/server/platform/services/sharedchannel/msg.go @@ -6,7 +6,7 @@ package sharedchannel import ( "encoding/json" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) // syncMsg represents a change in content (post add/edit/delete, reaction add/remove, users). diff --git a/server/platform/services/sharedchannel/permalink.go b/server/platform/services/sharedchannel/permalink.go index b33d70cdf2..5e4cfd5fcd 100644 --- a/server/platform/services/sharedchannel/permalink.go +++ b/server/platform/services/sharedchannel/permalink.go @@ -9,9 +9,9 @@ import ( "regexp" "strings" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/i18n" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/i18n" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) var ( diff --git a/server/platform/services/sharedchannel/permalink_test.go b/server/platform/services/sharedchannel/permalink_test.go index cc3a9687d1..4728d79daf 100644 --- a/server/platform/services/sharedchannel/permalink_test.go +++ b/server/platform/services/sharedchannel/permalink_test.go @@ -10,11 +10,11 @@ import ( "github.com/stretchr/testify/assert" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/plugin/plugintest/mock" - "github.com/mattermost/mattermost-server/v6/server/channels/store/storetest/mocks" - "github.com/mattermost/mattermost-server/v6/server/channels/utils" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/store/storetest/mocks" + "github.com/mattermost/mattermost-server/server/v8/channels/utils" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/plugin/plugintest/mock" ) func TestProcessPermalinkToRemote(t *testing.T) { diff --git a/server/platform/services/sharedchannel/service.go b/server/platform/services/sharedchannel/service.go index b6da9fe5dc..fdf0c7a9eb 100644 --- a/server/platform/services/sharedchannel/service.go +++ b/server/platform/services/sharedchannel/service.go @@ -10,12 +10,12 @@ import ( "sync" "time" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/app/request" - "github.com/mattermost/mattermost-server/v6/server/channels/store" - "github.com/mattermost/mattermost-server/v6/server/platform/services/remotecluster" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/filestore" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/app/request" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/services/remotecluster" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/filestore" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) const ( diff --git a/server/platform/services/sharedchannel/sync_recv.go b/server/platform/services/sharedchannel/sync_recv.go index 02ff7b14a3..0f5c493084 100644 --- a/server/platform/services/sharedchannel/sync_recv.go +++ b/server/platform/services/sharedchannel/sync_recv.go @@ -11,10 +11,10 @@ import ( "strconv" "strings" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/app/request" - "github.com/mattermost/mattermost-server/v6/server/platform/services/remotecluster" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/app/request" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/services/remotecluster" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) func (scs *Service) onReceiveSyncMessage(msg model.RemoteClusterMsg, rc *model.RemoteCluster, response *remotecluster.Response) error { diff --git a/server/platform/services/sharedchannel/sync_send.go b/server/platform/services/sharedchannel/sync_send.go index 213808f509..883a4c73d9 100644 --- a/server/platform/services/sharedchannel/sync_send.go +++ b/server/platform/services/sharedchannel/sync_send.go @@ -8,11 +8,11 @@ import ( "fmt" "time" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/app/request" - "github.com/mattermost/mattermost-server/v6/server/platform/services/remotecluster" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/i18n" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/app/request" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/services/remotecluster" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/i18n" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) type syncTask struct { diff --git a/server/platform/services/sharedchannel/sync_send_remote.go b/server/platform/services/sharedchannel/sync_send_remote.go index 09074a59af..d2886ab572 100644 --- a/server/platform/services/sharedchannel/sync_send_remote.go +++ b/server/platform/services/sharedchannel/sync_send_remote.go @@ -11,10 +11,10 @@ import ( "github.com/wiggin77/merror" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/app/request" - "github.com/mattermost/mattermost-server/v6/server/platform/services/remotecluster" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/app/request" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/services/remotecluster" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) type sendSyncMsgResultFunc func(syncResp SyncResponse, err error) diff --git a/server/platform/services/sharedchannel/util.go b/server/platform/services/sharedchannel/util.go index b8c0b124ad..e21abd5144 100644 --- a/server/platform/services/sharedchannel/util.go +++ b/server/platform/services/sharedchannel/util.go @@ -7,7 +7,7 @@ import ( "fmt" "strings" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) // fixMention replaces any mentions in a post for the user with the user's real username. diff --git a/server/platform/services/slackimport/converters.go b/server/platform/services/slackimport/converters.go index 9c90e98fad..041759f778 100644 --- a/server/platform/services/slackimport/converters.go +++ b/server/platform/services/slackimport/converters.go @@ -8,7 +8,7 @@ import ( "strconv" "strings" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) func slackConvertTimeStamp(ts string) int64 { diff --git a/server/platform/services/slackimport/parsers.go b/server/platform/services/slackimport/parsers.go index d001c5e8ee..fa3b49bd32 100644 --- a/server/platform/services/slackimport/parsers.go +++ b/server/platform/services/slackimport/parsers.go @@ -7,8 +7,8 @@ import ( "encoding/json" "io" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) func slackParseChannels(data io.Reader, channelType model.ChannelType) ([]slackChannel, error) { diff --git a/server/platform/services/slackimport/slackimport.go b/server/platform/services/slackimport/slackimport.go index 3cc7a1f365..bddadb7db6 100644 --- a/server/platform/services/slackimport/slackimport.go +++ b/server/platform/services/slackimport/slackimport.go @@ -18,12 +18,12 @@ import ( "time" "unicode/utf8" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/app/request" - "github.com/mattermost/mattermost-server/v6/server/channels/store" - "github.com/mattermost/mattermost-server/v6/server/channels/utils" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/i18n" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/app/request" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/utils" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/i18n" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) type slackChannel struct { diff --git a/server/platform/services/slackimport/slackimport_test.go b/server/platform/services/slackimport/slackimport_test.go index c25dcf96da..fd4ef1e4ea 100644 --- a/server/platform/services/slackimport/slackimport_test.go +++ b/server/platform/services/slackimport/slackimport_test.go @@ -12,10 +12,10 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/app/request" - "github.com/mattermost/mattermost-server/v6/server/channels/store/storetest/mocks" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/app/request" + "github.com/mattermost/mattermost-server/server/v8/channels/store/storetest/mocks" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) func TestSlackConvertTimeStamp(t *testing.T) { diff --git a/server/platform/services/telemetry/mocks/ServerIface.go b/server/platform/services/telemetry/mocks/ServerIface.go index df271fa334..dcc8dfc19b 100644 --- a/server/platform/services/telemetry/mocks/ServerIface.go +++ b/server/platform/services/telemetry/mocks/ServerIface.go @@ -7,14 +7,14 @@ package mocks import ( context "context" - httpservice "github.com/mattermost/mattermost-server/v6/server/platform/services/httpservice" + httpservice "github.com/mattermost/mattermost-server/server/v8/platform/services/httpservice" mock "github.com/stretchr/testify/mock" - model "github.com/mattermost/mattermost-server/v6/model" + model "github.com/mattermost/mattermost-server/server/v8/model" - plugin "github.com/mattermost/mattermost-server/v6/plugin" + plugin "github.com/mattermost/mattermost-server/server/v8/plugin" - product "github.com/mattermost/mattermost-server/v6/server/channels/product" + product "github.com/mattermost/mattermost-server/server/v8/channels/product" ) // ServerIface is an autogenerated mock type for the ServerIface type diff --git a/server/platform/services/telemetry/telemetry.go b/server/platform/services/telemetry/telemetry.go index a214911f20..e260cdfa90 100644 --- a/server/platform/services/telemetry/telemetry.go +++ b/server/platform/services/telemetry/telemetry.go @@ -14,15 +14,15 @@ import ( rudder "github.com/rudderlabs/analytics-go" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/plugin" - "github.com/mattermost/mattermost-server/v6/server/channels/product" - "github.com/mattermost/mattermost-server/v6/server/channels/store" - "github.com/mattermost/mattermost-server/v6/server/channels/utils" - "github.com/mattermost/mattermost-server/v6/server/platform/services/httpservice" - "github.com/mattermost/mattermost-server/v6/server/platform/services/marketplace" - "github.com/mattermost/mattermost-server/v6/server/platform/services/searchengine" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/product" + "github.com/mattermost/mattermost-server/server/v8/channels/store" + "github.com/mattermost/mattermost-server/server/v8/channels/utils" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/services/httpservice" + "github.com/mattermost/mattermost-server/server/v8/platform/services/marketplace" + "github.com/mattermost/mattermost-server/server/v8/platform/services/searchengine" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/plugin" ) const ( @@ -476,7 +476,6 @@ func (ts *TelemetryService) trackConfig() { "post_priority": *cfg.ServiceSettings.PostPriority, "self_hosted_purchase": *cfg.ServiceSettings.SelfHostedPurchase, "allow_synced_drafts": *cfg.ServiceSettings.AllowSyncedDrafts, - "self_hosted_expansion": *cfg.ServiceSettings.SelfHostedExpansion, }) ts.SendTelemetry(TrackConfigTeam, map[string]any{ @@ -522,6 +521,7 @@ func (ts *TelemetryService) trackConfig() { "query_timeout": *cfg.SqlSettings.QueryTimeout, "disable_database_search": *cfg.SqlSettings.DisableDatabaseSearch, "migrations_statement_timeout_seconds": *cfg.SqlSettings.MigrationsStatementTimeoutSeconds, + "replica_monitor_interval_seconds": *cfg.SqlSettings.ReplicaMonitorIntervalSeconds, }) ts.SendTelemetry(TrackConfigLog, map[string]any{ @@ -750,15 +750,16 @@ func (ts *TelemetryService) trackConfig() { }) ts.SendTelemetry(TrackConfigExperimental, map[string]any{ - "client_side_cert_enable": *cfg.ExperimentalSettings.ClientSideCertEnable, - "isdefault_client_side_cert_check": isDefault(*cfg.ExperimentalSettings.ClientSideCertCheck, model.ClientSideCertCheckPrimaryAuth), - "link_metadata_timeout_milliseconds": *cfg.ExperimentalSettings.LinkMetadataTimeoutMilliseconds, - "restrict_system_admin": *cfg.ExperimentalSettings.RestrictSystemAdmin, - "use_new_saml_library": *cfg.ExperimentalSettings.UseNewSAMLLibrary, - "enable_shared_channels": *cfg.ExperimentalSettings.EnableSharedChannels, - "enable_remote_cluster_service": *cfg.ExperimentalSettings.EnableRemoteClusterService && cfg.FeatureFlags.EnableRemoteClusterService, - "enable_app_bar": *cfg.ExperimentalSettings.EnableAppBar, - "patch_plugins_react_dom": *cfg.ExperimentalSettings.PatchPluginsReactDOM, + "client_side_cert_enable": *cfg.ExperimentalSettings.ClientSideCertEnable, + "isdefault_client_side_cert_check": isDefault(*cfg.ExperimentalSettings.ClientSideCertCheck, model.ClientSideCertCheckPrimaryAuth), + "link_metadata_timeout_milliseconds": *cfg.ExperimentalSettings.LinkMetadataTimeoutMilliseconds, + "restrict_system_admin": *cfg.ExperimentalSettings.RestrictSystemAdmin, + "use_new_saml_library": *cfg.ExperimentalSettings.UseNewSAMLLibrary, + "enable_shared_channels": *cfg.ExperimentalSettings.EnableSharedChannels, + "enable_remote_cluster_service": *cfg.ExperimentalSettings.EnableRemoteClusterService && cfg.FeatureFlags.EnableRemoteClusterService, + "enable_app_bar": *cfg.ExperimentalSettings.EnableAppBar, + "disable_refetching_on_browser_focus": *cfg.ExperimentalSettings.DisableRefetchingOnBrowserFocus, + "delay_channel_autocomplete": *cfg.ExperimentalSettings.DelayChannelAutocomplete, }) ts.SendTelemetry(TrackConfigAnalytics, map[string]any{ diff --git a/server/platform/services/telemetry/telemetry_test.go b/server/platform/services/telemetry/telemetry_test.go index f869c9fe48..52ab021bda 100644 --- a/server/platform/services/telemetry/telemetry_test.go +++ b/server/platform/services/telemetry/telemetry_test.go @@ -21,16 +21,16 @@ import ( "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/plugin" - "github.com/mattermost/mattermost-server/v6/plugin/plugintest" - "github.com/mattermost/mattermost-server/v6/server/channels/product" - storeMocks "github.com/mattermost/mattermost-server/v6/server/channels/store/storetest/mocks" - "github.com/mattermost/mattermost-server/v6/server/config" - "github.com/mattermost/mattermost-server/v6/server/platform/services/httpservice" - "github.com/mattermost/mattermost-server/v6/server/platform/services/searchengine" - "github.com/mattermost/mattermost-server/v6/server/platform/services/telemetry/mocks" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/product" + storeMocks "github.com/mattermost/mattermost-server/server/v8/channels/store/storetest/mocks" + "github.com/mattermost/mattermost-server/server/v8/config" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/services/httpservice" + "github.com/mattermost/mattermost-server/server/v8/platform/services/searchengine" + "github.com/mattermost/mattermost-server/server/v8/platform/services/telemetry/mocks" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/plugin" + "github.com/mattermost/mattermost-server/server/v8/plugin/plugintest" ) type FakeConfigService struct { @@ -168,7 +168,6 @@ func initializeMocks(cfg *model.Config, cloudLicense bool) (*mocks.ServerIface, func(m *model.Manifest) plugin.API { return pluginsAPIMock }, nil, pluginDir, webappPluginDir, - false, logger, nil) serverIfaceMock.On("GetPluginsEnvironment").Return(pluginEnv, nil) diff --git a/server/platform/services/tracing/tracing.go b/server/platform/services/tracing/tracing.go index dd0563e231..f65c5d43f5 100644 --- a/server/platform/services/tracing/tracing.go +++ b/server/platform/services/tracing/tracing.go @@ -14,7 +14,7 @@ import ( "github.com/uber/jaeger-client-go/zipkin" "github.com/uber/jaeger-lib/metrics" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) // Tracer is a wrapper around Jaeger OpenTracing client, used to properly de-initialize jaeger on exit diff --git a/server/platform/services/upgrader/upgrader_linux.go b/server/platform/services/upgrader/upgrader_linux.go index db4f726722..df51c6321c 100644 --- a/server/platform/services/upgrader/upgrader_linux.go +++ b/server/platform/services/upgrader/upgrader_linux.go @@ -24,8 +24,8 @@ import ( "github.com/pkg/errors" "golang.org/x/crypto/openpgp" //nolint:staticcheck - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) //go:embed pubkey.gpg diff --git a/server/platform/services/upgrader/upgrader_linux_test.go b/server/platform/services/upgrader/upgrader_linux_test.go index 73853b3281..49b5d48365 100644 --- a/server/platform/services/upgrader/upgrader_linux_test.go +++ b/server/platform/services/upgrader/upgrader_linux_test.go @@ -12,7 +12,7 @@ import ( "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestCanIUpgradeToE0(t *testing.T) { diff --git a/server/platform/shared/driver/conn.go b/server/platform/shared/driver/conn.go index 6acf8e8762..2a567c19db 100644 --- a/server/platform/shared/driver/conn.go +++ b/server/platform/shared/driver/conn.go @@ -7,7 +7,7 @@ import ( "context" "database/sql/driver" - "github.com/mattermost/mattermost-server/v6/plugin" + "github.com/mattermost/mattermost-server/server/v8/plugin" ) // Conn is a DB driver conn implementation diff --git a/server/platform/shared/driver/driver.go b/server/platform/shared/driver/driver.go index 2f6f6c3b7a..a76903ba22 100644 --- a/server/platform/shared/driver/driver.go +++ b/server/platform/shared/driver/driver.go @@ -12,7 +12,7 @@ import ( "context" "database/sql/driver" - "github.com/mattermost/mattermost-server/v6/plugin" + "github.com/mattermost/mattermost-server/server/v8/plugin" ) var ( diff --git a/server/platform/shared/driver/objects.go b/server/platform/shared/driver/objects.go index ff28cb2ed5..c07c8f7ad6 100644 --- a/server/platform/shared/driver/objects.go +++ b/server/platform/shared/driver/objects.go @@ -7,7 +7,7 @@ import ( "context" "database/sql/driver" - "github.com/mattermost/mattermost-server/v6/plugin" + "github.com/mattermost/mattermost-server/server/v8/plugin" ) type wrapperTx struct { diff --git a/server/platform/shared/filestore/filesstore_test.go b/server/platform/shared/filestore/filesstore_test.go index b14bdb8e03..0c2358e1bf 100644 --- a/server/platform/shared/filestore/filesstore_test.go +++ b/server/platform/shared/filestore/filesstore_test.go @@ -18,7 +18,7 @@ import ( "github.com/stretchr/testify/suite" "github.com/xtgo/uuid" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) func randomString() string { diff --git a/server/platform/shared/filestore/localstore.go b/server/platform/shared/filestore/localstore.go index 68ea9ad66e..7c607bdab3 100644 --- a/server/platform/shared/filestore/localstore.go +++ b/server/platform/shared/filestore/localstore.go @@ -12,7 +12,7 @@ import ( "github.com/pkg/errors" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) const ( diff --git a/server/platform/shared/filestore/mocks/FileBackend.go b/server/platform/shared/filestore/mocks/FileBackend.go index aecaee75fc..a12156a569 100644 --- a/server/platform/shared/filestore/mocks/FileBackend.go +++ b/server/platform/shared/filestore/mocks/FileBackend.go @@ -7,7 +7,7 @@ package mocks import ( io "io" - filestore "github.com/mattermost/mattermost-server/v6/server/platform/shared/filestore" + filestore "github.com/mattermost/mattermost-server/server/v8/platform/shared/filestore" mock "github.com/stretchr/testify/mock" diff --git a/server/platform/shared/filestore/s3store.go b/server/platform/shared/filestore/s3store.go index 4986f28ce8..9d2eacfffa 100644 --- a/server/platform/shared/filestore/s3store.go +++ b/server/platform/shared/filestore/s3store.go @@ -19,7 +19,7 @@ import ( "github.com/minio/minio-go/v7/pkg/encrypt" "github.com/pkg/errors" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) // S3FileBackend contains all necessary information to communicate with diff --git a/server/platform/shared/i18n/i18n.go b/server/platform/shared/i18n/i18n.go index 00cdc1a704..605f0a13d4 100644 --- a/server/platform/shared/i18n/i18n.go +++ b/server/platform/shared/i18n/i18n.go @@ -15,7 +15,7 @@ import ( "github.com/mattermost/go-i18n/i18n" "github.com/mattermost/go-i18n/i18n/bundle" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) const defaultLocale = "en" diff --git a/server/platform/shared/mail/mail.go b/server/platform/shared/mail/mail.go index 2b8e97aea3..02944684e4 100644 --- a/server/platform/shared/mail/mail.go +++ b/server/platform/shared/mail/mail.go @@ -18,8 +18,8 @@ import ( "github.com/pkg/errors" gomail "gopkg.in/mail.v2" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) const ( diff --git a/server/platform/shared/markdown/inlines.go b/server/platform/shared/markdown/inlines.go index 43dee3bd32..973ae5ed21 100644 --- a/server/platform/shared/markdown/inlines.go +++ b/server/platform/shared/markdown/inlines.go @@ -628,7 +628,7 @@ func MergeInlineText(inlines []Inline) []Inline { } func Unescape(markdown string) string { - ret := "" + var ret strings.Builder position := 0 for position < len(markdown) { @@ -637,27 +637,27 @@ func Unescape(markdown string) string { switch c { case '\\': if position+1 < len(markdown) && isEscapableByte(markdown[position+1]) { - ret += string(markdown[position+1]) + ret.WriteByte(markdown[position+1]) position += 2 } else { - ret += `\` + ret.WriteString(`\`) position++ } case '&': position++ if semicolon := strings.IndexByte(markdown[position:], ';'); semicolon == -1 { - ret += "&" + ret.WriteString("&") } else if s := CharacterReference(markdown[position : position+semicolon]); s != "" { position += semicolon + 1 - ret += s + ret.WriteString(s) } else { - ret += "&" + ret.WriteString("&") } default: - ret += string(c) + ret.WriteRune(c) position += cSize } } - return ret + return ret.String() } diff --git a/server/platform/shared/markdown/inspect.go b/server/platform/shared/markdown/inspect.go index 2c14412949..b3b5ead33d 100644 --- a/server/platform/shared/markdown/inspect.go +++ b/server/platform/shared/markdown/inspect.go @@ -26,53 +26,89 @@ func Inspect(markdown string, f func(any) bool) { // InspectBlock traverses the blocks in depth-first order, starting with block. If f returns true, // InspectBlock invokes f recursively for each child of the block, followed by a call of f(nil). func InspectBlock(block Block, f func(Block) bool) { - if !f(block) { - return - } - switch v := block.(type) { - case *Document: - for _, child := range v.Children { - InspectBlock(child, f) + stack := []Block{block} + // Using seen for backtracking + seen := map[Block]bool{} + + for len(stack) > 0 { + // "peek" the node from the stack + block := stack[len(stack)-1] + + if seen[block] { + // "pop" the node only when backtracking(seen) + stack = stack[:len(stack)-1] + f(nil) + continue } - case *List: - for _, child := range v.Children { - InspectBlock(child, f) + seen[block] = true + + // Process the node + if !f(block) { + continue } - case *ListItem: - for _, child := range v.Children { - InspectBlock(child, f) - } - case *BlockQuote: - for _, child := range v.Children { - InspectBlock(child, f) + + switch v := block.(type) { + case *Document: + for i := len(v.Children) - 1; i >= 0; i-- { + stack = append(stack, v.Children[i]) + } + case *List: + for i := len(v.Children) - 1; i >= 0; i-- { + stack = append(stack, v.Children[i]) + } + case *ListItem: + for i := len(v.Children) - 1; i >= 0; i-- { + stack = append(stack, v.Children[i]) + } + case *BlockQuote: + for i := len(v.Children) - 1; i >= 0; i-- { + stack = append(stack, v.Children[i]) + } } } - f(nil) } // InspectInline traverses the blocks in depth-first order, starting with block. If f returns true, // InspectInline invokes f recursively for each child of the block, followed by a call of f(nil). func InspectInline(inline Inline, f func(Inline) bool) { - if !f(inline) { - return - } - switch v := inline.(type) { - case *InlineImage: - for _, child := range v.Children { - InspectInline(child, f) + stack := []Inline{inline} + // Using seen for backtracking + seen := map[Inline]bool{} + + for len(stack) > 0 { + // "peek" the node from the stack + inline := stack[len(stack)-1] + + if seen[inline] { + // "pop" the node only when backtracking(seen) + stack = stack[:len(stack)-1] + f(nil) + continue } - case *InlineLink: - for _, child := range v.Children { - InspectInline(child, f) + seen[inline] = true + + // Process the node + if !f(inline) { + continue } - case *ReferenceImage: - for _, child := range v.Children { - InspectInline(child, f) - } - case *ReferenceLink: - for _, child := range v.Children { - InspectInline(child, f) + + switch v := inline.(type) { + case *InlineImage: + for i := len(v.Children) - 1; i >= 0; i-- { + stack = append(stack, v.Children[i]) + } + case *InlineLink: + for i := len(v.Children) - 1; i >= 0; i-- { + stack = append(stack, v.Children[i]) + } + case *ReferenceImage: + for i := len(v.Children) - 1; i >= 0; i-- { + stack = append(stack, v.Children[i]) + } + case *ReferenceLink: + for i := len(v.Children) - 1; i >= 0; i-- { + stack = append(stack, v.Children[i]) + } } } - f(nil) } diff --git a/server/platform/shared/mfa/mfa_test.go b/server/platform/shared/mfa/mfa_test.go index bb820cfda4..e90c370569 100644 --- a/server/platform/shared/mfa/mfa_test.go +++ b/server/platform/shared/mfa/mfa_test.go @@ -15,8 +15,8 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/plugin/plugintest/mock" - "github.com/mattermost/mattermost-server/v6/server/channels/store/storetest/mocks" + "github.com/mattermost/mattermost-server/server/v8/channels/store/storetest/mocks" + "github.com/mattermost/mattermost-server/server/v8/plugin/plugintest/mock" ) func TestGenerateSecret(t *testing.T) { diff --git a/server/platform/shared/mlog/global_test.go b/server/platform/shared/mlog/global_test.go index 2383478aa6..8c661d7e77 100644 --- a/server/platform/shared/mlog/global_test.go +++ b/server/platform/shared/mlog/global_test.go @@ -14,7 +14,7 @@ import ( "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) func TestLoggingBeforeInitialized(t *testing.T) { diff --git a/server/platform/shared/templates/templates.go b/server/platform/shared/templates/templates.go index 4bb8840f48..392c3f3dc4 100644 --- a/server/platform/shared/templates/templates.go +++ b/server/platform/shared/templates/templates.go @@ -13,7 +13,7 @@ import ( "github.com/fsnotify/fsnotify" - "github.com/mattermost/mattermost-server/v6/server/channels/utils/fileutils" + "github.com/mattermost/mattermost-server/server/v8/channels/utils/fileutils" ) // Container represents a set of templates that can be render diff --git a/server/playbooks/client/client.go b/server/playbooks/client/client.go index b9c0ed970d..e095c13323 100644 --- a/server/playbooks/client/client.go +++ b/server/playbooks/client/client.go @@ -16,7 +16,7 @@ import ( "strconv" "github.com/google/go-querystring/query" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" "github.com/pkg/errors" "golang.org/x/oauth2" ) diff --git a/server/playbooks/client/doc_test.go b/server/playbooks/client/doc_test.go index 059fcc1dc2..ab876bbebd 100644 --- a/server/playbooks/client/doc_test.go +++ b/server/playbooks/client/doc_test.go @@ -8,8 +8,8 @@ import ( "fmt" "log" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/playbooks/client" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/playbooks/client" ) func Example() { diff --git a/server/playbooks/client/playbook_runs_test.go b/server/playbooks/client/playbook_runs_test.go index 125b2fdef4..8f3489c866 100644 --- a/server/playbooks/client/playbook_runs_test.go +++ b/server/playbooks/client/playbook_runs_test.go @@ -8,8 +8,8 @@ import ( "fmt" "log" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/playbooks/client" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/playbooks/client" ) func ExamplePlaybookRunService_Get() { diff --git a/server/playbooks/client/playbooks_test.go b/server/playbooks/client/playbooks_test.go index 4b39f44dae..863b2ff652 100644 --- a/server/playbooks/client/playbooks_test.go +++ b/server/playbooks/client/playbooks_test.go @@ -8,8 +8,8 @@ import ( "fmt" "log" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/playbooks/client" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/playbooks/client" ) func ExamplePlaybooksService_Get() { diff --git a/server/playbooks/product/api_adapter.go b/server/playbooks/product/api_adapter.go index 7f073f3958..7a91df438e 100644 --- a/server/playbooks/product/api_adapter.go +++ b/server/playbooks/product/api_adapter.go @@ -14,12 +14,12 @@ import ( "github.com/pkg/errors" "github.com/sirupsen/logrus" - "github.com/mattermost/mattermost-server/v6/model" - mm_model "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/app/request" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/i18n" - "github.com/mattermost/mattermost-server/v6/server/playbooks/server/app" - "github.com/mattermost/mattermost-server/v6/server/playbooks/server/playbooks" + "github.com/mattermost/mattermost-server/server/v8/channels/app/request" + "github.com/mattermost/mattermost-server/server/v8/model" + mm_model "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/i18n" + "github.com/mattermost/mattermost-server/server/v8/playbooks/server/app" + "github.com/mattermost/mattermost-server/server/v8/playbooks/server/playbooks" ) // normalizeAppError returns a truly nil error if appErr is nil diff --git a/server/playbooks/product/imports/playbooks_imports.go b/server/playbooks/product/imports/playbooks_imports.go index a8c3935ec1..4e8a5aeaa5 100644 --- a/server/playbooks/product/imports/playbooks_imports.go +++ b/server/playbooks/product/imports/playbooks_imports.go @@ -6,5 +6,5 @@ package imports import ( // Needed to ensure the init() method in the Playbooks product is run. // This file is copied to the mmserver imports package via makefile. - _ "github.com/mattermost/mattermost-server/v6/server/playbooks/product" + _ "github.com/mattermost/mattermost-server/server/v8/playbooks/product" ) diff --git a/server/playbooks/product/logrus.go b/server/playbooks/product/logrus.go index a6b23d94e3..0090d979c2 100644 --- a/server/playbooks/product/logrus.go +++ b/server/playbooks/product/logrus.go @@ -8,7 +8,7 @@ import ( "io" "github.com/mattermost/logr/v2" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" "github.com/sirupsen/logrus" ) diff --git a/server/playbooks/product/playbooks_product.go b/server/playbooks/product/playbooks_product.go index 9769c2d470..96ee88333a 100644 --- a/server/playbooks/product/playbooks_product.go +++ b/server/playbooks/product/playbooks_product.go @@ -10,23 +10,23 @@ import ( "strings" "time" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/plugin" - mmapp "github.com/mattermost/mattermost-server/v6/server/channels/app" - "github.com/mattermost/mattermost-server/v6/server/channels/product" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" - "github.com/mattermost/mattermost-server/v6/server/playbooks/product/pluginapi/cluster" - "github.com/mattermost/mattermost-server/v6/server/playbooks/server/api" - "github.com/mattermost/mattermost-server/v6/server/playbooks/server/app" - "github.com/mattermost/mattermost-server/v6/server/playbooks/server/bot" - "github.com/mattermost/mattermost-server/v6/server/playbooks/server/command" - "github.com/mattermost/mattermost-server/v6/server/playbooks/server/config" - "github.com/mattermost/mattermost-server/v6/server/playbooks/server/enterprise" - "github.com/mattermost/mattermost-server/v6/server/playbooks/server/metrics" - "github.com/mattermost/mattermost-server/v6/server/playbooks/server/playbooks" - "github.com/mattermost/mattermost-server/v6/server/playbooks/server/scheduler" - "github.com/mattermost/mattermost-server/v6/server/playbooks/server/sqlstore" - "github.com/mattermost/mattermost-server/v6/server/playbooks/server/telemetry" + mmapp "github.com/mattermost/mattermost-server/server/v8/channels/app" + "github.com/mattermost/mattermost-server/server/v8/channels/product" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/playbooks/product/pluginapi/cluster" + "github.com/mattermost/mattermost-server/server/v8/playbooks/server/api" + "github.com/mattermost/mattermost-server/server/v8/playbooks/server/app" + "github.com/mattermost/mattermost-server/server/v8/playbooks/server/bot" + "github.com/mattermost/mattermost-server/server/v8/playbooks/server/command" + "github.com/mattermost/mattermost-server/server/v8/playbooks/server/config" + "github.com/mattermost/mattermost-server/server/v8/playbooks/server/enterprise" + "github.com/mattermost/mattermost-server/server/v8/playbooks/server/metrics" + "github.com/mattermost/mattermost-server/server/v8/playbooks/server/playbooks" + "github.com/mattermost/mattermost-server/server/v8/playbooks/server/scheduler" + "github.com/mattermost/mattermost-server/server/v8/playbooks/server/sqlstore" + "github.com/mattermost/mattermost-server/server/v8/playbooks/server/telemetry" + "github.com/mattermost/mattermost-server/server/v8/plugin" "github.com/pkg/errors" "github.com/sirupsen/logrus" ) diff --git a/server/playbooks/product/pluginapi/cluster/job.go b/server/playbooks/product/pluginapi/cluster/job.go index bb71d34779..96c8385a79 100644 --- a/server/playbooks/product/pluginapi/cluster/job.go +++ b/server/playbooks/product/pluginapi/cluster/job.go @@ -8,7 +8,7 @@ import ( "sync" "time" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" "github.com/pkg/errors" "github.com/sirupsen/logrus" ) diff --git a/server/playbooks/product/pluginapi/cluster/job_once.go b/server/playbooks/product/pluginapi/cluster/job_once.go index 855a412006..2599962546 100644 --- a/server/playbooks/product/pluginapi/cluster/job_once.go +++ b/server/playbooks/product/pluginapi/cluster/job_once.go @@ -9,7 +9,7 @@ import ( "sync" "time" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" "github.com/pkg/errors" ) diff --git a/server/playbooks/product/pluginapi/cluster/mutex.go b/server/playbooks/product/pluginapi/cluster/mutex.go index a32e299ebe..1f95ff3d4e 100644 --- a/server/playbooks/product/pluginapi/cluster/mutex.go +++ b/server/playbooks/product/pluginapi/cluster/mutex.go @@ -8,7 +8,7 @@ import ( "sync" "time" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" "github.com/pkg/errors" "github.com/sirupsen/logrus" ) diff --git a/server/playbooks/product/pluginapi/license.go b/server/playbooks/product/pluginapi/license.go index d12a0fecfb..cac67f4da3 100644 --- a/server/playbooks/product/pluginapi/license.go +++ b/server/playbooks/product/pluginapi/license.go @@ -4,7 +4,7 @@ package pluginapi import ( - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) const ( diff --git a/server/playbooks/server/api/actions.go b/server/playbooks/server/api/actions.go index b35aa90cc4..6047ecff62 100644 --- a/server/playbooks/server/api/actions.go +++ b/server/playbooks/server/api/actions.go @@ -9,8 +9,8 @@ import ( "net/http" "net/url" - "github.com/mattermost/mattermost-server/v6/server/playbooks/server/app" - "github.com/mattermost/mattermost-server/v6/server/playbooks/server/playbooks" + "github.com/mattermost/mattermost-server/server/v8/playbooks/server/app" + "github.com/mattermost/mattermost-server/server/v8/playbooks/server/playbooks" "github.com/pkg/errors" "github.com/gorilla/mux" diff --git a/server/playbooks/server/api/api.go b/server/playbooks/server/api/api.go index 7c348c21dc..dc36fd606d 100644 --- a/server/playbooks/server/api/api.go +++ b/server/playbooks/server/api/api.go @@ -10,7 +10,7 @@ import ( "github.com/sirupsen/logrus" "github.com/gorilla/mux" - "github.com/mattermost/mattermost-server/v6/server/playbooks/server/config" + "github.com/mattermost/mattermost-server/server/v8/playbooks/server/config" ) // MaxRequestSize is the size limit for any incoming request diff --git a/server/playbooks/server/api/api.yaml b/server/playbooks/server/api/api.yaml index 69e74a44c7..bed383530c 100644 --- a/server/playbooks/server/api/api.yaml +++ b/server/playbooks/server/api/api.yaml @@ -10,7 +10,7 @@ info: servers: - url: http://localhost:8065/plugins/playbooks/api/v0 paths: - /runs: + /plugins/playbooks/api/v0/runs: get: summary: List all playbook runs description: Retrieve a paged list of playbook runs, filtered by team, status, owner, name and/or members, and sorted by ID, name, status, creation date, end date, team or owner ID. @@ -198,7 +198,7 @@ paths: 500: $ref: "#/components/responses/500" - /runs/dialog: + /plugins/playbooks/api/v0/runs/dialog: post: summary: Create a new playbook run from dialog description: This is an internal endpoint to create a playbook run from the submission of an interactive dialog, filled by a user in the webapp. See [Interactive Dialogs](https://docs.mattermost.com/developer/interactive-dialogs.html) for more information. @@ -276,7 +276,7 @@ paths: 500: $ref: "#/components/responses/500" - /runs/owners: + /plugins/playbooks/api/v0/runs/owners: get: summary: Get all owners description: Get the owners of all playbook runs, filtered by team. @@ -314,7 +314,7 @@ paths: 500: $ref: "#/components/responses/500" - /runs/channels: + /plugins/playbooks/api/v0/runs/channels: get: summary: Get playbook run channels description: Get all channels associated with a playbook run, filtered by team, status, owner, name and/or members, and sorted by ID, name, status, creation date, end date, team, or owner ID. @@ -413,7 +413,7 @@ paths: 500: $ref: "#/components/responses/500" - /runs/checklist-autocomplete: + /plugins/playbooks/api/v0/runs/checklist-autocomplete: get: summary: Get autocomplete data for /playbook check description: This is an internal endpoint used by the autocomplete system to retrieve the data needed to show the list of items that the user can check. @@ -459,7 +459,7 @@ paths: 500: $ref: "#/components/responses/500" - /runs/channel/{channel_id}: + /plugins/playbooks/api/v0/runs/channel/{channel_id}: get: summary: Find playbook run by channel ID operationId: getPlaybookRunByChannelId @@ -492,7 +492,7 @@ paths: 500: $ref: "#/components/responses/500" - /runs/{id}: + /plugins/playbooks/api/v0/runs/{id}: get: summary: Get a playbook run operationId: getPlaybookRun @@ -565,7 +565,7 @@ paths: 500: $ref: "#/components/responses/500" - /runs/{id}/metadata: + /plugins/playbooks/api/v0/runs/{id}/metadata: get: summary: Get playbook run metadata operationId: getPlaybookRunMetadata @@ -598,7 +598,7 @@ paths: 500: $ref: "#/components/responses/500" - /runs/{id}/end: + /plugins/playbooks/api/v0/runs/{id}/end: put: summary: End a playbook run operationId: endPlaybookRun @@ -651,7 +651,7 @@ paths: 500: $ref: "#/components/responses/500" - /runs/{id}/restart: + /plugins/playbooks/api/v0/runs/{id}/restart: put: summary: Restart a playbook run operationId: restartPlaybookRun @@ -678,7 +678,7 @@ paths: 500: $ref: "#/components/responses/500" - /runs/{id}/status: + /plugins/playbooks/api/v0/runs/{id}/status: post: summary: Update a playbook run's status operationId: status @@ -728,7 +728,7 @@ paths: 500: $ref: "#/components/responses/500" - /runs/{id}/finish: + /plugins/playbooks/api/v0/runs/{id}/finish: put: summary: Finish a playbook operationId: finish @@ -755,7 +755,7 @@ paths: 500: $ref: "#/components/responses/500" - /runs/{id}/owner: + /plugins/playbooks/api/v0/runs/{id}/owner: post: summary: Update playbook run owner operationId: changeOwner @@ -800,7 +800,7 @@ paths: 500: $ref: "#/components/responses/500" - /runs/{id}/next-stage-dialog: + /plugins/playbooks/api/v0/runs/{id}/next-stage-dialog: post: summary: Go to next stage from dialog description: This is an internal endpoint to go to the next stage via a confirmation dialog, submitted by a user in the webapp. @@ -835,7 +835,7 @@ paths: 500: $ref: "#/components/responses/500" - /runs/{id}/checklists/{checklist}/add: + /plugins/playbooks/api/v0/runs/{id}/checklists/{checklist}/add: put: summary: Add an item to a playbook run's checklist description: The most common pattern to add a new item is to only send its title as the request payload. By default, it is an open item, with no assignee and no slash command. @@ -923,7 +923,7 @@ paths: schema: $ref: "#/components/schemas/Error" - /runs/{id}/checklists/{checklist}/reorder: + /plugins/playbooks/api/v0/runs/{id}/checklists/{checklist}/reorder: put: summary: Reorder an item in a playbook run's checklist operationId: reoderChecklistItem @@ -978,7 +978,7 @@ paths: 500: $ref: "#/components/responses/500" - /runs/{id}/checklists/{checklist}/item/{item}: + /plugins/playbooks/api/v0/runs/{id}/checklists/{checklist}/item/{item}: put: summary: Update an item of a playbook run's checklist description: Update the title and the slash command of an item in one of the playbook run's checklists. @@ -1083,7 +1083,7 @@ paths: 500: $ref: "#/components/responses/500" - /runs/{id}/checklists/{checklist}/item/{item}/state: + /plugins/playbooks/api/v0/runs/{id}/checklists/{checklist}/item/{item}/state: put: summary: Update the state of an item operationId: itemSetState @@ -1145,7 +1145,7 @@ paths: 500: $ref: "#/components/responses/500" - /runs/{id}/checklists/{checklist}/item/{item}/assignee: + /plugins/playbooks/api/v0/runs/{id}/checklists/{checklist}/item/{item}/assignee: put: summary: Update the assignee of an item operationId: itemSetAssignee @@ -1202,7 +1202,7 @@ paths: 500: $ref: "#/components/responses/500" - /runs/{id}/checklists/{checklist}/item/{item}/run: + /plugins/playbooks/api/v0/runs/{id}/checklists/{checklist}/item/{item}/run: put: summary: Run an item's slash command operationId: itemRun @@ -1249,7 +1249,7 @@ paths: 500: $ref: "#/components/responses/500" - /runs/{id}/timeline/{event_id}/: + /plugins/playbooks/api/v0/runs/{id}/timeline/{event_id}/: delete: summary: Remove a timeline event from the playbook run operationId: removeTimelineEvent @@ -1285,7 +1285,7 @@ paths: 500: $ref: "#/components/responses/500" - /playbooks: + /plugins/playbooks/api/v0/playbooks: get: summary: List all playbooks description: Retrieve a paged list of playbooks, filtered by team, and sorted by title, number of stages or number of steps. @@ -1405,6 +1405,10 @@ paths: type: boolean description: A boolean indicating whether the playbook runs created from this playbook should be public or private. example: true + public: + type: boolean + description: A boolean indicating whether the playbook is licensed as public or private. Required 'true' for free tier. + example: true checklists: type: array description: The stages defined by this playbook. @@ -1558,7 +1562,7 @@ paths: 500: $ref: "#/components/responses/500" - /playbooks/{id}: + /plugins/playbooks/api/v0/playbooks/{id}: get: summary: Get a playbook operationId: getPlaybook @@ -1654,7 +1658,7 @@ paths: 500: $ref: "#/components/responses/500" - /playbooks/{id}/autofollows: + /plugins/playbooks/api/v0/playbooks/{id}/autofollows: get: summary: Get the list of followers' user IDs of a playbook operationId: getAutoFollows diff --git a/server/playbooks/server/api/bot.go b/server/playbooks/server/api/bot.go index 331fcd960a..8bc80a9ec2 100644 --- a/server/playbooks/server/api/bot.go +++ b/server/playbooks/server/api/bot.go @@ -13,11 +13,11 @@ import ( "github.com/sirupsen/logrus" "github.com/gorilla/mux" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/playbooks/server/app" - "github.com/mattermost/mattermost-server/v6/server/playbooks/server/bot" - "github.com/mattermost/mattermost-server/v6/server/playbooks/server/config" - "github.com/mattermost/mattermost-server/v6/server/playbooks/server/playbooks" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/playbooks/server/app" + "github.com/mattermost/mattermost-server/server/v8/playbooks/server/bot" + "github.com/mattermost/mattermost-server/server/v8/playbooks/server/config" + "github.com/mattermost/mattermost-server/server/v8/playbooks/server/playbooks" ) type BotHandler struct { diff --git a/server/playbooks/server/api/categories.go b/server/playbooks/server/api/categories.go index 8bfef8cfc8..cb2a205c62 100644 --- a/server/playbooks/server/api/categories.go +++ b/server/playbooks/server/api/categories.go @@ -9,9 +9,9 @@ import ( "net/http" "github.com/gorilla/mux" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/playbooks/server/app" - "github.com/mattermost/mattermost-server/v6/server/playbooks/server/playbooks" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/playbooks/server/app" + "github.com/mattermost/mattermost-server/server/v8/playbooks/server/playbooks" "github.com/pkg/errors" ) diff --git a/server/playbooks/server/api/graphql.go b/server/playbooks/server/api/graphql.go index 6507532948..d12211bdd0 100644 --- a/server/playbooks/server/api/graphql.go +++ b/server/playbooks/server/api/graphql.go @@ -12,9 +12,9 @@ import ( "github.com/gorilla/mux" "github.com/graph-gophers/dataloader/v7" graphql "github.com/graph-gophers/graphql-go" - "github.com/mattermost/mattermost-server/v6/server/playbooks/server/app" - "github.com/mattermost/mattermost-server/v6/server/playbooks/server/config" - "github.com/mattermost/mattermost-server/v6/server/playbooks/server/playbooks" + "github.com/mattermost/mattermost-server/server/v8/playbooks/server/app" + "github.com/mattermost/mattermost-server/server/v8/playbooks/server/config" + "github.com/mattermost/mattermost-server/server/v8/playbooks/server/playbooks" "github.com/pkg/errors" "github.com/sirupsen/logrus" ) diff --git a/server/playbooks/server/api/graphql_loader_favorite.go b/server/playbooks/server/api/graphql_loader_favorite.go index 15aaf88c56..325513f521 100644 --- a/server/playbooks/server/api/graphql_loader_favorite.go +++ b/server/playbooks/server/api/graphql_loader_favorite.go @@ -7,7 +7,7 @@ import ( "context" "github.com/graph-gophers/dataloader/v7" - "github.com/mattermost/mattermost-server/v6/server/playbooks/server/app" + "github.com/mattermost/mattermost-server/server/v8/playbooks/server/app" ) type favoriteInfo struct { diff --git a/server/playbooks/server/api/graphql_loader_playbook.go b/server/playbooks/server/api/graphql_loader_playbook.go index 934ec04cd2..95032810c9 100644 --- a/server/playbooks/server/api/graphql_loader_playbook.go +++ b/server/playbooks/server/api/graphql_loader_playbook.go @@ -7,7 +7,7 @@ import ( "context" "github.com/graph-gophers/dataloader/v7" - "github.com/mattermost/mattermost-server/v6/server/playbooks/server/app" + "github.com/mattermost/mattermost-server/server/v8/playbooks/server/app" ) type playbookInfo struct { diff --git a/server/playbooks/server/api/graphql_playbook.go b/server/playbooks/server/api/graphql_playbook.go index 40c0251ebc..128dbb5162 100644 --- a/server/playbooks/server/api/graphql_playbook.go +++ b/server/playbooks/server/api/graphql_playbook.go @@ -7,7 +7,7 @@ import ( "context" "fmt" - "github.com/mattermost/mattermost-server/v6/server/playbooks/server/app" + "github.com/mattermost/mattermost-server/server/v8/playbooks/server/app" "github.com/sirupsen/logrus" ) diff --git a/server/playbooks/server/api/graphql_root_playbook.go b/server/playbooks/server/api/graphql_root_playbook.go index 987ead79fa..7933bde0f3 100644 --- a/server/playbooks/server/api/graphql_root_playbook.go +++ b/server/playbooks/server/api/graphql_root_playbook.go @@ -7,8 +7,8 @@ import ( "context" "encoding/json" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/playbooks/server/app" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/playbooks/server/app" "github.com/pkg/errors" "gopkg.in/guregu/null.v4" ) diff --git a/server/playbooks/server/api/graphql_root_run.go b/server/playbooks/server/api/graphql_root_run.go index 9699cd2b82..a8c9274511 100644 --- a/server/playbooks/server/api/graphql_root_run.go +++ b/server/playbooks/server/api/graphql_root_run.go @@ -6,9 +6,9 @@ package api import ( "context" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/playbooks/client" - "github.com/mattermost/mattermost-server/v6/server/playbooks/server/app" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/playbooks/client" + "github.com/mattermost/mattermost-server/server/v8/playbooks/server/app" "github.com/pkg/errors" ) diff --git a/server/playbooks/server/api/graphql_run.go b/server/playbooks/server/api/graphql_run.go index 0bc6ddc70d..9f8e235635 100644 --- a/server/playbooks/server/api/graphql_run.go +++ b/server/playbooks/server/api/graphql_run.go @@ -7,7 +7,7 @@ import ( "context" "strconv" - "github.com/mattermost/mattermost-server/v6/server/playbooks/server/app" + "github.com/mattermost/mattermost-server/server/v8/playbooks/server/app" "github.com/pkg/errors" ) diff --git a/server/playbooks/server/api/logger.go b/server/playbooks/server/api/logger.go index 759368f449..bdccd4958a 100644 --- a/server/playbooks/server/api/logger.go +++ b/server/playbooks/server/api/logger.go @@ -8,7 +8,7 @@ import ( "net/http" "time" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" "github.com/sirupsen/logrus" ) diff --git a/server/playbooks/server/api/playbook_runs.go b/server/playbooks/server/api/playbook_runs.go index b78086f2e0..bd688c76ac 100644 --- a/server/playbooks/server/api/playbook_runs.go +++ b/server/playbooks/server/api/playbook_runs.go @@ -14,14 +14,14 @@ import ( "time" "github.com/gorilla/mux" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/playbooks/client" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/playbooks/client" "github.com/pkg/errors" - "github.com/mattermost/mattermost-server/v6/server/playbooks/server/app" - "github.com/mattermost/mattermost-server/v6/server/playbooks/server/bot" - "github.com/mattermost/mattermost-server/v6/server/playbooks/server/config" - "github.com/mattermost/mattermost-server/v6/server/playbooks/server/playbooks" + "github.com/mattermost/mattermost-server/server/v8/playbooks/server/app" + "github.com/mattermost/mattermost-server/server/v8/playbooks/server/bot" + "github.com/mattermost/mattermost-server/server/v8/playbooks/server/config" + "github.com/mattermost/mattermost-server/server/v8/playbooks/server/playbooks" ) // PlaybookRunHandler is the API handler. diff --git a/server/playbooks/server/api/playbooks.go b/server/playbooks/server/api/playbooks.go index 2806a0f96d..6a87d5a74c 100644 --- a/server/playbooks/server/api/playbooks.go +++ b/server/playbooks/server/api/playbooks.go @@ -10,14 +10,12 @@ import ( "net/url" "strconv" "strings" - "time" "github.com/gorilla/mux" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/playbooks/server/app" - "github.com/mattermost/mattermost-server/v6/server/playbooks/server/config" - "github.com/mattermost/mattermost-server/v6/server/playbooks/server/playbooks" - "github.com/mattermost/mattermost-server/v6/server/playbooks/server/timeutils" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/playbooks/server/app" + "github.com/mattermost/mattermost-server/server/v8/playbooks/server/config" + "github.com/mattermost/mattermost-server/server/v8/playbooks/server/playbooks" "github.com/pkg/errors" "github.com/sirupsen/logrus" ) @@ -693,14 +691,8 @@ func (h *PlaybookHandler) getTopPlaybooksForUser(c *Context, w http.ResponseWrit h.HandleErrorWithCode(w, c.logger, http.StatusBadRequest, "unable to get user", err) return } - timezone, err := timeutils.GetUserTimezone(user) - if err != nil { - h.HandleErrorWithCode(w, c.logger, http.StatusBadRequest, "unable to get user timezone", err) - return - } - if timezone == nil { - timezone = time.Now().UTC().Location() - } + timezone := user.GetTimezoneLocation() + // get unix time for duration startTime, appErr := model.GetStartOfDayForTimeRange(timeRange, timezone) if appErr != nil { @@ -750,14 +742,8 @@ func (h *PlaybookHandler) getTopPlaybooksForTeam(c *Context, w http.ResponseWrit h.HandleErrorWithCode(w, c.logger, http.StatusBadRequest, "unable to get user", err) return } - timezone, err := timeutils.GetUserTimezone(user) - if err != nil { - h.HandleErrorWithCode(w, c.logger, http.StatusBadRequest, "unable to get user timezone", err) - return - } - if timezone == nil { - timezone = time.Now().UTC().Location() - } + timezone := user.GetTimezoneLocation() + // get unix time for duration startTime, appErr := model.GetStartOfDayForTimeRange(timeRange, timezone) if appErr != nil { diff --git a/server/playbooks/server/api/settings.go b/server/playbooks/server/api/settings.go index 242f8f4245..a9a33f389b 100644 --- a/server/playbooks/server/api/settings.go +++ b/server/playbooks/server/api/settings.go @@ -7,9 +7,9 @@ import ( "net/http" "github.com/gorilla/mux" - "github.com/mattermost/mattermost-server/v6/server/playbooks/client" - "github.com/mattermost/mattermost-server/v6/server/playbooks/server/config" - "github.com/mattermost/mattermost-server/v6/server/playbooks/server/playbooks" + "github.com/mattermost/mattermost-server/server/v8/playbooks/client" + "github.com/mattermost/mattermost-server/server/v8/playbooks/server/config" + "github.com/mattermost/mattermost-server/server/v8/playbooks/server/playbooks" ) // SettingsHandler is the API handler. diff --git a/server/playbooks/server/api/signal.go b/server/playbooks/server/api/signal.go index 94c9cf8a8f..f78a090e2e 100644 --- a/server/playbooks/server/api/signal.go +++ b/server/playbooks/server/api/signal.go @@ -9,9 +9,9 @@ import ( "net/http" "github.com/gorilla/mux" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/playbooks/server/app" - "github.com/mattermost/mattermost-server/v6/server/playbooks/server/playbooks" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/playbooks/server/app" + "github.com/mattermost/mattermost-server/server/v8/playbooks/server/playbooks" "github.com/pkg/errors" "github.com/sirupsen/logrus" ) diff --git a/server/playbooks/server/api/stats.go b/server/playbooks/server/api/stats.go index 05c666db3d..8c0c6acc07 100644 --- a/server/playbooks/server/api/stats.go +++ b/server/playbooks/server/api/stats.go @@ -8,13 +8,13 @@ import ( "net/http" "net/url" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/playbooks/server/app" - "github.com/mattermost/mattermost-server/v6/server/playbooks/server/playbooks" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/playbooks/server/app" + "github.com/mattermost/mattermost-server/server/v8/playbooks/server/playbooks" "gopkg.in/guregu/null.v4" "github.com/gorilla/mux" - "github.com/mattermost/mattermost-server/v6/server/playbooks/server/sqlstore" + "github.com/mattermost/mattermost-server/server/v8/playbooks/server/sqlstore" "github.com/pkg/errors" ) diff --git a/server/playbooks/server/api/telemetry.go b/server/playbooks/server/api/telemetry.go index da7921c216..c7e28db181 100644 --- a/server/playbooks/server/api/telemetry.go +++ b/server/playbooks/server/api/telemetry.go @@ -10,9 +10,9 @@ import ( "github.com/gorilla/mux" "github.com/pkg/errors" - "github.com/mattermost/mattermost-server/v6/server/playbooks/server/app" - "github.com/mattermost/mattermost-server/v6/server/playbooks/server/bot" - "github.com/mattermost/mattermost-server/v6/server/playbooks/server/playbooks" + "github.com/mattermost/mattermost-server/server/v8/playbooks/server/app" + "github.com/mattermost/mattermost-server/server/v8/playbooks/server/bot" + "github.com/mattermost/mattermost-server/server/v8/playbooks/server/playbooks" ) // TelemetryHandler is the API handler. diff --git a/server/playbooks/server/api/urls.go b/server/playbooks/server/api/urls.go index fdc0af5031..ae4ccce881 100644 --- a/server/playbooks/server/api/urls.go +++ b/server/playbooks/server/api/urls.go @@ -8,8 +8,8 @@ import ( "net/url" "path" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/playbooks/server/playbooks" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/playbooks/server/playbooks" "github.com/pkg/errors" "github.com/sirupsen/logrus" ) diff --git a/server/playbooks/server/api_actions_test.go b/server/playbooks/server/api_actions_test.go index 26ba51d31b..d91747a765 100644 --- a/server/playbooks/server/api_actions_test.go +++ b/server/playbooks/server/api_actions_test.go @@ -1,15 +1,15 @@ // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. -package main +package server import ( "context" "net/http" "testing" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/playbooks/client" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/playbooks/client" "github.com/mitchellh/mapstructure" "github.com/stretchr/testify/assert" ) diff --git a/server/playbooks/server/api_bot_test.go b/server/playbooks/server/api_bot_test.go index 4ab0bd0196..9dcc2baa45 100644 --- a/server/playbooks/server/api_bot_test.go +++ b/server/playbooks/server/api_bot_test.go @@ -1,14 +1,14 @@ // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. -package main +package server import ( "encoding/json" "net/http" "testing" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" "github.com/stretchr/testify/assert" ) diff --git a/server/playbooks/server/api_general_test.go b/server/playbooks/server/api_general_test.go index b3052eb649..5793427392 100644 --- a/server/playbooks/server/api_general_test.go +++ b/server/playbooks/server/api_general_test.go @@ -1,7 +1,7 @@ // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. -package main +package server import ( "net/http" diff --git a/server/playbooks/server/api_graphql_playbooks_test.go b/server/playbooks/server/api_graphql_playbooks_test.go index bcb78c08a3..66e67fecfe 100644 --- a/server/playbooks/server/api_graphql_playbooks_test.go +++ b/server/playbooks/server/api_graphql_playbooks_test.go @@ -1,7 +1,7 @@ // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. -package main +package server import ( "context" @@ -12,9 +12,9 @@ import ( "testing" "github.com/graph-gophers/graphql-go" - "github.com/mattermost/mattermost-server/v6/server/playbooks/client" - "github.com/mattermost/mattermost-server/v6/server/playbooks/server/api" - "github.com/mattermost/mattermost-server/v6/server/playbooks/server/app" + "github.com/mattermost/mattermost-server/server/v8/playbooks/client" + "github.com/mattermost/mattermost-server/server/v8/playbooks/server/api" + "github.com/mattermost/mattermost-server/server/v8/playbooks/server/app" "github.com/pkg/errors" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/server/playbooks/server/api_graphql_runs_test.go b/server/playbooks/server/api_graphql_runs_test.go index 7a97b3be53..953ea2caff 100644 --- a/server/playbooks/server/api_graphql_runs_test.go +++ b/server/playbooks/server/api_graphql_runs_test.go @@ -1,7 +1,7 @@ // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. -package main +package server import ( "context" @@ -11,10 +11,10 @@ import ( "testing" "github.com/graph-gophers/graphql-go" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/app/request" - "github.com/mattermost/mattermost-server/v6/server/playbooks/client" - "github.com/mattermost/mattermost-server/v6/server/playbooks/server/app" + "github.com/mattermost/mattermost-server/server/v8/channels/app/request" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/playbooks/client" + "github.com/mattermost/mattermost-server/server/v8/playbooks/server/app" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/server/playbooks/server/api_playbooks_test.go b/server/playbooks/server/api_playbooks_test.go index d1c9e8ebed..eedf819272 100644 --- a/server/playbooks/server/api_playbooks_test.go +++ b/server/playbooks/server/api_playbooks_test.go @@ -1,7 +1,7 @@ // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. -package main +package server import ( "context" @@ -13,9 +13,9 @@ import ( "strings" "testing" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/playbooks/client" - "github.com/mattermost/mattermost-server/v6/server/playbooks/server/app" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/playbooks/client" + "github.com/mattermost/mattermost-server/server/v8/playbooks/server/app" "github.com/pkg/errors" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/server/playbooks/server/api_runs_test.go b/server/playbooks/server/api_runs_test.go index 2cac09e2b3..575152b81d 100644 --- a/server/playbooks/server/api_runs_test.go +++ b/server/playbooks/server/api_runs_test.go @@ -1,7 +1,7 @@ // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. -package main +package server import ( "context" @@ -11,9 +11,9 @@ import ( "testing" "time" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/playbooks/client" - "github.com/mattermost/mattermost-server/v6/server/playbooks/server/app" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/playbooks/client" + "github.com/mattermost/mattermost-server/server/v8/playbooks/server/app" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/server/playbooks/server/api_settings_test.go b/server/playbooks/server/api_settings_test.go index 4ef06b42c4..0f2eb0dd5e 100644 --- a/server/playbooks/server/api_settings_test.go +++ b/server/playbooks/server/api_settings_test.go @@ -1,14 +1,14 @@ // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. -package main +package server import ( "context" "net/http" "testing" - "github.com/mattermost/mattermost-server/v6/server/playbooks/client" + "github.com/mattermost/mattermost-server/server/v8/playbooks/client" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/server/playbooks/server/api_stats_test.go b/server/playbooks/server/api_stats_test.go index a005ca7212..a705342e15 100644 --- a/server/playbooks/server/api_stats_test.go +++ b/server/playbooks/server/api_stats_test.go @@ -1,7 +1,7 @@ // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. -package main +package server import ( "context" @@ -9,7 +9,7 @@ import ( "net/http" "testing" - "github.com/mattermost/mattermost-server/v6/server/playbooks/client" + "github.com/mattermost/mattermost-server/server/v8/playbooks/client" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "gopkg.in/guregu/null.v4" diff --git a/server/playbooks/server/api_telemetry_test.go b/server/playbooks/server/api_telemetry_test.go index 7a3c9ab10f..3a154381e7 100644 --- a/server/playbooks/server/api_telemetry_test.go +++ b/server/playbooks/server/api_telemetry_test.go @@ -1,7 +1,7 @@ // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. -package main +package server import ( "context" diff --git a/server/playbooks/server/app/action.go b/server/playbooks/server/app/action.go index d3b3881a25..ed62a71c41 100644 --- a/server/playbooks/server/app/action.go +++ b/server/playbooks/server/app/action.go @@ -3,7 +3,7 @@ package app -import "github.com/mattermost/mattermost-server/v6/model" +import "github.com/mattermost/mattermost-server/server/v8/model" type GenericChannelActionWithoutPayload struct { ID string `json:"id"` diff --git a/server/playbooks/server/app/actions_service.go b/server/playbooks/server/app/actions_service.go index d00e298d9b..56fb1b16f1 100644 --- a/server/playbooks/server/app/actions_service.go +++ b/server/playbooks/server/app/actions_service.go @@ -9,10 +9,10 @@ import ( "sync" "time" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/playbooks/server/bot" - "github.com/mattermost/mattermost-server/v6/server/playbooks/server/config" - "github.com/mattermost/mattermost-server/v6/server/playbooks/server/playbooks" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/playbooks/server/bot" + "github.com/mattermost/mattermost-server/server/v8/playbooks/server/config" + "github.com/mattermost/mattermost-server/server/v8/playbooks/server/playbooks" "github.com/mitchellh/mapstructure" "github.com/pkg/errors" "github.com/sirupsen/logrus" diff --git a/server/playbooks/server/app/category_service.go b/server/playbooks/server/app/category_service.go index bc9cb2e363..f213a760e2 100644 --- a/server/playbooks/server/app/category_service.go +++ b/server/playbooks/server/app/category_service.go @@ -6,8 +6,8 @@ package app import ( "database/sql" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/playbooks/server/playbooks" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/playbooks/server/playbooks" "github.com/pkg/errors" ) diff --git a/server/playbooks/server/app/mocks/mock_job_once_scheduler.go b/server/playbooks/server/app/mocks/mock_job_once_scheduler.go index fdfdc2184b..9ae41d0ba1 100644 --- a/server/playbooks/server/app/mocks/mock_job_once_scheduler.go +++ b/server/playbooks/server/app/mocks/mock_job_once_scheduler.go @@ -2,7 +2,7 @@ // See LICENSE.txt for license information. // Code generated by MockGen. DO NOT EDIT. -// Source: github.com/mattermost/mattermost-server/v6/server/playbooks/server/app (interfaces: JobOnceScheduler) +// Source: github.com/mattermost/mattermost-server/server/v8/playbooks/server/app (interfaces: JobOnceScheduler) // Package mock_app is a generated GoMock package. package mock_app @@ -12,7 +12,7 @@ import ( time "time" gomock "github.com/golang/mock/gomock" - cluster "github.com/mattermost/mattermost-server/v6/server/playbooks/product/pluginapi/cluster" + cluster "github.com/mattermost/mattermost-server/server/v8/playbooks/product/pluginapi/cluster" ) // MockJobOnceScheduler is a mock of JobOnceScheduler interface. diff --git a/server/playbooks/server/app/permissions_service.go b/server/playbooks/server/app/permissions_service.go index cff8806fba..9a663cb91f 100644 --- a/server/playbooks/server/app/permissions_service.go +++ b/server/playbooks/server/app/permissions_service.go @@ -7,9 +7,9 @@ import ( "reflect" "strings" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/playbooks/server/config" - "github.com/mattermost/mattermost-server/v6/server/playbooks/server/playbooks" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/playbooks/server/config" + "github.com/mattermost/mattermost-server/server/v8/playbooks/server/playbooks" "github.com/pkg/errors" "github.com/sirupsen/logrus" ) diff --git a/server/playbooks/server/app/playbook.go b/server/playbooks/server/app/playbook.go index b0bb91f3e5..086be5a5a7 100644 --- a/server/playbooks/server/app/playbook.go +++ b/server/playbooks/server/app/playbook.go @@ -10,7 +10,7 @@ import ( "net/url" "strings" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" "gopkg.in/guregu/null.v4" "github.com/pkg/errors" diff --git a/server/playbooks/server/app/playbook_run.go b/server/playbooks/server/app/playbook_run.go index 24efefd839..276a54cc1f 100644 --- a/server/playbooks/server/app/playbook_run.go +++ b/server/playbooks/server/app/playbook_run.go @@ -10,10 +10,10 @@ import ( "gopkg.in/guregu/null.v4" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" "github.com/pkg/errors" - "github.com/mattermost/mattermost-server/v6/server/playbooks/product/pluginapi/cluster" + "github.com/mattermost/mattermost-server/server/v8/playbooks/product/pluginapi/cluster" ) const ( diff --git a/server/playbooks/server/app/playbook_run_service.go b/server/playbooks/server/app/playbook_run_service.go index f4ac2506ff..6a736df24c 100644 --- a/server/playbooks/server/app/playbook_run_service.go +++ b/server/playbooks/server/app/playbook_run_service.go @@ -16,14 +16,14 @@ import ( "github.com/sirupsen/logrus" stripmd "github.com/writeas/go-strip-markdown" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/i18n" - "github.com/mattermost/mattermost-server/v6/server/playbooks/server/bot" - "github.com/mattermost/mattermost-server/v6/server/playbooks/server/config" - "github.com/mattermost/mattermost-server/v6/server/playbooks/server/httptools" - "github.com/mattermost/mattermost-server/v6/server/playbooks/server/metrics" - "github.com/mattermost/mattermost-server/v6/server/playbooks/server/playbooks" - "github.com/mattermost/mattermost-server/v6/server/playbooks/server/timeutils" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/i18n" + "github.com/mattermost/mattermost-server/server/v8/playbooks/server/bot" + "github.com/mattermost/mattermost-server/server/v8/playbooks/server/config" + "github.com/mattermost/mattermost-server/server/v8/playbooks/server/httptools" + "github.com/mattermost/mattermost-server/server/v8/playbooks/server/metrics" + "github.com/mattermost/mattermost-server/server/v8/playbooks/server/playbooks" + "github.com/mattermost/mattermost-server/server/v8/playbooks/server/timeutils" ) const checklistItemDescriptionCharLimit = 4000 diff --git a/server/playbooks/server/app/playbook_run_test.go b/server/playbooks/server/app/playbook_run_test.go index 277f00b2c1..160dec7cc0 100644 --- a/server/playbooks/server/app/playbook_run_test.go +++ b/server/playbooks/server/app/playbook_run_test.go @@ -7,7 +7,7 @@ import ( "encoding/json" "testing" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" "github.com/stretchr/testify/require" ) diff --git a/server/playbooks/server/app/playbook_service.go b/server/playbooks/server/app/playbook_service.go index a870204987..a4cce88812 100644 --- a/server/playbooks/server/app/playbook_service.go +++ b/server/playbooks/server/app/playbook_service.go @@ -4,13 +4,13 @@ package app import ( - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" "github.com/pkg/errors" "github.com/sirupsen/logrus" - "github.com/mattermost/mattermost-server/v6/server/playbooks/server/bot" - "github.com/mattermost/mattermost-server/v6/server/playbooks/server/metrics" - "github.com/mattermost/mattermost-server/v6/server/playbooks/server/playbooks" + "github.com/mattermost/mattermost-server/server/v8/playbooks/server/bot" + "github.com/mattermost/mattermost-server/server/v8/playbooks/server/metrics" + "github.com/mattermost/mattermost-server/server/v8/playbooks/server/playbooks" ) const ( diff --git a/server/playbooks/server/app/plugin_api_tools.go b/server/playbooks/server/app/plugin_api_tools.go index 59e3589fcd..1910d9fe59 100644 --- a/server/playbooks/server/app/plugin_api_tools.go +++ b/server/playbooks/server/app/plugin_api_tools.go @@ -4,7 +4,7 @@ package app import ( - "github.com/mattermost/mattermost-server/v6/server/playbooks/server/playbooks" + "github.com/mattermost/mattermost-server/server/v8/playbooks/server/playbooks" "github.com/pkg/errors" ) diff --git a/server/playbooks/server/app/reminder.go b/server/playbooks/server/app/reminder.go index b6120e2367..9436c055ae 100644 --- a/server/playbooks/server/app/reminder.go +++ b/server/playbooks/server/app/reminder.go @@ -8,7 +8,7 @@ import ( "strings" "time" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" "github.com/pkg/errors" "github.com/sirupsen/logrus" ) diff --git a/server/playbooks/server/app/task_actions.go b/server/playbooks/server/app/task_actions.go index bc2d1e4bf2..8eba78404a 100644 --- a/server/playbooks/server/app/task_actions.go +++ b/server/playbooks/server/app/task_actions.go @@ -7,7 +7,7 @@ import ( "encoding/json" "strings" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" "github.com/pkg/errors" "github.com/sirupsen/logrus" ) diff --git a/server/playbooks/server/app/task_actions_test.go b/server/playbooks/server/app/task_actions_test.go index 29c7a4bef4..e19479daf9 100644 --- a/server/playbooks/server/app/task_actions_test.go +++ b/server/playbooks/server/app/task_actions_test.go @@ -6,7 +6,7 @@ package app import ( "testing" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" "github.com/stretchr/testify/require" ) diff --git a/server/playbooks/server/bot/bot.go b/server/playbooks/server/bot/bot.go index 52be192cf1..b35912a253 100644 --- a/server/playbooks/server/bot/bot.go +++ b/server/playbooks/server/bot/bot.go @@ -4,9 +4,9 @@ package bot import ( - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/playbooks/server/config" - "github.com/mattermost/mattermost-server/v6/server/playbooks/server/playbooks" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/playbooks/server/config" + "github.com/mattermost/mattermost-server/server/v8/playbooks/server/playbooks" ) // Bot stores the information for the plugin configuration, and implements the Poster interfaces. diff --git a/server/playbooks/server/bot/mocks/mock_poster.go b/server/playbooks/server/bot/mocks/mock_poster.go index f8e4aeb10b..a6c78d9a04 100644 --- a/server/playbooks/server/bot/mocks/mock_poster.go +++ b/server/playbooks/server/bot/mocks/mock_poster.go @@ -2,7 +2,7 @@ // See LICENSE.txt for license information. // Code generated by MockGen. DO NOT EDIT. -// Source: github.com/mattermost/mattermost-server/v6/server/playbooks/server/bot (interfaces: Poster) +// Source: github.com/mattermost/mattermost-server/server/v8/playbooks/server/bot (interfaces: Poster) // Package mock_bot is a generated GoMock package. package mock_bot @@ -11,7 +11,7 @@ import ( reflect "reflect" gomock "github.com/golang/mock/gomock" - model "github.com/mattermost/mattermost-server/v6/model" + model "github.com/mattermost/mattermost-server/server/v8/model" ) // MockPoster is a mock of Poster interface. diff --git a/server/playbooks/server/bot/poster.go b/server/playbooks/server/bot/poster.go index 17c1e545b6..a720dec395 100644 --- a/server/playbooks/server/bot/poster.go +++ b/server/playbooks/server/bot/poster.go @@ -7,7 +7,7 @@ import ( "encoding/json" "fmt" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" "github.com/pkg/errors" "github.com/sirupsen/logrus" ) diff --git a/server/playbooks/server/command/command.go b/server/playbooks/server/command/command.go index 782824de87..6188588b8a 100644 --- a/server/playbooks/server/command/command.go +++ b/server/playbooks/server/command/command.go @@ -10,13 +10,13 @@ import ( "strings" "time" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/plugin" - "github.com/mattermost/mattermost-server/v6/server/playbooks/server/app" - "github.com/mattermost/mattermost-server/v6/server/playbooks/server/bot" - "github.com/mattermost/mattermost-server/v6/server/playbooks/server/config" - "github.com/mattermost/mattermost-server/v6/server/playbooks/server/playbooks" - "github.com/mattermost/mattermost-server/v6/server/playbooks/server/timeutils" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/playbooks/server/app" + "github.com/mattermost/mattermost-server/server/v8/playbooks/server/bot" + "github.com/mattermost/mattermost-server/server/v8/playbooks/server/config" + "github.com/mattermost/mattermost-server/server/v8/playbooks/server/playbooks" + "github.com/mattermost/mattermost-server/server/v8/playbooks/server/timeutils" + "github.com/mattermost/mattermost-server/server/v8/plugin" "github.com/pkg/errors" "github.com/sirupsen/logrus" ) diff --git a/server/playbooks/server/config/service.go b/server/playbooks/server/config/service.go index bb5ec8bc97..320b450427 100644 --- a/server/playbooks/server/config/service.go +++ b/server/playbooks/server/config/service.go @@ -9,8 +9,8 @@ import ( "github.com/pkg/errors" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/playbooks/server/playbooks" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/playbooks/server/playbooks" ) // const npsPluginID = "com.mattermost.nps" diff --git a/server/playbooks/server/enterprise/license.go b/server/playbooks/server/enterprise/license.go index 54c9af0a9e..4a83c4419c 100644 --- a/server/playbooks/server/enterprise/license.go +++ b/server/playbooks/server/enterprise/license.go @@ -4,8 +4,8 @@ package enterprise import ( - "github.com/mattermost/mattermost-server/v6/server/playbooks/product/pluginapi" - "github.com/mattermost/mattermost-server/v6/server/playbooks/server/playbooks" + "github.com/mattermost/mattermost-server/server/v8/playbooks/product/pluginapi" + "github.com/mattermost/mattermost-server/server/v8/playbooks/server/playbooks" ) type LicenseChecker struct { diff --git a/server/playbooks/server/httptools/client.go b/server/playbooks/server/httptools/client.go index e55ee47a5b..0ffde23be6 100644 --- a/server/playbooks/server/httptools/client.go +++ b/server/playbooks/server/httptools/client.go @@ -10,8 +10,8 @@ import ( "time" "unicode" - "github.com/mattermost/mattermost-server/v6/server/platform/services/httpservice" - "github.com/mattermost/mattermost-server/v6/server/playbooks/server/playbooks" + "github.com/mattermost/mattermost-server/server/v8/platform/services/httpservice" + "github.com/mattermost/mattermost-server/server/v8/playbooks/server/playbooks" ) func MakeClient(api playbooks.ServicesAPI) *http.Client { diff --git a/server/playbooks/server/main_test.go b/server/playbooks/server/main_test.go index 3392c2cb1e..5590ea392c 100644 --- a/server/playbooks/server/main_test.go +++ b/server/playbooks/server/main_test.go @@ -1,44 +1,33 @@ // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. -package main +package server import ( "context" "encoding/json" "fmt" "os" - "os/exec" - "path/filepath" - "strings" "testing" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/api4" - sapp "github.com/mattermost/mattermost-server/v6/server/channels/app" - "github.com/mattermost/mattermost-server/v6/server/channels/app/request" - "github.com/mattermost/mattermost-server/v6/server/channels/store/storetest" - "github.com/mattermost/mattermost-server/v6/server/channels/utils" - "github.com/mattermost/mattermost-server/v6/server/config" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" - "github.com/mattermost/mattermost-server/v6/server/playbooks/client" - "github.com/mattermost/mattermost-server/v6/server/playbooks/server/app" + "github.com/mattermost/mattermost-server/server/v8/channels/api4" + sapp "github.com/mattermost/mattermost-server/server/v8/channels/app" + "github.com/mattermost/mattermost-server/server/v8/channels/app/request" + "github.com/mattermost/mattermost-server/server/v8/channels/store/storetest" + "github.com/mattermost/mattermost-server/server/v8/channels/utils" + "github.com/mattermost/mattermost-server/server/v8/config" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/playbooks/client" + "github.com/mattermost/mattermost-server/server/v8/playbooks/server/app" "github.com/pkg/errors" "github.com/stretchr/testify/require" "gopkg.in/guregu/null.v4" - _ "github.com/mattermost/mattermost-server/v6/server/playbooks/product" + _ "github.com/mattermost/mattermost-server/server/v8/playbooks/product" ) func TestMain(m *testing.M) { - serverpathBytes, err := exec.Command("go", "list", "-f", "'{{.Dir}}'", "-m", "github.com/mattermost/mattermost-server/v6").Output() - if err != nil { - panic(err) - } - serverpath := string(serverpathBytes) - serverpath = strings.Trim(strings.TrimSpace(serverpath), "'") - os.Setenv("MM_SERVER_PATH", filepath.Join(serverpath, "server")) - // This actually runs the tests status := m.Run() diff --git a/server/playbooks/server/playbooks/service_api.go b/server/playbooks/server/playbooks/service_api.go index c17cae4aa3..e148581fdc 100644 --- a/server/playbooks/server/playbooks/service_api.go +++ b/server/playbooks/server/playbooks/service_api.go @@ -10,7 +10,7 @@ import ( "github.com/gorilla/mux" - mm_model "github.com/mattermost/mattermost-server/v6/model" + mm_model "github.com/mattermost/mattermost-server/server/v8/model" ) const ( diff --git a/server/playbooks/server/sqlstore/actions.go b/server/playbooks/server/sqlstore/actions.go index 09b7743463..93d6589f3e 100644 --- a/server/playbooks/server/sqlstore/actions.go +++ b/server/playbooks/server/sqlstore/actions.go @@ -11,8 +11,8 @@ import ( sq "github.com/Masterminds/squirrel" "github.com/go-sql-driver/mysql" "github.com/lib/pq" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/playbooks/server/app" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/playbooks/server/app" "github.com/pkg/errors" ) diff --git a/server/playbooks/server/sqlstore/actions_test.go b/server/playbooks/server/sqlstore/actions_test.go index 65b9f0b34c..92db488041 100644 --- a/server/playbooks/server/sqlstore/actions_test.go +++ b/server/playbooks/server/sqlstore/actions_test.go @@ -10,9 +10,9 @@ import ( "github.com/jmoiron/sqlx" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/playbooks/server/app" - mock_sqlstore "github.com/mattermost/mattermost-server/v6/server/playbooks/server/sqlstore/mocks" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/playbooks/server/app" + mock_sqlstore "github.com/mattermost/mattermost-server/server/v8/playbooks/server/sqlstore/mocks" ) func setupChannelActionStore(t *testing.T, db *sqlx.DB) app.ChannelActionStore { diff --git a/server/playbooks/server/sqlstore/category.go b/server/playbooks/server/sqlstore/category.go index 955cc4fecf..4e8eab5742 100644 --- a/server/playbooks/server/sqlstore/category.go +++ b/server/playbooks/server/sqlstore/category.go @@ -7,8 +7,8 @@ import ( "database/sql" sq "github.com/Masterminds/squirrel" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/playbooks/server/app" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/playbooks/server/app" "github.com/pkg/errors" ) diff --git a/server/playbooks/server/sqlstore/category_test.go b/server/playbooks/server/sqlstore/category_test.go index 6fed27c0d3..0e271ea9d5 100644 --- a/server/playbooks/server/sqlstore/category_test.go +++ b/server/playbooks/server/sqlstore/category_test.go @@ -10,9 +10,9 @@ import ( "github.com/jmoiron/sqlx" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/playbooks/server/app" - mock_sqlstore "github.com/mattermost/mattermost-server/v6/server/playbooks/server/sqlstore/mocks" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/playbooks/server/app" + mock_sqlstore "github.com/mattermost/mattermost-server/server/v8/playbooks/server/sqlstore/mocks" ) func setupCategoryStore(t *testing.T, db *sqlx.DB) app.CategoryStore { diff --git a/server/playbooks/server/sqlstore/migrate.go b/server/playbooks/server/sqlstore/migrate.go index 8de5710f80..b4b08e0cf0 100644 --- a/server/playbooks/server/sqlstore/migrate.go +++ b/server/playbooks/server/sqlstore/migrate.go @@ -11,7 +11,7 @@ import ( "github.com/blang/semver" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" "github.com/mattermost/morph" "github.com/mattermost/morph/drivers" "github.com/mattermost/morph/sources" diff --git a/server/playbooks/server/sqlstore/migrations.go b/server/playbooks/server/sqlstore/migrations.go index 1c2f4f8f6e..d965c46743 100644 --- a/server/playbooks/server/sqlstore/migrations.go +++ b/server/playbooks/server/sqlstore/migrations.go @@ -13,8 +13,8 @@ import ( "github.com/blang/semver" "github.com/go-sql-driver/mysql" "github.com/jmoiron/sqlx" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/playbooks/server/app" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/playbooks/server/app" "github.com/pkg/errors" "github.com/sirupsen/logrus" ) diff --git a/server/playbooks/server/sqlstore/migrations_test.go b/server/playbooks/server/sqlstore/migrations_test.go index 04fdca9be6..913e6e8632 100644 --- a/server/playbooks/server/sqlstore/migrations_test.go +++ b/server/playbooks/server/sqlstore/migrations_test.go @@ -11,7 +11,7 @@ import ( "github.com/mattermost/morph" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) type MigrationMapping struct { diff --git a/server/playbooks/server/sqlstore/migrations_utils.go b/server/playbooks/server/sqlstore/migrations_utils.go index 9f5c43f15c..61ae236ffa 100644 --- a/server/playbooks/server/sqlstore/migrations_utils.go +++ b/server/playbooks/server/sqlstore/migrations_utils.go @@ -8,7 +8,7 @@ import ( "fmt" "strings" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" "github.com/pkg/errors" "github.com/jmoiron/sqlx" diff --git a/server/playbooks/server/sqlstore/mockmocks/mock_storeapi.go b/server/playbooks/server/sqlstore/mockmocks/mock_storeapi.go index 895d7f5134..10b706dde5 100644 --- a/server/playbooks/server/sqlstore/mockmocks/mock_storeapi.go +++ b/server/playbooks/server/sqlstore/mockmocks/mock_storeapi.go @@ -2,7 +2,7 @@ // See LICENSE.txt for license information. // Code generated by MockGen. DO NOT EDIT. -// Source: github.com/mattermost/mattermost-server/v6/server/playbooks/server/sqlstore (interfaces: StoreAPI) +// Source: github.com/mattermost/mattermost-server/server/v8/playbooks/server/sqlstore (interfaces: StoreAPI) // Package mock_sqlstore is a generated GoMock package. package mock_sqlstore diff --git a/server/playbooks/server/sqlstore/mocks/mock_configurationapi.go b/server/playbooks/server/sqlstore/mocks/mock_configurationapi.go index c9980a13ca..50ffc09958 100644 --- a/server/playbooks/server/sqlstore/mocks/mock_configurationapi.go +++ b/server/playbooks/server/sqlstore/mocks/mock_configurationapi.go @@ -2,7 +2,7 @@ // See LICENSE.txt for license information. // Code generated by MockGen. DO NOT EDIT. -// Source: github.com/mattermost/mattermost-server/v6/server/playbooks/server/sqlstore (interfaces: ConfigurationAPI) +// Source: github.com/mattermost/mattermost-server/server/v8/playbooks/server/sqlstore (interfaces: ConfigurationAPI) // Package mock_sqlstore is a generated GoMock package. package mock_sqlstore @@ -11,7 +11,7 @@ import ( reflect "reflect" gomock "github.com/golang/mock/gomock" - model "github.com/mattermost/mattermost-server/v6/model" + model "github.com/mattermost/mattermost-server/server/v8/model" ) // MockConfigurationAPI is a mock of ConfigurationAPI interface. diff --git a/server/playbooks/server/sqlstore/mocks/mock_kvapi.go b/server/playbooks/server/sqlstore/mocks/mock_kvapi.go index f121fe1a4e..398e6f7901 100644 --- a/server/playbooks/server/sqlstore/mocks/mock_kvapi.go +++ b/server/playbooks/server/sqlstore/mocks/mock_kvapi.go @@ -2,7 +2,7 @@ // See LICENSE.txt for license information. // Code generated by MockGen. DO NOT EDIT. -// Source: github.com/mattermost/mattermost-server/v6/server/playbooks/server/sqlstore (interfaces: KVAPI) +// Source: github.com/mattermost/mattermost-server/server/v8/playbooks/server/sqlstore (interfaces: KVAPI) // Package mock_sqlstore is a generated GoMock package. package mock_sqlstore diff --git a/server/playbooks/server/sqlstore/mocks/mock_storeapi.go b/server/playbooks/server/sqlstore/mocks/mock_storeapi.go index 6ba8846d39..ffd99fd491 100644 --- a/server/playbooks/server/sqlstore/mocks/mock_storeapi.go +++ b/server/playbooks/server/sqlstore/mocks/mock_storeapi.go @@ -2,7 +2,7 @@ // See LICENSE.txt for license information. // Code generated by MockGen. DO NOT EDIT. -// Source: github.com/mattermost/mattermost-server/v6/server/playbooks/server/sqlstore (interfaces: StoreAPI) +// Source: github.com/mattermost/mattermost-server/server/v8/playbooks/server/sqlstore (interfaces: StoreAPI) // Package mock_sqlstore is a generated GoMock package. package mock_sqlstore diff --git a/server/playbooks/server/sqlstore/playbook.go b/server/playbooks/server/sqlstore/playbook.go index 9c8bf48e36..dcb06a98fe 100644 --- a/server/playbooks/server/sqlstore/playbook.go +++ b/server/playbooks/server/sqlstore/playbook.go @@ -11,8 +11,8 @@ import ( "strings" sq "github.com/Masterminds/squirrel" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/playbooks/server/app" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/playbooks/server/app" "github.com/pkg/errors" ) diff --git a/server/playbooks/server/sqlstore/playbook_run.go b/server/playbooks/server/sqlstore/playbook_run.go index e1f48e80df..061699d018 100644 --- a/server/playbooks/server/sqlstore/playbook_run.go +++ b/server/playbooks/server/sqlstore/playbook_run.go @@ -16,8 +16,8 @@ import ( "github.com/jmoiron/sqlx" sq "github.com/Masterminds/squirrel" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/playbooks/server/app" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/playbooks/server/app" "github.com/pkg/errors" ) diff --git a/server/playbooks/server/sqlstore/playbook_run_test.go b/server/playbooks/server/sqlstore/playbook_run_test.go index 2dee055a78..d95b78fd0b 100644 --- a/server/playbooks/server/sqlstore/playbook_run_test.go +++ b/server/playbooks/server/sqlstore/playbook_run_test.go @@ -20,9 +20,9 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/playbooks/server/app" - mock_sqlstore "github.com/mattermost/mattermost-server/v6/server/playbooks/server/sqlstore/mocks" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/playbooks/server/app" + mock_sqlstore "github.com/mattermost/mattermost-server/server/v8/playbooks/server/sqlstore/mocks" ) func TestCreateAndGetPlaybookRun(t *testing.T) { diff --git a/server/playbooks/server/sqlstore/playbook_test.go b/server/playbooks/server/sqlstore/playbook_test.go index d556ab5b7a..e61d7d62fa 100644 --- a/server/playbooks/server/sqlstore/playbook_test.go +++ b/server/playbooks/server/sqlstore/playbook_test.go @@ -16,9 +16,9 @@ import ( "github.com/pkg/errors" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/playbooks/server/app" - mock_sqlstore "github.com/mattermost/mattermost-server/v6/server/playbooks/server/sqlstore/mocks" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/playbooks/server/app" + mock_sqlstore "github.com/mattermost/mattermost-server/server/v8/playbooks/server/sqlstore/mocks" ) func membersFromIds(ids []string) []app.PlaybookMember { diff --git a/server/playbooks/server/sqlstore/pluginapi_client.go b/server/playbooks/server/sqlstore/pluginapi_client.go index e2f069d7a5..699fd10513 100644 --- a/server/playbooks/server/sqlstore/pluginapi_client.go +++ b/server/playbooks/server/sqlstore/pluginapi_client.go @@ -6,9 +6,9 @@ package sqlstore import ( "database/sql" - "github.com/mattermost/mattermost-server/v6/server/playbooks/server/playbooks" + "github.com/mattermost/mattermost-server/server/v8/playbooks/server/playbooks" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) // StoreAPI is the interface exposing the underlying database, provided by pluginapi diff --git a/server/playbooks/server/sqlstore/stats.go b/server/playbooks/server/sqlstore/stats.go index 54000c582f..4c101e25d8 100644 --- a/server/playbooks/server/sqlstore/stats.go +++ b/server/playbooks/server/sqlstore/stats.go @@ -15,7 +15,7 @@ import ( "gopkg.in/guregu/null.v4" sq "github.com/Masterminds/squirrel" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) type StatsStore struct { diff --git a/server/playbooks/server/sqlstore/stats_test.go b/server/playbooks/server/sqlstore/stats_test.go index d516b3eb0d..5973f279bc 100644 --- a/server/playbooks/server/sqlstore/stats_test.go +++ b/server/playbooks/server/sqlstore/stats_test.go @@ -13,9 +13,9 @@ import ( "github.com/stretchr/testify/require" "gopkg.in/guregu/null.v4" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/playbooks/server/app" - mock_sqlstore "github.com/mattermost/mattermost-server/v6/server/playbooks/server/sqlstore/mocks" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/playbooks/server/app" + mock_sqlstore "github.com/mattermost/mattermost-server/server/v8/playbooks/server/sqlstore/mocks" ) func setupStatsStore(t *testing.T, db *sqlx.DB) *StatsStore { diff --git a/server/playbooks/server/sqlstore/store.go b/server/playbooks/server/sqlstore/store.go index b2c1194813..fae12dd6c7 100644 --- a/server/playbooks/server/sqlstore/store.go +++ b/server/playbooks/server/sqlstore/store.go @@ -6,12 +6,12 @@ package sqlstore import ( "database/sql" - "github.com/mattermost/mattermost-server/v6/server/playbooks/server/app" + "github.com/mattermost/mattermost-server/server/v8/playbooks/server/app" "github.com/sirupsen/logrus" sq "github.com/Masterminds/squirrel" "github.com/jmoiron/sqlx" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" "github.com/pkg/errors" ) diff --git a/server/playbooks/server/sqlstore/store_test.go b/server/playbooks/server/sqlstore/store_test.go index 7956df70b9..cb33394f7f 100644 --- a/server/playbooks/server/sqlstore/store_test.go +++ b/server/playbooks/server/sqlstore/store_test.go @@ -8,9 +8,9 @@ import ( "testing" "time" - "github.com/mattermost/mattermost-server/v6/server/playbooks/server/app" + "github.com/mattermost/mattermost-server/server/v8/playbooks/server/app" - mock_app "github.com/mattermost/mattermost-server/v6/server/playbooks/server/app/mocks" + mock_app "github.com/mattermost/mattermost-server/server/v8/playbooks/server/app/mocks" sq "github.com/Masterminds/squirrel" "github.com/blang/semver" @@ -18,7 +18,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) func TestMigrations(t *testing.T) { diff --git a/server/playbooks/server/sqlstore/support_for_test.go b/server/playbooks/server/sqlstore/support_for_test.go index eb5b12a4d1..3035fe8dd5 100644 --- a/server/playbooks/server/sqlstore/support_for_test.go +++ b/server/playbooks/server/sqlstore/support_for_test.go @@ -10,16 +10,16 @@ import ( "github.com/blang/semver" - mock_app "github.com/mattermost/mattermost-server/v6/server/playbooks/server/app/mocks" + mock_app "github.com/mattermost/mattermost-server/server/v8/playbooks/server/app/mocks" sq "github.com/Masterminds/squirrel" "github.com/golang/mock/gomock" "github.com/jmoiron/sqlx" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/store/storetest" - "github.com/mattermost/mattermost-server/v6/server/playbooks/server/app" + "github.com/mattermost/mattermost-server/server/v8/channels/store/storetest" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/playbooks/server/app" ) func getDriverName() string { diff --git a/server/playbooks/server/sqlstore/system.go b/server/playbooks/server/sqlstore/system.go index 584f7639ce..7be08ffb26 100644 --- a/server/playbooks/server/sqlstore/system.go +++ b/server/playbooks/server/sqlstore/system.go @@ -7,7 +7,7 @@ import ( "database/sql" sq "github.com/Masterminds/squirrel" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" "github.com/pkg/errors" ) diff --git a/server/playbooks/server/sqlstore/timeline_event_test.go b/server/playbooks/server/sqlstore/timeline_event_test.go index 78572c2229..2a22ce2cc6 100644 --- a/server/playbooks/server/sqlstore/timeline_event_test.go +++ b/server/playbooks/server/sqlstore/timeline_event_test.go @@ -8,8 +8,8 @@ import ( "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/playbooks/server/app" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/playbooks/server/app" ) func TestPlaybookRunStore_CreateTimelineEvent(t *testing.T) { diff --git a/server/playbooks/server/sqlstore/user_info.go b/server/playbooks/server/sqlstore/user_info.go index 949c3440c8..211fcc90d2 100644 --- a/server/playbooks/server/sqlstore/user_info.go +++ b/server/playbooks/server/sqlstore/user_info.go @@ -7,10 +7,10 @@ import ( "database/sql" "encoding/json" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" sq "github.com/Masterminds/squirrel" - "github.com/mattermost/mattermost-server/v6/server/playbooks/server/app" + "github.com/mattermost/mattermost-server/server/v8/playbooks/server/app" "github.com/pkg/errors" ) diff --git a/server/playbooks/server/sqlstore/user_info_test.go b/server/playbooks/server/sqlstore/user_info_test.go index 0230268d19..3781d2f7a8 100644 --- a/server/playbooks/server/sqlstore/user_info_test.go +++ b/server/playbooks/server/sqlstore/user_info_test.go @@ -7,7 +7,7 @@ import ( "reflect" "testing" - mock_app "github.com/mattermost/mattermost-server/v6/server/playbooks/server/app/mocks" + mock_app "github.com/mattermost/mattermost-server/server/v8/playbooks/server/app/mocks" "github.com/pkg/errors" @@ -16,8 +16,8 @@ import ( "github.com/jmoiron/sqlx" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/playbooks/server/app" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/playbooks/server/app" ) func Test_userInfoStore_Get(t *testing.T) { diff --git a/server/playbooks/server/telemetry/noop.go b/server/playbooks/server/telemetry/noop.go index 37694ddfc1..c0a8521ec3 100644 --- a/server/playbooks/server/telemetry/noop.go +++ b/server/playbooks/server/telemetry/noop.go @@ -4,7 +4,7 @@ package telemetry import ( - "github.com/mattermost/mattermost-server/v6/server/playbooks/server/app" + "github.com/mattermost/mattermost-server/server/v8/playbooks/server/app" ) // NoopTelemetry satisfies the Telemetry interface with no-op implementations. diff --git a/server/playbooks/server/telemetry/rudder.go b/server/playbooks/server/telemetry/rudder.go index 081d5d518c..294a23b2a7 100644 --- a/server/playbooks/server/telemetry/rudder.go +++ b/server/playbooks/server/telemetry/rudder.go @@ -6,7 +6,7 @@ package telemetry import ( "sync" - "github.com/mattermost/mattermost-server/v6/server/playbooks/server/app" + "github.com/mattermost/mattermost-server/server/v8/playbooks/server/app" "github.com/pkg/errors" rudder "github.com/rudderlabs/analytics-go" diff --git a/server/playbooks/server/telemetry/rudder_test.go b/server/playbooks/server/telemetry/rudder_test.go index 3d0befeada..2f67254a60 100644 --- a/server/playbooks/server/telemetry/rudder_test.go +++ b/server/playbooks/server/telemetry/rudder_test.go @@ -13,7 +13,7 @@ import ( "gopkg.in/guregu/null.v4" - "github.com/mattermost/mattermost-server/v6/server/playbooks/server/app" + "github.com/mattermost/mattermost-server/server/v8/playbooks/server/app" rudder "github.com/rudderlabs/analytics-go" "github.com/stretchr/testify/require" diff --git a/server/playbooks/server/timeutils/timeutils.go b/server/playbooks/server/timeutils/timeutils.go index fb98a50eb6..efed974dd7 100644 --- a/server/playbooks/server/timeutils/timeutils.go +++ b/server/playbooks/server/timeutils/timeutils.go @@ -8,7 +8,7 @@ import ( "math" "time" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) func GetTimeForMillis(unixMillis int64) time.Time { diff --git a/plugin/api.go b/server/plugin/api.go similarity index 99% rename from plugin/api.go rename to server/plugin/api.go index f777539d04..63be22ce43 100644 --- a/plugin/api.go +++ b/server/plugin/api.go @@ -9,7 +9,7 @@ import ( plugin "github.com/hashicorp/go-plugin" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) // The API can be used to retrieve data or perform actions on behalf of the plugin. Most methods diff --git a/plugin/api_timer_layer_generated.go b/server/plugin/api_timer_layer_generated.go similarity index 99% rename from plugin/api_timer_layer_generated.go rename to server/plugin/api_timer_layer_generated.go index a084188c62..0f1ab22ff7 100644 --- a/plugin/api_timer_layer_generated.go +++ b/server/plugin/api_timer_layer_generated.go @@ -11,8 +11,8 @@ import ( "net/http" timePkg "time" - "github.com/mattermost/mattermost-server/v6/server/channels/einterfaces" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/channels/einterfaces" + "github.com/mattermost/mattermost-server/server/v8/model" ) type apiTimerLayer struct { diff --git a/plugin/checker/check_api.go b/server/plugin/checker/check_api.go similarity index 87% rename from plugin/checker/check_api.go rename to server/plugin/checker/check_api.go index 707da34e9c..88c7a53775 100644 --- a/plugin/checker/check_api.go +++ b/server/plugin/checker/check_api.go @@ -8,8 +8,8 @@ import ( "go/ast" "go/token" - "github.com/mattermost/mattermost-server/v6/plugin/checker/internal/asthelpers" - "github.com/mattermost/mattermost-server/v6/plugin/checker/internal/version" + "github.com/mattermost/mattermost-server/server/v8/plugin/checker/internal/asthelpers" + "github.com/mattermost/mattermost-server/server/v8/plugin/checker/internal/version" ) func checkAPIVersionComments(pkgPath string) (result, error) { diff --git a/plugin/checker/check_api_test.go b/server/plugin/checker/check_api_test.go similarity index 76% rename from plugin/checker/check_api_test.go rename to server/plugin/checker/check_api_test.go index c270399abc..5c22f4f231 100644 --- a/plugin/checker/check_api_test.go +++ b/server/plugin/checker/check_api_test.go @@ -17,24 +17,24 @@ func TestCheckAPIVersionComments(t *testing.T) { }{ { name: "valid comments", - pkgPath: "github.com/mattermost/mattermost-server/v6/plugin/checker/internal/test/valid", + pkgPath: "github.com/mattermost/mattermost-server/server/v8/plugin/checker/internal/test/valid", err: "", }, { name: "invalid comments", - pkgPath: "github.com/mattermost/mattermost-server/v6/plugin/checker/internal/test/invalid", + pkgPath: "github.com/mattermost/mattermost-server/server/v8/plugin/checker/internal/test/invalid", expected: result{ Errors: []string{"internal/test/invalid/invalid.go:15:2: missing a minimum server version comment on method InvalidMethod"}, }, }, { name: "missing API interface", - pkgPath: "github.com/mattermost/mattermost-server/v6/plugin/checker/internal/test/missing", + pkgPath: "github.com/mattermost/mattermost-server/server/v8/plugin/checker/internal/test/missing", err: "could not find API interface", }, { name: "non-existent package path", - pkgPath: "github.com/mattermost/mattermost-server/v6/plugin/checker/internal/test/does_not_exist", + pkgPath: "github.com/mattermost/mattermost-server/server/v8/plugin/checker/internal/test/does_not_exist", err: "could not find API interface", }, } diff --git a/plugin/checker/internal/asthelpers/helpers.go b/server/plugin/checker/internal/asthelpers/helpers.go similarity index 100% rename from plugin/checker/internal/asthelpers/helpers.go rename to server/plugin/checker/internal/asthelpers/helpers.go diff --git a/plugin/checker/internal/test/invalid/invalid.go b/server/plugin/checker/internal/test/invalid/invalid.go similarity index 100% rename from plugin/checker/internal/test/invalid/invalid.go rename to server/plugin/checker/internal/test/invalid/invalid.go diff --git a/plugin/checker/internal/test/missing/missing.go b/server/plugin/checker/internal/test/missing/missing.go similarity index 100% rename from plugin/checker/internal/test/missing/missing.go rename to server/plugin/checker/internal/test/missing/missing.go diff --git a/plugin/checker/internal/test/valid/valid.go b/server/plugin/checker/internal/test/valid/valid.go similarity index 100% rename from plugin/checker/internal/test/valid/valid.go rename to server/plugin/checker/internal/test/valid/valid.go diff --git a/plugin/checker/internal/version/comments.go b/server/plugin/checker/internal/version/comments.go similarity index 100% rename from plugin/checker/internal/version/comments.go rename to server/plugin/checker/internal/version/comments.go diff --git a/plugin/checker/internal/version/comments_test.go b/server/plugin/checker/internal/version/comments_test.go similarity index 100% rename from plugin/checker/internal/version/comments_test.go rename to server/plugin/checker/internal/version/comments_test.go diff --git a/plugin/checker/internal/version/version.go b/server/plugin/checker/internal/version/version.go similarity index 100% rename from plugin/checker/internal/version/version.go rename to server/plugin/checker/internal/version/version.go diff --git a/plugin/checker/internal/version/version_test.go b/server/plugin/checker/internal/version/version_test.go similarity index 100% rename from plugin/checker/internal/version/version_test.go rename to server/plugin/checker/internal/version/version_test.go diff --git a/plugin/checker/main.go b/server/plugin/checker/main.go similarity index 98% rename from plugin/checker/main.go rename to server/plugin/checker/main.go index 87c1f6b414..b7a2e76aa7 100644 --- a/plugin/checker/main.go +++ b/server/plugin/checker/main.go @@ -10,7 +10,7 @@ import ( "strings" ) -const pluginPackagePath = "github.com/mattermost/mattermost-server/v6/plugin" +const pluginPackagePath = "github.com/mattermost/mattermost-server/server/v8/plugin" type result struct { Warnings []string diff --git a/plugin/checker/render.go b/server/plugin/checker/render.go similarity index 100% rename from plugin/checker/render.go rename to server/plugin/checker/render.go diff --git a/plugin/client.go b/server/plugin/client.go similarity index 100% rename from plugin/client.go rename to server/plugin/client.go diff --git a/plugin/client_rpc.go b/server/plugin/client_rpc.go similarity index 99% rename from plugin/client_rpc.go rename to server/plugin/client_rpc.go index 699e8d967a..ec30c31ec6 100644 --- a/plugin/client_rpc.go +++ b/server/plugin/client_rpc.go @@ -24,8 +24,8 @@ import ( "github.com/hashicorp/go-plugin" "github.com/lib/pq" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) var hookNameToId map[string]int = make(map[string]int) diff --git a/plugin/client_rpc_generated.go b/server/plugin/client_rpc_generated.go similarity index 99% rename from plugin/client_rpc_generated.go rename to server/plugin/client_rpc_generated.go index e0d3a5e814..3453a35578 100644 --- a/plugin/client_rpc_generated.go +++ b/server/plugin/client_rpc_generated.go @@ -10,8 +10,8 @@ import ( "fmt" "log" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) func init() { diff --git a/plugin/context.go b/server/plugin/context.go similarity index 100% rename from plugin/context.go rename to server/plugin/context.go diff --git a/plugin/db_rpc.go b/server/plugin/db_rpc.go similarity index 100% rename from plugin/db_rpc.go rename to server/plugin/db_rpc.go diff --git a/plugin/doc.go b/server/plugin/doc.go similarity index 100% rename from plugin/doc.go rename to server/plugin/doc.go diff --git a/plugin/driver.go b/server/plugin/driver.go similarity index 100% rename from plugin/driver.go rename to server/plugin/driver.go diff --git a/plugin/environment.go b/server/plugin/environment.go similarity index 90% rename from plugin/environment.go rename to server/plugin/environment.go index b32ef66519..2cdcbdd90c 100644 --- a/plugin/environment.go +++ b/server/plugin/environment.go @@ -4,21 +4,19 @@ package plugin import ( - "bytes" "fmt" "hash/fnv" "os" "path/filepath" - "strings" "sync" "time" "github.com/pkg/errors" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/einterfaces" - "github.com/mattermost/mattermost-server/v6/server/channels/utils" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/einterfaces" + "github.com/mattermost/mattermost-server/server/v8/channels/utils" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) var ErrNotFound = errors.New("Item not found") @@ -59,7 +57,6 @@ type Environment struct { dbDriver Driver pluginDir string webappPluginDir string - patchReactDOM bool prepackagedPlugins []*PrepackagedPlugin prepackagedPluginsLock sync.RWMutex } @@ -69,7 +66,6 @@ func NewEnvironment( dbDriver Driver, pluginDir string, webappPluginDir string, - patchReactDOM bool, logger *mlog.Logger, metrics einterfaces.MetricsInterface, ) (*Environment, error) { @@ -80,7 +76,6 @@ func NewEnvironment( dbDriver: dbDriver, pluginDir: pluginDir, webappPluginDir: webappPluginDir, - patchReactDOM: patchReactDOM, }, nil } @@ -488,17 +483,6 @@ func (env *Environment) UnpackWebappBundle(id string) (*model.Manifest, error) { return nil, errors.Wrapf(err, "unable to read webapp bundle: %v", id) } - if env.patchReactDOM { - newContents, changed := patchReactDOM(sourceBundleFileContents) - if changed { - sourceBundleFileContents = newContents - err = os.WriteFile(sourceBundleFilepath, sourceBundleFileContents, 0644) - if err != nil { - return nil, errors.Wrapf(err, "unable to overwrite webapp bundle: %v", id) - } - } - } - hash := fnv.New64a() if _, err = hash.Write(sourceBundleFileContents); err != nil { return nil, errors.Wrapf(err, "unable to generate hash for webapp bundle: %v", id) @@ -515,52 +499,6 @@ func (env *Environment) UnpackWebappBundle(id string) (*model.Manifest, error) { return manifest, nil } -func patchReactDOM(initialBytes []byte) ([]byte, bool) { - if !bytes.Contains(initialBytes, []byte("react-dom.production.min.js")) { - return initialBytes, false - } - - initial := string(initialBytes) - nameIndex := strings.Index(initial, "react-dom.production.min.js") - - beginning := strings.LastIndex(initial[:nameIndex], "{") - var end int - - argDefBeginning := strings.LastIndex(initial[:beginning], "function") + 9 - argDefEnd := strings.LastIndex(initial[:beginning], ")") - 1 - argsNames := strings.Split(initial[argDefBeginning:argDefEnd], ",") - if len(argsNames) != 3 { - return initialBytes, false - } - - exportsArgName := strings.TrimSpace(argsNames[1]) - - numOpenBraces := 0 - for i, c := range initial[beginning:] { - if end != 0 { - break - } - switch c { - case '}': - numOpenBraces-- - - if numOpenBraces == 0 { - end = beginning + i - } - case '{': - numOpenBraces++ - } - } - - beforePatch := initial[:end] - afterPatch := initial[end:] - - patch := fmt.Sprintf("; Object.assign(%s, window.ReactDOM)", exportsArgName) - - result := fmt.Sprintf("%s%s%s", beforePatch, patch, afterPatch) - return []byte(result), true -} - // HooksForPlugin returns the hooks API for the plugin with the given id. // // Consider using RunMultiPluginHook instead. diff --git a/plugin/environment_test.go b/server/plugin/environment_test.go similarity index 95% rename from plugin/environment_test.go rename to server/plugin/environment_test.go index 489d52ff8e..6a4afa138f 100644 --- a/plugin/environment_test.go +++ b/server/plugin/environment_test.go @@ -11,8 +11,8 @@ import ( "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) func TestAvailablePlugins(t *testing.T) { diff --git a/plugin/example_hello_world_test.go b/server/plugin/example_hello_world_test.go similarity index 92% rename from plugin/example_hello_world_test.go rename to server/plugin/example_hello_world_test.go index 59ed5a01cd..dff5c78d69 100644 --- a/plugin/example_hello_world_test.go +++ b/server/plugin/example_hello_world_test.go @@ -7,7 +7,7 @@ import ( "fmt" "net/http" - "github.com/mattermost/mattermost-server/v6/plugin" + "github.com/mattermost/mattermost-server/server/v8/plugin" ) // HelloWorldPlugin implements the interface expected by the Mattermost server to communicate diff --git a/plugin/example_help_test.go b/server/plugin/example_help_test.go similarity index 96% rename from plugin/example_help_test.go rename to server/plugin/example_help_test.go index a1e55f7b2f..9b6f08f4d8 100644 --- a/plugin/example_help_test.go +++ b/server/plugin/example_help_test.go @@ -9,8 +9,8 @@ import ( "github.com/pkg/errors" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/plugin" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/plugin" ) // configuration represents the configuration for this plugin as exposed via the Mattermost diff --git a/plugin/hclog_adapter.go b/server/plugin/hclog_adapter.go similarity index 97% rename from plugin/hclog_adapter.go rename to server/plugin/hclog_adapter.go index 3c63c66a58..b2be0eae29 100644 --- a/plugin/hclog_adapter.go +++ b/server/plugin/hclog_adapter.go @@ -11,7 +11,7 @@ import ( "github.com/hashicorp/go-hclog" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) type hclogAdapter struct { diff --git a/plugin/health_check.go b/server/plugin/health_check.go similarity index 97% rename from plugin/health_check.go rename to server/plugin/health_check.go index 38251d1c90..68ffd8b0f0 100644 --- a/plugin/health_check.go +++ b/server/plugin/health_check.go @@ -7,8 +7,8 @@ import ( "sync" "time" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) const ( diff --git a/plugin/health_check_test.go b/server/plugin/health_check_test.go similarity index 90% rename from plugin/health_check_test.go rename to server/plugin/health_check_test.go index 7a7cc872bc..36cb728545 100644 --- a/plugin/health_check_test.go +++ b/server/plugin/health_check_test.go @@ -11,9 +11,9 @@ import ( "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/utils" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/utils" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) func TestPluginHealthCheck(t *testing.T) { @@ -35,7 +35,7 @@ func testPluginHealthCheckSuccess(t *testing.T) { package main import ( - "github.com/mattermost/mattermost-server/v6/plugin" + "github.com/mattermost/mattermost-server/server/v8/plugin" ) type MyPlugin struct { @@ -73,8 +73,8 @@ func testPluginHealthCheckPanic(t *testing.T) { package main import ( - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/plugin" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/plugin" ) type MyPlugin struct { diff --git a/plugin/hijack.go b/server/plugin/hijack.go similarity index 100% rename from plugin/hijack.go rename to server/plugin/hijack.go diff --git a/plugin/hooks.go b/server/plugin/hooks.go similarity index 99% rename from plugin/hooks.go rename to server/plugin/hooks.go index a384dfbb2e..afe727d6a7 100644 --- a/plugin/hooks.go +++ b/server/plugin/hooks.go @@ -7,7 +7,7 @@ import ( "io" "net/http" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) // These assignments are part of the wire protocol used to trigger hook events in plugins. diff --git a/plugin/hooks_timer_layer_generated.go b/server/plugin/hooks_timer_layer_generated.go similarity index 98% rename from plugin/hooks_timer_layer_generated.go rename to server/plugin/hooks_timer_layer_generated.go index 6093048d54..393e6e6a91 100644 --- a/plugin/hooks_timer_layer_generated.go +++ b/server/plugin/hooks_timer_layer_generated.go @@ -11,8 +11,8 @@ import ( "net/http" timePkg "time" - "github.com/mattermost/mattermost-server/v6/server/channels/einterfaces" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/channels/einterfaces" + "github.com/mattermost/mattermost-server/server/v8/model" ) type hooksTimerLayer struct { diff --git a/plugin/http.go b/server/plugin/http.go similarity index 97% rename from plugin/http.go rename to server/plugin/http.go index ab9eab3f65..5480e4696a 100644 --- a/plugin/http.go +++ b/server/plugin/http.go @@ -12,7 +12,7 @@ import ( "net/http" "net/rpc" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) type hijackedResponse struct { diff --git a/plugin/interface_generator/main.go b/server/plugin/interface_generator/main.go similarity index 98% rename from plugin/interface_generator/main.go rename to server/plugin/interface_generator/main.go index 95996f11be..2a02c26d41 100644 --- a/plugin/interface_generator/main.go +++ b/server/plugin/interface_generator/main.go @@ -453,8 +453,8 @@ import ( "net/http" timePkg "time" - "github.com/mattermost/mattermost-server/v6/server/channels/einterfaces" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/channels/einterfaces" + "github.com/mattermost/mattermost-server/server/v8/model" ) type apiTimerLayer struct { @@ -495,8 +495,8 @@ import ( "net/http" timePkg "time" - "github.com/mattermost/mattermost-server/v6/server/channels/einterfaces" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/channels/einterfaces" + "github.com/mattermost/mattermost-server/server/v8/model" ) type hooksTimerLayer struct { @@ -676,7 +676,7 @@ func generatePluginTimerLayer(info *PluginInterfaceInfo) { } func getPluginPackageDir() string { - dirs, err := goList("github.com/mattermost/mattermost-server/v6/plugin") + dirs, err := goList("github.com/mattermost/mattermost-server/server/v8/plugin") if err != nil { panic(err) } else if len(dirs) != 1 { diff --git a/plugin/io_rpc.go b/server/plugin/io_rpc.go similarity index 100% rename from plugin/io_rpc.go rename to server/plugin/io_rpc.go diff --git a/plugin/plugintest/api.go b/server/plugin/plugintest/api.go similarity index 99% rename from plugin/plugintest/api.go rename to server/plugin/plugintest/api.go index b92bc3288d..9fa1420457 100644 --- a/plugin/plugintest/api.go +++ b/server/plugin/plugintest/api.go @@ -10,7 +10,7 @@ import ( mock "github.com/stretchr/testify/mock" - model "github.com/mattermost/mattermost-server/v6/model" + model "github.com/mattermost/mattermost-server/server/v8/model" ) // API is an autogenerated mock type for the API type diff --git a/plugin/plugintest/doc.go b/server/plugin/plugintest/doc.go similarity index 83% rename from plugin/plugintest/doc.go rename to server/plugin/plugintest/doc.go index b20f1a92c3..ebf514d766 100644 --- a/plugin/plugintest/doc.go +++ b/server/plugin/plugintest/doc.go @@ -7,5 +7,5 @@ // https://godoc.org/github.com/stretchr/testify/mock // // If you need to import the mock package, you can import it with -// "github.com/mattermost/mattermost-server/v6/plugin/plugintest/mock". +// "github.com/mattermost/mattermost-server/server/v8/plugin/plugintest/mock". package plugintest diff --git a/plugin/plugintest/driver.go b/server/plugin/plugintest/driver.go similarity index 99% rename from plugin/plugintest/driver.go rename to server/plugin/plugintest/driver.go index 398b334450..bd10226f76 100644 --- a/plugin/plugintest/driver.go +++ b/server/plugin/plugintest/driver.go @@ -9,7 +9,7 @@ import ( mock "github.com/stretchr/testify/mock" - plugin "github.com/mattermost/mattermost-server/v6/plugin" + plugin "github.com/mattermost/mattermost-server/server/v8/plugin" ) // Driver is an autogenerated mock type for the Driver type diff --git a/plugin/plugintest/example_hello_user_test.go b/server/plugin/plugintest/example_hello_user_test.go similarity index 86% rename from plugin/plugintest/example_hello_user_test.go rename to server/plugin/plugintest/example_hello_user_test.go index 2095b914d3..0c475382d2 100644 --- a/plugin/plugintest/example_hello_user_test.go +++ b/server/plugin/plugintest/example_hello_user_test.go @@ -13,9 +13,9 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/plugin" - "github.com/mattermost/mattermost-server/v6/plugin/plugintest" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/plugin" + "github.com/mattermost/mattermost-server/server/v8/plugin/plugintest" ) type HelloUserPlugin struct { diff --git a/plugin/plugintest/hooks.go b/server/plugin/plugintest/hooks.go similarity index 99% rename from plugin/plugintest/hooks.go rename to server/plugin/plugintest/hooks.go index d5550e5ba0..29900351ea 100644 --- a/plugin/plugintest/hooks.go +++ b/server/plugin/plugintest/hooks.go @@ -10,9 +10,9 @@ import ( mock "github.com/stretchr/testify/mock" - model "github.com/mattermost/mattermost-server/v6/model" + model "github.com/mattermost/mattermost-server/server/v8/model" - plugin "github.com/mattermost/mattermost-server/v6/plugin" + plugin "github.com/mattermost/mattermost-server/server/v8/plugin" ) // Hooks is an autogenerated mock type for the Hooks type diff --git a/plugin/plugintest/mock/mock.go b/server/plugin/plugintest/mock/mock.go similarity index 100% rename from plugin/plugintest/mock/mock.go rename to server/plugin/plugintest/mock/mock.go diff --git a/plugin/product.go b/server/plugin/product.go similarity index 100% rename from plugin/product.go rename to server/plugin/product.go diff --git a/plugin/product_hooks_generated.go b/server/plugin/product_hooks_generated.go similarity index 99% rename from plugin/product_hooks_generated.go rename to server/plugin/product_hooks_generated.go index d3d51a930f..b81cc632a4 100644 --- a/plugin/product_hooks_generated.go +++ b/server/plugin/product_hooks_generated.go @@ -11,7 +11,7 @@ import ( "io" "reflect" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) type OnConfigurationChangeIFace interface { diff --git a/plugin/scheduler/scheduler.go b/server/plugin/scheduler/scheduler.go similarity index 76% rename from plugin/scheduler/scheduler.go rename to server/plugin/scheduler/scheduler.go index 218d80beef..0640477a1c 100644 --- a/plugin/scheduler/scheduler.go +++ b/server/plugin/scheduler/scheduler.go @@ -6,8 +6,8 @@ package scheduler import ( "time" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/jobs" + "github.com/mattermost/mattermost-server/server/v8/channels/jobs" + "github.com/mattermost/mattermost-server/server/v8/model" ) const schedFreq = 24 * time.Hour diff --git a/plugin/scheduler/worker.go b/server/plugin/scheduler/worker.go similarity index 93% rename from plugin/scheduler/worker.go rename to server/plugin/scheduler/worker.go index 7b042130f4..a03e5795d0 100644 --- a/plugin/scheduler/worker.go +++ b/server/plugin/scheduler/worker.go @@ -4,9 +4,9 @@ package scheduler import ( - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/jobs" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/jobs" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) type AppIface interface { diff --git a/plugin/stringifier.go b/server/plugin/stringifier.go similarity index 100% rename from plugin/stringifier.go rename to server/plugin/stringifier.go diff --git a/plugin/stringifier_test.go b/server/plugin/stringifier_test.go similarity index 100% rename from plugin/stringifier_test.go rename to server/plugin/stringifier_test.go diff --git a/plugin/supervisor.go b/server/plugin/supervisor.go similarity index 95% rename from plugin/supervisor.go rename to server/plugin/supervisor.go index 5c5bd84cc3..415ee3820c 100644 --- a/plugin/supervisor.go +++ b/server/plugin/supervisor.go @@ -18,9 +18,9 @@ import ( plugin "github.com/hashicorp/go-plugin" "github.com/pkg/errors" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/einterfaces" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/einterfaces" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) type supervisor struct { diff --git a/plugin/supervisor_test.go b/server/plugin/supervisor_test.go similarity index 92% rename from plugin/supervisor_test.go rename to server/plugin/supervisor_test.go index 32d6cc6a0a..af9a55d759 100644 --- a/plugin/supervisor_test.go +++ b/server/plugin/supervisor_test.go @@ -11,9 +11,9 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/mattermost-server/v6/model" - "github.com/mattermost/mattermost-server/v6/server/channels/utils" - "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" + "github.com/mattermost/mattermost-server/server/v8/channels/utils" + "github.com/mattermost/mattermost-server/server/v8/model" + "github.com/mattermost/mattermost-server/server/v8/platform/shared/mlog" ) func TestSupervisor(t *testing.T) { diff --git a/server/scripts/config_generator/main.go b/server/scripts/config_generator/main.go index b7641cbbf0..6767d13912 100644 --- a/server/scripts/config_generator/main.go +++ b/server/scripts/config_generator/main.go @@ -8,7 +8,7 @@ import ( "fmt" "os" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" ) // generateDefaultConfig writes default config to outputFile. diff --git a/server/scripts/config_generator/main_test.go b/server/scripts/config_generator/main_test.go index 8dba358c44..da10cd3491 100644 --- a/server/scripts/config_generator/main_test.go +++ b/server/scripts/config_generator/main_test.go @@ -8,7 +8,7 @@ import ( "os" "testing" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/server/v8/model" "github.com/stretchr/testify/require" ) diff --git a/server/scripts/esrupgrades/README.md b/server/scripts/esrupgrades/README.md new file mode 100644 index 0000000000..e71dcb2487 --- /dev/null +++ b/server/scripts/esrupgrades/README.md @@ -0,0 +1 @@ +A collection of ad-hoc scripts to upgrade between ESRs. diff --git a/server/scripts/esrupgrades/esr.5.37-6.3.mysql.cleanup.sql b/server/scripts/esrupgrades/esr.5.37-6.3.mysql.cleanup.sql new file mode 100644 index 0000000000..3a13b11f83 --- /dev/null +++ b/server/scripts/esrupgrades/esr.5.37-6.3.mysql.cleanup.sql @@ -0,0 +1,160 @@ +/* Product notices are controlled externally, via the mattermost/notices repository. + When there is a new notice specified there, the server may have time, right after + the migration and before it is shut down, to download it and modify the + ProductNoticeViewState table, adding a row for all users that have not seen it or + removing old notices that no longer need to be shown. This can happen in the + UpdateProductNotices function that is executed periodically to update the notices + cache. The script will never do this, so we need to remove all rows in that table + to avoid any unwanted diff. */ +DELETE FROM ProductNoticeViewState; + +/* The script does not update the Systems row that tracks the version, so it is manually updated + here so that it does not show in the diff. */ +UPDATE Systems SET Value = '6.3.0' WHERE Name = 'Version'; + +/* The script does not update the schema_migrations table, which is automatically used by the + migrate library to track the version, so we drop it altogether to avoid spurious errors in + the diff */ +DROP TABLE IF EXISTS schema_migrations; + +/* Migration 000054_create_crt_channelmembership_count.up sets + ChannelMembers.LastUpdateAt to the results of SELECT ROUND(UNIX_TIMESTAMP(NOW(3))*1000) + which will be different each time the migration is run. Thus, the column will always be + different when comparing the server and script migrations. To bypass this, we update all + rows in ChannelMembers so that they contain the same value for such column. */ +UPDATE ChannelMembers SET LastUpdateAt = 1; + +/* Migration 000055_create_crt_thread_count_and_unreads.up sets + ThreadMemberships.LastUpdated to the results of SELECT ROUND(UNIX_TIMESTAMP(NOW(3))*1000) + which will be different each time the migration is run. Thus, the column will always be + different when comparing the server and script migrations. To bypass this, we update all + rows in ThreadMemberships so that they contain the same value for such column. */ +UPDATE ThreadMemberships SET LastUpdated = 1; + +/* The security update check in the server may update the LastSecurityTime system value. To + avoid any spurious difference in the migrations, we update it to a fixed value. */ +UPDATE Systems SET Value = 1 WHERE Name = 'LastSecurityTime'; + +/* The server migration contains an in-app migration that adds new roles for Playbooks: + doPlaybooksRolesCreationMigration, defined in https://github.com/mattermost/mattermost-server/blob/282bd351e3767dcfd8c8340da2e0915197c0dbcb/app/migrations.go#L345-L469 + The roles are the ones defined in https://github.com/mattermost/mattermost-server/blob/282bd351e3767dcfd8c8340da2e0915197c0dbcb/model/role.go#L874-L929 + When this migration finishes, it also adds a new row to the Systems table with the key of the migration. + This in-app migration does not happen in the script, so we remove those rows here. */ +DELETE FROM Roles WHERE Name = 'playbook_member'; +DELETE FROM Roles WHERE Name = 'playbook_admin'; +DELETE FROM Roles WHERE Name = 'run_member'; +DELETE FROM Roles WHERE Name = 'run_admin'; +DELETE FROM Systems WHERE Name = 'PlaybookRolesCreationMigrationComplete'; + +/* The server migration contains an in-app migration that add playbooks permissions to certain roles: + getAddPlaybooksPermissions, defined in https://github.com/mattermost/mattermost-server/blob/f9b996934cabf9a8fad5901835e7e9b418917402/app/permissions_migrations.go#L918-L951 + The specific roles ('%playbook%') are removed in the procedure below, but the migrations also add a new row to the Systems table marking the migration as complete. + This in-app migration does not happen in the script, so we remove that rows here. */ +DELETE FROM Systems WHERE Name = 'playbooks_permissions'; + +/* The rest of this script defines and executes a procedure to update the Roles table. It performs several changes: + 1. Set the UpdateAt column of all rows to a fixed value, so that the server migration changes to this column + do not appear in the diff. + 2. Remove the set of specific permissions added in the server migration that is not covered by the script, as + this logic happens all in-app after the normal DB migrations. + 3. Set a consistent order in the Permissions column, which is modelled a space-separated string containing each of + the different permissions each role has. This change is the reason why we need a complex procedure, which creates + a temporary table that pairs each single permission to its corresponding ID. So if the Roles table contains two + rows like: + Id: 'abcd' + Permissions: 'view_team read_public_channel invite_user' + Id: 'efgh' + Permissions: 'view_team create_emojis' + then the new temporary table will contain five rows like: + Id: 'abcd' + Permissions: 'view_team' + Id: 'abcd' + Permissions: 'read_public_channel' + Id: 'abcd' + Permissions: 'invite_user' + Id: 'efgh' + Permissions: 'view_team' + Id: 'efgh' + Permissions: 'create_emojis' +*/ + +DROP PROCEDURE IF EXISTS splitPermissions; +DROP PROCEDURE IF EXISTS sortAndFilterPermissionsInRoles; + +DROP TEMPORARY TABLE IF EXISTS temp_roles; +CREATE TEMPORARY TABLE temp_roles(id varchar(26), permission longtext); + +DELIMITER // + +/* Auxiliary procedure that splits the space-separated permissions string into single rows that are inserted + in the temporary temp_roles table along with their corresponding ID. */ +CREATE PROCEDURE splitPermissions( + IN id varchar(26), + IN permissionsString longtext +) +BEGIN + DECLARE idx INT DEFAULT 0; + SELECT TRIM(permissionsString) INTO permissionsString; + SELECT LOCATE(' ', permissionsString) INTO idx; + WHILE idx > 0 DO + INSERT INTO temp_roles SELECT id, TRIM(LEFT(permissionsString, idx)); + SELECT SUBSTR(permissionsString, idx+1) INTO permissionsString; + SELECT LOCATE(' ', permissionsString) INTO idx; + END WHILE; + INSERT INTO temp_roles(id, permission) VALUES(id, TRIM(permissionsString)); +END; // + +/* Main procedure that does update the Roles table */ +CREATE PROCEDURE sortAndFilterPermissionsInRoles() +BEGIN + DECLARE done INT DEFAULT FALSE; + DECLARE rolesId varchar(26) DEFAULT ''; + DECLARE rolesPermissions longtext DEFAULT ''; + DECLARE cur1 CURSOR FOR SELECT Id, Permissions FROM Roles; + DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; + + /* 1. Set a fixed value in the UpdateAt column for all rows in Roles table */ + UPDATE Roles SET UpdateAt = 1; + + /* Call splitPermissions for every row in the Roles table, thus populating the + temp_roles table. */ + OPEN cur1; + read_loop: LOOP + FETCH cur1 INTO rolesId, rolesPermissions; + IF done THEN + LEAVE read_loop; + END IF; + CALL splitPermissions(rolesId, rolesPermissions); + END LOOP; + CLOSE cur1; + + /* 2. Filter out the new permissions added by the in-app migrations */ + DELETE FROM temp_roles WHERE permission LIKE '%playbook%'; + DELETE FROM temp_roles WHERE permission LIKE 'run_create'; + DELETE FROM temp_roles WHERE permission LIKE 'run_manage_members'; + DELETE FROM temp_roles WHERE permission LIKE 'run_manage_properties'; + DELETE FROM temp_roles WHERE permission LIKE 'run_view'; + + /* Temporarily set to the maximum permitted value, since the call to group_concat + below needs a value bigger than the default */ + SET group_concat_max_len = 18446744073709551615; + + /* 3. Update the Permissions column in the Roles table with the filtered, sorted permissions, + concatenated again as a space-separated string */ + UPDATE + Roles INNER JOIN ( + SELECT temp_roles.id as Id, TRIM(group_concat(temp_roles.permission ORDER BY temp_roles.permission SEPARATOR ' ')) as Permissions + FROM Roles JOIN temp_roles ON Roles.Id = temp_roles.id + GROUP BY temp_roles.id + ) AS Sorted + ON Roles.Id = Sorted.Id + SET Roles.Permissions = Sorted.Permissions; + + /* Reset group_concat_max_len to its default value */ + SET group_concat_max_len = 1024; +END; // +DELIMITER ; + +CALL sortAndFilterPermissionsInRoles(); + +DROP TEMPORARY TABLE IF EXISTS temp_roles; diff --git a/server/scripts/esrupgrades/esr.5.37-6.3.mysql.up.sql b/server/scripts/esrupgrades/esr.5.37-6.3.mysql.up.sql new file mode 100644 index 0000000000..53c1c211fa --- /dev/null +++ b/server/scripts/esrupgrades/esr.5.37-6.3.mysql.up.sql @@ -0,0 +1,695 @@ +/* ==> mysql/000054_create_crt_channelmembership_count.up.sql <== */ +/* fixCRTChannelMembershipCounts fixes the channel counts, i.e. the total message count, +total root message count, mention count, and mention count in root messages for users +who have viewed the channel after the last post in the channel */ + +DELIMITER // +CREATE PROCEDURE MigrateCRTChannelMembershipCounts () +BEGIN + IF( + SELECT + EXISTS ( + SELECT + * FROM Systems + WHERE + Name = 'CRTChannelMembershipCountsMigrationComplete') = 0) THEN + UPDATE + ChannelMembers + INNER JOIN Channels ON Channels.Id = ChannelMembers.ChannelId SET + MentionCount = 0, MentionCountRoot = 0, MsgCount = Channels.TotalMsgCount, MsgCountRoot = Channels.TotalMsgCountRoot, LastUpdateAt = ( + SELECT + (SELECT ROUND(UNIX_TIMESTAMP(NOW(3))*1000))) + WHERE + ChannelMembers.LastViewedAt >= Channels.LastPostAt; + INSERT INTO Systems + VALUES('CRTChannelMembershipCountsMigrationComplete', 'true'); + END IF; +END// +DELIMITER ; +CALL MigrateCRTChannelMembershipCounts (); +DROP PROCEDURE IF EXISTS MigrateCRTChannelMembershipCounts; + +/* ==> mysql/000055_create_crt_thread_count_and_unreads.up.sql <== */ +/* fixCRTThreadCountsAndUnreads Marks threads as read for users where the last +reply time of the thread is earlier than the time the user viewed the channel. +Marking a thread means setting the mention count to zero and setting the +last viewed at time of the the thread as the last viewed at time +of the channel */ + +DELIMITER // +CREATE PROCEDURE MigrateCRTThreadCountsAndUnreads () +BEGIN + IF(SELECT EXISTS(SELECT * FROM Systems WHERE Name = 'CRTThreadCountsAndUnreadsMigrationComplete') = 0) THEN + UPDATE + ThreadMemberships + INNER JOIN ( + SELECT + PostId, + UserId, + ChannelMembers.LastViewedAt AS CM_LastViewedAt, + Threads.LastReplyAt + FROM + Threads + INNER JOIN ChannelMembers ON ChannelMembers.ChannelId = Threads.ChannelId + WHERE + Threads.LastReplyAt <= ChannelMembers.LastViewedAt) AS q ON ThreadMemberships.Postid = q.PostId + AND ThreadMemberships.UserId = q.UserId SET LastViewed = q.CM_LastViewedAt + 1, UnreadMentions = 0, LastUpdated = ( + SELECT + (SELECT ROUND(UNIX_TIMESTAMP(NOW(3))*1000))); + INSERT INTO Systems + VALUES('CRTThreadCountsAndUnreadsMigrationComplete', 'true'); + END IF; +END// +DELIMITER ; +CALL MigrateCRTThreadCountsAndUnreads (); +DROP PROCEDURE IF EXISTS MigrateCRTThreadCountsAndUnreads; + +/* ==> mysql/000056_upgrade_channels_v6.0.up.sql <== */ +SET @preparedStatement = (SELECT IF( + ( + SELECT COUNT(*) FROM INFORMATION_SCHEMA.STATISTICS + WHERE table_name = 'Channels' + AND table_schema = DATABASE() + AND index_name = 'idx_channels_team_id_display_name' + ) > 0, + 'SELECT 1', + 'CREATE INDEX idx_channels_team_id_display_name ON Channels(TeamId, DisplayName);' +)); + +PREPARE createIndexIfNotExists FROM @preparedStatement; +EXECUTE createIndexIfNotExists; +DEALLOCATE PREPARE createIndexIfNotExists; + +SET @preparedStatement = (SELECT IF( + ( + SELECT COUNT(*) FROM INFORMATION_SCHEMA.STATISTICS + WHERE table_name = 'Channels' + AND table_schema = DATABASE() + AND index_name = 'idx_channels_team_id_type' + ) > 0, + 'SELECT 1', + 'CREATE INDEX idx_channels_team_id_type ON Channels(TeamId, Type);' +)); + +PREPARE createIndexIfNotExists FROM @preparedStatement; +EXECUTE createIndexIfNotExists; +DEALLOCATE PREPARE createIndexIfNotExists; + +SET @preparedStatement = (SELECT IF( + ( + SELECT COUNT(*) FROM INFORMATION_SCHEMA.STATISTICS + WHERE table_name = 'Channels' + AND table_schema = DATABASE() + AND index_name = 'idx_channels_team_id' + ) > 0, + 'DROP INDEX idx_channels_team_id ON Channels;', + 'SELECT 1' +)); + +PREPARE removeIndexIfExists FROM @preparedStatement; +EXECUTE removeIndexIfExists; +DEALLOCATE PREPARE removeIndexIfExists; + +/* ==> mysql/000057_upgrade_command_webhooks_v6.0.up.sql <== */ + +DELIMITER // +CREATE PROCEDURE MigrateRootId_CommandWebhooks () BEGIN DECLARE ParentId_EXIST INT; +SELECT COUNT(*) +FROM INFORMATION_SCHEMA.COLUMNS +WHERE TABLE_NAME = 'CommandWebhooks' + AND table_schema = DATABASE() + AND COLUMN_NAME = 'ParentId' INTO ParentId_EXIST; +IF(ParentId_EXIST > 0) THEN + UPDATE CommandWebhooks SET RootId = ParentId WHERE RootId = '' AND RootId != ParentId; +END IF; +END// +DELIMITER ; +CALL MigrateRootId_CommandWebhooks (); +DROP PROCEDURE IF EXISTS MigrateRootId_CommandWebhooks; + +SET @preparedStatement = (SELECT IF( + ( + SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS + WHERE table_name = 'CommandWebhooks' + AND table_schema = DATABASE() + AND column_name = 'ParentId' + ) > 0, + 'ALTER TABLE CommandWebhooks DROP COLUMN ParentId;', + 'SELECT 1' +)); + +PREPARE alterIfExists FROM @preparedStatement; +EXECUTE alterIfExists; +DEALLOCATE PREPARE alterIfExists; + +/* ==> mysql/000058_upgrade_channelmembers_v6.0.up.sql <== */ +SET @preparedStatement = (SELECT IF( + ( + SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS + WHERE table_name = 'ChannelMembers' + AND table_schema = DATABASE() + AND column_name = 'NotifyProps' + AND column_type != 'JSON' + ) > 0, + 'ALTER TABLE ChannelMembers MODIFY COLUMN NotifyProps JSON;', + 'SELECT 1' +)); + +PREPARE alterIfExists FROM @preparedStatement; +EXECUTE alterIfExists; +DEALLOCATE PREPARE alterIfExists; + +SET @preparedStatement = (SELECT IF( + ( + SELECT COUNT(*) FROM INFORMATION_SCHEMA.STATISTICS + WHERE table_name = 'ChannelMembers' + AND table_schema = DATABASE() + AND index_name = 'idx_channelmembers_user_id' + ) > 0, + 'DROP INDEX idx_channelmembers_user_id ON ChannelMembers;', + 'SELECT 1' +)); + +PREPARE removeIndexIfExists FROM @preparedStatement; +EXECUTE removeIndexIfExists; +DEALLOCATE PREPARE removeIndexIfExists; + +SET @preparedStatement = (SELECT IF( + ( + SELECT COUNT(*) FROM INFORMATION_SCHEMA.STATISTICS + WHERE table_name = 'ChannelMembers' + AND table_schema = DATABASE() + AND index_name = 'idx_channelmembers_user_id_channel_id_last_viewed_at' + ) > 0, + 'SELECT 1', + 'CREATE INDEX idx_channelmembers_user_id_channel_id_last_viewed_at ON ChannelMembers(UserId, ChannelId, LastViewedAt);' +)); + +PREPARE createIndexIfNotExists FROM @preparedStatement; +EXECUTE createIndexIfNotExists; +DEALLOCATE PREPARE createIndexIfNotExists; + +SET @preparedStatement = (SELECT IF( + ( + SELECT COUNT(*) FROM INFORMATION_SCHEMA.STATISTICS + WHERE table_name = 'ChannelMembers' + AND table_schema = DATABASE() + AND index_name = 'idx_channelmembers_channel_id_scheme_guest_user_id' + ) > 0, + 'SELECT 1', + 'CREATE INDEX idx_channelmembers_channel_id_scheme_guest_user_id ON ChannelMembers(ChannelId, SchemeGuest, UserId);' +)); + +PREPARE createIndexIfNotExists FROM @preparedStatement; +EXECUTE createIndexIfNotExists; +DEALLOCATE PREPARE createIndexIfNotExists; + +/* ==> mysql/000059_upgrade_users_v6.0.up.sql <== */ +SET @preparedStatement = (SELECT IF( + ( + SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS + WHERE table_name = 'Users' + AND table_schema = DATABASE() + AND column_name = 'Props' + AND column_type != 'JSON' + ) > 0, + 'ALTER TABLE Users MODIFY COLUMN Props JSON;', + 'SELECT 1' +)); + +PREPARE alterIfExists FROM @preparedStatement; +EXECUTE alterIfExists; +DEALLOCATE PREPARE alterIfExists; + +SET @preparedStatement = (SELECT IF( + ( + SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS + WHERE table_name = 'Users' + AND table_schema = DATABASE() + AND column_name = 'NotifyProps' + AND column_type != 'JSON' + ) > 0, + 'ALTER TABLE Users MODIFY COLUMN NotifyProps JSON;', + 'SELECT 1' +)); + +PREPARE alterIfExists FROM @preparedStatement; +EXECUTE alterIfExists; +DEALLOCATE PREPARE alterIfExists; + +SET @preparedStatement = (SELECT IF( + ( + SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS + WHERE table_name = 'Users' + AND table_schema = DATABASE() + AND column_name = 'Timezone' + AND column_default IS NOT NULL + ) > 0, + 'ALTER TABLE Users ALTER Timezone DROP DEFAULT;', + 'SELECT 1' +)); + +PREPARE alterIfExists FROM @preparedStatement; +EXECUTE alterIfExists; +DEALLOCATE PREPARE alterIfExists; + +SET @preparedStatement = (SELECT IF( + ( + SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS + WHERE table_name = 'Users' + AND table_schema = DATABASE() + AND column_name = 'Timezone' + AND column_type != 'JSON' + ) > 0, + 'ALTER TABLE Users MODIFY COLUMN Timezone JSON;', + 'SELECT 1' +)); + +PREPARE alterIfExists FROM @preparedStatement; +EXECUTE alterIfExists; +DEALLOCATE PREPARE alterIfExists; + +SET @preparedStatement = (SELECT IF( + ( + SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS + WHERE table_name = 'Users' + AND table_schema = DATABASE() + AND column_name = 'Roles' + AND column_type != 'text' + ) > 0, + 'ALTER TABLE Users MODIFY COLUMN Roles text;', + 'SELECT 1' +)); + +PREPARE alterIfExists FROM @preparedStatement; +EXECUTE alterIfExists; +DEALLOCATE PREPARE alterIfExists; + +/* ==> mysql/000060_upgrade_jobs_v6.0.up.sql <== */ +SET @preparedStatement = (SELECT IF( + ( + SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS + WHERE table_name = 'Jobs' + AND table_schema = DATABASE() + AND column_name = 'Data' + AND column_type != 'JSON' + ) > 0, + 'ALTER TABLE Jobs MODIFY COLUMN Data JSON;', + 'SELECT 1' +)); + +PREPARE alterIfExists FROM @preparedStatement; +EXECUTE alterIfExists; +DEALLOCATE PREPARE alterIfExists; + + +/* ==> mysql/000061_upgrade_link_metadata_v6.0.up.sql <== */ + +SET @preparedStatement = (SELECT IF( + ( + SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS + WHERE table_name = 'LinkMetadata' + AND table_schema = DATABASE() + AND column_name = 'Data' + AND column_type != 'JSON' + ) > 0, + 'ALTER TABLE LinkMetadata MODIFY COLUMN Data JSON;', + 'SELECT 1' +)); + +PREPARE alterIfExists FROM @preparedStatement; +EXECUTE alterIfExists; +DEALLOCATE PREPARE alterIfExists; + +/* ==> mysql/000062_upgrade_sessions_v6.0.up.sql <== */ +SET @preparedStatement = (SELECT IF( + ( + SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS + WHERE table_name = 'Sessions' + AND table_schema = DATABASE() + AND column_name = 'Props' + AND column_type != 'JSON' + ) > 0, + 'ALTER TABLE Sessions MODIFY COLUMN Props JSON;', + 'SELECT 1' +)); + +PREPARE alterIfExists FROM @preparedStatement; +EXECUTE alterIfExists; +DEALLOCATE PREPARE alterIfExists; + + +/* ==> mysql/000063_upgrade_threads_v6.0.up.sql <== */ +SET @preparedStatement = (SELECT IF( + ( + SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS + WHERE table_name = 'Threads' + AND table_schema = DATABASE() + AND column_name = 'Participants' + AND column_type != 'JSON' + ) > 0, + 'ALTER TABLE Threads MODIFY COLUMN Participants JSON;', + 'SELECT 1' +)); + +PREPARE alterIfExists FROM @preparedStatement; +EXECUTE alterIfExists; +DEALLOCATE PREPARE alterIfExists; + +SET @preparedStatement = (SELECT IF( + ( + SELECT COUNT(*) FROM INFORMATION_SCHEMA.STATISTICS + WHERE table_name = 'Threads' + AND table_schema = DATABASE() + AND index_name = 'idx_threads_channel_id_last_reply_at' + ) > 0, + 'SELECT 1', + 'CREATE INDEX idx_threads_channel_id_last_reply_at ON Threads(ChannelId, LastReplyAt);' +)); + +PREPARE createIndexIfNotExists FROM @preparedStatement; +EXECUTE createIndexIfNotExists; +DEALLOCATE PREPARE createIndexIfNotExists; + +SET @preparedStatement = (SELECT IF( + ( + SELECT COUNT(*) FROM INFORMATION_SCHEMA.STATISTICS + WHERE table_name = 'Threads' + AND table_schema = DATABASE() + AND index_name = 'idx_threads_channel_id' + ) > 0, + 'DROP INDEX idx_threads_channel_id ON Threads;', + 'SELECT 1' +)); + +PREPARE removeIndexIfExists FROM @preparedStatement; +EXECUTE removeIndexIfExists; +DEALLOCATE PREPARE removeIndexIfExists; + +/* ==> mysql/000064_upgrade_status_v6.0.up.sql <== */ +SET @preparedStatement = (SELECT IF( + ( + SELECT COUNT(*) FROM INFORMATION_SCHEMA.STATISTICS + WHERE table_name = 'Status' + AND table_schema = DATABASE() + AND index_name = 'idx_status_status_dndendtime' + ) > 0, + 'SELECT 1', + 'CREATE INDEX idx_status_status_dndendtime ON Status(Status, DNDEndTime);' +)); + +PREPARE createIndexIfNotExists FROM @preparedStatement; +EXECUTE createIndexIfNotExists; +DEALLOCATE PREPARE createIndexIfNotExists; + +SET @preparedStatement = (SELECT IF( + ( + SELECT COUNT(*) FROM INFORMATION_SCHEMA.STATISTICS + WHERE table_name = 'Status' + AND table_schema = DATABASE() + AND index_name = 'idx_status_status' + ) > 0, + 'DROP INDEX idx_status_status ON Status;', + 'SELECT 1' +)); + +PREPARE removeIndexIfExists FROM @preparedStatement; +EXECUTE removeIndexIfExists; +DEALLOCATE PREPARE removeIndexIfExists; + +/* ==> mysql/000065_upgrade_groupchannels_v6.0.up.sql <== */ +SET @preparedStatement = (SELECT IF( + ( + SELECT COUNT(*) FROM INFORMATION_SCHEMA.STATISTICS + WHERE table_name = 'GroupChannels' + AND table_schema = DATABASE() + AND index_name = 'idx_groupchannels_schemeadmin' + ) > 0, + 'SELECT 1', + 'CREATE INDEX idx_groupchannels_schemeadmin ON GroupChannels(SchemeAdmin);' +)); + +PREPARE createIndexIfNotExists FROM @preparedStatement; +EXECUTE createIndexIfNotExists; +DEALLOCATE PREPARE createIndexIfNotExists; + +/* ==> mysql/000066_upgrade_posts_v6.0.up.sql <== */ +DELIMITER // +CREATE PROCEDURE MigrateRootId_Posts () +BEGIN +DECLARE ParentId_EXIST INT; +DECLARE Alter_FileIds INT; +DECLARE Alter_Props INT; +SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS +WHERE TABLE_NAME = 'Posts' + AND table_schema = DATABASE() + AND COLUMN_NAME = 'ParentId' INTO ParentId_EXIST; +SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS + WHERE table_name = 'Posts' + AND table_schema = DATABASE() + AND column_name = 'FileIds' + AND column_type != 'text' INTO Alter_FileIds; +SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS + WHERE table_name = 'Posts' + AND table_schema = DATABASE() + AND column_name = 'Props' + AND column_type != 'JSON' INTO Alter_Props; +IF (Alter_Props OR Alter_FileIds) THEN + IF(ParentId_EXIST > 0) THEN + UPDATE Posts SET RootId = ParentId WHERE RootId = '' AND RootId != ParentId; + ALTER TABLE Posts MODIFY COLUMN FileIds text, MODIFY COLUMN Props JSON, DROP COLUMN ParentId; + ELSE + ALTER TABLE Posts MODIFY COLUMN FileIds text, MODIFY COLUMN Props JSON; + END IF; +END IF; +END// +DELIMITER ; +CALL MigrateRootId_Posts (); +DROP PROCEDURE IF EXISTS MigrateRootId_Posts; + +SET @preparedStatement = (SELECT IF( + ( + SELECT COUNT(*) FROM INFORMATION_SCHEMA.STATISTICS + WHERE table_name = 'Posts' + AND table_schema = DATABASE() + AND index_name = 'idx_posts_root_id_delete_at' + ) > 0, + 'SELECT 1', + 'CREATE INDEX idx_posts_root_id_delete_at ON Posts(RootId, DeleteAt);' +)); + +PREPARE createIndexIfNotExists FROM @preparedStatement; +EXECUTE createIndexIfNotExists; +DEALLOCATE PREPARE createIndexIfNotExists; + +SET @preparedStatement = (SELECT IF( + ( + SELECT COUNT(*) FROM INFORMATION_SCHEMA.STATISTICS + WHERE table_name = 'Posts' + AND table_schema = DATABASE() + AND index_name = 'idx_posts_root_id' + ) > 0, + 'DROP INDEX idx_posts_root_id ON Posts;', + 'SELECT 1' +)); + +PREPARE removeIndexIfExists FROM @preparedStatement; +EXECUTE removeIndexIfExists; +DEALLOCATE PREPARE removeIndexIfExists; + +/* ==> mysql/000067_upgrade_channelmembers_v6.1.up.sql <== */ +SET @preparedStatement = (SELECT IF( + ( + SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS + WHERE table_name = 'ChannelMembers' + AND table_schema = DATABASE() + AND column_name = 'Roles' + AND column_type != 'text' + ) > 0, + 'ALTER TABLE ChannelMembers MODIFY COLUMN Roles text;', + 'SELECT 1' +)); + +PREPARE alterIfExists FROM @preparedStatement; +EXECUTE alterIfExists; +DEALLOCATE PREPARE alterIfExists; + +/* ==> mysql/000068_upgrade_teammembers_v6.1.up.sql <== */ +SET @preparedStatement = (SELECT IF( + ( + SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS + WHERE table_name = 'TeamMembers' + AND table_schema = DATABASE() + AND column_name = 'Roles' + AND column_type != 'text' + ) > 0, + 'ALTER TABLE TeamMembers MODIFY COLUMN Roles text;', + 'SELECT 1' +)); + +PREPARE alterIfExists FROM @preparedStatement; +EXECUTE alterIfExists; +DEALLOCATE PREPARE alterIfExists; + +/* ==> mysql/000069_upgrade_jobs_v6.1.up.sql <== */ +SET @preparedStatement = (SELECT IF( + ( + SELECT COUNT(*) FROM INFORMATION_SCHEMA.STATISTICS + WHERE table_name = 'Jobs' + AND table_schema = DATABASE() + AND index_name = 'idx_jobs_status_type' + ) > 0, + 'SELECT 1', + 'CREATE INDEX idx_jobs_status_type ON Jobs(Status, Type);' +)); + +PREPARE createIndexIfNotExists FROM @preparedStatement; +EXECUTE createIndexIfNotExists; +DEALLOCATE PREPARE createIndexIfNotExists; + +/* ==> mysql/000070_upgrade_cte_v6.1.up.sql <== */ +DELIMITER // +CREATE PROCEDURE Migrate_LastRootPostAt () +BEGIN +DECLARE + LastRootPostAt_EXIST INT; + SELECT + COUNT(*) + FROM + INFORMATION_SCHEMA.COLUMNS + WHERE + TABLE_NAME = 'Channels' + AND table_schema = DATABASE() + AND COLUMN_NAME = 'LastRootPostAt' INTO LastRootPostAt_EXIST; + IF(LastRootPostAt_EXIST = 0) THEN + ALTER TABLE Channels ADD COLUMN LastRootPostAt bigint DEFAULT 0; + UPDATE + Channels + INNER JOIN ( + SELECT + Channels.Id channelid, + COALESCE(MAX(Posts.CreateAt), 0) AS lastrootpost + FROM + Channels + LEFT JOIN Posts FORCE INDEX (idx_posts_channel_id_update_at) ON Channels.Id = Posts.ChannelId + WHERE + Posts.RootId = '' + GROUP BY + Channels.Id) AS q ON q.channelid = Channels.Id SET LastRootPostAt = lastrootpost; + END IF; +END// +DELIMITER ; +CALL Migrate_LastRootPostAt (); +DROP PROCEDURE IF EXISTS Migrate_LastRootPostAt; + +/* ==> mysql/000071_upgrade_sessions_v6.1.up.sql <== */ +SET @preparedStatement = (SELECT IF( + ( + SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS + WHERE table_name = 'Sessions' + AND table_schema = DATABASE() + AND column_name = 'Roles' + AND column_type != 'text' + ) > 0, + 'ALTER TABLE Sessions MODIFY COLUMN Roles text;', + 'SELECT 1' +)); + +PREPARE alterIfExists FROM @preparedStatement; +EXECUTE alterIfExists; +DEALLOCATE PREPARE alterIfExists; + +/* ==> mysql/000072_upgrade_schemes_v6.3.up.sql <== */ +SET @preparedStatement = (SELECT IF( + ( + SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS + WHERE table_name = 'Schemes' + AND table_schema = DATABASE() + AND column_name = 'DefaultPlaybookAdminRole' + ) > 0, + 'SELECT 1', + 'ALTER TABLE Schemes ADD COLUMN DefaultPlaybookAdminRole VARCHAR(64) DEFAULT "";' +)); + +PREPARE alterIfNotExists FROM @preparedStatement; +EXECUTE alterIfNotExists; +DEALLOCATE PREPARE alterIfNotExists; + +SET @preparedStatement = (SELECT IF( + ( + SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS + WHERE table_name = 'Schemes' + AND table_schema = DATABASE() + AND column_name = 'DefaultPlaybookMemberRole' + ) > 0, + 'SELECT 1', + 'ALTER TABLE Schemes ADD COLUMN DefaultPlaybookMemberRole VARCHAR(64) DEFAULT "";' +)); + +PREPARE alterIfNotExists FROM @preparedStatement; +EXECUTE alterIfNotExists; +DEALLOCATE PREPARE alterIfNotExists; + +SET @preparedStatement = (SELECT IF( + ( + SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS + WHERE table_name = 'Schemes' + AND table_schema = DATABASE() + AND column_name = 'DefaultRunAdminRole' + ) > 0, + 'SELECT 1', + 'ALTER TABLE Schemes ADD COLUMN DefaultRunAdminRole VARCHAR(64) DEFAULT "";' +)); + +PREPARE alterIfNotExists FROM @preparedStatement; +EXECUTE alterIfNotExists; +DEALLOCATE PREPARE alterIfNotExists; + +SET @preparedStatement = (SELECT IF( + ( + SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS + WHERE table_name = 'Schemes' + AND table_schema = DATABASE() + AND column_name = 'DefaultRunMemberRole' + ) > 0, + 'SELECT 1', + 'ALTER TABLE Schemes ADD COLUMN DefaultRunMemberRole VARCHAR(64) DEFAULT "";' +)); + +PREPARE alterIfNotExists FROM @preparedStatement; +EXECUTE alterIfNotExists; +DEALLOCATE PREPARE alterIfNotExists; + +/* ==> mysql/000073_upgrade_plugin_key_value_store_v6.3.up.sql <== */ +SET @preparedStatement = (SELECT IF( + ( + SELECT Count(*) FROM Information_Schema.Columns + WHERE table_name = 'PluginKeyValueStore' + AND table_schema = DATABASE() + AND column_name = 'PKey' + AND column_type != 'varchar(150)' + ) > 0, + 'ALTER TABLE PluginKeyValueStore MODIFY COLUMN PKey varchar(150);', + 'SELECT 1' +)); + +PREPARE alterTypeIfExists FROM @preparedStatement; +EXECUTE alterTypeIfExists; +DEALLOCATE PREPARE alterTypeIfExists; + +/* ==> mysql/000074_upgrade_users_v6.3.up.sql <== */ + +SET @preparedStatement = (SELECT IF( + ( + SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS + WHERE table_name = 'Users' + AND table_schema = DATABASE() + AND column_name = 'AcceptedTermsOfServiceId' + ) > 0, + 'ALTER TABLE Users DROP COLUMN AcceptedTermsOfServiceId;', + 'SELECT 1' +)); + +PREPARE alterIfExists FROM @preparedStatement; +EXECUTE alterIfExists; +DEALLOCATE PREPARE alterIfExists; diff --git a/server/scripts/esrupgrades/esr.5.37-7.8.mysql.cleanup.sql b/server/scripts/esrupgrades/esr.5.37-7.8.mysql.cleanup.sql new file mode 100644 index 0000000000..4c23874cb1 --- /dev/null +++ b/server/scripts/esrupgrades/esr.5.37-7.8.mysql.cleanup.sql @@ -0,0 +1,199 @@ +/* Product notices are controlled externally, via the mattermost/notices repository. + When there is a new notice specified there, the server may have time, right after + the migration and before it is shut down, to download it and modify the + ProductNoticeViewState table, adding a row for all users that have not seen it or + removing old notices that no longer need to be shown. This can happen in the + UpdateProductNotices function that is executed periodically to update the notices + cache. The script will never do this, so we need to remove all rows in that table + to avoid any unwanted diff. */ +DELETE FROM ProductNoticeViewState; + +/* Remove migration-related tables that are only updated through the server to track which + migrations have been applied */ +DROP TABLE IF EXISTS db_lock; +DROP TABLE IF EXISTS db_migrations; + +/* Migration 000054_create_crt_channelmembership_count.up sets + ChannelMembers.LastUpdateAt to the results of SELECT ROUND(UNIX_TIMESTAMP(NOW(3))*1000) + which will be different each time the migration is run. Thus, the column will always be + different when comparing the server and script migrations. To bypass this, we update all + rows in ChannelMembers so that they contain the same value for such column. */ +UPDATE ChannelMembers SET LastUpdateAt = 1; + +/* Migration 000055_create_crt_thread_count_and_unreads.up sets + ThreadMemberships.LastUpdated to the results of SELECT ROUND(UNIX_TIMESTAMP(NOW(3))*1000) + which will be different each time the migration is run. Thus, the column will always be + different when comparing the server and script migrations. To bypass this, we update all + rows in ThreadMemberships so that they contain the same value for such column. */ +UPDATE ThreadMemberships SET LastUpdated = 1; + +/* The security update check in the server may update the LastSecurityTime system value. To + avoid any spurious difference in the migrations, we update it to a fixed value. */ +UPDATE Systems SET Value = 1 WHERE Name = 'LastSecurityTime'; + +/* The server migration may contain a row in the Systems table marking the onboarding as complete. + There are no migrations related to this, so we can simply drop it here. */ +DELETE FROM Systems WHERE Name = 'FirstAdminSetupComplete'; + +/* The server migration contains an in-app migration that adds new roles for Playbooks: + doPlaybooksRolesCreationMigration, defined in https://github.com/mattermost/mattermost-server/blob/282bd351e3767dcfd8c8340da2e0915197c0dbcb/app/migrations.go#L345-L469 + The roles are the ones defined in https://github.com/mattermost/mattermost-server/blob/282bd351e3767dcfd8c8340da2e0915197c0dbcb/model/role.go#L874-L929 + When this migration finishes, it also adds a new row to the Systems table with the key of the migration. + This in-app migration does not happen in the script, so we remove those rows here. */ +DELETE FROM Roles WHERE Name = 'playbook_member'; +DELETE FROM Roles WHERE Name = 'playbook_admin'; +DELETE FROM Roles WHERE Name = 'run_member'; +DELETE FROM Roles WHERE Name = 'run_admin'; +DELETE FROM Systems WHERE Name = 'PlaybookRolesCreationMigrationComplete'; + +/* The server migration contains two in-app migrations that add playbooks permissions to certain roles: + getAddPlaybooksPermissions and getPlaybooksPermissionsAddManageRoles, defined in https://github.com/mattermost/mattermost-server/blob/282bd351e3767dcfd8c8340da2e0915197c0dbcb/app/permissions_migrations.go#L1021-L1072 + The specific roles ('%playbook%') are removed in the procedure below, but the migrations also add new rows to the Systems table marking the migrations as complete. + These in-app migrations do not happen in the script, so we remove those rows here. */ +DELETE FROM Systems WHERE Name = 'playbooks_manage_roles'; +DELETE FROM Systems WHERE Name = 'playbooks_permissions'; + +/* The server migration contains an in-app migration that adds boards permissions to certain roles: + getProductsBoardsPermissions, defined in https://github.com/mattermost/mattermost-server/blob/282bd351e3767dcfd8c8340da2e0915197c0dbcb/app/permissions_migrations.go#L1074-L1093 + The specific roles (sysconsole_read_product_boards and sysconsole_write_product_boards) are removed in the procedure below, + but the migrations also adds a new row to the Systems table marking the migrations as complete. + This in-app migration does not happen in the script, so we remove that row here. */ +DELETE FROM Systems WHERE Name = 'products_boards'; + +/* TODO: REVIEW STARTING HERE */ + +/* The server migration contain an in-app migration that adds Ids to the Teams whose InviteId is an empty string: + doRemainingSchemaMigrations, defined in https://github.com/mattermost/mattermost-server/blob/282bd351e3767dcfd8c8340da2e0915197c0dbcb/app/migrations.go#L515-L540 + The migration is not replicated in the script, since it happens in-app, but the server adds a new row to the + Systems table marking the table as complete, which the script doesn't do, so we remove that row here. */ +DELETE FROM Systems WHERE Name = 'RemainingSchemaMigrations'; + +/* The server migration contains three in-app migration that adds a new role and new permissions + related to custom groups. The migrations are: + - doCustomGroupAdminRoleCreationMigration https://github.com/mattermost/mattermost-server/blob/282bd351e3767dcfd8c8340da2e0915197c0dbcb/app/migrations.go#L345-L469 + - getAddCustomUserGroupsPermissions https://github.com/mattermost/mattermost-server/blob/282bd351e3767dcfd8c8340da2e0915197c0dbcb/app/permissions_migrations.go#L974-L995 + - getAddCustomUserGroupsPermissionRestore https://github.com/mattermost/mattermost-server/blob/282bd351e3767dcfd8c8340da2e0915197c0dbcb/app/permissions_migrations.go#L997-L1019 + The specific roles and permissions are removed in the procedure below, but the migrations also + adds a new row to the Roles table for the new role and new rows to the Systems table marking the + migrations as complete. + This in-app migration does not happen in the script, so we remove that row here. */ +DELETE FROM Roles WHERE Name = 'system_custom_group_admin'; +DELETE FROM Systems WHERE Name = 'CustomGroupAdminRoleCreationMigrationComplete'; +DELETE FROM Systems WHERE Name = 'custom_groups_permissions'; +DELETE FROM Systems WHERE Name = 'custom_groups_permission_restore'; + +/* The server migration contains an in-app migration that updates the config, setting ServiceSettings.PostPriority + to true, doPostPriorityConfigDefaultTrueMigration, defined in https://github.com/mattermost/mattermost-server/blob/282bd351e3767dcfd8c8340da2e0915197c0dbcb/app/migrations.go#L542-L560 + The migration is not replicated in the script, since it happens in-app, but the server adds a new row to the + Systems table marking the table as complete, which the script doesn't do, so we remove that row here. */ +DELETE FROM Systems WHERE Name = 'PostPriorityConfigDefaultTrueMigrationComplete'; + +/* The rest of this script defines and executes a procedure to update the Roles table. It performs several changes: + 1. Set the UpdateAt column of all rows to a fixed value, so that the server migration changes to this column + do not appear in the diff. + 2. Remove the set of specific permissions added in the server migration that is not covered by the script, as + this logic happens all in-app after the normal DB migrations. + 3. Set a consistent order in the Permissions column, which is modelled a space-separated string containing each of + the different permissions each role has. This change is the reason why we need a complex procedure, which creates + a temporary table that pairs each single permission to its corresponding ID. So if the Roles table contains two + rows like: + Id: 'abcd' + Permissions: 'view_team read_public_channel invite_user' + Id: 'efgh' + Permissions: 'view_team create_emojis' + then the new temporary table will contain five rows like: + Id: 'abcd' + Permissions: 'view_team' + Id: 'abcd' + Permissions: 'read_public_channel' + Id: 'abcd' + Permissions: 'invite_user' + Id: 'efgh' + Permissions: 'view_team' + Id: 'efgh' + Permissions: 'create_emojis' +*/ + +DROP PROCEDURE IF EXISTS splitPermissions; +DROP PROCEDURE IF EXISTS sortAndFilterPermissionsInRoles; + +DROP TEMPORARY TABLE IF EXISTS temp_roles; +CREATE TEMPORARY TABLE temp_roles(id varchar(26), permission longtext); + +DELIMITER // + +/* Auxiliary procedure that splits the space-separated permissions string into single rows that are inserted + in the temporary temp_roles table along with their corresponding ID. */ +CREATE PROCEDURE splitPermissions( + IN id varchar(26), + IN permissionsString longtext +) +BEGIN + DECLARE idx INT DEFAULT 0; + SELECT TRIM(permissionsString) INTO permissionsString; + SELECT LOCATE(' ', permissionsString) INTO idx; + WHILE idx > 0 DO + INSERT INTO temp_roles SELECT id, TRIM(LEFT(permissionsString, idx)); + SELECT SUBSTR(permissionsString, idx+1) INTO permissionsString; + SELECT LOCATE(' ', permissionsString) INTO idx; + END WHILE; + INSERT INTO temp_roles(id, permission) VALUES(id, TRIM(permissionsString)); +END; // + +/* Main procedure that does update the Roles table */ +CREATE PROCEDURE sortAndFilterPermissionsInRoles() +BEGIN + DECLARE done INT DEFAULT FALSE; + DECLARE rolesId varchar(26) DEFAULT ''; + DECLARE rolesPermissions longtext DEFAULT ''; + DECLARE cur1 CURSOR FOR SELECT Id, Permissions FROM Roles; + DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; + + /* 1. Set a fixed value in the UpdateAt column for all rows in Roles table */ + UPDATE Roles SET UpdateAt = 1; + + /* Call splitPermissions for every row in the Roles table, thus populating the + temp_roles table. */ + OPEN cur1; + read_loop: LOOP + FETCH cur1 INTO rolesId, rolesPermissions; + IF done THEN + LEAVE read_loop; + END IF; + CALL splitPermissions(rolesId, rolesPermissions); + END LOOP; + CLOSE cur1; + + /* 2. Filter out the new permissions added by the in-app migrations */ + DELETE FROM temp_roles WHERE permission LIKE 'sysconsole_read_products_boards'; + DELETE FROM temp_roles WHERE permission LIKE 'sysconsole_write_products_boards'; + DELETE FROM temp_roles WHERE permission LIKE '%playbook%'; + DELETE FROM temp_roles WHERE permission LIKE 'run_create'; + DELETE FROM temp_roles WHERE permission LIKE 'run_manage_members'; + DELETE FROM temp_roles WHERE permission LIKE 'run_manage_properties'; + DELETE FROM temp_roles WHERE permission LIKE 'run_view'; + DELETE FROM temp_roles WHERE permission LIKE '%custom_group%'; + + /* Temporarily set to the maximum permitted value, since the call to group_concat + below needs a value bigger than the default */ + SET group_concat_max_len = 18446744073709551615; + + /* 3. Update the Permissions column in the Roles table with the filtered, sorted permissions, + concatenated again as a space-separated string */ + UPDATE + Roles INNER JOIN ( + SELECT temp_roles.id as Id, TRIM(group_concat(temp_roles.permission ORDER BY temp_roles.permission SEPARATOR ' ')) as Permissions + FROM Roles JOIN temp_roles ON Roles.Id = temp_roles.id + GROUP BY temp_roles.id + ) AS Sorted + ON Roles.Id = Sorted.Id + SET Roles.Permissions = Sorted.Permissions; + + /* Reset group_concat_max_len to its default value */ + SET group_concat_max_len = 1024; +END; // +DELIMITER ; + +CALL sortAndFilterPermissionsInRoles(); + +DROP TEMPORARY TABLE IF EXISTS temp_roles; diff --git a/server/scripts/esrupgrades/esr.5.37-7.8.mysql.up.sql b/server/scripts/esrupgrades/esr.5.37-7.8.mysql.up.sql new file mode 100644 index 0000000000..63e5899860 --- /dev/null +++ b/server/scripts/esrupgrades/esr.5.37-7.8.mysql.up.sql @@ -0,0 +1,1385 @@ +/* ==> mysql/000041_create_upload_sessions.up.sql <== */ +/* Release 5.37 was meant to contain the index idx_uploadsessions_type, but a bug prevented that. + This part of the migration #41 adds such index */ +/* ==> mysql/000075_alter_upload_sessions_index.up.sql <== */ +/* ==> mysql/000090_create_enums.up.sql <== */ +DELIMITER // +CREATE PROCEDURE MigrateUploadSessions () +BEGIN + -- 'CREATE INDEX idx_uploadsessions_type ON UploadSessions(Type);' + DECLARE CreateIndex BOOLEAN; + DECLARE CreateIndexQuery TEXT DEFAULT NULL; + + -- 'DROP INDEX idx_uploadsessions_user_id ON UploadSessions; CREATE INDEX idx_uploadsessions_user_id ON UploadSessions(UserId);' + DECLARE AlterIndex BOOLEAN; + DECLARE AlterIndexQuery TEXT DEFAULT NULL; + + -- 'ALTER TABLE UploadSessions MODIFY COLUMN Type ENUM("attachment", "import");' + DECLARE AlterColumn BOOLEAN; + DECLARE AlterColumnQuery TEXT DEFAULT NULL; + + SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.STATISTICS + WHERE table_name = 'UploadSessions' + AND table_schema = DATABASE() + AND index_name = 'idx_uploadsessions_type' + INTO CreateIndex; + + SELECT IFNULL(GROUP_CONCAT(column_name ORDER BY seq_in_index), '') = 'Type' FROM information_schema.statistics + WHERE table_name = 'UploadSessions' + AND table_schema = DATABASE() + AND index_name = 'idx_uploadsessions_user_id' + GROUP BY index_name + INTO AlterIndex; + + SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS + WHERE table_name = 'UploadSessions' + AND table_schema = DATABASE() + AND column_name = 'Type' + AND REPLACE(LOWER(column_type), '"', "'") != "enum('attachment','import')" + INTO AlterColumn; + + IF CreateIndex THEN + SET CreateIndexQuery = 'ADD INDEX idx_uploadsessions_type (Type)'; + END IF; + + IF AlterIndex THEN + SET AlterIndexQuery = 'DROP INDEX idx_uploadsessions_user_id, ADD INDEX idx_uploadsessions_user_id (UserId)'; + END IF; + + IF AlterColumn THEN + SET AlterColumnQuery = 'MODIFY COLUMN Type ENUM("attachment", "import")'; + END IF; + + SET @alterQuery = CONCAT_WS(', ', CreateIndexQuery, AlterIndexQuery, AlterColumnQuery); + IF @alterQuery <> '' THEN + SET @query = CONCAT('ALTER TABLE UploadSessions ', @alterQuery); + PREPARE stmt FROM @query; + EXECUTE stmt; + DEALLOCATE PREPARE stmt; + END IF; +END// +DELIMITER ; +SELECT CONCAT('-- ', NOW(), ' MigrateUploadSessions procedure starting.') AS DEBUG; +CALL MigrateUploadSessions(); +SELECT CONCAT('-- ', NOW(), ' MigrateUploadSessions procedure finished.') AS DEBUG; +DROP PROCEDURE IF EXISTS MigrateUploadSessions; + +/* ==> mysql/000055_create_crt_thread_count_and_unreads.up.sql <== */ +/* fixCRTThreadCountsAndUnreads Marks threads as read for users where the last +reply time of the thread is earlier than the time the user viewed the channel. +Marking a thread means setting the mention count to zero and setting the +last viewed at time of the the thread as the last viewed at time +of the channel */ +DELIMITER // +CREATE PROCEDURE MigrateThreadMemberships () +BEGIN + -- UPDATE ThreadMemberships SET LastViewed = ..., UnreadMentions = ..., LastUpdated = ... + DECLARE UpdateThreadMemberships BOOLEAN; + DECLARE UpdateThreadMembershipsQuery TEXT DEFAULT NULL; + + SELECT COUNT(*) = 0 FROM Systems + WHERE Name = 'CRTThreadCountsAndUnreadsMigrationComplete' + INTO UpdateThreadMemberships; + + IF UpdateThreadMemberships THEN + UPDATE ThreadMemberships INNER JOIN ( + SELECT PostId, UserId, ChannelMembers.LastViewedAt AS CM_LastViewedAt, Threads.LastReplyAt + FROM Threads INNER JOIN ChannelMembers ON ChannelMembers.ChannelId = Threads.ChannelId + WHERE Threads.LastReplyAt <= ChannelMembers.LastViewedAt + ) AS q ON ThreadMemberships.Postid = q.PostId AND ThreadMemberships.UserId = q.UserId + SET LastViewed = q.CM_LastViewedAt + 1, UnreadMentions = 0, LastUpdated = (SELECT (SELECT ROUND(UNIX_TIMESTAMP(NOW(3))*1000))); + INSERT INTO Systems VALUES('CRTThreadCountsAndUnreadsMigrationComplete', 'true'); + END IF; +END// +DELIMITER ; +SELECT CONCAT('-- ', NOW(), ' MigrateThreadMemberships procedure starting.') AS DEBUG; +CALL MigrateThreadMemberships(); +SELECT CONCAT('-- ', NOW(), ' MigrateThreadMemberships procedure finished.') AS DEBUG; +DROP PROCEDURE IF EXISTS MigrateThreadMemberships; + +/* ==> mysql/000056_upgrade_channels_v6.0.up.sql <== */ +/* ==> mysql/000070_upgrade_cte_v6.1.up.sql <== */ +/* ==> mysql/000090_create_enums.up.sql <== */ +/* ==> mysql/000076_upgrade_lastrootpostat.up.sql <== */ +DELIMITER // +CREATE PROCEDURE MigrateChannels () +BEGIN + -- 'DROP INDEX idx_channels_team_id ON Channels;' + DECLARE DropIndex BOOLEAN; + DECLARE DropIndexQuery TEXT DEFAULT NULL; + + -- 'CREATE INDEX idx_channels_team_id_display_name ON Channels(TeamId, DisplayName);' + DECLARE CreateIndexTeamDisplay BOOLEAN; + DECLARE CreateIndexTeamDisplayQuery TEXT DEFAULT NULL; + + -- 'CREATE INDEX idx_channels_team_id_type ON Channels(TeamId, Type);' + DECLARE CreateIndexTeamType BOOLEAN; + DECLARE CreateIndexTeamTypeQuery TEXT DEFAULT NULL; + + -- 'ALTER TABLE Channels ADD COLUMN LastRootPostAt bigint DEFAULT 0;'' + -- UPDATE Channels INNER JOIN ... + DECLARE AddLastRootPostAt BOOLEAN; + DECLARE AddLastRootPostAtQuery TEXT DEFAULT NULL; + + -- 'ALTER TABLE Channels MODIFY COLUMN Type ENUM("D", "O", "G", "P");', + DECLARE ModifyColumn BOOLEAN; + DECLARE ModifyColumnQuery TEXT DEFAULT NULL; + + -- 'ALTER TABLE Channels ALTER COLUMN LastRootPostAt SET DEFAULT 0;', + DECLARE SetDefault BOOLEAN; + DECLARE SetDefaultQuery TEXT DEFAULT NULL; + + -- 'UPDATE Channels SET LastRootPostAt = ...', + DECLARE UpdateLastRootPostAt BOOLEAN; + DECLARE UpdateLastRootPostAtQuery TEXT DEFAULT NULL; + + SELECT COUNT(*) FROM INFORMATION_SCHEMA.STATISTICS + WHERE table_name = 'Channels' + AND table_schema = DATABASE() + AND index_name = 'idx_channels_team_id' + INTO DropIndex; + + SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.STATISTICS + WHERE table_name = 'Channels' + AND table_schema = DATABASE() + AND index_name = 'idx_channels_team_id_display_name' + INTO CreateIndexTeamDisplay; + + SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.STATISTICS + WHERE table_name = 'Channels' + AND table_schema = DATABASE() + AND index_name = 'idx_channels_team_id_type' + INTO CreateIndexTeamType; + + SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.COLUMNS + WHERE TABLE_NAME = 'Channels' + AND table_schema = DATABASE() + AND COLUMN_NAME = 'LastRootPostAt' + INTO AddLastRootPostAt; + + SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS + WHERE table_name = 'Channels' + AND table_schema = DATABASE() + AND column_name = 'Type' + AND REPLACE(LOWER(column_type), '"', "'") != "enum('d','o','g','p')" + INTO ModifyColumn; + + SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS + WHERE TABLE_NAME = 'Channels' + AND TABLE_SCHEMA = DATABASE() + AND COLUMN_NAME = 'LastRootPostAt' + AND (COLUMN_DEFAULT IS NULL OR COLUMN_DEFAULT != 0) + INTO SetDefault; + + IF DropIndex THEN + SET DropIndexQuery = 'DROP INDEX idx_channels_team_id'; + END IF; + + IF CreateIndexTeamDisplay THEN + SET CreateIndexTeamDisplayQuery = 'ADD INDEX idx_channels_team_id_display_name (TeamId, DisplayName)'; + END IF; + + IF CreateIndexTeamType THEN + SET CreateIndexTeamTypeQuery = 'ADD INDEX idx_channels_team_id_type (TeamId, Type)'; + END IF; + + IF AddLastRootPostAt THEN + SET AddLastRootPostAtQuery = 'ADD COLUMN LastRootPostAt bigint DEFAULT 0'; + END IF; + + IF ModifyColumn THEN + SET ModifyColumnQuery = 'MODIFY COLUMN Type ENUM("D", "O", "G", "P")'; + END IF; + + IF SetDefault THEN + SET SetDefaultQuery = 'ALTER COLUMN LastRootPostAt SET DEFAULT 0'; + END IF; + + SET @alterQuery = CONCAT_WS(', ', DropIndexQuery, CreateIndexTeamDisplayQuery, CreateIndexTeamTypeQuery, AddLastRootPostAtQuery, ModifyColumnQuery, SetDefaultQuery); + IF @alterQuery <> '' THEN + SET @query = CONCAT('ALTER TABLE Channels ', @alterQuery); + PREPARE stmt FROM @query; + EXECUTE stmt; + DEALLOCATE PREPARE stmt; + END IF; + + IF AddLastRootPostAt THEN + UPDATE Channels INNER JOIN ( + SELECT Channels.Id channelid, COALESCE(MAX(Posts.CreateAt), 0) AS lastrootpost + FROM Channels LEFT JOIN Posts FORCE INDEX (idx_posts_channel_id_update_at) ON Channels.Id = Posts.ChannelId + WHERE Posts.RootId = '' GROUP BY Channels.Id + ) AS q ON q.channelid = Channels.Id + SET LastRootPostAt = lastrootpost; + END IF; + + -- Cover the case where LastRootPostAt was already present and there are rows with it set to NULL + IF (SELECT COUNT(*) FROM Channels WHERE LastRootPostAt IS NULL) THEN + -- fixes migrate cte and sets the LastRootPostAt for channels that don't have it set + UPDATE Channels INNER JOIN ( + SELECT Channels.Id channelid, COALESCE(MAX(Posts.CreateAt), 0) AS lastrootpost + FROM Channels LEFT JOIN Posts FORCE INDEX (idx_posts_channel_id_update_at) ON Channels.Id = Posts.ChannelId + WHERE Posts.RootId = '' + GROUP BY Channels.Id + ) AS q ON q.channelid = Channels.Id + SET LastRootPostAt = lastrootpost + WHERE LastRootPostAt IS NULL; + -- sets LastRootPostAt to 0, for channels with no posts + UPDATE Channels SET LastRootPostAt=0 WHERE LastRootPostAt IS NULL; + END IF; + +END// +DELIMITER ; + +SELECT CONCAT('-- ', NOW(), ' MigrateChannels procedure starting.') AS DEBUG; +CALL MigrateChannels(); +SELECT CONCAT('-- ', NOW(), ' MigrateChannels procedure finished.') AS DEBUG; +DROP PROCEDURE IF EXISTS MigrateChannels; + +/* ==> mysql/000057_upgrade_command_webhooks_v6.0.up.sql <== */ +DELIMITER // +CREATE PROCEDURE MigrateCommandWebhooks () +BEGIN + DECLARE DropParentId BOOLEAN; + + SELECT COUNT(*) + FROM INFORMATION_SCHEMA.COLUMNS + WHERE TABLE_NAME = 'CommandWebhooks' + AND table_schema = DATABASE() + AND COLUMN_NAME = 'ParentId' + INTO DropParentId; + + IF DropParentId THEN + UPDATE CommandWebhooks SET RootId = ParentId WHERE RootId = '' AND RootId != ParentId; + ALTER TABLE CommandWebhooks DROP COLUMN ParentId; + END IF; +END// +DELIMITER ; +SELECT CONCAT('-- ', NOW(), ' MigrateCommandWebhooks procedure starting.') AS DEBUG; +CALL MigrateCommandWebhooks(); +SELECT CONCAT('-- ', NOW(), ' MigrateCommandWebhooks procedure finished.') AS DEBUG; +DROP PROCEDURE IF EXISTS MigrateCommandWebhooks; + +/* ==> mysql/000054_create_crt_channelmembership_count.up.sql <== */ +/* ==> mysql/000058_upgrade_channelmembers_v6.0.up.sql <== */ +/* ==> mysql/000067_upgrade_channelmembers_v6.1.up.sql <== */ +/* ==> mysql/000097_create_posts_priority.up.sql <== */ +DELIMITER // +CREATE PROCEDURE MigrateChannelMembers () +BEGIN + -- 'ALTER TABLE ChannelMembers MODIFY COLUMN NotifyProps JSON;', + DECLARE ModifyNotifyProps BOOLEAN; + DECLARE ModifyNotifyPropsQuery TEXT DEFAULT NULL; + + -- 'DROP INDEX idx_channelmembers_user_id ON ChannelMembers;', + DECLARE DropIndex BOOLEAN; + DECLARE DropIndexQuery TEXT DEFAULT NULL; + + -- 'CREATE INDEX idx_channelmembers_user_id_channel_id_last_viewed_at ON ChannelMembers(UserId, ChannelId, LastViewedAt);' + DECLARE CreateIndexLastViewedAt BOOLEAN; + DECLARE CreateIndexLastViewedAtQuery TEXT DEFAULT NULL; + + -- 'CREATE INDEX idx_channelmembers_channel_id_scheme_guest_user_id ON ChannelMembers(ChannelId, SchemeGuest, UserId);' + DECLARE CreateIndexSchemeGuest BOOLEAN; + DECLARE CreateIndexSchemeGuestQuery TEXT DEFAULT NULL; + + -- 'ALTER TABLE ChannelMembers MODIFY COLUMN Roles text;', + DECLARE ModifyRoles BOOLEAN; + DECLARE ModifyRolesQuery TEXT DEFAULT NOT NULL; + + -- 'ALTER TABLE ChannelMembers ADD COLUMN UrgentMentionCount bigint(20);', + DECLARE AddUrgentMentionCount BOOLEAN; + DECLARE AddUrgentMentionCountQuery TEXT DEFAULT NOT NULL; + + DECLARE MigrateMemberships BOOLEAN; + + SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS + WHERE table_name = 'ChannelMembers' + AND table_schema = DATABASE() + AND column_name = 'NotifyProps' + AND LOWER(column_type) != 'json' + INTO ModifyNotifyProps; + + SELECT COUNT(*) FROM INFORMATION_SCHEMA.STATISTICS + WHERE table_name = 'ChannelMembers' + AND table_schema = DATABASE() + AND index_name = 'idx_channelmembers_user_id' + INTO DropIndex; + + SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.STATISTICS + WHERE table_name = 'ChannelMembers' + AND table_schema = DATABASE() + AND index_name = 'idx_channelmembers_user_id_channel_id_last_viewed_at' + INTO CreateIndexLastViewedAt; + + SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.STATISTICS + WHERE table_name = 'ChannelMembers' + AND table_schema = DATABASE() + AND index_name = 'idx_channelmembers_channel_id_scheme_guest_user_id' + INTO CreateIndexSchemeGuest; + + SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS + WHERE table_name = 'ChannelMembers' + AND table_schema = DATABASE() + AND column_name = 'Roles' + AND LOWER(column_type) != 'text' + INTO ModifyRoles; + + SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.COLUMNS + WHERE table_name = 'ChannelMembers' + AND table_schema = DATABASE() + AND column_name = 'UrgentMentionCount' + INTO AddUrgentMentionCount; + + SELECT COUNT(*) = 0 FROM Systems + WHERE Name = 'CRTChannelMembershipCountsMigrationComplete' + INTO MigrateMemberships; + + IF ModifyNotifyProps THEN + SET ModifyNotifyPropsQuery = 'MODIFY COLUMN NotifyProps JSON'; + END IF; + + IF DropIndex THEN + SET DropIndexQuery = 'DROP INDEX idx_channelmembers_user_id'; + END IF; + + IF CreateIndexLastViewedAt THEN + SET CreateIndexLastViewedAtQuery = 'ADD INDEX idx_channelmembers_user_id_channel_id_last_viewed_at (UserId, ChannelId, LastViewedAt)'; + END IF; + + IF CreateIndexSchemeGuest THEN + SET CreateIndexSchemeGuestQuery = 'ADD INDEX idx_channelmembers_channel_id_scheme_guest_user_id (ChannelId, SchemeGuest, UserId)'; + END IF; + + IF ModifyRoles THEN + SET ModifyRolesQuery = 'MODIFY COLUMN Roles text'; + END IF; + + IF AddUrgentMentionCount THEN + SET AddUrgentMentionCountQuery = 'ADD COLUMN UrgentMentionCount bigint(20)'; + END IF; + + SET @alterQuery = CONCAT_WS(', ', ModifyNotifyPropsQuery, DropIndexQuery, CreateIndexLastViewedAtQuery, CreateIndexSchemeGuestQuery, ModifyRolesQuery, AddUrgentMentionCountQuery); + IF @alterQuery <> '' THEN + SET @query = CONCAT('ALTER TABLE ChannelMembers ', @alterQuery); + PREPARE stmt FROM @query; + EXECUTE stmt; + DEALLOCATE PREPARE stmt; + END IF; + + IF MigrateMemberships THEN + UPDATE ChannelMembers INNER JOIN Channels ON Channels.Id = ChannelMembers.ChannelId + SET MentionCount = 0, MentionCountRoot = 0, MsgCount = Channels.TotalMsgCount, MsgCountRoot = Channels.TotalMsgCountRoot, LastUpdateAt = (SELECT (SELECT ROUND(UNIX_TIMESTAMP(NOW(3))*1000))) + WHERE ChannelMembers.LastViewedAt >= Channels.LastPostAt; + INSERT INTO Systems VALUES('CRTChannelMembershipCountsMigrationComplete', 'true'); + END IF; + +END// +DELIMITER ; + +SELECT CONCAT('-- ', NOW(), ' MigrateChannelMembers procedure starting.') AS DEBUG; +CALL MigrateChannelMembers(); +SELECT CONCAT('-- ', NOW(), ' MigrateChannelMembers procedure finished.') AS DEBUG; +DROP PROCEDURE IF EXISTS MigrateChannelMembers; + +/* ==> mysql/000059_upgrade_users_v6.0.up.sql <== */ +/* ==> mysql/000074_upgrade_users_v6.3.up.sql <== */ +/* ==> mysql/000077_upgrade_users_v6.5.up.sql <== */ +/* ==> mysql/000088_remaining_migrations.up.sql <== */ +DELIMITER // +CREATE PROCEDURE MigrateUsers () +BEGIN + -- 'ALTER TABLE Users MODIFY COLUMN Props JSON;', + DECLARE ChangeProps BOOLEAN; + DECLARE ChangePropsQuery TEXT DEFAULT NULL; + + -- 'ALTER TABLE Users MODIFY COLUMN NotifyProps JSON;', + DECLARE ChangeNotifyProps BOOLEAN; + DECLARE ChangeNotifyPropsQuery TEXT DEFAULT NULL; + + -- 'ALTER TABLE Users ALTER Timezone DROP DEFAULT;', + DECLARE DropTimezoneDefault BOOLEAN; + DECLARE DropTimezoneDefaultQuery TEXT DEFAULT NULL; + + -- 'ALTER TABLE Users MODIFY COLUMN Timezone JSON;', + DECLARE ChangeTimezone BOOLEAN; + DECLARE ChangeTimezoneQuery TEXT DEFAULT NULL; + + -- 'ALTER TABLE Users MODIFY COLUMN Roles text;', + DECLARE ChangeRoles BOOLEAN; + DECLARE ChangeRolesQuery TEXT DEFAULT NULL; + + -- 'ALTER TABLE Users DROP COLUMN AcceptedTermsOfServiceId;', + DECLARE DropTermsOfService BOOLEAN; + DECLARE DropTermsOfServiceQuery TEXT DEFAULT NULL; + + -- 'ALTER TABLE Users DROP COLUMN AcceptedServiceTermsId;', + DECLARE DropServiceTerms BOOLEAN; + DECLARE DropServiceTermsQuery TEXT DEFAULT NULL; + + -- 'ALTER TABLE Users DROP COLUMN ThemeProps', + DECLARE DropThemeProps BOOLEAN; + DECLARE DropThemePropsQuery TEXT DEFAULT NULL; + + SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS + WHERE table_name = 'Users' + AND table_schema = DATABASE() + AND column_name = 'Props' + AND LOWER(column_type) != 'json' + INTO ChangeProps; + + SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS + WHERE table_name = 'Users' + AND table_schema = DATABASE() + AND column_name = 'NotifyProps' + AND LOWER(column_type) != 'json' + INTO ChangeNotifyProps; + + SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS + WHERE table_name = 'Users' + AND column_default IS NOT NULL + INTO DropTimezoneDefault; + + SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS + WHERE table_name = 'Users' + AND table_schema = DATABASE() + AND column_name = 'Timezone' + AND LOWER(column_type) != 'json' + INTO ChangeTimezone; + + SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS + WHERE table_name = 'Users' + AND table_schema = DATABASE() + AND column_name = 'Roles' + AND LOWER(column_type) != 'text' + INTO ChangeRoles; + + SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS + WHERE table_name = 'Users' + AND table_schema = DATABASE() + AND column_name = 'AcceptedTermsOfServiceId' + INTO DropTermsOfService; + + SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS + WHERE table_name = 'Users' + AND table_schema = DATABASE() + AND column_name = 'AcceptedServiceTermsId' + INTO DropServiceTerms; + + SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS + WHERE table_name = 'Users' + AND table_schema = DATABASE() + AND column_name = 'ThemeProps' + INTO DropThemeProps; + + IF ChangeProps THEN + SET ChangePropsQuery = 'MODIFY COLUMN Props JSON'; + END IF; + + IF ChangeNotifyProps THEN + SET ChangeNotifyPropsQuery = 'MODIFY COLUMN NotifyProps JSON'; + END IF; + + IF DropTimezoneDefault THEN + SET DropTimezoneDefaultQuery = 'ALTER Timezone DROP DEFAULT'; + END IF; + + IF ChangeTimezone THEN + SET ChangeTimezoneQuery = 'MODIFY COLUMN Timezone JSON'; + END IF; + + IF ChangeRoles THEN + SET ChangeRolesQuery = 'MODIFY COLUMN Roles text'; + END IF; + + IF DropTermsOfService THEN + SET DropTermsOfServiceQuery = 'DROP COLUMN AcceptedTermsOfServiceId'; + END IF; + + IF DropServiceTerms THEN + SET DropServiceTermsQuery = 'DROP COLUMN AcceptedServiceTermsId'; + END IF; + + IF DropThemeProps THEN + INSERT INTO Preferences(UserId, Category, Name, Value) SELECT Id, '', '', ThemeProps FROM Users WHERE Users.ThemeProps != 'null'; + SET DropThemePropsQuery = 'DROP COLUMN ThemeProps'; + END IF; + + SET @alterQuery = CONCAT_WS(', ', ChangePropsQuery, ChangeNotifyPropsQuery, DropTimezoneDefaultQuery, ChangeTimezoneQuery, ChangeRolesQuery, DropTermsOfServiceQuery, DropServiceTermsQuery, DropThemePropsQuery); + IF @alterQuery <> '' THEN + SET @query = CONCAT('ALTER TABLE Users ', @alterQuery); + PREPARE stmt FROM @query; + EXECUTE stmt; + DEALLOCATE PREPARE stmt; + END IF; +END// +DELIMITER ; +SELECT CONCAT('-- ', NOW(), ' MigrateUsers procedure starting.') AS DEBUG; +CALL MigrateUsers(); +SELECT CONCAT('-- ', NOW(), ' MigrateUsers procedure finished.') AS DEBUG; +DROP PROCEDURE IF EXISTS MigrateUsers; + +/* ==> mysql/000060_upgrade_jobs_v6.0.up.sql <== */ +/* ==> mysql/000069_upgrade_jobs_v6.1.up.sql <== */ +DELIMITER // +CREATE PROCEDURE MigrateJobs () +BEGIN + -- 'ALTER TABLE Jobs MODIFY COLUMN Data JSON;', + DECLARE ModifyData BOOLEAN; + DECLARE ModifyDataQuery TEXT DEFAULT NULL; + + -- 'CREATE INDEX idx_jobs_status_type ON Jobs(Status, Type);' + DECLARE CreateIndex BOOLEAN; + DECLARE CreateIndexQuery TEXT DEFAULT NULL; + + SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS + WHERE table_name = 'Jobs' + AND table_schema = DATABASE() + AND column_name = 'Data' + AND LOWER(column_type) != 'JSON' + INTO ModifyData; + + SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.STATISTICS + WHERE table_name = 'Jobs' + AND table_schema = DATABASE() + AND index_name = 'idx_jobs_status_type' + INTO CreateIndex; + + IF ModifyData THEN + SET ModifyDataQuery = 'MODIFY COLUMN Data JSON'; + END IF; + + IF CreateIndex THEN + SET CreateIndexQuery = 'ADD INDEX idx_jobs_status_type (Status, Type)'; + END IF; + + SET @alterQuery = CONCAT_WS(', ', ModifyDataQuery, CreateIndexQuery); + IF @alterQuery <> '' THEN + SET @query = CONCAT('ALTER TABLE Jobs ', @alterQuery); + PREPARE stmt FROM @query; + EXECUTE stmt; + DEALLOCATE PREPARE stmt; + END IF; +END// +DELIMITER ; +SELECT CONCAT('-- ', NOW(), ' MigrateJobs procedure starting.') AS DEBUG; +CALL MigrateJobs(); +SELECT CONCAT('-- ', NOW(), ' MigrateJobs procedure finished.') AS DEBUG; +DROP PROCEDURE IF EXISTS MigrateJobs; + +/* ==> mysql/000061_upgrade_link_metadata_v6.0.up.sql <== */ +DELIMITER // +CREATE PROCEDURE MigrateLinkMetadata () +BEGIN + -- ALTER TABLE LinkMetadata MODIFY COLUMN Data JSON; + DECLARE ModifyData BOOLEAN; + + SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS + WHERE table_name = 'LinkMetadata' + AND table_schema = DATABASE() + AND column_name = 'Data' + AND LOWER(column_type) != 'JSON' + INTO ModifyData; + + IF ModifyData THEN + ALTER TABLE LinkMetadata MODIFY COLUMN Data JSON; + END IF; +END// +DELIMITER ; +SELECT CONCAT('-- ', NOW(), ' MigrateLinkMetadata procedure starting.') AS DEBUG; +CALL MigrateLinkMetadata(); +SELECT CONCAT('-- ', NOW(), ' MigrateLinkMetadata procedure finished.') AS DEBUG; +DROP PROCEDURE IF EXISTS MigrateLinkMetadata; + +/* ==> mysql/000062_upgrade_sessions_v6.0.up.sql <== */ +/* ==> mysql/000071_upgrade_sessions_v6.1.up.sql <== */ +DELIMITER // +CREATE PROCEDURE MigrateSessions () +BEGIN + -- 'ALTER TABLE Sessions MODIFY COLUMN Props JSON;', + DECLARE ModifyProps BOOLEAN; + DECLARE ModifyPropsQuery TEXT DEFAULT NULL; + + -- 'ALTER TABLE Sessions MODIFY COLUMN Roles text;', + DECLARE ModifyRoles BOOLEAN; + DECLARE ModifyRolesQuery TEXT DEFAULT NULL; + + SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS + WHERE table_name = 'Sessions' + AND table_schema = DATABASE() + AND column_name = 'Props' + AND LOWER(column_type) != 'json' + INTO ModifyProps; + + + SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS + WHERE table_name = 'Sessions' + AND table_schema = DATABASE() + AND column_name = 'Roles' + AND LOWER(column_type) != 'text' + INTO ModifyRoles; + + IF ModifyProps THEN + SET ModifyPropsQuery = 'MODIFY COLUMN Props JSON'; + END IF; + + IF ModifyRoles THEN + SET ModifyRolesQuery = 'MODIFY COLUMN Roles text'; + END IF; + + SET @alterQuery = CONCAT_WS(', ', ModifyPropsQuery, ModifyRolesQuery); + IF @alterQuery <> '' THEN + SET @query = CONCAT('ALTER TABLE Sessions ', @alterQuery); + PREPARE stmt FROM @query; + EXECUTE stmt; + DEALLOCATE PREPARE stmt; + END IF; + +END// +DELIMITER ; +SELECT CONCAT('-- ', NOW(), ' MigrateSessions procedure starting.') AS DEBUG; +CALL MigrateSessions(); +SELECT CONCAT('-- ', NOW(), ' MigrateSessions procedure finished.') AS DEBUG; +DROP PROCEDURE IF EXISTS MigrateSessions; + +/* ==> mysql/000063_upgrade_threads_v6.0.up.sql <== */ +/* ==> mysql/000083_threads_threaddeleteat.up.sql <== */ +/* ==> mysql/000096_threads_threadteamid.up.sql <== */ +DELIMITER // +CREATE PROCEDURE MigrateThreads () +BEGIN + -- 'ALTER TABLE Threads MODIFY COLUMN Participants JSON;' + DECLARE ChangeParticipants BOOLEAN; + DECLARE ChangeParticipantsQuery TEXT DEFAULT NULL; + + -- 'ALTER TABLE Threads DROP COLUMN DeleteAt;' + DECLARE DropDeleteAt BOOLEAN; + DECLARE DropDeleteAtQuery TEXT DEFAULT NULL; + + -- 'ALTER TABLE Threads ADD COLUMN ThreadDeleteAt bigint(20);' + DECLARE CreateThreadDeleteAt BOOLEAN; + DECLARE CreateThreadDeleteAtQuery TEXT DEFAULT NULL; + + -- 'ALTER TABLE Threads DROP COLUMN TeamId;' + DECLARE DropTeamId BOOLEAN; + DECLARE DropTeamIdQuery TEXT DEFAULT NULL; + + -- 'ALTER TABLE Threads ADD COLUMN ThreadTeamId varchar(26) DEFAULT NULL;' + DECLARE CreateThreadTeamId BOOLEAN; + DECLARE CreateThreadTeamIdQuery TEXT DEFAULT NULL; + + -- CREATE INDEX idx_threads_channel_id_last_reply_at ON Threads(ChannelId, LastReplyAt); + DECLARE CreateIndex BOOLEAN; + DECLARE CreateIndexQuery TEXT DEFAULT NULL; + + -- DROP INDEX idx_threads_channel_id ON Threads; + DECLARE DropIndex BOOLEAN; + DECLARE DropIndexQuery TEXT DEFAULT NULL; + + SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS + WHERE table_name = 'Threads' + AND table_schema = DATABASE() + AND column_name = 'Participants' + AND LOWER(column_type) != 'json' + INTO ChangeParticipants; + + SELECT COUNT(*) FROM INFORMATION_SCHEMA.STATISTICS + WHERE table_name = 'Threads' + AND table_schema = DATABASE() + AND column_name = 'DeleteAt' + INTO DropDeleteAt; + + SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.COLUMNS + WHERE table_name = 'Threads' + AND table_schema = DATABASE() + AND column_name = 'ThreadDeleteAt' + INTO CreateThreadDeleteAt; + + SELECT COUNT(*) FROM INFORMATION_SCHEMA.STATISTICS + WHERE table_name = 'Threads' + AND table_schema = DATABASE() + AND column_name = 'TeamId' + INTO DropTeamId; + + SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.COLUMNS + WHERE table_name = 'Threads' + AND table_schema = DATABASE() + AND column_name = 'ThreadTeamId' + INTO CreateThreadTeamId; + + SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.STATISTICS + WHERE table_name = 'Threads' + AND table_schema = DATABASE() + AND index_name = 'idx_threads_channel_id_last_reply_at' + INTO CreateIndex; + + SELECT COUNT(*) FROM INFORMATION_SCHEMA.STATISTICS + WHERE table_name = 'Threads' + AND table_schema = DATABASE() + AND index_name = 'idx_threads_channel_id' + INTO DropIndex; + + IF ChangeParticipants THEN + SET ChangeParticipantsQuery = 'MODIFY COLUMN Participants JSON'; + END IF; + + IF DropDeleteAt THEN + SET DropDeleteAtQuery = 'DROP COLUMN DeleteAt'; + END IF; + + IF CreateThreadDeleteAt THEN + SET CreateThreadDeleteAtQuery = 'ADD COLUMN ThreadDeleteAt bigint(20)'; + END IF; + + IF DropTeamId THEN + SET DropTeamIdQuery = 'DROP COLUMN TeamId'; + END IF; + + IF CreateThreadTeamId THEN + SET CreateThreadTeamIdQuery = 'ADD COLUMN ThreadTeamId varchar(26) DEFAULT NULL'; + END IF; + + IF CreateIndex THEN + SET CreateIndexQuery = 'ADD INDEX idx_threads_channel_id_last_reply_at (ChannelId, LastReplyAt)'; + END IF; + + IF DropIndex THEN + SET DropIndexQuery = 'DROP INDEX idx_threads_channel_id'; + END IF; + + SET @alterQuery = CONCAT_WS(', ', ChangeParticipantsQuery, DropDeleteAtQuery, CreateThreadDeleteAtQuery, DropTeamIdQuery, CreateThreadTeamIdQuery, CreateIndexQuery, DropIndexQuery); + IF @alterQuery <> '' THEN + SET @query = CONCAT('ALTER TABLE Threads ', @alterQuery); + PREPARE stmt FROM @query; + EXECUTE stmt; + DEALLOCATE PREPARE stmt; + END IF; + + UPDATE Threads, Posts + SET Threads.ThreadDeleteAt = Posts.DeleteAt + WHERE Posts.Id = Threads.PostId + AND Threads.ThreadDeleteAt IS NULL; + + UPDATE Threads, Channels + SET Threads.ThreadTeamId = Channels.TeamId + WHERE Channels.Id = Threads.ChannelId + AND Threads.ThreadTeamId IS NULL; +END// +DELIMITER ; +SELECT CONCAT('-- ', NOW(), ' MigrateThreads procedure starting.') AS DEBUG; +CALL MigrateThreads(); +SELECT CONCAT('-- ', NOW(), ' MigrateThreads procedure finished.') AS DEBUG; +DROP PROCEDURE IF EXISTS MigrateThreads; + +/* ==> mysql/000064_upgrade_status_v6.0.up.sql <== */ +DELIMITER // +CREATE PROCEDURE MigrateStatus () +BEGIN + -- 'CREATE INDEX idx_status_status_dndendtime ON Status(Status, DNDEndTime);' + DECLARE CreateIndex BOOLEAN; + DECLARE CreateIndexQuery TEXT DEFAULT NULL; + + -- 'DROP INDEX idx_status_status ON Status;', + DECLARE DropIndex BOOLEAN; + DECLARE DropIndexQuery TEXT DEFAULT NULL; + + SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.STATISTICS + WHERE table_name = 'Status' + AND table_schema = DATABASE() + AND index_name = 'idx_status_status_dndendtime' + INTO CreateIndex; + + SELECT COUNT(*) FROM INFORMATION_SCHEMA.STATISTICS + WHERE table_name = 'Status' + AND table_schema = DATABASE() + AND index_name = 'idx_status_status' + INTO DropIndex; + + IF CreateIndex THEN + SET CreateIndexQuery = 'ADD INDEX idx_status_status_dndendtime (Status, DNDEndTime)'; + END IF; + + IF DropIndex THEN + SET DropIndexQuery = 'DROP INDEX idx_status_status'; + END IF; + + SET @alterQuery = CONCAT_WS(', ', CreateIndexQuery, DropIndexQuery); + IF @alterQuery <> '' THEN + SET @query = CONCAT('ALTER TABLE Status ', @alterQuery); + PREPARE stmt FROM @query; + EXECUTE stmt; + DEALLOCATE PREPARE stmt; + END IF; +END// +DELIMITER ; +SELECT CONCAT('-- ', NOW(), ' MigrateStatus procedure starting.') AS DEBUG; +CALL MigrateStatus (); +SELECT CONCAT('-- ', NOW(), ' MigrateStatus procedure finished.') AS DEBUG; +DROP PROCEDURE IF EXISTS MigrateStatus; + +/* ==> mysql/000065_upgrade_groupchannels_v6.0.up.sql <== */ +DELIMITER // +CREATE PROCEDURE MigrateGroupChannels () +BEGIN + -- 'CREATE INDEX idx_groupchannels_schemeadmin ON GroupChannels(SchemeAdmin);' + DECLARE CreateIndex BOOLEAN; + + SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.STATISTICS + WHERE table_name = 'GroupChannels' + AND table_schema = DATABASE() + AND index_name = 'idx_groupchannels_schemeadmin' + INTO CreateIndex; + + IF CreateIndex THEN + CREATE INDEX idx_groupchannels_schemeadmin ON GroupChannels(SchemeAdmin); + END IF; +END// +DELIMITER ; +SELECT CONCAT('-- ', NOW(), ' MigrateGroupChannels procedure starting.') AS DEBUG; +CALL MigrateGroupChannels (); +SELECT CONCAT('-- ', NOW(), ' MigrateGroupChannels procedure finished.') AS DEBUG; +DROP PROCEDURE IF EXISTS MigrateGroupChannels; + +/* ==> mysql/000066_upgrade_posts_v6.0.up.sql <== */ +/* ==> mysql/000080_posts_createat_id.up.sql <== */ +/* ==> mysql/000095_remove_posts_parentid.up.sql <== */ +DELIMITER // +CREATE PROCEDURE MigratePosts () +BEGIN + -- DROP COLUMN ParentId + DECLARE DropParentId BOOLEAN; + DECLARE DropParentIdQuery TEXT DEFAULT NULL; + + -- MODIFY COLUMN FileIds + DECLARE ModifyFileIds BOOLEAN; + DECLARE ModifyFileIdsQuery TEXT DEFAULT NULL; + + -- MODIFY COLUMN Props + DECLARE ModifyProps BOOLEAN; + DECLARE ModifyPropsQuery TEXT DEFAULT NULL; + + -- 'CREATE INDEX idx_posts_root_id_delete_at ON Posts(RootId, DeleteAt);' + DECLARE CreateIndexRootId BOOLEAN; + DECLARE CreateIndexRootIdQuery TEXT DEFAULT NULL; + + -- 'DROP INDEX idx_posts_root_id ON Posts;', + DECLARE DropIndex BOOLEAN; + DECLARE DropIndexQuery TEXT DEFAULT NULL; + + -- 'CREATE INDEX idx_posts_create_at_id on Posts(CreateAt, Id) LOCK=NONE;' + DECLARE CreateIndexCreateAt BOOLEAN; + DECLARE CreateIndexCreateAtQuery TEXT DEFAULT NULL; + + SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS + WHERE TABLE_NAME = 'Posts' + AND table_schema = DATABASE() + AND COLUMN_NAME = 'ParentId' + INTO DropParentId; + + SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS + WHERE table_name = 'Posts' + AND table_schema = DATABASE() + AND column_name = 'FileIds' + AND LOWER(column_type) != 'text' + INTO ModifyFileIds; + + SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS + WHERE table_name = 'Posts' + AND table_schema = DATABASE() + AND column_name = 'Props' + AND LOWER(column_type) != 'json' + INTO ModifyProps; + + SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.STATISTICS + WHERE table_name = 'Posts' + AND table_schema = DATABASE() + AND index_name = 'idx_posts_root_id_delete_at' + INTO CreateIndexRootId; + + SELECT COUNT(*) FROM INFORMATION_SCHEMA.STATISTICS + WHERE table_name = 'Posts' + AND table_schema = DATABASE() + AND index_name = 'idx_posts_root_id' + INTO DropIndex; + + SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.STATISTICS + WHERE table_name = 'Posts' + AND table_schema = DATABASE() + AND index_name = 'idx_posts_create_at_id' + INTO CreateIndexCreateAt; + + IF DropParentId THEN + SET DropParentIdQuery = 'DROP COLUMN ParentId'; + UPDATE Posts SET RootId = ParentId WHERE RootId = '' AND RootId != ParentId; + END IF; + + IF ModifyFileIds THEN + SET ModifyFileIdsQuery = 'MODIFY COLUMN FileIds text'; + END IF; + + IF ModifyProps THEN + SET ModifyPropsQuery = 'MODIFY COLUMN Props JSON'; + END IF; + + IF CreateIndexRootId THEN + SET CreateIndexRootIdQuery = 'ADD INDEX idx_posts_root_id_delete_at (RootId, DeleteAt)'; + END IF; + + IF DropIndex THEN + SET DropIndexQuery = 'DROP INDEX idx_posts_root_id'; + END IF; + + IF CreateIndexCreateAt THEN + SET CreateIndexCreateAtQuery = 'ADD INDEX idx_posts_create_at_id (CreateAt, Id)'; + END IF; + + SET @alterQuery = CONCAT_WS(', ', DropParentIdQuery, ModifyFileIdsQuery, ModifyPropsQuery, CreateIndexRootIdQuery, DropIndexQuery, CreateIndexCreateAtQuery); + IF @alterQuery <> '' THEN + SET @query = CONCAT('ALTER TABLE Posts ', @alterQuery); + PREPARE stmt FROM @query; + EXECUTE stmt; + DEALLOCATE PREPARE stmt; + END IF; + +END// +DELIMITER ; +SELECT CONCAT('-- ', NOW(), ' MigratePosts procedure starting.') AS DEBUG; +CALL MigratePosts (); +SELECT CONCAT('-- ', NOW(), ' MigratePosts procedure finished.') AS DEBUG; +DROP PROCEDURE IF EXISTS MigratePosts; + +/* ==> mysql/000068_upgrade_teammembers_v6.1.up.sql <== */ +/* ==> mysql/000092_add_createat_to_teammembers.up.sql <== */ +DELIMITER // +CREATE PROCEDURE MigrateTeamMembers () +BEGIN + -- 'ALTER TABLE TeamMembers MODIFY COLUMN Roles text;', + DECLARE ModifyRoles BOOLEAN; + DECLARE ModifyRolesQuery TEXT DEFAULT NULL; + + -- 'ALTER TABLE TeamMembers ADD COLUMN CreateAt bigint DEFAULT 0;', + DECLARE AddCreateAt BOOLEAN; + DECLARE AddCreateAtQuery TEXT DEFAULT NULL; + + -- 'CREATE INDEX idx_teammembers_createat ON TeamMembers(CreateAt);' + DECLARE CreateIndex BOOLEAN; + DECLARE CreateIndexQuery TEXT DEFAULT NULL; + + SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS + WHERE table_name = 'TeamMembers' + AND table_schema = DATABASE() + AND column_name = 'Roles' + AND LOWER(column_type) != 'text' + INTO ModifyRoles; + + SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.COLUMNS + WHERE table_name = 'TeamMembers' + AND table_schema = DATABASE() + AND column_name = 'CreateAt' + INTO AddCreateAt; + + SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.STATISTICS + WHERE table_name = 'TeamMembers' + AND table_schema = DATABASE() + AND index_name = 'idx_teammembers_createat' + INTO CreateIndex; + + IF ModifyRoles THEN + SET ModifyRolesQuery = 'MODIFY COLUMN Roles text'; + END IF; + + IF AddCreateAt THEN + SET AddCreateAtQuery = 'ADD COLUMN CreateAt bigint DEFAULT 0'; + END IF; + + IF CreateIndex THEN + SET CreateIndexQuery = 'ADD INDEX idx_teammembers_createat (CreateAt)'; + END IF; + + SET @alterQuery = CONCAT_WS(', ', ModifyRolesQuery, AddCreateAtQuery, CreateIndexQuery); + IF @alterQuery <> '' THEN + SET @query = CONCAT('ALTER TABLE TeamMembers ', @alterQuery); + PREPARE stmt FROM @query; + EXECUTE stmt; + DEALLOCATE PREPARE stmt; + END IF; +END// +DELIMITER ; +SELECT CONCAT('-- ', NOW(), ' MigrateTeamMembers procedure starting.') AS DEBUG; +CALL MigrateTeamMembers (); +SELECT CONCAT('-- ', NOW(), ' MigrateTeamMembers procedure finished.') AS DEBUG; +DROP PROCEDURE IF EXISTS MigrateTeamMembers; + +/* ==> mysql/000072_upgrade_schemes_v6.3.up.sql <== */ +DELIMITER // +CREATE PROCEDURE MigrateSchemes () +BEGIN + -- 'ALTER TABLE Schemes ADD COLUMN DefaultPlaybookAdminRole VARCHAR(64) DEFAULT "";' + DECLARE AddDefaultPlaybookAdminRole BOOLEAN; + DECLARE AddDefaultPlaybookAdminRoleQuery TEXT DEFAULT NULL; + + -- 'ALTER TABLE Schemes ADD COLUMN DefaultPlaybookMemberRole VARCHAR(64) DEFAULT "";' + DECLARE AddDefaultPlaybookMemberRole BOOLEAN; + DECLARE AddDefaultPlaybookMemberRoleQuery TEXT DEFAULT NULL; + + -- 'ALTER TABLE Schemes ADD COLUMN DefaultRunAdminRole VARCHAR(64) DEFAULT "";' + DECLARE AddDefaultRunAdminRole BOOLEAN; + DECLARE AddDefaultRunAdminRoleQuery TEXT DEFAULT NULL; + + -- 'ALTER TABLE Schemes ADD COLUMN DefaultRunMemberRole VARCHAR(64) DEFAULT "";' + DECLARE AddDefaultRunMemberRole BOOLEAN; + DECLARE AddDefaultRunMemberRoleQuery TEXT DEFAULT NULL; + + SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.COLUMNS + WHERE table_name = 'Schemes' + AND table_schema = DATABASE() + AND column_name = 'DefaultPlaybookAdminRole' + INTO AddDefaultPlaybookAdminRole; + + SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.COLUMNS + WHERE table_name = 'Schemes' + AND table_schema = DATABASE() + AND column_name = 'DefaultPlaybookMemberRole' + INTO AddDefaultPlaybookMemberRole; + + SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.COLUMNS + WHERE table_name = 'Schemes' + AND table_schema = DATABASE() + AND column_name = 'DefaultRunAdminRole' + INTO AddDefaultRunAdminRole; + + SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.COLUMNS + WHERE table_name = 'Schemes' + AND table_schema = DATABASE() + AND column_name = 'DefaultRunMemberRole' + INTO AddDefaultRunMemberRole; + + IF AddDefaultPlaybookAdminRole THEN + SET AddDefaultPlaybookAdminRoleQuery = 'ADD COLUMN DefaultPlaybookAdminRole VARCHAR(64) DEFAULT ""'; + END IF; + + IF AddDefaultPlaybookMemberRole THEN + SET AddDefaultPlaybookMemberRoleQuery = 'ADD COLUMN DefaultPlaybookMemberRole VARCHAR(64) DEFAULT ""'; + END IF; + + IF AddDefaultRunAdminRole THEN + SET AddDefaultRunAdminRoleQuery = 'ADD COLUMN DefaultRunAdminRole VARCHAR(64) DEFAULT ""'; + END IF; + + IF AddDefaultRunMemberRole THEN + SET AddDefaultRunMemberRoleQuery = 'ADD COLUMN DefaultRunMemberRole VARCHAR(64) DEFAULT ""'; + END IF; + + SET @alterQuery = CONCAT_WS(', ', AddDefaultPlaybookAdminRoleQuery, AddDefaultPlaybookMemberRoleQuery, AddDefaultRunAdminRoleQuery, AddDefaultRunMemberRoleQuery); + IF @alterQuery <> '' THEN + SET @query = CONCAT('ALTER TABLE Schemes ', @alterQuery); + PREPARE stmt FROM @query; + EXECUTE stmt; + DEALLOCATE PREPARE stmt; + END IF; +END// +DELIMITER ; +SELECT CONCAT('-- ', NOW(), ' MigrateSchemes procedure starting.') AS DEBUG; +CALL MigrateSchemes (); +SELECT CONCAT('-- ', NOW(), ' MigrateSchemes procedure finished.') AS DEBUG; +DROP PROCEDURE IF EXISTS MigrateSchemes; + +/* ==> mysql/000073_upgrade_plugin_key_value_store_v6.3.up.sql <== */ +DELIMITER // +CREATE PROCEDURE MigratePluginKeyValueStore () +BEGIN + -- 'ALTER TABLE PluginKeyValueStore MODIFY COLUMN PKey varchar(150);', + DECLARE ModifyPKey BOOLEAN; + + SELECT COUNT(*) FROM Information_Schema.Columns + WHERE table_name = 'PluginKeyValueStore' + AND table_schema = DATABASE() + AND column_name = 'PKey' + AND LOWER(column_type) != 'varchar(150)' + INTO ModifyPKey; + + IF ModifyPKey THEN + ALTER TABLE PluginKeyValueStore MODIFY COLUMN PKey varchar(150); + END IF; +END// +DELIMITER ; +SELECT CONCAT('-- ', NOW(), ' MigratePluginKeyValueStore procedure starting.') AS DEBUG; +CALL MigratePluginKeyValueStore (); +SELECT CONCAT('-- ', NOW(), ' MigratePluginKeyValueStore procedure finished.') AS DEBUG; +DROP PROCEDURE IF EXISTS MigratePluginKeyValueStore; + +/* ==> mysql/000078_create_oauth_mattermost_app_id.up.sql <== */ +/* ==> mysql/000082_upgrade_oauth_mattermost_app_id.up.sql <== */ +DELIMITER // +CREATE PROCEDURE MigrateOAuthApps () +BEGIN + -- 'ALTER TABLE OAuthApps ADD COLUMN MattermostAppID varchar(32);' + DECLARE AddMattermostAppID BOOLEAN; + DECLARE AddMattermostAppIDQuery TEXT DEFAULT NULL; + + SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.COLUMNS + WHERE table_name = 'OAuthApps' + AND table_schema = DATABASE() + AND column_name = 'MattermostAppID' + INTO AddMattermostAppID; + + IF AddMattermostAppID THEN + SET AddMattermostAppIDQuery = 'ADD COLUMN MattermostAppID varchar(32) NOT NULL DEFAULT ""'; + SET @query = CONCAT('ALTER TABLE OAuthApps ', CONCAT_WS(', ', AddMattermostAppIDQuery)); + PREPARE stmt FROM @query; + EXECUTE stmt; + DEALLOCATE PREPARE stmt; + END IF; + + IF AddMattermostAppID THEN + UPDATE OAuthApps SET MattermostAppID = "" WHERE MattermostAppID IS NULL; + END IF; +END// +DELIMITER ; +SELECT CONCAT('-- ', NOW(), ' MigrateOAuthApps procedure starting.') AS DEBUG; +CALL MigrateOAuthApps (); +SELECT CONCAT('-- ', NOW(), ' MigrateOAuthApps procedure finished.') AS DEBUG; +DROP PROCEDURE IF EXISTS MigrateOAuthApps; + +/* ==> mysql/000079_usergroups_displayname_index.up.sql <== */ +DELIMITER // +CREATE PROCEDURE MigrateUserGroups () +BEGIN + -- 'CREATE INDEX idx_usergroups_displayname ON UserGroups(DisplayName);' + DECLARE CreateIndex BOOLEAN; + + SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.STATISTICS + WHERE table_name = 'UserGroups' + AND table_schema = DATABASE() + AND index_name = 'idx_usergroups_displayname' + INTO CreateIndex; + + IF CreateIndex THEN + CREATE INDEX idx_usergroups_displayname ON UserGroups(DisplayName); + END IF; +END// +DELIMITER ; +SELECT CONCAT('-- ', NOW(), ' MigrateUserGroups procedure starting.') AS DEBUG; +CALL MigrateUserGroups (); +SELECT CONCAT('-- ', NOW(), ' MigrateUserGroups procedure finished.') AS DEBUG; +DROP PROCEDURE IF EXISTS MigrateUserGroups; + +/* ==> mysql/000081_threads_deleteat.up.sql <== */ +-- Replaced by 000083_threads_threaddeleteat.up.sql + +/* ==> mysql/000084_recent_searches.up.sql <== */ +CREATE TABLE IF NOT EXISTS RecentSearches ( + UserId CHAR(26), + SearchPointer int, + Query json, + CreateAt bigint NOT NULL, + PRIMARY KEY (UserId, SearchPointer) +); + +/* ==> mysql/000085_fileinfo_add_archived_column.up.sql <== */ +DELIMITER // +CREATE PROCEDURE MigrateFileInfo () +BEGIN + -- 'ALTER TABLE FileInfo ADD COLUMN Archived boolean NOT NULL DEFAULT false;' + DECLARE AddArchived BOOLEAN; + + SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.COLUMNS + WHERE table_name = 'FileInfo' + AND table_schema = DATABASE() + AND column_name = 'Archived' + INTO AddArchived; + + IF AddArchived THEN + ALTER TABLE FileInfo ADD COLUMN Archived boolean NOT NULL DEFAULT false; + END IF; +END// +DELIMITER ; +SELECT CONCAT('-- ', NOW(), ' MigrateFileInfo procedure starting.') AS DEBUG; +CALL MigrateFileInfo (); +SELECT CONCAT('-- ', NOW(), ' MigrateFileInfo procedure finished.') AS DEBUG; +DROP PROCEDURE IF EXISTS MigrateFileInfo; + +/* ==> mysql/000086_add_cloud_limits_archived.up.sql <== */ +/* ==> mysql/000090_create_enums.up.sql <== */ +DELIMITER // +CREATE PROCEDURE MigrateTeams () +BEGIN + -- 'ALTER TABLE Teams ADD COLUMN CloudLimitsArchived BOOLEAN NOT NULL DEFAULT FALSE;', + DECLARE AddCloudLimitsArchived BOOLEAN; + DECLARE AddCloudLimitsArchivedQuery TEXT DEFAULT NULL; + + -- 'ALTER TABLE Teams MODIFY COLUMN Type ENUM("I", "O");', + DECLARE ModifyType BOOLEAN; + DECLARE ModifyTypeQuery TEXT DEFAULT NULL; + + SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.COLUMNS + WHERE table_name = 'Teams' + AND table_schema = DATABASE() + AND column_name = 'CloudLimitsArchived' + INTO AddCloudLimitsArchived; + + SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS + WHERE table_name = 'Teams' + AND table_schema = DATABASE() + AND column_name = 'Type' + AND REPLACE(LOWER(column_type), '"', "'") != "enum('i','o')" + INTO ModifyType; + + IF AddCloudLimitsArchived THEN + SET AddCloudLimitsArchivedQuery = 'ADD COLUMN CloudLimitsArchived BOOLEAN NOT NULL DEFAULT FALSE'; + END IF; + + IF ModifyType THEN + SET ModifyTypeQuery = 'MODIFY COLUMN Type ENUM("I", "O")'; + END IF; + + SET @alterQuery = CONCAT_WS(', ', AddCloudLimitsArchivedQuery, ModifyTypeQuery); + IF @alterQuery <> '' THEN + SET @query = CONCAT('ALTER TABLE Teams ', @alterQuery); + PREPARE stmt FROM @query; + EXECUTE stmt; + DEALLOCATE PREPARE stmt; + END IF; +END// +DELIMITER ; +SELECT CONCAT('-- ', NOW(), ' MigrateTeams procedure starting.') AS DEBUG; +CALL MigrateTeams (); +SELECT CONCAT('-- ', NOW(), ' MigrateTeams procedure finished.') AS DEBUG; +DROP PROCEDURE IF EXISTS MigrateTeams; + +/* ==> mysql/000087_sidebar_categories_index.up.sql <== */ +DELIMITER // +CREATE PROCEDURE MigrateSidebarCategories () +BEGIN + -- 'CREATE INDEX idx_sidebarcategories_userid_teamid on SidebarCategories(UserId, TeamId) LOCK=NONE;' + DECLARE CreateIndex BOOLEAN; + + SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.STATISTICS + WHERE table_name = 'SidebarCategories' + AND table_schema = DATABASE() + AND index_name = 'idx_sidebarcategories_userid_teamid' + INTO CreateIndex; + + IF CreateIndex THEN + CREATE INDEX idx_sidebarcategories_userid_teamid on SidebarCategories(UserId, TeamId) LOCK=NONE; + END IF; +END// +DELIMITER ; +SELECT CONCAT('-- ', NOW(), ' MigrateSidebarCategories procedure starting.') AS DEBUG; +CALL MigrateSidebarCategories (); +SELECT CONCAT('-- ', NOW(), ' MigrateSidebarCategories procedure finished.') AS DEBUG; +DROP PROCEDURE IF EXISTS MigrateSidebarCategories; + +/* ==> mysql/000088_remaining_migrations.up.sql <== */ +DROP TABLE IF EXISTS JobStatuses; +DROP TABLE IF EXISTS PasswordRecovery; + +/* ==> mysql/000089_add-channelid-to-reaction.up.sql <== */ +DELIMITER // +CREATE PROCEDURE MigrateReactions () +BEGIN + -- 'ALTER TABLE Reactions ADD COLUMN ChannelId varchar(26) NOT NULL DEFAULT "";', + DECLARE AddChannelId BOOLEAN; + DECLARE AddChannelIdQuery TEXT DEFAULT NULL; + + -- 'CREATE INDEX idx_reactions_channel_id ON Reactions(ChannelId);' + DECLARE CreateIndex BOOLEAN; + DECLARE CreateIndexQuery TEXT DEFAULT NULL; + + SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.COLUMNS + WHERE table_name = 'Reactions' + AND table_schema = DATABASE() + AND column_name = 'ChannelId' + INTO AddChannelId; + + SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.STATISTICS + WHERE table_name = 'Reactions' + AND table_schema = DATABASE() + AND index_name = 'idx_reactions_channel_id' + INTO CreateIndex; + + IF AddChannelId THEN + SET AddChannelIdQuery = 'ADD COLUMN ChannelId varchar(26) NOT NULL DEFAULT ""'; + END IF; + + IF CreateIndex THEN + SET CreateIndexQuery = 'ADD INDEX idx_reactions_channel_id (ChannelId)'; + END IF; + + SET @alterQuery = CONCAT_WS(', ', AddChannelIdQuery, CreateIndexQuery); + IF @alterQuery <> '' THEN + SET @query = CONCAT('ALTER TABLE Reactions ', @alterQuery); + PREPARE stmt FROM @query; + EXECUTE stmt; + DEALLOCATE PREPARE stmt; + END IF; + + UPDATE Reactions SET ChannelId = COALESCE((select ChannelId from Posts where Posts.Id = Reactions.PostId), '') WHERE ChannelId=""; +END// +DELIMITER ; +SELECT CONCAT('-- ', NOW(), ' MigrateReactions procedure starting.') AS DEBUG; +CALL MigrateReactions (); +SELECT CONCAT('-- ', NOW(), ' MigrateReactions procedure finished.') AS DEBUG; +DROP PROCEDURE IF EXISTS MigrateReactions; + +/* ==> mysql/000091_create_post_reminder.up.sql <== */ +CREATE TABLE IF NOT EXISTS PostReminders ( + PostId varchar(26) NOT NULL, + UserId varchar(26) NOT NULL, + TargetTime bigint, + INDEX idx_postreminders_targettime (TargetTime), + PRIMARY KEY (PostId, UserId) +); + +/* ==> mysql/000093_notify_admin.up.sql <== */ +CREATE TABLE IF NOT EXISTS NotifyAdmin ( + UserId varchar(26) NOT NULL, + CreateAt bigint(20) DEFAULT NULL, + RequiredPlan varchar(26) NOT NULL, + RequiredFeature varchar(100) NOT NULL, + Trial BOOLEAN NOT NULL, + PRIMARY KEY (UserId, RequiredFeature, RequiredPlan) +); + +/* ==> mysql/000094_threads_teamid.up.sql <== */ +-- Replaced by 000096_threads_threadteamid.up.sql + +/* ==> mysql/000097_create_posts_priority.up.sql <== */ +CREATE TABLE IF NOT EXISTS PostsPriority ( + PostId varchar(26) NOT NULL, + ChannelId varchar(26) NOT NULL, + Priority varchar(32) NOT NULL, + RequestedAck tinyint(1), + PersistentNotifications tinyint(1), + PRIMARY KEY (PostId) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; + +/* ==> mysql/000098_create_post_acknowledgements.up.sql <== */ +CREATE TABLE IF NOT EXISTS PostAcknowledgements ( + PostId varchar(26) NOT NULL, + UserId varchar(26) NOT NULL, + AcknowledgedAt bigint(20) DEFAULT NULL, + PRIMARY KEY (PostId, UserId) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; + +/* ==> mysql/000099_create_drafts.up.sql <== */ +/* ==> mysql/000100_add_draft_priority_column.up.sql <== */ +CREATE TABLE IF NOT EXISTS Drafts ( + CreateAt bigint(20) DEFAULT NULL, + UpdateAt bigint(20) DEFAULT NULL, + DeleteAt bigint(20) DEFAULT NULL, + UserId varchar(26) NOT NULL, + ChannelId varchar(26) NOT NULL, + RootId varchar(26) DEFAULT '', + Message text, + Props text, + FileIds text, + Priority text, + PRIMARY KEY (UserId, ChannelId, RootId) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; + +/* ==> mysql/000101_create_true_up_review_history.up.sql <== */ +CREATE TABLE IF NOT EXISTS TrueUpReviewHistory ( + DueDate bigint(20), + Completed boolean, + PRIMARY KEY (DueDate) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; diff --git a/server/scripts/esrupgrades/esr.6.3-7.8.mysql.cleanup.sql b/server/scripts/esrupgrades/esr.6.3-7.8.mysql.cleanup.sql new file mode 100644 index 0000000000..43af4c4844 --- /dev/null +++ b/server/scripts/esrupgrades/esr.6.3-7.8.mysql.cleanup.sql @@ -0,0 +1,168 @@ +/* Product notices are controlled externally, via the mattermost/notices repository. + When there is a new notice specified there, the server may have time, right after + the migration and before it is shut down, to download it and modify the + ProductNoticeViewState table, adding a row for all users that have not seen it or + removing old notices that no longer need to be shown. This can happen in the + UpdateProductNotices function that is executed periodically to update the notices + cache. The script will never do this, so we need to remove all rows in that table + to avoid any unwanted diff. */ +DELETE FROM ProductNoticeViewState; + +/* Remove migration-related tables that are only updated through the server to track which + migrations have been applied */ +DROP TABLE IF EXISTS db_lock; +DROP TABLE IF EXISTS db_migrations; + +/* The security update check in the server may update the LastSecurityTime system value. To + avoid any spurious difference in the migrations, we update it to a fixed value. */ +UPDATE Systems SET Value = 1 WHERE Name = 'LastSecurityTime'; + +/* The server migration may contain a row in the Systems table marking the onboarding as complete. + There are no migrations related to this, so we can simply drop it here. */ +DELETE FROM Systems WHERE Name = 'FirstAdminSetupComplete'; + +/* The server migration contains an in-app migration that add playbooks permissions to certain roles: + getPlaybooksPermissionsAddManageRoles, defined in https://github.com/mattermost/mattermost-server/blob/56a093ceaee6389a01a35b6d4626ef5a9fea4759/app/permissions_migrations.go#L1056-L1072 + The specific roles ('%playbook%') are removed in the procedure below, but the migrations also add new rows to the Systems table marking the migrations as complete. + This in-app migration does not happen in the script, so we remove that rows here. */ +DELETE FROM Systems WHERE Name = 'playbooks_manage_roles'; + +/* The server migration contains an in-app migration that adds boards permissions to certain roles: + getProductsBoardsPermissions, defined in https://github.com/mattermost/mattermost-server/blob/282bd351e3767dcfd8c8340da2e0915197c0dbcb/app/permissions_migrations.go#L1074-L1093 + The specific roles (sysconsole_read_product_boards and sysconsole_write_product_boards) are removed in the procedure below, + but the migrations also adds a new row to the Systems table marking the migrations as complete. + This in-app migration does not happen in the script, so we remove that row here. */ +DELETE FROM Systems WHERE Name = 'products_boards'; + +/* The server migration contains an in-app migration that adds Ids to the Teams whose InviteId is an empty string: + doRemainingSchemaMigrations, defined in https://github.com/mattermost/mattermost-server/blob/282bd351e3767dcfd8c8340da2e0915197c0dbcb/app/migrations.go#L515-L540 + The migration is not replicated in the script, since it happens in-app, but the server adds a new row to the + Systems table marking the table as complete, which the script doesn't do, so we remove that row here. */ +DELETE FROM Systems WHERE Name = 'RemainingSchemaMigrations'; + +/* The server migration contains three in-app migration that adds a new role and new permissions + related to custom groups. The migrations are: + - doCustomGroupAdminRoleCreationMigration https://github.com/mattermost/mattermost-server/blob/282bd351e3767dcfd8c8340da2e0915197c0dbcb/app/migrations.go#L345-L469 + - getAddCustomUserGroupsPermissions https://github.com/mattermost/mattermost-server/blob/282bd351e3767dcfd8c8340da2e0915197c0dbcb/app/permissions_migrations.go#L974-L995 + - getAddCustomUserGroupsPermissionRestore https://github.com/mattermost/mattermost-server/blob/282bd351e3767dcfd8c8340da2e0915197c0dbcb/app/permissions_migrations.go#L997-L1019 + The specific roles and permissions are removed in the procedure below, but the migrations also + adds a new row to the Roles table for the new role and new rows to the Systems table marking the + migrations as complete. + This in-app migration does not happen in the script, so we remove that row here. */ +DELETE FROM Roles WHERE Name = 'system_custom_group_admin'; +DELETE FROM Systems WHERE Name = 'CustomGroupAdminRoleCreationMigrationComplete'; +DELETE FROM Systems WHERE Name = 'custom_groups_permissions'; +DELETE FROM Systems WHERE Name = 'custom_groups_permission_restore'; + +/* The server migration contains an in-app migration that updates the config, setting ServiceSettings.PostPriority + to true, doPostPriorityConfigDefaultTrueMigration, defined in https://github.com/mattermost/mattermost-server/blob/282bd351e3767dcfd8c8340da2e0915197c0dbcb/app/migrations.go#L542-L560 + The migration is not replicated in the script, since it happens in-app, but the server adds a new row to the + Systems table marking the table as complete, which the script doesn't do, so we remove that row here. */ +DELETE FROM Systems WHERE Name = 'PostPriorityConfigDefaultTrueMigrationComplete'; + +/* The rest of this script defines and executes a procedure to update the Roles table. It performs several changes: + 1. Set the UpdateAt column of all rows to a fixed value, so that the server migration changes to this column + do not appear in the diff. + 2. Remove the set of specific permissions added in the server migration that is not covered by the script, as + this logic happens all in-app after the normal DB migrations. + 3. Set a consistent order in the Permissions column, which is modelled a space-separated string containing each of + the different permissions each role has. This change is the reason why we need a complex procedure, which creates + a temporary table that pairs each single permission to its corresponding ID. So if the Roles table contains two + rows like: + Id: 'abcd' + Permissions: 'view_team read_public_channel invite_user' + Id: 'efgh' + Permissions: 'view_team create_emojis' + then the new temporary table will contain five rows like: + Id: 'abcd' + Permissions: 'view_team' + Id: 'abcd' + Permissions: 'read_public_channel' + Id: 'abcd' + Permissions: 'invite_user' + Id: 'efgh' + Permissions: 'view_team' + Id: 'efgh' + Permissions: 'create_emojis' +*/ + +DROP PROCEDURE IF EXISTS splitPermissions; +DROP PROCEDURE IF EXISTS sortAndFilterPermissionsInRoles; + +DROP TEMPORARY TABLE IF EXISTS temp_roles; +CREATE TEMPORARY TABLE temp_roles(id varchar(26), permission longtext); + +DELIMITER // + +/* Auxiliary procedure that splits the space-separated permissions string into single rows that are inserted + in the temporary temp_roles table along with their corresponding ID. */ +CREATE PROCEDURE splitPermissions( + IN id varchar(26), + IN permissionsString longtext +) +BEGIN + DECLARE idx INT DEFAULT 0; + SELECT TRIM(permissionsString) INTO permissionsString; + SELECT LOCATE(' ', permissionsString) INTO idx; + WHILE idx > 0 DO + INSERT INTO temp_roles SELECT id, TRIM(LEFT(permissionsString, idx)); + SELECT SUBSTR(permissionsString, idx+1) INTO permissionsString; + SELECT LOCATE(' ', permissionsString) INTO idx; + END WHILE; + INSERT INTO temp_roles(id, permission) VALUES(id, TRIM(permissionsString)); +END; // + +/* Main procedure that does update the Roles table */ +CREATE PROCEDURE sortAndFilterPermissionsInRoles() +BEGIN + DECLARE done INT DEFAULT FALSE; + DECLARE rolesId varchar(26) DEFAULT ''; + DECLARE rolesPermissions longtext DEFAULT ''; + DECLARE cur1 CURSOR FOR SELECT Id, Permissions FROM Roles; + DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; + + /* 1. Set a fixed value in the UpdateAt column for all rows in Roles table */ + UPDATE Roles SET UpdateAt = 1; + + /* Call splitPermissions for every row in the Roles table, thus populating the + temp_roles table. */ + OPEN cur1; + read_loop: LOOP + FETCH cur1 INTO rolesId, rolesPermissions; + IF done THEN + LEAVE read_loop; + END IF; + CALL splitPermissions(rolesId, rolesPermissions); + END LOOP; + CLOSE cur1; + + /* 2. Filter out the new permissions added by the in-app migrations */ + DELETE FROM temp_roles WHERE permission LIKE 'sysconsole_read_products_boards'; + DELETE FROM temp_roles WHERE permission LIKE 'sysconsole_write_products_boards'; + DELETE FROM temp_roles WHERE permission LIKE 'playbook_public_manage_roles'; + DELETE FROM temp_roles WHERE permission LIKE 'playbook_private_manage_roles'; + DELETE FROM temp_roles WHERE permission LIKE '%custom_group%'; + + /* Temporarily set to the maximum permitted value, since the call to group_concat + below needs a value bigger than the default */ + SET group_concat_max_len = 18446744073709551615; + + /* 3. Update the Permissions column in the Roles table with the filtered, sorted permissions, + concatenated again as a space-separated string */ + UPDATE + Roles INNER JOIN ( + SELECT temp_roles.id as Id, TRIM(group_concat(temp_roles.permission ORDER BY temp_roles.permission SEPARATOR ' ')) as Permissions + FROM Roles JOIN temp_roles ON Roles.Id = temp_roles.id + GROUP BY temp_roles.id + ) AS Sorted + ON Roles.Id = Sorted.Id + SET Roles.Permissions = Sorted.Permissions; + + /* Reset group_concat_max_len to its default value */ + SET group_concat_max_len = 1024; +END; // +DELIMITER ; + +CALL sortAndFilterPermissionsInRoles(); + +DROP TEMPORARY TABLE IF EXISTS temp_roles; diff --git a/server/scripts/esrupgrades/esr.6.3-7.8.mysql.up.sql b/server/scripts/esrupgrades/esr.6.3-7.8.mysql.up.sql new file mode 100644 index 0000000000..543d4f68bf --- /dev/null +++ b/server/scripts/esrupgrades/esr.6.3-7.8.mysql.up.sql @@ -0,0 +1,599 @@ +/* ==> mysql/000041_create_upload_sessions.up.sql <== */ +/* Release 5.37 was meant to contain the index idx_uploadsessions_type, but a bug prevented that. + This part of the migration #41 adds such index */ + +SET @preparedStatement = (SELECT IF( + ( + SELECT COUNT(*) FROM INFORMATION_SCHEMA.STATISTICS + WHERE table_name = 'UploadSessions' + AND table_schema = DATABASE() + AND index_name = 'idx_uploadsessions_type' + ) > 0, + 'SELECT 1', + 'CREATE INDEX idx_uploadsessions_type ON UploadSessions(Type);' +)); + +PREPARE createIndexIfNotExists FROM @preparedStatement; +EXECUTE createIndexIfNotExists; +DEALLOCATE PREPARE createIndexIfNotExists; + +/* ==> mysql/000075_alter_upload_sessions_index.up.sql <== */ +DELIMITER // +CREATE PROCEDURE AlterIndex() +BEGIN + DECLARE columnName varchar(26) default ''; + + SELECT IFNULL(GROUP_CONCAT(column_name ORDER BY seq_in_index), '') INTO columnName + FROM information_schema.statistics + WHERE table_schema = DATABASE() + AND table_name = 'UploadSessions' + AND index_name = 'idx_uploadsessions_user_id' + GROUP BY index_name; + + IF columnName = 'Type' THEN + DROP INDEX idx_uploadsessions_user_id ON UploadSessions; + CREATE INDEX idx_uploadsessions_user_id ON UploadSessions(UserId); + END IF; +END// +DELIMITER ; +CALL AlterIndex(); +DROP PROCEDURE IF EXISTS AlterIndex; + +/* ==> mysql/000076_upgrade_lastrootpostat.up.sql <== */ +DELIMITER // +CREATE PROCEDURE Migrate_LastRootPostAt_Default () +BEGIN + IF ( + SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS + WHERE TABLE_NAME = 'Channels' + AND TABLE_SCHEMA = DATABASE() + AND COLUMN_NAME = 'LastRootPostAt' + AND (COLUMN_DEFAULT IS NULL OR COLUMN_DEFAULT != 0) + ) = 1 THEN + ALTER TABLE Channels ALTER COLUMN LastRootPostAt SET DEFAULT 0; + END IF; +END// +DELIMITER ; +CALL Migrate_LastRootPostAt_Default (); +DROP PROCEDURE IF EXISTS Migrate_LastRootPostAt_Default; + +DELIMITER // +CREATE PROCEDURE Migrate_LastRootPostAt_Fix () +BEGIN + IF ( + SELECT COUNT(*) + FROM Channels + WHERE LastRootPostAt IS NULL + ) > 0 THEN + -- fixes migrate cte and sets the LastRootPostAt for channels that don't have it set + UPDATE + Channels + INNER JOIN ( + SELECT + Channels.Id channelid, + COALESCE(MAX(Posts.CreateAt), 0) AS lastrootpost + FROM + Channels + LEFT JOIN Posts FORCE INDEX (idx_posts_channel_id_update_at) ON Channels.Id = Posts.ChannelId + WHERE + Posts.RootId = '' + GROUP BY + Channels.Id) AS q ON q.channelid = Channels.Id + SET + LastRootPostAt = lastrootpost + WHERE + LastRootPostAt IS NULL; + + -- sets LastRootPostAt to 0, for channels with no posts + UPDATE Channels SET LastRootPostAt=0 WHERE LastRootPostAt IS NULL; + END IF; +END// +DELIMITER ; +CALL Migrate_LastRootPostAt_Fix (); +DROP PROCEDURE IF EXISTS Migrate_LastRootPostAt_Fix; + +/* ==> mysql/000077_upgrade_users_v6.5.up.sql <== */ + +SET @preparedStatement = (SELECT IF( + ( + SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS + WHERE table_name = 'Users' + AND table_schema = DATABASE() + AND column_name = 'AcceptedServiceTermsId' + ) > 0, + 'ALTER TABLE Users DROP COLUMN AcceptedServiceTermsId;', + 'SELECT 1' +)); + +PREPARE alterIfExists FROM @preparedStatement; +EXECUTE alterIfExists; +DEALLOCATE PREPARE alterIfExists; + +/* ==> mysql/000078_create_oauth_mattermost_app_id.up.sql <== */ +SET @preparedStatement = (SELECT IF( + ( + SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS + WHERE table_name = 'OAuthApps' + AND table_schema = DATABASE() + AND column_name = 'MattermostAppID' + ) > 0, + 'SELECT 1', + 'ALTER TABLE OAuthApps ADD COLUMN MattermostAppID varchar(32);' +)); + +PREPARE alterIfExists FROM @preparedStatement; +EXECUTE alterIfExists; +DEALLOCATE PREPARE alterIfExists; + +/* ==> mysql/000079_usergroups_displayname_index.up.sql <== */ +SET @preparedStatement = (SELECT IF( + ( + SELECT COUNT(*) FROM INFORMATION_SCHEMA.STATISTICS + WHERE table_name = 'UserGroups' + AND table_schema = DATABASE() + AND index_name = 'idx_usergroups_displayname' + ) > 0, + 'SELECT 1', + 'CREATE INDEX idx_usergroups_displayname ON UserGroups(DisplayName);' +)); + +PREPARE createIndexIfNotExists FROM @preparedStatement; +EXECUTE createIndexIfNotExists; +DEALLOCATE PREPARE createIndexIfNotExists; + +/* ==> mysql/000080_posts_createat_id.up.sql <== */ +SET @preparedStatement = (SELECT IF( + ( + SELECT COUNT(*) FROM INFORMATION_SCHEMA.STATISTICS + WHERE table_name = 'Posts' + AND table_schema = DATABASE() + AND index_name = 'idx_posts_create_at_id' + ) > 0, + 'SELECT 1;', + 'CREATE INDEX idx_posts_create_at_id on Posts(CreateAt, Id) LOCK=NONE;' +)); + +PREPARE createIndexIfNotExists FROM @preparedStatement; +EXECUTE createIndexIfNotExists; +DEALLOCATE PREPARE createIndexIfNotExists; + +/* ==> mysql/000081_threads_deleteat.up.sql <== */ +-- Replaced by 000083_threads_threaddeleteat.up.sql + +/* ==> mysql/000082_upgrade_oauth_mattermost_app_id.up.sql <== */ +SET @preparedStatement = (SELECT IF( + ( + SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS + WHERE table_name = 'OAuthApps' + AND table_schema = DATABASE() + AND column_name = 'MattermostAppID' + ) > 0, + 'UPDATE OAuthApps SET MattermostAppID = "" WHERE MattermostAppID IS NULL;', + 'SELECT 1' +)); + +PREPARE alterIfExists FROM @preparedStatement; +EXECUTE alterIfExists; +DEALLOCATE PREPARE alterIfExists; + +SET @preparedStatement = (SELECT IF( + ( + SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS + WHERE table_name = 'OAuthApps' + AND table_schema = DATABASE() + AND column_name = 'MattermostAppID' + ) > 0, + 'ALTER TABLE OAuthApps MODIFY MattermostAppID varchar(32) NOT NULL DEFAULT "";', + 'SELECT 1' +)); + +PREPARE alterIfExists FROM @preparedStatement; +EXECUTE alterIfExists; +DEALLOCATE PREPARE alterIfExists; + +/* ==> mysql/000083_threads_threaddeleteat.up.sql <== */ +-- Drop any existing DeleteAt column from 000081_threads_deleteat.up.sql +SET @preparedStatement = (SELECT IF( + EXISTS( + SELECT 1 FROM INFORMATION_SCHEMA.STATISTICS + WHERE table_name = 'Threads' + AND table_schema = DATABASE() + AND column_name = 'DeleteAt' + ) > 0, + 'ALTER TABLE Threads DROP COLUMN DeleteAt;', + 'SELECT 1;' +)); + +PREPARE removeColumnIfExists FROM @preparedStatement; +EXECUTE removeColumnIfExists; +DEALLOCATE PREPARE removeColumnIfExists; + +SET @preparedStatement = (SELECT IF( + NOT EXISTS( + SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS + WHERE table_name = 'Threads' + AND table_schema = DATABASE() + AND column_name = 'ThreadDeleteAt' + ), + 'ALTER TABLE Threads ADD COLUMN ThreadDeleteAt bigint(20);', + 'SELECT 1;' +)); + +PREPARE addColumnIfNotExists FROM @preparedStatement; +EXECUTE addColumnIfNotExists; +DEALLOCATE PREPARE addColumnIfNotExists; + +UPDATE Threads, Posts +SET Threads.ThreadDeleteAt = Posts.DeleteAt +WHERE Posts.Id = Threads.PostId +AND Threads.ThreadDeleteAt IS NULL; + +/* ==> mysql/000084_recent_searches.up.sql <== */ +CREATE TABLE IF NOT EXISTS RecentSearches ( + UserId CHAR(26), + SearchPointer int, + Query json, + CreateAt bigint NOT NULL, + PRIMARY KEY (UserId, SearchPointer) +); +/* ==> mysql/000085_fileinfo_add_archived_column.up.sql <== */ + +SET @preparedStatement = (SELECT IF( + ( + SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS + WHERE table_name = 'FileInfo' + AND table_schema = DATABASE() + AND column_name = 'Archived' + ) > 0, + 'SELECT 1', + 'ALTER TABLE FileInfo ADD COLUMN Archived boolean NOT NULL DEFAULT false;' +)); + +PREPARE alterIfExists FROM @preparedStatement; +EXECUTE alterIfExists; +DEALLOCATE PREPARE alterIfExists; + +/* ==> mysql/000086_add_cloud_limits_archived.up.sql <== */ +SET @preparedStatement = (SELECT IF( + NOT EXISTS( + SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS + WHERE table_name = 'Teams' + AND table_schema = DATABASE() + AND column_name = 'CloudLimitsArchived' + ), + 'ALTER TABLE Teams ADD COLUMN CloudLimitsArchived BOOLEAN NOT NULL DEFAULT FALSE;', + 'SELECT 1' +)); + +PREPARE alterIfNotExists FROM @preparedStatement; +EXECUTE alterIfNotExists; +DEALLOCATE PREPARE alterIfNotExists; + +/* ==> mysql/000087_sidebar_categories_index.up.sql <== */ +SET @preparedStatement = (SELECT IF( + ( + SELECT COUNT(*) FROM INFORMATION_SCHEMA.STATISTICS + WHERE table_name = 'SidebarCategories' + AND table_schema = DATABASE() + AND index_name = 'idx_sidebarcategories_userid_teamid' + ) > 0, + 'SELECT 1;', + 'CREATE INDEX idx_sidebarcategories_userid_teamid on SidebarCategories(UserId, TeamId) LOCK=NONE;' +)); + +PREPARE createIndexIfNotExists FROM @preparedStatement; +EXECUTE createIndexIfNotExists; +DEALLOCATE PREPARE createIndexIfNotExists; + +/* ==> mysql/000088_remaining_migrations.up.sql <== */ +DROP TABLE IF EXISTS JobStatuses; + +DROP TABLE IF EXISTS PasswordRecovery; + +SET @preparedStatement = (SELECT IF( + ( + SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS + WHERE table_name = 'Users' + AND table_schema = DATABASE() + AND column_name = 'ThemeProps' + ) > 0, + 'INSERT INTO Preferences(UserId, Category, Name, Value) SELECT Id, \'\', \'\', ThemeProps FROM Users WHERE Users.ThemeProps != \'null\'', + 'SELECT 1' +)); + +PREPARE migrateTheme FROM @preparedStatement; +EXECUTE migrateTheme; +DEALLOCATE PREPARE migrateTheme; + +-- We have to do this twice because the prepared statement doesn't support multiple SQL queries +-- in a single string. + +SET @preparedStatement = (SELECT IF( + ( + SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS + WHERE table_name = 'Users' + AND table_schema = DATABASE() + AND column_name = 'ThemeProps' + ) > 0, + 'ALTER TABLE Users DROP COLUMN ThemeProps', + 'SELECT 1' +)); + +PREPARE migrateTheme FROM @preparedStatement; +EXECUTE migrateTheme; +DEALLOCATE PREPARE migrateTheme; + +/* ==> mysql/000089_add-channelid-to-reaction.up.sql <== */ +SET @preparedStatement = (SELECT IF( + NOT EXISTS( + SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS + WHERE table_name = 'Reactions' + AND table_schema = DATABASE() + AND column_name = 'ChannelId' + ), + 'ALTER TABLE Reactions ADD COLUMN ChannelId varchar(26) NOT NULL DEFAULT "";', + 'SELECT 1;' +)); + +PREPARE addColumnIfNotExists FROM @preparedStatement; +EXECUTE addColumnIfNotExists; +DEALLOCATE PREPARE addColumnIfNotExists; + + +UPDATE Reactions SET ChannelId = COALESCE((select ChannelId from Posts where Posts.Id = Reactions.PostId), '') WHERE ChannelId=""; + + +SET @preparedStatement = (SELECT IF( + ( + SELECT COUNT(*) FROM INFORMATION_SCHEMA.STATISTICS + WHERE table_name = 'Reactions' + AND table_schema = DATABASE() + AND index_name = 'idx_reactions_channel_id' + ) > 0, + 'SELECT 1', + 'CREATE INDEX idx_reactions_channel_id ON Reactions(ChannelId);' +)); + +PREPARE createIndexIfNotExists FROM @preparedStatement; +EXECUTE createIndexIfNotExists; +DEALLOCATE PREPARE createIndexIfNotExists; + +/* ==> mysql/000090_create_enums.up.sql <== */ +SET @preparedStatement = (SELECT IF( + ( + SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS + WHERE table_name = 'Channels' + AND table_schema = DATABASE() + AND column_name = 'Type' + AND column_type != 'ENUM("D", "O", "G", "P")' + ) > 0, + 'ALTER TABLE Channels MODIFY COLUMN Type ENUM("D", "O", "G", "P");', + 'SELECT 1' +)); + +PREPARE alterIfExists FROM @preparedStatement; +EXECUTE alterIfExists; +DEALLOCATE PREPARE alterIfExists; + +SET @preparedStatement = (SELECT IF( + ( + SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS + WHERE table_name = 'Teams' + AND table_schema = DATABASE() + AND column_name = 'Type' + AND column_type != 'ENUM("I", "O")' + ) > 0, + 'ALTER TABLE Teams MODIFY COLUMN Type ENUM("I", "O");', + 'SELECT 1' +)); + +PREPARE alterIfExists FROM @preparedStatement; +EXECUTE alterIfExists; +DEALLOCATE PREPARE alterIfExists; + +SET @preparedStatement = (SELECT IF( + ( + SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS + WHERE table_name = 'UploadSessions' + AND table_schema = DATABASE() + AND column_name = 'Type' + AND column_type != 'ENUM("attachment", "import")' + ) > 0, + 'ALTER TABLE UploadSessions MODIFY COLUMN Type ENUM("attachment", "import");', + 'SELECT 1' +)); + +PREPARE alterIfExists FROM @preparedStatement; +EXECUTE alterIfExists; +DEALLOCATE PREPARE alterIfExists; +/* ==> mysql/000091_create_post_reminder.up.sql <== */ +CREATE TABLE IF NOT EXISTS PostReminders ( + PostId varchar(26) NOT NULL, + UserId varchar(26) NOT NULL, + TargetTime bigint, + PRIMARY KEY (PostId, UserId) +); + +SET @preparedStatement = (SELECT IF( + ( + SELECT COUNT(*) FROM INFORMATION_SCHEMA.STATISTICS + WHERE table_name = 'PostReminders' + AND table_schema = DATABASE() + AND index_name = 'idx_postreminders_targettime' + ) > 0, + 'SELECT 1', + 'CREATE INDEX idx_postreminders_targettime ON PostReminders(TargetTime);' +)); + +PREPARE createIndexIfNotExists FROM @preparedStatement; +EXECUTE createIndexIfNotExists; +DEALLOCATE PREPARE createIndexIfNotExists; +/* ==> mysql/000092_add_createat_to_teammembers.up.sql <== */ +SET @preparedStatement = (SELECT IF( + NOT EXISTS( + SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS + WHERE table_name = 'TeamMembers' + AND table_schema = DATABASE() + AND column_name = 'CreateAt' + ), + 'ALTER TABLE TeamMembers ADD COLUMN CreateAt bigint DEFAULT 0;', + 'SELECT 1;' +)); + +PREPARE addColumnIfNotExists FROM @preparedStatement; +EXECUTE addColumnIfNotExists; +DEALLOCATE PREPARE addColumnIfNotExists; + +SET @preparedStatement = (SELECT IF( + ( + SELECT COUNT(*) FROM INFORMATION_SCHEMA.STATISTICS + WHERE table_name = 'TeamMembers' + AND table_schema = DATABASE() + AND index_name = 'idx_teammembers_create_at' + ) > 0, + 'SELECT 1', + 'CREATE INDEX idx_teammembers_createat ON TeamMembers(CreateAt);' +)); + +PREPARE createIndexIfNotExists FROM @preparedStatement; +EXECUTE createIndexIfNotExists; +DEALLOCATE PREPARE createIndexIfNotExists; + +/* ==> mysql/000093_notify_admin.up.sql <== */ +CREATE TABLE IF NOT EXISTS NotifyAdmin ( + UserId varchar(26) NOT NULL, + CreateAt bigint(20) DEFAULT NULL, + RequiredPlan varchar(26) NOT NULL, + RequiredFeature varchar(100) NOT NULL, + Trial BOOLEAN NOT NULL, + PRIMARY KEY (UserId, RequiredFeature, RequiredPlan) +); + +/* ==> mysql/000094_threads_teamid.up.sql <== */ +-- Replaced by 000096_threads_threadteamid.up.sql + +/* ==> mysql/000095_remove_posts_parentid.up.sql <== */ +-- While upgrading from 5.x to 6.x with manual queries, there is a chance that this +-- migration is skipped. In that case, we need to make sure that the column is dropped. + +SET @preparedStatement = (SELECT IF( + ( + SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS + WHERE table_name = 'Posts' + AND table_schema = DATABASE() + AND column_name = 'ParentId' + ) > 0, + 'ALTER TABLE Posts DROP COLUMN ParentId;', + 'SELECT 1' +)); + +PREPARE alterIfExists FROM @preparedStatement; +EXECUTE alterIfExists; +DEALLOCATE PREPARE alterIfExists; + +/* ==> mysql/000096_threads_threadteamid.up.sql <== */ +-- Drop any existing TeamId column from 000094_threads_teamid.up.sql +SET @preparedStatement = (SELECT IF( + EXISTS( + SELECT 1 FROM INFORMATION_SCHEMA.STATISTICS + WHERE table_name = 'Threads' + AND table_schema = DATABASE() + AND column_name = 'TeamId' + ) > 0, + 'ALTER TABLE Threads DROP COLUMN TeamId;', + 'SELECT 1;' +)); + +PREPARE removeColumnIfExists FROM @preparedStatement; +EXECUTE removeColumnIfExists; +DEALLOCATE PREPARE removeColumnIfExists; + +SET @preparedStatement = (SELECT IF( + NOT EXISTS( + SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS + WHERE table_name = 'Threads' + AND table_schema = DATABASE() + AND column_name = 'ThreadTeamId' + ), + 'ALTER TABLE Threads ADD COLUMN ThreadTeamId varchar(26) DEFAULT NULL;', + 'SELECT 1;' +)); + +PREPARE addColumnIfNotExists FROM @preparedStatement; +EXECUTE addColumnIfNotExists; +DEALLOCATE PREPARE addColumnIfNotExists; + +UPDATE Threads, Channels +SET Threads.ThreadTeamId = Channels.TeamId +WHERE Channels.Id = Threads.ChannelId +AND Threads.ThreadTeamId IS NULL; + +/* ==> mysql/000097_create_posts_priority.up.sql <== */ +CREATE TABLE IF NOT EXISTS PostsPriority ( + PostId varchar(26) NOT NULL, + ChannelId varchar(26) NOT NULL, + Priority varchar(32) NOT NULL, + RequestedAck tinyint(1), + PersistentNotifications tinyint(1), + PRIMARY KEY (PostId) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; + +SET @preparedStatement = (SELECT IF( + NOT EXISTS( + SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS + WHERE table_name = 'ChannelMembers' + AND table_schema = DATABASE() + AND column_name = 'UrgentMentionCount' + ), + 'ALTER TABLE ChannelMembers ADD COLUMN UrgentMentionCount bigint(20);', + 'SELECT 1;' +)); + +PREPARE alterIfNotExists FROM @preparedStatement; +EXECUTE alterIfNotExists; +DEALLOCATE PREPARE alterIfNotExists; + +/* ==> mysql/000098_create_post_acknowledgements.up.sql <== */ +CREATE TABLE IF NOT EXISTS PostAcknowledgements ( + PostId varchar(26) NOT NULL, + UserId varchar(26) NOT NULL, + AcknowledgedAt bigint(20) DEFAULT NULL, + PRIMARY KEY (PostId, UserId) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; + +/* ==> mysql/000099_create_drafts.up.sql <== */ +CREATE TABLE IF NOT EXISTS Drafts ( + CreateAt bigint(20) DEFAULT NULL, + UpdateAt bigint(20) DEFAULT NULL, + DeleteAt bigint(20) DEFAULT NULL, + UserId varchar(26) NOT NULL, + ChannelId varchar(26) NOT NULL, + RootId varchar(26) DEFAULT '', + Message text, + Props text, + FileIds text, + PRIMARY KEY (UserId, ChannelId, RootId) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; + +/* ==> mysql/000100_add_draft_priority_column.up.sql <== */ +SET @preparedStatement = (SELECT IF( + ( + SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS + WHERE table_name = 'Drafts' + AND table_schema = DATABASE() + AND column_name = 'Priority' + ) > 0, + 'SELECT 1', + 'ALTER TABLE Drafts ADD COLUMN Priority text;' +)); + +PREPARE alterIfExists FROM @preparedStatement; +EXECUTE alterIfExists; +DEALLOCATE PREPARE alterIfExists; + +/* ==> mysql/000101_create_true_up_review_history.up.sql <== */ +CREATE TABLE IF NOT EXISTS TrueUpReviewHistory ( + DueDate bigint(20), + Completed boolean, + PRIMARY KEY (DueDate) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; diff --git a/server/scripts/esrupgrades/esr.common.mysql.preprocess.sql b/server/scripts/esrupgrades/esr.common.mysql.preprocess.sql new file mode 100644 index 0000000000..4c06e1ba19 --- /dev/null +++ b/server/scripts/esrupgrades/esr.common.mysql.preprocess.sql @@ -0,0 +1,23 @@ +/* The sessions in the DB dump may have expired before the CI tests run, making + the server remove the rows and generating a spurious diff that we want to avoid. + In order to do so, we mark all sessions' ExpiresAt value to 0, so they never expire. */ +UPDATE Sessions SET ExpiresAt = 0; + +/* The dump may not contain a system-bot user, in which case the server will create + one if it's not shutdown before a job requests it. This situation creates a flaky + tests in which, in rare ocassions, the system-bot is indeed created, generating a + spurious diff. We avoid this by making sure that there is a system-bot user and + corresponding bot */ +DELIMITER // +CREATE PROCEDURE AddSystemBotIfNeeded () +BEGIN + DECLARE CreateSystemBot BOOLEAN; + SELECT COUNT(*) = 0 FROM Users WHERE Username = 'system-bot' INTO CreateSystemBot; + IF CreateSystemBot THEN + /* These values are retrieved from a real system-bot created by a server */ + INSERT INTO `Bots` VALUES ('nc7y5x1i8jgr9btabqo5m3579c','','phxrtijfrtfg7k4bwj9nophqyc',0,1681308600015,1681308600015,0); + INSERT INTO `Users` VALUES ('nc7y5x1i8jgr9btabqo5m3579c',1681308600014,1681308600014,0,'system-bot','',NULL,'','system-bot@localhost',0,'','System','','','system_user',0,'{}','{\"push\": \"mention\", \"email\": \"true\", \"channel\": \"true\", \"desktop\": \"mention\", \"comments\": \"never\", \"first_name\": \"false\", \"push_status\": \"away\", \"mention_keys\": \"\", \"push_threads\": \"all\", \"desktop_sound\": \"true\", \"email_threads\": \"all\", \"desktop_threads\": \"all\"}',1681308600014,0,0,'en','{\"manualTimezone\": \"\", \"automaticTimezone\": \"\", \"useAutomaticTimezone\": \"true\"}',0,'',NULL); + END IF; +END// +DELIMITER ; +CALL AddSystemBotIfNeeded(); diff --git a/server/scripts/setup_go_work.sh b/server/scripts/setup_go_work.sh index 5415351813..821a48588e 100755 --- a/server/scripts/setup_go_work.sh +++ b/server/scripts/setup_go_work.sh @@ -8,13 +8,8 @@ then if [ "$BUILD_ENTERPRISE_READY" == "true" ] then - txt="${txt}use ../enterprise\n" + txt="${txt}use ../../enterprise\n" fi - if [ "$BUILD_PLAYBOOKS" == "true" ] - then - txt="${txt}use ../mattermost-plugin-playbooks\n" - fi - - printf "$txt" > "../go.work" + printf "$txt" > "go.work" fi diff --git a/webapp/README.md b/webapp/README.md new file mode 100644 index 0000000000..dfb7d47a09 --- /dev/null +++ b/webapp/README.md @@ -0,0 +1,28 @@ +# Mattermost Web App + +This folder contains the client code for the Mattermost web app. It's broken up into multiple packages each of which either contains an area of the app (such as `playbooks` or `boards`) or shared logic used across other packages (such as the packages located in the `platform` directory). For anyone who's used to working in [the mattermost/mattermost-webapp repo](https://github.com/mattermost/mattermost-webapp), most of that is now located in `channels`. + +## npm Workspaces + +To interact with a workspace using npm, such as to add a dependency or run a script, use the `--workspace` (or `--workspaces`) flag. This can be done when using built-in npm commands such as `npm add` or when running scripts. Those commands should be run from this directory. + +```sh +# Add a dependency to a single package +npm add react --workspace=boards + +# Build multiple packages +npm run build --workspace=packages/client --workspace=packages/components + +# Test all workspaces +npm test --workspaces + +# Clean all workspaces that have a clean script defined +npm run clean --workspaces --if-present +``` + +To install dependencies for a workspace, simply run `npm install` from this folder as you would do normally. Most packages' dependencies will be included in the root `node_modules`, and all packages' dependencies will appear in the `package-lock.json`. A `node_modules` will only be created inside a package if one of its dependencies conflicts with that of another package. + +## Useful Links + +- [Developer setup](https://developers.mattermost.com/contribute/developer-setup/), now included with the Mattermost server developer setup +- [Web app developer documentation](https://developers.mattermost.com/contribute/more-info/webapp/) \ No newline at end of file diff --git a/webapp/boards/.eslintrc.json b/webapp/boards/.eslintrc.json index 38051b75e8..a0bb15cbdd 100644 --- a/webapp/boards/.eslintrc.json +++ b/webapp/boards/.eslintrc.json @@ -11,7 +11,8 @@ "formatjs", "unused-imports", "no-relative-import-paths", - "import-newlines" + "import-newlines", + "eslint-comments" ], "parser": "@typescript-eslint/parser", "settings": { @@ -27,21 +28,101 @@ "line", " Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.\n See LICENSE.txt for license information." ], - "max-lines": "off", - "no-unused-expressions": 0, - "babel/no-unused-expressions": [ + "array-bracket-spacing": [ 2, - { - "allowShortCircuit": true - } + "never" ], - "eol-last": [ + "array-callback-return": 2, + "arrow-body-style": 0, + "arrow-parens": [ 2, "always" ], - "import/no-unresolved": 2, - "import/order": [ + "arrow-spacing": [ 2, + { + "before": true, + "after": true + } + ], + "block-scoped-var": 2, + "brace-style": [ + 2, + "1tbs", + { + "allowSingleLine": false + } + ], + "capitalized-comments": 0, + "class-methods-use-this": 0, + "comma-dangle": [ + 2, + "always-multiline" + ], + "comma-spacing": [ + 2, + { + "before": false, + "after": true + } + ], + "comma-style": [ + 2, + "last" + ], + "complexity": [ + 0, + 10 + ], + "computed-property-spacing": [ + 2, + "never" + ], + "consistent-return": 2, + "consistent-this": [ + 2, + "self" + ], + "constructor-super": 2, + "curly": [ + 2, + "all" + ], + "dot-location": [ + 2, + "property" + ], + "dot-notation": 2, + "eqeqeq": [ + 2, + "smart" + ], + "func-call-spacing": [ + 2, + "never" + ], + "func-name-matching": 0, + "func-names": 2, + "func-style": [ + 2, + "declaration", + { + "allowArrowFunctions": true + } + ], + "generator-star-spacing": [ + 2, + { + "before": false, + "after": true + } + ], + "global-require": 2, + "guard-for-in": 2, + "id-blacklist": 0, + "import/no-unresolved": 0, // ts handles this better + "import/order": [ + "error", { "newlines-between": "always-and-inside-groups", "groups": [ @@ -56,27 +137,413 @@ ] } ], + "indent": 0, // ts handles this + "jsx-quotes": [ + 2, + "prefer-single" + ], + "key-spacing": [ + 2, + { + "beforeColon": false, + "afterColon": true, + "mode": "strict" + } + ], + "keyword-spacing": [ + 2, + { + "before": true, + "after": true, + "overrides": {} + } + ], + "line-comment-position": 0, + "linebreak-style": 2, + "lines-around-comment": [ + 2, + { + "beforeBlockComment": true, + "beforeLineComment": true, + "allowBlockStart": true, + "allowBlockEnd": true + } + ], + "max-lines": [ + 2, + { + "max": 800, + "skipBlankLines": true, + "skipComments": true + } + ], + "max-statements-per-line": [ + 2, + { + "max": 1 + } + ], + "multiline-ternary": [ + 1, + "never" + ], + "new-cap": 2, + "new-parens": 2, + "padding-line-between-statements": [ + 2, + { + "blankLine": "always", + "prev": "*", + "next": "return" + } + ], + "newline-per-chained-call": 0, + "no-alert": 2, + "no-array-constructor": 2, + "no-await-in-loop": 2, + "no-caller": 2, + "no-case-declarations": 2, + "no-class-assign": 2, + "no-compare-neg-zero": 2, + "no-cond-assign": [ + 2, + "except-parens" + ], + "no-confusing-arrow": 2, + "no-console": 2, + "no-const-assign": 2, + "no-constant-condition": 2, + "no-debugger": 2, + "no-div-regex": 2, + "no-dupe-args": 2, + "no-dupe-class-members": 2, + "no-dupe-keys": 2, + "no-duplicate-case": 2, + "no-duplicate-imports": [ + 2, + { + "includeExports": true + } + ], + "no-else-return": 2, + "no-empty": 2, + "no-empty-function": 2, + "no-empty-pattern": 2, + "no-eval": 2, + "no-ex-assign": 2, + "no-extend-native": 2, + "no-extra-bind": 2, + "no-extra-label": 2, + "no-extra-parens": 0, + "no-extra-semi": 2, + "no-fallthrough": 2, + "no-floating-decimal": 2, + "no-func-assign": 2, + "no-global-assign": 2, + "no-implicit-coercion": 2, + "no-implicit-globals": 0, + "no-implied-eval": 2, + "no-inner-declarations": 0, + "no-invalid-regexp": 2, + "no-irregular-whitespace": 2, + "no-iterator": 2, + "no-labels": 2, + "no-lone-blocks": 2, + "no-lonely-if": 2, + "no-loop-func": 2, + "no-magic-numbers": [ + 0, + { + "ignore": [ + -1, + 0, + 1, + 2 + ], + "enforceConst": true, + "detectObjects": true + } + ], + "no-mixed-operators": [ + 2, + { + "allowSamePrecedence": false + } + ], + "no-mixed-spaces-and-tabs": 2, + "no-multi-assign": 2, + "no-multi-spaces": [ + 2, + { + "exceptions": { + "Property": false + } + } + ], + "no-multi-str": 0, + "no-multiple-empty-lines": [ + 2, + { + "max": 1 + } + ], + "no-native-reassign": 2, + "no-negated-condition": 2, + "no-nested-ternary": 2, + "no-new": 2, + "no-new-func": 2, + "no-new-object": 2, + "no-new-symbol": 2, + "no-new-wrappers": 2, + "no-octal-escape": 2, + "no-param-reassign": 2, + "no-process-env": 2, + "no-process-exit": 2, + "no-proto": 2, + "no-redeclare": 2, + "no-return-assign": [ + 2, + "always" + ], + "no-return-await": 2, + "no-script-url": 2, + "no-self-assign": [ + 2, + { + "props": true + } + ], + "no-self-compare": 2, + "no-sequences": 2, + "no-shadow-restricted-names": 2, + "no-spaced-func": 2, + "no-tabs": 0, + "no-template-curly-in-string": 2, + "no-ternary": 0, + "no-this-before-super": 2, + "no-throw-literal": 2, + "no-trailing-spaces": [ + 2, + { + "skipBlankLines": false + } + ], + "no-undef-init": 2, "no-undefined": 0, - "react/jsx-filename-extension": 0, + "no-underscore-dangle": 2, + "no-unexpected-multiline": 2, + "no-unmodified-loop-condition": 2, + "no-unneeded-ternary": [ + 2, + { + "defaultAssignment": false + } + ], + "no-unreachable": 2, + "no-unsafe-finally": 2, + "no-unsafe-negation": 2, + "no-unused-expressions": 2, + "no-unused-vars": [ + 2, + { + "vars": "all", + "args": "after-used" + } + ], + "no-use-before-define": 0, + "no-useless-computed-key": 2, + "no-useless-concat": 2, + "no-useless-constructor": 2, + "no-useless-escape": 2, + "no-useless-rename": 2, + "no-useless-return": 2, + "no-var": 0, + "no-void": 2, + "no-warning-comments": 1, + "no-whitespace-before-property": 2, + "no-with": 2, + "object-curly-newline": 0, + "object-curly-spacing": [ + 2, + "never" + ], + "object-property-newline": [ + 2, + { + "allowMultiplePropertiesPerLine": true + } + ], + "object-shorthand": [ + 2, + "always" + ], + "one-var": [ + 2, + "never" + ], + "one-var-declaration-per-line": 0, + "operator-assignment": [ + 2, + "always" + ], + "operator-linebreak": [ + 2, + "after" + ], + "padded-blocks": [ + 2, + "never" + ], + "prefer-arrow-callback": 2, + "prefer-const": 2, + "prefer-destructuring": 0, + "prefer-numeric-literals": 2, + "prefer-promise-reject-errors": 2, + "prefer-rest-params": 2, + "prefer-spread": 2, + "prefer-template": 0, + "quote-props": [ + 2, + "as-needed" + ], + "quotes": [ + 2, + "single", + "avoid-escape" + ], + "radix": 2, + "react/display-name": [ + 0, + { + "ignoreTranspilerName": false + } + ], + "react/forbid-component-props": 0, + "react/forbid-elements": [ + 2, + { + "forbid": [ + "embed" + ] + } + ], + "react/jsx-boolean-value": [ + 2, + "always" + ], + "react/jsx-closing-bracket-location": [ + 2, + { + "location": "tag-aligned" + } + ], + "react/jsx-curly-spacing": [ + 2, + "never" + ], + "react/jsx-equals-spacing": [ + 2, + "never" + ], + "react/jsx-filename-extension": 2, + "react/jsx-first-prop-new-line": [ + 2, + "multiline" + ], + "react/jsx-handler-names": 0, + "react/jsx-indent": [ + 2, + 4 + ], + "react/jsx-indent-props": [ + 2, + 4 + ], + "react/jsx-key": 2, + "react/jsx-max-props-per-line": [ + 2, + { + "maximum": 1 + } + ], + "react/jsx-no-bind": 0, + "react/jsx-no-comment-textnodes": 2, + "react/jsx-no-duplicate-props": [ + 2, + { + "ignoreCase": false + } + ], + "react/jsx-no-literals": 2, + "react/jsx-no-target-blank": 2, + "react/jsx-no-undef": 2, + "react/jsx-pascal-case": 2, + "react/jsx-tag-spacing": [ + 2, + { + "closingSlash": "never", + "beforeSelfClosing": "never", + "afterOpening": "never" + } + ], + "react/jsx-uses-react": 2, + "react/jsx-uses-vars": 2, + "react/jsx-wrap-multilines": 2, + "react/no-array-index-key": 1, + "react/no-children-prop": 2, + "react/no-danger": 0, + "react/no-danger-with-children": 2, + "react/no-deprecated": 1, + "react/no-did-mount-set-state": 2, + "react/no-did-update-set-state": 2, + "react/no-direct-mutation-state": 2, + "react/no-find-dom-node": 1, + "react/no-is-mounted": 2, + "react/no-multi-comp": [ + 2, + { + "ignoreStateless": true + } + ], + "react/no-render-return-value": 2, + "react/no-set-state": 0, + "react/no-string-refs": 0, + "react/no-unescaped-entities": 2, + "react/no-unknown-property": 2, + "react/no-unused-prop-types": [ + 1, + { + "skipShapeProps": true + } + ], + "react/prefer-es6-class": 2, + "react/prefer-stateless-function": 2, "react/prop-types": [ 2, { "ignore": [ "location", "history", - "component" + "component", + "className" ] } ], - "react/no-string-refs": 2, - "no-only-tests/no-only-tests": [ - 2, - { - "focus": [ - "only", - "skip" - ] - } + "react/require-default-props": 0, + "react/require-optimization": 1, + "react/require-render-return": 2, + "react/self-closing-comp": 2, + "react/sort-comp": 0, + "react/style-prop-object": [ + 2, + { + "allow": [ + "FormattedNumber", + "FormattedDuration", + "FormattedRelativeTime", + "Timestamp" + ] + } ], "max-nested-callbacks": [ 2, @@ -91,17 +558,88 @@ "error", { "allowSameFolder": true, "rootDir": "webapp/boards"} ], - /* "no-restricted-imports": ["error", { - "patterns": ["..*"] - }], */ "import-newlines/enforce": [ 2, 3 ], - "object-curly-spacing": [ + "formatjs/no-multiple-whitespaces": 2, + "require-yield": 2, + "rest-spread-spacing": [ 2, "never" - ] + ], + "semi": [ + 2, + "always" + ], + "semi-spacing": [ + 2, + { + "before": false, + "after": true + } + ], + "sort-imports": [ + 2, + { + "ignoreDeclarationSort": true + } + ], + "sort-keys": 0, + "space-before-blocks": [ + 2, + "always" + ], + "space-before-function-paren": [ + 2, + { + "anonymous": "never", + "named": "never", + "asyncArrow": "always" + } + ], + "space-in-parens": [ + 2, + "never" + ], + "space-infix-ops": 2, + "space-unary-ops": [ + 2, + { + "words": true, + "nonwords": false + } + ], + "symbol-description": 2, + "template-curly-spacing": [ + 2, + "never" + ], + "valid-typeof": [ + 2, + { + "requireStringLiterals": false + } + ], + "vars-on-top": 0, + "wrap-iife": [ + 2, + "outside" + ], + "wrap-regex": 2, + "yoda": [ + 2, + "never", + { + "exceptRange": false, + "onlyEquality": false + } + ], + "eol-last": [ + 2, + "always" + ], + "eslint-comments/no-unused-disable": 2 }, "overrides": [ { @@ -208,7 +746,9 @@ "global-require": 0, "new-cap": 0, "prefer-arrow-callback": 0, - "no-import-assign": 0 + "no-import-assign": 0, + "no-console": 0, + "max-lines": 0 } } ] diff --git a/webapp/boards/i18n/en.json b/webapp/boards/i18n/en.json index a913658a73..2fe9b2c5fa 100644 --- a/webapp/boards/i18n/en.json +++ b/webapp/boards/i18n/en.json @@ -453,4 +453,4 @@ "tutorial_tip.ok": "Next", "tutorial_tip.out": "Opt out of these tips.", "tutorial_tip.seen": "Seen this before?" -} \ No newline at end of file +} diff --git a/webapp/boards/i18n/fa.json b/webapp/boards/i18n/fa.json index d49f74c6b2..c875c9456a 100644 --- a/webapp/boards/i18n/fa.json +++ b/webapp/boards/i18n/fa.json @@ -1,5 +1,5 @@ { - "AppBar.Tooltip": "تغییر وضعیت تخته‌های مرتبط", + "AppBar.Tooltip": "تغییر وضعیت تابلوهای مرتبط", "Attachment.Attachment-title": "ضمیمه", "AttachmentBlock.DeleteAction": "حذف", "AttachmentBlock.addElement": "افزودن {type}", diff --git a/webapp/boards/i18n/fr.json b/webapp/boards/i18n/fr.json index ad55293a0d..a94f4529f5 100644 --- a/webapp/boards/i18n/fr.json +++ b/webapp/boards/i18n/fr.json @@ -1,5 +1,14 @@ { + "AdminBadge.SystemAdmin": "Administrateur", + "AdminBadge.TeamAdmin": "Administrateur d'équipe", "AppBar.Tooltip": "Activer les panneaux liés", + "Attachment.Attachment-title": "Pièce jointe", + "AttachmentBlock.DeleteAction": "supprimer", + "AttachmentBlock.addElement": "ajouter {type}", + "AttachmentBlock.delete": "Pièce jointe supprimée.", + "AttachmentBlock.failed": "Impossible de télécharger le fichier. Limite de taille de fichier atteinte.", + "AttachmentElement.delete-confirmation-dialog-button-text": "Supprimer", + "AttachmentElement.download": "Télécharger", "BoardComponent.add-a-group": "+ Ajouter un groupe", "BoardComponent.delete": "Supprimer", "BoardComponent.hidden-columns": "Colonnes cachées", @@ -71,6 +80,7 @@ "CardBadges.title-checkboxes": "Cases à cocher", "CardBadges.title-comments": "Commentaires", "CardBadges.title-description": "Cette carte a une description", + "CardDetail.Attach": "Joindre", "CardDetail.Follow": "Suivre", "CardDetail.Following": "Suivi", "CardDetail.add-content": "Ajouter du contenu", @@ -92,6 +102,7 @@ "CardDetailProperty.property-deleted": "{propertyName} supprimé avec succès !", "CardDetailProperty.property-name-change-subtext": "de \"{oldPropType}\" à \"{newPropType}\"", "CardDetial.limited-link": "En savoir plus sur nos offres.", + "CardDialog.delete-confirmation-dialog-attachment": "Confirmer la suppression de la pièce jointe", "CardDialog.delete-confirmation-dialog-button-text": "Supprimer", "CardDialog.delete-confirmation-dialog-heading": "Confirmer la suppression de la carte !", "CardDialog.editing-template": "Vous éditez un modèle.", @@ -102,9 +113,12 @@ "Categories.CreateCategoryDialog.UpdateText": "Mettre à jour", "CenterPanel.Login": "Connexion", "CenterPanel.Share": "Partager", + "ChannelIntro.CreateBoard": "Créer un tableau", "ColorOption.selectColor": "Choisir la couleur {color}", "Comment.delete": "Supprimer", "CommentsList.send": "Envoyer", + "ConfirmPerson.empty": "Vide", + "ConfirmPerson.search": "Recherche en cours…", "ConfirmationDialog.cancel-action": "Annuler", "ConfirmationDialog.confirm-action": "Confirmer", "ContentBlock.Delete": "Supprimer", @@ -118,9 +132,11 @@ "ContentBlock.editText": "Éditer le texte...", "ContentBlock.image": "image", "ContentBlock.insertAbove": "Insérer au-dessus", + "ContentBlock.moveBlock": "Déplacer le contenu de la carte", "ContentBlock.moveDown": "Déplacer vers le bas", "ContentBlock.moveUp": "Déplacer vers le haut", "ContentBlock.text": "texte", + "DateFilter.empty": "Vide", "DateRange.clear": "Supprimer", "DateRange.empty": "Vide", "DateRange.endDate": "Date de fin", @@ -139,10 +155,14 @@ "Filter.ends-with": "se termine par", "Filter.includes": "inclus", "Filter.is": "est", + "Filter.is-after": "est après", + "Filter.is-before": "est avant", "Filter.is-empty": "est vide", "Filter.is-not-empty": "n'est pas vide", "Filter.is-not-set": "n'est pas renseigné", "Filter.is-set": "est renseigné", + "Filter.isafter": "est après", + "Filter.isbefore": "est avant", "Filter.not-contains": "ne contient pas", "Filter.not-ends-with": "ne se termine pas par", "Filter.not-includes": "n'inclut pas", @@ -151,6 +171,7 @@ "FilterByText.placeholder": "filtre de texte", "FilterComponent.add-filter": "+ Ajouter un filtre", "FilterComponent.delete": "Supprimer", + "FilterValue.empty": "(vide)", "FindBoardsDialog.IntroText": "Rechercher des tableaux", "FindBoardsDialog.NoResultsFor": "Pas de résultats pour \"{searchQuery}\"", "FindBoardsDialog.NoResultsSubtext": "Vérifiez l'orthographe ou essayez une autre recherche.", @@ -161,6 +182,7 @@ "GroupBy.ungroup": "Dégrouper", "HideBoard.MenuOption": "Cacher le tableau", "KanbanCard.untitled": "Sans titre", + "MentionSuggestion.is-not-board-member": "(non membre du tableau)", "Mutator.new-board-from-template": "nouveau tableau à partir du modèle", "Mutator.new-card-from-template": "nouvelle carte depuis un modèle", "Mutator.new-template-from-card": "nouveau modèle depuis une carte", @@ -178,6 +200,9 @@ "OnboardingTour.OpenACard.Title": "Ouvrir une carte", "OnboardingTour.ShareBoard.Body": "Vous pouvez partager votre tableau en interne, au sein de votre équipe ou le publier publiquement pour une visibilité en dehors de votre organisation.", "OnboardingTour.ShareBoard.Title": "Partager un tableau", + "PersonProperty.board-members": "Membres du tableau", + "PersonProperty.me": "Moi", + "PersonProperty.non-board-members": "Non membres du tableau", "PropertyMenu.Delete": "Supprimer", "PropertyMenu.changeType": "Changer le type de la propriété", "PropertyMenu.selectType": "Sélectionner le type de propriété", @@ -187,6 +212,7 @@ "PropertyType.CreatedTime": "Date de création", "PropertyType.Date": "Date", "PropertyType.Email": "Adresse e-mail", + "PropertyType.MultiPerson": "Personne multiple", "PropertyType.MultiSelect": "Sélection multiple", "PropertyType.Number": "Nombre", "PropertyType.Person": "Personne", @@ -230,6 +256,8 @@ "Sidebar.import-archive": "Importer une archive", "Sidebar.invite-users": "Inviter des utilisateurs", "Sidebar.logout": "Se déconnecter", + "Sidebar.new-category.badge": "Nouveau", + "Sidebar.new-category.drag-boards-cta": "Déplacer les tableaux ici...", "Sidebar.no-boards-in-category": "Aucun tableaux", "Sidebar.product-tour": "Visite guidée", "Sidebar.random-icons": "Icônes aléatoires", @@ -252,6 +280,8 @@ "SidebarTour.SidebarCategories.Body": "Tous vos tableaux sont maintenant organisés sous votre nouvelle barre latérale. Plus besoin de basculer entre les espaces de travail. Des catégories personnalisées uniques basées sur vos espaces de travail précédents peuvent avoir été automatiquement créées pour vous dans le cadre de la mise à jour 7.2. Ceux-ci peuvent être supprimés ou modifiés selon vos préférences.", "SidebarTour.SidebarCategories.Link": "En savoir plus", "SidebarTour.SidebarCategories.Title": "Catégories de la barre latérale", + "SiteStats.total_boards": "Total des tableaux", + "SiteStats.total_cards": "Total des cartes", "TableComponent.add-icon": "Ajouter une icône", "TableComponent.name": "Nom", "TableComponent.plus-new": "+ Nouveau", @@ -262,6 +292,8 @@ "TableHeaderMenu.insert-right": "Insérer à droite", "TableHeaderMenu.sort-ascending": "Tri ascendant", "TableHeaderMenu.sort-descending": "Tri descendant", + "TableRow.DuplicateCard": "Dupliquer une carte", + "TableRow.MoreOption": "Plus d'actions", "TableRow.open": "Ouvrir", "TopBar.give-feedback": "Donner un avis", "URLProperty.copiedLink": "Copié !", @@ -277,6 +309,7 @@ "ValueSelector.valueSelector": "Sélecteur de value", "ValueSelectorLabel.openMenu": "Ouvrir le menu", "VersionMessage.help": "Découvrez les nouveautés de cette version.", + "VersionMessage.learn-more": "En savoir plus", "View.AddView": "Ajouter une vue", "View.Board": "Tableau", "View.DeleteView": "Supprimer la vue", @@ -331,6 +364,9 @@ "WelcomePage.StartUsingIt.Text": "Commencez à l'utiliser", "Workspace.editing-board-template": "Vous éditez un modèle de tableau.", "badge.guest": "Invité", + "boardPage.confirm-join-button": "Rejoindre", + "boardPage.confirm-join-text": "Vous êtes sur le point de rejoindre un forum privé sans avoir été explicitement ajouté par l'administrateur du forum. Êtes-vous sûr de vouloir rejoindre ce forum privé ?", + "boardPage.confirm-join-title": "Rejoindre un tableau privé", "boardSelector.confirm-link-board": "Lier la carte au canal", "boardSelector.confirm-link-board-button": "Oui, lier ce tableau", "boardSelector.confirm-link-board-subtext": "Lorsque vous liez \"{boardName}\" au canal, tous les membres du canal (existants et nouveaux) pourront le modifier. Vous pouvez dissocier un tableau d'un canal à tout moment.", @@ -343,6 +379,8 @@ "calendar.month": "Mois", "calendar.today": "AUJOURD'HUI", "calendar.week": "Semaine", + "centerPanel.undefined": "Pas de {propertyName}", + "centerPanel.unknown-user": "Utilisateur inconnu", "cloudMessage.learn-more": "En savoir plus", "createImageBlock.failed": "Impossible de télécharger le fichier. Limite de taille de fichier atteinte.", "default-properties.badges": "Commentaires et description", @@ -364,6 +402,10 @@ "login.log-in-button": "Connexion", "login.log-in-title": "Connexion", "login.register-button": "ou créez un compte si vous n'en avez pas", + "new_channel_modal.create_board.empty_board_description": "Créer un nouveau tableau vide", + "new_channel_modal.create_board.empty_board_title": "Tableau vide", + "new_channel_modal.create_board.select_template_placeholder": "Sélectionner un modèle", + "new_channel_modal.create_board.title": "Créer un tableau pour ce canal", "notification-box-card-limit-reached.close-tooltip": "Oublier pendant 10 jours", "notification-box-card-limit-reached.contact-link": "informez votre administrateur", "notification-box-card-limit-reached.link": "Passer à une offre payante", diff --git a/webapp/boards/i18n/ja.json b/webapp/boards/i18n/ja.json index a4eae6f694..9d5b6fc20e 100644 --- a/webapp/boards/i18n/ja.json +++ b/webapp/boards/i18n/ja.json @@ -1,5 +1,7 @@ { - "AppBar.Tooltip": "リンク先Boardの切替え", + "AdminBadge.SystemAdmin": "管理者", + "AdminBadge.TeamAdmin": "チーム管理者", + "AppBar.Tooltip": "リンク先Boardsの切替え", "Attachment.Attachment-title": "添付する", "AttachmentBlock.DeleteAction": "削除", "AttachmentBlock.addElement": "{type} を追加", @@ -137,6 +139,7 @@ "ContentBlock.moveDown": "下へ移動する", "ContentBlock.moveUp": "上へ移動する", "ContentBlock.text": "テキスト", + "DateFilter.empty": "空", "DateRange.clear": "クリア", "DateRange.empty": "空", "DateRange.endDate": "終了日", @@ -155,10 +158,14 @@ "Filter.ends-with": "で終わる", "Filter.includes": "を含む", "Filter.is": "と一致する", + "Filter.is-after": "が次の日付以降", + "Filter.is-before": "が次の日付以前", "Filter.is-empty": "が空である", "Filter.is-not-empty": "が空でない", "Filter.is-not-set": "が未設定", "Filter.is-set": "が設定済み", + "Filter.isafter": "が次の日付以降", + "Filter.isbefore": "が次の日付以前", "Filter.not-contains": "を含まない", "Filter.not-ends-with": "で終わらない", "Filter.not-includes": "を含まない", @@ -305,6 +312,7 @@ "ValueSelector.valueSelector": "値選択", "ValueSelectorLabel.openMenu": "メニューを開く", "VersionMessage.help": "このバージョンの新機能を確認する。", + "VersionMessage.learn-more": "詳しく", "View.AddView": "ビューを追加", "View.Board": "Board", "View.DeleteView": "ビューを削除", @@ -359,6 +367,9 @@ "WelcomePage.StartUsingIt.Text": "利用を開始する", "Workspace.editing-board-template": "Boardのテンプレートを編集しています。", "badge.guest": "ゲスト", + "boardPage.confirm-join-button": "参加", + "boardPage.confirm-join-text": "あなたは、ボード管理者によって明示的に追加されることなく、非公開のボードに参加しようとしています。本当にこの非公開ボードに参加しますか?", + "boardPage.confirm-join-title": "非公開ボードに参加", "boardSelector.confirm-link-board": "Boardをチャンネルへリンク", "boardSelector.confirm-link-board-button": "はい、Boardをリンクします", "boardSelector.confirm-link-board-subtext": "\"{boardName}\" をチャンネルにリンクすると、チャンネルの(既存/新規)メンバー全員がBoardを編集できるようになります。ただし、ゲストユーザーは除外されます。Boardとチャンネルのリンク解除はいつでも可能です。", diff --git a/webapp/boards/i18n/ka.json b/webapp/boards/i18n/ka.json index 5623cbd56e..9d3b5d3553 100644 --- a/webapp/boards/i18n/ka.json +++ b/webapp/boards/i18n/ka.json @@ -5,7 +5,7 @@ "BoardComponent.hidden-columns": "დამალული სვეტები", "BoardComponent.hide": "დამალვა", "BoardComponent.new": "+ ახალი", - "BoardComponent.no-property": "არ არის {Property}", + "BoardComponent.no-property": "არ არის {property}", "BoardComponent.no-property-title": "ცარიელი {property} საკუთრების მქონე ელემენტები აქ წავა. ამ სვეტის წაშლა შეუძლებელია.", "BoardComponent.show": "ჩვენება", "BoardMember.schemeAdmin": "ადმინისტრატორი", diff --git a/webapp/boards/i18n/ko.json b/webapp/boards/i18n/ko.json index 3e622dda50..8c97934d1b 100644 --- a/webapp/boards/i18n/ko.json +++ b/webapp/boards/i18n/ko.json @@ -1,22 +1,24 @@ { - "AppBar.Tooltip": "링크된 보드로 이동", + "AdminBadge.SystemAdmin": "시스템 관리자", + "AdminBadge.TeamAdmin": "팀 관리자", + "AppBar.Tooltip": "연결된 보드 토글", "Attachment.Attachment-title": "첨부", "AttachmentBlock.DeleteAction": "삭제", "AttachmentBlock.addElement": "{type} 추가", - "AttachmentBlock.delete": "첨부 파일이 삭제되었습니다.", + "AttachmentBlock.delete": "첨부 파일을 삭제했습니다.", "AttachmentBlock.failed": "첨부 파일 크기 제한을 초과하기 때문에 업로드할 수 없습니다.", "AttachmentBlock.upload": "첨부 파일을 업로드 중입니다.", - "AttachmentBlock.uploadSuccess": "첨부 파일이 성공적으로 업로드 되었습니다.", + "AttachmentBlock.uploadSuccess": "첨부 파일을 업로드했습니다.", "AttachmentElement.delete-confirmation-dialog-button-text": "삭제", "AttachmentElement.download": "다운로드", "AttachmentElement.upload-percentage": "업로드 중...({uploadPercent}%)", - "BoardComponent.add-a-group": "+ 그룹 추가하기", - "BoardComponent.delete": "삭제하기", + "BoardComponent.add-a-group": "+ 그룹 추가", + "BoardComponent.delete": "삭제", "BoardComponent.hidden-columns": "숨겨진 열", "BoardComponent.hide": "숨기기", - "BoardComponent.new": "+ 추가하기", + "BoardComponent.new": "+ 신규", "BoardComponent.no-property": "{property} 속성 없음", - "BoardComponent.no-property-title": "{property} 속성이 빈 항목은 여기로 이동됩니다. 이 열은 제거할 수 없습니다.", + "BoardComponent.no-property-title": "{property} 속성이 빈 항목은 여기에 배치됩니다. 이 열은 제거할 수 없습니다.", "BoardComponent.show": "보이기", "BoardMember.schemeAdmin": "관리자", "BoardMember.schemeCommenter": "댓글 작성자", @@ -29,12 +31,12 @@ "BoardTemplateSelector.add-template": "새 템플릿 만들기", "BoardTemplateSelector.create-empty-board": "빈 보드 만들기", "BoardTemplateSelector.delete-template": "삭제", - "BoardTemplateSelector.description": "아래에 정의된 템플릿을 사용하여 사이드바에 보드를 추가하거나 처음부터 시작하십시오.", + "BoardTemplateSelector.description": "아래에 정의된 템플릿을 사용하여 사이드바에 보드를 추가하거나 처음부터 시작하세요.", "BoardTemplateSelector.edit-template": "편집", - "BoardTemplateSelector.plugin.no-content-description": "아래에 정의된 템플릿을 사용하여 사이드바에 보드를 추가하거나 처음부터 시작하십시오.", + "BoardTemplateSelector.plugin.no-content-description": "아래에 정의된 템플릿을 사용하여 사이드바에 보드를 추가하거나 처음부터 시작하세요.", "BoardTemplateSelector.plugin.no-content-title": "보드 만들기", "BoardTemplateSelector.title": "보드 만들기", - "BoardTemplateSelector.use-this-template": "이 템플릿 사용하기", + "BoardTemplateSelector.use-this-template": "이 템플릿 사용", "BoardsSwitcher.Title": "보드 찾기", "BoardsUnfurl.Limited": "보관 중인 카드로 인해 추가 세부정보가 숨겨져 있습니다", "BoardsUnfurl.Remainder": "+{remainder} 추가", @@ -48,7 +50,7 @@ "Calculations.Options.countUnchecked.displayName": "확인되지 않음", "Calculations.Options.countUnchecked.label": "확인되지 않은 개수", "Calculations.Options.countUniqueValue.displayName": "고윳값", - "Calculations.Options.countUniqueValue.label": "고유 값 계산", + "Calculations.Options.countUniqueValue.label": "고유값 계산", "Calculations.Options.countValue.displayName": "값", "Calculations.Options.countValue.label": "계산 값", "Calculations.Options.dateRange.displayName": "범위", @@ -59,22 +61,22 @@ "Calculations.Options.latest.label": "늦은 순으로", "Calculations.Options.max.displayName": "최대", "Calculations.Options.max.label": "최대", - "Calculations.Options.median.displayName": "중앙값", - "Calculations.Options.median.label": "중앙값", + "Calculations.Options.median.displayName": "중간", + "Calculations.Options.median.label": "중간", "Calculations.Options.min.displayName": "최소", "Calculations.Options.min.label": "최소", - "Calculations.Options.none.displayName": "계산하기", + "Calculations.Options.none.displayName": "계산", "Calculations.Options.none.label": "없음", "Calculations.Options.percentChecked.displayName": "확인됨", - "Calculations.Options.percentChecked.label": "선택된 비율", + "Calculations.Options.percentChecked.label": "확인된 비율", "Calculations.Options.percentUnchecked.displayName": "확인되지 않음", - "Calculations.Options.percentUnchecked.label": "선택되지 않은 비율", + "Calculations.Options.percentUnchecked.label": "확인되지 않은 비율", "Calculations.Options.range.displayName": "범위", "Calculations.Options.range.label": "범위", "Calculations.Options.sum.displayName": "더하기", - "Calculations.Options.sum.label": "더하기", + "Calculations.Options.sum.label": "합계", "CalendarCard.untitled": "제목 없음", - "CardActionsMenu.copiedLink": "복사!", + "CardActionsMenu.copiedLink": "복사됨!", "CardActionsMenu.copyLink": "링크 복사하기", "CardActionsMenu.delete": "삭제", "CardActionsMenu.duplicate": "복제하기", @@ -82,30 +84,30 @@ "CardBadges.title-comments": "댓글", "CardBadges.title-description": "이 카드에는 설명이 있습니다", "CardDetail.Attach": "첨부", - "CardDetail.Follow": "팔로우하기", - "CardDetail.Following": "팔로우 중", - "CardDetail.add-content": "콘텐츠 추가하기", - "CardDetail.add-icon": "아이콘 추가하기", - "CardDetail.add-property": "+ 속성 추가하기", - "CardDetail.addCardText": "카드 텍스트 추가하기", + "CardDetail.Follow": "팔로우", + "CardDetail.Following": "팔로잉", + "CardDetail.add-content": "콘텐츠 추가", + "CardDetail.add-icon": "아이콘 추가", + "CardDetail.add-property": "+ 속성 추가", + "CardDetail.addCardText": "카드 텍스트 추가", "CardDetail.limited-body": "Professional 또는 Enterprise 플랜으로 업그레이드하여 보관된 카드를 보거나 보드당 무제한 보기, 카드 무제한 보기 등을 할 수 있습니다.", "CardDetail.limited-button": "업그레이드", - "CardDetail.limited-title": "숨겨진 카드가 있습니다", - "CardDetail.moveContent": "카드 내용 이동하기", - "CardDetail.new-comment-placeholder": "댓글 추가하기...", + "CardDetail.limited-title": "숨겨진 카드입니다", + "CardDetail.moveContent": "카드 내용 이동", + "CardDetail.new-comment-placeholder": "댓글 추가...", "CardDetailProperty.confirm-delete-heading": "속성 삭제 확인", "CardDetailProperty.confirm-delete-subtext": "정말로 \"{propertyName}\"속성을 삭제할까요? 보드의 모든 카드에서 이 속성이 삭제됩니다.", - "CardDetailProperty.confirm-property-name-change-subtext": "정말로 \"{propertyName}\"속성을 {customText}로 바꾸시겠습니까? 이 보드에 있는 {numOfCards}개의 카드가 수정되며, 데이터가 손실될 수 있습니다.", - "CardDetailProperty.confirm-property-type-change": "속성 유형 변경 확인하기", - "CardDetailProperty.delete-action-button": "삭제하기", - "CardDetailProperty.property-change-action-button": "속성 변경하기", + "CardDetailProperty.confirm-property-name-change-subtext": "정말로 \"{propertyName}\"속성을 {customText}(으)로 바꾸시겠습니까? 이 보드에 있는 {numOfCards}개의 카드가 수정되며, 데이터가 손실될 수 있습니다.", + "CardDetailProperty.confirm-property-type-change": "속성 유형 변경 확인", + "CardDetailProperty.delete-action-button": "삭제", + "CardDetailProperty.property-change-action-button": "속성 변경", "CardDetailProperty.property-changed": "성공적으로 속성이 변경되었습니다!", "CardDetailProperty.property-deleted": "{propertyName}을(를) 성공적으로 삭제했습니다!", - "CardDetailProperty.property-name-change-subtext": "유형을 \"{oldPropType}\"에서 \"{newPropType}\"로", - "CardDetial.limited-link": "우리 계획에 대해 더 알아보기.", - "CardDialog.delete-confirmation-dialog-attachment": "첨부 파일 삭제 확인!", + "CardDetailProperty.property-name-change-subtext": "유형을 \"{oldPropType}\"에서 \"{newPropType}\"(으)로", + "CardDetial.limited-link": "Plan에 대해 자세히 알아보기.", + "CardDialog.delete-confirmation-dialog-attachment": "첨부 파일 삭제 확인", "CardDialog.delete-confirmation-dialog-button-text": "삭제", - "CardDialog.delete-confirmation-dialog-heading": "카드 삭제 확인!", + "CardDialog.delete-confirmation-dialog-heading": "카드 삭제 확인", "CardDialog.editing-template": "템플릿을 수정하는 중입니다.", "CardDialog.nocard": "이 카드는 존재하지 않거나 사용할 수 없습니다.", "Categories.CreateCategoryDialog.CancelText": "취소", @@ -114,63 +116,72 @@ "Categories.CreateCategoryDialog.UpdateText": "업데이트", "CenterPanel.Login": "로그인", "CenterPanel.Share": "공유", + "ChannelIntro.CreateBoard": "보드 생성", "ColorOption.selectColor": "{color} 색 선택하기", - "Comment.delete": "삭제하기", + "Comment.delete": "삭제", "CommentsList.send": "보내기", - "ConfirmationDialog.cancel-action": "취소하기", - "ConfirmationDialog.confirm-action": "결정하기", - "ContentBlock.Delete": "삭제하기", - "ContentBlock.DeleteAction": "삭제하기", - "ContentBlock.addElement": "{type} 추가하기", + "ConfirmPerson.empty": "빈", + "ConfirmPerson.search": "검색...", + "ConfirmationDialog.cancel-action": "취소", + "ConfirmationDialog.confirm-action": "확인", + "ContentBlock.Delete": "삭제", + "ContentBlock.DeleteAction": "삭제", + "ContentBlock.addElement": "{type} 추가", "ContentBlock.checkbox": "체크박스", "ContentBlock.divider": "구분선", "ContentBlock.editCardCheckbox": "토글 체크박스", - "ContentBlock.editCardCheckboxText": "카드 텍스트 수정하기", - "ContentBlock.editCardText": "카드 텍스트 수정하기", - "ContentBlock.editText": "텍스트 수정하기...", + "ContentBlock.editCardCheckboxText": "카드 텍스트 수정", + "ContentBlock.editCardText": "카드 텍스트 수정", + "ContentBlock.editText": "텍스트 수정...", "ContentBlock.image": "이미지", - "ContentBlock.insertAbove": "위에 삽입하기", + "ContentBlock.insertAbove": "위에 삽입", "ContentBlock.moveBlock": "카드 내용 이동", - "ContentBlock.moveDown": "아래로 이동하기", - "ContentBlock.moveUp": "위로 이동하기", + "ContentBlock.moveDown": "아래로 이동", + "ContentBlock.moveUp": "위로 이동", "ContentBlock.text": "텍스트", + "DateFilter.empty": "빈", "DateRange.clear": "지우기", - "DateRange.empty": "비어 있음", + "DateRange.empty": "빈", "DateRange.endDate": "종료일자", "DateRange.today": "오늘", "DeleteBoardDialog.confirm-cancel": "취소", "DeleteBoardDialog.confirm-delete": "삭제", "DeleteBoardDialog.confirm-info": "“{boardTitle}” 보드를 삭제하시겠습니까? 이 보드에 있는 모든 카드들이 삭제됩니다.", "DeleteBoardDialog.confirm-info-template": "{boardTitle} 보드 템플릿을 삭제 하시겠습니까?", - "DeleteBoardDialog.confirm-tite": "보드 삭제 확인하기", - "DeleteBoardDialog.confirm-tite-template": "보드 템플릿 삭제 확인하기", + "DeleteBoardDialog.confirm-tite": "보드 삭제 확인", + "DeleteBoardDialog.confirm-tite-template": "보드 템플릿 삭제 확인", "Dialog.closeDialog": "대화창 닫기", "EditableDayPicker.today": "오늘", "Error.mobileweb": "모바일 웹 지원은 현재 초기 베타 버전입니다. 모든 기능이 있는 것은 아닙니다.", - "Error.websocket-closed": "웹소켓 연결이 닫혀서 연결이 중단되었습니다. 이 문제가 지속되면, 서버 또는 웹 프록시 구성을 확인하세요.", - "Filter.contains": "필터를 포함하다", - "Filter.ends-with": "~로 끝나다", - "Filter.includes": "~를 포함한다", + "Error.websocket-closed": "웹소켓 연결이 닫혀서 연결이 중단되었습니다. 이 문제가 지속되면 서버 또는 웹 프록시 구성을 확인하세요.", + "Filter.contains": "~을 포함", + "Filter.ends-with": "~로 끝남", + "Filter.includes": "~을 포함", "Filter.is": "~이다", + "Filter.is-after": "~ 이후", + "Filter.is-before": "~ 이전", "Filter.is-empty": "비어있음", "Filter.is-not-empty": "비어 있지 않음", "Filter.is-not-set": "미설정", "Filter.is-set": "설정", - "Filter.not-contains": "~를 포함하지 않음", + "Filter.isafter": "~ 이후", + "Filter.isbefore": "~ 이전", + "Filter.not-contains": "~을 포함하지 않음", "Filter.not-ends-with": "~로 끝나지 않음", - "Filter.not-includes": "~를 포함하지 않음", + "Filter.not-includes": "~을 포함하지 않음", "Filter.not-starts-with": "~로 시작하지 않음", "Filter.starts-with": "~로 시작함", "FilterByText.placeholder": "필터값", "FilterComponent.add-filter": "+ 필터 추가", "FilterComponent.delete": "삭제", + "FilterValue.empty": "(비었음)", "FindBoardsDialog.IntroText": "보드에서 검색", "FindBoardsDialog.NoResultsFor": "\"{searchQuery}\" 에 대한 검색 결과가 없습니다", - "FindBoardsDialog.NoResultsSubtext": "글자를 확인 하시거나 다른 단어로 검색해 주세요.", - "FindBoardsDialog.SubTitle": "보드를 찾으려면 입력하십시오. UP/DOWN 버튼을 이용해서 보드를 찾아주세요. 선택은 ENTER , 해제는 ESC", + "FindBoardsDialog.NoResultsSubtext": "오타를 확인 또는 다른 단어로 검색해보세요.", + "FindBoardsDialog.SubTitle": "보드를 찾으려면 입력하십시오. 탐색은 UP/DOWN 버튼으로, 선택은 ENTER , 해제는 ESC입니다", "FindBoardsDialog.Title": "보드 찾기", - "GroupBy.hideEmptyGroups": "{count} 그룹 숨기기", - "GroupBy.showHiddenGroups": "{count} 숨김 그룹 보기", + "GroupBy.hideEmptyGroups": "{count}개의 빈 그룹 숨기기", + "GroupBy.showHiddenGroups": "{count}개의 숨김 그룹 보기", "GroupBy.ungroup": "그룹 해제", "HideBoard.MenuOption": "보드 숨기기", "KanbanCard.untitled": "제목 없음", @@ -178,21 +189,22 @@ "Mutator.new-board-from-template": "템플릿에서 신규 보드 만들기", "Mutator.new-card-from-template": "템플릿에서 신규 카드 만들기", "Mutator.new-template-from-card": "카드에서 신규 템플릿 만들기", - "OnboardingTour.AddComments.Body": "@mention 을 이용하여 이슈에 대해 메터머스트 사용자에게 알릴 수 있습니다.", - "OnboardingTour.AddComments.Title": "댓글 작성", - "OnboardingTour.AddDescription.Body": "팀원들이 카드의 내용을 알 수 있도록 카드에 설명을 추가합니다.", + "OnboardingTour.AddComments.Body": "이슈에 댓글을 달거나 동료 Mattermost 사용자를 @멘션하여 관심을 끌 수도 있습니다.", + "OnboardingTour.AddComments.Title": "댓글 추가", + "OnboardingTour.AddDescription.Body": "팀원들이 카드에 대해 알 수 있도록 설명을 추가하세요.", "OnboardingTour.AddDescription.Title": "설명 추가", - "OnboardingTour.AddProperties.Body": "카드에 다양한 속성을 추가하여 더욱 강력해 질 수 있습니다!", + "OnboardingTour.AddProperties.Body": "카드에 다양한 속성을 추가하여 더욱 강력해 질 수 있습니다.", "OnboardingTour.AddProperties.Title": "속성 추가", - "OnboardingTour.AddView.Body": "다른 레이아웃을 사용하여 보드를 구성할 새 보기를 작성하려면 여기로 이동하십시오.", - "OnboardingTour.AddView.Title": "뷰 추가", - "OnboardingTour.CopyLink.Body": "링크를 복사하여 채널, 다이렉트 메시지 또는 그룹 메시지에 붙여넣어 팀원들과 카드를 공유할 수 있습니다.", + "OnboardingTour.AddView.Body": "다양한 레이아웃을 사용하여 보드를 구성하는 새 보기를 만들려면 여기로 이동하세요.", + "OnboardingTour.AddView.Title": "새 보기 추가", + "OnboardingTour.CopyLink.Body": "링크를 복사하여 채널, 쪽지 또는 그룹 메시지에 붙여넣어 팀원들과 카드를 공유할 수 있습니다.", "OnboardingTour.CopyLink.Title": "링크 복사", - "OnboardingTour.OpenACard.Body": "카드를 열어 보드가 작업을 구성하는 데 도움이 될 수 있는 강력한 방법을 알아보십시오.", + "OnboardingTour.OpenACard.Body": "카드를 열어 보드를 통해 작업을 정리하는 데 도움이 되는 강력한 방법을 살펴보세요.", "OnboardingTour.OpenACard.Title": "카드 열기", "OnboardingTour.ShareBoard.Body": "보드를 팀 내에서 내부적으로 공유하거나 조직 외부에서 볼 수 있도록 공개적으로 게시할 수 있습니다.", "OnboardingTour.ShareBoard.Title": "보드 공유", "PersonProperty.board-members": "보드 멤버", + "PersonProperty.me": "나", "PersonProperty.non-board-members": "보드 멤버가 아님", "PropertyMenu.Delete": "삭제", "PropertyMenu.changeType": "속성 유형 변경", @@ -202,7 +214,7 @@ "PropertyType.CreatedBy": "만든 사람", "PropertyType.CreatedTime": "생성 시간", "PropertyType.Date": "날짜", - "PropertyType.Email": "전자우편", + "PropertyType.Email": "이메일", "PropertyType.MultiPerson": "다중 사용자", "PropertyType.MultiSelect": "다중 선택하기", "PropertyType.Number": "숫자", @@ -211,30 +223,30 @@ "PropertyType.Select": "선택", "PropertyType.Text": "텍스트", "PropertyType.Unknown": "알 수 없는 유형", - "PropertyType.UpdatedBy": "최근 수정한 사람", - "PropertyType.UpdatedTime": "최근 수정 시간", - "PropertyType.Url": "URL 주소", - "PropertyValueElement.empty": "비어있음", + "PropertyType.UpdatedBy": "마지막으로 업데이트한 사람", + "PropertyType.UpdatedTime": "마지막으로 업데이트된 시간", + "PropertyType.Url": "URL", + "PropertyValueElement.empty": "빈", "RegistrationLink.confirmRegenerateToken": "이전에 공유된 링크가 무효화됩니다. 계속하시겠습니까?", - "RegistrationLink.copiedLink": "복사되었습니다!", + "RegistrationLink.copiedLink": "복사됨!", "RegistrationLink.copyLink": "링크 복사", "RegistrationLink.description": "다른 구성원이 계정을 만들 수 있도록 이 링크를 공유하세요:", "RegistrationLink.regenerateToken": "토큰 재성성", "RegistrationLink.tokenRegenerated": "등록 링크가 재생성되었음", "ShareBoard.PublishDescription": "웹 상의 모든 사용자와 읽기 전용 링크를 게시하고 공유합니다.", - "ShareBoard.PublishTitle": "웹에 게시하다", - "ShareBoard.ShareInternal": "내부공유하기", + "ShareBoard.PublishTitle": "웹에 발행", + "ShareBoard.ShareInternal": "내부 공유", "ShareBoard.ShareInternalDescription": "권한이 있는 사용자는 이 링크를 사용할 수 있습니다.", "ShareBoard.Title": "보드 공유", "ShareBoard.confirmRegenerateToken": "이전에 공유된 링크가 무효화됩니다. 계속하시겠습니까?", - "ShareBoard.copiedLink": "복사되었습니다!", + "ShareBoard.copiedLink": "복사됨!", "ShareBoard.copyLink": "링크 복사", - "ShareBoard.regenerate": "토큰 재생성하기", + "ShareBoard.regenerate": "토큰 재생성", "ShareBoard.searchPlaceholder": "사용자 및 채널 검색", "ShareBoard.teamPermissionsText": "{teamName}팀의 모든 사용자", "ShareBoard.tokenRegenrated": "토큰이 재성생되었음", - "ShareBoard.userPermissionsRemoveMemberText": "멤버 제외하기", - "ShareBoard.userPermissionsYouText": "당신", + "ShareBoard.userPermissionsRemoveMemberText": "멤버 제거", + "ShareBoard.userPermissionsYouText": "(당신)", "ShareTemplate.Title": "템플릿 공유", "ShareTemplate.searchPlaceholder": "사용자 검색", "Sidebar.about": "Focalboard에 대하여", @@ -242,15 +254,15 @@ "Sidebar.changePassword": "패스워드 변경", "Sidebar.delete-board": "보드 삭제", "Sidebar.duplicate-board": "보드 복제", - "Sidebar.export-archive": "아카이브 내보내기", - "Sidebar.import": "사이드바 가져요기", - "Sidebar.import-archive": "아카이브 들여오기", + "Sidebar.export-archive": "보관 데이터 내보내기", + "Sidebar.import": "가져오기", + "Sidebar.import-archive": "보관데이터 가져오기", "Sidebar.invite-users": "사용자 초대", "Sidebar.logout": "로그아웃", "Sidebar.new-category.badge": "신규", "Sidebar.new-category.drag-boards-cta": "보드를 여기에 드래그하세요...", "Sidebar.no-boards-in-category": "해당 카테고리에 보드가 존재하지 않음", - "Sidebar.product-tour": "상품 둘러보기", + "Sidebar.product-tour": "제품 둘러보기", "Sidebar.random-icons": "임의 아이콘", "Sidebar.set-language": "언어 설정", "Sidebar.set-theme": "테마 설정", @@ -259,8 +271,8 @@ "Sidebar.untitled-board": "(제목 없는 보드)", "Sidebar.untitled-view": "(제목 없는 뷰)", "SidebarCategories.BlocksMenu.Move": "이동 ...", - "SidebarCategories.CategoryMenu.CreateNew": "새 카테고리 만들기", - "SidebarCategories.CategoryMenu.Delete": "카테고리 삭제하기", + "SidebarCategories.CategoryMenu.CreateNew": "새 카테고리 생성", + "SidebarCategories.CategoryMenu.Delete": "카테고리 삭제", "SidebarCategories.CategoryMenu.DeleteModal.Body": "{categoryName}의 다시 보드 카테고리로 이동합니다. 당신은 어떤 보드에서도 제거되지 않았습니다.", "SidebarCategories.CategoryMenu.DeleteModal.Title": "해당 카테고리를 삭제하시겠습니까?", "SidebarCategories.CategoryMenu.Update": "카테고리 이름 수정하기", @@ -283,6 +295,7 @@ "TableHeaderMenu.insert-right": "오른쪽에 삽입", "TableHeaderMenu.sort-ascending": "오름차순 정렬", "TableHeaderMenu.sort-descending": "내림차순 정렬", + "TableRow.DuplicateCard": "카드 복제", "TableRow.MoreOption": "더 많은 행동", "TableRow.open": "열기", "TopBar.give-feedback": "피드백 하기", @@ -299,6 +312,7 @@ "ValueSelector.valueSelector": "값 선택", "ValueSelectorLabel.openMenu": "메뉴 열기", "VersionMessage.help": "이 버전의 새로운 기능을 확인하십시오.", + "VersionMessage.learn-more": "더 알아보기", "View.AddView": "뷰 추가", "View.Board": "보드", "View.DeleteView": "뷰 삭제", @@ -335,38 +349,43 @@ "ViewLimitDialog.Heading": "보드 당 조회 수 제한에 도달했습니다", "ViewLimitDialog.PrimaryButton.Title.Admin": "업그레이드", "ViewLimitDialog.PrimaryButton.Title.RegularUser": "관리자에게 알리기", - "ViewLimitDialog.Subtext.Admin": "Professional 또는 Enterprise 플랜으로 업그레이드하여 보드당 무제한 보기, 카드 무제한 등을 이용할 수 있습니다.", - "ViewLimitDialog.Subtext.Admin.PricingPageLink": "우리의 계획에 대해 더 알아보기.", - "ViewLimitDialog.Subtext.RegularUser": "관리자에게 통지하여 프로페셔널 또는 엔터프라이즈 플랜으로 업그레이드하여 보드당 무제한 보기, 카드 무제한 등을 사용할 수 있습니다.", + "ViewLimitDialog.Subtext.Admin": "Professional 또는 Enterprise 요금제로 업그레이드합니다.", + "ViewLimitDialog.Subtext.Admin.PricingPageLink": "요금제 더 알아보기.", + "ViewLimitDialog.Subtext.RegularUser": "관리자에게 Professional 또는 Enterprise 요금제로 업그레이드를 요청하는 알림을 보냈습니다.", "ViewLimitDialog.UpgradeImg.AltText": "이미지 업그레이드", - "ViewLimitDialog.notifyAdmin.Success": "관리자에게 알림이 왔습니다", + "ViewLimitDialog.notifyAdmin.Success": "관리자에게 알림을 보냈습니다", "ViewTitle.hide-description": "설명 숨기기", "ViewTitle.pick-icon": "아이콘 선택", - "ViewTitle.random-icon": "임의", + "ViewTitle.random-icon": "무작위", "ViewTitle.remove-icon": "아이콘 제거", "ViewTitle.show-description": "설명 보기", "ViewTitle.untitled-board": "제목 없는 보드", "WelcomePage.Description": "보드는 친숙한 칸반 보드 형태를 사용하여 팀간의 업무를 정의, 구성 및 추적하고 관리하는 프로젝트 관리 도구입니다.", - "WelcomePage.Explore.Button": "탐색하기", - "WelcomePage.Heading": "보드에 오신 것을 환영합니다", - "WelcomePage.NoThanks.Text": "아뇨, 제가 알아서 해결하겠습니다", + "WelcomePage.Explore.Button": "둘러보기", + "WelcomePage.Heading": "보드 사용을 환영합니다", + "WelcomePage.NoThanks.Text": "아니오, 스스로 찾아보겠습니다", "WelcomePage.StartUsingIt.Text": "사용 시작하기", "Workspace.editing-board-template": "보드 템플릿을 수정하는 중입니다.", "badge.guest": "게스트", - "boardSelector.confirm-link-board": "채널에 보드 연결하기", - "boardSelector.confirm-link-board-button": "예. 보드 연결하기", + "boardPage.confirm-join-button": "가입", + "boardPage.confirm-join-text": "보드 관리자가 명시적으로 추가하지 않은 비공개 보드에 가입하려고 합니다. 이 비공개 보드에 가입하시겠습니까?", + "boardPage.confirm-join-title": "비공개 보드 가입", + "boardSelector.confirm-link-board": "채널에 보드 연결", + "boardSelector.confirm-link-board-button": "예, 보드에 연결합니다", "boardSelector.confirm-link-board-subtext": "{boardName}을(를) 채널에 연결하면 게스트를 제외한 채널의 모든 구성원(기존 및 새)이 해당 채널을 편집할 수 있습니다. 언제든지 채널에서 보드의 연결을 해제할 수 있습니다.", "boardSelector.confirm-link-board-subtext-with-other-channel": "{boardName}을(를) 채널에 연결하면 게스트를 제외한 채널의 모든 구성원(기존 및 새)이 해당 채널을 편집할 수 있습니다.{lineBreak} 이 보드는 현재 다른 채널에 연결되어 있습니다. 여기에 연결을 선택하면 연결이 해제됩니다.", - "boardSelector.create-a-board": "보드 만들기", - "boardSelector.link": "연결하기", - "boardSelector.search-for-boards": "보드 검색하기", - "boardSelector.title": "보드 연결하기", - "boardSelector.unlink": "연결 해제하기", + "boardSelector.create-a-board": "보드 생성", + "boardSelector.link": "연결", + "boardSelector.search-for-boards": "보드 검색", + "boardSelector.title": "보드 연결", + "boardSelector.unlink": "연결 해제", "calendar.month": "월", "calendar.today": "오늘", "calendar.week": "주", + "centerPanel.undefined": "{propertyName} 없음", + "centerPanel.unknown-user": "알 수 없는 사용자", "cloudMessage.learn-more": "더 배우기", - "createImageBlock.failed": "파일을 업로드할 수 없습니다. 파일 크기 제한에 도달했습니다.", + "createImageBlock.failed": "파일 크기 제한에 도달했기 때문에 이 파일을 업로드 할 수 없습니다.", "default-properties.badges": "댓글 및 설명", "default-properties.title": "제목", "error.back-to-home": "홈으로 돌아가기", @@ -374,66 +393,70 @@ "error.board-not-found": "보드를 찾을 수 없습니다.", "error.go-login": "로그인", "error.invalid-read-only-board": "이 보드에 액세스할 수 없습니다. 보드에 액세스하려면 로그인하십시오.", - "error.not-logged-in": "세션이 만료되었거나 로그인하지 않았을 수 있습니다. 보드에 액세스하려면 다시 로그인하십시오.", - "error.page.title": "죄송해요, 뭔가 잘못되었어요", + "error.not-logged-in": "세션이 만료되었거나 로그인 하지 않았습니다. 보드에 액세스하려면 다시 로그인하십시오.", + "error.page.title": "죄송합니다, 뭔가 잘못되었습니다", "error.team-undefined": "유효한 팀이 아닙니다.", "error.unknown": "오류가 발생했습니다.", "generic.previous": "이전", - "guest-no-board.subtitle": "당신은 이 팀의 어느 보드에도 접속하고 있지 않습니다. 누군가 당신을 보드에 추가해 줄 때까지 기다려주세요.", - "guest-no-board.title": "보드에 참여중이 아님", - "imagePaste.upload-failed": "일부 파일이 업로드 되지 않았습니다. 파일 크기 제한에 도달했습니다", + "guest-no-board.subtitle": "이 팀의 어느 보드에도 접속할 수 없습니다. 누군가 보드에 추가해 줄 때까지 기다려주세요.", + "guest-no-board.title": "아직 참여 중인 보드가 없습니다", + "imagePaste.upload-failed": "파일 크기 제한으로 일부 파일을 업로드 할 수 없습니다.", "limitedCard.title": "숨겨진 카드", "login.log-in-button": "로그인", "login.log-in-title": "로그인", "login.register-button": "계정이 없다면 계정을 만드세요", - "notification-box-card-limit-reached.close-tooltip": "10일 동안 잠자기", + "new_channel_modal.create_board.empty_board_description": "비어있는 새 보드 생성", + "new_channel_modal.create_board.empty_board_title": "비어있는 보드", + "new_channel_modal.create_board.select_template_placeholder": "템플릿 선택", + "new_channel_modal.create_board.title": "이 채널용 보드 생성", + "notification-box-card-limit-reached.close-tooltip": "10일 동안 알림 중단", "notification-box-card-limit-reached.contact-link": "관리자에게 알리기", "notification-box-card-limit-reached.link": "유료 요금제로 업그레이드하기", "notification-box-card-limit-reached.title": "{cards}개의 숨겨진 카드가 보드에 있습니다", "notification-box-cards-hidden.title": "이 작업으로 인해 다른 카드가 숨겨졌습니다", - "notification-box.card-limit-reached.not-admin.text": "아카이브된 카드에 액세스하려면 {contactLink}을(를) 사용하여 유료 요금제로 업그레이드하십시오.", + "notification-box.card-limit-reached.not-admin.text": "보관된 카드에 액세스하려면 {contactLink}에서 유료 요금제로 업그레이드하십시오.", "notification-box.card-limit-reached.text": "카드 제한에 도달했습니다,이전 카드를 보려면 {link}를 눌러주세요", - "person.add-user-to-board": "{username}을 보드에 추가", + "person.add-user-to-board": "{username}을(를) 보드에 추가", "person.add-user-to-board-confirm-button": "보드에 추가", "person.add-user-to-board-permissions": "권한", - "person.add-user-to-board-question": "{username}을 보드에 추가하시겠습니까?", - "person.add-user-to-board-warning": "{username}은 보드에 참여중이지 않으며, 관련될 알림을 수신하지 않습니다.", + "person.add-user-to-board-question": "{username}을(을) 보드에 추가하시겠습니까?", + "person.add-user-to-board-warning": "{username}은(는) 보드멤버가 아니므로 관련 알림을 수신하지 않습니다.", "register.login-button": "이미 계정이 있다면 로그인하세요", "register.signup-title": "계정 등록", "rhs-board-non-admin-msg": "당신은 보드의 관리자가 아닙니다", "rhs-boards.add": "추가하기", - "rhs-boards.dm": "다이렉트 메시지", + "rhs-boards.dm": "DM", "rhs-boards.gm": "그룹 메시지", - "rhs-boards.header.dm": "이 개인 메시지", + "rhs-boards.header.dm": "이 DM", "rhs-boards.header.gm": "이 그룹 메시지", "rhs-boards.last-update-at": "마지막 업데이트 시간: {datetime}", - "rhs-boards.link-boards-to-channel": "{channelName}에 보드 연결하기", + "rhs-boards.link-boards-to-channel": "{channelName}에 보드 연결", "rhs-boards.linked-boards": "연결된 보드", - "rhs-boards.no-boards-linked-to-channel": "{channelName}에 아직 연결된 보드가 없음", - "rhs-boards.no-boards-linked-to-channel-description": "Boards는 익숙한 Kanban 보드 뷰를 사용하여 팀 전체의 작업을 정의, 구성, 추적 및 관리하는 데 도움이 되는 프로젝트 관리 도구입니다.", - "rhs-boards.unlink-board": "보드 연결해제하기", - "rhs-boards.unlink-board1": "연결되지 않은 보드", + "rhs-boards.no-boards-linked-to-channel": "{channelName}에 아직 연결된 보드가 없습니다", + "rhs-boards.no-boards-linked-to-channel-description": "보드는 익숙한 Kanban 보드를 사용하여 팀 전체의 작업을 정의, 구성, 추적 및 관리하는 데 도움이 되는 프로젝트 관리 도구입니다.", + "rhs-boards.unlink-board": "보드 연결 해제", + "rhs-boards.unlink-board1": "보드 연결 해제", "rhs-channel-boards-header.title": "보드", - "share-board.publish": "게재하기", - "share-board.share": "공유하기", + "share-board.publish": "발행", + "share-board.share": "공유", "shareBoard.channels-select-group": "채널", "shareBoard.confirm-change-team-role.body": "이 보드 사용자 중 {role}보다 낮은 권한을 가진 사용자들은 {role}권한으로 승급합니다. 이 보드의 최소 권한을 변경하시겠습니까?", - "shareBoard.confirm-change-team-role.confirmBtnText": "최소 권한 수정", - "shareBoard.confirm-change-team-role.title": "최소 권한 수정", - "shareBoard.confirm-link-channel": "채널에 보드 연결하기", - "shareBoard.confirm-link-channel-button": "채널 연결하기", - "shareBoard.confirm-link-channel-button-with-other-channel": "연결 및 연결해제하기", + "shareBoard.confirm-change-team-role.confirmBtnText": "최소 보드 권한 변경", + "shareBoard.confirm-change-team-role.title": "최소 보드 권한 변경", + "shareBoard.confirm-link-channel": "채널에 보드 연결", + "shareBoard.confirm-link-channel-button": "채널 연결", + "shareBoard.confirm-link-channel-button-with-other-channel": "연결 및 연결해제는 여기로", "shareBoard.confirm-link-channel-subtext": "채널을 보드에 연결하면 게스트를 제외한 채널의 모든 구성원(기존 및 신규)이 해당 채널을 편집할 수 있습니다.", "shareBoard.confirm-link-channel-subtext-with-other-channel": "채널을 보드에 연결하면 게스트를 제외한 채널의 모든 구성원(기존 및 신규)이 해당 채널을 편집할 수 있습니다.{lineBreak}이 보드는 현재 다른 채널에 연결되어 있습니다. 여기에 연결을 선택하면 연결이 해제됩니다.", - "shareBoard.confirm-unlink.body": "보드에서 채널 연결을 해제하면 채널의 모든 구성원(기존 및 새)이 개별적으로 권한이 부여되지 않는 한 해당 채널에 대한 액세스 권한을 잃게 됩니다.", - "shareBoard.confirm-unlink.confirmBtnText": "채널 연결 해제하기", - "shareBoard.confirm-unlink.title": "보드에서 채널 연결 해제하기", - "shareBoard.lastAdmin": "보드에는 최소한 한명 이상의 관리자 있어야 합니다", + "shareBoard.confirm-unlink.body": "보드에서 채널 연결을 해제하면 채널의 모든 구성원(기존 및 신규)이 개별적으로 권한이 부여되지 않는 한 해당 채널에 대한 액세스 권한을 잃게 됩니다.", + "shareBoard.confirm-unlink.confirmBtnText": "채널 연결 해제", + "shareBoard.confirm-unlink.title": "보드에서 채널 연결 해제", + "shareBoard.lastAdmin": "보드에는 최소한 한명 이상의 관리자가 있어야 합니다", "shareBoard.members-select-group": "멤버", - "shareBoard.unknown-channel-display-name": "알수없는 채널", + "shareBoard.unknown-channel-display-name": "알 수 없는 채널", "tutorial_tip.finish_tour": "완료", "tutorial_tip.got_it": "알겠습니다", "tutorial_tip.ok": "다음", "tutorial_tip.out": "이 도움말을 선택 해제합니다.", - "tutorial_tip.seen": "전에 본적 있나요?" + "tutorial_tip.seen": "전에 본 적 있나요?" } diff --git a/webapp/boards/i18n/lt.json b/webapp/boards/i18n/lt.json index 0967ef424b..27c6f80214 100644 --- a/webapp/boards/i18n/lt.json +++ b/webapp/boards/i18n/lt.json @@ -1 +1,456 @@ -{} +{ + "AdminBadge.SystemAdmin": "Administratorius", + "AdminBadge.TeamAdmin": "Komandos administratorius", + "AppBar.Tooltip": "Perjungti susietas lentas", + "Attachment.Attachment-title": "Priedas", + "AttachmentBlock.DeleteAction": "Ištrinti", + "AttachmentBlock.addElement": "pridėti {type}", + "AttachmentBlock.delete": "Priedas ištrintas.", + "AttachmentBlock.failed": "Šio failo nepavyko įkelti, nes pasiektas failo dydžio limitas.", + "AttachmentBlock.upload": "Priedo įkėlimas.", + "AttachmentBlock.uploadSuccess": "Priedas įkeltas.", + "AttachmentElement.delete-confirmation-dialog-button-text": "Ištrinti", + "AttachmentElement.download": "Parsisiųsti", + "AttachmentElement.upload-percentage": "Įkeliama...({uploadPercent}%)", + "BoardComponent.add-a-group": "+ Pridėti grupę", + "BoardComponent.delete": "Ištrinti", + "BoardComponent.hidden-columns": "Paslėpti stulpeliai", + "BoardComponent.hide": "Slėpti", + "BoardComponent.new": "+ Naujas", + "BoardComponent.no-property": "Nėra {property}", + "BoardComponent.no-property-title": "Elementai su tuščia nuosavybe {property} pateks čia. Šio stulpelio pašalinti negalima.", + "BoardComponent.show": "Rodyti", + "BoardMember.schemeAdmin": "Administratorius", + "BoardMember.schemeCommenter": "Komentuotojas", + "BoardMember.schemeEditor": "Redaktorius", + "BoardMember.schemeNone": "Joks", + "BoardMember.schemeViewer": "Žiūriklis", + "BoardMember.unlinkChannel": "Atsieti", + "BoardPage.newVersion": "Yra nauja Boards versija. Spustelėkite čia, kad įkeltumėte iš naujo.", + "BoardPage.syncFailed": "Lenta gali būti ištrinta arba jos prieiga gali būti atšaukta.", + "BoardTemplateSelector.add-template": "Sukurti naują šabloną", + "BoardTemplateSelector.create-empty-board": "Sukurti tuščią lentą", + "BoardTemplateSelector.delete-template": "Ištrinti", + "BoardTemplateSelector.description": "Pridėkite lentą prie šoninės juostos naudodami bet kurį iš toliau nurodytų šablonų arba pradėkite nuo nulio.", + "BoardTemplateSelector.edit-template": "Redaguoti", + "BoardTemplateSelector.plugin.no-content-description": "Pridėkite lentą prie šoninės juostos naudodami bet kurį iš toliau nurodytų šablonų arba pradėkite nuo nulio.", + "BoardTemplateSelector.plugin.no-content-title": "Sukurti lentą", + "BoardTemplateSelector.title": "Sukurti lentą", + "BoardTemplateSelector.use-this-template": "Naudoti šį šabloną", + "BoardsSwitcher.Title": "Rasti lentas", + "BoardsUnfurl.Limited": "Papildoma informacija yra paslėpta, nes kortelė yra archyvuojama", + "BoardsUnfurl.Remainder": "+{remainder} dar", + "BoardsUnfurl.Updated": "Atnaujinta {time}", + "Calculations.Options.average.displayName": "Vidutinis", + "Calculations.Options.average.label": "Vidutinis", + "Calculations.Options.count.displayName": "Skaičius", + "Calculations.Options.count.label": "Skaičius", + "Calculations.Options.countChecked.displayName": "Pažymėta", + "Calculations.Options.countChecked.label": "Skaičius patikrintas", + "Calculations.Options.countUnchecked.displayName": "Nepažymėta", + "Calculations.Options.countUnchecked.label": "Skaičiaus žymėjimas panaikintas", + "Calculations.Options.countUniqueValue.displayName": "Unikalus", + "Calculations.Options.countUniqueValue.label": "Suskaičiuoti unikalias reikšmes", + "Calculations.Options.countValue.displayName": "Reikšmės", + "Calculations.Options.countValue.label": "Skaičius", + "Calculations.Options.dateRange.displayName": "Diapazonas", + "Calculations.Options.dateRange.label": "Diapazonas", + "Calculations.Options.earliest.displayName": "Anksčiausiai", + "Calculations.Options.earliest.label": "Anksčiausiai", + "Calculations.Options.latest.displayName": "Naujausias", + "Calculations.Options.latest.label": "Naujausias", + "Calculations.Options.max.displayName": "Maks.", + "Calculations.Options.max.label": "Maks.", + "Calculations.Options.median.displayName": "Mediana", + "Calculations.Options.median.label": "Mediana", + "Calculations.Options.min.displayName": "Min.", + "Calculations.Options.min.label": "Min.", + "Calculations.Options.none.displayName": "Apskaičiuoti", + "Calculations.Options.none.label": "Joks", + "Calculations.Options.percentChecked.displayName": "Pažymėta", + "Calculations.Options.percentChecked.label": "Patikrinta procentais", + "Calculations.Options.percentUnchecked.displayName": "Nepažymėta", + "Calculations.Options.percentUnchecked.label": "Nepažymėtas procentas", + "Calculations.Options.range.displayName": "Diapazonas", + "Calculations.Options.range.label": "Diapazonas", + "Calculations.Options.sum.displayName": "Iš viso", + "Calculations.Options.sum.label": "Iš viso", + "CalendarCard.untitled": "Be pavadinimo", + "CardActionsMenu.copiedLink": "Nukopijuota!", + "CardActionsMenu.copyLink": "Kopijuoti nuorodą", + "CardActionsMenu.delete": "Ištrinti", + "CardActionsMenu.duplicate": "Pasikartojantis", + "CardBadges.title-checkboxes": "Žymimieji langeliai", + "CardBadges.title-comments": "Komentarai", + "CardBadges.title-description": "Ši kortelė turi aprašymą", + "CardDetail.Attach": "Prisegti", + "CardDetail.Follow": "Sekti", + "CardDetail.Following": "Sekama", + "CardDetail.add-content": "Pridėti turinį", + "CardDetail.add-icon": "Pridėti piktogramą", + "CardDetail.add-property": "+ Pridėti savybę", + "CardDetail.addCardText": "pridėti kortelės tekstą", + "CardDetail.limited-body": "Naujovinkite į mūsų Professional arba Enterprise planą.", + "CardDetail.limited-button": "Patobulinti", + "CardDetail.limited-title": "Ši kortelė paslėpta", + "CardDetail.moveContent": "Perkelti kortelės turinį", + "CardDetail.new-comment-placeholder": "Pridėti komentarą...", + "CardDetailProperty.confirm-delete-heading": "Patvirtinkite nuosavybės ištrynimą", + "CardDetailProperty.confirm-delete-subtext": "Ar tikrai norite ištrinti savybę „{propertyName}“? Ją ištrynus, savybė bus ištrinta iš visų šios lentos kortelių.", + "CardDetailProperty.confirm-property-name-change-subtext": "Ar tikrai norite pakeisti savybę „{propertyName}“ {customText}? Tai turės įtakos {numOfCards} kortelės reikšmei (-ėms) šioje lentoje ir duomenys gali būti prarasti.", + "CardDetailProperty.confirm-property-type-change": "Patvirtinkite nuosavybės tipo pakeitimą", + "CardDetailProperty.delete-action-button": "Ištrinti", + "CardDetailProperty.property-change-action-button": "Keisti savybę", + "CardDetailProperty.property-changed": "Savybė sėkmingai pakeista!", + "CardDetailProperty.property-deleted": "{propertyName} sėkmingai ištrinta!", + "CardDetailProperty.property-name-change-subtext": "įveskite iš „{oldPropType}“ į „{newPropType}“", + "CardDetial.limited-link": "Sužinokite daugiau apie mūsų planus.", + "CardDialog.delete-confirmation-dialog-attachment": "Patvirtinkite priedo ištrynimą", + "CardDialog.delete-confirmation-dialog-button-text": "Ištrinti", + "CardDialog.delete-confirmation-dialog-heading": "Patvirtinkite kortelės ištrynimą", + "CardDialog.editing-template": "Jūs redaguojate šabloną.", + "CardDialog.nocard": "Šios kortelės nėra arba ji nepasiekiama.", + "Categories.CreateCategoryDialog.CancelText": "Atšaukti", + "Categories.CreateCategoryDialog.CreateText": "Sukurti", + "Categories.CreateCategoryDialog.Placeholder": "Pavadinkite savo kategoriją", + "Categories.CreateCategoryDialog.UpdateText": "Atnaujinti", + "CenterPanel.Login": "Prisijungti", + "CenterPanel.Share": "Bendrinti", + "ChannelIntro.CreateBoard": "Sukurti lentą", + "ColorOption.selectColor": "Pasirinkti {color} spalvą", + "Comment.delete": "Ištrinti", + "CommentsList.send": "Siųsti", + "ConfirmPerson.empty": "Tuščias", + "ConfirmPerson.search": "Ieškoti...", + "ConfirmationDialog.cancel-action": "Atšaukti", + "ConfirmationDialog.confirm-action": "Patvirtinti", + "ContentBlock.Delete": "Ištrinti", + "ContentBlock.DeleteAction": "Ištrinti", + "ContentBlock.addElement": "pridėti {type}", + "ContentBlock.checkbox": "žymimasis langelis", + "ContentBlock.divider": "skirtukas", + "ContentBlock.editCardCheckbox": "perjungtas žymimasis laukelis", + "ContentBlock.editCardCheckboxText": "redaguoti kortelės tekstą", + "ContentBlock.editCardText": "redaguoti kortelės tekstą", + "ContentBlock.editText": "Keisti tekstą...", + "ContentBlock.image": "Paveikslėlis", + "ContentBlock.insertAbove": "Įdėti aukščiau", + "ContentBlock.moveBlock": "perkelti kortelės turinį", + "ContentBlock.moveDown": "Perkelti žemyn", + "ContentBlock.moveUp": "Perkelti aukštyn", + "ContentBlock.text": "tekstas", + "DateFilter.empty": "Tuščias", + "DateRange.clear": "Išvalyti", + "DateRange.empty": "Tuščias", + "DateRange.endDate": "Pabaigos data", + "DateRange.today": "Šiandien", + "DeleteBoardDialog.confirm-cancel": "Atšaukti", + "DeleteBoardDialog.confirm-delete": "Ištrinti", + "DeleteBoardDialog.confirm-info": "Ar tikrai norite ištrinti lentą „{boardTitle}“? Ją ištrynus, bus ištrintos visos lentos kortelės.", + "DeleteBoardDialog.confirm-info-template": "Ar tikrai norite ištrinti lentos šabloną „{boardTitle}“?", + "DeleteBoardDialog.confirm-tite": "Patvirtinkite lentos ištrynimą", + "DeleteBoardDialog.confirm-tite-template": "Patvirtinkite lentos šablono ištrynimą", + "Dialog.closeDialog": "Uždaryti dialogo langą", + "EditableDayPicker.today": "Šiandien", + "Error.mobileweb": "Mobiliojo žiniatinklio palaikymas šiuo metu yra ankstyvoje beta versijoje. Gali būti ne visos funkcijos.", + "Error.websocket-closed": "Interneto lizdo ryšys uždarytas, ryšys nutrauktas. Jei tai išlieka, patikrinkite savo serverio arba žiniatinklio tarpinio serverio konfigūraciją.", + "Filter.contains": "turi", + "Filter.ends-with": "baigiasi", + "Filter.includes": "apima", + "Filter.is": "yra", + "Filter.is-after": "yra po", + "Filter.is-before": "yra prieš", + "Filter.is-empty": "yra tuščias", + "Filter.is-not-empty": "nėra tuščias", + "Filter.is-not-set": "nėra nustatytas", + "Filter.is-set": "yra nustatytas", + "Filter.isafter": "yra po", + "Filter.isbefore": "yra prieš", + "Filter.not-contains": "nėra", + "Filter.not-ends-with": "nesibaigia", + "Filter.not-includes": "neapima", + "Filter.not-starts-with": "neprasideda", + "Filter.starts-with": "prasideda", + "FilterByText.placeholder": "filtruoti tekstą", + "FilterComponent.add-filter": "+ Pridėti filtrą", + "FilterComponent.delete": "Ištrinti", + "FilterValue.empty": "(tuščia)", + "FindBoardsDialog.IntroText": "Ieškoti lentų", + "FindBoardsDialog.NoResultsFor": "Nėra rezultatų pagal „{searchQuery}“", + "FindBoardsDialog.NoResultsSubtext": "Patikrinkite rašybą arba pabandykite atlikti kitą paiešką.", + "FindBoardsDialog.SubTitle": "Įveskite, kad rastumėte lentą. Norėdami naršyti, naudokite AUKŠTYN / ŽEMYN. ENTER , kad pasirinktumėte, ESC , kad atsisakytumėte", + "FindBoardsDialog.Title": "Raskite lentas", + "GroupBy.hideEmptyGroups": "Slėpti {count} tuščias grupes", + "GroupBy.showHiddenGroups": "Rodyti paslėptas grupes: {count}", + "GroupBy.ungroup": "Išgrupuoti", + "HideBoard.MenuOption": "Paslėpti lentą", + "KanbanCard.untitled": "Be pavadinimo", + "MentionSuggestion.is-not-board-member": "(ne lentos narys)", + "Mutator.new-board-from-template": "nauja lenta pagal šabloną", + "Mutator.new-card-from-template": "nauja kortelė pagal šabloną", + "Mutator.new-template-from-card": "naujas šablonas pagal kortelę", + "OnboardingTour.AddComments.Body": "Galite komentuoti problemas ir net @paminėti kitus Mattermost naudotojus, kad atkreiptumėte jų dėmesį.", + "OnboardingTour.AddComments.Title": "Pridėti komentarų", + "OnboardingTour.AddDescription.Body": "Pridėkite aprašymą prie savo kortelės, kad komandos draugai žinotų, kam ji skirta.", + "OnboardingTour.AddDescription.Title": "Pridėti aprašymą", + "OnboardingTour.AddProperties.Body": "Pridėkite prie kortelių įvairių savybių, kad jos būtų dar galingesnės.", + "OnboardingTour.AddProperties.Title": "Pridėti savybių", + "OnboardingTour.AddView.Body": "Eikite čia, kad sukurtumėte naują rodinį ir galėtumėte tvarkyti lentą naudodami skirtingus išdėstymus.", + "OnboardingTour.AddView.Title": "Pridėti naują rodinį", + "OnboardingTour.CopyLink.Body": "Galite bendrinti savo korteles su komandos draugais nukopijuodami nuorodą ir įklijuodami ją į kanalą, tiesioginį pranešimą ar grupės pranešimą.", + "OnboardingTour.CopyLink.Title": "Kopijuoti nuorodą", + "OnboardingTour.OpenACard.Body": "Atidarykite kortelę, kad sužinotumėte, kokiais galingais būdais Boards gali padėti organizuoti darbą.", + "OnboardingTour.OpenACard.Title": "Atidaryti kortelę", + "OnboardingTour.ShareBoard.Body": "Galite bendrinti lentą viduje, savo komandoje arba paskelbti ją viešai, kad būtų matoma už organizacijos ribų.", + "OnboardingTour.ShareBoard.Title": "Bendrinti lentą", + "PersonProperty.board-members": "Lentos nariai", + "PersonProperty.me": "aš", + "PersonProperty.non-board-members": "Ne lentos nariai", + "PropertyMenu.Delete": "Ištrinti", + "PropertyMenu.changeType": "Pakeisti savybės tipą", + "PropertyMenu.selectType": "Pasirinkti savybės tipą", + "PropertyMenu.typeTitle": "Tipas", + "PropertyType.Checkbox": "Žymimasis langelis", + "PropertyType.CreatedBy": "Sukurta", + "PropertyType.CreatedTime": "Sukūrimo laikas", + "PropertyType.Date": "Data", + "PropertyType.Email": "El. paštas", + "PropertyType.MultiPerson": "Daugelio žmonių", + "PropertyType.MultiSelect": "Keletas pasirinkimų", + "PropertyType.Number": "Skaičius", + "PropertyType.Person": "Asmuo", + "PropertyType.Phone": "Telefonas", + "PropertyType.Select": "Pasirinkite", + "PropertyType.Text": "Tekstas", + "PropertyType.Unknown": "Nežinoma", + "PropertyType.UpdatedBy": "Paskutinį kartą atnaujino", + "PropertyType.UpdatedTime": "Paskutinio atnaujinimo laikas", + "PropertyType.Url": "URL", + "PropertyValueElement.empty": "Tuščias", + "RegistrationLink.confirmRegenerateToken": "Tai panaikins anksčiau bendrintas nuorodas. Tęsti?", + "RegistrationLink.copiedLink": "Nukopijuota!", + "RegistrationLink.copyLink": "Kopijuoti nuorodą", + "RegistrationLink.description": "Pasidalykite šia nuoroda, kad kiti galėtų susikurti paskyras:", + "RegistrationLink.regenerateToken": "Atkurti prieigos raktą", + "RegistrationLink.tokenRegenerated": "Registracijos nuoroda sugeneruota iš naujo", + "ShareBoard.PublishDescription": "Paskelbti ir bendrinti tik skaitomą nuorodą su visais žiniatinklio naudotojais.", + "ShareBoard.PublishTitle": "Paskelbti žiniatinklyje", + "ShareBoard.ShareInternal": "Bendrinti viduje", + "ShareBoard.ShareInternalDescription": "Leidimus turintys naudotojai galės naudotis šia nuoroda.", + "ShareBoard.Title": "Bendrinti lentą", + "ShareBoard.confirmRegenerateToken": "Tai panaikins anksčiau bendrintas nuorodas. Tęsti?", + "ShareBoard.copiedLink": "Nukopijuota!", + "ShareBoard.copyLink": "Kopijuoti nuorodą", + "ShareBoard.regenerate": "Atkurti prieigos raktą", + "ShareBoard.searchPlaceholder": "Ieškoti žmonių ir kanalų", + "ShareBoard.teamPermissionsText": "Visi {teamName} komandos nariai", + "ShareBoard.tokenRegenrated": "Prieigos raktas atkurtas", + "ShareBoard.userPermissionsRemoveMemberText": "Pašalinti narį", + "ShareBoard.userPermissionsYouText": "(Jūs)", + "ShareTemplate.Title": "Bendrinti šabloną", + "ShareTemplate.searchPlaceholder": "Ieškoti žmonių", + "Sidebar.delete-board": "Ištrinti lentą", + "Sidebar.duplicate-board": "Pasikartojanti lenta", + "Sidebar.export-archive": "Eksportuoti archyvą", + "Sidebar.import": "Importuoti", + "Sidebar.import-archive": "Importuoti archyvą", + "Sidebar.new-category.badge": "Naujas", + "Sidebar.new-category.drag-boards-cta": "Vilkite lentas čia...", + "Sidebar.no-boards-in-category": "Viduje nėra lentų", + "Sidebar.product-tour": "Produkto apžvalga", + "Sidebar.random-icons": "Atsitiktinės piktogramos", + "Sidebar.set-language": "Nustatyti kalbą", + "Sidebar.set-theme": "Nustatyti temą", + "Sidebar.settings": "Nustatymai", + "Sidebar.template-from-board": "Naujas šablonas pagal lentą", + "Sidebar.untitled-board": "(Lenta be pavadinimo)", + "Sidebar.untitled-view": "(Rodinys be pavadinimo)", + "SidebarCategories.BlocksMenu.Move": "Perkelti į...", + "SidebarCategories.CategoryMenu.CreateNew": "Sukurti naują kategoriją", + "SidebarCategories.CategoryMenu.Delete": "Ištrinti kategoriją", + "SidebarCategories.CategoryMenu.DeleteModal.Body": "{categoryName} lentos bus perkeltos atgal į lentų kategorijas. Jūs nesate pašalintas iš jokių lentų.", + "SidebarCategories.CategoryMenu.DeleteModal.Title": "Ištrinti šią kategoriją?", + "SidebarCategories.CategoryMenu.Update": "Pervadinti kategoriją", + "SidebarTour.ManageCategories.Body": "Kurkite ir tvarkykite pasirinktines kategorijas. Kategorijos priklauso nuo naudotojo, todėl lentos perkėlimas į kategoriją neturės įtakos kitiems nariams, naudojantiems tą pačią lentą.", + "SidebarTour.ManageCategories.Title": "Tvarkyti kategorijas", + "SidebarTour.SearchForBoards.Body": "Atidarykite lentos perjungiklį (Cmd / Ctrl + K), kad galėtumėte greitai ieškoti ir pridėti lentų šoninėje juostoje.", + "SidebarTour.SearchForBoards.Title": "Ieškoti lentų", + "SidebarTour.SidebarCategories.Body": "Visos Jūsų lentos dabar sutvarkytos naujoje šoninėje juostoje. Nebereikia perjungti darbo erdvių. Vienkartinės pasirinktinės kategorijos, pagrįstos ankstesnėmis darbo sritimis, gali būti automatiškai sukurtos Jums atnaujinant į 7.2 versiją. Jas galima pašalinti arba redaguoti pagal savo pageidavimus.", + "SidebarTour.SidebarCategories.Link": "Sužinoti daugiau", + "SidebarTour.SidebarCategories.Title": "Šoninės juostos kategorijos", + "SiteStats.total_boards": "Iš viso lentų", + "SiteStats.total_cards": "Iš viso kortelių", + "TableComponent.add-icon": "Pridėti piktogramą", + "TableComponent.name": "Pavadinimas", + "TableComponent.plus-new": "+ Naujas", + "TableHeaderMenu.delete": "Ištrinti", + "TableHeaderMenu.duplicate": "Pasikartojantis", + "TableHeaderMenu.hide": "Slėpti", + "TableHeaderMenu.insert-left": "Įdėkite kairėje", + "TableHeaderMenu.insert-right": "Įdėkite dešinėje", + "TableHeaderMenu.sort-ascending": "Rūšiuoti didėjančia tvarka", + "TableHeaderMenu.sort-descending": "Rūšiuoti mažėjančia tvarka", + "TableRow.DuplicateCard": "kortelės dublikatas", + "TableRow.MoreOption": "Daugiau veiksmų", + "TableRow.open": "Atverti", + "TopBar.give-feedback": "Palikti atsiliepimą", + "URLProperty.copiedLink": "Nukopijuota!", + "URLProperty.copy": "Kopijuoti", + "URLProperty.edit": "Redaguoti", + "UndoRedoHotKeys.canRedo": "Grąžinti", + "UndoRedoHotKeys.canRedo-with-description": "Perdaryti {description}", + "UndoRedoHotKeys.canUndo": "Anuliuoti", + "UndoRedoHotKeys.canUndo-with-description": "Anuliuoti {description}", + "UndoRedoHotKeys.cannotRedo": "Nėra ką perdaryti", + "UndoRedoHotKeys.cannotUndo": "Nėra ką anuliuoti", + "ValueSelector.noOptions": "Jokių parinkčių. Pradėkite rašyti, kad pridėtumėte pirmąją!", + "ValueSelector.valueSelector": "Reikšmės parinkiklis", + "ValueSelectorLabel.openMenu": "Atidaryti meniu", + "VersionMessage.help": "Patikrinkite, kas naujo šioje versijoje.", + "VersionMessage.learn-more": "Sužinoti daugiau", + "View.AddView": "Pridėti rodinį", + "View.Board": "Lenta", + "View.DeleteView": "Ištrinti rodinį", + "View.DuplicateView": "Pasikartojantis rodinys", + "View.Gallery": "Galerija", + "View.NewBoardTitle": "Lentos rodinys", + "View.NewCalendarTitle": "Kalendoriaus rodinys", + "View.NewGalleryTitle": "Galerijos vaizdas", + "View.NewTableTitle": "Lentelės rodinys", + "View.NewTemplateDefaultTitle": "Šablonas be pavadinimo", + "View.NewTemplateTitle": "Be pavadinimo", + "View.Table": "Lentelė", + "ViewHeader.add-template": "Naujas šablonas", + "ViewHeader.delete-template": "Ištrinti", + "ViewHeader.display-by": "Pateikė: {property}", + "ViewHeader.edit-template": "Redaguoti", + "ViewHeader.empty-card": "Tuščia kortelė", + "ViewHeader.export-board-archive": "Eksportuoti lentos archyvą", + "ViewHeader.export-complete": "Eksportas baigtas!", + "ViewHeader.export-csv": "Eksportuoti į CSV", + "ViewHeader.export-failed": "Eksportuoti nepavyko!", + "ViewHeader.filter": "Filtras", + "ViewHeader.group-by": "Grupuoti pagal: {property}", + "ViewHeader.new": "Naujas", + "ViewHeader.properties": "Savybės", + "ViewHeader.properties-menu": "Savybių meniu", + "ViewHeader.search-text": "Ieškoti kortelių", + "ViewHeader.select-a-template": "Pasirinkti šabloną", + "ViewHeader.set-default-template": "Nustatyti kaip numatytąjį", + "ViewHeader.sort": "Rūšiuoti", + "ViewHeader.untitled": "Be pavadinimo", + "ViewHeader.view-header-menu": "Žiūrėti antraštės meniu", + "ViewHeader.view-menu": "Žiūrėti meniu", + "ViewLimitDialog.Heading": "Pasiektas peržiūrų skaičius vienoje lentoje", + "ViewLimitDialog.PrimaryButton.Title.Admin": "Patobulinti", + "ViewLimitDialog.PrimaryButton.Title.RegularUser": "Pranešti administratoriui", + "ViewLimitDialog.Subtext.Admin": "Naujovinkite į mūsų Professional arba Enterprise planą.", + "ViewLimitDialog.Subtext.Admin.PricingPageLink": "Sužinokite daugiau apie mūsų planus.", + "ViewLimitDialog.Subtext.RegularUser": "Praneškite savo administratoriui, kad jis naujovintų į mūsų Professional arba Enterprise planą.", + "ViewLimitDialog.UpgradeImg.AltText": "atnaujinti vaizdą", + "ViewLimitDialog.notifyAdmin.Success": "Jūsų administratoriui buvo pranešta", + "ViewTitle.hide-description": "slėpti aprašymą", + "ViewTitle.pick-icon": "Pasirinkti piktogramą", + "ViewTitle.random-icon": "Atsitiktinis", + "ViewTitle.remove-icon": "Pašalinti piktogramą", + "ViewTitle.show-description": "rodyti aprašymą", + "ViewTitle.untitled-board": "Lenta be pavadinimo", + "WelcomePage.Description": "„Boards“ yra projektų valdymo įrankis, padedantis apibrėžti, organizuoti, sekti ir valdyti darbą įvairiose komandose, naudojant pažįstamą Kanban lentos vaizdą.", + "WelcomePage.Explore.Button": "Apžiūrėti", + "WelcomePage.Heading": "Sveiki atvykę į Boards", + "WelcomePage.NoThanks.Text": "Ne, ačiū, išsiaiškinsiu pats", + "WelcomePage.StartUsingIt.Text": "Pradėkite jį naudoti", + "Workspace.editing-board-template": "Redaguojate lentos šabloną.", + "badge.guest": "Svečias", + "boardPage.confirm-join-button": "Prisijungti", + "boardPage.confirm-join-text": "Jūs ketinate prisijungti prie privačios lentos, tačiau lentos administratorius Jūsų nepridėjo. Ar tikrai norite prisijungti prie šios privačios lentos?", + "boardPage.confirm-join-title": "Prisijunti prie privačios lentos", + "boardSelector.confirm-link-board": "Susieti lentą su kanalu", + "boardSelector.confirm-link-board-button": "Taip, susieti lentą", + "boardSelector.confirm-link-board-subtext": "Kai susiesite „{boardName}“ su kanalu, visi kanalo nariai (esami ir nauji) galės ją redaguoti. Tai neįtraukia narių, kurie yra svečiai. Galite bet kada atsieti lentą nuo kanalo.", + "boardSelector.confirm-link-board-subtext-with-other-channel": "Kai susiesite „{boardName}“ su kanalu, visi kanalo nariai (esami ir nauji) galės ją redaguoti. Tai neįtraukia narių, kurie yra svečiai.{lineBreak} Ši lenta šiuo metu susieta su kitu kanalu. Jis bus atsietas, jei pasirinksite susieti jį čia.", + "boardSelector.create-a-board": "Sukurti lentą", + "boardSelector.link": "nuoroda", + "boardSelector.search-for-boards": "Ieškoti lentų", + "boardSelector.title": "Susieti lentas", + "boardSelector.unlink": "Atsieti", + "calendar.month": "Mėnuo", + "calendar.today": "Šiandien", + "calendar.week": "Savaitė", + "centerPanel.undefined": "Nėra {propertyName}", + "centerPanel.unknown-user": "Nežinomas naudotojas", + "createImageBlock.failed": "Šio failo nepavyko įkelti, nes pasiektas failo dydžio limitas.", + "default-properties.badges": "Komentarai ir aprašymas", + "default-properties.title": "Pavadinimas", + "error.back-to-home": "Grįžti namo", + "error.back-to-team": "Atgal į komandą", + "error.board-not-found": "Lenta nerasta.", + "error.go-login": "Prisijungti", + "error.invalid-read-only-board": "Neturite prieigos prie šios lentos. Prisijunkite, kad pasiektumėte lentas.", + "error.not-logged-in": "Jūsų sesija gali būti pasibaigusi arba nesate prisijungę. Prisijunkite dar kartą, kad pasiektumėte lentas.", + "error.page.title": "Atsiprašome, kažkas nutiko", + "error.team-undefined": "Netinkama komanda.", + "error.unknown": "Įvyko klaida.", + "generic.previous": "Ankstesnis", + "guest-no-board.subtitle": "Dar neturite prieigos prie jokios šios komandos lentos, palaukite, kol kas nors jus įtrauks į bet kurią lentą.", + "guest-no-board.title": "Dar nėra jokių lentų", + "imagePaste.upload-failed": "Kai kurie failai nebuvo įkelti, nes pasiektas failo dydžio limitas.", + "limitedCard.title": "Paslėptos kortelės", + "login.log-in-button": "Prisijungti", + "login.log-in-title": "Prisijungti", + "login.register-button": "arba susikurkite paskyrą, jei jos neturite", + "new_channel_modal.create_board.empty_board_description": "Sukurti naują tuščią lentą", + "new_channel_modal.create_board.empty_board_title": "Tuščia lenta", + "new_channel_modal.create_board.select_template_placeholder": "Pasirinkti šabloną", + "new_channel_modal.create_board.title": "Sukurti šio kanalo lentą", + "notification-box-card-limit-reached.close-tooltip": "Snausti 10 dienų", + "notification-box-card-limit-reached.contact-link": "praneškite savo administratoriui", + "notification-box-card-limit-reached.link": "Atnaujinti į mokamą planą", + "notification-box-card-limit-reached.title": "{cards} kortelės paslėptos", + "notification-box-cards-hidden.title": "Šis veiksmas paslėpė kitą kortelę", + "notification-box.card-limit-reached.not-admin.text": "Norėdami pasiekti archyvuotas korteles, galite {contactLink} naujovinti į mokamą planą.", + "notification-box.card-limit-reached.text": "Pasiektas kortelių limitas, jei norite peržiūrėti senesnes korteles, {link}", + "person.add-user-to-board": "Pridėti {username} prie lentos", + "person.add-user-to-board-confirm-button": "Pridėti prie lentos", + "person.add-user-to-board-permissions": "Leidimai", + "person.add-user-to-board-question": "Ar norite pridėti {username} prie lentos?", + "person.add-user-to-board-warning": "{username} nėra lentos narys ir negaus apie tai jokių pranešimų.", + "register.login-button": "arba prisijunkite, jei jau turite paskyrą", + "register.signup-title": "Prisiregistruokite prie paskyros", + "rhs-board-non-admin-msg": "Jūs nesate lentos administratorius", + "rhs-boards.add": "Pridėti", + "rhs-boards.dm": "AŽ", + "rhs-boards.gm": "GŽ", + "rhs-boards.header.dm": "ši tiesioginė žinutė", + "rhs-boards.header.gm": "ši grupės žinutė", + "rhs-boards.last-update-at": "Paskutinį kartą atnaujinta: {datetime}", + "rhs-boards.link-boards-to-channel": "Susieti lentas su {channelName}", + "rhs-boards.linked-boards": "Susietos lentos", + "rhs-boards.no-boards-linked-to-channel": "Su {channelName} dar nėra susietų lentų", + "rhs-boards.no-boards-linked-to-channel-description": "„Boards“ yra projektų valdymo įrankis, padedantis apibrėžti, organizuoti, sekti ir valdyti darbą įvairiose komandose, naudojant pažįstamą Kanban lentos vaizdą.", + "rhs-boards.unlink-board": "Atsieti lentą", + "rhs-boards.unlink-board1": "Atsieti lentą", + "rhs-channel-boards-header.title": "Boards", + "share-board.publish": "Paskelbti", + "share-board.share": "Bendrinti", + "shareBoard.channels-select-group": "Kanalai", + "shareBoard.confirm-change-team-role.body": "Visi šioje lentoje esantys asmenys, turintys žemesnį nei „{role}“ vaidmenį , dabar bus paaukštinti į {role} . Ar tikrai norite pakeisti minimalų lentos vaidmenį?", + "shareBoard.confirm-change-team-role.confirmBtnText": "Pakeiskite minimalų lentos vaidmenį", + "shareBoard.confirm-change-team-role.title": "Pakeiskite minimalų lentos vaidmenį", + "shareBoard.confirm-link-channel": "Susieti lentą su kanalu", + "shareBoard.confirm-link-channel-button": "Susieti kanalą", + "shareBoard.confirm-link-channel-button-with-other-channel": "Atsieti ir susieti čia", + "shareBoard.confirm-link-channel-subtext": "Kai susiesite kanalą su lenta, visi kanalo nariai (esami ir nauji) galės ją redaguoti. Tai neįtraukia narių, kurie yra svečiai.", + "shareBoard.confirm-link-channel-subtext-with-other-channel": "Kai susiesite kanalą su lenta, visi kanalo nariai (esami ir nauji) galės jį redaguoti. Tai neįtraukia narių, kurie yra svečiai.{lineBreak}Ši lenta šiuo metu susieta su kitu kanalu. Jis bus atsietas, jei pasirinksite susieti jį čia.", + "shareBoard.confirm-unlink.body": "Kai atsiesite kanalą nuo lentos, visi kanalo nariai (esami ir nauji) praras prieigą prie jo, nebent jiems bus suteiktas atskiras leidimas.", + "shareBoard.confirm-unlink.confirmBtnText": "Atsieti kanalą", + "shareBoard.confirm-unlink.title": "Atsieti kanalą nuo lentos", + "shareBoard.lastAdmin": "Lentose turi būti bent vienas administratorius", + "shareBoard.members-select-group": "Nariai", + "shareBoard.unknown-channel-display-name": "Nežinomas kanalas", + "tutorial_tip.finish_tour": "Atlikta", + "tutorial_tip.got_it": "Supratau", + "tutorial_tip.ok": "Kitas", + "tutorial_tip.out": "Atsisakyti šių patarimų.", + "tutorial_tip.seen": "Matėte tai anksčiau?" +} diff --git a/webapp/boards/i18n/nl.json b/webapp/boards/i18n/nl.json index d0d735c948..67c60a9a46 100644 --- a/webapp/boards/i18n/nl.json +++ b/webapp/boards/i18n/nl.json @@ -1,4 +1,6 @@ { + "AdminBadge.SystemAdmin": "Beheerder", + "AdminBadge.TeamAdmin": "Teambeheerder", "AppBar.Tooltip": "Gekoppelde borden weergeven", "Attachment.Attachment-title": "Bijlage", "AttachmentBlock.DeleteAction": "verwijderen", @@ -137,6 +139,7 @@ "ContentBlock.moveDown": "Naar beneden verplaatsen", "ContentBlock.moveUp": "Naar boven verplaatsen", "ContentBlock.text": "tekst", + "DateFilter.empty": "Leeg", "DateRange.clear": "Wissen", "DateRange.empty": "Leeg", "DateRange.endDate": "Einddatum", @@ -155,10 +158,14 @@ "Filter.ends-with": "eindigt met", "Filter.includes": "bevat", "Filter.is": "is", + "Filter.is-after": "is na", + "Filter.is-before": "is voor", "Filter.is-empty": "is leeg", "Filter.is-not-empty": "is niet leeg", "Filter.is-not-set": "is niet ingesteld", "Filter.is-set": "is ingesteld", + "Filter.isafter": "is na", + "Filter.isbefore": "is voor", "Filter.not-contains": "bevat niet", "Filter.not-ends-with": "eindigt niet met", "Filter.not-includes": "bevat niet", @@ -305,6 +312,7 @@ "ValueSelector.valueSelector": "Waardekiezer", "ValueSelectorLabel.openMenu": "Menu openen", "VersionMessage.help": "Bekijk eens wat nieuw is in deze versie.", + "VersionMessage.learn-more": "Meer info", "View.AddView": "Weergave toevoegen", "View.Board": "Bord", "View.DeleteView": "Weergave verwijderen", @@ -359,6 +367,9 @@ "WelcomePage.StartUsingIt.Text": "Ga het gebruiken", "Workspace.editing-board-template": "Je bent een bordsjabloon aan het bewerken.", "badge.guest": "Gast", + "boardPage.confirm-join-button": "Word lid", + "boardPage.confirm-join-text": "Je staat op het punt lid te worden van een privé-bord zonder dat je expliciet bent toegevoegd door de bordbeheerder. Weet je zeker dat je lid wilt worden van dit privé-bord?", + "boardPage.confirm-join-title": "Word lid van het privé-bord", "boardSelector.confirm-link-board": "Koppel bord aan kanaal", "boardSelector.confirm-link-board-button": "Ja, koppel het bord", "boardSelector.confirm-link-board-subtext": "Wanneer je \"{boardName}\" aan het kanaal koppelt, kunnen alle leden van het kanaal (bestaande en nieuwe) het bewerken. Dit sluit leden die gast zijn uit. Je kan de koppeling van een bord naar een kanaal op elk moment ongedaan maken.", diff --git a/webapp/boards/i18n/pt.json b/webapp/boards/i18n/pt.json index 6f70f2608e..654733b2f1 100644 --- a/webapp/boards/i18n/pt.json +++ b/webapp/boards/i18n/pt.json @@ -63,12 +63,15 @@ "CardDetail.limited-button": "Atualizar", "CardDetail.new-comment-placeholder": "Adicionar um comentário...", "CardDetailProperty.delete-action-button": "Apagar", + "CardDetailProperty.property-change-action-button": "Alterar propriedade", + "CardDetailProperty.property-changed": "Propriedade alterada com sucesso!", "CardDialog.delete-confirmation-dialog-button-text": "Apagar", "Categories.CreateCategoryDialog.CancelText": "Cancelar", "Categories.CreateCategoryDialog.CreateText": "Criar", "Categories.CreateCategoryDialog.UpdateText": "Atualizar", "CenterPanel.Login": "Entrar", "CenterPanel.Share": "Compartilhar", + "ChannelIntro.CreateBoard": "Criar um quadro", "Comment.delete": "Apagar", "CommentsList.send": "Enviar", "ConfirmPerson.empty": "Vazio", diff --git a/webapp/boards/i18n/ru.json b/webapp/boards/i18n/ru.json index bcbcbdf899..382943683c 100644 --- a/webapp/boards/i18n/ru.json +++ b/webapp/boards/i18n/ru.json @@ -1,4 +1,6 @@ { + "AdminBadge.SystemAdmin": "Администратор", + "AdminBadge.TeamAdmin": "Администратор Команды", "AppBar.Tooltip": "Переключить связанные доски", "Attachment.Attachment-title": "Вложение", "AttachmentBlock.DeleteAction": "Удалить", @@ -137,6 +139,7 @@ "ContentBlock.moveDown": "Опустить", "ContentBlock.moveUp": "Поднять", "ContentBlock.text": "текст", + "DateFilter.empty": "Пусто", "DateRange.clear": "Очистить", "DateRange.empty": "Пусто", "DateRange.endDate": "Дата окончания", @@ -155,10 +158,14 @@ "Filter.ends-with": "заканчивается", "Filter.includes": "содержит", "Filter.is": "является", + "Filter.is-after": "после", + "Filter.is-before": "раньше", "Filter.is-empty": "пусто", "Filter.is-not-empty": "не пусто", "Filter.is-not-set": "не установлен", "Filter.is-set": "установлен", + "Filter.isafter": "после", + "Filter.isbefore": "раньше", "Filter.not-contains": "не содержит", "Filter.not-ends-with": "не заканчивается", "Filter.not-includes": "не содержит", @@ -197,6 +204,7 @@ "OnboardingTour.ShareBoard.Body": "Вы можете поделиться своей доской внутри своей команды или опубликовать ее для общего доступа за пределами Вашей организации.", "OnboardingTour.ShareBoard.Title": "Поделиться доской", "PersonProperty.board-members": "Совет директоров", + "PersonProperty.me": "Я", "PersonProperty.non-board-members": "Не члены правления", "PropertyMenu.Delete": "Удалить", "PropertyMenu.changeType": "Изменить тип свойства", @@ -304,6 +312,7 @@ "ValueSelector.valueSelector": "Выбор значения", "ValueSelectorLabel.openMenu": "Открыть меню", "VersionMessage.help": "Узнайте, что нового в этой версии.", + "VersionMessage.learn-more": "Узнать больше", "View.AddView": "Добавить вид", "View.Board": "Доска", "View.DeleteView": "Удалить вид", @@ -358,6 +367,9 @@ "WelcomePage.StartUsingIt.Text": "Начать пользоваться", "Workspace.editing-board-template": "Вы редактируете шаблон доски.", "badge.guest": "Гость", + "boardPage.confirm-join-button": "Присоединиться", + "boardPage.confirm-join-text": "Вы собираетесь присоединиться к закрытой доске без явного добавления администратором доски. Вы уверены, что хотите присоединиться к этой закрытой доске?", + "boardPage.confirm-join-title": "Присоединиться к приватной доске", "boardSelector.confirm-link-board": "Привязать доску к каналу", "boardSelector.confirm-link-board-button": "Да, ссылка доски", "boardSelector.confirm-link-board-subtext": "Связывание доски \"{boardName}\" с каналом даст всем участникам канала доступ на редактирование доски. Вы можете в любое время отвязать доску о канала.", @@ -386,6 +398,8 @@ "error.team-undefined": "Не корректная команда.", "error.unknown": "Произошла ошибка.", "generic.previous": "Предыдущий", + "guest-no-board.subtitle": "У вас пока нет доступа ни к одной доске в этой команде, пожалуйста, подождите, пока кто-нибудь не добавит вас к любой из досок.", + "guest-no-board.title": "Пока нет досок", "imagePaste.upload-failed": "Некоторые файлы не загружены из-за превышения квоты на размер файла.", "limitedCard.title": "Карточки скрыты", "login.log-in-button": "Вход в систему", @@ -406,22 +420,40 @@ "person.add-user-to-board-confirm-button": "Добавить доску", "person.add-user-to-board-permissions": "Разрешения", "person.add-user-to-board-question": "Вы хотите добавить {username} на доску?", + "person.add-user-to-board-warning": "{username} не является участником доски и не получает никаких уведомлений о ней.", "register.login-button": "или войти в систему, если у вас уже есть аккаунт", "register.signup-title": "Зарегистрируйте свой аккаунт", "rhs-board-non-admin-msg": "Вы не являетесь администратором этой доски", "rhs-boards.add": "Добавить", + "rhs-boards.dm": "ЛС", + "rhs-boards.gm": "GM", + "rhs-boards.header.dm": "это личное сообщение", + "rhs-boards.header.gm": "это групповое сообщение", "rhs-boards.last-update-at": "Последнее обновление: {datetime}", "rhs-boards.link-boards-to-channel": "Связать доски с {channelName}", "rhs-boards.linked-boards": "Связанные доски", "rhs-boards.no-boards-linked-to-channel": "К каналу {channelName} пока не подключены доски", "rhs-boards.no-boards-linked-to-channel-description": "Доски — это инструмент управления проектами, который помогает определять, организовывать, отслеживать и управлять работой между командами, используя знакомое представление доски Канбан.", "rhs-boards.unlink-board": "Отвязать доску", + "rhs-boards.unlink-board1": "Отвязать доску", "rhs-channel-boards-header.title": "Доски", "share-board.publish": "Опубликовать", "share-board.share": "Поделиться", "shareBoard.channels-select-group": "Каналы", + "shareBoard.confirm-change-team-role.body": "Все на этой доске с правами ниже, чем роль \"{role}\" теперь будут повышены до {role}. Вы уверены, что хотите изменить минимальную роль для доски?", + "shareBoard.confirm-change-team-role.confirmBtnText": "Изменение минимальной роли доски", + "shareBoard.confirm-change-team-role.title": "Изменение минимальной роли доски", + "shareBoard.confirm-link-channel": "Привязать доску к каналу", + "shareBoard.confirm-link-channel-button": "Привязать канал", + "shareBoard.confirm-link-channel-button-with-other-channel": "Отвязать и привязать это", + "shareBoard.confirm-link-channel-subtext": "Когда вы связываете канал с доской, все участники канала (существующие и новые) смогут редактировать его. За исключением пользователей, которые являются гостями.", + "shareBoard.confirm-link-channel-subtext-with-other-channel": "Когда вы связываете канал с доской, все участники канала (существующие и новые) смогут редактировать его. За исключением пользователей, которые являются гостями.{lineBreak}Эта доска в настоящее время связана с другим каналом. Она будет удалена, если вы решите связать ее здесь.", + "shareBoard.confirm-unlink.body": "Когда вы отвязываете канал от доски, все участники канала (как существующие, так и новые) теряют к нему доступ, если им не дано отдельное разрешение.", + "shareBoard.confirm-unlink.confirmBtnText": "Отвязать канал", + "shareBoard.confirm-unlink.title": "Отвязать канал от доски", "shareBoard.lastAdmin": "Доски должны иметь хотя бы одного администратора", "shareBoard.members-select-group": "Участники", + "shareBoard.unknown-channel-display-name": "Неизвестный канал", "tutorial_tip.finish_tour": "Готово", "tutorial_tip.got_it": "Понятно", "tutorial_tip.ok": "Следующий", diff --git a/webapp/boards/i18n/sv.json b/webapp/boards/i18n/sv.json index d776db6a9a..8be135400b 100644 --- a/webapp/boards/i18n/sv.json +++ b/webapp/boards/i18n/sv.json @@ -1,5 +1,7 @@ { - "AppBar.Tooltip": "Växla länkade boards", + "AdminBadge.SystemAdmin": "Administratör", + "AdminBadge.TeamAdmin": "Teamadministratör", + "AppBar.Tooltip": "Växla länkade tavlor", "Attachment.Attachment-title": "Bilaga", "AttachmentBlock.DeleteAction": "radera", "AttachmentBlock.addElement": "lägg till {type}", @@ -137,6 +139,7 @@ "ContentBlock.moveDown": "Flytta ned", "ContentBlock.moveUp": "Flytta upp", "ContentBlock.text": "text", + "DateFilter.empty": "Tom", "DateRange.clear": "Rensa", "DateRange.empty": "Tom", "DateRange.endDate": "Slutdatum", @@ -155,10 +158,14 @@ "Filter.ends-with": "slutar med", "Filter.includes": "inkluderar", "Filter.is": "är", + "Filter.is-after": "är efter", + "Filter.is-before": "är före", "Filter.is-empty": "är tomt", "Filter.is-not-empty": "är inte tomt", "Filter.is-not-set": "är inte inställd", "Filter.is-set": "är inställd", + "Filter.isafter": "är efter", + "Filter.isbefore": "är före", "Filter.not-contains": "innehåller inte", "Filter.not-ends-with": "slutar inte med", "Filter.not-includes": "inkluderar inte", @@ -305,6 +312,7 @@ "ValueSelector.valueSelector": "Värdeväljare", "ValueSelectorLabel.openMenu": "Öppna meny", "VersionMessage.help": "Kolla in vad som är nytt i den här versionen.", + "VersionMessage.learn-more": "Mer information", "View.AddView": "Lägg till vy", "View.Board": "Tavla", "View.DeleteView": "Radera vy", @@ -359,6 +367,9 @@ "WelcomePage.StartUsingIt.Text": "Börja använda den", "Workspace.editing-board-template": "Du redigerar en tavelmall.", "badge.guest": "Gäst", + "boardPage.confirm-join-button": "Gå med", + "boardPage.confirm-join-text": "Du är på väg att gå med i en privat tavla utan att läggas till av taveladministratören. Vill du gå med i den här privata tavlan?", + "boardPage.confirm-join-title": "Gå med i en privat tavla", "boardSelector.confirm-link-board": "Koppla board till kanal", "boardSelector.confirm-link-board-button": "Ja, koppla board", "boardSelector.confirm-link-board-subtext": "När du kopplar \"{boardName}\" till kanalen kommer alla medlemmar i kanalen (befintliga och nya) att kunna redigera den, gäster exkluderade. Du kan när som helst koppla bort ett board från kanalen.", diff --git a/webapp/boards/i18n/zh_Hans.json b/webapp/boards/i18n/zh_Hans.json index 56dfdd2824..f3c7fb7bfc 100644 --- a/webapp/boards/i18n/zh_Hans.json +++ b/webapp/boards/i18n/zh_Hans.json @@ -1,5 +1,5 @@ { - "AppBar.Tooltip": "切换链接的板块", + "AppBar.Tooltip": "切换已链接的板块", "Attachment.Attachment-title": "附件", "AttachmentBlock.DeleteAction": "删除", "AttachmentBlock.addElement": "添加 {type}", @@ -137,6 +137,7 @@ "ContentBlock.moveDown": "下移", "ContentBlock.moveUp": "上移", "ContentBlock.text": "文字", + "DateFilter.empty": "空", "DateRange.clear": "清除", "DateRange.empty": "空的", "DateRange.endDate": "结束日期", @@ -305,6 +306,7 @@ "ValueSelector.valueSelector": "值选择器", "ValueSelectorLabel.openMenu": "打开菜单", "VersionMessage.help": "了解查看新版本有什么新特性。", + "VersionMessage.learn-more": "了解更多", "View.AddView": "添加视图", "View.Board": "板块", "View.DeleteView": "删除视图", @@ -359,6 +361,7 @@ "WelcomePage.StartUsingIt.Text": "开始使用", "Workspace.editing-board-template": "您正在编辑版面模板。", "badge.guest": "访客", + "boardPage.confirm-join-button": "加入", "boardSelector.confirm-link-board": "连接板块到频道", "boardSelector.confirm-link-board-button": "是的,连接板块", "boardSelector.confirm-link-board-subtext": "当你连接“{boardName}”到频道时,所有频道的成员(现有的或新的)都可以编辑。这并不包括访客。你随时都可以取消板块与频道的连接。", diff --git a/webapp/boards/jest.config.js b/webapp/boards/jest.config.js index 05b4cd53e9..517bc921e6 100644 --- a/webapp/boards/jest.config.js +++ b/webapp/boards/jest.config.js @@ -5,64 +5,63 @@ const config = { transform: { - "^.+\\.(t|j)sx?$": ["@swc/jest"] + '^.+\\.(t|j)sx?$': ['@swc/jest'], }, - moduleFileExtensions: [ - "ts", - "tsx", - "js", - "jsx", - "json", - "node" + moduleFileExtensions: [ + 'ts', + 'tsx', + 'js', + 'jsx', + 'json', + 'node', ], extensionsToTreatAsEsm: ['.ts', '.tsx'], transformIgnorePatterns: [ - "/nanoevents/", - "node_modules/(?!react-native|react-router|react-day-picker)" + '/nanoevents/', + 'node_modules/(?!react-native|react-router|react-day-picker)', ], - maxWorkers: "80%", - testEnvironment: "jsdom", + testEnvironment: 'jsdom', collectCoverage: true, collectCoverageFrom: [ - "src/**/*.{ts,tsx,js,jsx}", - "!src/test/**" + 'src/**/*.{ts,tsx,js,jsx}', + '!src/test/**', ], testPathIgnorePatterns: [ - "/node_modules/", + '/node_modules/', ], clearMocks: true, coverageReporters: [ - "lcov", - "text-summary" + 'lcov', + 'text-summary', ], moduleNameMapper: { - "^.+\\.(scss|css)$": "/src/test/style_mock.json", - "\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "/__mocks__/fileMock.js", - "\\.(scss|css)$": "/__mocks__/styleMock.js", - "^bundle-loader\\?lazy\\!(.*)$": "$1", - "^src(.*)$": "/src$1", - "^i18n(.*)$": "/i18n$1", - "^static(.*)$": "/static$1", - "^moment(.*)$": "/../node_modules/moment$1", + '^.+\\.(scss|css)$': '/src/test/style_mock.json', + '\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$': '/__mocks__/fileMock.js', + '\\.(scss|css)$': '/__mocks__/styleMock.js', + '^bundle-loader\\?lazy\\!(.*)$': '$1', + '^src(.*)$': '/src$1', + '^i18n(.*)$': '/i18n$1', + '^static(.*)$': '/static$1', + '^moment(.*)$': '/../node_modules/moment$1', }, moduleDirectories: [ - "src", - "node_modules", + 'src', + 'node_modules', ], reporters: [ - "default", - "jest-junit" + 'default', + 'jest-junit', ], setupFiles: [ - "jest-canvas-mock" + 'jest-canvas-mock', ], setupFilesAfterEnv: [ - "/src/test/setup.tsx" + '/src/test/setup.tsx', ], testTimeout: 60000, testEnvironmentOptions: { - url: "http://localhost:8065" - } + url: 'http://localhost:8065', + }, }; module.exports = config; diff --git a/webapp/boards/loaders/globalScssClassLoader.js b/webapp/boards/loaders/globalScssClassLoader.js index 80b58e7ad3..4e0f25229e 100644 --- a/webapp/boards/loaders/globalScssClassLoader.js +++ b/webapp/boards/loaders/globalScssClassLoader.js @@ -19,5 +19,6 @@ module.exports = function loader(source) { newSource.push(line); } }); + return newSource.join('\n'); }; diff --git a/webapp/boards/package.json b/webapp/boards/package.json index 318e177a43..bab4924545 100644 --- a/webapp/boards/package.json +++ b/webapp/boards/package.json @@ -1,10 +1,9 @@ { "name": "boards", - "version": "7.9.1", + "version": "7.11.0", "private": true, "description": "", "scripts": { - "i18n-extract": "formatjs extract \"src/**/*.{ts,tsx}\" --ignore \"**/*.d.ts\" \"../**/*.d.ts\" --out-file i18n/tmp.json && formatjs compile i18n/tmp.json --out-file i18n/en.json && npx rimraf i18n/tmp.json", "build": "webpack --mode=production", "build:watch": "webpack --mode=production --watch", "start:product": "webpack serve --mode=development", @@ -18,6 +17,7 @@ "check-types": "tsc -b", "check-types:fix": "npm run check-types -- --noEmit --fix", "check": "npm run check-lint && npm run check-style", + "i18n-extract": "formatjs extract \"src/**/*.{ts,tsx}\" --ignore \"**/*.d.ts\" --id-interpolation-pattern '[sha512:contenthash:base64:6]' --format simple --out-file i18n/en.json", "fix": "npm run check-lint:fix && npm run check-style:fix", "test": "cross-env TZ=Etc/UTC jest", "test:watch": "cross-env TZ=Etc/UTC jest --watch", @@ -58,7 +58,7 @@ "react-dom": "17.0.2", "react-hot-keys": "^2.7.1", "react-hotkeys-hook": "^3.4.4", - "react-intl": "^5.20.0", + "react-intl": "*", "react-redux": "^7.2.1", "react-router-dom": "^5.2.0", "react-select": "5.5.9", @@ -95,7 +95,6 @@ "@types/node": "16.11.7", "@types/react": "17.0.53", "@types/react-beautiful-dnd": "^13.1.2", - "@types/react-day-picker": "5.3.0", "@types/react-dom": "17.0.19", "@types/react-redux": "^7.1.23", "@types/react-router-dom": "^5.3.3", @@ -104,10 +103,10 @@ "@typescript-eslint/eslint-plugin": "5.57.1", "@typescript-eslint/parser": "5.57.1", "babel-eslint": "10.1.0", - "cross-env": "^7.0.3", "css-loader": "6.7.1", "eslint-import-resolver-webpack": "0.13.2", "eslint-plugin-babel": "^5.3.1", + "eslint-plugin-eslint-comments": "3.2.0", "eslint-plugin-formatjs": "4.9.0", "eslint-plugin-header": "3.1.1", "eslint-plugin-import": "2.25.4", diff --git a/webapp/boards/src/app.tsx b/webapp/boards/src/app.tsx index 75aa8a5115..245c046703 100644 --- a/webapp/boards/src/app.tsx +++ b/webapp/boards/src/app.tsx @@ -14,8 +14,8 @@ import FlashMessages from './components/flashMessages' import NewVersionBanner from './components/newVersionBanner' import {Utils} from './utils' import {fetchMe, getMe} from './store/users' -import {getLanguage, fetchLanguage} from './store/language' -import {useAppSelector, useAppDispatch} from './store/hooks' +import {fetchLanguage, getLanguage} from './store/language' +import {useAppDispatch, useAppSelector} from './store/hooks' import {fetchClientConfig} from './store/clientConfig' import FocalboardRouter from './router' diff --git a/webapp/boards/src/archiver.ts b/webapp/boards/src/archiver.ts index c1b313b65a..01dfb30f28 100644 --- a/webapp/boards/src/archiver.ts +++ b/webapp/boards/src/archiver.ts @@ -21,8 +21,8 @@ class Archiver { private static exportArchive(prom: Promise): void { // TODO: don't download whole archive before presenting SaveAs dialog. prom.then((response) => { - response.blob(). - then((blob) => { + response.blob() + .then((blob) => { const link = document.createElement('a') link.style.display = 'none' diff --git a/webapp/boards/src/blockIcons.ts b/webapp/boards/src/blockIcons.ts index f7b88ca1ee..2390f0acf3 100644 --- a/webapp/boards/src/blockIcons.ts +++ b/webapp/boards/src/blockIcons.ts @@ -8,6 +8,7 @@ class BlockIcons { randomIcon(): string { const index = Math.floor(Math.random() * randomEmojiList.length) const icon = randomEmojiList[index] + return icon } } diff --git a/webapp/boards/src/blocks/attachmentBlock.tsx b/webapp/boards/src/blocks/attachmentBlock.tsx index bf0568505a..f84e6d051a 100644 --- a/webapp/boards/src/blocks/attachmentBlock.tsx +++ b/webapp/boards/src/blocks/attachmentBlock.tsx @@ -3,7 +3,7 @@ import {Block, createBlock} from './block' type AttachmentBlockFields = { - attachmentId: string + fileId: string } type AttachmentBlock = Block & { @@ -18,7 +18,7 @@ function createAttachmentBlock(block?: Block): AttachmentBlock { ...createBlock(block), type: 'attachment', fields: { - attachmentId: block?.fields.attachmentId || '', + fileId: block?.fields.attachmentId || block?.fields.fileId || '', }, isUploading: false, uploadingPercent: 0, diff --git a/webapp/boards/src/blocks/block.test.ts b/webapp/boards/src/blocks/block.test.ts index d2fe33a32a..3da8d852a5 100644 --- a/webapp/boards/src/blocks/block.test.ts +++ b/webapp/boards/src/blocks/block.test.ts @@ -2,7 +2,7 @@ // See LICENSE.txt for license information. import {TestBlockFactory} from 'src/test/testBlockFactory' -import {createPatchesFromBlocks, createBlock} from './block' +import {createBlock, createPatchesFromBlocks} from './block' describe('block tests', () => { const board = TestBlockFactory.createBoard() diff --git a/webapp/boards/src/blocks/block.ts b/webapp/boards/src/blocks/block.ts index 47dbc5c493..0e9e4e3a9b 100644 --- a/webapp/boards/src/blocks/block.ts +++ b/webapp/boards/src/blocks/block.ts @@ -53,6 +53,7 @@ interface FileInfo { function createBlock(block?: Block): Block { const now = Date.now() + return { id: block?.id || Utils.createGuid(Utils.blockTypeToIDType(block?.type)), schema: 1, diff --git a/webapp/boards/src/blocks/board.test.ts b/webapp/boards/src/blocks/board.test.ts index f421e7f3e3..2b3ff84e2c 100644 --- a/webapp/boards/src/blocks/board.test.ts +++ b/webapp/boards/src/blocks/board.test.ts @@ -3,10 +3,10 @@ import {TestBlockFactory} from 'src/test/testBlockFactory' import { - createPatchesFromBoards, - createBoard, IPropertyTemplate, - createPatchesFromBoardsAndBlocks + createBoard, + createPatchesFromBoards, + createPatchesFromBoardsAndBlocks, } from './board' import {createBlock} from './block' diff --git a/webapp/boards/src/blocks/board.ts b/webapp/boards/src/blocks/board.ts index 3a69f042d4..b00a5c68ed 100644 --- a/webapp/boards/src/blocks/board.ts +++ b/webapp/boards/src/blocks/board.ts @@ -3,7 +3,7 @@ import difference from 'lodash/difference' -import {Utils, IDType} from 'src/utils' +import {IDType, Utils} from 'src/utils' import {Block, BlockPatch, createPatchesFromBlocks} from './block' import {Card} from './card' @@ -54,7 +54,7 @@ type BoardPatch = { // eslint-disable-next-line @typescript-eslint/no-explicit-any updatedProperties?: Record deletedProperties?: string[] - // eslint-disable-next-line @typescript-eslint/no-explicit-any + updatedCardProperties?: IPropertyTemplate[] deletedCardProperties?: string[] } diff --git a/webapp/boards/src/blocks/card.ts b/webapp/boards/src/blocks/card.ts index 9dd287283f..ba047e0a72 100644 --- a/webapp/boards/src/blocks/card.ts +++ b/webapp/boards/src/blocks/card.ts @@ -27,6 +27,7 @@ function createCard(block?: Block): Card { } } } + return { ...createBlock(block), type: 'card', diff --git a/webapp/boards/src/blocks/filterGroup.ts b/webapp/boards/src/blocks/filterGroup.ts index 157e14a315..e304e38edc 100644 --- a/webapp/boards/src/blocks/filterGroup.ts +++ b/webapp/boards/src/blocks/filterGroup.ts @@ -21,9 +21,11 @@ function createFilterGroup(o?: FilterGroup): FilterGroup { if (isAFilterGroupInstance(p)) { return createFilterGroup(p) } + return createFilterClause(p) }) } + return { operation: o?.operation || 'and', filters, diff --git a/webapp/boards/src/boardUtils.ts b/webapp/boards/src/boardUtils.ts index bb0776f917..f8d9484ca6 100644 --- a/webapp/boards/src/boardUtils.ts +++ b/webapp/boards/src/boardUtils.ts @@ -1,7 +1,7 @@ // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. import {Card} from './blocks/card' -import {IPropertyTemplate, IPropertyOption, BoardGroup} from './blocks/board' +import {BoardGroup, IPropertyOption, IPropertyTemplate} from './blocks/board' function groupCardsByOptions(cards: Card[], optionIds: string[], groupByProperty?: IPropertyTemplate): BoardGroup[] { const groups = [] @@ -22,6 +22,7 @@ function groupCardsByOptions(cards: Card[], optionIds: string[], groupByProperty // Empty group const emptyGroupCards = cards.filter((card) => { const groupByOptionId = card.fields.properties[groupByProperty?.id || ''] + return !groupByOptionId || !groupByProperty?.options.find((option) => option.id === groupByOptionId) }) const group: BoardGroup = { @@ -31,15 +32,16 @@ function groupCardsByOptions(cards: Card[], optionIds: string[], groupByProperty groups.push(group) } } + return groups } function getOptionGroups(cards: Card[], visibleOptionIds: string[], hiddenOptionIds: string[], groupByProperty?: IPropertyTemplate): {visible: BoardGroup[], hidden: BoardGroup[]} { let unassignedOptionIds: string[] = [] if (groupByProperty) { - unassignedOptionIds = groupByProperty.options. - filter((o: IPropertyOption) => !visibleOptionIds.includes(o.id) && !hiddenOptionIds.includes(o.id)). - map((o: IPropertyOption) => o.id) + unassignedOptionIds = groupByProperty.options + .filter((o: IPropertyOption) => !visibleOptionIds.includes(o.id) && !hiddenOptionIds.includes(o.id)) + .map((o: IPropertyOption) => o.id) } const allVisibleOptionIds = [...visibleOptionIds, ...unassignedOptionIds] @@ -50,6 +52,7 @@ function getOptionGroups(cards: Card[], visibleOptionIds: string[], hiddenOption const visibleGroups = groupCardsByOptions(cards, allVisibleOptionIds, groupByProperty) const hiddenGroups = groupCardsByOptions(cards, hiddenOptionIds, groupByProperty) + return {visible: visibleGroups, hidden: hiddenGroups} } export function getVisibleAndHiddenGroups(cards: Card[], visibleOptionIds: string[], hiddenOptionIds: string[], groupByProperty?: IPropertyTemplate): {visible: BoardGroup[], hidden: BoardGroup[]} { @@ -70,6 +73,7 @@ function getPersonGroups(cards: Card[], groupByProperty: IPropertyTemplate, hidd } const curGroup = unique[key] ?? [] + return {...unique, [key]: [...curGroup, item]} }, {}) diff --git a/webapp/boards/src/cardFilter.ts b/webapp/boards/src/cardFilter.ts index 17a0bd4f04..ae4da8b7f7 100644 --- a/webapp/boards/src/cardFilter.ts +++ b/webapp/boards/src/cardFilter.ts @@ -27,6 +27,7 @@ class CardFilter { } } } + return dateProperty } @@ -51,6 +52,7 @@ class CardFilter { return true } } + return false } Utils.assert(filterGroup.operation === 'and') @@ -63,6 +65,7 @@ class CardFilter { return false } } + return true } @@ -95,12 +98,14 @@ class CardFilter { if (filter.values?.length < 1) { break } // No values = ignore clause (always met) + return (filter.values.find((cValue) => (Array.isArray(value) ? value.includes(cValue) : cValue === value)) !== undefined) } case 'notIncludes': { if (filter.values?.length < 1) { break } // No values = ignore clause (always met) + return (filter.values.find((cValue) => (Array.isArray(value) ? value.includes(cValue) : cValue === value)) === undefined) } case 'isEmpty': { @@ -128,50 +133,59 @@ class CardFilter { if (dateValue.from) { return dateValue.from > (numericFilter - halfDay) && dateValue.from < (numericFilter + halfDay) } + return false } if (dateValue.from && dateValue.to) { return dateValue.from <= numericFilter && dateValue.to >= numericFilter } + return dateValue.from === numericFilter } + return filter.values[0]?.toLowerCase() === value } case 'contains': { if (filter.values.length === 0) { return true } + return (value as string || '').includes(filter.values[0]?.toLowerCase()) } case 'notContains': { if (filter.values.length === 0) { return true } + return !(value as string || '').includes(filter.values[0]?.toLowerCase()) } case 'startsWith': { if (filter.values.length === 0) { return true } + return (value as string || '').startsWith(filter.values[0]?.toLowerCase()) } case 'notStartsWith': { if (filter.values.length === 0) { return true } + return !(value as string || '').startsWith(filter.values[0]?.toLowerCase()) } case 'endsWith': { if (filter.values.length === 0) { return true } + return (value as string || '').endsWith(filter.values[0]?.toLowerCase()) } case 'notEndsWith': { if (filter.values.length === 0) { return true } + return !(value as string || '').endsWith(filter.values[0]?.toLowerCase()) } case 'isBefore': { @@ -187,11 +201,13 @@ class CardFilter { if (dateValue.from) { return dateValue.from < (numericFilter - halfDay) } + return false } return dateValue.from ? dateValue.from < numericFilter : false } + return false } case 'isAfter': { @@ -207,14 +223,17 @@ class CardFilter { if (dateValue.from) { return dateValue.from > (numericFilter + halfDay) } + return false } if (dateValue.to) { return dateValue.to > numericFilter } + return dateValue.from ? dateValue.from > numericFilter : false } + return false } @@ -222,6 +241,7 @@ class CardFilter { Utils.assertFailure(`Invalid filter condition ${filter.condition}`) } } + return true } @@ -243,6 +263,7 @@ class CardFilter { if (property.value) { result[property.id] = property.value } + return result } @@ -254,6 +275,7 @@ class CardFilter { result[property.id] = property.value } }) + return result } @@ -261,6 +283,7 @@ class CardFilter { const template = templates.find((o) => o.id === filterClause.propertyId) if (!template) { Utils.assertFailure(`propertyThatMeetsFilterClause. Cannot find template: ${filterClause.propertyId}`) + return {id: filterClause.propertyId} } @@ -273,6 +296,7 @@ class CardFilter { if (filterClause.values.length < 1) { return {id: filterClause.propertyId} } + return {id: filterClause.propertyId, value: filterClause.values[0]} } case 'notIncludes': { @@ -285,8 +309,10 @@ class CardFilter { if (template.type === 'select') { if (template.options.length > 0) { const option = template.options[0] + return {id: filterClause.propertyId, value: option.id} } + return {id: filterClause.propertyId} } diff --git a/webapp/boards/src/components/addContentMenuItem.test.tsx b/webapp/boards/src/components/addContentMenuItem.test.tsx index cefb9c6292..34cab3d6ef 100644 --- a/webapp/boards/src/components/addContentMenuItem.test.tsx +++ b/webapp/boards/src/components/addContentMenuItem.test.tsx @@ -4,7 +4,6 @@ import React, {ReactElement, ReactNode} from 'react' import {render, screen, waitFor} from '@testing-library/react' - import {mocked} from 'jest-mock' import userEvent from '@testing-library/user-event' @@ -114,6 +113,5 @@ describe('components/addContentMenuItem', () => { ) expect(console.error).toBeCalledWith(expect.stringContaining('addContentMenu, unknown content type: unknown')) expect(container).toMatchSnapshot() - }) }) diff --git a/webapp/boards/src/components/addContentMenuItem.tsx b/webapp/boards/src/components/addContentMenuItem.tsx index 1e147b2563..b9fc829c49 100644 --- a/webapp/boards/src/components/addContentMenuItem.tsx +++ b/webapp/boards/src/components/addContentMenuItem.tsx @@ -4,7 +4,7 @@ import React from 'react' import {useIntl} from 'react-intl' -import {BlockTypes, Block} from 'src/blocks/block' +import {Block, BlockTypes} from 'src/blocks/block' import {Card} from 'src/blocks/card' import mutator from 'src/mutator' import octoClient from 'src/octoClient' @@ -27,6 +27,7 @@ const AddContentMenuItem = (props: Props): JSX.Element => { const handler = contentRegistry.getHandler(type) if (!handler) { Utils.logError(`addContentMenu, unknown content type: ${type}`) + return <> } diff --git a/webapp/boards/src/components/blockIconSelector.test.tsx b/webapp/boards/src/components/blockIconSelector.test.tsx index bcce99f771..7ee9190535 100644 --- a/webapp/boards/src/components/blockIconSelector.test.tsx +++ b/webapp/boards/src/components/blockIconSelector.test.tsx @@ -6,7 +6,6 @@ import {fireEvent, render, screen} from '@testing-library/react' import userEvent from '@testing-library/user-event' - import {mocked} from 'jest-mock' import mutator from 'src/mutator' diff --git a/webapp/boards/src/components/blocksEditor/blockContent.test.tsx b/webapp/boards/src/components/blocksEditor/blockContent.test.tsx index 0a4ca74a17..3badc576e8 100644 --- a/webapp/boards/src/components/blocksEditor/blockContent.test.tsx +++ b/webapp/boards/src/components/blocksEditor/blockContent.test.tsx @@ -4,17 +4,17 @@ import React from 'react' import {Provider as ReduxProvider} from 'react-redux' import { + act, + fireEvent, render, screen, - fireEvent, - act } from '@testing-library/react' import { mockDOM, - wrapDNDIntl, mockStateStore, - setup + setup, + wrapDNDIntl, } from 'src/testUtils' import {TestBlockFactory} from 'src/test/testBlockFactory' @@ -146,7 +146,7 @@ describe('components/blocksEditor/blockContent', () => { test('should call onSave on hit enter in the input', async () => { const onSave = jest.fn() - + const {user} = setup(wrapDNDIntl( ) } + return null } diff --git a/webapp/boards/src/components/blocksEditor/blocks/attachment/attachment.test.tsx b/webapp/boards/src/components/blocksEditor/blocks/attachment/attachment.test.tsx index ed4f9ee20f..a0631be397 100644 --- a/webapp/boards/src/components/blocksEditor/blocks/attachment/attachment.test.tsx +++ b/webapp/boards/src/components/blocksEditor/blocks/attachment/attachment.test.tsx @@ -2,7 +2,7 @@ // See LICENSE.txt for license information. import React from 'react' -import {render, screen, fireEvent} from '@testing-library/react' +import {fireEvent, render, screen} from '@testing-library/react' import {mocked} from 'jest-mock' import octoClient from 'src/octoClient' diff --git a/webapp/boards/src/components/blocksEditor/blocks/attachment/index.tsx b/webapp/boards/src/components/blocksEditor/blocks/attachment/index.tsx index 584caeea48..3aa19d7df8 100644 --- a/webapp/boards/src/components/blocksEditor/blocks/attachment/index.tsx +++ b/webapp/boards/src/components/blocksEditor/blocks/attachment/index.tsx @@ -1,6 +1,6 @@ // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. -import React, {useRef, useEffect, useState} from 'react' +import React, {useEffect, useRef, useState} from 'react' import {BlockInputProps, ContentType} from 'src/components/blocksEditor/blocks/types' import octoClient from 'src/octoClient' diff --git a/webapp/boards/src/components/blocksEditor/blocks/checkbox/checkbox.test.tsx b/webapp/boards/src/components/blocksEditor/blocks/checkbox/checkbox.test.tsx index b49f9a630a..2f95eee369 100644 --- a/webapp/boards/src/components/blocksEditor/blocks/checkbox/checkbox.test.tsx +++ b/webapp/boards/src/components/blocksEditor/blocks/checkbox/checkbox.test.tsx @@ -2,7 +2,7 @@ // See LICENSE.txt for license information. import React from 'react' -import {render, screen, fireEvent} from '@testing-library/react' +import {fireEvent, render, screen} from '@testing-library/react' import CheckboxBlock from '.' diff --git a/webapp/boards/src/components/blocksEditor/blocks/checkbox/index.tsx b/webapp/boards/src/components/blocksEditor/blocks/checkbox/index.tsx index 7be8c4d0ff..42d41f94bd 100644 --- a/webapp/boards/src/components/blocksEditor/blocks/checkbox/index.tsx +++ b/webapp/boards/src/components/blocksEditor/blocks/checkbox/index.tsx @@ -1,6 +1,6 @@ // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. -import React, {useRef, useEffect} from 'react' +import React, {useEffect, useRef} from 'react' import {marked} from 'marked' import {BlockInputProps, ContentType} from 'src/components/blocksEditor/blocks/types' @@ -23,6 +23,7 @@ const Checkbox: ContentType = { Display: (props: BlockInputProps) => { const renderer = new marked.Renderer() const html = marked(props.value.value || '', {renderer, breaks: true}) + return (
= { useEffect(() => { ref.current?.focus() }, []) + return (
{ props.onSave(props.value) }, []) + return null }, } diff --git a/webapp/boards/src/components/blocksEditor/blocks/h1/h1.test.tsx b/webapp/boards/src/components/blocksEditor/blocks/h1/h1.test.tsx index 5cec74a838..b912c3288a 100644 --- a/webapp/boards/src/components/blocksEditor/blocks/h1/h1.test.tsx +++ b/webapp/boards/src/components/blocksEditor/blocks/h1/h1.test.tsx @@ -2,7 +2,7 @@ // See LICENSE.txt for license information. import React from 'react' -import {render, screen, fireEvent} from '@testing-library/react' +import {fireEvent, render, screen} from '@testing-library/react' import H1Block from '.' diff --git a/webapp/boards/src/components/blocksEditor/blocks/h1/index.tsx b/webapp/boards/src/components/blocksEditor/blocks/h1/index.tsx index 2b8f9ade70..1deb2fcf6a 100644 --- a/webapp/boards/src/components/blocksEditor/blocks/h1/index.tsx +++ b/webapp/boards/src/components/blocksEditor/blocks/h1/index.tsx @@ -1,6 +1,6 @@ // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. -import React, {useRef, useEffect} from 'react' +import React, {useEffect, useRef} from 'react' import {marked} from 'marked' import {BlockInputProps, ContentType} from 'src/components/blocksEditor/blocks/types' @@ -17,6 +17,7 @@ const H1: ContentType = { Display: (props: BlockInputProps) => { const renderer = new marked.Renderer() const html = marked('# ' + props.value, {renderer, breaks: true}) + return (
{ ref.current?.focus() }, []) + return ( { const renderer = new marked.Renderer() const html = marked('## ' + props.value, {renderer, breaks: true}) + return (
{ ref.current?.focus() }, []) + return ( { const renderer = new marked.Renderer() const html = marked('### ' + props.value, {renderer, breaks: true}) + return (
{ ref.current?.focus() }, []) + return ( = { /> ) } + return null }, Input: (props: BlockInputProps) => { diff --git a/webapp/boards/src/components/blocksEditor/blocks/index.tsx b/webapp/boards/src/components/blocksEditor/blocks/index.tsx index db39ca8d44..bc29366c84 100644 --- a/webapp/boards/src/components/blocksEditor/blocks/index.tsx +++ b/webapp/boards/src/components/blocksEditor/blocks/index.tsx @@ -45,6 +45,7 @@ export function isSubPrefix(text: string): boolean { return true } } + return false } @@ -58,6 +59,7 @@ export function getBySlashCommandPrefix(slashCommandPrefix: string): ContentType return ct } } + return null } diff --git a/webapp/boards/src/components/blocksEditor/blocks/list-item/index.tsx b/webapp/boards/src/components/blocksEditor/blocks/list-item/index.tsx index c6f80de385..dcf90099cf 100644 --- a/webapp/boards/src/components/blocksEditor/blocks/list-item/index.tsx +++ b/webapp/boards/src/components/blocksEditor/blocks/list-item/index.tsx @@ -1,6 +1,6 @@ // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. -import React, {useRef, useEffect} from 'react' +import React, {useEffect, useRef} from 'react' import {BlockInputProps, ContentType} from 'src/components/blocksEditor/blocks/types' @@ -20,6 +20,7 @@ const ListItem: ContentType = { useEffect(() => { ref.current?.focus() }, []) + return (
  • diff --git a/webapp/boards/src/components/blocksEditor/blocks/list-item/list-item.test.tsx b/webapp/boards/src/components/blocksEditor/blocks/list-item/list-item.test.tsx index 1df8a9858c..ae77d35d3d 100644 --- a/webapp/boards/src/components/blocksEditor/blocks/list-item/list-item.test.tsx +++ b/webapp/boards/src/components/blocksEditor/blocks/list-item/list-item.test.tsx @@ -2,7 +2,7 @@ // See LICENSE.txt for license information. import React from 'react' -import {render, screen, fireEvent} from '@testing-library/react' +import {fireEvent, render, screen} from '@testing-library/react' import ListItemBlock from '.' diff --git a/webapp/boards/src/components/blocksEditor/blocks/quote/index.tsx b/webapp/boards/src/components/blocksEditor/blocks/quote/index.tsx index fcdad22458..c7607e23fb 100644 --- a/webapp/boards/src/components/blocksEditor/blocks/quote/index.tsx +++ b/webapp/boards/src/components/blocksEditor/blocks/quote/index.tsx @@ -1,6 +1,6 @@ // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. -import React, {useRef, useEffect} from 'react' +import React, {useEffect, useRef} from 'react' import {marked} from 'marked' import {BlockInputProps, ContentType} from 'src/components/blocksEditor/blocks/types' @@ -15,6 +15,7 @@ const Quote: ContentType = { Display: (props: BlockInputProps) => { const renderer = new marked.Renderer() const html = marked('> ' + props.value, {renderer, breaks: true}) + return (
    { ref.current?.focus() }, []) + return (
    { const html: string = Utils.htmlFromMarkdown(props.value || '') + return (
    { ref.current?.focus() }, []) + return ( { const html: string = Utils.htmlFromMarkdown(props.value || '') + return (
    = { ) } + return null }, Input: (props: BlockInputProps) => { diff --git a/webapp/boards/src/components/blocksEditor/blocks/video/video.test.tsx b/webapp/boards/src/components/blocksEditor/blocks/video/video.test.tsx index c4f980a7bd..2168fac0de 100644 --- a/webapp/boards/src/components/blocksEditor/blocks/video/video.test.tsx +++ b/webapp/boards/src/components/blocksEditor/blocks/video/video.test.tsx @@ -2,7 +2,7 @@ // See LICENSE.txt for license information. import React from 'react' -import {render, screen, fireEvent} from '@testing-library/react' +import {fireEvent, render, screen} from '@testing-library/react' import {mocked} from 'jest-mock' import octoClient from 'src/octoClient' diff --git a/webapp/boards/src/components/blocksEditor/blocksEditor.test.tsx b/webapp/boards/src/components/blocksEditor/blocksEditor.test.tsx index 2e713f56de..c1ef18db9e 100644 --- a/webapp/boards/src/components/blocksEditor/blocksEditor.test.tsx +++ b/webapp/boards/src/components/blocksEditor/blocksEditor.test.tsx @@ -4,21 +4,20 @@ import React from 'react' import {Provider as ReduxProvider} from 'react-redux' import { + act, + fireEvent, render, screen, - fireEvent, - act } from '@testing-library/react' import { mockDOM, - wrapDNDIntl, mockStateStore, - setup + setup, + wrapDNDIntl, } from 'src/testUtils' import {TestBlockFactory} from 'src/test/testBlockFactory' - import {BlockData} from './blocks/types' import BlocksEditor from './blocksEditor' @@ -120,7 +119,6 @@ describe('components/blocksEditor/blocksEditor', () => { await user.keyboard('{Enter}') }) - expect(onBlockCreated).toBeCalledWith(expect.objectContaining({value: 'test'})) }) diff --git a/webapp/boards/src/components/blocksEditor/blocksEditor.tsx b/webapp/boards/src/components/blocksEditor/blocksEditor.tsx index 9868d6910b..41b4023b40 100644 --- a/webapp/boards/src/components/blocksEditor/blocksEditor.tsx +++ b/webapp/boards/src/components/blocksEditor/blocksEditor.tsx @@ -1,6 +1,6 @@ // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. -import React, {useState, useMemo} from 'react' +import React, {useMemo, useState} from 'react' import {DndProvider} from 'react-dnd' import {HTML5Backend} from 'react-dnd-html5-backend' @@ -22,6 +22,7 @@ function BlocksEditor(props: Props) { const [editing, setEditing] = useState(null) const [afterBlock, setAfterBlock] = useState(null) const contentOrder = useMemo(() => props.blocks.filter((b) => b.id).map((b) => b.id!), [props.blocks]) + return (
    )} diff --git a/webapp/boards/src/components/blocksEditor/editor.test.tsx b/webapp/boards/src/components/blocksEditor/editor.test.tsx index 239e5e466e..f546a96f26 100644 --- a/webapp/boards/src/components/blocksEditor/editor.test.tsx +++ b/webapp/boards/src/components/blocksEditor/editor.test.tsx @@ -3,13 +3,13 @@ import React from 'react' import {Provider as ReduxProvider} from 'react-redux' -import {render, screen, act} from '@testing-library/react' +import {act, render, screen} from '@testing-library/react' import { mockDOM, - wrapDNDIntl, mockStateStore, - setup + setup, + wrapDNDIntl, } from 'src/testUtils' import {TestBlockFactory} from 'src/test/testBlockFactory' diff --git a/webapp/boards/src/components/blocksEditor/editor.tsx b/webapp/boards/src/components/blocksEditor/editor.tsx index 21c2d8adc7..46d3626623 100644 --- a/webapp/boards/src/components/blocksEditor/editor.tsx +++ b/webapp/boards/src/components/blocksEditor/editor.tsx @@ -1,9 +1,9 @@ // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. -import React, {useState, useEffect} from 'react' +import React, {useEffect, useState} from 'react' import * as contentBlocks from './blocks/' -import {ContentType, BlockData} from './blocks/types' +import {BlockData, ContentType} from './blocks/types' import RootInput from './rootInput' import './editor.scss' diff --git a/webapp/boards/src/components/blocksEditor/rootInput.test.tsx b/webapp/boards/src/components/blocksEditor/rootInput.test.tsx index 947189b0c4..568c35450f 100644 --- a/webapp/boards/src/components/blocksEditor/rootInput.test.tsx +++ b/webapp/boards/src/components/blocksEditor/rootInput.test.tsx @@ -2,7 +2,7 @@ // See LICENSE.txt for license information. import React from 'react' -import {render, screen, fireEvent} from '@testing-library/react' +import {fireEvent, render, screen} from '@testing-library/react' import RootInput from './rootInput' diff --git a/webapp/boards/src/components/boardSelector.test.tsx b/webapp/boards/src/components/boardSelector.test.tsx index 6f27ef27f1..369f2dc792 100644 --- a/webapp/boards/src/components/boardSelector.test.tsx +++ b/webapp/boards/src/components/boardSelector.test.tsx @@ -4,19 +4,18 @@ import React from 'react' import {Provider as ReduxProvider} from 'react-redux' import { + act, + fireEvent, render, screen, - act, - fireEvent } from '@testing-library/react' import {mocked} from 'jest-mock' import userEvent from '@testing-library/user-event' import octoClient from 'src/octoClient' -import {mockStateStore} from 'src/testUtils' +import {mockStateStore, wrapIntl} from 'src/testUtils' import {createBoard} from 'src/blocks/board' -import {wrapIntl} from 'src/testUtils' import BoardSelector from './boardSelector' @@ -97,7 +96,7 @@ describe('components/boardSelector', () => { expect(container).toMatchSnapshot() }) - it("escape button should unmount the component", () => { + it('escape button should unmount the component', () => { mockedOctoClient.searchLinkableBoards.mockResolvedValueOnce([]) const store = mockStateStore([], state) @@ -114,10 +113,10 @@ describe('components/boardSelector', () => { expect(store.dispatch).toHaveBeenCalledTimes(0) fireEvent.keyDown(getByText(/Link boards/i), { - key: "Escape", - code: "Escape", + key: 'Escape', + code: 'Escape', keyCode: 27, - charCode: 27 + charCode: 27, }) expect(store.dispatch).toHaveBeenCalledTimes(2) diff --git a/webapp/boards/src/components/boardSelector.tsx b/webapp/boards/src/components/boardSelector.tsx index a6e8a0dcea..7c4be33d73 100644 --- a/webapp/boards/src/components/boardSelector.tsx +++ b/webapp/boards/src/components/boardSelector.tsx @@ -1,7 +1,7 @@ // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. -import React, {useState, useMemo, useCallback} from 'react' -import {IntlProvider, useIntl, FormattedMessage} from 'react-intl' +import React, {useCallback, useMemo, useState} from 'react' +import {FormattedMessage, IntlProvider, useIntl} from 'react-intl' import debounce from 'lodash/debounce' import {SuiteWindow} from 'src/types/index' @@ -13,10 +13,10 @@ import {useWebsockets} from 'src/hooks/websockets' import octoClient from 'src/octoClient' import mutator from 'src/mutator' -import {getCurrentTeamId, getAllTeams, Team} from 'src/store/teams' -import {createBoard, Board} from 'src/blocks/board' -import {useAppSelector, useAppDispatch} from 'src/store/hooks' -import {EmptySearch, EmptyResults} from 'src/components/searchDialog/searchDialog' +import {Team, getAllTeams, getCurrentTeamId} from 'src/store/teams' +import {Board, createBoard} from 'src/blocks/board' +import {useAppDispatch, useAppSelector} from 'src/store/hooks' +import {EmptyResults, EmptySearch} from 'src/components/searchDialog/searchDialog' import ConfirmationDialog from 'src/components/confirmationDialogBox' import Dialog from 'src/components/dialog' import SearchIcon from 'src/widgets/icons/search' @@ -67,7 +67,7 @@ const BoardSelector = () => { let updated = false results.forEach((board, idx) => { for (const newBoard of boards) { - if (newBoard.id == board.id) { + if (newBoard.id === board.id) { newResults[idx] = newBoard updated = true } @@ -95,6 +95,7 @@ const BoardSelector = () => { const linkBoard = async (board: Board, confirmed?: boolean): Promise => { if (!confirmed) { setShowLinkBoardConfirmation(board) + return } const newBoard = createBoard({...board, channelId: currentChannel}) @@ -117,7 +118,7 @@ const BoardSelector = () => { } let confirmationSubText - if (showLinkBoardConfirmation?.channelId !== '') { + if (showLinkBoardConfirmation?.channelId) { confirmationSubText = intl.formatMessage({ id: 'boardSelector.confirm-link-board-subtext-with-other-channel', defaultMessage: 'When you link "{boardName}" to the channel, all members of the channel (existing and new) will be able to edit it. This excludes members who are guests.{lineBreak} This board is currently linked to another channel. It will be unlinked if you choose to link it here.', @@ -138,7 +139,7 @@ const BoardSelector = () => { } const handleKeyDown = (event: React.KeyboardEvent) => { - if (event.key == 'Escape') { + if (event.key === 'Escape') { closeDialog() } } @@ -197,13 +198,15 @@ const BoardSelector = () => {
    {/*When there are results to show*/} {searchQuery && results.length > 0 && - results.map((result) => ())} + results.map((result) => ( + + ))} {/*when user searched for something and there were no results*/} {emptyResult && } diff --git a/webapp/boards/src/components/boardSelectorItem.test.tsx b/webapp/boards/src/components/boardSelectorItem.test.tsx index 50202d1e96..f5d393baec 100644 --- a/webapp/boards/src/components/boardSelectorItem.test.tsx +++ b/webapp/boards/src/components/boardSelectorItem.test.tsx @@ -14,7 +14,7 @@ import BoardSelectorItem from './boardSelectorItem' describe('components/boardSelectorItem', () => { it('renders board without title', async () => { const board = createBoard() - board.title = "" + board.title = '' const {container} = render(wrapIntl( { it('renders linked board', async () => { const board = createBoard() - board.title = "Test title" + board.title = 'Test title' const {container} = render(wrapIntl( { it('renders not linked board', async () => { const board = createBoard() - board.title = "Test title" + board.title = 'Test title' const {container} = render(wrapIntl( { const intl = useIntl() const untitledBoardTitle = intl.formatMessage({id: 'ViewTitle.untitled-board', defaultMessage: 'Untitled board'}) const resultTitle = item.title || untitledBoardTitle + return (
    diff --git a/webapp/boards/src/components/boardTemplateSelector/boardTemplateSelector.test.tsx b/webapp/boards/src/components/boardTemplateSelector/boardTemplateSelector.test.tsx index 83c5b84b89..3f5806110e 100644 --- a/webapp/boards/src/components/boardTemplateSelector/boardTemplateSelector.test.tsx +++ b/webapp/boards/src/components/boardTemplateSelector/boardTemplateSelector.test.tsx @@ -5,7 +5,7 @@ import { render, screen, waitFor, - within + within, } from '@testing-library/react' import userEvent from '@testing-library/user-event' import React from 'react' @@ -20,7 +20,7 @@ import {MemoryRouter, Router} from 'react-router-dom' import Mutator from 'src/mutator' import {Team} from 'src/store/teams' -import {createBoard, Board} from 'src/blocks/board' +import {Board, createBoard} from 'src/blocks/board' import {IUser} from 'src/user' import {mockDOM, mockStateStore, wrapDNDIntl} from 'src/testUtils' @@ -288,7 +288,7 @@ describe('components/boardTemplateSelector/boardTemplateSelector', () => { const useTemplateButton = screen.getByText('Use this template').parentElement expect(useTemplateButton).not.toBeNull() - + await userEvent.click(useTemplateButton!) await waitFor(() => expect(mockedMutator.addBoardFromTemplate).toBeCalledTimes(1)) @@ -313,11 +313,10 @@ describe('components/boardTemplateSelector/boardTemplateSelector', () => { expect(divBoardToSelect).not.toBeNull() await userEvent.click(divBoardToSelect!) - const useTemplateButton = screen.getByText('Use this template').parentElement expect(useTemplateButton).not.toBeNull() - + await userEvent.click(useTemplateButton!) await waitFor(() => expect(mockedMutator.addBoardFromTemplate).toBeCalledTimes(1)) @@ -339,12 +338,12 @@ describe('components/boardTemplateSelector/boardTemplateSelector', () => { expect(divBoardToSelect).not.toBeNull() await userEvent.click(divBoardToSelect!) - + const useTemplateButton = screen.getByText('Use this template').parentElement expect(useTemplateButton).not.toBeNull() - + await userEvent.click(useTemplateButton!) - + await waitFor(() => expect(mockedMutator.addBoardFromTemplate).toBeCalledTimes(1)) await waitFor(() => expect(mockedMutator.addBoardFromTemplate).toBeCalledWith(team1.id, expect.anything(), expect.anything(), expect.anything(), 'global-1', team1.id)) await waitFor(() => expect(mockedTelemetry.trackEvent).toBeCalledWith('boards', 'createBoardViaTemplate', {boardTemplateId: 'template_id_global'})) @@ -367,9 +366,9 @@ describe('components/boardTemplateSelector/boardTemplateSelector', () => { const useTemplateButton = screen.getByText('Use this template').parentElement expect(useTemplateButton).not.toBeNull() - + await userEvent.click(useTemplateButton!) - + await waitFor(() => expect(mockedMutator.addBoardFromTemplate).toBeCalledTimes(1)) await waitFor(() => expect(mockedMutator.addBoardFromTemplate).toBeCalledWith(team1.id, expect.anything(), expect.anything(), expect.anything(), '2', team1.id)) await waitFor(() => expect(mockedTelemetry.trackEvent).toBeCalledWith('boards', 'createBoardViaTemplate', {boardTemplateId: 'template_id_2'})) diff --git a/webapp/boards/src/components/boardTemplateSelector/boardTemplateSelector.tsx b/webapp/boards/src/components/boardTemplateSelector/boardTemplateSelector.tsx index 3a3821407e..1dfeae7659 100644 --- a/webapp/boards/src/components/boardTemplateSelector/boardTemplateSelector.tsx +++ b/webapp/boards/src/components/boardTemplateSelector/boardTemplateSelector.tsx @@ -1,10 +1,10 @@ // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. import React, { - useEffect, - useState, useCallback, - useMemo + useEffect, + useMemo, + useState, } from 'react' import {FormattedMessage, useIntl} from 'react-intl' import {useHistory, useRouteMatch} from 'react-router-dom' @@ -18,8 +18,8 @@ import CloseIcon from 'src/widgets/icons/close' import Button from 'src/widgets/buttons/button' import octoClient from 'src/octoClient' import mutator from 'src/mutator' -import {getTemplates, getCurrentBoardId} from 'src/store/boards' -import {getCurrentTeam, Team} from 'src/store/teams' +import {getCurrentBoardId, getTemplates} from 'src/store/boards' +import {Team, getCurrentTeam} from 'src/store/teams' import {fetchGlobalTemplates, getGlobalTemplates} from 'src/store/globalTemplates' import {useAppDispatch, useAppSelector} from 'src/store/hooks' import TelemetryClient, {TelemetryActions, TelemetryCategory} from 'src/telemetry/telemetryClient' diff --git a/webapp/boards/src/components/boardTemplateSelector/boardTemplateSelectorItem.test.tsx b/webapp/boards/src/components/boardTemplateSelector/boardTemplateSelectorItem.test.tsx index ee629334b0..945d047b1f 100644 --- a/webapp/boards/src/components/boardTemplateSelector/boardTemplateSelectorItem.test.tsx +++ b/webapp/boards/src/components/boardTemplateSelector/boardTemplateSelectorItem.test.tsx @@ -1,17 +1,17 @@ // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. import { - render, - within, act, - waitFor + render, + waitFor, + within, } from '@testing-library/react' import userEvent from '@testing-library/user-event' import React from 'react' import {MockStoreEnhanced} from 'redux-mock-store' import {Provider as ReduxProvider} from 'react-redux' -import {Board, MemberRole, IPropertyTemplate} from 'src/blocks/board' +import {Board, IPropertyTemplate, MemberRole} from 'src/blocks/board' import {mockStateStore, wrapDNDIntl} from 'src/testUtils' import {IUser} from 'src/user' diff --git a/webapp/boards/src/components/boardTemplateSelector/boardTemplateSelectorPreview.tsx b/webapp/boards/src/components/boardTemplateSelector/boardTemplateSelectorPreview.tsx index 8ea77b2708..96c2ff3d1a 100644 --- a/webapp/boards/src/components/boardTemplateSelector/boardTemplateSelectorPreview.tsx +++ b/webapp/boards/src/components/boardTemplateSelector/boardTemplateSelectorPreview.tsx @@ -1,6 +1,6 @@ // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. -import React, {useEffect, useState, useMemo} from 'react' +import React, {useEffect, useMemo, useState} from 'react' import {Board} from 'src/blocks/board' import {Card} from 'src/blocks/card' @@ -45,6 +45,7 @@ const BoardTemplateSelectorPreview = (props: Props) => { } }) } + return () => { isSubscribed = false } @@ -62,6 +63,7 @@ const BoardTemplateSelectorPreview = (props: Props) => { if (!activeView) { return {visible: [], hidden: []} } + return getVisibleAndHiddenGroups(activeTemplateCards, activeView.fields.visibleOptionIds, activeView?.fields.hiddenOptionIds, groupByProperty) }, [activeTemplateCards, activeView, groupByProperty]) diff --git a/webapp/boards/src/components/boardsSwitcher/boardsSwitcher.tsx b/webapp/boards/src/components/boardsSwitcher/boardsSwitcher.tsx index a30f989946..f9030c435a 100644 --- a/webapp/boards/src/components/boardsSwitcher/boardsSwitcher.tsx +++ b/webapp/boards/src/components/boardsSwitcher/boardsSwitcher.tsx @@ -19,7 +19,7 @@ import AddIcon from 'src/widgets/icons/add' import BoardSwitcherDialog from 'src/components/boardsSwitcherDialog/boardSwitcherDialog' import {Utils} from 'src/utils' import {Constants} from 'src/constants' -import {TOUR_SIDEBAR, SidebarTourSteps} from 'src/components/onboardingTour' +import {SidebarTourSteps, TOUR_SIDEBAR} from 'src/components/onboardingTour' import IconButton from 'src/widgets/buttons/iconButton' import SearchForBoardsTourStep from 'src/components/onboardingTour/searchForBoards/searchForBoards' diff --git a/webapp/boards/src/components/boardsSwitcherDialog/boardSwitcherDialog.test.tsx b/webapp/boards/src/components/boardsSwitcherDialog/boardSwitcherDialog.test.tsx index 427a0188d2..97f77c975b 100644 --- a/webapp/boards/src/components/boardsSwitcherDialog/boardSwitcherDialog.test.tsx +++ b/webapp/boards/src/components/boardsSwitcherDialog/boardSwitcherDialog.test.tsx @@ -9,7 +9,7 @@ import {Provider as ReduxProvider} from 'react-redux' import {render} from '@testing-library/react' -import {createMemoryHistory, History} from 'history' +import {History, createMemoryHistory} from 'history' import {Router} from 'react-router-dom' diff --git a/webapp/boards/src/components/boardsSwitcherDialog/boardSwitcherDialog.tsx b/webapp/boards/src/components/boardsSwitcherDialog/boardSwitcherDialog.tsx index f0325bf586..cb50101ccc 100644 --- a/webapp/boards/src/components/boardsSwitcherDialog/boardSwitcherDialog.tsx +++ b/webapp/boards/src/components/boardsSwitcherDialog/boardSwitcherDialog.tsx @@ -1,12 +1,12 @@ // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. import React, { + MutableRefObject, ReactNode, - useRef, createRef, - useState, useEffect, - MutableRefObject + useRef, + useState, } from 'react' import './boardSwitcherDialog.scss' @@ -19,7 +19,7 @@ import SearchDialog from 'src/components/searchDialog/searchDialog' import Globe from 'src/widgets/icons/globe' import LockOutline from 'src/widgets/icons/lockOutline' import {useAppSelector} from 'src/store/hooks' -import {getAllTeams, getCurrentTeam, Team} from 'src/store/teams' +import {Team, getAllTeams, getCurrentTeam} from 'src/store/teams' import {getMe} from 'src/store/users' import {Utils} from 'src/utils' import {BoardTypeOpen, BoardTypePrivate} from 'src/blocks/board' @@ -39,7 +39,7 @@ const BoardSwitcherDialog = (props: Props): JSX.Element => { const team = useAppSelector(getCurrentTeam) const me = useAppSelector(getMe) const title = intl.formatMessage({id: 'FindBoardsDialog.Title', defaultMessage: 'Find Boards'}) - const subTitle = intl.formatMessage( + const subTitle = intl.formatMessage( { id: 'FindBoardsDialog.SubTitle', defaultMessage: 'Type to find a board. Use UP/DOWN to browse. ENTER to select, ESC to dismiss', @@ -75,6 +75,7 @@ const BoardSwitcherDialog = (props: Props): JSX.Element => { const untitledBoardTitle = intl.formatMessage({id: 'ViewTitle.untitled-board', defaultMessage: 'Untitled board'}) refs.current = items.map((_, i) => refs.current[i] ?? createRef()) setRefs(refs) + return items.map((item, i) => { const resultTitle = item.title || untitledBoardTitle const teamTitle = teamsById[item.teamId].title @@ -83,6 +84,7 @@ const BoardSwitcherDialog = (props: Props): JSX.Element => { ...prevIDs, [i]: [item.teamId, item.id], })) + return (
    { }) const board = {...createBoard(), title: 'test board'} + // mockedOctoClient.getBoard.mockResolvedValueOnce(board) const component = ( diff --git a/webapp/boards/src/components/boardsUnfurl/boardsUnfurl.tsx b/webapp/boards/src/components/boardsUnfurl/boardsUnfurl.tsx index 08a9f5eb51..b0704693fe 100644 --- a/webapp/boards/src/components/boardsUnfurl/boardsUnfurl.tsx +++ b/webapp/boards/src/components/boardsUnfurl/boardsUnfurl.tsx @@ -1,7 +1,7 @@ // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. -import React, {useState, useEffect} from 'react' -import {IntlProvider, FormattedMessage, useIntl} from 'react-intl' +import React, {useEffect, useState} from 'react' +import {FormattedMessage, IntlProvider, useIntl} from 'react-intl' import WithWebSockets from 'src/components/withWebSockets' import {useWebsockets} from 'src/hooks/websockets' @@ -10,7 +10,7 @@ import {getLanguage} from 'src/store/language' import {useAppSelector} from 'src/store/hooks' import {getCurrentTeamId} from 'src/store/teams' -import {WSClient, MMWebSocketClient} from 'src/wsclient' +import {MMWebSocketClient, WSClient} from 'src/wsclient' import manifest from 'src/manifest' import {getMessages} from 'src/i18n' @@ -86,6 +86,7 @@ export const BoardsUnfurl = (props: Props): JSX.Element => { const [firstCard] = cards as Card[] if (!firstCard || !fetchedBoard || firstCard.type !== 'card') { setLoading(false) + return null } setCard(firstCard) @@ -102,12 +103,14 @@ export const BoardsUnfurl = (props: Props): JSX.Element => { const [firstContentBlock] = contentBlock if (!firstContentBlock) { setLoading(false) + return null } setContent(firstContentBlock) } setLoading(false) + return null } fetchData() diff --git a/webapp/boards/src/components/calculations/calculations.ts b/webapp/boards/src/components/calculations/calculations.ts index 86eb878754..bf1279926e 100644 --- a/webapp/boards/src/components/calculations/calculations.ts +++ b/webapp/boards/src/components/calculations/calculations.ts @@ -44,8 +44,8 @@ function fixTimestampToMinutesAccuracy(timestamp: number) { } function cardsWithValue(cards: readonly Card[], property: IPropertyTemplate): Card[] { - return cards. - filter((card) => Boolean(getCardProperty(card, property))) + return cards + .filter((card) => Boolean(getCardProperty(card, property))) } // eslint-disable-next-line @typescript-eslint/no-unused-vars @@ -66,6 +66,7 @@ function percentEmpty(cards: readonly Card[], property: IPropertyTemplate): stri if (cards.length === 0) { return '' } + return String((((cards.length - cardsWithValue(cards, property).length) / cards.length) * 100).toFixed(0)) + '%' } @@ -73,6 +74,7 @@ function percentNotEmpty(cards: readonly Card[], property: IPropertyTemplate): s if (cards.length === 0) { return '' } + return String(((cardsWithValue(cards, property).length / cards.length) * 100).toFixed(0)) + '%' } @@ -80,8 +82,8 @@ function countValueHelper(cards: readonly Card[], property: IPropertyTemplate): let values = 0 if (property.type === 'multiSelect') { - cardsWithValue(cards, property). - forEach((card) => { + cardsWithValue(cards, property) + .forEach((card) => { values += (getCardProperty(card, property) as string[]).length }) } else { @@ -140,8 +142,8 @@ function countUniqueValue(cards: readonly Card[], property: IPropertyTemplate): function sum(cards: readonly Card[], property: IPropertyTemplate): string { let result = 0 - cardsWithValue(cards, property). - forEach((card) => { + cardsWithValue(cards, property) + .forEach((card) => { result += parseFloat(getCardProperty(card, property) as string) }) @@ -156,12 +158,13 @@ function average(cards: readonly Card[], property: IPropertyTemplate): string { const result = parseFloat(sum(cards, property)) const avg = result / numCards + return String(Utils.roundTo(avg, ROUNDED_DECIMAL_PLACES)) } function median(cards: readonly Card[], property: IPropertyTemplate): string { - const sorted = cardsWithValue(cards, property). - sort((a, b) => { + const sorted = cardsWithValue(cards, property) + .sort((a, b) => { if (!getCardProperty(a, property)) { return 1 } @@ -231,6 +234,7 @@ function earliest(cards: readonly Card[], property: IPropertyTemplate, intl: Int return '' } const date = new Date(result) + return property.type === 'date' ? Utils.displayDate(date, intl) : Utils.displayDateTime(date, intl) } @@ -242,6 +246,7 @@ function earliestEpoch(cards: readonly Card[], property: IPropertyTemplate): num result = Math.min(result, timestamp) } }) + return result } @@ -251,6 +256,7 @@ function latest(cards: readonly Card[], property: IPropertyTemplate, intl: IntlS return '' } const date = new Date(result) + return property.type === 'date' ? Utils.displayDate(date, intl) : Utils.displayDateTime(date, intl) } @@ -262,6 +268,7 @@ function latestEpoch(cards: readonly Card[], property: IPropertyTemplate): numbe result = Math.max(result, timestamp) } }) + return result } @@ -276,10 +283,12 @@ function getTimestampsFromPropertyValue(value: number | string | string[]): numb } catch { return [] } + return [property.from, property.to].flatMap((e) => { return e ? [e] : [] }) } + return [] } @@ -292,6 +301,7 @@ function dateRange(cards: readonly Card[], property: IPropertyTemplate, intl: In if (resultLatest === Number.NEGATIVE_INFINITY) { return '' } + return moment.duration(resultLatest - resultEarliest, 'milliseconds').locale(intl.locale.toLowerCase()).humanize() } diff --git a/webapp/boards/src/components/calculations/options.tsx b/webapp/boards/src/components/calculations/options.tsx index 859da420ff..a35c68499b 100644 --- a/webapp/boards/src/components/calculations/options.tsx +++ b/webapp/boards/src/components/calculations/options.tsx @@ -2,10 +2,9 @@ // See LICENSE.txt for license information. import React from 'react' -import Select, {components, DropdownIndicatorProps, StylesConfig} from 'react-select' +import Select, {DropdownIndicatorProps, StylesConfig, components} from 'react-select' - -import {useIntl, IntlShape} from 'react-intl' +import {IntlShape, useIntl} from 'react-intl' import {getSelectBaseStyle} from 'src/theme' import ChevronUp from 'src/widgets/icons/chevronUp' diff --git a/webapp/boards/src/components/calendar/fullCalendar.test.tsx b/webapp/boards/src/components/calendar/fullCalendar.test.tsx index 556dcb85d1..77f9451dc2 100644 --- a/webapp/boards/src/components/calendar/fullCalendar.test.tsx +++ b/webapp/boards/src/components/calendar/fullCalendar.test.tsx @@ -5,7 +5,7 @@ import {render} from '@testing-library/react' import {Provider as ReduxProvider} from 'react-redux' import {TestBlockFactory} from 'src/test/testBlockFactory' -import {wrapIntl, mockStateStore} from 'src/testUtils' +import {mockStateStore, wrapIntl} from 'src/testUtils' import {IPropertyTemplate} from 'src/blocks/board' import CalendarView from './fullCalendar' diff --git a/webapp/boards/src/components/calendar/fullCalendar.tsx b/webapp/boards/src/components/calendar/fullCalendar.tsx index 1ba1a2c888..ffd67dfa8a 100644 --- a/webapp/boards/src/components/calendar/fullCalendar.tsx +++ b/webapp/boards/src/components/calendar/fullCalendar.tsx @@ -5,10 +5,10 @@ import React, {useCallback, useMemo, useState} from 'react' import {useIntl} from 'react-intl' import FullCalendar, { + DayCellContentArg, EventChangeArg, - EventInput, EventContentArg, - DayCellContentArg + EventInput, } from '@fullcalendar/react' import interactionPlugin from '@fullcalendar/interaction' @@ -60,6 +60,7 @@ function createDatePropertyFromCalendarDates(start: Date, end: Date): DateProper if (dateTo !== dateFrom) { dateProperty.to = dateTo } + return dateProperty } @@ -69,6 +70,7 @@ function createDatePropertyFromCalendarDate(start: Date): DateProperty { const dateFrom = start.getTime() - timeZoneOffset(start.getTime()) const dateProperty: DateProperty = {from: dateFrom} + return dateProperty } @@ -97,6 +99,7 @@ const CalendarFullView = (props: Props): JSX.Element|null => { if (readonly || !dateDisplayProperty || propsRegistry.get(dateDisplayProperty.type).isReadOnly) { return false } + return true }, [readonly, dateDisplayProperty]) @@ -118,6 +121,7 @@ const CalendarFullView = (props: Props): JSX.Element|null => { //full calendar end date is exclusive, so increment by 1 day. dateTo.setDate(dateTo.getDate() + 1) } + return [{ id: card.id, title: card.title, diff --git a/webapp/boards/src/components/cardBadges.tsx b/webapp/boards/src/components/cardBadges.tsx index bfba9df14a..2f2fd00817 100644 --- a/webapp/boards/src/components/cardBadges.tsx +++ b/webapp/boards/src/components/cardBadges.tsx @@ -64,6 +64,7 @@ const calculateBadges = (contents: ContentsType, comments: CommentBlock[]): Badg updateCounters(content) } } + return { description: text > 0, comments: comments.length, @@ -84,6 +85,7 @@ const CardBadges = (props: Props) => { } const intl = useIntl() const {checkboxes} = badges + return (
    {badges.description && diff --git a/webapp/boards/src/components/cardDetail/cardDetail.tsx b/webapp/boards/src/components/cardDetail/cardDetail.tsx index 872ebd33da..7ff6d17033 100644 --- a/webapp/boards/src/components/cardDetail/cardDetail.tsx +++ b/webapp/boards/src/components/cardDetail/cardDetail.tsx @@ -1,14 +1,14 @@ // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. import React, { + Fragment, useCallback, useEffect, + useMemo, useRef, useState, - Fragment, - useMemo } from 'react' -import {FormattedMessage, useIntl, IntlShape} from 'react-intl' +import {FormattedMessage, IntlShape, useIntl} from 'react-intl' import {BlockIcons} from 'src/blockIcons' import {Card} from 'src/blocks/card' @@ -30,7 +30,7 @@ import TelemetryClient, {TelemetryActions, TelemetryCategory} from 'src/telemetr import BlockIconSelector from 'src/components/blockIconSelector' import {useAppDispatch, useAppSelector} from 'src/store/hooks' -import {updateCards, setCurrent as setCurrentCard} from 'src/store/cards' +import {setCurrent as setCurrentCard, updateCards} from 'src/store/cards' import {updateContents} from 'src/store/contents' import {Permission} from 'src/constants' import {useHasCurrentBoardPermissions} from 'src/hooks/permissions' @@ -102,6 +102,7 @@ async function addBlockNewEditor(card: Card, intl: IntlShape, title: string, fie const newBlock = await mutator.insertBlock(block.boardId, block, description, afterRedo, beforeUndo) dispatch(updateContents([newBlock])) + return newBlock } @@ -144,7 +145,7 @@ const CardDetail = (props: Props): JSX.Element|null => { useEffect(() => { return () => { - saveTitleRef.current && saveTitleRef.current() + saveTitleRef.current?.() } }, []) @@ -339,6 +340,7 @@ const CardDetail = (props: Props): JSX.Element|null => { } else { newBlock = await addBlockNewEditor(card, intl, block.value, {}, block.contentType, afterBlock?.id, dispatch) } + return {...block, id: newBlock.id} }} onBlockModified={async (block: any): Promise|null> => { @@ -351,6 +353,7 @@ const CardDetail = (props: Props): JSX.Element|null => { const description = intl.formatMessage({id: 'ContentBlock.DeleteAction', defaultMessage: 'delete'}) mutator.deleteBlock(originalContentBlock, description) + return null } const newBlock = { @@ -363,6 +366,7 @@ const CardDetail = (props: Props): JSX.Element|null => { newBlock.fields = {...newBlock.fields, value: block.value.checked} } mutator.updateBlock(card.boardId, newBlock, originalContentBlock, intl.formatMessage({id: 'ContentBlock.editCardText', defaultMessage: 'edit card text'})) + return block }} onBlockMoved={async (block: BlockData, beforeBlock: BlockData|null, afterBlock: BlockData|null): Promise => { @@ -372,6 +376,7 @@ const CardDetail = (props: Props): JSX.Element|null => { let sourceWhere: 'after'|'before' if (idx === -1) { Utils.logError('Unable to find the block id in the order of the current block') + return } if (idx === 0) { @@ -383,6 +388,7 @@ const CardDetail = (props: Props): JSX.Element|null => { } if (afterBlock && afterBlock.id) { await mutator.moveContentBlock(block.id, afterBlock.id, 'after', sourceBlockId, sourceWhere, intl.formatMessage({id: 'ContentBlock.moveBlock', defaultMessage: 'move card content'})) + return } if (beforeBlock && beforeBlock.id) { diff --git a/webapp/boards/src/components/cardDetail/cardDetailContents.test.tsx b/webapp/boards/src/components/cardDetail/cardDetailContents.test.tsx index a25a18c33b..c4149d2704 100644 --- a/webapp/boards/src/components/cardDetail/cardDetailContents.test.tsx +++ b/webapp/boards/src/components/cardDetail/cardDetailContents.test.tsx @@ -9,7 +9,7 @@ import {act} from 'react-dom/test-utils' import {TestBlockFactory} from 'src/test/testBlockFactory' -import {mockDOM, wrapDNDIntl, mockStateStore} from 'src/testUtils' +import {mockDOM, mockStateStore, wrapDNDIntl} from 'src/testUtils' import CardDetailContents from './cardDetailContents' import {CardDetailProvider} from './cardDetailContext' diff --git a/webapp/boards/src/components/cardDetail/cardDetailContents.tsx b/webapp/boards/src/components/cardDetail/cardDetailContents.tsx index a6e0f636de..4896e573ed 100644 --- a/webapp/boards/src/components/cardDetail/cardDetailContents.tsx +++ b/webapp/boards/src/components/cardDetail/cardDetailContents.tsx @@ -1,9 +1,9 @@ // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. import React from 'react' -import {useIntl, IntlShape} from 'react-intl' +import {IntlShape, useIntl} from 'react-intl' -import {IContentBlockWithCords, ContentBlock as ContentBlockType} from 'src/blocks/contentBlock' +import {ContentBlock as ContentBlockType, IContentBlockWithCords} from 'src/blocks/contentBlock' import {Card} from 'src/blocks/card' import {createTextBlock} from 'src/blocks/textBlock' import {Block} from 'src/blocks/block' @@ -182,6 +182,7 @@ const CardDetailContents = (props: Props) => {
    ) } + return (
    diff --git a/webapp/boards/src/components/cardDetail/cardDetailContentsMenu.test.tsx b/webapp/boards/src/components/cardDetail/cardDetailContentsMenu.test.tsx index c293560d34..4c48a1a823 100644 --- a/webapp/boards/src/components/cardDetail/cardDetailContentsMenu.test.tsx +++ b/webapp/boards/src/components/cardDetail/cardDetailContentsMenu.test.tsx @@ -6,7 +6,7 @@ import {Provider as ReduxProvider} from 'react-redux' import userEvent from '@testing-library/user-event' -import {wrapIntl, mockStateStore, setup} from 'src/testUtils' +import {mockStateStore, setup, wrapIntl} from 'src/testUtils' import {TestBlockFactory} from 'src/test/testBlockFactory' diff --git a/webapp/boards/src/components/cardDetail/cardDetailContentsMenu.tsx b/webapp/boards/src/components/cardDetail/cardDetailContentsMenu.tsx index 441ee3876e..817f5825f7 100644 --- a/webapp/boards/src/components/cardDetail/cardDetailContentsMenu.tsx +++ b/webapp/boards/src/components/cardDetail/cardDetailContentsMenu.tsx @@ -17,6 +17,7 @@ function addContentMenu(intl: IntlShape, type: BlockTypes): JSX.Element { const handler = contentRegistry.getHandler(type) if (!handler) { Utils.logError(`addContentMenu, unknown content type: ${type}`) + return <> } const cardDetail = useCardDetailContext() @@ -39,6 +40,7 @@ function addContentMenu(intl: IntlShape, type: BlockTypes): JSX.Element { const CardDetailContentsMenu = () => { const intl = useIntl() + return (
    diff --git a/webapp/boards/src/components/cardDetail/cardDetailContext.tsx b/webapp/boards/src/components/cardDetail/cardDetailContext.tsx index 436f981700..d5c23e6f06 100644 --- a/webapp/boards/src/components/cardDetail/cardDetailContext.tsx +++ b/webapp/boards/src/components/cardDetail/cardDetailContext.tsx @@ -1,13 +1,13 @@ // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. import React, { - createContext, ReactElement, ReactNode, + createContext, + useCallback, useContext, useMemo, useState, - useCallback } from 'react' import {useIntl} from 'react-intl' @@ -37,6 +37,7 @@ export function useCardDetailContext(): CardDetailContextType { if (!cardDetailContext) { throw new Error('CardDetailContext is not available!') } + return cardDetailContext } diff --git a/webapp/boards/src/components/cardDetail/cardDetailProperties.test.tsx b/webapp/boards/src/components/cardDetail/cardDetailProperties.test.tsx index 3e16156102..b47c61f6fd 100644 --- a/webapp/boards/src/components/cardDetail/cardDetailProperties.test.tsx +++ b/webapp/boards/src/components/cardDetail/cardDetailProperties.test.tsx @@ -3,10 +3,10 @@ import React from 'react' import { + act, + fireEvent, render, screen, - act, - fireEvent } from '@testing-library/react' import userEvent from '@testing-library/user-event' import {mocked} from 'jest-mock' @@ -206,7 +206,7 @@ describe('components/cardDetail/CardDetailProperties', () => { await act(() => userEvent.click(menuElement)) const numberType = screen.getByRole('button', {name: /number/i}) - await act( () => userEvent.click(numberType)) + await act(() => userEvent.click(numberType)) expect(mockedMutator.insertPropertyTemplate).toHaveBeenCalledTimes(1) diff --git a/webapp/boards/src/components/cardDetail/cardDetailProperties.tsx b/webapp/boards/src/components/cardDetail/cardDetailProperties.tsx index eb8a7ac72c..a24c89ac7f 100644 --- a/webapp/boards/src/components/cardDetail/cardDetailProperties.tsx +++ b/webapp/boards/src/components/cardDetail/cardDetailProperties.tsx @@ -63,6 +63,7 @@ const CardDetailProperties = (props: Props) => { // if only the name has changed, set the property without warning if (affectsNumOfCards === '0' || oldType === newType) { mutator.changePropertyTypeAndName(board, cards, propertyTemplate, newType.type, newName) + return } diff --git a/webapp/boards/src/components/cardDetail/comment.test.tsx b/webapp/boards/src/components/cardDetail/comment.test.tsx index 537c034009..141b426e4f 100644 --- a/webapp/boards/src/components/cardDetail/comment.test.tsx +++ b/webapp/boards/src/components/cardDetail/comment.test.tsx @@ -8,7 +8,7 @@ import moment from 'moment' import {mocked} from 'jest-mock' -import {wrapIntl, mockStateStore} from 'src/testUtils' +import {mockStateStore, wrapIntl} from 'src/testUtils' import {TestBlockFactory} from 'src/test/testBlockFactory' diff --git a/webapp/boards/src/components/cardDetail/commentsList.tsx b/webapp/boards/src/components/cardDetail/commentsList.tsx index f3b3c3f3c0..f60cdf3103 100644 --- a/webapp/boards/src/components/cardDetail/commentsList.tsx +++ b/webapp/boards/src/components/cardDetail/commentsList.tsx @@ -95,6 +95,7 @@ const CommentsList = (props: Props) => { // Only modify _own_ comments, EXCEPT for Admins, which can delete _any_ comment // NOTE: editing comments will exist in the future (in addition to deleting) const canDeleteComment: boolean = canDeleteOthersComments || me?.id === comment.modifiedBy + return ( { document.addEventListener('paste', onPaste) document.addEventListener('drop', onDrop) + return () => { document.removeEventListener('paste', onPaste) document.removeEventListener('drop', onDrop) diff --git a/webapp/boards/src/components/cardDialog.test.tsx b/webapp/boards/src/components/cardDialog.test.tsx index b39c5db502..1ac87815a7 100644 --- a/webapp/boards/src/components/cardDialog.test.tsx +++ b/webapp/boards/src/components/cardDialog.test.tsx @@ -93,7 +93,6 @@ describe('components/cardDialog', () => { jest.clearAllMocks() }) test('should match snapshot', async () => { - const {container} = render(wrapDNDIntl( { /> , )) - + expect(container).toMatchSnapshot() }) diff --git a/webapp/boards/src/components/cardDialog.tsx b/webapp/boards/src/components/cardDialog.tsx index 7b8be86c20..3680b66a92 100644 --- a/webapp/boards/src/components/cardDialog.tsx +++ b/webapp/boards/src/components/cardDialog.tsx @@ -1,6 +1,6 @@ // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. -import React, {useState, useCallback} from 'react' +import React, {useCallback, useState} from 'react' import {FormattedMessage, useIntl} from 'react-intl' import {Board} from 'src/blocks/board' @@ -67,6 +67,7 @@ const CardDialog = (props: Props): JSX.Element => { const makeTemplateClicked = async () => { if (!card) { Utils.assertFailure('card') + return } @@ -89,6 +90,7 @@ const CardDialog = (props: Props): JSX.Element => { const handleDeleteCard = async () => { if (!card) { Utils.assertFailure() + return } TelemetryClient.trackEvent(TelemetryCategory, TelemetryActions.DeleteCard, {board: props.board.id, view: props.activeView.id, card: card.id}) @@ -111,6 +113,7 @@ const CardDialog = (props: Props): JSX.Element => { // so adding des if (card?.title === '' && card?.fields.contentOrder.length === 0) { handleDeleteCard() + return } @@ -151,7 +154,7 @@ const CardDialog = (props: Props): JSX.Element => { Utils.selectLocalFile(async (attachment) => { const uploadingBlock = createBlock() uploadingBlock.title = attachment.name - uploadingBlock.fields.attachmentId = attachment.name + uploadingBlock.fields.fileId = attachment.name uploadingBlock.boardId = boardId if (card) { uploadingBlock.parentId = card.id @@ -177,11 +180,11 @@ const CardDialog = (props: Props): JSX.Element => { xhr.onload = () => { if (xhr.status === 200 && xhr.readyState === 4) { const json = JSON.parse(xhr.response) - const attachmentId = json.fileId - if (attachmentId) { + const fileId = json.fileId + if (fileId) { removeUploadingAttachment(uploadingBlock) const block = createAttachmentBlock() - block.fields.attachmentId = attachmentId || '' + block.fields.fileId = fileId || '' block.title = attachment.name sendFlashMessage({content: intl.formatMessage({id: 'AttachmentBlock.uploadSuccess', defaultMessage: 'Attachment uploaded.'}), severity: 'normal'}) resolve(block) @@ -266,6 +269,7 @@ const CardDialog = (props: Props): JSX.Element => { if (!isTemplate && !card?.limited) { return (<>{attachBtn()}{following ? unfollowBtn : followBtn}) } + return (<>{attachBtn()}) } diff --git a/webapp/boards/src/components/cardLimitNotification.tsx b/webapp/boards/src/components/cardLimitNotification.tsx index aadb94a765..65d9007e48 100644 --- a/webapp/boards/src/components/cardLimitNotification.tsx +++ b/webapp/boards/src/components/cardLimitNotification.tsx @@ -1,19 +1,19 @@ // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. import React, {useCallback, useEffect, useState} from 'react' -import {useIntl, FormattedMessage} from 'react-intl' +import {FormattedMessage, useIntl} from 'react-intl' import AlertIcon from 'src/widgets/icons/alert' -import {useAppSelector, useAppDispatch} from 'src/store/hooks' +import {useAppDispatch, useAppSelector} from 'src/store/hooks' import {IUser, UserConfigPatch} from 'src/user' import { + getCardHiddenWarningSnoozeUntil, + getCardLimitSnoozeUntil, getMe, patchProps, - getCardLimitSnoozeUntil, - getCardHiddenWarningSnoozeUntil } from 'src/store/users' -import {getCurrentBoardHiddenCardsCount, getCardHiddenWarning} from 'src/store/cards' +import {getCardHiddenWarning, getCurrentBoardHiddenCardsCount} from 'src/store/cards' import TelemetryClient, {TelemetryActions, TelemetryCategory} from 'src/telemetry/telemetryClient' import CheckIcon from 'src/widgets/icons/check' import NotificationBox from 'src/widgets/notificationBox/notificationBox' @@ -103,10 +103,12 @@ const CardLimitNotification = (props: Props) => { useEffect(() => { if (!show) { const interval = setInterval(() => setTime(Date.now()), checkSnoozeInterval) + return () => { clearInterval(interval) } } + return () => null }, [show]) diff --git a/webapp/boards/src/components/centerPanel.test.tsx b/webapp/boards/src/components/centerPanel.test.tsx index 75fed7eee8..f16640357f 100644 --- a/webapp/boards/src/components/centerPanel.test.tsx +++ b/webapp/boards/src/components/centerPanel.test.tsx @@ -5,7 +5,7 @@ import { fireEvent, render, screen, - within + within, } from '@testing-library/react' import userEvent from '@testing-library/user-event' import React from 'react' @@ -375,7 +375,7 @@ describe('components/centerPanel', () => { )) const cardElement = screen.getByRole('textbox', {name: 'card1'}) expect(cardElement).not.toBeNull() - fireEvent.click(cardElement, {shiftKey: true}) + fireEvent.click(cardElement, {shiftKey: true}) expect(container).toMatchSnapshot() //delete diff --git a/webapp/boards/src/components/centerPanel.tsx b/webapp/boards/src/components/centerPanel.tsx index 96bbdd4e11..ff422041d5 100644 --- a/webapp/boards/src/components/centerPanel.tsx +++ b/webapp/boards/src/components/centerPanel.tsx @@ -1,11 +1,11 @@ // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. -/* eslint-disable max-lines */ + import React, { - useState, useCallback, useEffect, - useMemo + useMemo, + useState, } from 'react' import {useIntl} from 'react-intl' import {useHotkeys} from 'react-hotkeys-hook' @@ -15,32 +15,32 @@ import {ClientConfig} from 'src/config/clientConfig' import {Block} from 'src/blocks/block' import {BlockIcons} from 'src/blockIcons' import {Card, createCard} from 'src/blocks/card' -import {Board, IPropertyTemplate, BoardGroup} from 'src/blocks/board' +import {Board, BoardGroup, IPropertyTemplate} from 'src/blocks/board' import {BoardView} from 'src/blocks/boardView' import {CardFilter} from 'src/cardFilter' import mutator from 'src/mutator' import {Utils} from 'src/utils' import {UserSettings} from 'src/userSettings' import { - getCurrentCard, addCard as addCardAction, addTemplate as addTemplateAction, - showCardHiddenWarning + getCurrentCard, + showCardHiddenWarning, } from 'src/store/cards' import {getCardLimitTimestamp} from 'src/store/limits' import {updateView} from 'src/store/views' import {getVisibleAndHiddenGroups} from 'src/boardUtils' -import TelemetryClient, {TelemetryCategory, TelemetryActions} from 'src/telemetry/telemetryClient' +import TelemetryClient, {TelemetryActions, TelemetryCategory} from 'src/telemetry/telemetryClient' import {getClientConfig} from 'src/store/clientConfig' import './centerPanel.scss' -import {useAppSelector, useAppDispatch} from 'src/store/hooks' +import {useAppDispatch, useAppSelector} from 'src/store/hooks' import { - getMe, getBoardUsers, + getMe, getOnboardingTourCategory, getOnboardingTourStarted, getOnboardingTourStep, @@ -72,7 +72,7 @@ import { BoardTourSteps, FINISHED, TOUR_BOARD, - TOUR_CARD + TOUR_CARD, } from './onboardingTour' import ShareBoardTourStep from './onboardingTour/shareBoard/shareBoard' @@ -393,6 +393,7 @@ const CenterPanel = (props: Props) => { defaultMessage: 'No {propertyName}', }, {propertyName: groupByProperty?.name}) } + return intl.formatMessage({id: 'centerPanel.unknown-user', defaultMessage: 'Unknown user'}) } @@ -408,6 +409,7 @@ const CenterPanel = (props: Props) => { }) } } + return {visible: vg, hidden: hg} }, [cards, activeView.fields.visibleOptionIds, activeView.fields.hiddenOptionIds, groupByProperty, boardUsers]) diff --git a/webapp/boards/src/components/confirmAddUserForNotifications.tsx b/webapp/boards/src/components/confirmAddUserForNotifications.tsx index be4c1bbc14..04347a605c 100644 --- a/webapp/boards/src/components/confirmAddUserForNotifications.tsx +++ b/webapp/boards/src/components/confirmAddUserForNotifications.tsx @@ -1,9 +1,9 @@ // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. -import React, {useState, useRef} from 'react' +import React, {useRef, useState} from 'react' import Select from 'react-select' -import {useIntl, FormattedMessage} from 'react-intl' +import {FormattedMessage, useIntl} from 'react-intl' import {MemberRole} from 'src/blocks/board' diff --git a/webapp/boards/src/components/content/archivedFile/archivedFile.tsx b/webapp/boards/src/components/content/archivedFile/archivedFile.tsx index e87e8d917b..5a4c8c5d47 100644 --- a/webapp/boards/src/components/content/archivedFile/archivedFile.tsx +++ b/webapp/boards/src/components/content/archivedFile/archivedFile.tsx @@ -18,6 +18,7 @@ const ArchivedFile = (props: Props): JSX.Element => { const fileExtension = useCallback(() => { let extension = props.fileInfo.extension extension = extension?.startsWith('.') ? extension?.substring(1) : extension + return extension?.toUpperCase() }, [props.fileInfo.extension]) diff --git a/webapp/boards/src/components/content/attachmentElement.test.tsx b/webapp/boards/src/components/content/attachmentElement.test.tsx index 80a8ac6d77..1892368e62 100644 --- a/webapp/boards/src/components/content/attachmentElement.test.tsx +++ b/webapp/boards/src/components/content/attachmentElement.test.tsx @@ -39,7 +39,7 @@ describe('component/content/FileBlock', () => { type: 'attachment', title: 'test-title', fields: { - attachmentId: 'test.txt', + fileId: 'test.txt', }, createdBy: 'test-user-id', createAt: 0, diff --git a/webapp/boards/src/components/content/attachmentElement.tsx b/webapp/boards/src/components/content/attachmentElement.tsx index 1d18bf442b..1b7d36d722 100644 --- a/webapp/boards/src/components/content/attachmentElement.tsx +++ b/webapp/boards/src/components/content/attachmentElement.tsx @@ -48,9 +48,10 @@ const AttachmentElement = (props: Props): JSX.Element|null => { name: block.title, extension: block.title.split('.').slice(0, -1).join('.'), }) + return } - const attachmentInfo = await octoClient.getFileInfo(block.boardId, block.fields.attachmentId) + const attachmentInfo = await octoClient.getFileInfo(block.boardId, block.fields.fileId) setFileInfo(attachmentInfo) } loadFile() @@ -65,8 +66,10 @@ const AttachmentElement = (props: Props): JSX.Element|null => { if (fName.length > 18) { let result = fName.slice(0, 15) result += '...' + return result } + return fName } setFileName(generateFileName(fileInfo.name)) @@ -113,7 +116,7 @@ const AttachmentElement = (props: Props): JSX.Element|null => { } const attachmentDownloadHandler = async () => { - const attachment = await octoClient.getFileAsDataUrl(block.boardId, block.fields.attachmentId) + const attachment = await octoClient.getFileAsDataUrl(block.boardId, block.fields.fileId) const anchor = document.createElement('a') anchor.href = attachment.url || '' anchor.download = fileInfo.name || '' diff --git a/webapp/boards/src/components/content/checkboxElement.test.tsx b/webapp/boards/src/components/content/checkboxElement.test.tsx index ba1c1cda00..500e94934a 100644 --- a/webapp/boards/src/components/content/checkboxElement.test.tsx +++ b/webapp/boards/src/components/content/checkboxElement.test.tsx @@ -6,7 +6,7 @@ import { fireEvent, render, screen, - waitFor + waitFor, } from '@testing-library/react' import {mocked} from 'jest-mock' import userEvent from '@testing-library/user-event' @@ -174,7 +174,7 @@ describe('components/content/checkboxElement', () => { )) const input = screen.getByRole('textbox') - // should delete if title is empty + // should delete if title is empty await userEvent.type(input, '{Escape}') expect(deleteElement).toHaveBeenCalledTimes(1) await userEvent.type(input, '{Enter}') diff --git a/webapp/boards/src/components/content/checkboxElement.tsx b/webapp/boards/src/components/content/checkboxElement.tsx index caf37d7b98..c284d3d7c2 100644 --- a/webapp/boards/src/components/content/checkboxElement.tsx +++ b/webapp/boards/src/components/content/checkboxElement.tsx @@ -68,6 +68,7 @@ const CheckboxElement = (props: Props) => { const {lastAddedBlock} = cardDetail if (title === '' && block.id === lastAddedBlock.id && lastAddedBlock.autoAdded && props.onDeleteElement) { props.onDeleteElement() + return } @@ -77,6 +78,7 @@ const CheckboxElement = (props: Props) => { // Wait for the change to happen setTimeout(props.onAddElement, 100) } + return } diff --git a/webapp/boards/src/components/content/contentElement.test.tsx b/webapp/boards/src/components/content/contentElement.test.tsx index 18cc909ac5..62897cdd54 100644 --- a/webapp/boards/src/components/content/contentElement.test.tsx +++ b/webapp/boards/src/components/content/contentElement.test.tsx @@ -2,7 +2,6 @@ // See LICENSE.txt for license information. import React, {ReactElement, ReactNode} from 'react' - import {render} from '@testing-library/react' import {wrapIntl} from 'src/testUtils' @@ -53,7 +52,7 @@ describe('components/content/contentElement', () => { }) it('should return null for unknown type', () => { - jest.spyOn(console, 'error').mockImplementation() + jest.spyOn(console, 'error').mockImplementation() const block: ContentBlock = {...contentBlock, type: 'unknown'} const {container} = render(wrap( diff --git a/webapp/boards/src/components/content/contentElement.tsx b/webapp/boards/src/components/content/contentElement.tsx index 0d58c0e111..475fb81612 100644 --- a/webapp/boards/src/components/content/contentElement.tsx +++ b/webapp/boards/src/components/content/contentElement.tsx @@ -30,6 +30,7 @@ export default function ContentElement(props: Props): JSX.Element|null { const handler = contentRegistry.getHandler(block.type) if (!handler) { Utils.logError(`ContentElement, unknown content type: ${block.type}`) + return null } diff --git a/webapp/boards/src/components/content/contentRegistry.tsx b/webapp/boards/src/components/content/contentRegistry.tsx index d0836bcc54..84b38b5582 100644 --- a/webapp/boards/src/components/content/contentRegistry.tsx +++ b/webapp/boards/src/components/content/contentRegistry.tsx @@ -1,6 +1,6 @@ // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. -/* eslint-disable react/require-optimization */ + import {IntlShape} from 'react-intl' import {BlockTypes} from 'src/blocks/block' @@ -25,6 +25,7 @@ class ContentRegistry { registerContentType(entry: ContentHandler) { if (this.isContentType(entry.type)) { Utils.logError(`registerContentType, already registered type: ${entry.type}`) + return } this.registry.set(entry.type, entry) diff --git a/webapp/boards/src/components/content/textElement.test.tsx b/webapp/boards/src/components/content/textElement.test.tsx index 2cac748982..b9979050a0 100644 --- a/webapp/boards/src/components/content/textElement.test.tsx +++ b/webapp/boards/src/components/content/textElement.test.tsx @@ -2,15 +2,14 @@ // See LICENSE.txt for license information. import React from 'react' -import {render, act} from '@testing-library/react' +import {act, render} from '@testing-library/react' import {Provider as ReduxProvider} from 'react-redux' - import {mocked} from 'jest-mock' import {TextBlock} from 'src/blocks/textBlock' -import {mockDOM, wrapDNDIntl, mockStateStore} from 'src/testUtils' +import {mockDOM, mockStateStore, wrapDNDIntl} from 'src/testUtils' import {Utils} from 'src/utils' diff --git a/webapp/boards/src/components/contentBlock.test.tsx b/webapp/boards/src/components/contentBlock.test.tsx index 0991f3ae47..e6b97f357e 100644 --- a/webapp/boards/src/components/contentBlock.test.tsx +++ b/webapp/boards/src/components/contentBlock.test.tsx @@ -3,7 +3,7 @@ import {act, render, screen} from '@testing-library/react' -import React, {ReactNode, ReactElement} from 'react' +import React, {ReactElement, ReactNode} from 'react' import {mocked} from 'jest-mock' import {Provider as ReduxProvider} from 'react-redux' @@ -11,7 +11,7 @@ import userEvent from '@testing-library/user-event' import {Utils} from 'src/utils' import {TestBlockFactory} from 'src/test/testBlockFactory' -import {mockDOM, wrapDNDIntl, mockStateStore} from 'src/testUtils' +import {mockDOM, mockStateStore, wrapDNDIntl} from 'src/testUtils' import mutator from 'src/mutator' diff --git a/webapp/boards/src/components/createBoardFromTemplate.test.tsx b/webapp/boards/src/components/createBoardFromTemplate.test.tsx index cd83ce56b4..3655ed623a 100644 --- a/webapp/boards/src/components/createBoardFromTemplate.test.tsx +++ b/webapp/boards/src/components/createBoardFromTemplate.test.tsx @@ -6,13 +6,12 @@ import {act, render, screen} from '@testing-library/react' import userEvent from '@testing-library/user-event' -import {mockStateStore} from 'src/testUtils' -import {wrapIntl} from 'src/testUtils' +import {mockStateStore, wrapIntl} from 'src/testUtils' import CreateBoardFromTemplate from './createBoardFromTemplate' jest.mock('src/hooks/useGetAllTemplates', () => ({ - useGetAllTemplates: () => [{id: 'id', title: 'title', description: 'description', icon: '🍔'}] + useGetAllTemplates: () => [{id: 'id', title: 'title', description: 'description', icon: '🍔'}], })) describe('components/createBoardFromTemplate', () => { @@ -26,7 +25,7 @@ describe('components/createBoardFromTemplate', () => { const store = mockStateStore([], state) const setCanCreate = jest.fn const setAction = jest.fn - const newBoardInfoIcon = () + const newBoardInfoIcon = () const {container} = render(wrapIntl( @@ -41,11 +40,11 @@ describe('components/createBoardFromTemplate', () => { expect(container).toMatchSnapshot() }) - it('clicking checkbox toggles the templates selector', async () => { + it.only('clicking checkbox toggles the templates selector', async () => { const store = mockStateStore([], state) const setCanCreate = jest.fn const setAction = jest.fn - const newBoardInfoIcon = () + const newBoardInfoIcon = () render(wrapIntl( diff --git a/webapp/boards/src/components/createBoardFromTemplate.tsx b/webapp/boards/src/components/createBoardFromTemplate.tsx index b0ec3181c9..aa5da3fc55 100644 --- a/webapp/boards/src/components/createBoardFromTemplate.tsx +++ b/webapp/boards/src/components/createBoardFromTemplate.tsx @@ -4,19 +4,19 @@ import React, { useCallback, useEffect, useRef, - useState + useState, } from 'react' -import {createIntl, createIntlCache, IntlProvider} from 'react-intl' +import {IntlProvider, createIntl, createIntlCache} from 'react-intl' import Select from 'react-select/async' import { - components, FormatOptionLabelMeta, GroupBase, - PlaceholderProps + PlaceholderProps, + SingleValue, + components, } from 'react-select' -import {SingleValue} from 'react-select' import {CSSObject} from '@emotion/serialize' @@ -49,7 +49,7 @@ const TEMPLATE_DESCRIPTION_LENGTH = 70 const cache = createIntlCache() const intl = createIntl({ locale: getCurrentLanguage(), - messages: getMessages(getCurrentLanguage()) + messages: getMessages(getCurrentLanguage()), }, cache) const {ValueContainer, Placeholder} = components @@ -60,7 +60,7 @@ const CustomValueContainer = ({children, ...props}: any) => { {props.selectProps.placeholder} {React.Children.map(children, (child) => - child && child.type !== Placeholder ? child : null + (child && child.type !== Placeholder ? child : null) )} ) @@ -78,7 +78,6 @@ const CreateBoardFromTemplate = (props: Props) => { const templateIdRef = useRef('') templateIdRef.current = selectedBoardTemplateId - const showNewBoardTemplateSelector = async () => { setAddBoard((prev: boolean) => !prev) } @@ -86,14 +85,14 @@ const CreateBoardFromTemplate = (props: Props) => { // CreateBoardFromTemplate const addBoardToChannel = async (channelId: string, teamId: string) => { if (!addBoardRef.current || !templateIdRef.current) { - return + return undefined } const ACTION_DESCRIPTION = 'board created from channel' const LINKED_CHANNEL = 'linked channel' const asTemplate = false - let boardsAndBlocks = undefined + let boardsAndBlocks if (templateIdRef.current === EMPTY_BOARD) { boardsAndBlocks = await mutator.addEmptyBoard(teamId, intl) @@ -102,7 +101,8 @@ const CreateBoardFromTemplate = (props: Props) => { } const board = boardsAndBlocks.boards[0] - await mutator.updateBoard({...board, channelId: channelId}, board, LINKED_CHANNEL) + await mutator.updateBoard({...board, channelId}, board, LINKED_CHANNEL) + return board } @@ -127,6 +127,7 @@ const CreateBoardFromTemplate = (props: Props) => { if (wordBreakingIndex === -1) { return str } + return `${str.substring(0, (len + wordBreakingIndex))}…` } @@ -143,6 +144,7 @@ const CreateBoardFromTemplate = (props: Props) => { // do not show the description for the selected option so the input only show the icon and title of the template const selectedOption = id === optionLabel.selectValue[0]?.id + return (
    @@ -176,8 +178,9 @@ const CreateBoardFromTemplate = (props: Props) => { templates.push(emptyBoard) if (value !== '') { - templates = templates.filter(template => template.title.toLowerCase().includes(value.toLowerCase())) + templates = templates.filter((template) => template.title.toLowerCase().includes(value.toLowerCase())) } + return templates }, [allTemplates]) @@ -202,10 +205,11 @@ const CreateBoardFromTemplate = (props: Props) => { }), valueContainer: (baseStyles: CSSObject): CSSObject => ({ ...baseStyles, - overflow: 'visible' + overflow: 'visible', }), placeholder: (baseStyles: CSSObject, state: PlaceholderProps>): CSSObject => { const modifyPlaceholder = state.selectProps.menuIsOpen || (!state.selectProps.menuIsOpen && state.hasValue) + return { ...baseStyles, position: 'absolute', @@ -257,12 +261,13 @@ const CreateBoardFromTemplate = (props: Props) => { const IntlCreateBoardFromTemplate = (props: Props) => { const language = useAppSelector(getLanguage) + return ( - + ) } diff --git a/webapp/boards/src/components/createCategory/createCategory.tsx b/webapp/boards/src/components/createCategory/createCategory.tsx index 61ec3dc714..ddfc935501 100644 --- a/webapp/boards/src/components/createCategory/createCategory.tsx +++ b/webapp/boards/src/components/createCategory/createCategory.tsx @@ -1,7 +1,7 @@ // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. -import React, {useState, KeyboardEvent} from 'react' +import React, {KeyboardEvent, useState} from 'react' import {useIntl} from 'react-intl' @@ -49,6 +49,7 @@ const CreateCategory = (props: Props): JSX.Element => { const onCreate = async (categoryName: string) => { if (!me) { Utils.logError('me not initialized') + return } diff --git a/webapp/boards/src/components/error_boundary.tsx b/webapp/boards/src/components/error_boundary.tsx index 5b9ba178aa..2a9c759e9d 100644 --- a/webapp/boards/src/components/error_boundary.tsx +++ b/webapp/boards/src/components/error_boundary.tsx @@ -38,8 +38,10 @@ export default class ErrorBoundary extends React.Component { render(): React.ReactNode { if (this.state.hasError) { this.handleError() + return {this.msg} } + return this.props.children } } diff --git a/webapp/boards/src/components/flashMessages.test.tsx b/webapp/boards/src/components/flashMessages.test.tsx index ca3508451c..7ecc9f0141 100644 --- a/webapp/boards/src/components/flashMessages.test.tsx +++ b/webapp/boards/src/components/flashMessages.test.tsx @@ -4,17 +4,12 @@ import React from 'react' import { - render, act, + fireEvent, + render, screen, - fireEvent } from '@testing-library/react' - - - - - import {wrapIntl} from 'src/testUtils' import FlashMessages, {sendFlashMessage} from './flashMessages' diff --git a/webapp/boards/src/components/flashMessages.tsx b/webapp/boards/src/components/flashMessages.tsx index 7efe7fd2ee..d7c6d635de 100644 --- a/webapp/boards/src/components/flashMessages.tsx +++ b/webapp/boards/src/components/flashMessages.tsx @@ -1,6 +1,6 @@ // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. -import React, {useState, useEffect} from 'react' +import React, {useEffect, useState} from 'react' import {createNanoEvents} from 'nanoevents' import './flashMessages.scss' @@ -37,6 +37,7 @@ const FlashMessages = (props: Props) => { setMessage(newMessage) } }) + return () => { isSubscribed = false } diff --git a/webapp/boards/src/components/gallery/gallery.test.tsx b/webapp/boards/src/components/gallery/gallery.test.tsx index 98b40fc126..dbea5d77b6 100644 --- a/webapp/boards/src/components/gallery/gallery.test.tsx +++ b/webapp/boards/src/components/gallery/gallery.test.tsx @@ -2,7 +2,7 @@ // See LICENSE.txt for license information. import React from 'react' -import {render, screen, fireEvent} from '@testing-library/react' +import {fireEvent, render, screen} from '@testing-library/react' import {Provider as ReduxProvider} from 'react-redux' @@ -10,7 +10,7 @@ import userEvent from '@testing-library/user-event' import {mocked} from 'jest-mock' -import {wrapDNDIntl, mockStateStore, blocksById} from 'src/testUtils' +import {blocksById, mockStateStore, wrapDNDIntl} from 'src/testUtils' import {TestBlockFactory} from 'src/test/testBlockFactory' diff --git a/webapp/boards/src/components/gallery/gallery.tsx b/webapp/boards/src/components/gallery/gallery.tsx index b3656d23c6..3f08f9f7f6 100644 --- a/webapp/boards/src/components/gallery/gallery.tsx +++ b/webapp/boards/src/components/gallery/gallery.tsx @@ -1,6 +1,6 @@ // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. -import React, {useMemo, useCallback} from 'react' +import React, {useCallback, useMemo} from 'react' import {FormattedMessage} from 'react-intl' import {Constants, Permission} from 'src/constants' diff --git a/webapp/boards/src/components/gallery/galleryCard.test.tsx b/webapp/boards/src/components/gallery/galleryCard.test.tsx index 125cc84346..dbfed5e084 100644 --- a/webapp/boards/src/components/gallery/galleryCard.test.tsx +++ b/webapp/boards/src/components/gallery/galleryCard.test.tsx @@ -12,7 +12,7 @@ import {mocked} from 'jest-mock' import {MockStoreEnhanced} from 'redux-mock-store' -import {wrapDNDIntl, mockStateStore} from 'src/testUtils' +import {mockStateStore, wrapDNDIntl} from 'src/testUtils' import {TestBlockFactory} from 'src/test/testBlockFactory' diff --git a/webapp/boards/src/components/gallery/galleryCard.tsx b/webapp/boards/src/components/gallery/galleryCard.tsx index 47fe71b79b..8e9fe732e0 100644 --- a/webapp/boards/src/components/gallery/galleryCard.tsx +++ b/webapp/boards/src/components/gallery/galleryCard.tsx @@ -1,7 +1,7 @@ // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. -import React, {useMemo, useState, useCallback} from 'react' -import {useIntl, FormattedMessage} from 'react-intl' +import React, {useCallback, useMemo, useState} from 'react' +import {FormattedMessage, useIntl} from 'react-intl' import {Board, IPropertyTemplate} from 'src/blocks/board' import {Card} from 'src/blocks/card' @@ -68,6 +68,7 @@ const GalleryCard = (props: Props) => { return contents[i] as ContentBlock } } + return undefined }, [contents]) diff --git a/webapp/boards/src/components/globalHeader/globalHeaderSettingsMenu.test.tsx b/webapp/boards/src/components/globalHeader/globalHeaderSettingsMenu.test.tsx index 555b2de592..91b9068d5b 100644 --- a/webapp/boards/src/components/globalHeader/globalHeaderSettingsMenu.test.tsx +++ b/webapp/boards/src/components/globalHeader/globalHeaderSettingsMenu.test.tsx @@ -14,7 +14,7 @@ import {mocked} from 'jest-mock' import {wrapIntl} from 'src/testUtils' -import TelemetryClient, {TelemetryCategory, TelemetryActions} from 'src/telemetry/telemetryClient' +import TelemetryClient, {TelemetryActions, TelemetryCategory} from 'src/telemetry/telemetryClient' import client from 'src/octoClient' diff --git a/webapp/boards/src/components/globalHeader/globalHeaderSettingsMenu.tsx b/webapp/boards/src/components/globalHeader/globalHeaderSettingsMenu.tsx index bc0c7c3b4b..acfdaeeba2 100644 --- a/webapp/boards/src/components/globalHeader/globalHeaderSettingsMenu.tsx +++ b/webapp/boards/src/components/globalHeader/globalHeaderSettingsMenu.tsx @@ -9,8 +9,8 @@ import Menu from 'src/widgets/menu' import MenuWrapper from 'src/widgets/menuWrapper' import {useAppDispatch, useAppSelector} from 'src/store/hooks' import {storeLanguage} from 'src/store/language' -import {patchProps, getMe} from 'src/store/users' -import {getCurrentTeam, Team} from 'src/store/teams' +import {getMe, patchProps} from 'src/store/users' +import {Team, getCurrentTeam} from 'src/store/teams' import {IUser, UserConfigPatch} from 'src/user' import octoClient from 'src/octoClient' import {UserSettings} from 'src/userSettings' @@ -18,7 +18,7 @@ import CheckIcon from 'src/widgets/icons/check' import SettingsIcon from 'src/widgets/icons/settings' import {Constants} from 'src/constants' -import TelemetryClient, {TelemetryCategory, TelemetryActions} from 'src/telemetry/telemetryClient' +import TelemetryClient, {TelemetryActions, TelemetryCategory} from 'src/telemetry/telemetryClient' import './globalHeaderSettingsMenu.scss' diff --git a/webapp/boards/src/components/hiddenCardCount/hiddenCardCount.tsx b/webapp/boards/src/components/hiddenCardCount/hiddenCardCount.tsx index ace0cb7284..cd6339cfee 100644 --- a/webapp/boards/src/components/hiddenCardCount/hiddenCardCount.tsx +++ b/webapp/boards/src/components/hiddenCardCount/hiddenCardCount.tsx @@ -19,6 +19,7 @@ const HiddenCardCount = (props: Props): JSX.Element => { const onClickHandler = () => { props.showHiddenCardNotification(true) } + return (
    { return } - (optionsByType.get(property.type) || []). - forEach((typeOption) => { + (optionsByType.get(property.type) || []) + .forEach((typeOption) => { options.push({ ...typeOption, cardProperties: props.cardProperties, diff --git a/webapp/boards/src/components/kanban/calculation/kanbanOption.tsx b/webapp/boards/src/components/kanban/calculation/kanbanOption.tsx index 65dfd22942..b0fee41b83 100644 --- a/webapp/boards/src/components/kanban/calculation/kanbanOption.tsx +++ b/webapp/boards/src/components/kanban/calculation/kanbanOption.tsx @@ -34,12 +34,12 @@ const Option = (props: {data: OptionProps}): JSX.Element => { if (!calculationToProperties.get(props.data.value)) { const supportedPropertyTypes = new Map([]) if (typesByOptions.get(props.data.value)) { - (typesByOptions.get(props.data.value) || []). - forEach((propertyType) => supportedPropertyTypes.set(propertyType, true)) + (typesByOptions.get(props.data.value) || []) + .forEach((propertyType) => supportedPropertyTypes.set(propertyType, true)) } - const supportedProperties = props.data.cardProperties. - filter((property) => supportedPropertyTypes.get(property.type) || supportedPropertyTypes.get('common')) + const supportedProperties = props.data.cardProperties + .filter((property) => supportedPropertyTypes.get(property.type) || supportedPropertyTypes.get('common')) calculationToProperties.set(props.data.value, supportedProperties) setCalculationToProperties(calculationToProperties) diff --git a/webapp/boards/src/components/kanban/kanban.test.tsx b/webapp/boards/src/components/kanban/kanban.test.tsx index 0d83135d33..02372ef223 100644 --- a/webapp/boards/src/components/kanban/kanban.test.tsx +++ b/webapp/boards/src/components/kanban/kanban.test.tsx @@ -5,7 +5,7 @@ import { fireEvent, render, screen, - waitFor + waitFor, } from '@testing-library/react' import React from 'react' import {Provider as ReduxProvider} from 'react-redux' @@ -447,7 +447,7 @@ describe('src/component/kanban/kanban', () => { }) // TODO: fix this test: Mutator spyOn issue - // eslint-disable-next-line no-only-tests/no-only-tests + test.skip('return kanban and change title on KanbanColumnHeader', async () => { const user = userEvent.setup() const {container} = render(wrapDNDIntl( @@ -498,7 +498,7 @@ describe('src/component/kanban/kanban', () => { }) // TODO: fix this test: Mutator spyOn issue - // eslint-disable-next-line no-only-tests/no-only-tests + test.skip('return kanban and add a group', async () => { render(wrapDNDIntl( diff --git a/webapp/boards/src/components/kanban/kanban.tsx b/webapp/boards/src/components/kanban/kanban.tsx index a1e15c9334..17ea9ff6e1 100644 --- a/webapp/boards/src/components/kanban/kanban.tsx +++ b/webapp/boards/src/components/kanban/kanban.tsx @@ -1,11 +1,11 @@ // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. -/* eslint-disable max-lines */ + import React, { useCallback, - useState, + useEffect, useMemo, - useEffect + useState, } from 'react' import {FormattedMessage} from 'react-intl' @@ -17,14 +17,14 @@ import {Position} from 'src/components/cardDetail/cardDetailContents' import { Board, + BoardGroup, IPropertyOption, IPropertyTemplate, - BoardGroup } from 'src/blocks/board' import {Card} from 'src/blocks/card' import {BoardView} from 'src/blocks/boardView' import mutator from 'src/mutator' -import {Utils, IDType} from 'src/utils' +import {IDType, Utils} from 'src/utils' import Button from 'src/widgets/buttons/button' import {Constants, Permission} from 'src/constants' @@ -114,6 +114,7 @@ const Kanban = (props: Props) => { cardOrder = cardOrder.filter((id) => !setOfIds.has(id)) const lastCardIndex = cardOrder.indexOf(lastCardId) cardOrder.splice(lastCardIndex + 1, 0, ...cardIds) + return cardOrder }, [activeView, visibleGroups]) @@ -130,6 +131,7 @@ const Kanban = (props: Props) => { await mutator.performAsUndoGroup(async () => { const cardsById: { [key: string]: Card } = cards.reduce((acc: { [key: string]: Card }, c: Card): { [key: string]: Card } => { acc[c.id] = c + return acc }, {}) const draggedCards: Card[] = draggedCardIds.map((o: string) => cardsById[o]).filter((c) => c) @@ -186,6 +188,7 @@ const Kanban = (props: Props) => { // Update dstCard order const cardsById: { [key: string]: Card } = cards.reduce((acc: { [key: string]: Card }, card: Card): { [key: string]: Card } => { acc[card.id] = card + return acc }, {}) const draggedCards: Card[] = draggedCardIds.map((o: string) => cardsById[o]).filter((c) => c) @@ -223,6 +226,7 @@ const Kanban = (props: Props) => { if (!groupByProperty) { Utils.assertFailure('Board views must have groupByProperty set') + return
    } diff --git a/webapp/boards/src/components/kanban/kanbanCard.tsx b/webapp/boards/src/components/kanban/kanbanCard.tsx index 074174a60a..eaf55c154d 100644 --- a/webapp/boards/src/components/kanban/kanbanCard.tsx +++ b/webapp/boards/src/components/kanban/kanbanCard.tsx @@ -1,6 +1,6 @@ // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. -import React, {useState, useCallback, useMemo} from 'react' +import React, {useCallback, useMemo, useState} from 'react' import {useRouteMatch} from 'react-router-dom' import {useIntl} from 'react-intl' @@ -51,6 +51,7 @@ const KanbanCard = (props: Props) => { const handleDeleteCard = useCallback(() => { if (!card) { Utils.assertFailure() + return } TelemetryClient.trackEvent(TelemetryCategory, TelemetryActions.DeleteCard, {board: board.id, card: card.id}) @@ -74,6 +75,7 @@ const KanbanCard = (props: Props) => { // confirmation dialog if (card?.title === '' && card?.fields?.contentOrder?.length === 0) { handleDeleteCard() + return } setShowConfirmationDialogBox(true) diff --git a/webapp/boards/src/components/kanban/kanbanColumn.tsx b/webapp/boards/src/components/kanban/kanbanColumn.tsx index 116abbdcbc..0d1c5b0fa9 100644 --- a/webapp/boards/src/components/kanban/kanbanColumn.tsx +++ b/webapp/boards/src/components/kanban/kanbanColumn.tsx @@ -28,6 +28,7 @@ const KanbanColumn = (props: Props) => { if (isOver) { className += ' dragover' } + return (
    { )) expect(container).toMatchSnapshot() }) - test('return kanbanColumnHeader and edit title', async() => { + test('return kanbanColumnHeader and edit title', async () => { const mockedPropertyNameChanged = jest.fn() const {container} = render(wrapDNDIntl( diff --git a/webapp/boards/src/components/kanban/kanbanColumnHeader.tsx b/webapp/boards/src/components/kanban/kanbanColumnHeader.tsx index 5f2d6c1463..b3a90a1282 100644 --- a/webapp/boards/src/components/kanban/kanbanColumnHeader.tsx +++ b/webapp/boards/src/components/kanban/kanbanColumnHeader.tsx @@ -1,16 +1,16 @@ // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. -/* eslint-disable max-lines */ -import React, {useState, useEffect, useRef} from 'react' + +import React, {useEffect, useRef, useState} from 'react' import {FormattedMessage, useIntl} from 'react-intl' -import {useDrop, useDrag} from 'react-dnd' +import {useDrag, useDrop} from 'react-dnd' import {Constants, Permission} from 'src/constants' import { + Board, + BoardGroup, IPropertyOption, IPropertyTemplate, - Board, - BoardGroup } from 'src/blocks/board' import {BoardView} from 'src/blocks/boardView' import {Card} from 'src/blocks/card' @@ -53,7 +53,7 @@ export default function KanbanColumnHeader(props: Props): JSX.Element { const intl = useIntl() const {board, activeView, group, groupByProperty} = props let readonly = props.readonly - if(!readonly){ + if (!readonly) { readonly = !useHasCurrentBoardPermissions([Permission.ManageBoardProperties]) } @@ -95,6 +95,7 @@ export default function KanbanColumnHeader(props: Props): JSX.Element { const groupCalculation = props.activeView.fields.kanbanCalculations[props.group.option.id] const calculationValue = groupCalculation ? groupCalculation.calculation : defaultCalculation const calculationProperty = groupCalculation ? props.board.cardProperties.find((property) => property.id === groupCalculation.propertyId) || defaultProperty : defaultProperty + return (
    { const isDelimiterBlock = i === 0 || i === codeBlockKeys.length - 1 const block = newContentState.getBlockForKey(blockKey) const newBlockMap = newContentState.getBlockMap() - const data = block. - getData(). - merge({language: isDelimiterBlock ? undefined : language}) + const data = block + .getData() + .merge({language: isDelimiterBlock ? undefined : language}) const newBlock = block.merge({data}) as ContentBlock newContentState = newContentState.merge({ blockMap: newBlockMap.set(blockKey, newBlock), diff --git a/webapp/boards/src/components/live-markdown-plugin/inline-styles/boldStyleStrategy.ts b/webapp/boards/src/components/live-markdown-plugin/inline-styles/boldStyleStrategy.ts index acc74d6bec..443af56a4c 100644 --- a/webapp/boards/src/components/live-markdown-plugin/inline-styles/boldStyleStrategy.ts +++ b/webapp/boards/src/components/live-markdown-plugin/inline-styles/boldStyleStrategy.ts @@ -23,6 +23,7 @@ const createBoldStyleStrategy = (): InlineStrategy => { // e.g. [[0,6], [10,20]] const text = block.getText() const boldRanges = findRangesWithRegex(text, boldRegex) + return boldRanges }, findDelimiterRanges: (block, styleRanges) => { @@ -37,6 +38,7 @@ const createBoldStyleStrategy = (): InlineStrategy => { ).map((indices) => indices.map((x) => x + styleRange[0])) boldDelimiterRanges = boldDelimiterRanges.concat(delimiterRange) }) + return boldDelimiterRanges }, delimiterStyles: { diff --git a/webapp/boards/src/components/live-markdown-plugin/inline-styles/headingDelimiterStyleStrategy.ts b/webapp/boards/src/components/live-markdown-plugin/inline-styles/headingDelimiterStyleStrategy.ts index 2b62c06085..47e87e47fd 100644 --- a/webapp/boards/src/components/live-markdown-plugin/inline-styles/headingDelimiterStyleStrategy.ts +++ b/webapp/boards/src/components/live-markdown-plugin/inline-styles/headingDelimiterStyleStrategy.ts @@ -19,6 +19,7 @@ const createHeadingDelimiterStyleStrategy = (): InlineStrategy => { text, headingDelimiterRegex, ) + return headingDelimiterRanges }, styles: { diff --git a/webapp/boards/src/components/live-markdown-plugin/inline-styles/inlineCodeStyleStrategy.ts b/webapp/boards/src/components/live-markdown-plugin/inline-styles/inlineCodeStyleStrategy.ts index 4929176af2..eaf02f5a68 100644 --- a/webapp/boards/src/components/live-markdown-plugin/inline-styles/inlineCodeStyleStrategy.ts +++ b/webapp/boards/src/components/live-markdown-plugin/inline-styles/inlineCodeStyleStrategy.ts @@ -16,6 +16,7 @@ const createInlineCodeStyleStrategy = (): InlineStrategy => { const text = block.getText() const codeRanges = findRangesWithRegex(text, codeRegex) + return codeRanges }, styles: { diff --git a/webapp/boards/src/components/live-markdown-plugin/inline-styles/italicStyleStrategy.ts b/webapp/boards/src/components/live-markdown-plugin/inline-styles/italicStyleStrategy.ts index 849323f8ec..4da9d0016e 100644 --- a/webapp/boards/src/components/live-markdown-plugin/inline-styles/italicStyleStrategy.ts +++ b/webapp/boards/src/components/live-markdown-plugin/inline-styles/italicStyleStrategy.ts @@ -39,6 +39,7 @@ const createItalicStyleStrategy = (): InlineStrategy => { // e.g. [[0,6], [10,20]] const text = block.getText() const italicRanges = findRangesWithRegex(text, italicRegex) + return italicRanges }, findDelimiterRanges: (block, styleRanges) => { @@ -53,6 +54,7 @@ const createItalicStyleStrategy = (): InlineStrategy => { ).map((indices) => indices.map((x) => x + styleRange[0])) italicDelimiterRanges = italicDelimiterRanges.concat(delimiterRange) }) + return italicDelimiterRanges }, delimiterStyles: { diff --git a/webapp/boards/src/components/live-markdown-plugin/inline-styles/olDelimiterStyleStrategy.ts b/webapp/boards/src/components/live-markdown-plugin/inline-styles/olDelimiterStyleStrategy.ts index eb972b5110..22077cb33b 100644 --- a/webapp/boards/src/components/live-markdown-plugin/inline-styles/olDelimiterStyleStrategy.ts +++ b/webapp/boards/src/components/live-markdown-plugin/inline-styles/olDelimiterStyleStrategy.ts @@ -11,6 +11,7 @@ const createOLDelimiterStyleStrategy = (): InlineStrategy => { findStyleRanges: (block) => { const text = block.getText() const olDelimiterRanges = findRangesWithRegex(text, olDelimiterRegex) + return olDelimiterRanges }, styles: { diff --git a/webapp/boards/src/components/live-markdown-plugin/inline-styles/quoteStyleStrategy.ts b/webapp/boards/src/components/live-markdown-plugin/inline-styles/quoteStyleStrategy.ts index 8c992d05f8..3ef0159ebd 100644 --- a/webapp/boards/src/components/live-markdown-plugin/inline-styles/quoteStyleStrategy.ts +++ b/webapp/boards/src/components/live-markdown-plugin/inline-styles/quoteStyleStrategy.ts @@ -13,6 +13,7 @@ const createQuoteStyleStrategy = (): InlineStrategy => { findStyleRanges: (block) => { const text = block.getText() const quoteRanges = findRangesWithRegex(text, quoteRegex) + return quoteRanges }, findDelimiterRanges: (block, styleRanges) => { @@ -25,6 +26,7 @@ const createQuoteStyleStrategy = (): InlineStrategy => { ).map((indices) => indices.map((x) => x + styleRange[0])) quoteDelimiterRanges = quoteDelimiterRanges.concat(delimiterRange) }) + return quoteDelimiterRanges }, styles: { diff --git a/webapp/boards/src/components/live-markdown-plugin/inline-styles/strikethroughStyleStrategy.ts b/webapp/boards/src/components/live-markdown-plugin/inline-styles/strikethroughStyleStrategy.ts index 89b0eca114..c8b810e7a2 100644 --- a/webapp/boards/src/components/live-markdown-plugin/inline-styles/strikethroughStyleStrategy.ts +++ b/webapp/boards/src/components/live-markdown-plugin/inline-styles/strikethroughStyleStrategy.ts @@ -16,6 +16,7 @@ const createStrikethroughStyleStrategy = (): InlineStrategy => { // e.g. [[0,6], [10,20]] const text = block.getText() const strikethroughRanges = findRangesWithRegex(text, strikethroughRegex) + return strikethroughRanges }, findDelimiterRanges: (block, styleRanges) => { @@ -32,6 +33,7 @@ const createStrikethroughStyleStrategy = (): InlineStrategy => { delimiterRange, ) }) + return strikethroughDelimiterRanges }, styles: { diff --git a/webapp/boards/src/components/live-markdown-plugin/inline-styles/ulDelimiterStyleStrategy.ts b/webapp/boards/src/components/live-markdown-plugin/inline-styles/ulDelimiterStyleStrategy.ts index 0dfe04d638..b1a2415d3b 100644 --- a/webapp/boards/src/components/live-markdown-plugin/inline-styles/ulDelimiterStyleStrategy.ts +++ b/webapp/boards/src/components/live-markdown-plugin/inline-styles/ulDelimiterStyleStrategy.ts @@ -11,6 +11,7 @@ const createULDelimiterStyleStrategy = (): InlineStrategy => { findStyleRanges: (block) => { const text = block.getText() const ulDelimiterRanges = findRangesWithRegex(text, ulDelimiterRegex) + return ulDelimiterRanges }, styles: { diff --git a/webapp/boards/src/components/live-markdown-plugin/liveMarkdownPlugin.ts b/webapp/boards/src/components/live-markdown-plugin/liveMarkdownPlugin.ts index afcb2bd02a..aa49c1211e 100644 --- a/webapp/boards/src/components/live-markdown-plugin/liveMarkdownPlugin.ts +++ b/webapp/boards/src/components/live-markdown-plugin/liveMarkdownPlugin.ts @@ -1,15 +1,15 @@ // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. import { - EditorState, CharacterMetadata, - ContentState, ContentBlock, - EditorChangeType, + ContentState, DraftStyleMap, + EditorChangeType, + EditorState, } from 'draft-js' import {EditorPlugin} from '@draft-js-plugins/editor' -import {Repeat, List} from 'immutable' +import {List, Repeat} from 'immutable' // Inline style handlers import createBoldStyleStrategy from './inline-styles/boldStyleStrategy' @@ -64,10 +64,12 @@ function createLiveMarkdownPlugin(config: LiveMarkdownPluginConfig = {}): Editor // Construct the block style fn const blockStyleMap = blockTypeStrategies.reduce((map: Record, blockStrategy) => { map[blockStrategy.type] = blockStrategy.className + return map }, {}) const blockStyleFn = (block: ContentBlock) => { const blockType = block.getType() + return blockStyleMap[blockType] } @@ -257,6 +259,7 @@ const applyStyleRangesToCharacterMetadata = ( styledCharacterMetadataList = styledCharacterMetadataList.set(i, styled) } }) + return styledCharacterMetadataList } diff --git a/webapp/boards/src/components/markdownEditor.test.tsx b/webapp/boards/src/components/markdownEditor.test.tsx index 86c7247d61..a1b37c8f93 100644 --- a/webapp/boards/src/components/markdownEditor.test.tsx +++ b/webapp/boards/src/components/markdownEditor.test.tsx @@ -4,7 +4,7 @@ import {fireEvent, render, screen} from '@testing-library/react' import React from 'react' import {Provider as ReduxProvider} from 'react-redux' -import {mockDOM, wrapDNDIntl, mockStateStore} from 'src/testUtils' +import {mockDOM, mockStateStore, wrapDNDIntl} from 'src/testUtils' import {TestBlockFactory} from 'src/test/testBlockFactory' diff --git a/webapp/boards/src/components/markdownEditor.tsx b/webapp/boards/src/components/markdownEditor.tsx index 4910504b45..446287f524 100644 --- a/webapp/boards/src/components/markdownEditor.tsx +++ b/webapp/boards/src/components/markdownEditor.tsx @@ -1,6 +1,6 @@ // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. -import React, {useState, Suspense} from 'react' +import React, {Suspense, useState} from 'react' import {Utils} from 'src/utils' import './markdownEditor.scss' @@ -38,6 +38,7 @@ const MarkdownEditor = (props: Props): JSX.Element => { const element = e.target as Element if (element.tagName.toLowerCase() === LINK_TAG_NAME) { e.stopPropagation() + return } @@ -50,7 +51,7 @@ const MarkdownEditor = (props: Props): JSX.Element => { const editorOnBlur = (newText: string) => { setIsEditing(false) - onBlur && onBlur(newText) + onBlur?.(newText) } const editorElement = ( diff --git a/webapp/boards/src/components/markdownEditorInput/markdownEditorInput.tsx b/webapp/boards/src/components/markdownEditorInput/markdownEditorInput.tsx index 551861ac23..8900d4e39e 100644 --- a/webapp/boards/src/components/markdownEditorInput/markdownEditorInput.tsx +++ b/webapp/boards/src/components/markdownEditorInput/markdownEditorInput.tsx @@ -9,7 +9,7 @@ import { ContentState, DraftHandleValue, EditorState, - getDefaultKeyBinding + getDefaultKeyBinding, } from 'draft-js' import React, { ReactElement, @@ -17,7 +17,7 @@ import React, { useEffect, useMemo, useRef, - useState + useState, } from 'react' import {debounce} from 'lodash' @@ -86,8 +86,8 @@ const MarkdownEditorInput = (props: Props): ReactElement => { const excludeBots = true users = await octoClient.searchTeamUsers(term, excludeBots) } else { - users = boardUsers. - filter((user) => { + users = boardUsers + .filter((user) => { // no search term if (!term) { return true @@ -95,10 +95,10 @@ const MarkdownEditorInput = (props: Props): ReactElement => { // does the search term occur anywhere in the display name? return Utils.getUserDisplayName(user, clientConfig.teammateNameDisplay).includes(term) - }). + }) // first 10 results - slice(0, 10) + .slice(0, 10) } const mentions: MentionUser[] = users.map( @@ -124,6 +124,7 @@ const MarkdownEditorInput = (props: Props): ReactElement => { const generateEditorState = (text?: string) => { const state = EditorState.createWithContent(ContentState.createFromText(text || '')) + return EditorState.moveSelectionToEnd(state) } @@ -188,6 +189,7 @@ const MarkdownEditorInput = (props: Props): ReactElement => { emojiPlugin, markdownPlugin, ] + return {plugins, MentionSuggestions, EmojiSuggestions} }, []) @@ -195,7 +197,7 @@ const MarkdownEditorInput = (props: Props): ReactElement => { // newEditorState. const newText = newEditorState.getCurrentContent().getPlainText() - onChange && onChange(newText) + onChange?.(newText) setEditorState(newEditorState) }, [onChange]) @@ -226,6 +228,7 @@ const MarkdownEditorInput = (props: Props): ReactElement => { const handleKeyCommand = useCallback((command: string, currentState: EditorState): DraftHandleValue => { if (command === 'editor-blur') { ref.current?.blur() + return 'handled' } @@ -246,6 +249,7 @@ const MarkdownEditorInput = (props: Props): ReactElement => { if (command === 'backspace') { if (props.onEditorCancel && editorState.getCurrentContent().getPlainText().length === 0) { props.onEditorCancel() + return 'handled' } } @@ -258,7 +262,7 @@ const MarkdownEditorInput = (props: Props): ReactElement => { return } const text = editorState.getCurrentContent().getPlainText() - onBlur && onBlur(text) + onBlur?.(text) }, [editorState.getCurrentContent().getPlainText(), onBlur, confirmAddUser]) const onMentionPopoverOpenChange = useCallback((open: boolean) => { @@ -282,9 +286,11 @@ const MarkdownEditorInput = (props: Props): ReactElement => { const handleReturn = (e: any, state: EditorState): DraftHandleValue => { if (!e.shiftKey) { const text = state.getCurrentContent().getPlainText() - onBlur && onBlur(text) + onBlur?.(text) + return 'handled' } + return 'not-handled' } diff --git a/webapp/boards/src/components/messages/versionMessage.tsx b/webapp/boards/src/components/messages/versionMessage.tsx index 7073a35c61..6ed76fd853 100644 --- a/webapp/boards/src/components/messages/versionMessage.tsx +++ b/webapp/boards/src/components/messages/versionMessage.tsx @@ -2,25 +2,25 @@ // See LICENSE.txt for license information. import React from 'react' -import {useIntl, FormattedMessage} from 'react-intl' +import {FormattedMessage, useIntl} from 'react-intl' import IconButton from 'src/widgets/buttons/iconButton' import Button from 'src/widgets/buttons/button' import CloseIcon from 'src/widgets/icons/close' -import {useAppSelector, useAppDispatch} from 'src/store/hooks' +import {useAppDispatch, useAppSelector} from 'src/store/hooks' import octoClient from 'src/octoClient' import {IUser, UserConfigPatch} from 'src/user' import { getMe, - patchProps, getVersionMessageCanceled, - versionProperty + patchProps, + versionProperty, } from 'src/store/users' import CompassIcon from 'src/widgets/icons/compassIcon' -import TelemetryClient, {TelemetryCategory, TelemetryActions} from 'src/telemetry/telemetryClient' +import TelemetryClient, {TelemetryActions, TelemetryCategory} from 'src/telemetry/telemetryClient' import './versionMessage.scss' const helpURL = 'https://mattermost.com/pl/whats-new-boards/' diff --git a/webapp/boards/src/components/modal.tsx b/webapp/boards/src/components/modal.tsx index 65826ff5bd..bd8ce7a7e8 100644 --- a/webapp/boards/src/components/modal.tsx +++ b/webapp/boards/src/components/modal.tsx @@ -1,6 +1,6 @@ // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. -import React, {useRef, useEffect, useCallback} from 'react' +import React, {useCallback, useEffect, useRef} from 'react' import IconButton from 'src/widgets/buttons/iconButton' import CloseIcon from 'src/widgets/icons/close' @@ -26,6 +26,7 @@ const Modal = (props: Props): JSX.Element => { useEffect(() => { document.addEventListener('click', closeOnBlur, true) + return () => { document.removeEventListener('click', closeOnBlur, true) } diff --git a/webapp/boards/src/components/newVersionBanner.tsx b/webapp/boards/src/components/newVersionBanner.tsx index a17b037302..b1a5cb1fad 100644 --- a/webapp/boards/src/components/newVersionBanner.tsx +++ b/webapp/boards/src/components/newVersionBanner.tsx @@ -1,6 +1,6 @@ // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. -import React, {useState, useEffect} from 'react' +import React, {useEffect, useState} from 'react' import {FormattedMessage} from 'react-intl' import wsClient from 'src/wsclient' diff --git a/webapp/boards/src/components/onboardingTour/addProperties/add_properties.tsx b/webapp/boards/src/components/onboardingTour/addProperties/add_properties.tsx index 6cdaddc960..8d14955373 100644 --- a/webapp/boards/src/components/onboardingTour/addProperties/add_properties.tsx +++ b/webapp/boards/src/components/onboardingTour/addProperties/add_properties.tsx @@ -13,7 +13,7 @@ import { BaseTourSteps, CardTourSteps, TOUR_BASE, - TOUR_CARD + TOUR_CARD, } from 'src/components/onboardingTour/index' import TourTipRenderer from 'src/components/onboardingTour/tourTipRenderer/tourTipRenderer' import {OnboardingBoardTitle, OnboardingCardTitle} from 'src/components/cardDetail/cardDetail' diff --git a/webapp/boards/src/components/onboardingTour/sidebarCategories/sidebarCategories.tsx b/webapp/boards/src/components/onboardingTour/sidebarCategories/sidebarCategories.tsx index 1bc791de8e..cc71c8f5de 100644 --- a/webapp/boards/src/components/onboardingTour/sidebarCategories/sidebarCategories.tsx +++ b/webapp/boards/src/components/onboardingTour/sidebarCategories/sidebarCategories.tsx @@ -9,10 +9,10 @@ import {FormattedMessage} from 'react-intl' import {useMeasurePunchouts} from 'src/components/tutorial_tour_tip/hooks' import TourTipRenderer from 'src/components/onboardingTour/tourTipRenderer/tourTipRenderer' import { + FINISHED, + SidebarTourSteps, TOUR_BOARD, TOUR_SIDEBAR, - SidebarTourSteps, - FINISHED } from 'src/components/onboardingTour/index' import {useAppDispatch, useAppSelector} from 'src/store/hooks' import { diff --git a/webapp/boards/src/components/permissions/boardPermissionGate.test.tsx b/webapp/boards/src/components/permissions/boardPermissionGate.test.tsx index da6344f7f9..355b868f31 100644 --- a/webapp/boards/src/components/permissions/boardPermissionGate.test.tsx +++ b/webapp/boards/src/components/permissions/boardPermissionGate.test.tsx @@ -5,11 +5,10 @@ import React from 'react' import {render} from '@testing-library/react' import {Provider as ReduxProvider} from 'react-redux' - import {TestBlockFactory} from 'src/test/testBlockFactory' import {Permission} from 'src/constants' -import {wrapIntl, mockStateStore} from 'src/testUtils' +import {mockStateStore, wrapIntl} from 'src/testUtils' import BoardPermissionGate from './boardPermissionGate' diff --git a/webapp/boards/src/components/permissions/boardPermissionGate.tsx b/webapp/boards/src/components/permissions/boardPermissionGate.tsx index f45102478d..02cce02c6b 100644 --- a/webapp/boards/src/components/permissions/boardPermissionGate.tsx +++ b/webapp/boards/src/components/permissions/boardPermissionGate.tsx @@ -33,6 +33,7 @@ const BoardPermissionGate = (props: Props): React.ReactElement|null => { if (allowed) { return (<>{props.children}) } + return null } diff --git a/webapp/boards/src/components/personSelector.test.tsx b/webapp/boards/src/components/personSelector.test.tsx index 8b925cbb91..57bd154f5e 100644 --- a/webapp/boards/src/components/personSelector.test.tsx +++ b/webapp/boards/src/components/personSelector.test.tsx @@ -8,7 +8,6 @@ import {render, waitFor} from '@testing-library/react' import configureStore from 'redux-mock-store' - import userEvent from '@testing-library/user-event' import {wrapIntl} from 'src/testUtils' @@ -95,6 +94,7 @@ describe('properties/person', () => { if (!renderResult.container) { return Promise.reject(new Error('container not found')) } + return Promise.resolve(renderResult.container) }) expect(container).toMatchSnapshot() @@ -129,6 +129,7 @@ describe('properties/person', () => { if (!renderResult.container) { return Promise.reject(new Error('container not found')) } + return Promise.resolve(renderResult.container) }) expect(container).toMatchSnapshot() @@ -156,6 +157,7 @@ describe('properties/person', () => { if (!renderResult.container) { return Promise.reject(new Error('container not found')) } + return Promise.resolve(renderResult.container) }) expect(container).toMatchSnapshot() @@ -198,6 +200,7 @@ describe('properties/person', () => { if (!renderResult.container) { return Promise.reject(new Error('container not found')) } + return Promise.resolve(renderResult.container) }) expect(container).toMatchSnapshot() @@ -234,6 +237,7 @@ describe('properties/person', () => { if (!renderResult.container) { return Promise.reject(new Error('container not found')) } + return Promise.resolve(renderResult.container) }) expect(container).toMatchSnapshot() @@ -260,6 +264,7 @@ describe('properties/person', () => { if (!renderResult.container) { return Promise.reject(new Error('container not found')) } + return Promise.resolve(renderResult.container) }) expect(container).toMatchSnapshot() @@ -303,6 +308,7 @@ describe('properties/person', () => { if (!renderResult.container) { return Promise.reject(new Error('container not found')) } + return Promise.resolve(renderResult.container) }) @@ -312,7 +318,7 @@ describe('properties/person', () => { // opening of the dropdown const userProperty = container.querySelector('.Person > div > div:nth-child(1) > div:nth-child(2) > input') expect(userProperty).not.toBeNull() - + await userEvent.click(userProperty as Element) const userList = container.querySelector('.Person-item') diff --git a/webapp/boards/src/components/personSelector.tsx b/webapp/boards/src/components/personSelector.tsx index 1c620b0cd0..eb20c919bb 100644 --- a/webapp/boards/src/components/personSelector.tsx +++ b/webapp/boards/src/components/personSelector.tsx @@ -140,6 +140,7 @@ const PersonSelector = (props: Props): JSX.Element => { u.nickname.toLowerCase().includes(value.toLowerCase()) }) } + return returnUsers } const excludeBots = true @@ -153,6 +154,7 @@ const PersonSelector = (props: Props): JSX.Element => { usersOutsideBoard.push(u) } } + return [ {label: intl.formatMessage({id: 'PersonProperty.board-members', defaultMessage: 'Board members'}), options: usersInsideBoard}, {label: intl.formatMessage({id: 'PersonProperty.non-board-members', defaultMessage: 'Not board members'}), options: usersOutsideBoard}, diff --git a/webapp/boards/src/components/propertyValueElement.test.tsx b/webapp/boards/src/components/propertyValueElement.test.tsx index b3b3d8d729..cde524f092 100644 --- a/webapp/boards/src/components/propertyValueElement.test.tsx +++ b/webapp/boards/src/components/propertyValueElement.test.tsx @@ -7,7 +7,7 @@ import userEvent from '@testing-library/user-event' import {wrapDNDIntl} from 'src/testUtils' import 'isomorphic-fetch' -import {IPropertyTemplate, IPropertyOption, Board} from 'src/blocks/board' +import {Board, IPropertyOption, IPropertyTemplate} from 'src/blocks/board' import {TestBlockFactory} from 'src/test/testBlockFactory' import {Card} from 'src/blocks/card' @@ -163,7 +163,7 @@ describe('components/propertyValueElement', () => { } const user = userEvent.setup() - + const component = wrapDNDIntl( { } const property = propsRegistry.get(propertyTemplate.type) const Editor = property.Editor + return ( { myBoardMemberships: { [board.id]: {userId: 'user_id_1', schemeAdmin: true}, }, - } + }, } board.updateAt = 1657311058157 board.title = 'Test board' @@ -37,7 +37,7 @@ describe('components/rhsChannelBoardItem', () => { const store = mockStateStore([], state) const {container} = render(wrapIntl( - + )) expect(container).toMatchSnapshot() @@ -57,7 +57,7 @@ describe('components/rhsChannelBoardItem', () => { myBoardMemberships: { [board.id]: {userId: 'user_id_1', schemeAdmin: true}, }, - } + }, } board.id = 'test_id' board.title = 'New board' @@ -66,7 +66,7 @@ describe('components/rhsChannelBoardItem', () => { const store = mockStateStore([], state) const {container} = render(wrapIntl( - + )) diff --git a/webapp/boards/src/components/rhsChannelBoardItem.tsx b/webapp/boards/src/components/rhsChannelBoardItem.tsx index cae3915d39..9b1eebc03b 100644 --- a/webapp/boards/src/components/rhsChannelBoardItem.tsx +++ b/webapp/boards/src/components/rhsChannelBoardItem.tsx @@ -1,6 +1,6 @@ // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. -import React from 'react' +import React from 'react' import {FormattedMessage, useIntl} from 'react-intl' import {SuiteWindow} from 'src/types/index' @@ -8,7 +8,7 @@ import {SuiteWindow} from 'src/types/index' import mutator from 'src/mutator' import {Utils} from 'src/utils' import {getCurrentTeam} from 'src/store/teams' -import {createBoard, Board} from 'src/blocks/board' +import {Board, createBoard} from 'src/blocks/board' import {useAppSelector} from 'src/store/hooks' import IconButton from 'src/widgets/buttons/iconButton' import OptionsIcon from 'src/widgets/icons/options' @@ -55,6 +55,7 @@ const RHSChannelBoardItem = (props: Props) => { const untitledBoardTitle = intl.formatMessage({id: 'ViewTitle.untitled-board', defaultMessage: 'Untitled board'}) const markdownHtml = Utils.htmlFromMarkdown(description) + return (
    handleBoardClicked(id)} @@ -104,7 +105,8 @@ const RHSChannelBoardItem = (props: Props) => {
    -
    diff --git a/webapp/boards/src/components/rhsChannelBoards.test.tsx b/webapp/boards/src/components/rhsChannelBoards.test.tsx index 83285c5b1a..ca57a029a5 100644 --- a/webapp/boards/src/components/rhsChannelBoards.test.tsx +++ b/webapp/boards/src/components/rhsChannelBoards.test.tsx @@ -44,7 +44,7 @@ describe('components/rhsChannelBoards', () => { users: { me: { id: 'user-id', - permissions: ['create_post'] + permissions: ['create_post'], }, }, language: { @@ -115,7 +115,7 @@ describe('components/rhsChannelBoards', () => { }) it('renders the RHS for channel boards, no add', async () => { - const localState = {...state, users: {me:{id: 'user-id'}}} + const localState = {...state, users: {me: {id: 'user-id'}}} const store = mockStateStore([thunk], localState) let container: Element | DocumentFragment | null = null await act(async () => { @@ -133,7 +133,7 @@ describe('components/rhsChannelBoards', () => { }) it('renders with empty list of boards, cannot add', async () => { - const localState = {...state, users: {me:{id: 'user-id'}}, boards: {...state.boards, boards: {}}} + const localState = {...state, users: {me: {id: 'user-id'}}, boards: {...state.boards, boards: {}}} const store = mockStateStore([thunk], localState) let container: Element | DocumentFragment | null = null diff --git a/webapp/boards/src/components/rhsChannelBoards.tsx b/webapp/boards/src/components/rhsChannelBoards.tsx index e83a9b1e95..e9e4389ab7 100644 --- a/webapp/boards/src/components/rhsChannelBoards.tsx +++ b/webapp/boards/src/components/rhsChannelBoards.tsx @@ -1,6 +1,6 @@ // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. -import React, {useEffect} from 'react' +import React, {useEffect} from 'react' import {FormattedMessage, IntlProvider, useIntl} from 'react-intl' import {getMessages} from 'src/i18n' @@ -11,17 +11,17 @@ import {useWebsockets} from 'src/hooks/websockets' import {Board, BoardMember} from 'src/blocks/board' import {getCurrentTeamId} from 'src/store/teams' import {IUser} from 'src/user' -import {getMe, fetchMe} from 'src/store/users' +import {fetchMe, getMe} from 'src/store/users' import {loadBoards, loadMyBoardsMemberships} from 'src/store/initialLoad' import {getCurrentChannel} from 'src/store/channels' import { + addMyBoardMemberships, getMySortedBoards, setLinkToChannel, updateBoards, updateMembersEnsuringBoardsAndUsers, - addMyBoardMemberships, } from 'src/store/boards' -import {useAppSelector, useAppDispatch} from 'src/store/hooks' +import {useAppDispatch, useAppSelector} from 'src/store/hooks' import AddIcon from 'src/widgets/icons/add' import Button from 'src/widgets/buttons/button' @@ -125,7 +125,7 @@ const RHSChannelBoards = () => { } diff --git a/webapp/boards/src/components/rhsChannelBoardsHeader.tsx b/webapp/boards/src/components/rhsChannelBoardsHeader.tsx index e705d61e99..be9f1434d4 100644 --- a/webapp/boards/src/components/rhsChannelBoardsHeader.tsx +++ b/webapp/boards/src/components/rhsChannelBoardsHeader.tsx @@ -1,6 +1,6 @@ // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. -import React from 'react' +import React from 'react' import {FormattedMessage, IntlProvider} from 'react-intl' import {getMessages} from 'src/i18n' diff --git a/webapp/boards/src/components/rootPortal.tsx b/webapp/boards/src/components/rootPortal.tsx index 5c930a8d61..48b7c837ea 100644 --- a/webapp/boards/src/components/rootPortal.tsx +++ b/webapp/boards/src/components/rootPortal.tsx @@ -1,7 +1,7 @@ // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. -import React, {useState, useLayoutEffect} from 'react' +import React, {useLayoutEffect, useState} from 'react' import ReactDOM from 'react-dom' type Props = { @@ -16,6 +16,7 @@ const RootPortal = (props: Props): JSX.Element => { if (rootPortal) { rootPortal.appendChild(el) } + return () => { if (rootPortal) { rootPortal.removeChild(el) diff --git a/webapp/boards/src/components/searchDialog/searchDialog.tsx b/webapp/boards/src/components/searchDialog/searchDialog.tsx index 05cc23479a..e793ea94f4 100644 --- a/webapp/boards/src/components/searchDialog/searchDialog.tsx +++ b/webapp/boards/src/components/searchDialog/searchDialog.tsx @@ -4,7 +4,7 @@ import React, { ReactNode, useEffect, useMemo, - useState + useState, } from 'react' import './searchDialog.scss' diff --git a/webapp/boards/src/components/shareBoard/channelPermissionsRow.tsx b/webapp/boards/src/components/shareBoard/channelPermissionsRow.tsx index 450e2b05c3..03eccb64da 100644 --- a/webapp/boards/src/components/shareBoard/channelPermissionsRow.tsx +++ b/webapp/boards/src/components/shareBoard/channelPermissionsRow.tsx @@ -1,8 +1,8 @@ // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. -import React, {useState, useEffect} from 'react' -import {useIntl, FormattedMessage} from 'react-intl' +import React, {useEffect, useState} from 'react' +import {FormattedMessage, useIntl} from 'react-intl' import MenuWrapper from 'src/widgets/menuWrapper' import Menu from 'src/widgets/menu' @@ -46,6 +46,7 @@ const ChannelPermissionsRow = (props: Props): JSX.Element => { useEffect(() => { if (!board.channelId) { setLinkedChannel(null) + return } const unknownChannel = { @@ -93,6 +94,7 @@ const ChannelPermissionsRow = (props: Props): JSX.Element => { let result = Utils.getUserDisplayName(users[userIds[0]], props.teammateNameDisplay || '') result += ', ' result += Utils.getUserDisplayName(users[userIds[1]], props.teammateNameDisplay || '') + return result } diff --git a/webapp/boards/src/components/shareBoard/shareBoard.test.tsx b/webapp/boards/src/components/shareBoard/shareBoard.test.tsx index 29fb0a47d3..d14a83584e 100644 --- a/webapp/boards/src/components/shareBoard/shareBoard.test.tsx +++ b/webapp/boards/src/components/shareBoard/shareBoard.test.tsx @@ -129,7 +129,6 @@ describe('src/components/shareBoard/shareBoard', () => { let store: ReturnType beforeEach(() => { - state = { teams: { current: {id: teamId, title: 'Test Team'}, @@ -188,7 +187,6 @@ describe('src/components/shareBoard/shareBoard', () => { }, } - store = mockStateStore([thunk], state) // mockedUtils.buildURL.mockImplementation((path) => (w.baseURL || '') + path) @@ -335,7 +333,7 @@ describe('src/components/shareBoard/shareBoard', () => { const regenerateTokenElement = screen.getByRole('button', {name: 'Regenerate token'}) expect(regenerateTokenElement).toBeDefined() await act(() => userEvent.click(regenerateTokenElement)) - + expect(mockedOctoClient.setSharing).toBeCalledTimes(1) expect(container).toMatchSnapshot() }) @@ -392,8 +390,8 @@ describe('src/components/shareBoard/shareBoard', () => { enableSharedBoards={true} /> - ),{wrapper: MemoryRouter}) - + ), {wrapper: MemoryRouter}) + mockedOctoClient.getSharing.mockResolvedValue({ id: boardId, enabled: true, diff --git a/webapp/boards/src/components/shareBoard/shareBoard.tsx b/webapp/boards/src/components/shareBoard/shareBoard.tsx index c5d040f6f2..7a88734096 100644 --- a/webapp/boards/src/components/shareBoard/shareBoard.tsx +++ b/webapp/boards/src/components/shareBoard/shareBoard.tsx @@ -1,9 +1,9 @@ // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. -import React, {useState, useEffect} from 'react' +import React, {useEffect, useState} from 'react' -import {useIntl, FormattedMessage} from 'react-intl' +import {FormattedMessage, useIntl} from 'react-intl' import {generatePath, useRouteMatch} from 'react-router-dom' import Select from 'react-select/async' import {StylesConfig} from 'react-select' @@ -11,17 +11,17 @@ import {StylesConfig} from 'react-select' import {useAppSelector} from 'src/store/hooks' import {getCurrentBoard, getCurrentBoardMembers} from 'src/store/boards' import {Channel, ChannelTypeOpen, ChannelTypePrivate} from 'src/store/channels' -import {getMe, getBoardUsersList} from 'src/store/users' +import {getBoardUsersList, getMe} from 'src/store/users' import {ClientConfig} from 'src/config/clientConfig' import {getClientConfig} from 'src/store/clientConfig' -import {Utils, IDType} from 'src/utils' +import {IDType, Utils} from 'src/utils' import Tooltip from 'src/widgets/tooltip' import mutator from 'src/mutator' import {ISharing} from 'src/blocks/sharing' -import {BoardMember, createBoard, MemberRole} from 'src/blocks/board' +import {BoardMember, MemberRole, createBoard} from 'src/blocks/board' import client from 'src/octoClient' import Dialog from 'src/components/dialog' @@ -96,6 +96,7 @@ function isLastAdmin(members: BoardMember[]) { } } } + return true } @@ -135,6 +136,7 @@ export default function ShareBoardDialog(props: Props): JSX.Element { enabled: true, token: Utils.createGuid(IDType.Token), } + return newSharing } @@ -150,6 +152,7 @@ export default function ShareBoardDialog(props: Props): JSX.Element { const onLinkBoard = async (channel: Channel, confirmed?: boolean) => { if (!confirmed) { setShowLinkChannelConfirmation(channel) + return } setShowLinkChannelConfirmation(null) @@ -188,6 +191,7 @@ export default function ShareBoardDialog(props: Props): JSX.Element { const onUpdateBoardMember = (member: BoardMember, newPermission: string) => { if (member.userId === me?.id && isLastAdmin(Object.values(members))) { sendFlashMessage({content: intl.formatMessage({id: 'shareBoard.lastAdmin', defaultMessage: 'Boards must have at least one Administrator'}), severity: 'low'}) + return } @@ -239,6 +243,7 @@ export default function ShareBoardDialog(props: Props): JSX.Element { const onDeleteBoardMember = (member: BoardMember) => { if (member.userId === me?.id && isLastAdmin(Object.values(members))) { sendFlashMessage({content: intl.formatMessage({id: 'shareBoard.lastAdmin', defaultMessage: 'Boards must have at least one Administrator'}), severity: 'low'}) + return } mutator.deleteBoardMember(member) @@ -285,6 +290,7 @@ export default function ShareBoardDialog(props: Props): JSX.Element { const formatOptionLabel = (userOrChannel: IUser | Channel) => { if ((userOrChannel as IUser).username) { const user = userOrChannel as IUser + return (
    {channel.type === ChannelTypePrivate && } @@ -378,7 +385,7 @@ export default function ShareBoardDialog(props: Props): JSX.Element { defaultOptions={true} formatOptionLabel={formatOptionLabel} getOptionValue={({id}) => id} - getOptionLabel={(x) => isUser(x) ? x.username : x.display_name} + getOptionLabel={(x) => (isUser(x) ? x.username : x.display_name)} isMulti={false} placeholder={board.isTemplate ? intl.formatMessage({id: 'ShareTemplate.searchPlaceholder', defaultMessage: 'Search for people'}) : @@ -407,6 +414,7 @@ export default function ShareBoardDialog(props: Props): JSX.Element { if (members[user.id].synthetic) { return null } + return ( { if (board.type === BoardTypeOpen) { return } + return } diff --git a/webapp/boards/src/components/shareBoard/teamPermissionsRow.tsx b/webapp/boards/src/components/shareBoard/teamPermissionsRow.tsx index 1f7c1a5822..dc27f4e228 100644 --- a/webapp/boards/src/components/shareBoard/teamPermissionsRow.tsx +++ b/webapp/boards/src/components/shareBoard/teamPermissionsRow.tsx @@ -1,7 +1,7 @@ // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. -import React, {useState} from 'react' +import React, {ReactNode, useState} from 'react' import {useIntl} from 'react-intl' import MenuWrapper from 'src/widgets/menuWrapper' @@ -12,10 +12,10 @@ import CompassIcon from 'src/widgets/icons/compassIcon' import { Board, - createBoard, BoardTypeOpen, BoardTypePrivate, - MemberRole + MemberRole, + createBoard, } from 'src/blocks/board' import {useAppSelector} from 'src/store/hooks' import {getCurrentTeam} from 'src/store/teams' @@ -77,7 +77,7 @@ const TeamPermissionsRow = (): JSX.Element => { id: 'shareBoard.confirm-change-team-role.title', defaultMessage: 'Change minimum board role', }), - subText: intl.formatMessage({ + subText: intl.formatMessage({ id: 'shareBoard.confirm-change-team-role.body', defaultMessage: 'Everyone on this board with a lower permission than the "{role}" role will now be promoted to {role}. Are you sure you want to change the minimum role for the board?', }, { diff --git a/webapp/boards/src/components/sidebar/deleteBoardDialog.test.tsx b/webapp/boards/src/components/sidebar/deleteBoardDialog.test.tsx index aa2821b265..6728fae44a 100644 --- a/webapp/boards/src/components/sidebar/deleteBoardDialog.test.tsx +++ b/webapp/boards/src/components/sidebar/deleteBoardDialog.test.tsx @@ -37,6 +37,7 @@ describe('components/sidebar/DeleteBoardDialog', () => { rootPortalDiv.id = 'focalboard-root-portal' const {container} = render(, {container: document.body.appendChild(rootPortalDiv)}) + return container } diff --git a/webapp/boards/src/components/sidebar/deleteBoardDialog.tsx b/webapp/boards/src/components/sidebar/deleteBoardDialog.tsx index 5790688a0e..1b83ac8081 100644 --- a/webapp/boards/src/components/sidebar/deleteBoardDialog.tsx +++ b/webapp/boards/src/components/sidebar/deleteBoardDialog.tsx @@ -65,7 +65,9 @@ export default function DeleteBoardDialog(props: Props): JSX.Element { emphasis={'tertiary'} onClick={(e: React.MouseEvent) => { e.stopPropagation() - !isSubmitting && props.onClose() + if (!isSubmitting) { + props.onClose() + } }} > { } window.addEventListener('resize', handleResize) + return () => window.removeEventListener('resize', handleResize) }, []) @@ -143,6 +145,7 @@ const Sidebar = (props: Props) => { const boardsCategory = sidebarCategories.find((c) => c.name === 'Boards') if (!boardsCategory) { Utils.logError('Boards category not found for user') + return } @@ -155,6 +158,7 @@ const Sidebar = (props: Props) => { } websocketClient.addOnChange(onCategoryReorderHandler, 'categoryOrder') + return () => { websocketClient.removeOnChange(onCategoryReorderHandler, 'categoryOrder') } @@ -214,6 +218,7 @@ const Sidebar = (props: Props) => { const toSidebarCategory = sidebarCategories.find((category) => category.id === toCategoryID) if (!toSidebarCategory) { Utils.logError(`toCategoryID not found in list of sidebar categories. toCategoryID: ${toCategoryID}`) + return } @@ -232,11 +237,13 @@ const Sidebar = (props: Props) => { if (!toSidebarCategory) { Utils.logError(`toCategoryID not found in list of sidebar categories. toCategoryID: ${toCategoryID}`) + return } if (!fromSidebarCategory) { Utils.logError(`fromCategoryID not found in list of sidebar categories. fromCategoryID: ${fromCategoryID}`) + return } @@ -261,12 +268,14 @@ const Sidebar = (props: Props) => { if (!team || !destination) { setDraggedItemID('') setIsCategoryBeingDragged(false) + return } if (destination.droppableId === source.droppableId && destination.index === source.index) { setDraggedItemID('') setIsCategoryBeingDragged(false) + return } @@ -337,6 +346,7 @@ const Sidebar = (props: Props) => { sortedBoards.push(b) } }) + return sortedBoards } diff --git a/webapp/boards/src/components/sidebar/sidebarBoardItem.tsx b/webapp/boards/src/components/sidebar/sidebarBoardItem.tsx index b798f834e3..040571aab7 100644 --- a/webapp/boards/src/components/sidebar/sidebarBoardItem.tsx +++ b/webapp/boards/src/components/sidebar/sidebarBoardItem.tsx @@ -107,6 +107,7 @@ const SidebarBoardItem = (props: Props) => { undefined, () => { Utils.showBoard(board.id, match, history) + return Promise.resolve() }, ) @@ -193,6 +194,7 @@ const SidebarBoardItem = (props: Props) => { const boardItemRef = useRef(null) const title = board.title || intl.formatMessage({id: 'Sidebar.untitled-board', defaultMessage: '(Untitled Board)'}) + return ( { setBoardsMenuOpen((menuState) => { const newState = {...menuState} newState[board.id] = open + return newState }) }} diff --git a/webapp/boards/src/components/sidebar/sidebarCategory.test.tsx b/webapp/boards/src/components/sidebar/sidebarCategory.test.tsx index 5b97525b25..0e39923a75 100644 --- a/webapp/boards/src/components/sidebar/sidebarCategory.test.tsx +++ b/webapp/boards/src/components/sidebar/sidebarCategory.test.tsx @@ -193,7 +193,10 @@ describe('components/sidebarCategory', () => { expect(mockTemplateClose).toBeCalled() }) - test('sidebar template close other', async () => { + // TODO: Remove when fetch is mocked correctly + // https://mattermost.atlassian.net/browse/MM-52212 + + test.skip('sidebar template close other', async () => { const mockStore = configureStore([]) const store = mockStore(state) diff --git a/webapp/boards/src/components/sidebar/sidebarCategory.tsx b/webapp/boards/src/components/sidebar/sidebarCategory.tsx index dc036fc180..358d11be14 100644 --- a/webapp/boards/src/components/sidebar/sidebarCategory.tsx +++ b/webapp/boards/src/components/sidebar/sidebarCategory.tsx @@ -1,11 +1,12 @@ // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. import React, { + ReactNode, useCallback, useEffect, useMemo, useRef, - useState + useState, } from 'react' import {FormattedMessage, useIntl} from 'react-intl' import {generatePath, useHistory, useRouteMatch} from 'react-router-dom' @@ -24,6 +25,7 @@ import CompassIcon from 'src/widgets/icons/compassIcon' import OptionsIcon from 'src/widgets/icons/options' import Menu from 'src/widgets/menu' import MenuWrapper from 'src/widgets/menuWrapper' +import {UserSettings} from 'src/userSettings' import './sidebarCategory.scss' import {Category, CategoryBoardMetadata, CategoryBoards} from 'src/store/sidebar' @@ -38,10 +40,10 @@ import {getCurrentCard} from 'src/store/cards' import {Utils} from 'src/utils' import { - TOUR_SIDEBAR, + FINISHED, SidebarTourSteps, TOUR_BOARD, - FINISHED + TOUR_SIDEBAR, } from 'src/components/onboardingTour/index' import telemetryClient, {TelemetryActions, TelemetryCategory} from 'src/telemetry/telemetryClient' @@ -167,7 +169,7 @@ const SidebarCategory = (props: Props) => { id: 'SidebarCategories.CategoryMenu.DeleteModal.Title', defaultMessage: 'Delete this category?', }), - subText: intl.formatMessage( + subText: intl.formatMessage( { id: 'SidebarCategories.CategoryMenu.DeleteModal.Body', defaultMessage: 'Boards in {categoryName} will move back to the Boards categories. You\'re not removed from any boards.', @@ -201,12 +203,24 @@ const SidebarCategory = (props: Props) => { setTimeout(() => { showBoard(props.boards[nextBoardId as number].id) }, 120) + } else { + setTimeout(() => { + const newPath = generatePath('/team/:teamId', {teamId: teamID}) + history.push(newPath) + }, 120) } }, async () => { showBoard(deleteBoard.id) }, ) + if ( + UserSettings.lastBoardId && + UserSettings.lastBoardId[deleteBoard.teamId] === deleteBoard.id + ) { + UserSettings.setLastBoardID(deleteBoard.teamId, null) + UserSettings.setLastViewId(deleteBoard.id, null) + } }, [showBoard, deleteBoard, props.boards]) const updateCategory = useCallback(async (value: boolean) => { @@ -373,6 +387,7 @@ const SidebarCategory = (props: Props) => { if (!isBoardVisible(board.id)) { return null } + return ( { , ) const {container} = render(component) - expect(card1.id ) + expect(card1.id) expect(container).toMatchSnapshot() }) test('should match snapshot with CreatedBy', async () => { - jest.spyOn(console, 'error').mockImplementation() + jest.spyOn(console, 'error').mockImplementation() const board = TestBlockFactory.createBoard() const createdById = Utils.createGuid(IDType.User) @@ -536,7 +536,7 @@ describe('components/table/Table extended', () => { // TODO fix test — fix personSelector expect(console.error).toHaveBeenCalledWith( - expect.stringContaining('Each child in a list should have a unique "key" prop'), + expect.stringContaining('Each child in a list should have a unique "key" prop'), expect.stringContaining('Check the render method of `PersonSelector`'), expect.anything(), expect.anything() diff --git a/webapp/boards/src/components/table/table.tsx b/webapp/boards/src/components/table/table.tsx index 59b5631c7b..9025644ec1 100644 --- a/webapp/boards/src/components/table/table.tsx +++ b/webapp/boards/src/components/table/table.tsx @@ -5,12 +5,12 @@ import React, {useCallback} from 'react' import {FormattedMessage} from 'react-intl' import { + Board, + BoardGroup, IPropertyOption, IPropertyTemplate, - Board, - BoardGroup } from 'src/blocks/board' -import {createBoardView, BoardView} from 'src/blocks/boardView' +import {BoardView, createBoardView} from 'src/blocks/boardView' import {Card} from 'src/blocks/card' import {Constants, Permission} from 'src/constants' import mutator from 'src/mutator' @@ -121,6 +121,7 @@ const Table = (props: Props): JSX.Element => { if (activeView.fields.groupById !== undefined) { const cardsById: { [key: string]: Card } = cards.reduce((acc: { [key: string]: Card }, card: Card): { [key: string]: Card } => { acc[card.id] = card + return acc }, {}) const draggedCards: Card[] = draggedCardIds.map((o: string) => cardsById[o]) diff --git a/webapp/boards/src/components/table/tableColumnResizeContext.tsx b/webapp/boards/src/components/table/tableColumnResizeContext.tsx index a95ef6532c..aa3ce1cf5b 100644 --- a/webapp/boards/src/components/table/tableColumnResizeContext.tsx +++ b/webapp/boards/src/components/table/tableColumnResizeContext.tsx @@ -1,12 +1,12 @@ // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. import React, { - createContext, ReactElement, ReactNode, + createContext, useCallback, useContext, - useMemo + useMemo, } from 'react' import {Constants} from 'src/constants' @@ -26,6 +26,7 @@ export function useColumnResize(): ColumnResizeContextType { if (!context) { throw new Error('ColumnResizeContext is not available!') } + return context } @@ -69,8 +70,10 @@ export const ColumnResizeProvider = (props: ColumnResizeProviderProps): ReactEle const iter = columns.get(columnId)?.values() if (iter) { const {value, done} = iter.next() + return done ? value : iter.next().value } + return undefined }, width: (columnId) => { diff --git a/webapp/boards/src/components/table/tableGroup.tsx b/webapp/boards/src/components/table/tableGroup.tsx index e05a0f6608..645eece21d 100644 --- a/webapp/boards/src/components/table/tableGroup.tsx +++ b/webapp/boards/src/components/table/tableGroup.tsx @@ -1,15 +1,15 @@ // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. -/* eslint-disable max-lines */ + import React from 'react' import {useDrop} from 'react-dnd' import { Board, + BoardGroup, IPropertyOption, IPropertyTemplate, - BoardGroup } from 'src/blocks/board' import {BoardView} from 'src/blocks/boardView' import {Card} from 'src/blocks/card' diff --git a/webapp/boards/src/components/table/tableGroupHeaderRow.tsx b/webapp/boards/src/components/table/tableGroupHeaderRow.tsx index a9e29935a8..4dc9fb3e89 100644 --- a/webapp/boards/src/components/table/tableGroupHeaderRow.tsx +++ b/webapp/boards/src/components/table/tableGroupHeaderRow.tsx @@ -1,15 +1,15 @@ // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. -/* eslint-disable max-lines */ -import React, {useState, useEffect} from 'react' + +import React, {useEffect, useState} from 'react' import {FormattedMessage, useIntl} from 'react-intl' import {Constants} from 'src/constants' import { - IPropertyOption, Board, + BoardGroup, + IPropertyOption, IPropertyTemplate, - BoardGroup } from 'src/blocks/board' import {BoardView} from 'src/blocks/boardView' import {useSortable} from 'src/hooks/sortable' diff --git a/webapp/boards/src/components/table/tableHeaderMenu.tsx b/webapp/boards/src/components/table/tableHeaderMenu.tsx index 9c0866284c..84d4b24a25 100644 --- a/webapp/boards/src/components/table/tableHeaderMenu.tsx +++ b/webapp/boards/src/components/table/tableHeaderMenu.tsx @@ -22,6 +22,7 @@ type Props = { const TableHeaderMenu: FC = (props: Props): JSX.Element => { const {board, activeView, templateId, views, cards} = props const intl = useIntl() + return ( { if (sortOption) { sorted = sortOption.reversed ? 'down' : 'up' } + return ( { const Wrapper: React.FC = ({children}) => { const store = mockStore(state) + return wrapDNDIntl( { }, []) const onClick = useCallback((e: React.MouseEvent) => { - props.onClick && props.onClick(e, card) + props.onClick?.(e, card) }, [card, props.onClick]) const onSaveWithEnter = useCallback(() => { @@ -123,6 +123,7 @@ const TableRow = (props: Props) => { const handleDeleteCard = useCallback(async () => { if (!card) { Utils.assertFailure() + return } TelemetryClient.trackEvent(TelemetryCategory, TelemetryActions.DeleteCard, {board: board.id, card: card.id}) @@ -146,6 +147,7 @@ const TableRow = (props: Props) => { // confirmation dialog if (card?.title === '' && card?.fields.contentOrder.length === 0) { handleDeleteCard() + return } setShowConfirmationDialogBox(true) diff --git a/webapp/boards/src/components/topBar.tsx b/webapp/boards/src/components/topBar.tsx index 4e31eb8dea..61aecf1c79 100644 --- a/webapp/boards/src/components/topBar.tsx +++ b/webapp/boards/src/components/topBar.tsx @@ -10,6 +10,7 @@ import {Constants} from 'src/constants' const TopBar = (): JSX.Element => { const feedbackUrl = 'https://www.focalboard.com/fwlink/feedback-boards.html?v=' + Constants.versionString + return (
    window.removeEventListener('resize', updateSize) }, []) @@ -56,5 +57,6 @@ export function useMeasurePunchouts(elementIds: string[], additionalDeps: any[], height: `${(maxY - minY) + (offset ? offset.height : 0)}px`, } }, [...elementIds, ...additionalDeps, size, elementsAvailable]) + return channelPunchout } diff --git a/webapp/boards/src/components/tutorial_tour_tip/tutorial_tour_tip.tsx b/webapp/boards/src/components/tutorial_tour_tip/tutorial_tour_tip.tsx index 2134775515..37eb89dcdd 100644 --- a/webapp/boards/src/components/tutorial_tour_tip/tutorial_tour_tip.tsx +++ b/webapp/boards/src/components/tutorial_tour_tip/tutorial_tour_tip.tsx @@ -131,6 +131,7 @@ const TutorialTourTip = ({ defaultMessage={'Got it'} /> ) + return buttonText } diff --git a/webapp/boards/src/components/tutorial_tour_tip/tutorial_tour_tip_manager.tsx b/webapp/boards/src/components/tutorial_tour_tip/tutorial_tour_tip_manager.tsx index 2c94d27288..94e5e41c27 100644 --- a/webapp/boards/src/components/tutorial_tour_tip/tutorial_tour_tip_manager.tsx +++ b/webapp/boards/src/components/tutorial_tour_tip/tutorial_tour_tip_manager.tsx @@ -5,12 +5,12 @@ import React, {useCallback, useEffect, useState} from 'react' import {useDispatch} from 'react-redux' -import {FINISHED, TourCategoriesMapToSteps, TOUR_ORDER} from 'src/components/onboardingTour' +import {FINISHED, TOUR_ORDER, TourCategoriesMapToSteps} from 'src/components/onboardingTour' import {useAppSelector} from 'src/store/hooks' import {getMe, getOnboardingTourStep, patchProps} from 'src/store/users' import {UserConfigPatch} from 'src/user' import octoClient from 'src/octoClient' -import {Utils, KeyCodes} from 'src/utils' +import {KeyCodes, Utils} from 'src/utils' import TelemetryClient, {TelemetryCategory} from 'src/telemetry/telemetryClient' export interface TutorialTourTipManager { @@ -107,6 +107,7 @@ const useTutorialTourTipManager = ({ useEffect(() => { window.addEventListener('keydown', handleKeyDown) + return () => window.removeEventListener('keydown', handleKeyDown) }, []) @@ -194,6 +195,7 @@ const useTutorialTourTipManager = ({ if (candidateMaxStep > maxStep && candidateMaxStep !== tourSteps.FINISHED) { return candidateMaxStep } + return maxStep }, Number.MIN_SAFE_INTEGER) } diff --git a/webapp/boards/src/components/tutorial_tour_tip/useElementAvailable.ts b/webapp/boards/src/components/tutorial_tour_tip/useElementAvailable.ts index 40c363ae82..09b84ecc04 100644 --- a/webapp/boards/src/components/tutorial_tour_tip/useElementAvailable.ts +++ b/webapp/boards/src/components/tutorial_tour_tip/useElementAvailable.ts @@ -13,9 +13,10 @@ export default function useElementAvailable( clearInterval(checkAvailableInterval.current) checkAvailableInterval.current = null } - return + + return undefined } else if (checkAvailableInterval.current) { - return + return undefined } checkAvailableInterval.current = setInterval(() => { if (elementIds.every((x) => document.querySelector(x))) { diff --git a/webapp/boards/src/components/viewHeader/dateFilter.test.tsx b/webapp/boards/src/components/viewHeader/dateFilter.test.tsx index 4cd13819aa..d4e3c1124c 100644 --- a/webapp/boards/src/components/viewHeader/dateFilter.test.tsx +++ b/webapp/boards/src/components/viewHeader/dateFilter.test.tsx @@ -7,12 +7,11 @@ import userEvent from '@testing-library/user-event' import {IntlProvider} from 'react-intl' import {mocked} from 'jest-mock' - import {wrapIntl} from 'src/testUtils' import mutator from 'src/mutator' import {TestBlockFactory} from 'src/test/testBlockFactory' -import {createFilterClause, FilterClause} from 'src/blocks/filterClause' +import {FilterClause, createFilterClause} from 'src/blocks/filterClause' import {createFilterGroup} from 'src/blocks/filterGroup' import DateFilter from './dateFilter' diff --git a/webapp/boards/src/components/viewHeader/dateFilter.tsx b/webapp/boards/src/components/viewHeader/dateFilter.tsx index 6c0dcb9fb9..ef51b3b029 100644 --- a/webapp/boards/src/components/viewHeader/dateFilter.tsx +++ b/webapp/boards/src/components/viewHeader/dateFilter.tsx @@ -1,6 +1,6 @@ // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. -import React, {useState, useCallback} from 'react' +import React, {useCallback, useState} from 'react' import {useIntl} from 'react-intl' import {DateUtils} from 'react-day-picker' import MomentLocaleUtils from 'react-day-picker/moment' @@ -77,6 +77,7 @@ function DateFilter(props: Props): JSX.Element { if (date) { displayDate = Utils.displayDate(date, intl) } + return displayDate } @@ -129,6 +130,7 @@ function DateFilter(props: Props): JSX.Element { } const className = 'DateFilter' + return (
    ); diff --git a/webapp/channels/src/components/admin_console/billing/billing_summary/index.tsx b/webapp/channels/src/components/admin_console/billing/billing_summary/index.tsx index e53bd72570..e4e3e1a2ce 100644 --- a/webapp/channels/src/components/admin_console/billing/billing_summary/index.tsx +++ b/webapp/channels/src/components/admin_console/billing/billing_summary/index.tsx @@ -5,6 +5,7 @@ import React from 'react'; import {useSelector} from 'react-redux'; import {getSubscriptionProduct, checkHadPriorTrial, getCloudSubscription} from 'mattermost-redux/selectors/entities/cloud'; +import {cloudReverseTrial} from 'mattermost-redux/selectors/entities/preferences'; import {CloudProducts} from 'utils/constants'; @@ -27,20 +28,23 @@ type BillingSummaryProps = { const BillingSummary = ({isFreeTrial, daysLeftOnTrial, onUpgradeMattermostCloud}: BillingSummaryProps) => { const subscription = useSelector(getCloudSubscription); const product = useSelector(getSubscriptionProduct); + const reverseTrial = useSelector(cloudReverseTrial); let body = noBillingHistory; const isPreTrial = subscription?.is_free_trial === 'false' && subscription?.trial_end_at === 0; const hasPriorTrial = useSelector(checkHadPriorTrial); - const showTryEnterprise = product?.sku === CloudProducts.STARTER && isPreTrial; - const showUpgradeProfessional = product?.sku === CloudProducts.STARTER && hasPriorTrial; + const isStarterPreTrial = product?.sku === CloudProducts.STARTER && isPreTrial; + const isStarterPostTrial = product?.sku === CloudProducts.STARTER && hasPriorTrial; - if (showTryEnterprise) { + if (isStarterPreTrial && reverseTrial) { + body = ; + } else if (isStarterPreTrial) { body = tryEnterpriseCard; - } else if (showUpgradeProfessional) { + } else if (isStarterPostTrial) { body = ; } else if (isFreeTrial) { - body = freeTrial(onUpgradeMattermostCloud, daysLeftOnTrial); + body = freeTrial(onUpgradeMattermostCloud, daysLeftOnTrial, reverseTrial); } else if (subscription?.last_invoice && !subscription?.upcoming_invoice) { const invoice = subscription.last_invoice; const fullCharges = invoice.line_items.filter((item) => item.type === 'full'); diff --git a/webapp/channels/src/components/admin_console/billing/delete_workspace/delete_workspace_modal.scss b/webapp/channels/src/components/admin_console/billing/delete_workspace/delete_workspace_modal.scss index 2bcbbebd2a..514dd90e0a 100644 --- a/webapp/channels/src/components/admin_console/billing/delete_workspace/delete_workspace_modal.scss +++ b/webapp/channels/src/components/admin_console/billing/delete_workspace/delete_workspace_modal.scss @@ -12,6 +12,10 @@ } } + &__Icon { + padding-top: 8px; + } + &__Title { color: var(--sys-denim-center-channel-text); font-family: Metropolis; @@ -21,15 +25,17 @@ } &__Usage { + color: var(--center-channel-color); text-align: left; &-Highlighted { color: black; - font-weight: 700; + font-weight: bold; } } &__Warning { + color: var(--center-channel-color); text-align: left; } diff --git a/webapp/channels/src/components/admin_console/billing/delete_workspace/delete_workspace_modal.tsx b/webapp/channels/src/components/admin_console/billing/delete_workspace/delete_workspace_modal.tsx index 5fc7c7c2a7..1b57ecfc79 100644 --- a/webapp/channels/src/components/admin_console/billing/delete_workspace/delete_workspace_modal.tsx +++ b/webapp/channels/src/components/admin_console/billing/delete_workspace/delete_workspace_modal.tsx @@ -7,7 +7,7 @@ import {FormattedMessage} from 'react-intl'; import {useDispatch, useSelector} from 'react-redux'; -import {GenericModal} from '@mattermost/components'; +import {LegacyGenericModal} from '@mattermost/components'; import LaptopAlertSVG from 'components/common/svg_images_components/laptop_alert_svg'; import {closeModal, openModal} from 'actions/views/modals'; @@ -29,7 +29,6 @@ import {getSubscriptionProduct} from 'mattermost-redux/selectors/entities/cloud' import {isCloudLicense} from 'utils/license_utils'; import {getLicense} from 'mattermost-redux/selectors/entities/general'; import {DispatchFunc} from 'mattermost-redux/types/actions'; -import {trackEvent} from 'actions/telemetry_actions'; import useGetSubscription from 'components/common/hooks/useGetSubscription'; import DeleteWorkspaceSuccessModal from './success_modal'; @@ -122,7 +121,6 @@ export default function DeleteWorkspaceModal(props: Props) { modalId: ModalIdentifiers.DELETE_WORKSPACE_RESULT, dialogType: DeleteWorkspaceSuccessModal, })); - trackEvent('cloud_admin', 'self_serve_workspace_deletion_completed'); } else { // Failure dispatch(openModal({ modalId: ModalIdentifiers.DELETE_WORKSPACE_RESULT, @@ -182,12 +180,12 @@ export default function DeleteWorkspaceModal(props: Props) { } return ( - -
    - +
    +
    - + ); } diff --git a/webapp/channels/src/components/admin_console/database_settings.jsx b/webapp/channels/src/components/admin_console/database_settings.jsx index e75e100c89..520cb8e2a7 100644 --- a/webapp/channels/src/components/admin_console/database_settings.jsx +++ b/webapp/channels/src/components/admin_console/database_settings.jsx @@ -4,7 +4,7 @@ import React from 'react'; import {FormattedMessage} from 'react-intl'; -import {recycleDatabaseConnection} from 'actions/admin_actions.jsx'; +import {recycleDatabaseConnection, ping} from 'actions/admin_actions'; import * as Utils from 'utils/utils'; import {t} from 'utils/i18n'; @@ -19,6 +19,15 @@ import TextSetting from './text_setting'; import MigrationsTable from './database'; export default class DatabaseSettings extends AdminSettings { + constructor(props) { + super(props); + + this.state = { + ...this.state, + searchBackend: '', + }; + } + getConfigFromState = (config) => { // driverName and dataSource are read-only from the UI @@ -34,6 +43,17 @@ export default class DatabaseSettings extends AdminSettings { return config; }; + componentDidMount() { + this.getSearchBackend().then((searchBackend) => { + this.setState({searchBackend}); + }); + } + + async getSearchBackend() { + const res = await ping()(); + return res.ActiveSearchBackend; + } + getStateFromConfig(config) { return { driverName: config.SqlSettings.DriverName, @@ -368,6 +388,30 @@ export default class DatabaseSettings extends AdminSettings {
    +
    + +
    + +
    + +
    +
    +
    ); }; diff --git a/webapp/channels/src/components/admin_console/database_settings.test.jsx b/webapp/channels/src/components/admin_console/database_settings.test.jsx index b6e98f8a6c..936ee41d13 100644 --- a/webapp/channels/src/components/admin_console/database_settings.test.jsx +++ b/webapp/channels/src/components/admin_console/database_settings.test.jsx @@ -7,8 +7,14 @@ import {shallow} from 'enzyme'; import DatabaseSettings from 'components/admin_console/database_settings.jsx'; jest.mock('actions/admin_actions.jsx', () => { + const pingFn = () => { + return jest.fn(() => { + return {ActiveSearchBackend: 'none'}; + }); + }; return { recycleDatabaseConnection: jest.fn(), + ping: pingFn, }; }); diff --git a/webapp/channels/src/components/admin_console/feature_discovery/__snapshots__/feature_discovery.test.tsx.snap b/webapp/channels/src/components/admin_console/feature_discovery/__snapshots__/feature_discovery.test.tsx.snap deleted file mode 100644 index 08bf045383..0000000000 --- a/webapp/channels/src/components/admin_console/feature_discovery/__snapshots__/feature_discovery.test.tsx.snap +++ /dev/null @@ -1,138 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`components/feature_discovery FeatureDiscovery should match snapshot 1`] = ` -
    -
    -
    - -
    -
    - -
    - - - - -

    - -

    -
    -
    - -
    -
    -`; - -exports[`components/feature_discovery FeatureDiscovery should match snapshot when is cloud environment 1`] = ` -
    -
    -
    - -
    -
    - -
    - - - - -

    - -

    -
    -
    - -
    -
    -`; - -exports[`components/feature_discovery FeatureDiscovery should match snapshot when is cloud environment and subscription is not loaded yet in redux store 1`] = ` - -`; diff --git a/webapp/channels/src/components/admin_console/feature_discovery/feature_discovery.test.tsx b/webapp/channels/src/components/admin_console/feature_discovery/feature_discovery.test.tsx index e8589a0c09..e0cd671bb3 100644 --- a/webapp/channels/src/components/admin_console/feature_discovery/feature_discovery.test.tsx +++ b/webapp/channels/src/components/admin_console/feature_discovery/feature_discovery.test.tsx @@ -2,100 +2,189 @@ // See LICENSE.txt for license information. import React from 'react'; -import {shallow} from 'enzyme'; import FeatureDiscovery from 'components/admin_console/feature_discovery/feature_discovery'; import {LicenseSkus} from 'utils/constants'; import SamlSVG from './features/images/saml_svg'; +import {renderWithIntl} from 'tests/react_testing_utils'; +import {screen, waitFor} from '@testing-library/react'; +import {Provider as ReduxProvider} from 'react-redux'; +import store from 'stores/redux_store'; +import userEvent from '@testing-library/user-event'; describe('components/feature_discovery', () => { describe('FeatureDiscovery', () => { - test('should match snapshot', () => { - const wrapper = shallow( - } - // eslint-disable-next-line @typescript-eslint/naming-convention - stats={{TOTAL_USERS: 20}} - prevTrialLicense={{IsLicensed: 'false'}} - isCloud={false} - isCloudTrial={false} - hadPrevCloudTrial={false} - isSubscriptionLoaded={true} - isPaidSubscription={false} - actions={{ - getPrevTrialLicense: jest.fn(), - getCloudSubscription: jest.fn(), - openModal: jest.fn(), - }} - />, + test('should match the default state of the component when is not cloud environment', async () => { + const getPrevTrialLicense = jest.fn(); + const getCloudSubscription = jest.fn(); + const openModal = jest.fn(); + + renderWithIntl( + + } + // eslint-disable-next-line @typescript-eslint/naming-convention + stats={{TOTAL_USERS: 20}} + prevTrialLicense={{IsLicensed: 'false'}} + isCloud={false} + isCloudTrial={false} + hadPrevCloudTrial={false} + isSubscriptionLoaded={true} + isPaidSubscription={false} + cloudFreeDeprecated={false} + actions={{ + getPrevTrialLicense, + getCloudSubscription, + openModal, + }} + /> + , ); - expect(wrapper).toMatchSnapshot(); + + expect(screen.queryByText('Bar')).toBeInTheDocument(); + expect(screen.queryByText('Foo')).toBeInTheDocument(); + + expect(screen.getByRole('button', {name: 'Start trial'})).toBeInTheDocument(); + await userEvent.click(screen.getByRole('button', {name: 'Start trial'})); + await userEvent.click(screen.getByText('Mattermost Software and Services License Agreement')); + + //cloud option + expect(screen.queryByRole('button', {name: 'Try free for 30 days'})).not.toBeInTheDocument(); + + const featureLink = screen.getByTestId('featureDiscovery_secondaryCallToAction'); + + expect(featureLink).toBeInTheDocument(); + expect(featureLink).toHaveAttribute('href', 'https://test.mattermost.com/secondary/?utm_source=mattermost&utm_medium=in-product&utm_content=feature_discovery&uid=&sid='); + expect(featureLink).toHaveTextContent('Learn more'); + expect(screen.getByText('Mattermost Software and Services License Agreement')).toHaveAttribute('href', 'https://mattermost.com/pl/software-and-services-license-agreement?utm_source=mattermost&utm_medium=in-product&utm_content=feature_discovery&uid=&sid='); + expect(screen.getByText('Privacy Policy')).toHaveAttribute('href', 'https://mattermost.com/privacy-policy/?utm_source=mattermost&utm_medium=in-product&utm_content=feature_discovery&uid=&sid='); + + expect(getPrevTrialLicense).toHaveBeenCalled(); + expect(getCloudSubscription).not.toHaveBeenCalled(); + expect(openModal).not.toHaveBeenCalled(); }); - test('should match snapshot when is cloud environment', () => { - const wrapper = shallow( - } - // eslint-disable-next-line @typescript-eslint/naming-convention - stats={{TOTAL_USERS: 20}} - prevTrialLicense={{IsLicensed: 'false'}} - isCloud={true} - isCloudTrial={false} - hadPrevCloudTrial={false} - isPaidSubscription={false} - isSubscriptionLoaded={true} - actions={{ - getPrevTrialLicense: jest.fn(), - openModal: jest.fn(), - getCloudSubscription: jest.fn(), - }} - />, - ); - expect(wrapper).toMatchSnapshot(); + test('should match component state when is cloud environment', async () => { + const getPrevTrialLicense = jest.fn(); + const getCloudSubscription = jest.fn(); + const openModal = jest.fn(); + + await waitFor(() => { + renderWithIntl( + + } + // eslint-disable-next-line @typescript-eslint/naming-convention + stats={{TOTAL_USERS: 20}} + prevTrialLicense={{IsLicensed: 'false'}} + isCloud={true} + isCloudTrial={false} + hadPrevCloudTrial={false} + isPaidSubscription={false} + isSubscriptionLoaded={true} + cloudFreeDeprecated={false} + actions={{ + getPrevTrialLicense, + getCloudSubscription, + openModal, + }} + /> + , + ); + }); + + // subscription is loaded, so loadingSpinner should not be visible + expect(screen.queryByTestId('loadingSpinner')).not.toBeInTheDocument(); + + expect(screen.queryByText('Bar')).toBeInTheDocument(); + expect(screen.queryByText('Foo')).toBeInTheDocument(); + + //this option is visible only when it is cloud environment + expect(screen.getByRole('button', {name: 'Try free for 30 days'})).toBeInTheDocument(); + expect(screen.getAllByText('Try free for 30 days')).toHaveLength(2); + + expect(screen.getByTestId('featureDiscovery_secondaryCallToAction')).toHaveAttribute('href', 'https://test.mattermost.com/secondary/?utm_source=mattermost&utm_medium=in-product&utm_content=feature_discovery&uid=&sid='); + + expect(screen.getByText('Privacy Policy')).toHaveAttribute('href', 'https://mattermost.com/privacy-policy/?utm_source=mattermost&utm_medium=in-product&utm_content=feature_discovery&uid=&sid='); + + const featureLink = screen.getByTestId('featureDiscovery_secondaryCallToAction'); + + expect(featureLink).toBeInTheDocument(); + expect(featureLink).toHaveAttribute('href', 'https://test.mattermost.com/secondary/?utm_source=mattermost&utm_medium=in-product&utm_content=feature_discovery&uid=&sid='); + expect(featureLink).toHaveTextContent('Learn more'); + + expect(getPrevTrialLicense).toHaveBeenCalled(); + expect(getCloudSubscription).not.toHaveBeenCalled(); + expect(openModal).not.toHaveBeenCalled(); + + expect(screen.queryByRole('button', {name: 'Start trial'})).not.toBeInTheDocument(); }); - test('should match snapshot when is cloud environment and subscription is not loaded yet in redux store', () => { - const wrapper = shallow( - } - // eslint-disable-next-line @typescript-eslint/naming-convention - stats={{TOTAL_USERS: 20}} - prevTrialLicense={{IsLicensed: 'false'}} - isCloud={true} - isCloudTrial={false} - hadPrevCloudTrial={false} - isSubscriptionLoaded={false} - isPaidSubscription={false} - actions={{ - getPrevTrialLicense: jest.fn(), - openModal: jest.fn(), - getCloudSubscription: jest.fn(), - }} - />, + test('should match component state when is cloud environment and subscription is not loaded yet in redux store', () => { + const getPrevTrialLicense = jest.fn(); + const getCloudSubscription = jest.fn(); + const openModal = jest.fn(); + + renderWithIntl( + + } + // eslint-disable-next-line @typescript-eslint/naming-convention + stats={{TOTAL_USERS: 20}} + prevTrialLicense={{IsLicensed: 'false'}} + isCloud={true} + isCloudTrial={false} + hadPrevCloudTrial={false} + isSubscriptionLoaded={false} + isPaidSubscription={false} + cloudFreeDeprecated={false} + actions={{ + getPrevTrialLicense, + getCloudSubscription, + openModal, + }} + /> + , ); - expect(wrapper).toMatchSnapshot(); + + // when is cloud and subscription is not loaded yet, then only loading spinner is visible + expect(screen.getByTestId('loadingSpinner')).toBeInTheDocument(); + + expect(screen.queryByText('Bar')).not.toBeInTheDocument(); + expect(screen.queryByText('Foo')).not.toBeInTheDocument(); + + //this option is visible only when subscription is loaded and is cloud environment + expect(screen.queryByRole('button', {name: 'Try free for 30 days'})).not.toBeInTheDocument(); + + expect(screen.queryByTestId('featureDiscovery_secondaryCallToAction')).not.toBeInTheDocument(); + + expect(getPrevTrialLicense).toHaveBeenCalled(); + expect(getCloudSubscription).not.toHaveBeenCalled(); + expect(openModal).not.toHaveBeenCalled(); + + expect(screen.queryByRole('button', {name: 'Start trial'})).not.toBeInTheDocument(); }); }); }); diff --git a/webapp/channels/src/components/admin_console/feature_discovery/feature_discovery.tsx b/webapp/channels/src/components/admin_console/feature_discovery/feature_discovery.tsx index e2faca2227..9d757b205d 100644 --- a/webapp/channels/src/components/admin_console/feature_discovery/feature_discovery.tsx +++ b/webapp/channels/src/components/admin_console/feature_discovery/feature_discovery.tsx @@ -2,7 +2,7 @@ // See LICENSE.txt for license information. import React from 'react'; -import {FormattedMessage} from 'react-intl'; +import {FormattedMessage, useIntl} from 'react-intl'; import FormattedMarkdownMessage from 'components/formatted_markdown_message'; @@ -59,6 +59,7 @@ type Props = { isSubscriptionLoaded: boolean; isPaidSubscription: boolean; customer?: CloudCustomer; + cloudFreeDeprecated: boolean; } type State = { @@ -195,16 +196,28 @@ export default class FeatureDiscovery extends React.PureComponent // if all conditions are set for being able to request a cloud trial, then show the cta start cloud trial button if (canRequestCloudFreeTrial) { ctaPrimaryButton = ( - ); + if (this.props.cloudFreeDeprecated) { + ctaPrimaryButton = ( + + ); + } } else if (hadPrevCloudTrial) { // if it is cloud, but this account already had a free trial, then the cta button must be Upgrade now ctaPrimaryButton = ( @@ -259,7 +272,7 @@ export default class FeatureDiscovery extends React.PureComponent /> {gettingTrialError} - {(!this.props.isCloud || canRequestCloudFreeTrial) &&

    + {((!this.props.isCloud || canRequestCloudFreeTrial) && !this.props.cloudFreeDeprecated) &&

    {canRequestCloudFreeTrial ? ( ); } } + +function FeatureDiscoveryCloudStartTrialButton(props: Omit, 'message'>) { + const message = useIntl().formatMessage( + { + id: 'admin.ldap_feature_discovery.call_to_action.primary.cloudFree', + defaultMessage: 'Try free for {trialLength} days', + }, + { + trialLength: FREEMIUM_TO_ENTERPRISE_TRIAL_LENGTH_DAYS, + }, + ); + + return ( + + ); +} diff --git a/webapp/channels/src/components/admin_console/feature_discovery/index.tsx b/webapp/channels/src/components/admin_console/feature_discovery/index.tsx index 99ea68e874..49c2eea386 100644 --- a/webapp/channels/src/components/admin_console/feature_discovery/index.tsx +++ b/webapp/channels/src/components/admin_console/feature_discovery/index.tsx @@ -9,6 +9,7 @@ import {getCloudSubscription} from 'mattermost-redux/actions/cloud'; import {Action, GenericAction} from 'mattermost-redux/types/actions'; import {checkHadPriorTrial, getCloudCustomer} from 'mattermost-redux/selectors/entities/cloud'; import {getLicense} from 'mattermost-redux/selectors/entities/general'; +import {deprecateCloudFree} from 'mattermost-redux/selectors/entities/preferences'; import {ModalData} from 'types/actions'; import {GlobalState} from 'types/store'; @@ -29,6 +30,7 @@ function mapStateToProps(state: GlobalState) { const hasPriorTrial = checkHadPriorTrial(state); const isCloudTrial = subscription?.is_free_trial === 'true'; const customer = getCloudCustomer(state); + const cloudFreeDeprecated = deprecateCloudFree(state); return { stats: state.entities.admin.analytics, prevTrialLicense: state.entities.admin.prevTrialLicense, @@ -38,6 +40,7 @@ function mapStateToProps(state: GlobalState) { hadPrevCloudTrial: hasPriorTrial, isPaidSubscription: isCloud && license?.SkuShortName !== LicenseSkus.Starter && !isCloudTrial, customer, + cloudFreeDeprecated, }; } diff --git a/webapp/channels/src/components/admin_console/generated_setting.tsx b/webapp/channels/src/components/admin_console/generated_setting.tsx index 8f00f5c862..4665443779 100644 --- a/webapp/channels/src/components/admin_console/generated_setting.tsx +++ b/webapp/channels/src/components/admin_console/generated_setting.tsx @@ -38,7 +38,11 @@ export default class GeneratedSetting extends React.PureComponent { private regenerate = (e: React.MouseEvent) => { e.preventDefault(); - this.props.onChange(this.props.id, crypto.randomBytes(256).toString('base64').substring(0, 32)); + // Pure base64 implementation can contain characters that are not URL safe without additional + // encoding. Adopt a URL/Filename safer alphabet as noted in https://datatracker.ietf.org/doc/html/rfc4648#section-5 + // where: 62 - (minus) , 63 _ (underscore) + const value = crypto.randomBytes(256).toString('base64').substring(0, 32); + this.props.onChange(this.props.id, value.replaceAll('+', '-').replaceAll('/', '_')); }; public render() { diff --git a/webapp/channels/src/components/admin_console/license_settings/enterprise_edition/enterprise_edition.scss b/webapp/channels/src/components/admin_console/license_settings/enterprise_edition/enterprise_edition.scss index 881616d1cf..acce9b4621 100644 --- a/webapp/channels/src/components/admin_console/license_settings/enterprise_edition/enterprise_edition.scss +++ b/webapp/channels/src/components/admin_console/license_settings/enterprise_edition/enterprise_edition.scss @@ -104,7 +104,7 @@ .license-details-top { display: flex; - justify-content: flex-start; + justify-content: space-between; font-size: 14px; font-weight: 700; line-height: 24px; @@ -114,10 +114,11 @@ color: #3f4350; } - span.expiration-days { - margin-left: auto; - color: var(--denim-status-online); + .add-seats-button { + border-radius: 4px; + font-family: 'Open Sans', sans-serif; font-size: 12px; + font-weight: 600; } } @@ -157,6 +158,20 @@ font-weight: 600; } } + + span.expiration-days { + margin-left: 8px; + font-size: 14px; + font-weight: 600; + + &-warning { + color: var(--sys-away-indicator); + } + + &-danger { + color: var(--dnd-indicator); + } + } } .add-new-licence-btn { diff --git a/webapp/channels/src/components/admin_console/license_settings/enterprise_edition/enterprise_edition_left_panel.test.tsx b/webapp/channels/src/components/admin_console/license_settings/enterprise_edition/enterprise_edition_left_panel.test.tsx index 603aa6807b..987a3421f5 100644 --- a/webapp/channels/src/components/admin_console/license_settings/enterprise_edition/enterprise_edition_left_panel.test.tsx +++ b/webapp/channels/src/components/admin_console/license_settings/enterprise_edition/enterprise_edition_left_panel.test.tsx @@ -6,17 +6,31 @@ import {screen} from '@testing-library/react'; import {Provider} from 'react-redux'; +import moment from 'moment-timezone'; + import {mountWithIntl} from 'tests/helpers/intl-test-helper'; import {renderWithIntl} from 'tests/react_testing_utils'; -import {OverActiveUserLimits} from 'utils/constants'; +import {OverActiveUserLimits, SelfHostedProducts} from 'utils/constants'; +import {TestHelper} from 'utils/test_helper'; import {General} from 'mattermost-redux/constants'; import {DeepPartial} from '@mattermost/types/utilities'; import {GlobalState} from '@mattermost/types/store'; import mockStore from 'tests/test_store'; +import * as useCanSelfHostedExpand from 'components/common/hooks/useCanSelfHostedExpand'; + import EnterpriseEditionLeftPanel, {EnterpriseEditionProps} from './enterprise_edition_left_panel'; +jest.mock('react-router-dom', () => ({ + ...jest.requireActual('react-router-dom') as typeof import('react-router-dom'), + useLocation: () => { + return { + pathname: '', + }; + }, +})); + describe('components/admin_console/license_settings/enterprise_edition/enterprise_edition_left_panel', () => { const license = { IsLicensed: 'true', @@ -26,7 +40,7 @@ describe('components/admin_console/license_settings/enterprise_edition/enterpris SkuShortName: 'Enterprise', Name: 'LicenseName', Company: 'Mattermost Inc.', - Users: '1000000', + Users: '1000', }; const initialState: DeepPartial = { @@ -45,10 +59,36 @@ describe('components/admin_console/license_settings/enterprise_edition/enterpris }, general: { license, + config: { + BuildEnterpriseReady: 'true', + }, }, preferences: { myPreferences: {}, }, + admin: { + config: { + ServiceSettings: { + SelfHostedPurchase: true, + }, + }, + }, + cloud: { + subscription: undefined, + }, + hostedCustomer: { + products: { + products: { + prod_professional: TestHelper.getProductMock({ + id: 'prod_professional', + name: 'Professional', + sku: SelfHostedProducts.PROFESSIONAL, + price_per_seat: 7.5, + }), + }, + productsLoaded: true, + }, + }, }, }; @@ -80,12 +120,12 @@ describe('components/admin_console/license_settings/enterprise_edition/enterpris const item = wrapper.find('.item-element').filterWhere((n) => { return n.children().length === 2 && - n.childAt(0).type() === 'span' && - !n.childAt(0).text().includes('ACTIVE') && - n.childAt(0).text().includes('LICENSED SEATS'); + n.childAt(0).type() === 'span' && + !n.childAt(0).text().includes('ACTIVE') && + n.childAt(0).text().includes('LICENSED SEATS'); }); - expect(item.text()).toContain('1,000,000'); + expect(item.text()).toContain('1,000'); }); test('should not add any class if active users is lower than the minimal', async () => { @@ -146,4 +186,47 @@ describe('components/admin_console/license_settings/enterprise_edition/enterpris expect(screen.getByText('ACTIVE USERS:')).not.toHaveClass('legend--warning-over-seats-purchased'); expect(screen.getByText('ACTIVE USERS:')).toHaveClass('legend--over-seats-purchased'); }); + + test('should add warning class to days expired indicator when there are more than 5 days until expiry', async () => { + license.ExpiresAt = moment().add(6, 'days').valueOf().toString(); + const store = await mockStore(initialState); + renderWithIntl( + + + , + ); + + expect(screen.getByText('Expires in 6 days')).toHaveClass('expiration-days-warning'); + }); + + test('should add danger class to days expired indicator when there are at least 5 days until expiry', async () => { + license.ExpiresAt = moment().add(5, 'days').valueOf().toString(); + const store = await mockStore(initialState); + renderWithIntl( + + + , + ); + + expect(screen.getByText('Expires in 5 days')).toHaveClass('expiration-days-danger'); + }); + + test('should display add seats button when there are more than 60 days until expiry and self hosted expansion is available', async () => { + license.ExpiresAt = moment().add(61, 'days').valueOf().toString(); + const store = await mockStore(initialState); + jest.spyOn(useCanSelfHostedExpand, 'default').mockImplementation(() => true); + renderWithIntl( + + + , + ); + + expect(screen.getByText('+ Add seats')).toBeVisible(); + }); }); diff --git a/webapp/channels/src/components/admin_console/license_settings/enterprise_edition/enterprise_edition_left_panel.tsx b/webapp/channels/src/components/admin_console/license_settings/enterprise_edition/enterprise_edition_left_panel.tsx index 790272b3a5..e3fee21900 100644 --- a/webapp/channels/src/components/admin_console/license_settings/enterprise_edition/enterprise_edition_left_panel.tsx +++ b/webapp/channels/src/components/admin_console/license_settings/enterprise_edition/enterprise_edition_left_panel.tsx @@ -4,6 +4,7 @@ import React, {RefObject, useEffect, useState} from 'react'; import classNames from 'classnames'; import {FormattedDate, FormattedMessage, FormattedNumber, FormattedTime, useIntl} from 'react-intl'; +import {useSelector} from 'react-redux'; import Tag from 'components/widgets/tag/tag'; @@ -12,12 +13,21 @@ import {ClientLicense} from '@mattermost/types/config'; import {Client4} from 'mattermost-redux/client'; import {getRemainingDaysFromFutureTimestamp, toTitleCase} from 'utils/utils'; -import {FileTypes} from 'utils/constants'; +import {FileTypes, TELEMETRY_CATEGORIES} from 'utils/constants'; import {getSkuDisplayName} from 'utils/subscription'; import {calculateOverageUserActivated} from 'utils/overage_team'; +import {getConfig} from 'mattermost-redux/selectors/entities/admin'; import './enterprise_edition.scss'; import useOpenPricingModal from 'components/common/hooks/useOpenPricingModal'; +import useCanSelfHostedExpand from 'components/common/hooks/useCanSelfHostedExpand'; +import {getExpandSeatsLink} from 'selectors/cloud'; +import useControlSelfHostedExpansionModal from 'components/common/hooks/useControlSelfHostedExpansionModal'; +import {useQuery} from 'utils/http_utils'; +import {trackEvent} from 'actions/telemetry_actions'; + +const DAYS_UNTIL_EXPIRY_WARNING_DISPLAY_THRESHOLD = 30; +const DAYS_UNTIL_EXPIRY_DANGER_DISPLAY_THRESHOLD = 5; export interface EnterpriseEditionProps { openEELicenseModal: () => void; @@ -47,10 +57,23 @@ const EnterpriseEditionLeftPanel = ({ const {formatMessage} = useIntl(); const [unsanitizedLicense, setUnsanitizedLicense] = useState(license); const openPricingModal = useOpenPricingModal(); + const canExpand = useCanSelfHostedExpand(); + const selfHostedExpansionModal = useControlSelfHostedExpansionModal({trackingLocation: 'license_settings_add_seats'}); + const expandableLink = useSelector(getExpandSeatsLink); + const isSelfHostedPurchaseEnabled = useSelector(getConfig)?.ServiceSettings?.SelfHostedPurchase; + + const query = useQuery(); + const actionQueryParam = query.get('action'); + + useEffect(() => { + if (actionQueryParam === 'show_expansion_modal' && canExpand && isSelfHostedPurchaseEnabled) { + selfHostedExpansionModal.open(); + query.set('action', ''); + } + }, []); useEffect(() => { async function fetchUnSanitizedLicense() { - // This solves this the issue reported here: https://mattermost.atlassian.net/browse/MM-42906 try { const unsanitizedL = await Client4.getClientLicenseOld(); setUnsanitizedLicense(unsanitizedL); @@ -77,6 +100,15 @@ const EnterpriseEditionLeftPanel = ({ ); + const handleClickAddSeats = () => { + trackEvent(TELEMETRY_CATEGORIES.SELF_HOSTED_EXPANSION, 'add_seats_clicked'); + if (!isSelfHostedPurchaseEnabled || !canExpand) { + window.open(expandableLink(unsanitizedLicense.Id), '_blank'); + } else { + selfHostedExpansionModal.open(); + } + }; + return (

    {'License details'} - {(expirationDays <= 30) && - - {`Expires in ${expirationDays} day${expirationDays > 1 ? 's' : ''}`} - + {canExpand && + }
    { @@ -134,6 +172,7 @@ const EnterpriseEditionLeftPanel = ({ fileInputRef, handleChange, statsActiveUsers, + expirationDays, ) }
    @@ -162,7 +201,7 @@ const EnterpriseEditionLeftPanel = ({ type LegendValues = 'START DATE:' | 'EXPIRES:' | 'LICENSED SEATS:' | 'ACTIVE USERS:' | 'EDITION:' | 'LICENSE ISSUED:' | 'NAME:' | 'COMPANY / ORG:' -const renderLicenseValues = (activeUsers: number, seatsPurchased: number) => ({legend, value}: {legend: LegendValues; value: string | JSX.Element | null}, index: number): React.ReactNode => { +const renderLicenseValues = (activeUsers: number, seatsPurchased: number, expirationDays: number) => ({legend, value}: {legend: LegendValues; value: string | JSX.Element | null}, index: number): React.ReactNode => { if (legend === 'ACTIVE USERS:') { const {isBetween5PercerntAnd10PercentPurchasedSeats, isOver10PercerntPurchasedSeats} = calculateOverageUserActivated({activeUsers, seatsPurchased}); return ( @@ -186,6 +225,26 @@ const renderLicenseValues = (activeUsers: number, seatsPurchased: number) => ({l >{value}
    ); + } else if (legend === 'EXPIRES:') { + return ( +
    + {legend} + {value} + {(expirationDays <= DAYS_UNTIL_EXPIRY_WARNING_DISPLAY_THRESHOLD) && + + {`Expires in ${expirationDays} day${expirationDays > 1 ? 's' : ''}`} + + } +
    + ); } return ( @@ -209,6 +268,7 @@ const renderLicenseContent = ( fileInputRef: RefObject, handleChange: () => void, statsActiveUsers: number, + expirationDays: number, ) => { // Note: DO NOT LOCALISE THESE STRINGS. Legally we can not since the license is in English. @@ -246,7 +306,7 @@ const renderLicenseContent = ( return (
    - {licenseValues.map(renderLicenseValues(statsActiveUsers, parseInt(license.Users, 10)))} + {licenseValues.map(renderLicenseValues(statsActiveUsers, parseInt(license.Users, 10), expirationDays))}
    {renderAddNewLicenseButton(fileInputRef, handleChange)} {renderRemoveButton(handleRemove, isDisabled, removing)} diff --git a/webapp/channels/src/components/admin_console/license_settings/trial_banner/trial_banner.tsx b/webapp/channels/src/components/admin_console/license_settings/trial_banner/trial_banner.tsx index ba97c6a2f0..17f13e3861 100644 --- a/webapp/channels/src/components/admin_console/license_settings/trial_banner/trial_banner.tsx +++ b/webapp/channels/src/components/admin_console/license_settings/trial_banner/trial_banner.tsx @@ -1,7 +1,7 @@ // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. -import React, {useEffect, useState} from 'react'; +import React, {useEffect, useState, ReactNode} from 'react'; import {FormattedMessage, useIntl} from 'react-intl'; import {useDispatch, useSelector} from 'react-redux'; @@ -106,7 +106,7 @@ const TrialBanner = ({ const dispatch = useDispatch(); - const btnText = (status: TrialLoadStatus): string => { + const btnText = (status: TrialLoadStatus) => { switch (status) { case TrialLoadStatus.Started: return formatMessage({id: 'start_trial.modal.gettingTrial', defaultMessage: 'Getting Trial...'}); @@ -115,7 +115,22 @@ const TrialBanner = ({ case TrialLoadStatus.Failed: return formatMessage({id: 'start_trial.modal.failed', defaultMessage: 'Failed'}); case TrialLoadStatus.Embargoed: - return formatMessage({id: 'admin.license.trial-request.embargoed'}); + return formatMessage( + { + id: 'admin.license.trial-request.embargoed', + defaultMessage: 'We were unable to process the request due to limitations for embargoed countries. Learn more in our documentation, or reach out to legal@mattermost.com for questions around export limitations.', + }, + { + link: (text: string) => ( + + {text} + + ), + }, + ); default: return formatMessage({id: 'admin.license.trial-request.startTrial', defaultMessage: 'Start trial'}); } diff --git a/webapp/channels/src/components/admin_console/request_button/__snapshots__/request_button.test.tsx.snap b/webapp/channels/src/components/admin_console/request_button/__snapshots__/request_button.test.tsx.snap index a13c3bb7ec..142bbd54a4 100644 --- a/webapp/channels/src/components/admin_console/request_button/__snapshots__/request_button.test.tsx.snap +++ b/webapp/channels/src/components/admin_console/request_button/__snapshots__/request_button.test.tsx.snap @@ -20,7 +20,7 @@ exports[`components/admin_console/request_button/request_button.jsx should match > @@ -30,7 +30,7 @@ exports[`components/admin_console/request_button/request_button.jsx should match >
    @@ -42,7 +42,7 @@ exports[`components/admin_console/request_button/request_button.jsx should match buttonText={ } disabled={false} @@ -55,7 +55,7 @@ exports[`components/admin_console/request_button/request_button.jsx should match helpText={ } includeDetailedError={true} @@ -103,7 +103,7 @@ exports[`components/admin_console/request_button/request_button.jsx should match > Button Text @@ -154,7 +154,7 @@ exports[`components/admin_console/request_button/request_button.jsx should match > Help Text @@ -171,7 +171,7 @@ exports[`components/admin_console/request_button/request_button.jsx should match buttonText={ } disabled={false} @@ -184,7 +184,7 @@ exports[`components/admin_console/request_button/request_button.jsx should match helpText={ } includeDetailedError={false} @@ -240,7 +240,7 @@ exports[`components/admin_console/request_button/request_button.jsx should match > Button Text @@ -291,7 +291,7 @@ exports[`components/admin_console/request_button/request_button.jsx should match > Help Text @@ -308,7 +308,7 @@ exports[`components/admin_console/request_button/request_button.jsx should match buttonText={ } disabled={false} @@ -321,7 +321,7 @@ exports[`components/admin_console/request_button/request_button.jsx should match helpText={ } includeDetailedError={false} @@ -369,7 +369,7 @@ exports[`components/admin_console/request_button/request_button.jsx should match > Button Text @@ -413,7 +413,7 @@ exports[`components/admin_console/request_button/request_button.jsx should match > Help Text @@ -430,7 +430,7 @@ exports[`components/admin_console/request_button/request_button.jsx should match buttonText={ } disabled={false} @@ -443,7 +443,7 @@ exports[`components/admin_console/request_button/request_button.jsx should match helpText={ } includeDetailedError={false} @@ -499,7 +499,7 @@ exports[`components/admin_console/request_button/request_button.jsx should match > Button Text @@ -513,7 +513,7 @@ exports[`components/admin_console/request_button/request_button.jsx should match > Help Text diff --git a/webapp/channels/src/components/admin_console/request_button/request_button.test.tsx b/webapp/channels/src/components/admin_console/request_button/request_button.test.tsx index f4ec173212..176669253f 100644 --- a/webapp/channels/src/components/admin_console/request_button/request_button.test.tsx +++ b/webapp/channels/src/components/admin_console/request_button/request_button.test.tsx @@ -18,13 +18,13 @@ describe('components/admin_console/request_button/request_button.jsx', () => { requestAction={emptyFunction} helpText={ } buttonText={ } @@ -42,13 +42,13 @@ describe('components/admin_console/request_button/request_button.jsx', () => { requestAction={requestActionSuccess} helpText={ } buttonText={ } @@ -72,13 +72,13 @@ describe('components/admin_console/request_button/request_button.jsx', () => { requestAction={requestActionSuccess} helpText={ } buttonText={ } @@ -102,13 +102,13 @@ describe('components/admin_console/request_button/request_button.jsx', () => { requestAction={requestActionSuccess} helpText={ } buttonText={ } @@ -129,13 +129,13 @@ describe('components/admin_console/request_button/request_button.jsx', () => { requestAction={requestActionSuccess} helpText={ } buttonText={ } @@ -164,13 +164,13 @@ describe('components/admin_console/request_button/request_button.jsx', () => { requestAction={requestActionFailure} helpText={ } buttonText={ } @@ -191,13 +191,13 @@ describe('components/admin_console/request_button/request_button.jsx', () => { requestAction={requestActionFailure} helpText={ } buttonText={ } diff --git a/webapp/channels/src/components/admin_console/schema_admin_settings.jsx b/webapp/channels/src/components/admin_console/schema_admin_settings.jsx index d1b8886a8e..b35db711ef 100644 --- a/webapp/channels/src/components/admin_console/schema_admin_settings.jsx +++ b/webapp/channels/src/components/admin_console/schema_admin_settings.jsx @@ -671,7 +671,7 @@ export default class SchemaAdminSettings extends React.PureComponent { }; handleGeneratedChange = (id, s) => { - this.handleChange(id, s.replace('+', '-').replace('/', '_')); + this.handleChange(id, s.replace(/\+/g, '-').replace(/\//g, '_')); }; handleChange = (id, value, confirm = false, doSubmit = false, warning = false) => { diff --git a/webapp/channels/src/components/admin_console/server_logs/log_list.tsx b/webapp/channels/src/components/admin_console/server_logs/log_list.tsx index d73d3d4b4e..ce8fa09e16 100644 --- a/webapp/channels/src/components/admin_console/server_logs/log_list.tsx +++ b/webapp/channels/src/components/admin_console/server_logs/log_list.tsx @@ -95,7 +95,7 @@ export default class LogList extends React.PureComponent { ); const level: JSX.Element = ( ); diff --git a/webapp/channels/src/components/admin_console/team_channel_settings/channel/details/channel_members/__snapshots__/channel_members.test.tsx.snap b/webapp/channels/src/components/admin_console/team_channel_settings/channel/details/channel_members/__snapshots__/channel_members.test.tsx.snap index de12f30686..337301c12b 100644 --- a/webapp/channels/src/components/admin_console/team_channel_settings/channel/details/channel_members/__snapshots__/channel_members.test.tsx.snap +++ b/webapp/channels/src/components/admin_console/team_channel_settings/channel/details/channel_members/__snapshots__/channel_members.test.tsx.snap @@ -124,6 +124,7 @@ exports[`admin_console/team_channel_settings/channel/ChannelMembers should match "msg_count": 0, "msg_count_root": 0, "notify_props": Object { + "channel_auto_follow_threads": "off", "desktop": "default", "email": "default", "ignore_channel_mentions": "default", @@ -145,6 +146,7 @@ exports[`admin_console/team_channel_settings/channel/ChannelMembers should match "msg_count": 0, "msg_count_root": 0, "notify_props": Object { + "channel_auto_follow_threads": "off", "desktop": "default", "email": "default", "ignore_channel_mentions": "default", @@ -166,6 +168,7 @@ exports[`admin_console/team_channel_settings/channel/ChannelMembers should match "msg_count": 0, "msg_count_root": 0, "notify_props": Object { + "channel_auto_follow_threads": "off", "desktop": "default", "email": "default", "ignore_channel_mentions": "default", diff --git a/webapp/channels/src/components/admin_console/team_channel_settings/group/group_users/__snapshots__/users_to_remove_role.test.tsx.snap b/webapp/channels/src/components/admin_console/team_channel_settings/group/group_users/__snapshots__/users_to_remove_role.test.tsx.snap index 68a500efec..18a77631df 100644 --- a/webapp/channels/src/components/admin_console/team_channel_settings/group/group_users/__snapshots__/users_to_remove_role.test.tsx.snap +++ b/webapp/channels/src/components/admin_console/team_channel_settings/group/group_users/__snapshots__/users_to_remove_role.test.tsx.snap @@ -95,6 +95,7 @@ exports[`components/admin_console/team_channel_settings/group/UsersToRemoveRole "msg_count": 0, "msg_count_root": 0, "notify_props": Object { + "channel_auto_follow_threads": "off", "desktop": "default", "email": "default", "ignore_channel_mentions": "default", @@ -186,6 +187,7 @@ exports[`components/admin_console/team_channel_settings/group/UsersToRemoveRole "msg_count": 0, "msg_count_root": 0, "notify_props": Object { + "channel_auto_follow_threads": "off", "desktop": "default", "email": "default", "ignore_channel_mentions": "default", @@ -277,6 +279,7 @@ exports[`components/admin_console/team_channel_settings/group/UsersToRemoveRole "msg_count": 0, "msg_count_root": 0, "notify_props": Object { + "channel_auto_follow_threads": "off", "desktop": "default", "email": "default", "ignore_channel_mentions": "default", diff --git a/webapp/channels/src/components/admin_console/team_channel_settings/team/details/__snapshots__/team_profile.test.tsx.snap b/webapp/channels/src/components/admin_console/team_channel_settings/team/details/__snapshots__/team_profile.test.tsx.snap index f3da9ea817..a714b14a38 100644 --- a/webapp/channels/src/components/admin_console/team_channel_settings/team/details/__snapshots__/team_profile.test.tsx.snap +++ b/webapp/channels/src/components/admin_console/team_channel_settings/team/details/__snapshots__/team_profile.test.tsx.snap @@ -213,9 +213,11 @@ exports[`admin_console/team_channel_settings/team/TeamProfile__Cloud restore sho content="name" intl={ Object { + "$t": [Function], "defaultFormats": Object {}, "defaultLocale": "en", "defaultRichTextElements": undefined, + "fallbackOnEmptyString": true, "formatDate": [Function], "formatDateTimeRange": [Function], "formatDateToParts": [Function], @@ -242,6 +244,7 @@ exports[`admin_console/team_channel_settings/team/TeamProfile__Cloud restore sho "locale": "en", "messages": Object {}, "onError": [Function], + "onWarn": [Function], "textComponent": "span", "timeZone": "Etc/UTC", "wrapRichTextChunksInFragment": undefined, @@ -457,9 +460,11 @@ exports[`admin_console/team_channel_settings/team/TeamProfile__Cloud should matc content="name" intl={ Object { + "$t": [Function], "defaultFormats": Object {}, "defaultLocale": "en", "defaultRichTextElements": undefined, + "fallbackOnEmptyString": true, "formatDate": [Function], "formatDateTimeRange": [Function], "formatDateToParts": [Function], @@ -486,6 +491,7 @@ exports[`admin_console/team_channel_settings/team/TeamProfile__Cloud should matc "locale": "en", "messages": Object {}, "onError": [Function], + "onWarn": [Function], "textComponent": "span", "timeZone": "Etc/UTC", "wrapRichTextChunksInFragment": undefined, @@ -603,9 +609,11 @@ exports[`admin_console/team_channel_settings/team/TeamProfile__Cloud should matc id="sharedTooltip" intl={ Object { + "$t": [Function], "defaultFormats": Object {}, "defaultLocale": "en", "defaultRichTextElements": undefined, + "fallbackOnEmptyString": true, "formatDate": [Function], "formatDateTimeRange": [Function], "formatDateToParts": [Function], @@ -632,6 +640,7 @@ exports[`admin_console/team_channel_settings/team/TeamProfile__Cloud should matc "locale": "en", "messages": Object {}, "onError": [Function], + "onWarn": [Function], "textComponent": "span", "timeZone": "Etc/UTC", "wrapRichTextChunksInFragment": undefined, @@ -834,9 +843,11 @@ exports[`admin_console/team_channel_settings/team/TeamProfile__Cloud should matc content="name" intl={ Object { + "$t": [Function], "defaultFormats": Object {}, "defaultLocale": "en", "defaultRichTextElements": undefined, + "fallbackOnEmptyString": true, "formatDate": [Function], "formatDateTimeRange": [Function], "formatDateToParts": [Function], @@ -863,6 +874,7 @@ exports[`admin_console/team_channel_settings/team/TeamProfile__Cloud should matc "locale": "en", "messages": Object {}, "onError": [Function], + "onWarn": [Function], "textComponent": "span", "timeZone": "Etc/UTC", "wrapRichTextChunksInFragment": undefined, diff --git a/webapp/channels/src/components/admin_console/workspace-optimization/chips_list.test.tsx b/webapp/channels/src/components/admin_console/workspace-optimization/chips_list.test.tsx index 3953977204..514597a354 100644 --- a/webapp/channels/src/components/admin_console/workspace-optimization/chips_list.test.tsx +++ b/webapp/channels/src/components/admin_console/workspace-optimization/chips_list.test.tsx @@ -6,7 +6,7 @@ import {shallow} from 'enzyme'; import ChipsList, {ChipsInfoType} from 'components/admin_console/workspace-optimization/chips_list'; -import {ItemStatus} from './dashboard.data'; +import {ItemStatus} from './dashboard.type'; describe('components/admin_console/workspace-optimization/chips_list', () => { const overallScoreChips: ChipsInfoType = { diff --git a/webapp/channels/src/components/admin_console/workspace-optimization/chips_list.tsx b/webapp/channels/src/components/admin_console/workspace-optimization/chips_list.tsx index 2dd06b5bc1..d9911f749b 100644 --- a/webapp/channels/src/components/admin_console/workspace-optimization/chips_list.tsx +++ b/webapp/channels/src/components/admin_console/workspace-optimization/chips_list.tsx @@ -6,7 +6,7 @@ import {FormattedMessage} from 'react-intl'; import Chip from 'components/common/chip/chip'; -import {ItemStatus} from './dashboard.data'; +import {ItemStatus} from './dashboard.type'; import './dashboard.scss'; diff --git a/webapp/channels/src/components/admin_console/workspace-optimization/dashboard.data.tsx b/webapp/channels/src/components/admin_console/workspace-optimization/dashboard.data.tsx index dd5ee9b565..93bfad13b8 100644 --- a/webapp/channels/src/components/admin_console/workspace-optimization/dashboard.data.tsx +++ b/webapp/channels/src/components/admin_console/workspace-optimization/dashboard.data.tsx @@ -1,7 +1,7 @@ // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. -import React from 'react'; +import React, {useEffect, useMemo, useState} from 'react'; import {useIntl} from 'react-intl'; import {useSelector} from 'react-redux'; @@ -14,56 +14,23 @@ import { AccountMultipleOutlineIcon, } from '@mattermost/compass-icons/components'; -import {getLicense} from 'mattermost-redux/selectors/entities/general'; +import {getLicense, getServerVersion} from 'mattermost-redux/selectors/entities/general'; import {GlobalState} from '@mattermost/types/store'; -import {CloudLinks, ConsolePages, DocLinks} from 'utils/constants'; +import {ConsolePages} from 'utils/constants'; import {daysToLicenseExpire, isEnterpriseOrE20License, getIsStarterLicense} from '../../../utils/license_utils'; import useOpenSalesLink from 'components/common/hooks/useOpenSalesLink'; +import {AdminConfig} from '@mattermost/types/config'; +import {runConfigChecks} from './dashboard_checks/config'; +import {DataModel, ItemStatus, Options} from './dashboard.type'; +import {runAccessChecks} from './dashboard_checks/access'; +import {runDataPrivacyChecks} from './dashboard_checks/data_privacy'; +import {runPerformanceChecks} from './dashboard_checks/performance'; +import {runEaseOfUseChecks} from './dashboard_checks/easy_management'; +import {runUpdateChecks} from './dashboard_checks/updates'; -export type DataModel = { - [key: string]: { - title: string; - description: string; - descriptionOk: string; - items: ItemModel[]; - icon: React.ReactNode; - hide?: boolean; - }; -} - -export enum ItemStatus { - NONE = 'none', - OK = 'ok', - INFO = 'info', - WARNING = 'warning', - ERROR = 'error', -} - -export type ItemModel = { - id: string; - title: string; - description: string; - status: ItemStatus; - scoreImpact: number; - impactModifier: number; - configUrl?: string; - configText?: string; - telemetryAction?: string; - infoUrl?: string; - infoText?: string; -} - -export type UpdatesParam = { - serverVersion: { - type: string; - status: ItemStatus; - description: string; - }; -} - -const impactModifiers: Record = { +export const impactModifiers: Record = { [ItemStatus.NONE]: 1, [ItemStatus.OK]: 1, [ItemStatus.INFO]: 0.5, @@ -71,11 +38,191 @@ const impactModifiers: Record = { [ItemStatus.ERROR]: 0, }; -const useMetricsData = () => { +const getUpdatesData = async ( + config: Partial, + formatMessage: ReturnType['formatMessage'], + options: Options, +) => ({ + title: formatMessage({ + id: 'admin.reporting.workspace_optimization.updates.title', + defaultMessage: 'Server updates', + }), + description: formatMessage({ + id: 'admin.reporting.workspace_optimization.updates.description', + defaultMessage: 'An update is available.', + }), + descriptionOk: formatMessage({ + id: 'admin.reporting.workspace_optimization.updates.descriptionOk', + defaultMessage: 'Your workspace is completely up to date!', + }), + icon: ( +
    + +
    + ), + items: await runUpdateChecks(config, formatMessage, options), +}); + +const getConfigurationData = async ( + config: Partial, + formatMessage: ReturnType['formatMessage'], + options: Options, +) => ({ + title: formatMessage({ + id: 'admin.reporting.workspace_optimization.configuration.title', + defaultMessage: 'Configuration', + }), + description: formatMessage({ + id: 'admin.reporting.workspace_optimization.configuration.description', + defaultMessage: 'You have configuration issues to resolve', + }), + hide: options.isCloud, + descriptionOk: formatMessage({ + id: 'admin.reporting.workspace_optimization.configuration.descriptionOk', + defaultMessage: 'You\'ve successfully configured SSL and Session Lengths!', + }), + icon: ( +
    + +
    + ), + items: await runConfigChecks(config, formatMessage, options), +}); + +const getAccessData = async ( + config: Partial, + formatMessage: ReturnType['formatMessage'], + options: Options, +) => ({ + title: formatMessage({ + id: 'admin.reporting.workspace_optimization.access.title', + defaultMessage: 'Workspace access', + }), + description: formatMessage({ + id: 'admin.reporting.workspace_optimization.access.description', + defaultMessage: 'Web server configuration may be affecting access to your Mattermost workspace.', + }), + hide: options.isCloud, + descriptionOk: formatMessage({ + id: 'admin.reporting.workspace_optimization.access.descriptionOk', + defaultMessage: 'Your web server configuration is passing a live URL test!', + }), + icon: ( +
    + +
    + ), + items: await runAccessChecks(config, formatMessage), +}); + +const getPerformanceData = async ( + config: Partial, + formatMessage: ReturnType['formatMessage'], + options: Options, +) => ({ + title: formatMessage({ + id: 'admin.reporting.workspace_optimization.performance.title', + defaultMessage: 'Performance', + }), + description: formatMessage({ + id: 'admin.reporting.workspace_optimization.performance.description', + defaultMessage: 'Your server would benefit from some performance tweaks.', + }), + hide: options.isCloud, + descriptionOk: formatMessage({ + id: 'admin.reporting.workspace_optimization.performance.descriptionOk', + defaultMessage: 'Your search performance suits your workspace usage!', + }), + icon: ( +
    + +
    + ), + items: await runPerformanceChecks(config, formatMessage, options), +}); + +const getDataPrivacyData = async ( + config: Partial, + formatMessage: ReturnType['formatMessage'], + options: Options, +) => ({ + title: formatMessage({ + id: 'admin.reporting.workspace_optimization.data_privacy.title', + defaultMessage: 'Data privacy', + }), + description: formatMessage({ + id: 'admin.reporting.workspace_optimization.data_privacy.description', + defaultMessage: 'Get better insight and control over your data.', + }), + descriptionOk: formatMessage({ + id: 'admin.reporting.workspace_optimization.data_privacy.descriptionOk', + defaultMessage: 'You\'ve enabled data retention and compliance features!', + }), + icon: ( +
    + +
    + ), + items: await runDataPrivacyChecks(config, formatMessage, options), +}); + +const getEaseOfManagementData = async ( + config: Partial, + formatMessage: ReturnType['formatMessage'], + options: Options, +) => ({ + title: formatMessage({ + id: 'admin.reporting.workspace_optimization.ease_of_management.title', + defaultMessage: 'Ease of management', + }), + description: formatMessage({ + id: 'admin.reporting.workspace_optimization.ease_of_management.description', + defaultMessage: 'Make it easier to manage your Mattermost workspace.', + }), + descriptionOk: formatMessage({ + id: 'admin.reporting.workspace_optimization.ease_of_management.descriptionOk', + defaultMessage: 'Your user authentication setup is appropriate based on your current usage!', + }), + icon: ( +
    + +
    + ), + items: await runEaseOfUseChecks(config, formatMessage, options), +}); + +const useMetricsData = ( + config: Partial, +) => { + const [loading, setLoading] = useState(true); + const [data, setData] = useState(undefined); + const {formatMessage} = useIntl(); const prevTrialLicense = useSelector((state: GlobalState) => state.entities.admin.prevTrialLicense); const license = useSelector(getLicense); + // get the currently installed server version + const installedVersion = useSelector((state: GlobalState) => getServerVersion(state)); + const analytics = useSelector((state: GlobalState) => state.entities.admin.analytics) as unknown as Options['analytics']; + const canStartTrial = license?.IsLicensed !== 'true' && prevTrialLicense?.IsLicensed !== 'true'; const daysUntilExpiration = daysToLicenseExpire(license) || -1; @@ -87,358 +234,46 @@ const useMetricsData = () => { const [, contactSalesLink] = useOpenSalesLink(); - const trialOrEnterpriseCtaConfig = { + const trialOrEnterpriseCtaConfig = useMemo(() => ({ configUrl: canStartTrial ? ConsolePages.LICENSE : contactSalesLink, configText: canStartTrial ? formatMessage({id: 'admin.reporting.workspace_optimization.cta.startTrial', defaultMessage: 'Start trial'}) : formatMessage({id: 'admin.reporting.workspace_optimization.cta.upgradeLicense', defaultMessage: 'Contact sales'}), + }), [canStartTrial, contactSalesLink, formatMessage]); + + const options: Options = useMemo(() => ({ + isLicensed, + isEnterpriseLicense, + trialOrEnterpriseCtaConfig, + isStarterLicense, + isCloud, + analytics, + installedVersion, + }), [isLicensed, isEnterpriseLicense, trialOrEnterpriseCtaConfig, isStarterLicense, isCloud, analytics, installedVersion]); + + useEffect(() => { + setLoading(true); + const refreshData = async () => { + const data = { + updates: await getUpdatesData(config, formatMessage, options), + configuration: await getConfigurationData(config, formatMessage, options), + access: await getAccessData(config, formatMessage, options), + performance: await getPerformanceData(config, formatMessage, options), + dataPrivacy: await getDataPrivacyData(config, formatMessage, options), + easyManagement: await getEaseOfManagementData(config, formatMessage, options), + }; + + return data; + }; + + refreshData().then((data) => { + setData(data); + setLoading(false); + }); + }, [config, formatMessage, options]); + + return { + data, + loading, }; - - const getUpdatesData = (data: UpdatesParam) => ({ - title: formatMessage({ - id: 'admin.reporting.workspace_optimization.updates.title', - defaultMessage: 'Server updates', - }), - description: formatMessage({ - id: 'admin.reporting.workspace_optimization.updates.description', - defaultMessage: 'An update is available.', - }), - descriptionOk: formatMessage({ - id: 'admin.reporting.workspace_optimization.updates.descriptionOk', - defaultMessage: 'Your workspace is completely up to date!', - }), - icon: ( -
    - -
    - ), - items: [ - { - id: 'server_version', - title: formatMessage({ - id: 'admin.reporting.workspace_optimization.updates.server_version.status.title', - defaultMessage: '{type} version update available.', - }, {type: data.serverVersion.type}), - description: data.serverVersion.description, - configUrl: CloudLinks.DOWNLOAD_UPDATE, - configText: formatMessage({id: 'admin.reporting.workspace_optimization.cta.downloadUpdate', defaultMessage: 'Download update'}), - infoUrl: DocLinks.UPGRADE_SERVER, - infoText: formatMessage({id: 'admin.reporting.workspace_optimization.cta.learnMore', defaultMessage: 'Learn more'}), - telemetryAction: 'server-version', - status: data.serverVersion.status, - scoreImpact: 15, - impactModifier: impactModifiers[data.serverVersion.status], - }, - ], - }); - - type ConfigurationParam = { - ssl: { - status: ItemStatus; - }; - sessionLength: { - status: ItemStatus; - }; - } - - const getConfigurationData = (data: ConfigurationParam) => ({ - title: formatMessage({ - id: 'admin.reporting.workspace_optimization.configuration.title', - defaultMessage: 'Configuration', - }), - description: formatMessage({ - id: 'admin.reporting.workspace_optimization.configuration.description', - defaultMessage: 'You have configuration issues to resolve', - }), - hide: isCloud, - descriptionOk: formatMessage({ - id: 'admin.reporting.workspace_optimization.configuration.descriptionOk', - defaultMessage: 'You\'ve successfully configured SSL and Session Lengths!', - }), - icon: ( -
    - -
    - ), - items: [ - { - id: 'ssl', - title: formatMessage({ - id: 'admin.reporting.workspace_optimization.configuration.ssl.title', - defaultMessage: 'Configure SSL to make your server more secure', - }), - description: formatMessage({ - id: 'admin.reporting.workspace_optimization.configuration.ssl.description', - defaultMessage: 'We strongly recommend securing your Mattermost workspace by configuring SSL in production environments.', - }), - infoUrl: DocLinks.SSL_CERTIFICATE, - infoText: formatMessage({id: 'admin.reporting.workspace_optimization.cta.learnMore', defaultMessage: 'Learn more'}), - telemetryAction: 'ssl', - status: data.ssl.status, - scoreImpact: 25, - impactModifier: impactModifiers[data.ssl.status], - }, - { - id: 'session-length', - title: formatMessage({ - id: 'admin.reporting.workspace_optimization.configuration.session_length.title', - defaultMessage: 'Session lengths is set to default', - }), - description: formatMessage({ - id: 'admin.reporting.workspace_optimization.configuration.session_length.description', - defaultMessage: 'Your session length is set to the default of 30 days. A longer session length provides convenience, and a shorter session provides tighter security. We recommend adjusting this based on your organization\'s security policies.', - }), - configUrl: ConsolePages.SESSION_LENGTHS, - configText: formatMessage({id: 'admin.reporting.workspace_optimization.cta.configureSessionLength', defaultMessage: 'Configure session length'}), - infoUrl: DocLinks.SESSION_LENGTHS, - infoText: formatMessage({id: 'admin.reporting.workspace_optimization.cta.learnMore', defaultMessage: 'Learn more'}), - telemetryAction: 'session-length', - status: data.sessionLength.status, - scoreImpact: 8, - impactModifier: impactModifiers[data.sessionLength.status], - }, - ], - }); - - type AccessParam = { - siteUrl: { - status: ItemStatus; - }; - } - - const getAccessData = (data: AccessParam) => ({ - title: formatMessage({ - id: 'admin.reporting.workspace_optimization.access.title', - defaultMessage: 'Workspace access', - }), - description: formatMessage({ - id: 'admin.reporting.workspace_optimization.access.description', - defaultMessage: 'Web server configuration may be affecting access to your Mattermost workspace.', - }), - hide: isCloud, - descriptionOk: formatMessage({ - id: 'admin.reporting.workspace_optimization.access.descriptionOk', - defaultMessage: 'Your web server configuration is passing a live URL test!', - }), - icon: ( -
    - -
    - ), - items: [ - { - id: 'site-url', - title: formatMessage({ - id: 'admin.reporting.workspace_optimization.access.site_url.title', - defaultMessage: 'Misconfigured web server', - }), - description: formatMessage({ - id: 'admin.reporting.workspace_optimization.access.site_url.description', - defaultMessage: 'Your web server settings aren\'t passing a live URL test which means your workspace may not be accessible to users. We recommend updating your web server settings.', - }), - configUrl: ConsolePages.WEB_SERVER, - configText: formatMessage({id: 'admin.reporting.workspace_optimization.cta.configureWebServer', defaultMessage: 'Configure web server'}), - infoUrl: DocLinks.SITE_URL, - infoText: formatMessage({id: 'admin.reporting.workspace_optimization.cta.learnMore', defaultMessage: 'Learn more'}), - telemetryAction: 'site-url', - status: data.siteUrl.status, - scoreImpact: 12, - impactModifier: impactModifiers[data.siteUrl.status], - }, - ], - }); - - type PerformanceParam = { - search: { - status: ItemStatus; - }; - } - - const getPerformanceData = (data: PerformanceParam) => ({ - title: formatMessage({ - id: 'admin.reporting.workspace_optimization.performance.title', - defaultMessage: 'Performance', - }), - description: formatMessage({ - id: 'admin.reporting.workspace_optimization.performance.description', - defaultMessage: 'Your server would benefit from some performance tweaks.', - }), - hide: isCloud, - descriptionOk: formatMessage({ - id: 'admin.reporting.workspace_optimization.performance.descriptionOk', - defaultMessage: 'Your search performance suits your workspace usage!', - }), - icon: ( -
    - -
    - ), - items: [ - { - id: 'search', - title: formatMessage({ - id: 'admin.reporting.workspace_optimization.performance.search.title', - defaultMessage: 'Search performance', - }), - description: formatMessage({ - id: 'admin.reporting.workspace_optimization.performance.search.description', - defaultMessage: 'Your server has reached over 500 users and 2 million posts which can result in slow search performance. We recommend enabling Elasticsearch for better performance.', - }), - ...(isLicensed && isEnterpriseLicense ? { - configUrl: ConsolePages.ELASTICSEARCH, - configText: formatMessage({id: 'admin.reporting.workspace_optimization.cta.configureElasticsearch', defaultMessage: 'Try Elasticsearch'}), - } : trialOrEnterpriseCtaConfig), - infoUrl: DocLinks.ELASTICSEARCH, - infoText: formatMessage({id: 'admin.reporting.workspace_optimization.cta.learnMore', defaultMessage: 'Learn more'}), - telemetryAction: 'search-optimization', - status: data.search.status, - scoreImpact: 20, - impactModifier: impactModifiers[data.search.status], - }, - ], - }); - - type DataPrivacyParam = { - retention: { - status: ItemStatus; - }; - } - - // TBD - const getDataPrivacyData = (data: DataPrivacyParam) => ({ - title: formatMessage({ - id: 'admin.reporting.workspace_optimization.data_privacy.title', - defaultMessage: 'Data privacy', - }), - description: formatMessage({ - id: 'admin.reporting.workspace_optimization.data_privacy.description', - defaultMessage: 'Get better insight and control over your data.', - }), - descriptionOk: formatMessage({ - id: 'admin.reporting.workspace_optimization.data_privacy.descriptionOk', - defaultMessage: 'You\'ve enabled data retention and compliance features!', - }), - icon: ( -
    - -
    - ), - items: [ - { - id: 'data-retention', - title: formatMessage({ - id: 'admin.reporting.workspace_optimization.data_privacy.retention.title', - defaultMessage: 'Become more data aware', - }), - description: formatMessage({ - id: 'admin.reporting.workspace_optimization.data_privacy.retention.description', - defaultMessage: 'Organizations in highly regulated industries require more control and insight with their data. We recommend enabling Data Retention and Compliance features.', - }), - ...(isLicensed && isEnterpriseLicense ? { - configUrl: ConsolePages.DATA_RETENTION, - configText: formatMessage({id: 'admin.reporting.workspace_optimization.cta.configureDataRetention', defaultMessage: 'Try data retention'}), - } : trialOrEnterpriseCtaConfig), - infoUrl: DocLinks.DATA_RETENTION_POLICY, - infoText: formatMessage({id: 'admin.reporting.workspace_optimization.cta.learnMore', defaultMessage: 'Learn more'}), - telemetryAction: 'data-retention', - status: data.retention.status, - scoreImpact: 16, - impactModifier: impactModifiers[data.retention.status], - }, - ], - }); - - type EaseOfManagementParam = { - ldap: { - status: ItemStatus; - }; - guestAccounts?: { - status: ItemStatus; - }; - } - - // TBD - const getEaseOfManagementData = (data: EaseOfManagementParam) => ({ - title: formatMessage({ - id: 'admin.reporting.workspace_optimization.ease_of_management.title', - defaultMessage: 'Ease of management', - }), - description: formatMessage({ - id: 'admin.reporting.workspace_optimization.ease_of_management.description', - defaultMessage: 'Make it easier to manage your Mattermost workspace.', - }), - descriptionOk: formatMessage({ - id: 'admin.reporting.workspace_optimization.ease_of_management.descriptionOk', - defaultMessage: 'Your user authentication setup is appropriate based on your current usage!', - }), - icon: ( -
    - -
    - ), - items: [ - { - id: 'ad-ldap', - title: formatMessage({ - id: 'admin.reporting.workspace_optimization.ease_of_management.ldap.title', - defaultMessage: 'AD/LDAP integration recommended', - }), - description: formatMessage({ - id: 'admin.reporting.workspace_optimization.ease_of_management.ldap.description', - defaultMessage: 'You\'ve reached over 100 users! We recommend setting up AD/LDAP user authentication for easier onboarding as well as automated deactivations and role assignments.', - }), - ...(isLicensed && !isStarterLicense ? { - configUrl: ConsolePages.AD_LDAP, - configText: formatMessage({id: 'admin.reporting.workspace_optimization.cta.configureLDAP', defaultMessage: 'Try AD/LDAP'}), - } : trialOrEnterpriseCtaConfig), - infoUrl: DocLinks.AD_LDAP, - infoText: formatMessage({id: 'admin.reporting.workspace_optimization.cta.learnMore', defaultMessage: 'Learn more'}), - telemetryAction: 'ad-ldap', - status: data.ldap.status, - scoreImpact: 22, - impactModifier: impactModifiers[data.ldap.status], - }, - - // commented out for now. - // @see discussion here: https://github.com/mattermost/mattermost-webapp/pull/9822#discussion_r806879385 - // { - // id: 'guest-accounts', - // title: formatMessage({ - // id: 'admin.reporting.workspace_optimization.ease_of_management.guests_accounts.title', - // defaultMessage: 'Guest Accounts recommended', - // }), - // description: formatMessage({ - // id: 'admin.reporting.workspace_optimization.ease_of_management.guests_accounts.description', - // defaultMessage: 'Several user accounts are using different domains than your Site URL. You can control user access to channels and teams with guest accounts. We recommend starting an Enterprise trial and enabling Guest Access.', - // }), - // ...trialOrEnterpriseCtaConfig, - // infoUrl: 'https://docs.mattermost.com/onboard/guest-accounts.html', - // infoText: formatMessage({id: 'admin.reporting.workspace_optimization.cta.learnMore', defaultMessage: 'Learn more'}), - // telemetryAction: 'guest-accounts', - // status: data.guestAccounts.status, - // scoreImpact: 6, - // impactModifier: impactModifiers[data.guestAccounts.status], - // }, - ], - }); - - return {getAccessData, getConfigurationData, getUpdatesData, getPerformanceData, getDataPrivacyData, getEaseOfManagementData, isLicensed, isEnterpriseLicense}; }; export default useMetricsData; diff --git a/webapp/channels/src/components/admin_console/workspace-optimization/dashboard.tsx b/webapp/channels/src/components/admin_console/workspace-optimization/dashboard.tsx index 6fcbd8b6f3..2409601512 100644 --- a/webapp/channels/src/components/admin_console/workspace-optimization/dashboard.tsx +++ b/webapp/channels/src/components/admin_console/workspace-optimization/dashboard.tsx @@ -4,17 +4,11 @@ import {CheckIcon} from '@mattermost/compass-icons/components'; import classNames from 'classnames'; -import React, {useEffect, useState} from 'react'; -import {useIntl} from 'react-intl'; -import {useSelector} from 'react-redux'; +import React from 'react'; import styled from 'styled-components'; -import {GlobalState} from '@mattermost/types/store'; -import {getServerVersion} from 'mattermost-redux/selectors/entities/general'; -import {Client4} from 'mattermost-redux/client'; import Accordion, {AccordionItemType} from 'components/common/accordion/accordion'; -import {elasticsearchTest, ldapTest, testSiteURL} from '../../../actions/admin_actions'; import LoadingScreen from '../../loading_screen'; import FormattedAdminHeader from '../../widgets/admin_console/formatted_admin_header'; import {Props} from '../admin_console'; @@ -22,10 +16,11 @@ import {Props} from '../admin_console'; import ChipsList, {ChipsInfoType} from './chips_list'; import CtaButtons from './cta_buttons'; -import useMetricsData, {DataModel, ItemStatus, UpdatesParam} from './dashboard.data'; +import useMetricsData from './dashboard.data'; import './dashboard.scss'; import OverallScore from './overall-score'; +import {ItemStatus} from './dashboard.type'; const AccordionItem = styled.div` padding: 12px; @@ -49,180 +44,7 @@ const successIcon = ( ); const WorkspaceOptimizationDashboard = (props: Props) => { - const [loading, setLoading] = useState(true); - const [versionData, setVersionData] = useState({type: '', description: '', status: ItemStatus.NONE}); - - // const [guestAccountStatus, setGuestAccountStatus] = useState('none'); - const [liveUrlStatus, setLiveUrlStatus] = useState(ItemStatus.ERROR); - const [elastisearchStatus, setElasticsearchStatus] = useState(ItemStatus.INFO); - const [ldapStatus, setLdapStatus] = useState(ItemStatus.INFO); - const [dataRetentionStatus, setDataRetentionStatus] = useState(ItemStatus.INFO); - const {formatMessage} = useIntl(); - const {getAccessData, getConfigurationData, getUpdatesData, getPerformanceData, getDataPrivacyData, getEaseOfManagementData, isLicensed, isEnterpriseLicense} = useMetricsData(); - - // get the currently installed server version - const installedVersion = useSelector((state: GlobalState) => getServerVersion(state)); - const analytics = useSelector((state: GlobalState) => state.entities.admin.analytics); - const {TOTAL_USERS: totalUsers, TOTAL_POSTS: totalPosts} = analytics!; - - // gather locally available data - const { - ServiceSettings, - DataRetentionSettings, - ElasticsearchSettings, - LdapSettings, - - // TeamSettings, - // GuestAccountsSettings, - } = props.config; - const {location} = document; - - const sessionLengthWebInHours = ServiceSettings?.SessionLengthWebInHours || -1; - - const testURL = () => { - if (!ServiceSettings?.SiteURL) { - return Promise.resolve(); - } - - const onSuccess = ({status}: any) => setLiveUrlStatus(status === 'OK' ? ItemStatus.OK : ItemStatus.ERROR); - const onError = () => setLiveUrlStatus(ItemStatus.ERROR); - return testSiteURL(onSuccess, onError, ServiceSettings?.SiteURL); - }; - - const testDataRetention = async () => { - if (!isLicensed || !isEnterpriseLicense) { - return Promise.resolve(); - } - - if (DataRetentionSettings?.EnableMessageDeletion || DataRetentionSettings?.EnableFileDeletion) { - setDataRetentionStatus(ItemStatus.OK); - return Promise.resolve(); - } - - const result = await fetch(`${Client4.getBaseRoute()}/data_retention/policies?page=0&per_page=0`).then((result) => result.json()); - - setDataRetentionStatus(result.total_count > 0 ? ItemStatus.OK : ItemStatus.INFO); - return Promise.resolve(); - }; - - const fetchVersion = async () => { - const result = await fetch(`${Client4.getBaseRoute()}/latest_version`).then((result) => result.json()); - - if (result.tag_name) { - const sanitizedVersion = result.tag_name.startsWith('v') ? result.tag_name.slice(1) : result.tag_name; - const newVersionParts = sanitizedVersion.split('.'); - const installedVersionParts = installedVersion.split('.').slice(0, 3); - - // quick general check if a newer version is available - let type = ''; - let status: ItemStatus = ItemStatus.OK; - - if (newVersionParts.join('') > installedVersionParts.join('')) { - // get correct values to be inserted into the accordion item - switch (true) { - case newVersionParts[0] > installedVersionParts[0]: - type = formatMessage({ - id: 'admin.reporting.workspace_optimization.updates.server_version.update_type.major', - defaultMessage: 'Major', - }); - status = ItemStatus.ERROR; - break; - case newVersionParts[1] > installedVersionParts[1]: - type = formatMessage({ - id: 'admin.reporting.workspace_optimization.updates.server_version.update_type.minor', - defaultMessage: 'Minor', - }); - status = ItemStatus.WARNING; - break; - case newVersionParts[2] > installedVersionParts[2]: - type = formatMessage({ - id: 'admin.reporting.workspace_optimization.updates.server_version.update_type.patch', - defaultMessage: 'Patch', - }); - status = ItemStatus.INFO; - break; - } - } - - setVersionData({type, description: result.body, status}); - } - }; - - const testElasticsearch = () => { - if (!isLicensed || !isEnterpriseLicense || !(ElasticsearchSettings?.EnableIndexing && ElasticsearchSettings?.EnableSearching)) { - return Promise.resolve(); - } - - const onSuccess = ({status}: any) => setElasticsearchStatus(status === 'OK' ? ItemStatus.OK : ItemStatus.INFO); - const onError = () => setElasticsearchStatus(ItemStatus.INFO); - - return elasticsearchTest(props.config, onSuccess, onError); - }; - - const testLdap = () => { - if (!isLicensed || !LdapSettings?.Enable) { - return Promise.resolve(); - } - - const onSuccess = ({status}: any) => setLdapStatus(status === 'OK' ? ItemStatus.OK : ItemStatus.INFO); - const onError = () => setLdapStatus(ItemStatus.INFO); - - return ldapTest(onSuccess, onError); - }; - - // commented out for now. - // @see discussion here: https://github.com/mattermost/mattermost-webapp/pull/9822#discussion_r806879385 - // const fetchGuestAccounts = async () => { - // if (TeamSettings?.EnableOpenServer && GuestAccountsSettings?.Enable) { - // let usersArray = await fetch(`${Client4.getBaseRoute()}/users/invalid_emails`).then((result) => result.json()); - // - // // this setting is just a string with a list of domains, or an empty string - // if (GuestAccountsSettings?.RestrictCreationToDomains) { - // const domainList = GuestAccountsSettings?.RestrictCreationToDomains; - // usersArray = usersArray.filter(({email}: Record) => domainList.includes((email as string).split('@')[1])); - // } - // - // // if guest accounts make up more than 5% of the user base show the info accordion - // if (usersArray.length > (totalUsers as number * 0.05)) { - // setGuestAccountStatus(ItemStatus.INFO); - // return; - // } - // } - // - // setGuestAccountStatus(ItemStatus.OK); - // }; - - useEffect(() => { - const promises = []; - promises.push(testURL()); - promises.push(testLdap()); - promises.push(fetchVersion()); - promises.push(testElasticsearch()); - promises.push(testDataRetention()); - - // promises.push(fetchGuestAccounts()); - Promise.all(promises).then(() => setLoading(false)); - }, [props.config, isLicensed, isEnterpriseLicense]); - - const data: DataModel = { - updates: getUpdatesData({serverVersion: versionData}), - configuration: getConfigurationData({ - ssl: {status: location.protocol === 'https:' ? ItemStatus.OK : ItemStatus.ERROR}, - sessionLength: {status: sessionLengthWebInHours === 720 ? ItemStatus.INFO : ItemStatus.OK}, - }), - access: getAccessData({siteUrl: {status: liveUrlStatus}}), - performance: getPerformanceData({ - search: { - status: totalPosts < 2_000_000 && totalUsers < 500 ? ItemStatus.OK : elastisearchStatus, - }, - }), - dataPrivacy: getDataPrivacyData({retention: {status: dataRetentionStatus}}), - easyManagement: getEaseOfManagementData({ - ldap: {status: totalUsers < 100 ? ItemStatus.OK : ldapStatus}, - - // guestAccounts: {status: guestAccountStatus}, - }), - }; + const {data, loading} = useMetricsData(props.config); const overallScoreChips: ChipsInfoType = { [ItemStatus.INFO]: 0, @@ -236,7 +58,7 @@ const WorkspaceOptimizationDashboard = (props: Props) => { }; // eslint-disable-next-line @typescript-eslint/no-unused-vars - const accData: AccordionItemType[] = Object.entries(data).filter(([_, y]) => !y.hide).map(([accordionKey, accordionData]) => { + const accordionItemsData: AccordionItemType[] | undefined = data && Object.entries(data).filter(([_, y]) => !y.hide).map(([accordionKey, accordionData]) => { const accordionDataChips: ChipsInfoType = { [ItemStatus.INFO]: 0, [ItemStatus.WARNING]: 0, @@ -297,7 +119,7 @@ const WorkspaceOptimizationDashboard = (props: Props) => { }; }); - return loading ? : ( + return loading || !accordionItemsData ? : (
    { chartValue={Math.floor((overallScore.current / overallScore.max) * 100)} />
    diff --git a/webapp/channels/src/components/admin_console/workspace-optimization/dashboard.type.ts b/webapp/channels/src/components/admin_console/workspace-optimization/dashboard.type.ts new file mode 100644 index 0000000000..b87c9d1bdd --- /dev/null +++ b/webapp/channels/src/components/admin_console/workspace-optimization/dashboard.type.ts @@ -0,0 +1,75 @@ +// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. +// See LICENSE.txt for license information. + +export type DataModel = { + [key: string]: { + title: string; + description: string; + descriptionOk: string; + items: ItemModel[]; + icon: React.ReactNode; + hide?: boolean; + }; +} + +export enum ItemStatus { + + /** Return NONE if it's not relevant, not configured, or not an option */ + NONE = 'none', + + /** Return OK if all checks for this have passed */ + OK = 'ok', + + /** Return info if it might not be relevant to them, but they could utilize it */ + INFO = 'info', + WARNING = 'warning', + ERROR = 'error', +} + +export type ItemModel = { + id: string; + title: string; + description: string; + status: ItemStatus; + scoreImpact: number; + impactModifier: number; + configUrl?: string; + configText?: string; + telemetryAction?: string; + infoUrl?: string; + infoText?: string; +} + +export type UpdatesParam = { + serverVersion: { + type: string; + status: ItemStatus; + description: string; + }; +} + +type Analytics = { + DAILY_ACTIVE_USERS: number; + MONTHLY_ACTIVE_USERS: number; + TOTAL_INACTIVE_USERS: number; + TOTAL_MASTER_DB_CONNECTIONS: number; + TOTAL_POSTS: number; + TOTAL_PRIVATE_GROUPS: number; + TOTAL_PUBLIC_CHANNELS: number; + TOTAL_READ_DB_CONNECTIONS: number; + TOTAL_TEAMS: number; + TOTAL_USERS: number; + TOTAL_WEBSOCKET_CONNECTIONS: number; +} +export type Options = { + isLicensed: boolean; + isEnterpriseLicense: boolean; + trialOrEnterpriseCtaConfig: { + configUrl: string; + configText: string; + }; + isCloud: boolean; + isStarterLicense: boolean; + analytics: Analytics | undefined; + installedVersion: string; +}; diff --git a/webapp/channels/src/components/admin_console/workspace-optimization/dashboard_checks/access.ts b/webapp/channels/src/components/admin_console/workspace-optimization/dashboard_checks/access.ts new file mode 100644 index 0000000000..e8f37024bb --- /dev/null +++ b/webapp/channels/src/components/admin_console/workspace-optimization/dashboard_checks/access.ts @@ -0,0 +1,66 @@ +// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. +// See LICENSE.txt for license information. + +import {useIntl} from 'react-intl'; +import {ItemModel, ItemStatus} from '../dashboard.type'; +import {ConsolePages, DocLinks} from 'utils/constants'; +import {impactModifiers} from '../dashboard.data'; +import {AdminConfig} from '@mattermost/types/config'; +import {testSiteURL} from 'actions/admin_actions'; + +/** + * + * @description Checking to see if the siteURL is configured correctly by running it through the same "check siteURL" button that exists on the webserver page. + */ +const siteURLCheck = async (config: Partial, formatMessage: ReturnType['formatMessage']): Promise => { + let status = ItemStatus.OK; + const testURL = async () => { + if (!config.ServiceSettings?.SiteURL) { + status = ItemStatus.ERROR; + } + + const onSuccess = ({status: s}: any) => { + if (s === 'OK') { + status = ItemStatus.OK; + } + }; + const onError = () => { + status = ItemStatus.ERROR; + }; + await testSiteURL(onSuccess, onError, config.ServiceSettings?.SiteURL); + }; + + await testURL(); + return { + id: 'site-url', + title: formatMessage({ + id: 'admin.reporting.workspace_optimization.access.site_url.title', + defaultMessage: 'Misconfigured web server', + }), + description: formatMessage({ + id: 'admin.reporting.workspace_optimization.access.site_url.description', + defaultMessage: 'Your web server settings aren\'t passing a live URL test which means your workspace may not be accessible to users. We recommend updating your web server settings.', + }), + configUrl: ConsolePages.WEB_SERVER, + configText: formatMessage({id: 'admin.reporting.workspace_optimization.access.site_url.cta', defaultMessage: 'Configure web server'}), + infoUrl: DocLinks.SITE_URL, + infoText: formatMessage({id: 'admin.reporting.workspace_optimization.cta.learnMore', defaultMessage: 'Learn more'}), + telemetryAction: 'site-url', + status, + scoreImpact: 12, + impactModifier: impactModifiers[status], + }; +}; + +const checks = [ + siteURLCheck, +]; + +export const runAccessChecks = async ( + config: Partial, + formatMessage: ReturnType['formatMessage'], +) => { + const results = await Promise.all(checks.map((check) => check(config, formatMessage))); + return results; +}; + diff --git a/webapp/channels/src/components/admin_console/workspace-optimization/dashboard_checks/config.ts b/webapp/channels/src/components/admin_console/workspace-optimization/dashboard_checks/config.ts new file mode 100644 index 0000000000..3cc59e7939 --- /dev/null +++ b/webapp/channels/src/components/admin_console/workspace-optimization/dashboard_checks/config.ts @@ -0,0 +1,84 @@ +// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. +// See LICENSE.txt for license information. + +/* eslint-disable @typescript-eslint/no-unused-vars */ + +import {AdminConfig} from '@mattermost/types/config'; +import {useIntl} from 'react-intl'; +import {ConsolePages, DocLinks} from 'utils/constants'; +import {ItemModel, ItemStatus, Options} from '../dashboard.type'; +import {impactModifiers} from '../dashboard.data'; + +/** + * + * @description This checks to see if the user's active session is done over https. This does not check if the server is configured to use https. + */ +const ssl = ( + config: Partial, + formatMessage: ReturnType['formatMessage'], + options: Options, +): ItemModel => { + const status = document.location.protocol === 'https:' ? ItemStatus.OK : ItemStatus.ERROR; + + return { + id: 'ssl', + title: formatMessage({ + id: 'admin.reporting.workspace_optimization.configuration.ssl.title', + defaultMessage: 'Configure SSL to make your server more secure', + }), + description: formatMessage({ + id: 'admin.reporting.workspace_optimization.configuration.ssl.description', + defaultMessage: 'We strongly recommend securing your Mattermost workspace by configuring SSL in production environments.', + }), + infoUrl: DocLinks.SSL_CERTIFICATE, + infoText: formatMessage({id: 'admin.reporting.workspace_optimization.cta.learnMore', defaultMessage: 'Learn more'}), + telemetryAction: 'ssl', + status, + scoreImpact: 25, + impactModifier: impactModifiers[status], + }; +}; + +/** + * + * @description This checks to see if the user has adjusted the default session lengths to something other than 720 hours. + */ +const sessionLength = ( + config: Partial, + formatMessage: ReturnType['formatMessage'], + options: Options, +): ItemModel => { + const status = config.ServiceSettings?.SessionLengthMobileInHours === 720 ? ItemStatus.INFO : ItemStatus.OK; + return { + id: 'session-length', + title: formatMessage({ + id: 'admin.reporting.workspace_optimization.configuration.session_length.title', + defaultMessage: 'Session lengths is set to default', + }), + description: formatMessage({ + id: 'admin.reporting.workspace_optimization.configuration.session_length.description', + defaultMessage: 'Your session length is set to the default of 30 days. A longer session length provides convenience, and a shorter session provides tighter security. We recommend adjusting this based on your organization\'s security policies.', + }), + configUrl: ConsolePages.SESSION_LENGTHS, + configText: formatMessage({id: 'admin.reporting.workspace_optimization.configuration.session_length.cta', defaultMessage: 'Configure session length'}), + infoUrl: DocLinks.SESSION_LENGTHS, + infoText: formatMessage({id: 'admin.reporting.workspace_optimization.cta.learnMore', defaultMessage: 'Learn more'}), + telemetryAction: 'session-length', + status, + scoreImpact: 8, + impactModifier: impactModifiers[status], + }; +}; + +export const runConfigChecks = async ( + config: Partial, + formatMessage: ReturnType['formatMessage'], + options: Options, +) => { + const checks = [ + ssl, + sessionLength, + ]; + const results = await Promise.all(checks.map((check) => check(config, formatMessage, options))); + return results; +}; diff --git a/webapp/channels/src/components/admin_console/workspace-optimization/dashboard_checks/data_privacy.ts b/webapp/channels/src/components/admin_console/workspace-optimization/dashboard_checks/data_privacy.ts new file mode 100644 index 0000000000..049f90015c --- /dev/null +++ b/webapp/channels/src/components/admin_console/workspace-optimization/dashboard_checks/data_privacy.ts @@ -0,0 +1,70 @@ +// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. +// See LICENSE.txt for license information. + +import {useIntl} from 'react-intl'; +import {impactModifiers} from '../dashboard.data'; +import {ConsolePages, DocLinks} from 'utils/constants'; +import {Client4} from 'mattermost-redux/client'; +import {ItemStatus, Options} from '../dashboard.type'; +import {AdminConfig} from '@mattermost/types/config'; + +/** + * + * @description Checks if they they have a global policy deletion enabled, or if a custom policy has been created. + */ +const dataRetentionCheck = async ( + config: Partial, + formatMessage: ReturnType['formatMessage'], + options: Options, +) => { + const testDataRetention = async ( + config: Partial, + options: Options, + ) => { + if (!options.isLicensed || !options.isEnterpriseLicense) { + return ItemStatus.INFO; + } + + if (config.DataRetentionSettings?.EnableMessageDeletion || config.DataRetentionSettings?.EnableFileDeletion) { + return ItemStatus.OK; + } + + const policyCount: {total_count: number} = await fetch(`${Client4.getBaseRoute()}/data_retention/policies_count`).then((result) => result.json()); + return policyCount.total_count > 0 ? ItemStatus.OK : ItemStatus.INFO; + }; + + const status = await testDataRetention(config, options); + return { + id: 'data-retention', + title: formatMessage({ + id: 'admin.reporting.workspace_optimization.data_privacy.retention.title', + defaultMessage: 'Become more data aware', + }), + description: formatMessage({ + id: 'admin.reporting.workspace_optimization.data_privacy.retention.description', + defaultMessage: 'Organizations in highly regulated industries require more control and insight with their data. We recommend enabling Data Retention and Compliance features.', + }), + ...(options.isLicensed && options.isEnterpriseLicense ? { + configUrl: ConsolePages.DATA_RETENTION, + configText: formatMessage({id: 'admin.reporting.workspace_optimization.data_privacy.retention.cta', defaultMessage: 'Try data retention'}), + } : options.trialOrEnterpriseCtaConfig), + infoUrl: DocLinks.DATA_RETENTION_POLICY, + infoText: formatMessage({id: 'admin.reporting.workspace_optimization.cta.learnMore', defaultMessage: 'Learn more'}), + telemetryAction: 'data-retention', + status, + scoreImpact: 16, + impactModifier: impactModifiers[status], + }; +}; + +export const runDataPrivacyChecks = async ( + config: Partial, + formatMessage: ReturnType['formatMessage'], + options: Options, +) => { + const checks = [ + dataRetentionCheck, + ]; + const results = await Promise.all(checks.map((check) => check(config, formatMessage, options))); + return results; +}; diff --git a/webapp/channels/src/components/admin_console/workspace-optimization/dashboard_checks/easy_management.ts b/webapp/channels/src/components/admin_console/workspace-optimization/dashboard_checks/easy_management.ts new file mode 100644 index 0000000000..1a959918ad --- /dev/null +++ b/webapp/channels/src/components/admin_console/workspace-optimization/dashboard_checks/easy_management.ts @@ -0,0 +1,129 @@ +// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. +// See LICENSE.txt for license information. + +import {AdminConfig} from '@mattermost/types/config'; +import {useIntl} from 'react-intl'; +import {ItemModel, ItemStatus, Options} from '../dashboard.type'; +import {ConsolePages, DocLinks} from 'utils/constants'; +import {impactModifiers} from '../dashboard.data'; + +// import {Client4} from 'mattermost-redux/client'; +// import {AnalyticsRow} from '@mattermost/types/admin'; +import {ldapTest} from 'actions/admin_actions'; + +const usesLDAP = async ( + config: Partial, + formatMessage: ReturnType['formatMessage'], + options: Options, +): Promise => { + const testLdap = async ( + config: Partial, + options: Options, + ): Promise => { + let check = ItemStatus.INFO; + + if (!options.isLicensed || !config.LdapSettings?.Enable) { + return check; + } + + const onSuccess = ({status}: any) => { + if (status === 'OK') { + check = ItemStatus.OK; + } + }; + + await ldapTest(onSuccess); + + return check; + }; + + // something feels flawed in this check. + const status = options.analytics?.TOTAL_USERS as number > 100 ? await testLdap(config, options) : ItemStatus.OK; + + return { + id: 'ad-ldap', + title: formatMessage({ + id: 'admin.reporting.workspace_optimization.ease_of_management.ldap.title', + defaultMessage: 'AD/LDAP integration recommended', + }), + description: formatMessage({ + id: 'admin.reporting.workspace_optimization.ease_of_management.ldap.description', + defaultMessage: 'You\'ve reached over 100 users! We recommend setting up AD/LDAP user authentication for easier onboarding as well as automated deactivations and role assignments.', + }), + ...(options.isLicensed && !options.isStarterLicense ? { + configUrl: ConsolePages.AD_LDAP, + configText: formatMessage({id: 'admin.reporting.workspace_optimization.ease_of_management.ldap.cta', defaultMessage: 'Try AD/LDAP'}), + } : options.trialOrEnterpriseCtaConfig), + infoUrl: DocLinks.AD_LDAP, + infoText: formatMessage({id: 'admin.reporting.workspace_optimization.cta.learnMore', defaultMessage: 'Learn more'}), + telemetryAction: 'ad-ldap', + status, + scoreImpact: 22, + impactModifier: impactModifiers[status], + }; +}; + +// // commented out for now. +// // @see discussion here: https://github.com/mattermost/mattermost-webapp/pull/9822#discussion_r806879385 +// const fetchGuestAccounts = async ( +// config: Partial, +// analytics: Record | undefined, +// ) => { +// if (config.TeamSettings?.EnableOpenServer && config.GuestAccountsSettings?.Enable) { +// let usersArray = await fetch(`${Client4.getBaseRoute()}/users/invalid_emails`).then((result) => result.json()); + +// // this setting is just a string with a list of domains, or an empty string +// if (config.GuestAccountsSettings?.RestrictCreationToDomains) { +// const domainList = config.GuestAccountsSettings?.RestrictCreationToDomains; +// usersArray = usersArray.filter(({email}: Record) => domainList.includes((email as string).split('@')[1])); +// } + +// // if guest accounts make up more than 5% of the user base show the info accordion +// if (analytics && usersArray.length > (analytics.totalUsers as number * 0.05)) { +// return ItemStatus.INFO; +// } +// } + +// return ItemStatus.OK; +// }; + +// const guestAccounts = async ( +// config: Partial, +// formatMessage: ReturnType['formatMessage'], +// options: Options, +// ): Promise => { +// const status = await fetchGuestAccounts(config, options.analytics); +// return { +// id: 'guest-accounts', +// title: formatMessage({ +// id: 'admin.reporting.workspace_optimization.ease_of_management.guests_accounts.title', +// defaultMessage: 'Guest Accounts recommended', +// }), +// description: formatMessage({ +// id: 'admin.reporting.workspace_optimization.ease_of_management.guests_accounts.description', +// defaultMessage: 'Several user accounts are using different domains than your Site URL. You can control user access to channels and teams with guest accounts. We recommend starting an Enterprise trial and enabling Guest Access.', +// }), +// ...options.trialOrEnterpriseCtaConfig, +// infoUrl: 'https://docs.mattermost.com/onboard/guest-accounts.html', +// infoText: formatMessage({id: 'admin.reporting.workspace_optimization.cta.learnMore', defaultMessage: 'Learn more'}), +// telemetryAction: 'guest-accounts', +// status, +// scoreImpact: 6, +// impactModifier: impactModifiers[status], +// }; +// }; + +export const runEaseOfUseChecks = async ( + config: Partial, + formatMessage: ReturnType['formatMessage'], + options: Options, +): Promise => { + const checks = [ + usesLDAP, + + // guestAccounts, + ]; + + const results = await Promise.all(checks.map((check) => check(config, formatMessage, options))); + return results; +}; diff --git a/webapp/channels/src/components/admin_console/workspace-optimization/dashboard_checks/performance.ts b/webapp/channels/src/components/admin_console/workspace-optimization/dashboard_checks/performance.ts new file mode 100644 index 0000000000..50d7f6f662 --- /dev/null +++ b/webapp/channels/src/components/admin_console/workspace-optimization/dashboard_checks/performance.ts @@ -0,0 +1,72 @@ +// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. +// See LICENSE.txt for license information. + +import {AdminConfig} from '@mattermost/types/config'; +import {ItemModel, ItemStatus, Options} from '../dashboard.type'; +import {elasticsearchTest} from 'actions/admin_actions'; +import {useIntl} from 'react-intl'; +import {ConsolePages, DocLinks} from 'utils/constants'; +import {impactModifiers} from '../dashboard.data'; + +const search = async ( + config: Partial, + formatMessage: ReturnType['formatMessage'], + options: Options, +): Promise => { + const testElasticsearch = async ( + config: Partial, + options: Options, + ) => { + let check = ItemStatus.INFO; + + if (!options.isLicensed || !options.isEnterpriseLicense || !(config.ElasticsearchSettings?.EnableIndexing && config.ElasticsearchSettings?.EnableSearching)) { + return check; + } + + const onSuccess = ({status}: any) => { + if (status === 'OK') { + check = ItemStatus.OK; + } + }; + await elasticsearchTest(config, onSuccess); + return check; + }; + + const totalPosts = options.analytics?.TOTAL_POSTS as number; + const totalUsers = options.analytics?.TOTAL_USERS as number; + const status = totalPosts < 2_000_000 && totalUsers < 500 ? ItemStatus.OK : await testElasticsearch(config, options); + return { + id: 'search', + title: formatMessage({ + id: 'admin.reporting.workspace_optimization.performance.search.title', + defaultMessage: 'Search performance', + }), + description: formatMessage({ + id: 'admin.reporting.workspace_optimization.performance.search.description', + defaultMessage: 'Your server has reached over 500 users and 2 million posts which can result in slow search performance. We recommend enabling Elasticsearch for better performance.', + }), + ...(options.isLicensed && options.isEnterpriseLicense ? { + configUrl: ConsolePages.ELASTICSEARCH, + configText: formatMessage({id: 'admin.reporting.workspace_optimization.search.cta', defaultMessage: 'Try Elasticsearch'}), + } : options.trialOrEnterpriseCtaConfig), + infoUrl: DocLinks.ELASTICSEARCH, + infoText: formatMessage({id: 'admin.reporting.workspace_optimization.cta.learnMore', defaultMessage: 'Learn more'}), + telemetryAction: 'search-optimization', + status, + scoreImpact: 20, + impactModifier: impactModifiers[status], + }; +}; + +export const runPerformanceChecks = async ( + config: Partial, + formatMessage: ReturnType['formatMessage'], + options: Options, +) => { + const checks = [ + search, + ]; + + const results = await Promise.all(checks.map((check) => check(config, formatMessage, options))); + return results; +}; diff --git a/webapp/channels/src/components/admin_console/workspace-optimization/dashboard_checks/updates.ts b/webapp/channels/src/components/admin_console/workspace-optimization/dashboard_checks/updates.ts new file mode 100644 index 0000000000..438e358f6d --- /dev/null +++ b/webapp/channels/src/components/admin_console/workspace-optimization/dashboard_checks/updates.ts @@ -0,0 +1,94 @@ +// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. +// See LICENSE.txt for license information. + +import {Client4} from 'mattermost-redux/client'; +import {ItemStatus, Options} from '../dashboard.type'; +import {useIntl} from 'react-intl'; +import {AdminConfig} from '@mattermost/types/config'; +import {CloudLinks, DocLinks} from 'utils/constants'; +import {impactModifiers} from '../dashboard.data'; + +const testServerVersion = async ( + config: Partial, + formatMessage: ReturnType['formatMessage'], + options: Options, +) => { + const fetchVersion = async ( + installedVersion: string, + formatMessage: ReturnType['formatMessage'], + ) => { + const result = await fetch(`${Client4.getBaseRoute()}/latest_version`).then((result) => result.json()); + + if (result.tag_name) { + const sanitizedVersion = result.tag_name.startsWith('v') ? result.tag_name.slice(1) : result.tag_name; + const newVersionParts = sanitizedVersion.split('.'); + const installedVersionParts = installedVersion.split('.').slice(0, 3); + + // quick general check if a newer version is available + let type = ''; + let status: ItemStatus = ItemStatus.OK; + + if (newVersionParts.join('') > installedVersionParts.join('')) { + // get correct values to be inserted into the accordion item + switch (true) { + case newVersionParts[0] > installedVersionParts[0]: + type = formatMessage({ + id: 'admin.reporting.workspace_optimization.updates.server_version.update_type.major', + defaultMessage: 'Major', + }); + status = ItemStatus.ERROR; + break; + case newVersionParts[1] > installedVersionParts[1]: + type = formatMessage({ + id: 'admin.reporting.workspace_optimization.updates.server_version.update_type.minor', + defaultMessage: 'Minor', + }); + status = ItemStatus.WARNING; + break; + case newVersionParts[2] > installedVersionParts[2]: + type = formatMessage({ + id: 'admin.reporting.workspace_optimization.updates.server_version.update_type.patch', + defaultMessage: 'Patch', + }); + status = ItemStatus.INFO; + break; + } + } + + return {type, description: result.body, status}; + } + + return {type: '', description: '', status: ItemStatus.OK}; + }; + + const serverVersion = await fetchVersion(options.installedVersion, formatMessage); + return { + id: 'server_version', + title: formatMessage({ + id: 'admin.reporting.workspace_optimization.updates.server_version.status.title', + defaultMessage: '{type} version update available.', + }, {type: serverVersion.type}), + description: serverVersion.description, + configUrl: CloudLinks.DOWNLOAD_UPDATE, + configText: formatMessage({id: 'admin.reporting.workspace_optimization.updates.server_version.cta', defaultMessage: 'Download update'}), + infoUrl: DocLinks.UPGRADE_SERVER, + infoText: formatMessage({id: 'admin.reporting.workspace_optimization.cta.learnMore', defaultMessage: 'Learn more'}), + telemetryAction: 'server-version', + status: serverVersion.status, + scoreImpact: 15, + impactModifier: impactModifiers[serverVersion.status], + }; +}; + +export const runUpdateChecks = async ( + config: Partial, + formatMessage: ReturnType['formatMessage'], + options: Options, +) => { + const checks = [ + testServerVersion, + ]; + + const results = await Promise.all(checks.map((check) => check(config, formatMessage, options))); + return results; +}; diff --git a/webapp/channels/src/components/advanced_create_comment/advanced_create_comment.test.jsx b/webapp/channels/src/components/advanced_create_comment/advanced_create_comment.test.jsx index ef81ba5823..ee907be96f 100644 --- a/webapp/channels/src/components/advanced_create_comment/advanced_create_comment.test.jsx +++ b/webapp/channels/src/components/advanced_create_comment/advanced_create_comment.test.jsx @@ -40,6 +40,7 @@ describe('components/AdvancedCreateComment', () => { uploadsInProgress: [{}], fileInfos: [{}, {}, {}], }, + isRemoteDraft: false, enableAddButton: true, ctrlSend: false, latestPostId, @@ -84,9 +85,10 @@ describe('components/AdvancedCreateComment', () => { test('should match snapshot, empty comment', () => { const draft = emptyDraft; + const isRemoteDraft = false; const enableAddButton = false; const ctrlSend = true; - const props = {...baseProps, draft, enableAddButton, ctrlSend}; + const props = {...baseProps, draft, isRemoteDraft, enableAddButton, ctrlSend}; const wrapper = shallow( , @@ -104,8 +106,9 @@ describe('components/AdvancedCreateComment', () => { uploadsInProgress: [], fileInfos: [], }; + const isRemoteDraft = false; const ctrlSend = true; - const props = {...baseProps, ctrlSend, draft, clearCommentDraftUploads, onResetHistoryIndex, getChannelMemberCountsByGroup}; + const props = {...baseProps, ctrlSend, draft, isRemoteDraft, clearCommentDraftUploads, onResetHistoryIndex, getChannelMemberCountsByGroup}; const wrapper = shallow( , diff --git a/webapp/channels/src/components/advanced_create_comment/advanced_create_comment.tsx b/webapp/channels/src/components/advanced_create_comment/advanced_create_comment.tsx index b0679ea814..63c2a57bd5 100644 --- a/webapp/channels/src/components/advanced_create_comment/advanced_create_comment.tsx +++ b/webapp/channels/src/components/advanced_create_comment/advanced_create_comment.tsx @@ -13,6 +13,7 @@ import * as GlobalActions from 'actions/global_actions'; import Constants, {AdvancedTextEditor as AdvancedTextEditorConst, Locations, ModalIdentifiers, Preferences} from 'utils/constants'; import {PreferenceType} from '@mattermost/types/preferences'; +import * as Keyboard from 'utils/keyboard'; import * as UserAgent from 'utils/user_agent'; import * as Utils from 'utils/utils'; import { @@ -73,6 +74,9 @@ type Props = { // The current draft of the comment draft: PostDraft; + // Data used for knowing if the draft came from a WS event + isRemoteDraft: boolean; + // Determines if the submit button should be rendered enableAddButton?: boolean; @@ -232,8 +236,14 @@ class AdvancedCreateComment extends React.PureComponent { const rootChanged = props.rootId !== state.rootId; const messageInHistoryChanged = props.messageInHistory !== state.messageInHistory; - if (rootChanged || messageInHistoryChanged || props.draft.remote) { - updatedState = {...updatedState, draft: {...props.draft, uploadsInProgress: rootChanged ? [] : props.draft.uploadsInProgress}}; + if (rootChanged || messageInHistoryChanged || (props.isRemoteDraft && props.draft.message !== state.draft?.message)) { + updatedState = { + ...updatedState, + draft: { + ...props.draft, + uploadsInProgress: rootChanged ? [] : props.draft.uploadsInProgress, + }, + }; } return updatedState; @@ -251,6 +261,7 @@ class AdvancedCreateComment extends React.PureComponent { serverError: null, showFormat: false, isFormattingBarHidden: props.isFormattingBarHidden, + caretPosition: props.draft.caretPosition, }; this.textboxRef = React.createRef(); @@ -342,7 +353,6 @@ class AdvancedCreateComment extends React.PureComponent { const updatedDraft = { ...this.state.draft, show: !isDraftEmpty(this.state.draft), - remote: false, } as PostDraft; this.props.onUpdateCommentDraft(updatedDraft, true); @@ -355,7 +365,6 @@ class AdvancedCreateComment extends React.PureComponent { draft: { ...prev.draft, show: !isDraftEmpty(prev.draft), - remote: false, } as PostDraft, }; } @@ -819,11 +828,11 @@ class AdvancedCreateComment extends React.PureComponent { handleKeyDown = (e: React.KeyboardEvent) => { const ctrlOrMetaKeyPressed = e.ctrlKey || e.metaKey; - const lastMessageReactionKeyCombo = ctrlOrMetaKeyPressed && e.shiftKey && Utils.isKeyPressed(e, KeyCodes.BACK_SLASH); + const lastMessageReactionKeyCombo = ctrlOrMetaKeyPressed && e.shiftKey && Keyboard.isKeyPressed(e, KeyCodes.BACK_SLASH); - const ctrlKeyCombo = Utils.cmdOrCtrlPressed(e) && !e.altKey && !e.shiftKey; - const ctrlAltCombo = Utils.cmdOrCtrlPressed(e, true) && e.altKey; - const shiftAltCombo = !Utils.cmdOrCtrlPressed(e) && e.shiftKey && e.altKey; + const ctrlKeyCombo = Keyboard.cmdOrCtrlPressed(e) && !e.altKey && !e.shiftKey; + const ctrlAltCombo = Keyboard.cmdOrCtrlPressed(e, true) && e.altKey; + const shiftAltCombo = !Keyboard.cmdOrCtrlPressed(e) && e.shiftKey && e.altKey; // listen for line break key combo and insert new line character if (Utils.isUnhandledLineBreakKeyCombo(e)) { @@ -838,7 +847,7 @@ class AdvancedCreateComment extends React.PureComponent { if ( (this.props.ctrlSend || this.props.codeBlockOnCtrlEnter) && - Utils.isKeyPressed(e, KeyCodes.ENTER) && + Keyboard.isKeyPressed(e, KeyCodes.ENTER) && (e.ctrlKey || e.metaKey) ) { this.setShowPreview(false); @@ -849,7 +858,7 @@ class AdvancedCreateComment extends React.PureComponent { const draft = this.state.draft!; const {message} = draft; - if (Utils.isKeyPressed(e, KeyCodes.ESCAPE)) { + if (Keyboard.isKeyPressed(e, KeyCodes.ESCAPE)) { this.textboxRef.current?.blur(); } @@ -858,7 +867,7 @@ class AdvancedCreateComment extends React.PureComponent { !e.metaKey && !e.altKey && !e.shiftKey && - Utils.isKeyPressed(e, KeyCodes.UP) && + Keyboard.isKeyPressed(e, KeyCodes.UP) && message === '' ) { e.preventDefault(); @@ -879,13 +888,13 @@ class AdvancedCreateComment extends React.PureComponent { } = e.target as TextboxElement; if (ctrlKeyCombo) { - if (Utils.isKeyPressed(e, KeyCodes.UP)) { + if (Keyboard.isKeyPressed(e, KeyCodes.UP)) { e.preventDefault(); this.props.onMoveHistoryIndexBack(); - } else if (Utils.isKeyPressed(e, KeyCodes.DOWN)) { + } else if (Keyboard.isKeyPressed(e, KeyCodes.DOWN)) { e.preventDefault(); this.props.onMoveHistoryIndexForward(); - } else if (Utils.isKeyPressed(e, KeyCodes.B)) { + } else if (Keyboard.isKeyPressed(e, KeyCodes.B)) { e.stopPropagation(); e.preventDefault(); this.applyMarkdown({ @@ -894,7 +903,7 @@ class AdvancedCreateComment extends React.PureComponent { selectionEnd, message: value, }); - } else if (Utils.isKeyPressed(e, KeyCodes.I)) { + } else if (Keyboard.isKeyPressed(e, KeyCodes.I)) { e.stopPropagation(); e.preventDefault(); this.applyMarkdown({ @@ -905,7 +914,7 @@ class AdvancedCreateComment extends React.PureComponent { }); } } else if (ctrlAltCombo) { - if (Utils.isKeyPressed(e, KeyCodes.K)) { + if (Keyboard.isKeyPressed(e, KeyCodes.K)) { e.stopPropagation(); e.preventDefault(); this.applyMarkdown({ @@ -914,7 +923,7 @@ class AdvancedCreateComment extends React.PureComponent { selectionEnd, message: value, }); - } else if (Utils.isKeyPressed(e, KeyCodes.C)) { + } else if (Keyboard.isKeyPressed(e, KeyCodes.C)) { e.stopPropagation(); e.preventDefault(); this.applyMarkdown({ @@ -923,21 +932,21 @@ class AdvancedCreateComment extends React.PureComponent { selectionEnd, message: value, }); - } else if (Utils.isKeyPressed(e, KeyCodes.E)) { + } else if (Keyboard.isKeyPressed(e, KeyCodes.E)) { e.stopPropagation(); e.preventDefault(); this.toggleEmojiPicker(); - } else if (Utils.isKeyPressed(e, KeyCodes.T)) { + } else if (Keyboard.isKeyPressed(e, KeyCodes.T)) { e.stopPropagation(); e.preventDefault(); this.toggleAdvanceTextEditor(); - } else if (Utils.isKeyPressed(e, KeyCodes.P) && draft.message.length) { + } else if (Keyboard.isKeyPressed(e, KeyCodes.P) && draft.message.length) { e.stopPropagation(); e.preventDefault(); this.setShowPreview(!this.props.shouldShowPreview); } } else if (shiftAltCombo) { - if (Utils.isKeyPressed(e, KeyCodes.X)) { + if (Keyboard.isKeyPressed(e, KeyCodes.X)) { e.stopPropagation(); e.preventDefault(); this.applyMarkdown({ @@ -946,7 +955,7 @@ class AdvancedCreateComment extends React.PureComponent { selectionEnd, message: value, }); - } else if (Utils.isKeyPressed(e, KeyCodes.SEVEN)) { + } else if (Keyboard.isKeyPressed(e, KeyCodes.SEVEN)) { e.preventDefault(); this.applyMarkdown({ markdownMode: 'ol', @@ -954,7 +963,7 @@ class AdvancedCreateComment extends React.PureComponent { selectionEnd, message: value, }); - } else if (Utils.isKeyPressed(e, KeyCodes.EIGHT)) { + } else if (Keyboard.isKeyPressed(e, KeyCodes.EIGHT)) { e.preventDefault(); this.applyMarkdown({ markdownMode: 'ul', @@ -962,7 +971,7 @@ class AdvancedCreateComment extends React.PureComponent { selectionEnd, message: value, }); - } else if (Utils.isKeyPressed(e, KeyCodes.NINE)) { + } else if (Keyboard.isKeyPressed(e, KeyCodes.NINE)) { e.preventDefault(); this.applyMarkdown({ markdownMode: 'quote', diff --git a/webapp/channels/src/components/advanced_create_comment/index.ts b/webapp/channels/src/components/advanced_create_comment/index.ts index 75095246ec..065683f481 100644 --- a/webapp/channels/src/components/advanced_create_comment/index.ts +++ b/webapp/channels/src/components/advanced_create_comment/index.ts @@ -64,6 +64,7 @@ function makeMapStateToProps() { const err = state.requests.posts.createPost.error || {}; const draft = getPostDraft(state, StoragePrefixes.COMMENT_DRAFT, ownProps.rootId); + const isRemoteDraft = state.views.drafts.remotes[`${StoragePrefixes.COMMENT_DRAFT}${ownProps.rootId}`] || false; const channelMembersCount = getAllChannelStats(state)[ownProps.channelId] ? getAllChannelStats(state)[ownProps.channelId].member_count : 1; const messageInHistory = getMessageInHistoryItem(state); @@ -91,6 +92,7 @@ function makeMapStateToProps() { return { currentTeamId, draft, + isRemoteDraft, messageInHistory, channelMembersCount, currentUserId, @@ -121,11 +123,11 @@ function makeMapStateToProps() { } function makeOnUpdateCommentDraft(rootId: string, channelId: string) { - return (draft?: PostDraft, save = false) => updateCommentDraft(rootId, draft ? {...draft, channelId, remote: false} : draft, save); + return (draft?: PostDraft, save = false) => updateCommentDraft(rootId, draft ? {...draft, channelId} : draft, save); } function makeUpdateCommentDraftWithRootId(channelId: string) { - return (rootId: string, draft?: PostDraft, save = false) => updateCommentDraft(rootId, draft ? {...draft, channelId, remote: false} : draft, save); + return (rootId: string, draft?: PostDraft, save = false) => updateCommentDraft(rootId, draft ? {...draft, channelId} : draft, save); } type Actions = { diff --git a/webapp/channels/src/components/advanced_create_post/advanced_create_post.test.jsx b/webapp/channels/src/components/advanced_create_post/advanced_create_post.test.jsx index 76ebc7bf4f..eb04b8a1d2 100644 --- a/webapp/channels/src/components/advanced_create_post/advanced_create_post.test.jsx +++ b/webapp/channels/src/components/advanced_create_post/advanced_create_post.test.jsx @@ -115,6 +115,7 @@ function advancedCreatePost({ fullWidthTextBox={fullWidthTextBox} currentChannelMembersCount={currentChannelMembersCount} draft={draft} + isRemoteDraft={false} recentPostIdInChannel={recentPostIdInChannel} latestReplyablePostId={latestReplyablePostId} locale={locale} diff --git a/webapp/channels/src/components/advanced_create_post/advanced_create_post.tsx b/webapp/channels/src/components/advanced_create_post/advanced_create_post.tsx index 630ad71188..af9cc8a6b0 100644 --- a/webapp/channels/src/components/advanced_create_post/advanced_create_post.tsx +++ b/webapp/channels/src/components/advanced_create_post/advanced_create_post.tsx @@ -22,6 +22,7 @@ import Constants, { Preferences, AdvancedTextEditor as AdvancedTextEditorConst, } from 'utils/constants'; +import * as Keyboard from 'utils/keyboard'; import { containsAtChannel, specialMentionsInText, @@ -34,7 +35,6 @@ import { } from 'utils/post_utils'; import {getTable, hasHtmlLink, formatMarkdownMessage, formatGithubCodePaste, isGitHubCodeBlock} from 'utils/paste'; import * as UserAgent from 'utils/user_agent'; -import {isMac} from 'utils/utils'; import * as Utils from 'utils/utils'; import EmojiMap from 'utils/emoji_map'; import {applyMarkdown, ApplyMarkdownOptions} from 'utils/markdown/apply_markdown'; @@ -124,6 +124,9 @@ type Props = { // Data used for populating message state from previous draft draft: PostDraft; + // Data used for knowing if the draft came from a WS event + isRemoteDraft: boolean; + // Data used dispatching handleViewAction ex: edit post latestReplyablePostId?: string; locale: string; @@ -279,7 +282,7 @@ class AdvancedCreatePost extends React.PureComponent { }; if ( props.currentChannel.id !== state.currentChannel.id || - (props.draft.remote && props.draft.message !== state.message) + (props.isRemoteDraft && props.draft.message !== state.message) ) { updatedState = { ...updatedState, @@ -294,8 +297,8 @@ class AdvancedCreatePost extends React.PureComponent { constructor(props: Props) { super(props); this.state = { - message: this.props.draft.message, - caretPosition: this.props.draft.message.length, + message: props.draft.message, + caretPosition: props.draft.message.length, submitting: false, showEmojiPicker: false, uploadsProgressPercent: {}, @@ -387,7 +390,6 @@ class AdvancedCreatePost extends React.PureComponent { this.draftsForChannel[channelId] = { ...draft, show: !isDraftEmpty(draft), - remote: false, } as PostDraft; } } @@ -996,9 +998,9 @@ class AdvancedCreatePost extends React.PureComponent { }; handleUploadError = (err: string | ServerError, clientId?: string, channelId?: string) => { - let serverError = null; - if (typeof err === 'string' && err.length > 0) { - serverError = new Error(err); + let serverError = err; + if (typeof serverError === 'string') { + serverError = new Error(serverError); } if (!channelId || !clientId) { @@ -1096,7 +1098,7 @@ class AdvancedCreatePost extends React.PureComponent { documentKeyHandler = (e: KeyboardEvent) => { const ctrlOrMetaKeyPressed = e.ctrlKey || e.metaKey; - const lastMessageReactionKeyCombo = ctrlOrMetaKeyPressed && e.shiftKey && Utils.isKeyPressed(e, KeyCodes.BACK_SLASH); + const lastMessageReactionKeyCombo = ctrlOrMetaKeyPressed && e.shiftKey && Keyboard.isKeyPressed(e, KeyCodes.BACK_SLASH); if (lastMessageReactionKeyCombo) { this.reactToLastMessage(e); return; @@ -1134,12 +1136,12 @@ class AdvancedCreatePost extends React.PureComponent { const ctrlOrMetaKeyPressed = e.ctrlKey || e.metaKey; const ctrlEnterKeyCombo = (this.props.ctrlSend || this.props.codeBlockOnCtrlEnter) && - Utils.isKeyPressed(e, KeyCodes.ENTER) && + Keyboard.isKeyPressed(e, KeyCodes.ENTER) && ctrlOrMetaKeyPressed; - const ctrlKeyCombo = Utils.cmdOrCtrlPressed(e) && !e.altKey && !e.shiftKey; - const ctrlAltCombo = Utils.cmdOrCtrlPressed(e, true) && e.altKey; - const shiftAltCombo = !Utils.cmdOrCtrlPressed(e) && e.shiftKey && e.altKey; + const ctrlKeyCombo = Keyboard.cmdOrCtrlPressed(e) && !e.altKey && !e.shiftKey; + const ctrlAltCombo = Keyboard.cmdOrCtrlPressed(e, true) && e.altKey; + const shiftAltCombo = !Keyboard.cmdOrCtrlPressed(e) && e.shiftKey && e.altKey; // listen for line break key combo and insert new line character if (Utils.isUnhandledLineBreakKeyCombo(e)) { @@ -1155,7 +1157,7 @@ class AdvancedCreatePost extends React.PureComponent { const {message} = this.state; - if (Utils.isKeyPressed(e, KeyCodes.ESCAPE)) { + if (Keyboard.isKeyPressed(e, KeyCodes.ESCAPE)) { this.textboxRef.current?.blur(); } @@ -1164,7 +1166,7 @@ class AdvancedCreatePost extends React.PureComponent { !e.metaKey && !e.altKey && !e.shiftKey && - Utils.isKeyPressed(e, KeyCodes.UP) && + Keyboard.isKeyPressed(e, KeyCodes.UP) && message === '' ) { e.preventDefault(); @@ -1182,15 +1184,15 @@ class AdvancedCreatePost extends React.PureComponent { } = e.target as TextboxElement; if (ctrlKeyCombo) { - if (draftMessageIsEmpty && Utils.isKeyPressed(e, KeyCodes.UP)) { + if (draftMessageIsEmpty && Keyboard.isKeyPressed(e, KeyCodes.UP)) { e.stopPropagation(); e.preventDefault(); this.loadPrevMessage(e); - } else if (draftMessageIsEmpty && Utils.isKeyPressed(e, KeyCodes.DOWN)) { + } else if (draftMessageIsEmpty && Keyboard.isKeyPressed(e, KeyCodes.DOWN)) { e.stopPropagation(); e.preventDefault(); this.loadNextMessage(e); - } else if (Utils.isKeyPressed(e, KeyCodes.B)) { + } else if (Keyboard.isKeyPressed(e, KeyCodes.B)) { e.stopPropagation(); e.preventDefault(); this.applyMarkdown({ @@ -1199,7 +1201,7 @@ class AdvancedCreatePost extends React.PureComponent { selectionEnd, message: value, }); - } else if (Utils.isKeyPressed(e, KeyCodes.I)) { + } else if (Keyboard.isKeyPressed(e, KeyCodes.I)) { e.stopPropagation(); e.preventDefault(); this.applyMarkdown({ @@ -1210,7 +1212,7 @@ class AdvancedCreatePost extends React.PureComponent { }); } } else if (ctrlAltCombo) { - if (Utils.isKeyPressed(e, KeyCodes.K)) { + if (Keyboard.isKeyPressed(e, KeyCodes.K)) { e.stopPropagation(); e.preventDefault(); this.applyMarkdown({ @@ -1219,7 +1221,7 @@ class AdvancedCreatePost extends React.PureComponent { selectionEnd, message: value, }); - } else if (Utils.isKeyPressed(e, KeyCodes.C)) { + } else if (Keyboard.isKeyPressed(e, KeyCodes.C)) { e.stopPropagation(); e.preventDefault(); this.applyMarkdown({ @@ -1228,21 +1230,21 @@ class AdvancedCreatePost extends React.PureComponent { selectionEnd, message: value, }); - } else if (Utils.isKeyPressed(e, KeyCodes.E)) { + } else if (Keyboard.isKeyPressed(e, KeyCodes.E)) { e.stopPropagation(); e.preventDefault(); this.toggleEmojiPicker(); - } else if (Utils.isKeyPressed(e, KeyCodes.T)) { + } else if (Keyboard.isKeyPressed(e, KeyCodes.T)) { e.stopPropagation(); e.preventDefault(); this.toggleAdvanceTextEditor(); - } else if (Utils.isKeyPressed(e, KeyCodes.P) && message.length) { + } else if (Keyboard.isKeyPressed(e, KeyCodes.P) && message.length) { e.stopPropagation(); e.preventDefault(); this.setShowPreview(!this.props.shouldShowPreview); } } else if (shiftAltCombo) { - if (Utils.isKeyPressed(e, KeyCodes.X)) { + if (Keyboard.isKeyPressed(e, KeyCodes.X)) { e.stopPropagation(); e.preventDefault(); this.applyMarkdown({ @@ -1251,7 +1253,7 @@ class AdvancedCreatePost extends React.PureComponent { selectionEnd, message: value, }); - } else if (Utils.isKeyPressed(e, KeyCodes.SEVEN)) { + } else if (Keyboard.isKeyPressed(e, KeyCodes.SEVEN)) { e.preventDefault(); this.applyMarkdown({ markdownMode: 'ol', @@ -1259,7 +1261,7 @@ class AdvancedCreatePost extends React.PureComponent { selectionEnd, message: value, }); - } else if (Utils.isKeyPressed(e, KeyCodes.EIGHT)) { + } else if (Keyboard.isKeyPressed(e, KeyCodes.EIGHT)) { e.preventDefault(); this.applyMarkdown({ markdownMode: 'ul', @@ -1267,7 +1269,7 @@ class AdvancedCreatePost extends React.PureComponent { selectionEnd, message: value, }); - } else if (Utils.isKeyPressed(e, KeyCodes.NINE)) { + } else if (Keyboard.isKeyPressed(e, KeyCodes.NINE)) { e.preventDefault(); this.applyMarkdown({ markdownMode: 'quote', @@ -1277,21 +1279,21 @@ class AdvancedCreatePost extends React.PureComponent { }); } } - const upKeyOnly = !ctrlOrMetaKeyPressed && !e.altKey && !e.shiftKey && Utils.isKeyPressed(e, KeyCodes.UP); - const shiftUpKeyCombo = !ctrlOrMetaKeyPressed && !e.altKey && e.shiftKey && Utils.isKeyPressed(e, KeyCodes.UP); - const ctrlShiftCombo = Utils.cmdOrCtrlPressed(e, true) && e.shiftKey; + const upKeyOnly = !ctrlOrMetaKeyPressed && !e.altKey && !e.shiftKey && Keyboard.isKeyPressed(e, KeyCodes.UP); + const shiftUpKeyCombo = !ctrlOrMetaKeyPressed && !e.altKey && e.shiftKey && Keyboard.isKeyPressed(e, KeyCodes.UP); + const ctrlShiftCombo = Keyboard.cmdOrCtrlPressed(e, true) && e.shiftKey; if (upKeyOnly && messageIsEmpty) { this.editLastPost(e); } else if (shiftUpKeyCombo && messageIsEmpty) { this.replyToLastPost(e); - } else if (ctrlShiftCombo && Utils.isKeyPressed(e, KeyCodes.E)) { + } else if (ctrlShiftCombo && Keyboard.isKeyPressed(e, KeyCodes.E)) { e.stopPropagation(); e.preventDefault(); this.toggleEmojiPicker(); - } else if (((isMac() && ctrlShiftCombo) || (!isMac() && ctrlAltCombo)) && Utils.isKeyPressed(e, KeyCodes.P) && this.state.message.length) { + } else if (((UserAgent.isMac() && ctrlShiftCombo) || (!UserAgent.isMac() && ctrlAltCombo)) && Keyboard.isKeyPressed(e, KeyCodes.P) && this.state.message.length) { this.setShowPreview(!this.props.shouldShowPreview); - } else if (ctrlAltCombo && Utils.isKeyPressed(e, KeyCodes.T)) { + } else if (ctrlAltCombo && Keyboard.isKeyPressed(e, KeyCodes.T)) { this.toggleAdvanceTextEditor(); } }; diff --git a/webapp/channels/src/components/advanced_create_post/index.ts b/webapp/channels/src/components/advanced_create_post/index.ts index e6559e9a5b..c582f2316b 100644 --- a/webapp/channels/src/components/advanced_create_post/index.ts +++ b/webapp/channels/src/components/advanced_create_post/index.ts @@ -77,6 +77,7 @@ function makeMapStateToProps() { const currentChannel = getCurrentChannel(state) || {}; const currentChannelTeammateUsername = getUser(state, currentChannel.teammate_id || '')?.username; const draft = getChannelDraft(state, currentChannel.id); + const isRemoteDraft = state.views.drafts.remotes[`${StoragePrefixes.DRAFT}${currentChannel.id}`] || false; const latestReplyablePostId = getLatestReplyablePostId(state); const currentChannelMembersCount = getCurrentChannelStats(state) ? getCurrentChannelStats(state).member_count : 1; const enableEmojiPicker = config.EnableEmojiPicker === 'true'; @@ -117,6 +118,7 @@ function makeMapStateToProps() { showSendTutorialTip, messageInHistoryItem: getMessageInHistoryItem(state), draft, + isRemoteDraft, latestReplyablePostId, locale: getCurrentLocale(state), currentUsersLatestPost: getCurrentUsersLatestPost(state, ''), @@ -181,12 +183,7 @@ function setDraft(key: string, value: PostDraft, draftChannelId: string, save = const channelId = draftChannelId || getCurrentChannelId(getState()); let updatedValue = null; if (value) { - updatedValue = {...value}; - updatedValue = { - ...value, - channelId, - remote: false, - }; + updatedValue = {...value, channelId}; } if (updatedValue) { return dispatch(updateDraft(key, updatedValue, '', save)); diff --git a/webapp/channels/src/components/air_gapped_self_hosted_purchase_modal/index.tsx b/webapp/channels/src/components/air_gapped_self_hosted_purchase_modal/index.tsx index 530902c3bb..97b6d9222c 100644 --- a/webapp/channels/src/components/air_gapped_self_hosted_purchase_modal/index.tsx +++ b/webapp/channels/src/components/air_gapped_self_hosted_purchase_modal/index.tsx @@ -4,7 +4,7 @@ import React from 'react'; import {FormattedMessage} from 'react-intl'; -import {GenericModal} from '@mattermost/components'; +import {LegacyGenericModal} from '@mattermost/components'; import {CloudLinks} from 'utils/constants'; import CreditCardSvg from 'components/common/svg_images_components/credit_card_svg'; import {useControlAirGappedSelfHostedPurchaseModal} from 'components/common/hooks/useControlModal'; @@ -15,7 +15,7 @@ export default function AirGappedSelfHostedPurhcaseModal() { const {close} = useControlAirGappedSelfHostedPurchaseModal(); return ( - {CloudLinks.SELF_HOSTED_PRICING}
    - + ); } diff --git a/webapp/channels/src/components/announcement_bar/cloud_trial_announcement_bar/cloud_trial_announcement_bar.tsx b/webapp/channels/src/components/announcement_bar/cloud_trial_announcement_bar/cloud_trial_announcement_bar.tsx index 8224463d43..f03effb517 100644 --- a/webapp/channels/src/components/announcement_bar/cloud_trial_announcement_bar/cloud_trial_announcement_bar.tsx +++ b/webapp/channels/src/components/announcement_bar/cloud_trial_announcement_bar/cloud_trial_announcement_bar.tsx @@ -137,7 +137,7 @@ class CloudTrialAnnouncementBar extends React.PureComponent { let trialMoreThan7DaysMsg = ( diff --git a/webapp/channels/src/components/announcement_bar/configuration_bar/configuration_bar.tsx b/webapp/channels/src/components/announcement_bar/configuration_bar/configuration_bar.tsx index b6a0a0b572..5c8ef4c5f1 100644 --- a/webapp/channels/src/components/announcement_bar/configuration_bar/configuration_bar.tsx +++ b/webapp/channels/src/components/announcement_bar/configuration_bar/configuration_bar.tsx @@ -1,7 +1,7 @@ // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. -import React from 'react'; +import React, {ReactNode} from 'react'; import {FormattedMessage, injectIntl, IntlShape} from 'react-intl'; import {Link} from 'react-router-dom'; @@ -395,7 +395,7 @@ const ConfigurationAnnouncementBar = (props: Props) => { defaultMessage = 'Please configure your site URL on the System Console.'; } - const values = { + const values: Record = { linkSite: (msg: string) => ( { activeUsers, seatsPurchased, }); + const isSelfHostedExpansionEnabled = useSelector(getConfig)?.ServiceSettings?.SelfHostedPurchase; + const canSelfHostedExpand = useCanSelfHostedExpand() && isSelfHostedExpansionEnabled; + const siteURL = getSiteURL(); const prefixPreferences = isOver10PercerntPurchasedSeats ? 'error' : 'warn'; const prefixLicenseId = (license.Id || '').substring(0, 8); const preferenceName = `${prefixPreferences}_overage_seats_${prefixLicenseId}`; @@ -72,6 +78,7 @@ const OverageUsersBanner = () => { licenseId: license.Id, isWarningState: isBetween5PercerntAnd10PercentPurchasedSeats, banner: 'global banner', + canSelfHostedExpand: canSelfHostedExpand || false, }); const handleClose = () => { @@ -86,6 +93,12 @@ const OverageUsersBanner = () => { const handleUpdateSeatsSelfServeClick = (e: React.MouseEvent) => { e.preventDefault(); trackEventFn('Self Serve'); + + if (canSelfHostedExpand) { + window.open(`${siteURL}/${ConsolePages.LICENSE}?action=show_expansion_modal`); + return; + } + window.open(expandableLink(license.Id), '_blank'); }; @@ -101,7 +114,7 @@ const OverageUsersBanner = () => { return null; } - const message = ( + let message = ( { }} />); + if (canSelfHostedExpand) { + message = ( + ); + } + return ( { getRequestState: 'IDLE', }, }, + hostedCustomer: { + products: { + productsLoaded: true, + products: { + prod_professional: TestHelper.getProductMock({ + id: 'prod_professional', + name: 'Professional', + sku: SelfHostedProducts.PROFESSIONAL, + price_per_seat: 7.5, + }), + }, + }, + }, }, }; diff --git a/webapp/channels/src/components/announcement_bar/payment_announcement_bar/index.test.tsx b/webapp/channels/src/components/announcement_bar/payment_announcement_bar/index.test.tsx new file mode 100644 index 0000000000..8e610d2d24 --- /dev/null +++ b/webapp/channels/src/components/announcement_bar/payment_announcement_bar/index.test.tsx @@ -0,0 +1,97 @@ +// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. +// See LICENSE.txt for license information. + +import React from 'react'; +import {screen} from '@testing-library/react'; +import {renderWithIntlAndStore} from 'tests/react_testing_utils'; +import * as cloudActions from 'mattermost-redux/actions/cloud'; + +import {CloudProducts} from 'utils/constants'; + +import PaymentAnnouncementBar from './'; + +jest.mock('mattermost-redux/actions/cloud', () => { + const original = jest.requireActual('mattermost-redux/actions/cloud'); + return { + ...original, + __esModule: true, + + // just testing that it fired, not that the result updated or anything like that + getCloudCustomer: jest.fn(() => ({type: 'bogus'})), + }; +}); + +describe('PaymentAnnouncementBar', () => { + const happyPathStore = { + entities: { + users: { + currentUserId: 'me', + profiles: { + me: { + roles: 'system_admin', + }, + }, + }, + general: { + license: { + Cloud: 'true', + }, + }, + cloud: { + subscription: { + product_id: 'prod_something', + last_invoice: { + status: 'failed', + }, + }, + customer: { + payment_method: { + exp_month: 12, + exp_year: (new Date()).getFullYear() + 1, + }, + }, + products: { + prod_something: { + id: 'prod_something', + sku: CloudProducts.PROFESSIONAL, + }, + }, + }, + }, + views: { + announcementBar: { + announcementBarState: { + announcementBarCount: 1, + }, + }, + }, + }; + + it('when most recent payment failed, shows that', () => { + renderWithIntlAndStore(, happyPathStore); + screen.getByText('Your most recent payment failed'); + }); + + it('when card is expired, shows that', () => { + const store = JSON.parse(JSON.stringify(happyPathStore)); + store.entities.cloud.customer.payment_method.exp_year = (new Date()).getFullYear() - 1; + store.entities.cloud.subscription.last_invoice.status = 'success'; + renderWithIntlAndStore(, store); + screen.getByText('Your credit card has expired', {exact: false}); + }); + + it('when needed, fetches, customer', () => { + const store = JSON.parse(JSON.stringify(happyPathStore)); + store.entities.cloud.customer = null; + store.entities.cloud.subscription.last_invoice.status = 'success'; + renderWithIntlAndStore(, store); + expect(cloudActions.getCloudCustomer).toHaveBeenCalled(); + }); + + it('when not an admin, does not fetch customer', () => { + const store = JSON.parse(JSON.stringify(happyPathStore)); + store.entities.users.profiles.me.roles = ''; + renderWithIntlAndStore(, store); + expect(cloudActions.getCloudCustomer).not.toHaveBeenCalled(); + }); +}); diff --git a/webapp/channels/src/components/announcement_bar/payment_announcement_bar/index.ts b/webapp/channels/src/components/announcement_bar/payment_announcement_bar/index.ts deleted file mode 100644 index 86e3bd5f05..0000000000 --- a/webapp/channels/src/components/announcement_bar/payment_announcement_bar/index.ts +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. -// See LICENSE.txt for license information. - -import {connect} from 'react-redux'; -import {bindActionCreators, Dispatch} from 'redux'; - -import {savePreferences} from 'mattermost-redux/actions/preferences'; -import {getLicense} from 'mattermost-redux/selectors/entities/general'; -import {GenericAction} from 'mattermost-redux/types/actions'; -import {getCloudSubscription, getCloudCustomer} from 'mattermost-redux/actions/cloud'; - -import {isCurrentUserSystemAdmin} from 'mattermost-redux/selectors/entities/users'; -import { - getCloudSubscription as selectCloudSubscription, - getCloudCustomer as selectCloudCustomer, - getSubscriptionProduct, -} from 'mattermost-redux/selectors/entities/cloud'; -import {CloudProducts} from 'utils/constants'; - -import {openModal} from 'actions/views/modals'; - -import {GlobalState} from 'types/store'; - -import PaymentAnnouncementBar from './payment_announcement_bar'; - -function mapStateToProps(state: GlobalState) { - const subscription = selectCloudSubscription(state); - const customer = selectCloudCustomer(state); - const subscriptionProduct = getSubscriptionProduct(state); - return { - userIsAdmin: isCurrentUserSystemAdmin(state), - isCloud: getLicense(state).Cloud === 'true', - subscription, - customer, - isStarterFree: subscriptionProduct?.sku === CloudProducts.STARTER, - }; -} - -function mapDispatchToProps(dispatch: Dispatch) { - return { - actions: bindActionCreators( - { - savePreferences, - openModal, - getCloudSubscription, - getCloudCustomer, - }, - dispatch, - ), - }; -} - -export default connect(mapStateToProps, mapDispatchToProps)(PaymentAnnouncementBar); diff --git a/webapp/channels/src/components/announcement_bar/payment_announcement_bar/index.tsx b/webapp/channels/src/components/announcement_bar/payment_announcement_bar/index.tsx new file mode 100644 index 0000000000..f14153ad8e --- /dev/null +++ b/webapp/channels/src/components/announcement_bar/payment_announcement_bar/index.tsx @@ -0,0 +1,89 @@ +// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. +// See LICENSE.txt for license information. + +import React, {useEffect, useState} from 'react'; +import {FormattedMessage} from 'react-intl'; +import {useSelector, useDispatch} from 'react-redux'; +import {isEmpty} from 'lodash'; + +import {DispatchFunc} from 'mattermost-redux/types/actions'; +import {getCloudCustomer} from 'mattermost-redux/actions/cloud'; +import {getLicense} from 'mattermost-redux/selectors/entities/general'; +import { + getCloudSubscription as selectCloudSubscription, + getCloudCustomer as selectCloudCustomer, + getSubscriptionProduct, +} from 'mattermost-redux/selectors/entities/cloud'; +import {isCurrentUserSystemAdmin} from 'mattermost-redux/selectors/entities/users'; + +import {getHistory} from 'utils/browser_history'; +import {isCustomerCardExpired} from 'utils/cloud_utils'; +import {AnnouncementBarTypes, CloudProducts, ConsolePages} from 'utils/constants'; +import {t} from 'utils/i18n'; + +import AnnouncementBar from '../default_announcement_bar'; + +export default function PaymentAnnouncementBar() { + const [requestedCustomer, setRequestedCustomer] = useState(false); + const dispatch = useDispatch(); + const subscription = useSelector(selectCloudSubscription); + const customer = useSelector(selectCloudCustomer); + const isStarterFree = useSelector(getSubscriptionProduct)?.sku === CloudProducts.STARTER; + const userIsAdmin = useSelector(isCurrentUserSystemAdmin); + const isCloud = useSelector(getLicense).Cloud === 'true'; + + useEffect(() => { + if (isCloud && !isStarterFree && isEmpty(customer) && userIsAdmin && !requestedCustomer) { + setRequestedCustomer(true); + dispatch(getCloudCustomer()); + } + }, + [isCloud, isStarterFree, customer, userIsAdmin, requestedCustomer]); + + const mostRecentPaymentFailed = subscription?.last_invoice?.status === 'failed'; + + if ( + // Prevents banner flashes if the subscription hasn't been loaded yet + isEmpty(subscription) || + isStarterFree || + !isCloud || + !userIsAdmin || + isEmpty(customer) || + (!isCustomerCardExpired(customer) && !mostRecentPaymentFailed) + ) { + return null; + } + + const updatePaymentInfo = () => { + getHistory().push(ConsolePages.PAYMENT_INFO); + }; + + let message = ( + + ); + + if (mostRecentPaymentFailed) { + message = ( + + ); + } + + return ( + + ); +} diff --git a/webapp/channels/src/components/announcement_bar/payment_announcement_bar/payment_announcement_bar.tsx b/webapp/channels/src/components/announcement_bar/payment_announcement_bar/payment_announcement_bar.tsx deleted file mode 100644 index 5fe7c7fa4b..0000000000 --- a/webapp/channels/src/components/announcement_bar/payment_announcement_bar/payment_announcement_bar.tsx +++ /dev/null @@ -1,96 +0,0 @@ -// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. -// See LICENSE.txt for license information. - -import React from 'react'; - -import {isEmpty} from 'lodash'; - -import {CloudCustomer, Subscription} from '@mattermost/types/cloud'; - -import {getHistory} from 'utils/browser_history'; -import {isCustomerCardExpired} from 'utils/cloud_utils'; -import {AnnouncementBarTypes} from 'utils/constants'; -import {t} from 'utils/i18n'; - -import AnnouncementBar from '../default_announcement_bar'; - -type Props = { - userIsAdmin: boolean; - isCloud: boolean; - subscription?: Subscription; - customer?: CloudCustomer; - isStarterFree: boolean; - actions: { - getCloudSubscription: () => void; - getCloudCustomer: () => void; - }; -}; - -class PaymentAnnouncementBar extends React.PureComponent { - async componentDidMount() { - if (isEmpty(this.props.customer)) { - await this.props.actions.getCloudCustomer(); - } - } - - isMostRecentPaymentFailed = () => { - return this.props.subscription?.last_invoice?.status === 'failed'; - }; - - shouldShowBanner = () => { - const {userIsAdmin, isCloud, subscription} = this.props; - - // Prevents banner flashes if the subscription hasn't been loaded yet - if (subscription === null) { - return false; - } - - if (this.props.isStarterFree) { - return false; - } - - if (!isCloud) { - return false; - } - - if (!userIsAdmin) { - return false; - } - - if (!isCustomerCardExpired(this.props.customer) && !this.isMostRecentPaymentFailed()) { - return false; - } - - return true; - }; - - updatePaymentInfo = () => { - getHistory().push('/admin_console/billing/payment_info'); - }; - - render() { - if (isEmpty(this.props.customer) || isEmpty(this.props.subscription)) { - return null; - } - - if (!this.shouldShowBanner()) { - return null; - } - - return ( - - - ); - } -} - -export default PaymentAnnouncementBar; diff --git a/webapp/channels/src/components/app_bar/app_bar.scss b/webapp/channels/src/components/app_bar/app_bar.scss index ce7813b3c9..1abd831b84 100644 --- a/webapp/channels/src/components/app_bar/app_bar.scss +++ b/webapp/channels/src/components/app_bar/app_bar.scss @@ -134,6 +134,7 @@ $app-bar-width: 48px; } &__bottom { + position: relative; display: flex; flex-flow: column; align-items: center; diff --git a/webapp/channels/src/components/apps_form/apps_form_component.tsx b/webapp/channels/src/components/apps_form/apps_form_component.tsx index a83eb11274..f682058ece 100644 --- a/webapp/channels/src/components/apps_form/apps_form_component.tsx +++ b/webapp/channels/src/components/apps_form/apps_form_component.tsx @@ -234,7 +234,7 @@ export class AppsForm extends React.PureComponent { const errorResponse = res.error; const errMsg = errorResponse.text || intl.formatMessage({ id: 'apps.error.unknown', - defaultMessage: 'Unknown error.', + defaultMessage: 'Unknown error occurred.', }); this.setState({ fieldErrors: { @@ -256,7 +256,7 @@ export class AppsForm extends React.PureComponent { case AppCallResponseTypes.NAVIGATE: { const errMsg = intl.formatMessage({ id: 'apps.error.responses.unexpected_type', - defaultMessage: 'App response type was not expected. Response type: {type}.', + defaultMessage: 'App response type was not expected. Response type: {type}', }, { type: callResp.type, }, @@ -338,7 +338,7 @@ export class AppsForm extends React.PureComponent { case AppCallResponseTypes.NAVIGATE: this.updateErrors([], undefined, this.props.intl.formatMessage({ id: 'apps.error.responses.unexpected_type', - defaultMessage: 'App response type was not expected. Response type: {type}.', + defaultMessage: 'App response type was not expected. Response type: {type}', }, { type: callResponse.type, })); diff --git a/webapp/channels/src/components/apps_form/apps_form_container.tsx b/webapp/channels/src/components/apps_form/apps_form_container.tsx index 2a816bb5d8..3e018f2e81 100644 --- a/webapp/channels/src/components/apps_form/apps_form_container.tsx +++ b/webapp/channels/src/components/apps_form/apps_form_container.tsx @@ -48,7 +48,7 @@ class AppsFormContainer extends React.PureComponent { }; const {form} = this.state; if (!form) { - const errMsg = this.props.intl.formatMessage({id: 'apps.error.form.no_form', defaultMessage: '`form` is not defined'}); + const errMsg = this.props.intl.formatMessage({id: 'apps.error.form.no_form', defaultMessage: '`form` is not defined.'}); return {error: makeCallErrorResponse(makeErrorMsg(errMsg))}; } if (!form.submit) { @@ -97,7 +97,7 @@ class AppsFormContainer extends React.PureComponent { refreshOnSelect = async (field: AppField, values: AppFormValues): Promise> => { const makeErrMsg = (message: string) => this.props.intl.formatMessage( { - id: 'apps.error.form.refresh', + id: 'apps.error.form.update', defaultMessage: 'There has been an error updating the modal. Contact the app developer. Details: {details}', }, {details: message}, @@ -144,7 +144,7 @@ class AppsFormContainer extends React.PureComponent { case AppCallResponseTypes.NAVIGATE: return {error: makeCallErrorResponse(makeErrMsg(this.props.intl.formatMessage({ id: 'apps.error.responses.unexpected_type', - defaultMessage: 'App response type was not expected. Response type: {type}.', + defaultMessage: 'App response type was not expected. Response type: {type}', }, { type: callResp.type, }, diff --git a/webapp/channels/src/components/apps_form/apps_form_field/apps_form_select_field.tsx b/webapp/channels/src/components/apps_form/apps_form_field/apps_form_select_field.tsx index 59fbe98db7..7ff560353d 100644 --- a/webapp/channels/src/components/apps_form/apps_form_field/apps_form_select_field.tsx +++ b/webapp/channels/src/components/apps_form/apps_form_field/apps_form_select_field.tsx @@ -90,7 +90,7 @@ export default class AppsFormSelectField extends React.PureComponent => { const usersSearchResults: UserAutocomplete = await this.props.actions.autocompleteUsers(userInput.toLowerCase()); - return usersSearchResults.users.map((user) => { + return usersSearchResults.users.filter((user) => !user.is_bot).map((user) => { const label = this.props.teammateNameDisplay ? displayUsername(user, this.props.teammateNameDisplay) : user.username; return {...user, label, value: user.id, icon_data: imageURLForUser(user.id)}; diff --git a/webapp/channels/src/components/at_mention/at_mention.tsx b/webapp/channels/src/components/at_mention/at_mention.tsx index 4bb914369f..e8e51ca423 100644 --- a/webapp/channels/src/components/at_mention/at_mention.tsx +++ b/webapp/channels/src/components/at_mention/at_mention.tsx @@ -12,9 +12,10 @@ import {Group} from '@mattermost/types/groups'; import ProfilePopover from 'components/profile_popover'; import {popOverOverlayPosition} from 'utils/position_utils'; +import {isKeyPressed} from 'utils/keyboard'; import {getUserOrGroupFromMentionName} from 'utils/post_utils'; import Constants from 'utils/constants'; -import {getViewportSize, isKeyPressed} from 'utils/utils'; +import {getViewportSize} from 'utils/utils'; import AtMentionGroup from 'components/at_mention/at_mention_group'; diff --git a/webapp/channels/src/components/at_mention/at_mention_group.tsx b/webapp/channels/src/components/at_mention/at_mention_group.tsx index aaa449eef9..fa1fd3abd5 100644 --- a/webapp/channels/src/components/at_mention/at_mention_group.tsx +++ b/webapp/channels/src/components/at_mention/at_mention_group.tsx @@ -12,8 +12,9 @@ import ProfilePopover from 'components/profile_popover'; import UserGroupPopover from 'components/user_group_popover'; import Constants, {A11yCustomEventTypes, A11yFocusEventDetail} from 'utils/constants'; +import {isKeyPressed} from 'utils/keyboard'; import {popOverOverlayPosition} from 'utils/position_utils'; -import {getViewportSize, isKeyPressed} from 'utils/utils'; +import {getViewportSize} from 'utils/utils'; import {MAX_LIST_HEIGHT, getListHeight, VIEWPORT_SCALE_FACTOR} from 'components/user_group_popover/group_member_list/group_member_list'; diff --git a/webapp/channels/src/components/autosize_textarea.tsx b/webapp/channels/src/components/autosize_textarea.tsx index 83a30afb07..d9df0e5ef3 100644 --- a/webapp/channels/src/components/autosize_textarea.tsx +++ b/webapp/channels/src/components/autosize_textarea.tsx @@ -129,6 +129,8 @@ export class AutosizeTextarea extends React.PureComponent { height: 0, }; + Reflect.deleteProperty(otherProps, 'onWidthChange'); + if (this.height <= 0) { // Set an initial number of rows so that the textarea doesn't appear too large when its first rendered heightProps.rows = 1; diff --git a/webapp/channels/src/components/channel_groups_manage_modal/channel_groups_manage_modal.tsx b/webapp/channels/src/components/channel_groups_manage_modal/channel_groups_manage_modal.tsx index 9bcf5d106e..5bcec33c60 100644 --- a/webapp/channels/src/components/channel_groups_manage_modal/channel_groups_manage_modal.tsx +++ b/webapp/channels/src/components/channel_groups_manage_modal/channel_groups_manage_modal.tsx @@ -145,7 +145,7 @@ class ChannelGroupsManageModal extends React.PureComponent { const {formatMessage} = this.props.intl; return (
    +
    +
    diff --git a/webapp/channels/src/components/channel_notifications_modal/channel_notifications_modal.test.tsx b/webapp/channels/src/components/channel_notifications_modal/channel_notifications_modal.test.tsx index b4da9f73a2..12ac3c3b1a 100644 --- a/webapp/channels/src/components/channel_notifications_modal/channel_notifications_modal.test.tsx +++ b/webapp/channels/src/components/channel_notifications_modal/channel_notifications_modal.test.tsx @@ -4,7 +4,7 @@ import React, {ComponentProps} from 'react'; import {shallow} from 'enzyme'; -import {IgnoreChannelMentions, NotificationLevels, NotificationSections} from 'utils/constants'; +import {ChannelAutoFollowThreads, IgnoreChannelMentions, NotificationLevels, NotificationSections} from 'utils/constants'; import {TestHelper} from 'utils/test_helper'; import ChannelNotificationsModal from 'components/channel_notifications_modal/channel_notifications_modal'; @@ -25,6 +25,7 @@ describe('components/channel_notifications_modal/ChannelNotificationsModal', () mark_unread: NotificationLevels.ALL, push: NotificationLevels.DEFAULT, ignore_channel_mentions: IgnoreChannelMentions.DEFAULT, + channel_auto_follow_threads: ChannelAutoFollowThreads.OFF, desktop_threads: NotificationLevels.ALL, push_threads: NotificationLevels.DEFAULT, }, @@ -62,6 +63,7 @@ describe('components/channel_notifications_modal/ChannelNotificationsModal', () expect(wrapper.state('markUnreadNotifyLevel')).toEqual(NotificationLevels.ALL); expect(wrapper.state('pushNotifyLevel')).toEqual(NotificationLevels.DEFAULT); expect(wrapper.state('ignoreChannelMentions')).toEqual(IgnoreChannelMentions.OFF); + expect(wrapper.state('channelAutoFollowThreads')).toEqual(ChannelAutoFollowThreads.OFF); }); test('should provide correct default when currentUser channel notify props is true', () => { @@ -207,7 +209,7 @@ describe('components/channel_notifications_modal/ChannelNotificationsModal', () expect(wrapper.state('desktopNotifyLevel')).toEqual(NotificationLevels.NONE); - wrapper.instance().updateSection(''); + wrapper.instance().updateSection(NotificationSections.NONE); expect(wrapper.state('desktopNotifyLevel')).toEqual(baseProps.channelMember?.notify_props.desktop); }); @@ -348,6 +350,7 @@ describe('components/channel_notifications_modal/ChannelNotificationsModal', () expect(wrapper.state('markUnreadNotifyLevel')).toEqual(NotificationLevels.MENTION); expect(wrapper.state('pushNotifyLevel')).toEqual(NotificationLevels.ALL); expect(wrapper.state('ignoreChannelMentions')).toEqual(IgnoreChannelMentions.ON); + expect(wrapper.state('channelAutoFollowThreads')).toEqual(ChannelAutoFollowThreads.OFF); wrapper.instance().resetStateFromNotifyProps(currentUserNotifyProps, {...channelMemberNotifyProps, desktop: NotificationLevels.ALL}); expect(wrapper.state('desktopNotifyLevel')).toEqual(NotificationLevels.ALL); diff --git a/webapp/channels/src/components/channel_notifications_modal/channel_notifications_modal.tsx b/webapp/channels/src/components/channel_notifications_modal/channel_notifications_modal.tsx index 1b5ff1b8f1..20756d7619 100644 --- a/webapp/channels/src/components/channel_notifications_modal/channel_notifications_modal.tsx +++ b/webapp/channels/src/components/channel_notifications_modal/channel_notifications_modal.tsx @@ -8,7 +8,7 @@ import {FormattedMessage} from 'react-intl'; import {isChannelMuted} from 'mattermost-redux/utils/channel_utils'; -import {IgnoreChannelMentions, NotificationLevels, NotificationSections} from 'utils/constants'; +import {ChannelAutoFollowThreads, IgnoreChannelMentions, NotificationLevels, NotificationSections} from 'utils/constants'; import NotificationSection from 'components/channel_notifications_modal/components/notification_section.jsx'; @@ -47,6 +47,7 @@ type State = { pushNotifyLevel: ChannelNotifyProps['push']; pushThreadsNotifyLevel: UserNotifyProps['push_threads']; ignoreChannelMentions: ChannelNotifyProps['ignore_channel_mentions']; + channelAutoFollowThreads: ChannelNotifyProps['channel_auto_follow_threads']; }; export default class ChannelNotificationsModal extends React.PureComponent { @@ -95,6 +96,7 @@ export default class ChannelNotificationsModal extends React.PureComponent this.setState({channelAutoFollowThreads}); + + handleSubmitChannelAutoFollowThreads = () => { + const channelNotifyProps = this.props.channelMember && this.props.channelMember.notify_props; + const {channelAutoFollowThreads} = this.state; + + if (channelNotifyProps?.channel_auto_follow_threads === channelAutoFollowThreads) { + this.updateSection(NotificationSections.NONE); + return; + } + + const props = {channel_auto_follow_threads: channelAutoFollowThreads}; + this.handleUpdateChannelNotifyProps(props); + }; + render() { const { activeSection, @@ -207,6 +224,7 @@ export default class ChannelNotificationsModal extends React.PureComponent } +
    +
    diff --git a/webapp/channels/src/components/channel_notifications_modal/components/collapse_view.tsx b/webapp/channels/src/components/channel_notifications_modal/components/collapse_view.tsx index f9306c4a90..2728234484 100644 --- a/webapp/channels/src/components/channel_notifications_modal/components/collapse_view.tsx +++ b/webapp/channels/src/components/channel_notifications_modal/components/collapse_view.tsx @@ -10,13 +10,14 @@ import SectionTitle from './section_title'; type Props = { ignoreChannelMentions?: string; + channelAutoFollowThreads?: string; onExpandSection: (section: string) => void; globalNotifyLevel?: string; memberNotifyLevel: string; section: string; } -export default function CollapseView({onExpandSection, globalNotifyLevel, memberNotifyLevel, section, ignoreChannelMentions}: Props) { +export default function CollapseView({onExpandSection, globalNotifyLevel, memberNotifyLevel, section, ignoreChannelMentions, channelAutoFollowThreads}: Props) { return ( } @@ -24,6 +25,7 @@ export default function CollapseView({onExpandSection, globalNotifyLevel, member ); + } else if ( + section === NotificationSections.CHANNEL_AUTO_FOLLOW_THREADS && + channelAutoFollowThreads === ChannelAutoFollowThreads.ON + ) { + return ( + + ); + } else if ( + section === NotificationSections.CHANNEL_AUTO_FOLLOW_THREADS && + channelAutoFollowThreads === ChannelAutoFollowThreads.OFF + ) { + return ( + + ); } else if (memberNotifyLevel === NotificationLevels.MENTION) { return ( ) => void; onChangeThreads?: (e: ChangeEvent) => void; onCollapseSection: (section: string) => void; @@ -39,6 +40,7 @@ export default function ExpandView({ serverError, onCollapseSection, ignoreChannelMentions, + channelAutoFollowThreads, }: Props) { const isCRTEnabled = useSelector(isCollapsedThreadsEnabled); @@ -153,6 +155,46 @@ export default function ExpandView({
    } + {section === NotificationSections.CHANNEL_AUTO_FOLLOW_THREADS && +
    +
    + +
    +
    + +
    +
    + } {section === NotificationSections.MARK_UNREAD &&
    diff --git a/webapp/channels/src/components/channel_notifications_modal/components/extra_info.tsx b/webapp/channels/src/components/channel_notifications_modal/components/extra_info.tsx index 1bc65f6c66..7f489acec9 100644 --- a/webapp/channels/src/components/channel_notifications_modal/components/extra_info.tsx +++ b/webapp/channels/src/components/channel_notifications_modal/components/extra_info.tsx @@ -48,6 +48,15 @@ export default function ExtraInfo({section}: Props) { /> ); + case NotificationSections.CHANNEL_AUTO_FOLLOW_THREADS: + return ( + + + + ); default: return null; } diff --git a/webapp/channels/src/components/channel_notifications_modal/components/notification_section.jsx b/webapp/channels/src/components/channel_notifications_modal/components/notification_section.jsx index 9e369dc867..9ff5fbd3a4 100644 --- a/webapp/channels/src/components/channel_notifications_modal/components/notification_section.jsx +++ b/webapp/channels/src/components/channel_notifications_modal/components/notification_section.jsx @@ -37,6 +37,11 @@ export default class NotificationSection extends React.PureComponent { */ ignoreChannelMentions: PropTypes.string, + /** + * Auto-follow all new threads in this channel + */ + channelAutoFollowThreads: PropTypes.string, + /** * User's global notification level */ @@ -93,6 +98,7 @@ export default class NotificationSection extends React.PureComponent { memberNotificationLevel, memberThreadsNotificationLevel, ignoreChannelMentions, + channelAutoFollowThreads, onSubmit, section, serverError, @@ -106,6 +112,7 @@ export default class NotificationSection extends React.PureComponent { memberThreadsNotifyLevel={memberThreadsNotificationLevel} globalNotifyLevel={globalNotificationLevel} ignoreChannelMentions={ignoreChannelMentions} + channelAutoFollowThreads={channelAutoFollowThreads} onChange={this.handleOnChange} onChangeThreads={this.handleOnChangeThreads} onSubmit={onSubmit} @@ -122,6 +129,7 @@ export default class NotificationSection extends React.PureComponent { memberNotifyLevel={memberNotificationLevel} globalNotifyLevel={globalNotificationLevel} ignoreChannelMentions={ignoreChannelMentions} + channelAutoFollowThreads={channelAutoFollowThreads} /> ); } diff --git a/webapp/channels/src/components/channel_notifications_modal/components/section_title.tsx b/webapp/channels/src/components/channel_notifications_modal/components/section_title.tsx index be295810e0..be8704e554 100644 --- a/webapp/channels/src/components/channel_notifications_modal/components/section_title.tsx +++ b/webapp/channels/src/components/channel_notifications_modal/components/section_title.tsx @@ -39,6 +39,13 @@ export default function SectionTitle({section}: Props) { defaultMessage='Ignore mentions for @channel, @here and @all' /> ); + } else if (section === NotificationSections.CHANNEL_AUTO_FOLLOW_THREADS) { + return ( + + ); } return null; diff --git a/webapp/channels/src/components/cloud_start_trial/cloud_start_trial_btn.tsx b/webapp/channels/src/components/cloud_start_trial/cloud_start_trial_btn.tsx index 83bf4c715a..f511e36bb7 100644 --- a/webapp/channels/src/components/cloud_start_trial/cloud_start_trial_btn.tsx +++ b/webapp/channels/src/components/cloud_start_trial/cloud_start_trial_btn.tsx @@ -1,7 +1,7 @@ // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. -import React, {useEffect, useState} from 'react'; +import React, {useEffect, useState, ReactNode} from 'react'; import {useIntl} from 'react-intl'; import {useDispatch} from 'react-redux'; @@ -14,8 +14,9 @@ import {trackEvent} from 'actions/telemetry_actions'; import {openModal, closeModal} from 'actions/views/modals'; import TrialBenefitsModal from 'components/trial_benefits_modal/trial_benefits_modal'; +import ExternalLink from 'components/external_link'; -import {ModalIdentifiers, TELEMETRY_CATEGORIES} from 'utils/constants'; +import {ModalIdentifiers, TELEMETRY_CATEGORIES, LicenseLinks} from 'utils/constants'; import RequestBusinessEmailModal from './request_business_email_modal'; import './cloud_start_trial_btn.scss'; @@ -129,7 +130,7 @@ const CloudStartTrialButton = ({ })); }; - const btnText = (status: TrialLoadStatus): string => { + const btnText = (status: TrialLoadStatus) => { switch (status) { case TrialLoadStatus.Started: return formatMessage({id: 'start_cloud_trial.modal.gettingTrial', defaultMessage: 'Getting Trial...'}); @@ -138,7 +139,22 @@ const CloudStartTrialButton = ({ case TrialLoadStatus.Failed: return formatMessage({id: 'start_cloud_trial.modal.failed', defaultMessage: 'Failed'}); case TrialLoadStatus.Embargoed: - return formatMessage({id: 'admin.license.trial-request.embargoed'}); + return formatMessage( + { + id: 'admin.license.trial-request.embargoed', + defaultMessage: 'We were unable to process the request due to limitations for embargoed countries. Learn more in our documentation, or reach out to legal@mattermost.com for questions around export limitations.', + }, + { + link: (text: string) => ( + + {text} + + ), + }, + ); default: return message; } diff --git a/webapp/channels/src/components/cloud_subscribe_result_modal/__snapshots__/error.test.tsx.snap b/webapp/channels/src/components/cloud_subscribe_result_modal/__snapshots__/error.test.tsx.snap index acaf5d5d19..11d2ecaa22 100644 --- a/webapp/channels/src/components/cloud_subscribe_result_modal/__snapshots__/error.test.tsx.snap +++ b/webapp/channels/src/components/cloud_subscribe_result_modal/__snapshots__/error.test.tsx.snap @@ -29,9 +29,11 @@ exports[`components/pricing_modal/downgrade_team_removal_modal matches snapshot forwardedRef={null} intl={ Object { + "$t": [Function], "defaultFormats": Object {}, "defaultLocale": "en", "defaultRichTextElements": undefined, + "fallbackOnEmptyString": true, "formatDate": [Function], "formatDateTimeRange": [Function], "formatDateToParts": [Function], @@ -58,6 +60,7 @@ exports[`components/pricing_modal/downgrade_team_removal_modal matches snapshot "locale": "en", "messages": Object {}, "onError": [Function], + "onWarn": [Function], "textComponent": "span", "timeZone": "Etc/UTC", "wrapRichTextChunksInFragment": undefined, diff --git a/webapp/channels/src/components/cloud_subscribe_result_modal/__snapshots__/success.test.tsx.snap b/webapp/channels/src/components/cloud_subscribe_result_modal/__snapshots__/success.test.tsx.snap index 10328e6da5..42691638be 100644 --- a/webapp/channels/src/components/cloud_subscribe_result_modal/__snapshots__/success.test.tsx.snap +++ b/webapp/channels/src/components/cloud_subscribe_result_modal/__snapshots__/success.test.tsx.snap @@ -29,9 +29,11 @@ exports[`components/pricing_modal/downgrade_team_removal_modal matches snapshot forwardedRef={null} intl={ Object { + "$t": [Function], "defaultFormats": Object {}, "defaultLocale": "en", "defaultRichTextElements": undefined, + "fallbackOnEmptyString": true, "formatDate": [Function], "formatDateTimeRange": [Function], "formatDateToParts": [Function], @@ -58,6 +60,7 @@ exports[`components/pricing_modal/downgrade_team_removal_modal matches snapshot "locale": "en", "messages": Object {}, "onError": [Function], + "onWarn": [Function], "textComponent": "span", "timeZone": "Etc/UTC", "wrapRichTextChunksInFragment": undefined, diff --git a/webapp/channels/src/components/code_block/__snapshots__/code_block.test.tsx.snap b/webapp/channels/src/components/code_block/__snapshots__/code_block.test.tsx.snap index ad8a1dc2ce..5dd6346344 100644 --- a/webapp/channels/src/components/code_block/__snapshots__/code_block.test.tsx.snap +++ b/webapp/channels/src/components/code_block/__snapshots__/code_block.test.tsx.snap @@ -4,10 +4,12 @@ exports[`codeBlock should render html code block with proper indentation after s { id="copyButton" intl={ Object { + "$t": [Function], "defaultFormats": Object {}, "defaultLocale": "en", "defaultRichTextElements": undefined, + "fallbackOnEmptyString": true, "formatDate": [Function], "formatDateTimeRange": [Function], "formatDateToParts": [Function], @@ -321,6 +330,7 @@ const myFunction = () => { "locale": "en", "messages": Object {}, "onError": [Function], + "onWarn": [Function], "textComponent": Symbol(react.fragment), "timeZone": undefined, "wrapRichTextChunksInFragment": undefined, @@ -452,10 +462,12 @@ exports[`codeBlock should render unknown language after syntax highlighting 1`] { + if (!isEnterpriseReady) { + return; + } + Client4.getLicenseSelfServeStatus(). + then((res) => { + setExpansionAvailable(res.is_expandable ?? false); + }). + catch(() => { + setExpansionAvailable(false); + }); + }, [isEnterpriseReady]); + + return !isCloud && !isSelfHostedStarter && !isSalesServeOnly && expansionAvailable; +} diff --git a/webapp/channels/src/components/common/hooks/useControlSelfHostedExpansionModal.ts b/webapp/channels/src/components/common/hooks/useControlSelfHostedExpansionModal.ts new file mode 100644 index 0000000000..b16eeb187f --- /dev/null +++ b/webapp/channels/src/components/common/hooks/useControlSelfHostedExpansionModal.ts @@ -0,0 +1,88 @@ +// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. +// See LICENSE.txt for license information. + +import {useMemo} from 'react'; +import {useDispatch, useSelector} from 'react-redux'; + +import {trackEvent} from 'actions/telemetry_actions'; +import {openModal} from 'actions/views/modals'; +import {ModalIdentifiers, TELEMETRY_CATEGORIES} from 'utils/constants'; +import PurchaseInProgressModal from 'components/purchase_in_progress_modal'; +import {Client4} from 'mattermost-redux/client'; +import {getCurrentUser} from 'mattermost-redux/selectors/entities/common'; +import {HostedCustomerTypes} from 'mattermost-redux/action_types'; + +import {STORAGE_KEY_EXPANSION_IN_PROGRESS} from 'components/self_hosted_purchases/constants'; +import SelfHostedExpansionModal from 'components/self_hosted_purchases/self_hosted_expansion_modal'; + +import {useControlModal, ControlModal} from './useControlModal'; + +interface HookOptions{ + trackingLocation?: string; +} + +export default function useControlSelfHostedExpansionModal(options: HookOptions): ControlModal { + const dispatch = useDispatch(); + const currentUser = useSelector(getCurrentUser); + const controlModal = useControlModal({ + modalId: ModalIdentifiers.SELF_HOSTED_EXPANSION, + dialogType: SelfHostedExpansionModal, + }); + + return useMemo(() => { + return { + ...controlModal, + open: async () => { + const purchaseInProgress = localStorage.getItem(STORAGE_KEY_EXPANSION_IN_PROGRESS) === 'true'; + + // check if user already has an open purchase modal in current browser. + if (purchaseInProgress) { + // User within the same browser session + // is already trying to purchase. Notify them of this + // and request the exit that purchase flow before attempting again. + dispatch(openModal({ + modalId: ModalIdentifiers.EXPANSION_IN_PROGRESS, + dialogType: PurchaseInProgressModal, + dialogProps: { + purchaserEmail: currentUser.email, + storageKey: STORAGE_KEY_EXPANSION_IN_PROGRESS, + }, + })); + return; + } + + trackEvent(TELEMETRY_CATEGORIES.SELF_HOSTED_EXPANSION, 'click_open_expansion_modal', { + callerInfo: options.trackingLocation, + }); + + try { + const result = await Client4.bootstrapSelfHostedSignup(); + + if (result.email !== currentUser.email) { + // Token already exists and was created by another admin. + // Notify user of this and do not allow them to try to expand concurrently. + dispatch(openModal({ + modalId: ModalIdentifiers.EXPANSION_IN_PROGRESS, + dialogType: PurchaseInProgressModal, + dialogProps: { + purchaserEmail: result.email, + storageKey: STORAGE_KEY_EXPANSION_IN_PROGRESS, + }, + })); + return; + } + + dispatch({ + type: HostedCustomerTypes.RECEIVED_SELF_HOSTED_SIGNUP_PROGRESS, + data: result.progress, + }); + + controlModal.open(); + } catch (e) { + // eslint-disable-next-line no-console + console.error('error bootstrapping self hosted purchase modal', e); + } + }, + }; + }, [controlModal, options.trackingLocation]); +} diff --git a/webapp/channels/src/components/common/hooks/useControlSelfHostedPurchaseModal.ts b/webapp/channels/src/components/common/hooks/useControlSelfHostedPurchaseModal.ts index d6e3d1cdec..8de1c55a9d 100644 --- a/webapp/channels/src/components/common/hooks/useControlSelfHostedPurchaseModal.ts +++ b/webapp/channels/src/components/common/hooks/useControlSelfHostedPurchaseModal.ts @@ -7,8 +7,8 @@ import {useDispatch, useSelector} from 'react-redux'; import {trackEvent} from 'actions/telemetry_actions'; import {closeModal, openModal} from 'actions/views/modals'; import {ModalIdentifiers, TELEMETRY_CATEGORIES} from 'utils/constants'; -import SelfHostedPurchaseModal from 'components/self_hosted_purchase_modal'; -import {STORAGE_KEY_PURCHASE_IN_PROGRESS} from 'components/self_hosted_purchase_modal/constants'; +import SelfHostedPurchaseModal from 'components/self_hosted_purchases/self_hosted_purchase_modal'; +import {STORAGE_KEY_PURCHASE_IN_PROGRESS} from 'components/self_hosted_purchases/constants'; import PurchaseInProgressModal from 'components/purchase_in_progress_modal'; import {Client4} from 'mattermost-redux/client'; import {getCurrentUser} from 'mattermost-redux/selectors/entities/common'; @@ -63,6 +63,7 @@ export default function useControlSelfHostedPurchaseModal(options: HookOptions): dialogType: PurchaseInProgressModal, dialogProps: { purchaserEmail: currentUser.email, + storageKey: STORAGE_KEY_PURCHASE_IN_PROGRESS, }, })); return; @@ -86,6 +87,7 @@ export default function useControlSelfHostedPurchaseModal(options: HookOptions): dialogType: PurchaseInProgressModal, dialogProps: { purchaserEmail: result.email, + storageKey: STORAGE_KEY_PURCHASE_IN_PROGRESS, }, })); return; diff --git a/webapp/channels/src/components/common/hooks/useExpandOverageUsersCheck.ts b/webapp/channels/src/components/common/hooks/useExpandOverageUsersCheck.ts index 7caf23f2bf..6ef7bf34b6 100644 --- a/webapp/channels/src/components/common/hooks/useExpandOverageUsersCheck.ts +++ b/webapp/channels/src/components/common/hooks/useExpandOverageUsersCheck.ts @@ -18,6 +18,7 @@ type UseExpandOverageUsersCheckArgs = { shouldRequest: boolean; licenseId?: string; banner: 'global banner' | 'invite modal'; + canSelfHostedExpand: boolean; } export const useExpandOverageUsersCheck = ({ @@ -25,20 +26,30 @@ export const useExpandOverageUsersCheck = ({ isWarningState, licenseId, banner, + canSelfHostedExpand, }: UseExpandOverageUsersCheckArgs) => { const {formatMessage} = useIntl(); const dispatch = useDispatch(); const {getRequestState, is_expandable: isExpandable}: LicenseSelfServeStatusReducer = useSelector((state: GlobalState) => state.entities.cloud.subscriptionStats || {is_expandable: false, getRequestState: 'IDLE'}); const expandableLink = useSelector(getExpandSeatsLink); - const cta = useMemo(() => (isExpandable ? formatMessage({ - id: 'licensingPage.overageUsersBanner.ctaExpandSeats', - defaultMessage: 'Purchase additional seats', - }) : formatMessage({ - id: 'licensingPage.overageUsersBanner.cta', - defaultMessage: 'Contact Sales', - }) - ), [isExpandable]); + const cta = useMemo(() => { + if (isExpandable && !canSelfHostedExpand) { + return formatMessage({ + id: 'licensingPage.overageUsersBanner.ctaExpandSeats', + defaultMessage: 'Purchase additional seats', + }); + } else if (isExpandable && canSelfHostedExpand) { + return formatMessage({ + id: 'licensingPage.overageUsersBanner.ctaUpdateSeats', + defaultMessage: 'Update seat count', + }); + } + return formatMessage({ + id: 'licensingPage.overageUsersBanner.cta', + defaultMessage: 'Contact Sales', + }); + }, [isExpandable]); const trackEventFn = (cta: 'Contact Sales' | 'Self Serve') => { trackEvent('insights', isWarningState ? 'click_true_up_warning' : 'click_true_up_error', { diff --git a/webapp/channels/src/components/create_user_groups_modal/__snapshots__/create_user_groups_modal.test.tsx.snap b/webapp/channels/src/components/create_user_groups_modal/__snapshots__/create_user_groups_modal.test.tsx.snap index e7f6c4ffec..38fb416e91 100644 --- a/webapp/channels/src/components/create_user_groups_modal/__snapshots__/create_user_groups_modal.test.tsx.snap +++ b/webapp/channels/src/components/create_user_groups_modal/__snapshots__/create_user_groups_modal.test.tsx.snap @@ -65,7 +65,6 @@ exports[`component/create_user_groups_modal should match snapshot with back butt
    - +
    = (props: Props) => { const [isPopperOpen, setIsPopperOpen] = useState(false); const {formatMessage} = useIntl(); const timeButtonRef = useRef(null); + const theme = useSelector(getTheme); const handlePopperOpenState = useCallback((isOpen: boolean) => { setIsPopperOpen(isOpen); @@ -149,71 +154,73 @@ const DateTimeInputContainer: React.FC = (props: Props) => { }; return ( -
    -
    - - handlePopperOpenState(true)} - tabIndex={-1} - inputPrefix={inputIcon} - /> - -
    -
    - -
    - - - - {Array.isArray(timeOptions) && timeOptions.map((option, index) => ( - - } + {formatMessage({id: 'custom_status.expiry.time_picker.title', defaultMessage: 'Time'})} + + + +
    + - ))} - -
    - +
    + + + + {Array.isArray(timeOptions) && timeOptions.map((option, index) => ( + + } + /> + ))} + + + +
    -
    + ); }; diff --git a/webapp/channels/src/components/dnd_custom_time_picker_modal/dnd_custom_time_picker_modal.tsx b/webapp/channels/src/components/dnd_custom_time_picker_modal/dnd_custom_time_picker_modal.tsx index 8e83fb47cd..3601380eb2 100644 --- a/webapp/channels/src/components/dnd_custom_time_picker_modal/dnd_custom_time_picker_modal.tsx +++ b/webapp/channels/src/components/dnd_custom_time_picker_modal/dnd_custom_time_picker_modal.tsx @@ -15,6 +15,7 @@ import {ActionFunc} from 'mattermost-redux/types/actions'; import {UserStatus} from '@mattermost/types/users'; import GenericModal from 'components/generic_modal'; +import CompassThemeProvider from 'components/compass_theme_provider/compass_theme_provider'; import Constants, {A11yCustomEventTypes, A11yFocusEventDetail, UserStatuses} from 'utils/constants'; import Menu from 'components/widgets/menu/menu'; @@ -22,15 +23,19 @@ import MenuWrapper from 'components/widgets/menu/menu_wrapper'; import './dnd_custom_time_picker_modal.scss'; import {toUTCUnix} from 'utils/datetime'; -import {isKeyPressed, localizeMessage} from 'utils/utils'; +import {isKeyPressed} from 'utils/keyboard'; +import {localizeMessage} from 'utils/utils'; import Input from 'components/widgets/inputs/input/input'; import DatePicker from 'components/date_picker'; +import {Theme} from 'mattermost-redux/selectors/entities/preferences'; type Props = { onExited: () => void; userId: string; currentDate: Date; locale: string; + + theme: Theme; actions: { setStatus: (status: UserStatus) => ActionFunc; }; @@ -231,63 +236,65 @@ export default class DndCustomTimePicker extends React.PureComponent -
    - - this.handlePopperOpenState(true)} - tabIndex={-1} - inputPrefix={inputIcon} - /> - - - - this.handlePopperOpenState(true)} + tabIndex={-1} + inputPrefix={inputIcon} + /> + + - {timeMenuItems} - - -
    - + + + {timeMenuItems} + + +
    + + ); } } diff --git a/webapp/channels/src/components/dnd_custom_time_picker_modal/index.ts b/webapp/channels/src/components/dnd_custom_time_picker_modal/index.ts index fc5ef38e18..b0aaf0a014 100644 --- a/webapp/channels/src/components/dnd_custom_time_picker_modal/index.ts +++ b/webapp/channels/src/components/dnd_custom_time_picker_modal/index.ts @@ -7,6 +7,7 @@ import {connect} from 'react-redux'; import {bindActionCreators, Dispatch} from 'redux'; import {setStatus} from 'mattermost-redux/actions/users'; +import {getTheme} from 'mattermost-redux/selectors/entities/preferences'; import {getCurrentUserId} from 'mattermost-redux/selectors/entities/users'; @@ -19,10 +20,12 @@ const DndCustomTimePicker = makeAsyncComponent('DndCustomTimePicker', React.lazy function mapStateToProps(state: GlobalState) { const userId = getCurrentUserId(state); const locale = getCurrentLocale(state); + const theme = getTheme(state); return { userId, locale, + theme, }; } diff --git a/webapp/channels/src/components/do_verify_email/do_verify_email.tsx b/webapp/channels/src/components/do_verify_email/do_verify_email.tsx index 7b03d9e7d5..52390fa461 100644 --- a/webapp/channels/src/components/do_verify_email/do_verify_email.tsx +++ b/webapp/channels/src/components/do_verify_email/do_verify_email.tsx @@ -15,7 +15,7 @@ import LoadingScreen from 'components/loading_screen'; import {clearErrors, logError} from 'mattermost-redux/actions/errors'; import {verifyUserEmail, getMe} from 'mattermost-redux/actions/users'; -import {getUseCaseOnboarding} from 'mattermost-redux/selectors/entities/preferences'; +import {getIsOnboardingFlowEnabled} from 'mattermost-redux/selectors/entities/preferences'; import {getCurrentUserId} from 'mattermost-redux/selectors/entities/users'; import {DispatchFunc} from 'mattermost-redux/types/actions'; @@ -40,7 +40,7 @@ const DoVerifyEmail = () => { const token = params.get('token') ?? ''; const loggedIn = Boolean(useSelector(getCurrentUserId)); - const useCaseOnboarding = useSelector(getUseCaseOnboarding); + const onboardingFlowEnabled = useSelector(getIsOnboardingFlowEnabled); const [verifyStatus, setVerifyStatus] = useState(VerifyStatus.PENDING); const [serverError, setServerError] = useState(''); @@ -52,7 +52,7 @@ const DoVerifyEmail = () => { const handleRedirect = () => { if (loggedIn) { - if (useCaseOnboarding) { + if (onboardingFlowEnabled) { // need info about whether admin or not, // and whether admin has already completed // first time onboarding. Instead of fetching and orchestrating that here, @@ -60,7 +60,6 @@ const DoVerifyEmail = () => { history.push('/'); return; } - redirectUserToDefaultTeam(); return; } diff --git a/webapp/channels/src/components/dot_menu/__snapshots__/dot_menu.test.tsx.snap b/webapp/channels/src/components/dot_menu/__snapshots__/dot_menu.test.tsx.snap index 490e16e2da..93cfa8e998 100644 --- a/webapp/channels/src/components/dot_menu/__snapshots__/dot_menu.test.tsx.snap +++ b/webapp/channels/src/components/dot_menu/__snapshots__/dot_menu.test.tsx.snap @@ -9,7 +9,7 @@ Object { aria-controls="CENTER_dropdown_post_id_1" aria-expanded="false" aria-haspopup="true" - aria-label="Actions" + aria-label="more" class="post-menu__item" data-testid="PostDotMenu-Button-post_id_1" id="CENTER_button_post_id_1" @@ -34,7 +34,7 @@ Object { aria-controls="CENTER_dropdown_post_id_1" aria-expanded="false" aria-haspopup="true" - aria-label="Actions" + aria-label="more" class="post-menu__item" data-testid="PostDotMenu-Button-post_id_1" id="CENTER_button_post_id_1" @@ -121,7 +121,7 @@ exports[`components/dot_menu/DotMenu should match snapshot, on Center 1`] = ` } menuButton={ Object { - "aria-label": "Actions", + "aria-label": "more", "children": , diff --git a/webapp/channels/src/components/dot_menu/dot_menu.tsx b/webapp/channels/src/components/dot_menu/dot_menu.tsx index 46067b6abe..255d05a466 100644 --- a/webapp/channels/src/components/dot_menu/dot_menu.tsx +++ b/webapp/channels/src/components/dot_menu/dot_menu.tsx @@ -28,6 +28,7 @@ import Permissions from 'mattermost-redux/constants/permissions'; import {Locations, ModalIdentifiers, Constants, TELEMETRY_LABELS} from 'utils/constants'; import DeletePostModal from 'components/delete_post_modal'; import DelayedAction from 'utils/delayed_action'; +import * as Keyboard from 'utils/keyboard'; import * as PostUtils from 'utils/post_utils'; import * as Menu from 'components/menu'; import * as Utils from 'utils/utils'; @@ -337,61 +338,61 @@ export class DotMenuClass extends React.PureComponent { const isShiftKeyPressed = e.shiftKey; switch (true) { - case Utils.isKeyPressed(e, Constants.KeyCodes.R): + case Keyboard.isKeyPressed(e, Constants.KeyCodes.R): this.handleCommentClick(e); this.handleDropdownOpened(false); break; // edit post - case Utils.isKeyPressed(e, Constants.KeyCodes.E): + case Keyboard.isKeyPressed(e, Constants.KeyCodes.E): this.handleEditMenuItemActivated(e); this.handleDropdownOpened(false); break; // follow thread - case Utils.isKeyPressed(e, Constants.KeyCodes.F) && !isShiftKeyPressed: + case Keyboard.isKeyPressed(e, Constants.KeyCodes.F) && !isShiftKeyPressed: this.handleSetThreadFollow(e); this.handleDropdownOpened(false); break; // forward post - case Utils.isKeyPressed(e, Constants.KeyCodes.F) && isShiftKeyPressed: + case Keyboard.isKeyPressed(e, Constants.KeyCodes.F) && isShiftKeyPressed: this.handleForwardMenuItemActivated(e); this.handleDropdownOpened(false); break; // copy link - case Utils.isKeyPressed(e, Constants.KeyCodes.K): + case Keyboard.isKeyPressed(e, Constants.KeyCodes.K): this.copyLink(e); this.handleDropdownOpened(false); break; // copy text - case Utils.isKeyPressed(e, Constants.KeyCodes.C): + case Keyboard.isKeyPressed(e, Constants.KeyCodes.C): this.copyText(e); this.handleDropdownOpened(false); break; // delete post - case Utils.isKeyPressed(e, Constants.KeyCodes.DELETE): + case Keyboard.isKeyPressed(e, Constants.KeyCodes.DELETE): this.handleDeleteMenuItemActivated(e); this.handleDropdownOpened(false); break; // pin / unpin - case Utils.isKeyPressed(e, Constants.KeyCodes.P): + case Keyboard.isKeyPressed(e, Constants.KeyCodes.P): this.handlePinMenuItemActivated(e); this.handleDropdownOpened(false); break; // save / unsave - case Utils.isKeyPressed(e, Constants.KeyCodes.S): + case Keyboard.isKeyPressed(e, Constants.KeyCodes.S): this.handleFlagMenuItemActivated(e); this.handleDropdownOpened(false); break; // mark as unread - case Utils.isKeyPressed(e, Constants.KeyCodes.U): + case Keyboard.isKeyPressed(e, Constants.KeyCodes.U): this.handleMarkPostAsUnread(e); this.handleDropdownOpened(false); break; @@ -496,7 +497,7 @@ export class DotMenuClass extends React.PureComponent { class: classNames('post-menu__item', { 'post-menu__item--active': this.props.isMenuOpen, }), - 'aria-label': formatMessage({id: 'post_info.dot_menu.tooltip.more_actions', defaultMessage: 'Actions'}), + 'aria-label': formatMessage({id: 'post_info.dot_menu.tooltip.more', defaultMessage: 'More'}).toLowerCase(), children: , }} menu={{ @@ -509,7 +510,7 @@ export class DotMenuClass extends React.PureComponent { }} menuButtonTooltip={{ id: `PostDotMenu-ButtonTooltip-${this.props.post.id}`, - text: formatMessage({id: 'post_info.dot_menu.tooltip.more_actions', defaultMessage: 'More'}), + text: formatMessage({id: 'post_info.dot_menu.tooltip.more', defaultMessage: 'More'}), class: 'hidden-xs', }} > diff --git a/webapp/channels/src/components/drafts/__snapshots__/draft_row.test.tsx.snap b/webapp/channels/src/components/drafts/__snapshots__/draft_row.test.tsx.snap index cde2a61f2c..e3407af6f6 100644 --- a/webapp/channels/src/components/drafts/__snapshots__/draft_row.test.tsx.snap +++ b/webapp/channels/src/components/drafts/__snapshots__/draft_row.test.tsx.snap @@ -39,6 +39,7 @@ exports[`components/drafts/drafts_row should match snapshot for channel draft 1` "type": "channel", } } + isRemote={false} status={Object {}} user={Object {}} /> @@ -84,6 +85,7 @@ exports[`components/drafts/drafts_row should match snapshot for thread draft 1`] "type": "thread", } } + isRemote={false} status={Object {}} user={Object {}} /> diff --git a/webapp/channels/src/components/drafts/__snapshots__/drafts.test.tsx.snap b/webapp/channels/src/components/drafts/__snapshots__/drafts.test.tsx.snap index c77a7d5c70..c95826930d 100644 --- a/webapp/channels/src/components/drafts/__snapshots__/drafts.test.tsx.snap +++ b/webapp/channels/src/components/drafts/__snapshots__/drafts.test.tsx.snap @@ -34,6 +34,7 @@ exports[`components/drafts/drafts should match snapshot 1`] = ` > { type: 'channel' as 'channel' | 'thread', user: {} as UserProfile, value: {} as PostDraft, + isRemote: false, }; it('should match snapshot for channel draft', () => { diff --git a/webapp/channels/src/components/drafts/channel_draft/channel_draft.tsx b/webapp/channels/src/components/drafts/channel_draft/channel_draft.tsx index 4ac7c15608..3ec5dd72d1 100644 --- a/webapp/channels/src/components/drafts/channel_draft/channel_draft.tsx +++ b/webapp/channels/src/components/drafts/channel_draft/channel_draft.tsx @@ -29,6 +29,7 @@ type Props = { type: 'channel' | 'thread'; user: UserProfile; value: PostDraft; + isRemote: boolean; } function ChannelDraft({ @@ -40,6 +41,7 @@ function ChannelDraft({ type, user, value, + isRemote, }: Props) { const dispatch = useDispatch(); const history = useHistory(); @@ -101,7 +103,7 @@ function ChannelDraft({ /> )} timestamp={value.updateAt} - remote={value.remote || false} + remote={isRemote || false} /> - + `; exports[`components/drafts/draft_actions/delete_draft_modal should have called onExited 1`] = ` - - + `; exports[`components/drafts/draft_actions/delete_draft_modal should match snapshot 1`] = ` diff --git a/webapp/channels/src/components/drafts/draft_actions/__snapshots__/send_draft_modal.test.tsx.snap b/webapp/channels/src/components/drafts/draft_actions/__snapshots__/send_draft_modal.test.tsx.snap index 548c04c4c5..cf89abf778 100644 --- a/webapp/channels/src/components/drafts/draft_actions/__snapshots__/send_draft_modal.test.tsx.snap +++ b/webapp/channels/src/components/drafts/draft_actions/__snapshots__/send_draft_modal.test.tsx.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`components/drafts/draft_actions/send_draft_modal should have called onConfirm 1`] = ` - - + `; exports[`components/drafts/draft_actions/send_draft_modal should have called onExited 1`] = ` - - + `; exports[`components/drafts/draft_actions/send_draft_modal should match snapshot 1`] = ` diff --git a/webapp/channels/src/components/drafts/draft_row.test.tsx b/webapp/channels/src/components/drafts/draft_row.test.tsx index 89cd429588..2c08fe68c1 100644 --- a/webapp/channels/src/components/drafts/draft_row.test.tsx +++ b/webapp/channels/src/components/drafts/draft_row.test.tsx @@ -21,6 +21,7 @@ describe('components/drafts/drafts_row', () => { user: {} as UserProfile, status: {} as UserStatus['status'], displayName: 'test', + isRemote: false, }; it('should match snapshot for channel draft', () => { diff --git a/webapp/channels/src/components/drafts/draft_row.tsx b/webapp/channels/src/components/drafts/draft_row.tsx index 18913dd03e..004dbfb554 100644 --- a/webapp/channels/src/components/drafts/draft_row.tsx +++ b/webapp/channels/src/components/drafts/draft_row.tsx @@ -14,9 +14,10 @@ type Props = { status: UserStatus['status']; displayName: string; draft: Draft; + isRemote: boolean; } -function DraftRow({draft, user, status, displayName}: Props) { +function DraftRow({draft, user, status, displayName, isRemote}: Props) { switch (draft.type) { case 'channel': return ( @@ -26,6 +27,7 @@ function DraftRow({draft, user, status, displayName}: Props) { user={user} status={status} displayName={displayName} + isRemote={isRemote} /> ); case 'thread': @@ -37,6 +39,7 @@ function DraftRow({draft, user, status, displayName}: Props) { user={user} status={status} displayName={displayName} + isRemote={isRemote} /> ); default: diff --git a/webapp/channels/src/components/drafts/drafts.test.tsx b/webapp/channels/src/components/drafts/drafts.test.tsx index 0c5527c743..3453780f41 100644 --- a/webapp/channels/src/components/drafts/drafts.test.tsx +++ b/webapp/channels/src/components/drafts/drafts.test.tsx @@ -20,6 +20,7 @@ describe('components/drafts/drafts', () => { displayName: 'display_name', status: {} as UserStatus['status'], localDraftsAreEnabled: true, + draftRemotes: {}, }; it('should match snapshot', () => { diff --git a/webapp/channels/src/components/drafts/drafts.tsx b/webapp/channels/src/components/drafts/drafts.tsx index b929e1cd17..a2f499fe11 100644 --- a/webapp/channels/src/components/drafts/drafts.tsx +++ b/webapp/channels/src/components/drafts/drafts.tsx @@ -27,11 +27,13 @@ type Props = { displayName: string; status: UserStatus['status']; localDraftsAreEnabled: boolean; + draftRemotes: Record; } function Drafts({ displayName, drafts, + draftRemotes, status, user, localDraftsAreEnabled, @@ -75,6 +77,7 @@ function Drafts({ key={d.key} displayName={displayName} draft={d} + isRemote={draftRemotes[d.key]} user={user} status={status} /> diff --git a/webapp/channels/src/components/drafts/index.ts b/webapp/channels/src/components/drafts/index.ts index 201f6102c1..11347f4d12 100644 --- a/webapp/channels/src/components/drafts/index.ts +++ b/webapp/channels/src/components/drafts/index.ts @@ -22,6 +22,7 @@ function makeMapStateToProps() { return { displayName: displayUsername(user, getTeammateNameDisplaySetting(state)), drafts: getDrafts(state), + draftRemotes: state.views.drafts.remotes, status, user, localDraftsAreEnabled: localDraftsAreEnabled(state), diff --git a/webapp/channels/src/components/drafts/panel/__snapshots__/panel_body.test.tsx.snap b/webapp/channels/src/components/drafts/panel/__snapshots__/panel_body.test.tsx.snap index 3026f7a40e..45e0bcc69f 100644 --- a/webapp/channels/src/components/drafts/panel/__snapshots__/panel_body.test.tsx.snap +++ b/webapp/channels/src/components/drafts/panel/__snapshots__/panel_body.test.tsx.snap @@ -73,9 +73,11 @@ exports[`components/drafts/panel/panel_body should have called handleFormattedTe hide={[Function]} intl={ Object { + "$t": [Function], "defaultFormats": Object {}, "defaultLocale": "en", "defaultRichTextElements": undefined, + "fallbackOnEmptyString": true, "formatDate": [Function], "formatDateTimeRange": [Function], "formatDateToParts": [Function], @@ -102,6 +104,7 @@ exports[`components/drafts/panel/panel_body should have called handleFormattedTe "locale": "en", "messages": Object {}, "onError": [Function], + "onWarn": [Function], "textComponent": "span", "timeZone": "Etc/UTC", "wrapRichTextChunksInFragment": undefined, @@ -351,9 +354,11 @@ exports[`components/drafts/panel/panel_body should match snapshot 1`] = ` hide={[Function]} intl={ Object { + "$t": [Function], "defaultFormats": Object {}, "defaultLocale": "en", "defaultRichTextElements": undefined, + "fallbackOnEmptyString": true, "formatDate": [Function], "formatDateTimeRange": [Function], "formatDateToParts": [Function], @@ -380,6 +385,7 @@ exports[`components/drafts/panel/panel_body should match snapshot 1`] = ` "locale": "en", "messages": Object {}, "onError": [Function], + "onWarn": [Function], "textComponent": "span", "timeZone": "Etc/UTC", "wrapRichTextChunksInFragment": undefined, @@ -635,9 +641,11 @@ exports[`components/drafts/panel/panel_body should match snapshot for priority 1 hide={[Function]} intl={ Object { + "$t": [Function], "defaultFormats": Object {}, "defaultLocale": "en", "defaultRichTextElements": undefined, + "fallbackOnEmptyString": true, "formatDate": [Function], "formatDateTimeRange": [Function], "formatDateToParts": [Function], @@ -664,6 +672,7 @@ exports[`components/drafts/panel/panel_body should match snapshot for priority 1 "locale": "en", "messages": Object {}, "onError": [Function], + "onWarn": [Function], "textComponent": "span", "timeZone": "Etc/UTC", "wrapRichTextChunksInFragment": undefined, @@ -777,7 +786,7 @@ exports[`components/drafts/panel/panel_body should match snapshot for priority 1 @@ -809,7 +818,7 @@ exports[`components/drafts/panel/panel_body should match snapshot for priority 1 - IMPORTANT + Important
    @@ -989,9 +998,11 @@ exports[`components/drafts/panel/panel_body should match snapshot for requested_ hide={[Function]} intl={ Object { + "$t": [Function], "defaultFormats": Object {}, "defaultLocale": "en", "defaultRichTextElements": undefined, + "fallbackOnEmptyString": true, "formatDate": [Function], "formatDateTimeRange": [Function], "formatDateToParts": [Function], @@ -1018,6 +1029,7 @@ exports[`components/drafts/panel/panel_body should match snapshot for requested_ "locale": "en", "messages": Object {}, "onError": [Function], + "onWarn": [Function], "textComponent": "span", "timeZone": "Etc/UTC", "wrapRichTextChunksInFragment": undefined, diff --git a/webapp/channels/src/components/drafts/thread_draft/__snapshots__/thread_draft.test.tsx.snap b/webapp/channels/src/components/drafts/thread_draft/__snapshots__/thread_draft.test.tsx.snap index 8881d2f961..b4e4330511 100644 --- a/webapp/channels/src/components/drafts/thread_draft/__snapshots__/thread_draft.test.tsx.snap +++ b/webapp/channels/src/components/drafts/thread_draft/__snapshots__/thread_draft.test.tsx.snap @@ -42,6 +42,7 @@ exports[`components/drafts/drafts_row should match snapshot for channel draft 1` displayName="" draftId="" id={Object {}} + isRemote={false} rootId="" status={Object {}} thread={ @@ -98,6 +99,7 @@ exports[`components/drafts/drafts_row should match snapshot for undefined thread displayName="" draftId="" id={Object {}} + isRemote={false} rootId="" status={Object {}} thread={null} diff --git a/webapp/channels/src/components/drafts/thread_draft/thread_draft.test.tsx b/webapp/channels/src/components/drafts/thread_draft/thread_draft.test.tsx index f35378ab58..30635e4aa9 100644 --- a/webapp/channels/src/components/drafts/thread_draft/thread_draft.test.tsx +++ b/webapp/channels/src/components/drafts/thread_draft/thread_draft.test.tsx @@ -31,6 +31,7 @@ describe('components/drafts/drafts_row', () => { type: 'thread' as 'channel' | 'thread', user: {} as UserProfile, value: {} as PostDraft, + isRemote: false, }; it('should match snapshot for channel draft', () => { diff --git a/webapp/channels/src/components/drafts/thread_draft/thread_draft.tsx b/webapp/channels/src/components/drafts/thread_draft/thread_draft.tsx index 6856e135bf..e789ddc243 100644 --- a/webapp/channels/src/components/drafts/thread_draft/thread_draft.tsx +++ b/webapp/channels/src/components/drafts/thread_draft/thread_draft.tsx @@ -33,6 +33,7 @@ type Props = { type: 'channel' | 'thread'; user: UserProfile; value: PostDraft; + isRemote: boolean; } function ThreadDraft({ @@ -45,6 +46,7 @@ function ThreadDraft({ type, user, value, + isRemote, }: Props) { const dispatch = useDispatch(); @@ -107,7 +109,7 @@ function ThreadDraft({ /> )} timestamp={value.updateAt} - remote={value.remote || false} + remote={isRemote || false} /> { if (Utils.isUnhandledLineBreakKeyCombo(e)) { e.preventDefault(); this.setState({purpose: Utils.insertLineBreakFromKeyEvent(e as React.KeyboardEvent)}); - } else if (ctrlSend && Utils.isKeyPressed(e, Constants.KeyCodes.ENTER) && e.ctrlKey) { + } else if (ctrlSend && Keyboard.isKeyPressed(e, Constants.KeyCodes.ENTER) && e.ctrlKey) { e.preventDefault(); this.handleSave(); - } else if (!ctrlSend && Utils.isKeyPressed(e, Constants.KeyCodes.ENTER) && !e.shiftKey && !e.altKey) { + } else if (!ctrlSend && Keyboard.isKeyPressed(e, Constants.KeyCodes.ENTER) && !e.shiftKey && !e.altKey) { e.preventDefault(); this.handleSave(); } diff --git a/webapp/channels/src/components/edit_post/edit_post.tsx b/webapp/channels/src/components/edit_post/edit_post.tsx index 9a467ebbbf..81c9ea4667 100644 --- a/webapp/channels/src/components/edit_post/edit_post.tsx +++ b/webapp/channels/src/components/edit_post/edit_post.tsx @@ -10,6 +10,7 @@ import {Post} from '@mattermost/types/posts'; import {Emoji, SystemEmoji} from '@mattermost/types/emojis'; import {AppEvents, Constants, ModalIdentifiers, StoragePrefixes} from 'utils/constants'; +import * as Keyboard from 'utils/keyboard'; import { formatGithubCodePaste, formatMarkdownMessage, @@ -220,7 +221,13 @@ const EditPost = ({editingPost, actions, canEditPost, config, channelId, draft, actions.unsetEditingPost(); }; - const handleAutomatedRefocusAndExit = () => handleRefocusAndExit(editingPost.refocusId || null); + const handleAutomatedRefocusAndExit = () => { + draftRef.current = { + ...draftRef.current, + message: '', + }; + handleRefocusAndExit(editingPost.refocusId || null); + }; const handleEdit = async () => { if (!editingPost.post || isSaveDisabled()) { @@ -302,13 +309,13 @@ const EditPost = ({editingPost, actions, canEditPost, config, channelId, draft, const {ctrlSend, codeBlockOnCtrlEnter} = rest; const ctrlOrMetaKeyPressed = e.ctrlKey || e.metaKey; - const ctrlKeyCombo = Utils.cmdOrCtrlPressed(e) && !e.altKey && !e.shiftKey; - const ctrlAltCombo = Utils.cmdOrCtrlPressed(e, true) && e.altKey; + const ctrlKeyCombo = Keyboard.cmdOrCtrlPressed(e) && !e.altKey && !e.shiftKey; + const ctrlAltCombo = Keyboard.cmdOrCtrlPressed(e, true) && e.altKey; const ctrlEnterKeyCombo = (ctrlSend || codeBlockOnCtrlEnter) && - Utils.isKeyPressed(e, KeyCodes.ENTER) && + Keyboard.isKeyPressed(e, KeyCodes.ENTER) && ctrlOrMetaKeyPressed; - const markdownLinkKey = Utils.isKeyPressed(e, KeyCodes.K); + const markdownLinkKey = Keyboard.isKeyPressed(e, KeyCodes.K); // listen for line break key combo and insert new line character if (Utils.isUnhandledLineBreakKeyCombo(e)) { @@ -316,7 +323,7 @@ const EditPost = ({editingPost, actions, canEditPost, config, channelId, draft, setEditText(Utils.insertLineBreakFromKeyEvent(e as React.KeyboardEvent)); } else if (ctrlEnterKeyCombo) { handleEdit(); - } else if (Utils.isKeyPressed(e, KeyCodes.ESCAPE) && !showEmojiPicker) { + } else if (Keyboard.isKeyPressed(e, KeyCodes.ESCAPE) && !showEmojiPicker) { handleAutomatedRefocusAndExit(); } else if (ctrlAltCombo && markdownLinkKey) { applyHotkeyMarkdown({ @@ -325,14 +332,14 @@ const EditPost = ({editingPost, actions, canEditPost, config, channelId, draft, selectionEnd: e.currentTarget.selectionEnd, message: e.currentTarget.value, }); - } else if (ctrlKeyCombo && Utils.isKeyPressed(e, KeyCodes.B)) { + } else if (ctrlKeyCombo && Keyboard.isKeyPressed(e, KeyCodes.B)) { applyHotkeyMarkdown({ markdownMode: 'bold', selectionStart: e.currentTarget.selectionStart, selectionEnd: e.currentTarget.selectionEnd, message: e.currentTarget.value, }); - } else if (ctrlKeyCombo && Utils.isKeyPressed(e, KeyCodes.I)) { + } else if (ctrlKeyCombo && Keyboard.isKeyPressed(e, KeyCodes.I)) { applyHotkeyMarkdown({ markdownMode: 'italic', selectionStart: e.currentTarget.selectionStart, diff --git a/webapp/channels/src/components/edit_post/edit_post_footer.tsx b/webapp/channels/src/components/edit_post/edit_post_footer.tsx index 12971eb2cc..432c27eebe 100644 --- a/webapp/channels/src/components/edit_post/edit_post_footer.tsx +++ b/webapp/channels/src/components/edit_post/edit_post_footer.tsx @@ -8,7 +8,7 @@ import {FormattedMessage} from 'react-intl'; import {getBool} from 'mattermost-redux/selectors/entities/preferences'; import {Preferences} from 'mattermost-redux/constants'; -import {isMac} from 'utils/utils'; +import {isMac} from 'utils/user_agent'; import {GlobalState} from 'types/store'; type Props = { diff --git a/webapp/channels/src/components/emoji_picker/components/emoji_picker_preview.tsx b/webapp/channels/src/components/emoji_picker/components/emoji_picker_preview.tsx index 12e0905332..b52a3a8ace 100644 --- a/webapp/channels/src/components/emoji_picker/components/emoji_picker_preview.tsx +++ b/webapp/channels/src/components/emoji_picker/components/emoji_picker_preview.tsx @@ -18,7 +18,7 @@ function EmojiPickerPreview({emoji}: Props) { return (
    diff --git a/webapp/channels/src/components/error_page/error_page.tsx b/webapp/channels/src/components/error_page/error_page.tsx index 349f978d7c..d180549721 100644 --- a/webapp/channels/src/components/error_page/error_page.tsx +++ b/webapp/channels/src/components/error_page/error_page.tsx @@ -79,7 +79,7 @@ export default class ErrorPage extends React.PureComponent { backButton = ( { backButton = ( { expect.stringMatching('test'), ); }); + + it('renders href correctly when url contains anchor by setting anchor at the end', () => { + const state = { + ...initialState, + entities: { + ...initialState.entities, + general: { + ...initialState?.entities?.general, + config: { + DiagnosticsEnabled: 'true', + }, + }, + }, + }; + const store: GlobalState = JSON.parse(JSON.stringify(state)); + renderWithIntlAndStore( + + {'Click Me'} + , + store, + ); + + expect(screen.queryByText('Click Me')).toHaveAttribute( + 'href', + 'https://mattermost.com?utm_source=mattermost&utm_medium=in-product-cloud&utm_content=&uid=currentUserId&sid=#desktop', + ); + }); }); diff --git a/webapp/channels/src/components/external_link/index.tsx b/webapp/channels/src/components/external_link/index.tsx index d72779e212..76e34aff6f 100644 --- a/webapp/channels/src/components/external_link/index.tsx +++ b/webapp/channels/src/components/external_link/index.tsx @@ -52,7 +52,11 @@ export default function ExternalLink(props: Props) { // If the href already has query params, remove them before adding them back with the addition of the new ones href = href?.split('?')[0]; } - href = `${href}?${queryString}`; + const anchor = new URL(href).hash; + if (anchor) { + href = href.replace(anchor, ''); + } + href = `${href}?${queryString}${anchor ?? ''}`; } const handleClick = (e: React.MouseEvent) => { diff --git a/webapp/channels/src/components/feature_restricted_modal/feature_restricted_modal.tsx b/webapp/channels/src/components/feature_restricted_modal/feature_restricted_modal.tsx index 547dcd9fc5..c86cc27e0a 100644 --- a/webapp/channels/src/components/feature_restricted_modal/feature_restricted_modal.tsx +++ b/webapp/channels/src/components/feature_restricted_modal/feature_restricted_modal.tsx @@ -13,6 +13,7 @@ import {checkHadPriorTrial} from 'mattermost-redux/selectors/entities/cloud'; import {isCurrentUserSystemAdmin} from 'mattermost-redux/selectors/entities/users'; import {getLicense} from 'mattermost-redux/selectors/entities/general'; import {getPrevTrialLicense} from 'mattermost-redux/actions/admin'; +import {deprecateCloudFree} from 'mattermost-redux/selectors/entities/preferences'; import CloudStartTrialButton from 'components/cloud_start_trial/cloud_start_trial_btn'; import StartTrialBtn from 'components/learn_more_trial_modal/start_trial_btn'; @@ -59,6 +60,7 @@ const FeatureRestrictedModal = ({ dispatch(getPrevTrialLicense()); }, []); + const cloudFreeDeprecated = useSelector(deprecateCloudFree); const hasCloudPriorTrial = useSelector(checkHadPriorTrial); const prevTrialLicense = useSelector((state: GlobalState) => state.entities.admin.prevTrialLicense); const hasSelfHostedPriorTrial = prevTrialLicense.IsLicensed === 'true'; @@ -100,7 +102,7 @@ const FeatureRestrictedModal = ({ const getTitle = () => { if (isSystemAdmin) { - return hasPriorTrial ? titleAdminPostTrial : titleAdminPreTrial; + return (hasPriorTrial || cloudFreeDeprecated) ? titleAdminPostTrial : titleAdminPreTrial; } return titleEndUser; @@ -108,13 +110,13 @@ const FeatureRestrictedModal = ({ const getMessage = () => { if (isSystemAdmin) { - return hasPriorTrial ? messageAdminPostTrial : messageAdminPreTrial; + return (hasPriorTrial || cloudFreeDeprecated) ? messageAdminPostTrial : messageAdminPreTrial; } return messageEndUser; }; - const showStartTrial = isSystemAdmin && !hasPriorTrial; + const showStartTrial = isSystemAdmin && !hasPriorTrial && !cloudFreeDeprecated; // define what is the secondary button text and action, by default will be the View Plan button let secondaryBtnMsg = formatMessage({id: 'feature_restricted_modal.button.plans', defaultMessage: 'View plans'}); diff --git a/webapp/channels/src/components/feedback_modal/feedback.tsx b/webapp/channels/src/components/feedback_modal/feedback.tsx index 3f612017be..8b6c64aebe 100644 --- a/webapp/channels/src/components/feedback_modal/feedback.tsx +++ b/webapp/channels/src/components/feedback_modal/feedback.tsx @@ -6,7 +6,7 @@ import React, {useState} from 'react'; import {injectIntl, WrappedComponentProps} from 'react-intl'; import {useDispatch} from 'react-redux'; -import {GenericModal} from '@mattermost/components'; +import {LegacyGenericModal} from '@mattermost/components'; import {Feedback} from '@mattermost/types/cloud'; import {closeModal} from 'actions/views/modals'; import RadioButtonGroup from 'components/common/radio_group'; @@ -59,7 +59,7 @@ function FeedbackModal(props: Props) { }; return ( - } - + ); } diff --git a/webapp/channels/src/components/file_preview_modal/file_preview_modal.tsx b/webapp/channels/src/components/file_preview_modal/file_preview_modal.tsx index eecca2d3fa..ec031aaef4 100644 --- a/webapp/channels/src/components/file_preview_modal/file_preview_modal.tsx +++ b/webapp/channels/src/components/file_preview_modal/file_preview_modal.tsx @@ -12,6 +12,7 @@ import {Post} from '@mattermost/types/posts'; import {getFileDownloadUrl, getFilePreviewUrl, getFileUrl} from 'mattermost-redux/utils/file_utils'; import LoadingImagePreview from 'components/loading_image_preview'; import Constants, {FileTypes, ZoomSettings} from 'utils/constants'; +import * as Keyboard from 'utils/keyboard'; import * as Utils from 'utils/utils'; import AudioVideoPreview from 'components/audio_video_preview'; import CodePreview from 'components/code_preview'; @@ -115,9 +116,9 @@ export default class FilePreviewModal extends React.PureComponent }; handleKeyPress = (e: KeyboardEvent) => { - if (Utils.isKeyPressed(e, KeyCodes.RIGHT)) { + if (Keyboard.isKeyPressed(e, KeyCodes.RIGHT)) { this.handleNext(); - } else if (Utils.isKeyPressed(e, KeyCodes.LEFT)) { + } else if (Keyboard.isKeyPressed(e, KeyCodes.LEFT)) { this.handlePrev(); } }; diff --git a/webapp/channels/src/components/file_preview_modal/file_preview_modal_main_nav/__snapshots__/file_preview_modal_main_nav.test.tsx.snap b/webapp/channels/src/components/file_preview_modal/file_preview_modal_main_nav/__snapshots__/file_preview_modal_main_nav.test.tsx.snap index 257b5c6d24..2d162de260 100644 --- a/webapp/channels/src/components/file_preview_modal/file_preview_modal_main_nav/__snapshots__/file_preview_modal_main_nav.test.tsx.snap +++ b/webapp/channels/src/components/file_preview_modal/file_preview_modal_main_nav/__snapshots__/file_preview_modal_main_nav.test.tsx.snap @@ -14,7 +14,7 @@ exports[`components/file_preview_modal/file_preview_modal_main_nav/FilePreviewMo > } diff --git a/webapp/channels/src/components/file_preview_modal/file_preview_modal_main_nav/file_preview_modal_main_nav.tsx b/webapp/channels/src/components/file_preview_modal/file_preview_modal_main_nav/file_preview_modal_main_nav.tsx index 4f97c4e7a8..ebb6cf5d59 100644 --- a/webapp/channels/src/components/file_preview_modal/file_preview_modal_main_nav/file_preview_modal_main_nav.tsx +++ b/webapp/channels/src/components/file_preview_modal/file_preview_modal_main_nav/file_preview_modal_main_nav.tsx @@ -26,7 +26,7 @@ const FilePreviewModalMainNav: React.FC = (props: Props) => { overlay={ diff --git a/webapp/channels/src/components/file_upload/file_upload.tsx b/webapp/channels/src/components/file_upload/file_upload.tsx index 50ccafc021..26513bb951 100644 --- a/webapp/channels/src/components/file_upload/file_upload.tsx +++ b/webapp/channels/src/components/file_upload/file_upload.tsx @@ -12,6 +12,7 @@ import dragster from 'utils/dragster'; import Constants from 'utils/constants'; import DelayedAction from 'utils/delayed_action'; import {t} from 'utils/i18n'; +import {cmdOrCtrlPressed, isKeyPressed} from 'utils/keyboard'; import { isIosChrome, isMobileApp, @@ -19,8 +20,6 @@ import { import {getTable} from 'utils/paste'; import { clearFileInput, - cmdOrCtrlPressed, - isKeyPressed, generateId, isFileTransfer, isUriDrop, diff --git a/webapp/channels/src/components/forward_post_modal/forward_post_comment_input.tsx b/webapp/channels/src/components/forward_post_modal/forward_post_comment_input.tsx index 4923cd7ac3..bca35dd1e6 100644 --- a/webapp/channels/src/components/forward_post_modal/forward_post_comment_input.tsx +++ b/webapp/channels/src/components/forward_post_modal/forward_post_comment_input.tsx @@ -12,6 +12,7 @@ import Textbox, {TextboxClass, TextboxElement} from 'components/textbox'; import Constants from 'utils/constants'; import {applyMarkdown, ApplyMarkdownOptions} from 'utils/markdown/apply_markdown'; +import * as Keyboard from 'utils/keyboard'; import * as Utils from 'utils/utils'; import {GlobalState} from 'types/store'; @@ -77,13 +78,13 @@ const ForwardPostCommentInput = ({channelId, canForwardPost, comment, permaLinkL }; const handleKeyDown = (e: React.KeyboardEvent) => { - const ctrlKeyCombo = Utils.cmdOrCtrlPressed(e) && !e.altKey && !e.shiftKey; - const ctrlAltCombo = Utils.cmdOrCtrlPressed(e, true) && e.altKey; - const ctrlShiftCombo = Utils.cmdOrCtrlPressed(e, true) && e.shiftKey; - const markdownLinkKey = Utils.isKeyPressed(e, KeyCodes.K); + const ctrlKeyCombo = Keyboard.cmdOrCtrlPressed(e) && !e.altKey && !e.shiftKey; + const ctrlAltCombo = Keyboard.cmdOrCtrlPressed(e, true) && e.altKey; + const ctrlShiftCombo = Keyboard.cmdOrCtrlPressed(e, true) && e.shiftKey; + const markdownLinkKey = Keyboard.isKeyPressed(e, KeyCodes.K); const ctrlOrMetaKeyPressed = e.ctrlKey || e.metaKey; const ctrlEnterKeyCombo = - Utils.isKeyPressed(e, KeyCodes.ENTER) && ctrlOrMetaKeyPressed; + Keyboard.isKeyPressed(e, KeyCodes.ENTER) && ctrlOrMetaKeyPressed; const {selectionStart, selectionEnd, value} = e.target as TextboxElement; @@ -98,28 +99,28 @@ const ForwardPostCommentInput = ({channelId, canForwardPost, comment, permaLinkL selectionEnd, message: value, }); - } else if (ctrlKeyCombo && Utils.isKeyPressed(e, KeyCodes.B)) { + } else if (ctrlKeyCombo && Keyboard.isKeyPressed(e, KeyCodes.B)) { applyMarkdownMode({ markdownMode: 'bold', selectionStart, selectionEnd, message: value, }); - } else if (ctrlKeyCombo && Utils.isKeyPressed(e, KeyCodes.I)) { + } else if (ctrlKeyCombo && Keyboard.isKeyPressed(e, KeyCodes.I)) { applyMarkdownMode({ markdownMode: 'italic', selectionStart, selectionEnd, message: value, }); - } else if (ctrlShiftCombo && Utils.isKeyPressed(e, KeyCodes.X)) { + } else if (ctrlShiftCombo && Keyboard.isKeyPressed(e, KeyCodes.X)) { applyMarkdownMode({ markdownMode: 'strike', selectionStart, selectionEnd, message: value, }); - } else if (ctrlShiftCombo && Utils.isKeyPressed(e, KeyCodes.E)) { + } else if (ctrlShiftCombo && Keyboard.isKeyPressed(e, KeyCodes.E)) { e.stopPropagation(); e.preventDefault(); } else if (ctrlEnterKeyCombo && canForwardPost) { diff --git a/webapp/channels/src/components/forward_post_modal/forward_post_modal.tsx b/webapp/channels/src/components/forward_post_modal/forward_post_modal.tsx index 2fbf206401..8759fddac2 100644 --- a/webapp/channels/src/components/forward_post_modal/forward_post_modal.tsx +++ b/webapp/channels/src/components/forward_post_modal/forward_post_modal.tsx @@ -16,6 +16,8 @@ import {getCurrentTeam} from 'mattermost-redux/selectors/entities/teams'; import NotificationBox from 'components/notification_box'; +import {getPermalinkURL} from 'selectors/urls'; + import {GlobalState} from 'types/store'; import {haveIChannelPermission} from 'mattermost-redux/selectors/entities/roles'; @@ -28,7 +30,6 @@ import GenericModal from 'components/generic_modal'; import {PostPreviewMetadata} from '@mattermost/types/posts'; import {getSiteURL} from '../../utils/url'; -import * as Utils from '../../utils/utils'; import ForwardPostChannelSelect, {ChannelOption, makeSelectedChannelOption} from './forward_post_channel_select'; import ForwardPostCommentInput from './forward_post_comment_input'; @@ -49,7 +50,7 @@ const ForwardPostModal = ({onExited, post, actions}: Props) => { const channel = useSelector((state: GlobalState) => getChannel(state, {id: post.channel_id})); const currentTeam = useSelector(getCurrentTeam); - const relativePermaLink = useSelector((state: GlobalState) => Utils.getPermalinkURL(state, currentTeam.id, post.id)); + const relativePermaLink = useSelector((state: GlobalState) => getPermalinkURL(state, currentTeam.id, post.id)); const permaLink = `${getSiteURL()}${relativePermaLink}`; const isPrivateConversation = channel.type !== Constants.OPEN_CHANNEL; diff --git a/webapp/channels/src/components/generic_modal.tsx b/webapp/channels/src/components/generic_modal.tsx index 2e43ab311a..5ea190f2f5 100644 --- a/webapp/channels/src/components/generic_modal.tsx +++ b/webapp/channels/src/components/generic_modal.tsx @@ -1,7 +1,7 @@ // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. -import {GenericModal} from '@mattermost/components'; +import {LegacyGenericModal} from '@mattermost/components'; import {t} from 'utils/i18n'; @@ -15,4 +15,4 @@ t('footer_pagination.count'); t('footer_pagination.prev'); t('footer_pagination.next'); -export default GenericModal; +export default LegacyGenericModal; diff --git a/webapp/channels/src/components/global_header/center_controls/global_search_nav/global_search_nav.tsx b/webapp/channels/src/components/global_header/center_controls/global_search_nav/global_search_nav.tsx index a3bcbd7155..39e0c62870 100644 --- a/webapp/channels/src/components/global_header/center_controls/global_search_nav/global_search_nav.tsx +++ b/webapp/channels/src/components/global_header/center_controls/global_search_nav/global_search_nav.tsx @@ -17,7 +17,7 @@ import { Constants, RHSStates, } from 'utils/constants'; -import * as Utils from 'utils/utils'; +import * as Keyboard from 'utils/keyboard'; const GlobalSearchNav = (): JSX.Element => { const dispatch = useDispatch(); @@ -25,8 +25,8 @@ const GlobalSearchNav = (): JSX.Element => { useEffect(() => { const handleShortcut = (e: KeyboardEvent) => { - if (Utils.cmdOrCtrlPressed(e) && e.shiftKey) { - if (Utils.isKeyPressed(e, Constants.KeyCodes.M)) { + if (Keyboard.cmdOrCtrlPressed(e) && e.shiftKey) { + if (Keyboard.isKeyPressed(e, Constants.KeyCodes.M)) { e.preventDefault(); if (rhsState === RHSStates.MENTION) { dispatch(closeRightHandSide()); diff --git a/webapp/channels/src/components/global_header/center_controls/user_guide_dropdown/index.ts b/webapp/channels/src/components/global_header/center_controls/user_guide_dropdown/index.ts index a59ff532cc..80bdf8f328 100644 --- a/webapp/channels/src/components/global_header/center_controls/user_guide_dropdown/index.ts +++ b/webapp/channels/src/components/global_header/center_controls/user_guide_dropdown/index.ts @@ -8,7 +8,7 @@ import {withRouter} from 'react-router-dom'; import {getConfig} from 'mattermost-redux/selectors/entities/general'; import {GenericAction} from 'mattermost-redux/types/actions'; import {getCurrentRelativeTeamUrl} from 'mattermost-redux/selectors/entities/teams'; -import {getUseCaseOnboarding} from 'mattermost-redux/selectors/entities/preferences'; +import {getIsOnboardingFlowEnabled} from 'mattermost-redux/selectors/entities/preferences'; import {isFirstAdmin} from 'mattermost-redux/selectors/entities/users'; import {getUserGuideDropdownPluginMenuItems} from 'selectors/plugins'; @@ -32,7 +32,7 @@ function mapStateToProps(state: GlobalState) { teamUrl: getCurrentRelativeTeamUrl(state), pluginMenuItems: getUserGuideDropdownPluginMenuItems(state), isFirstAdmin: isFirstAdmin(state), - useCaseOnboarding: getUseCaseOnboarding(state), + onboardingFlowEnabled: getIsOnboardingFlowEnabled(state), }; } diff --git a/webapp/channels/src/components/global_header/center_controls/user_guide_dropdown/user_guide_dropdown.test.tsx b/webapp/channels/src/components/global_header/center_controls/user_guide_dropdown/user_guide_dropdown.test.tsx index effe92c1ad..ed4e5532b9 100644 --- a/webapp/channels/src/components/global_header/center_controls/user_guide_dropdown/user_guide_dropdown.test.tsx +++ b/webapp/channels/src/components/global_header/center_controls/user_guide_dropdown/user_guide_dropdown.test.tsx @@ -34,7 +34,7 @@ describe('components/channel_header/components/UserGuideDropdown', () => { }, pluginMenuItems: [], isFirstAdmin: false, - useCaseOnboarding: false, + onboardingFlowEnabled: false, }; test('should match snapshot', () => { diff --git a/webapp/channels/src/components/global_header/global_header.tsx b/webapp/channels/src/components/global_header/global_header.tsx index adbfcaf992..435a358890 100644 --- a/webapp/channels/src/components/global_header/global_header.tsx +++ b/webapp/channels/src/components/global_header/global_header.tsx @@ -12,6 +12,9 @@ import LeftControls from './left_controls/left_controls'; import RightControls from './right_controls/right_controls'; import {useIsLoggedIn} from './hooks'; +import CompassThemeProvider from 'components/compass_theme_provider/compass_theme_provider'; +import {useSelector} from 'react-redux'; +import {getTheme} from 'mattermost-redux/selectors/entities/preferences'; const GlobalHeaderContainer = styled.header` position: relative; @@ -38,17 +41,20 @@ const GlobalHeaderContainer = styled.header` const GlobalHeader = (): JSX.Element | null => { const isLoggedIn = useIsLoggedIn(); const currentProductID = useCurrentProductId(); + const theme = useSelector(getTheme); if (!isLoggedIn) { return null; } return ( - - - - - + + + + + + + ); }; diff --git a/webapp/channels/src/components/global_header/left_controls/product_menu/product_menu_list/index.ts b/webapp/channels/src/components/global_header/left_controls/product_menu/product_menu_list/index.ts index 023e5f29b8..d6b2389b0b 100644 --- a/webapp/channels/src/components/global_header/left_controls/product_menu/product_menu_list/index.ts +++ b/webapp/channels/src/components/global_header/left_controls/product_menu/product_menu_list/index.ts @@ -29,6 +29,7 @@ import {CloudProducts} from 'utils/constants'; import {isCloudLicense} from 'utils/license_utils'; import ProductMenuList from './product_menu_list'; +import {getIsMobileView} from 'selectors/views/browser'; type Actions = { openModal:

    (modalData: ModalData

    ) => void; @@ -53,6 +54,7 @@ function mapStateToProps(state: GlobalState) { const step = getInt(state, OnboardingTaskCategory, OnboardingTasksName.VISIT_SYSTEM_CONSOLE, 0); const showVisitSystemConsoleTour = step === TaskNameMapToSteps[OnboardingTasksName.VISIT_SYSTEM_CONSOLE].STARTED; const enableCustomUserGroups = isCustomGroupsEnabled(state); + const isMobile = getIsMobileView(state); const subscription = getCloudSubscription(state); const license = getLicense(state); @@ -70,7 +72,7 @@ function mapStateToProps(state: GlobalState) { const isFreeTrial = isCloudFreeTrial || isSelfHostedFreeTrial; return { - isMobile: state.views.channel.mobileView, + isMobile, appDownloadLink, enableCommands, canManageIntegrations, diff --git a/webapp/channels/src/components/header_footer_template/__snapshots__/header_footer_template.test.tsx.snap b/webapp/channels/src/components/header_footer_template/__snapshots__/header_footer_template.test.tsx.snap index bb4dd6479b..1b51b5dbbd 100644 --- a/webapp/channels/src/components/header_footer_template/__snapshots__/header_footer_template.test.tsx.snap +++ b/webapp/channels/src/components/header_footer_template/__snapshots__/header_footer_template.test.tsx.snap @@ -44,6 +44,7 @@ exports[`components/HeaderFooterTemplate should match snapshot with about link 1 location="header_footer_template" > @@ -98,6 +99,7 @@ exports[`components/HeaderFooterTemplate should match snapshot with all links 1` location="header_footer_template" > @@ -109,6 +111,7 @@ exports[`components/HeaderFooterTemplate should match snapshot with all links 1` location="header_footer_template" > @@ -120,6 +123,7 @@ exports[`components/HeaderFooterTemplate should match snapshot with all links 1` location="header_footer_template" > @@ -131,6 +135,7 @@ exports[`components/HeaderFooterTemplate should match snapshot with all links 1` location="header_footer_template" > @@ -231,6 +236,7 @@ exports[`components/HeaderFooterTemplate should match snapshot with help link 1` location="header_footer_template" > @@ -285,6 +291,7 @@ exports[`components/HeaderFooterTemplate should match snapshot with privacy poli location="header_footer_template" > @@ -339,6 +346,7 @@ exports[`components/HeaderFooterTemplate should match snapshot with term of serv location="header_footer_template" > diff --git a/webapp/channels/src/components/header_footer_template/header_footer_template.tsx b/webapp/channels/src/components/header_footer_template/header_footer_template.tsx index 66dc865749..e5be8d3d19 100644 --- a/webapp/channels/src/components/header_footer_template/header_footer_template.tsx +++ b/webapp/channels/src/components/header_footer_template/header_footer_template.tsx @@ -57,7 +57,10 @@ export default class NotLoggedIn extends React.PureComponent { location='header_footer_template' href={this.props.config.AboutLink} > - + , ); } @@ -71,7 +74,10 @@ export default class NotLoggedIn extends React.PureComponent { location='header_footer_template' href={this.props.config.PrivacyPolicyLink} > - + , ); } @@ -85,7 +91,10 @@ export default class NotLoggedIn extends React.PureComponent { location='header_footer_template' href={this.props.config.TermsOfServiceLink} > - + , ); } @@ -99,7 +108,10 @@ export default class NotLoggedIn extends React.PureComponent { location='header_footer_template' href={this.props.config.HelpLink} > - + , ); } diff --git a/webapp/channels/src/components/help/components/attaching.tsx b/webapp/channels/src/components/help/components/attaching.tsx deleted file mode 100644 index 7fa3a48fd4..0000000000 --- a/webapp/channels/src/components/help/components/attaching.tsx +++ /dev/null @@ -1,173 +0,0 @@ -// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. -// See LICENSE.txt for license information. - -import React from 'react'; -import {FormattedMessage} from 'react-intl'; - -import FormattedMarkdownMessage from 'components/formatted_markdown_message'; -import HelpLinks from 'components/help/components/help_links'; -import {HelpLink} from 'components/help/types'; - -export default function Attaching(): JSX.Element { - return ( -

    -

    - -

    -
    -

    - -

    -

    - -

    -

    - -

    -

    - -

    -

    - -

    -

    - -

    -

    - -

    -

    - -

    - -

    - -

    -

    - -

    - -

    - -

    -

    - -

    -

    - -

    -

    - -

    -

    - -

    -

    - -

    -

    - -

    -
      -
    • - -
    • -
    • - -
    • -
    • - -
    • -
    • - -
    • -
    -

    - -

    - -

    - -

    -

    - -

    - -
    - ); -} diff --git a/webapp/channels/src/components/help/components/commands.tsx b/webapp/channels/src/components/help/components/commands.tsx deleted file mode 100644 index df0d643b59..0000000000 --- a/webapp/channels/src/components/help/components/commands.tsx +++ /dev/null @@ -1,104 +0,0 @@ -// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. -// See LICENSE.txt for license information. - -import React from 'react'; -import {FormattedMessage} from 'react-intl'; - -import FormattedMarkdownMessage from 'components/formatted_markdown_message'; -import HelpLinks from 'components/help/components/help_links'; -import {HelpLink} from 'components/help/types'; -import ExternalLink from 'components/external_link'; - -export default function HelpCommands(): JSX.Element { - return ( -
    -

    - -

    - -
    - -

    - -

    - -

    - -

    - -

    - ( - - {msg} - - ), - }} - /> -

    -

    - -

    - -

    - Slash command autocomplete -

    - -

    - -

    - -

    - -

    - -

    - ( - - {msg} - - ), - strong: (msg: React.ReactNode) => {msg}, - }} - /> -

    - - -
    - ); -} diff --git a/webapp/channels/src/components/help/components/composing.tsx b/webapp/channels/src/components/help/components/composing.tsx deleted file mode 100644 index d9610ae199..0000000000 --- a/webapp/channels/src/components/help/components/composing.tsx +++ /dev/null @@ -1,114 +0,0 @@ -// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. -// See LICENSE.txt for license information. - -import React from 'react'; -import {FormattedMessage} from 'react-intl'; - -import FormattedMarkdownMessage from 'components/formatted_markdown_message'; -import HelpLinks from 'components/help/components/help_links'; -import {HelpLink} from 'components/help/types'; - -export default function HelpComposing(): JSX.Element { - return ( -
    -

    - -

    -
    -

    - -

    -

    - -

    -

    - -

    -

    - -

    -

    - -

    -

    - -

    -

    - -

    -

    - -

    -

    - -

    -

    - -

    -

    - -

    -

    - -

    -

    - -

    -

    - -

    -

    - -

    - -
    - ); -} diff --git a/webapp/channels/src/components/help/components/formatting.tsx b/webapp/channels/src/components/help/components/formatting.tsx deleted file mode 100644 index 21453133b4..0000000000 --- a/webapp/channels/src/components/help/components/formatting.tsx +++ /dev/null @@ -1,444 +0,0 @@ -// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. -// See LICENSE.txt for license information. - -import React from 'react'; -import {FormattedMessage} from 'react-intl'; - -import FormattedMarkdownMessage from 'components/formatted_markdown_message'; -import Markdown from 'components/markdown'; -import HelpLinks from 'components/help/components/help_links'; -import {HelpLink} from 'components/help/types'; -import ExternalLink from 'components/external_link'; - -export default function HelpFormatting(): JSX.Element { - const renderRawExample = (example: string | React.ReactNode): JSX.Element => { - return ( -
    - {example} -
    - ); - }; - - const renderRawExampleWithResult = (example: string | React.ReactNode): JSX.Element => { - return ( -
    - {renderRawExample(example)} -

    - -

    - {' '} - -
    - ); - }; - - return ( -
    -

    - -

    -
    -

    - -

    -

    - -

    -

    - -

    -
      -
    • - -
    • -
    • - -
    • -
    • - -
    • -
    • - -
    • -
    -

    - -

    -

    - -

    -

    - -

    - - {(example) => renderRawExampleWithResult('```\n' + example + '\n```')} - -

    - -

    -

    - -

    -

    - -

    -

    - -

    - - {(example) => renderRawExample(example)} - -

    - -

    -

    - -

    -

    - go syntax-highlighting -

    -

    - -

    -

    - go syntax-highlighting -

    -

    - -

    -

    - go syntax-highlighting -

    -

    - -

    -

    - go syntax-highlighting -

    -

    - -

    -

    - -

    - {renderRawExample('`monospace`')} -

    - - {(text) => ()} - -

    -

    - -

    -

    - -

    - - {(example) => ( -
    - - - {(text) => ()} - -
    - )} -
    -

    - -

    -

    - ( - - {msg} - - ), - }} - /> -

    -

    - -

    -

    - online. It is also possible to create your own Custom Emoji if the emoji you want to use doesn\'t exist.'} - values={{ - linkEmoji: (msg: React.ReactNode) => ( - - {msg} - - ), - linkCustomEmoji: (msg: React.ReactNode) => ( - - {msg} - - ), - }} - /> -

    - {renderRawExampleWithResult(':smile: :+1: :sheep:')} -

    - -

    -

    - -

    -

    - - {(text) => } - -

    - -

    - -

    -

    - -

    -

    - -

    -

    - -

    -

    - -

    -

    - -

    - - {(example) => renderRawExampleWithResult(example)} - -

    - -

    - - {(example) => renderRawExampleWithResult(example)} - -

    - -

    - - {(example) => renderRawExampleWithResult(example)} - -

    - -

    -

    - -

    - - {(example) => renderRawExampleWithResult(example)} - -

    - -

    -

    - -

    - - {(example) => renderRawExampleWithResult(example)} - -

    - -

    - - {(example) => renderRawExampleWithResult(example)} - - -
    - ); -} diff --git a/webapp/channels/src/components/help/components/help_links.tsx b/webapp/channels/src/components/help/components/help_links.tsx deleted file mode 100644 index 38b24c6bc2..0000000000 --- a/webapp/channels/src/components/help/components/help_links.tsx +++ /dev/null @@ -1,109 +0,0 @@ -// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. -// See LICENSE.txt for license information. - -import React from 'react'; - -import {FormattedMessage, useIntl} from 'react-intl'; -import {Link} from 'react-router-dom'; - -import * as I18n from 'i18n/i18n'; - -import {useQuery} from 'utils/http_utils'; - -import {HelpLink} from 'components/help/types'; - -type Props = { - excludedLinks?: HelpLink[]; -} - -type HelpLinkContent = { - path: string; - message: string; -} - -const HelpLinks: React.FC = ({excludedLinks = []}: Props) => { - // If the current page has locale query param in it, we want to preserve it when navigating to any of the help pages - let localeQueryParam = ''; - const currentLocaleFromQueryParam = useQuery().get('locale'); - if (currentLocaleFromQueryParam && I18n.isLanguageAvailable(currentLocaleFromQueryParam)) { - localeQueryParam = `?locale=${currentLocaleFromQueryParam}`; - } - - const {formatMessage} = useIntl(); - - const HELP_LINK_CONTENT: {[key in HelpLink]: HelpLinkContent} = { - [HelpLink.Messaging]: { - path: '/help/messaging', - message: formatMessage({ - id: 'help.link.messaging', - defaultMessage: 'Basic Messaging', - }), - }, - [HelpLink.Composing]: { - path: '/help/composing', - message: formatMessage({ - id: 'help.link.composing', - defaultMessage: 'Composing Messages and Replies', - }), - }, - [HelpLink.Mentioning]: { - path: '/help/mentioning', - message: formatMessage({ - id: 'help.link.mentioning', - defaultMessage: 'Mentioning Teammates', - }), - }, - [HelpLink.Formatting]: { - path: '/help/formatting', - message: formatMessage({ - id: 'help.link.formatting', - defaultMessage: 'Formatting Messages Using Markdown', - }), - }, - [HelpLink.Attaching]: { - path: '/help/attaching', - message: formatMessage({ - id: 'help.link.attaching', - defaultMessage: 'Attaching Files', - }), - }, - [HelpLink.Commands]: { - path: '/help/commands', - message: formatMessage({ - id: 'help.link.commands', - defaultMessage: 'Executing Commands', - }), - }, - }; - - const linksToBeRendered: HelpLink[] = Object.values(HelpLink). - filter((link: HelpLink) => !excludedLinks.includes(link)); - - return ( - <> -

    - -

    -
      - { - linksToBeRendered.map((linkType: HelpLink) => { - const {path, message}: HelpLinkContent = HELP_LINK_CONTENT[linkType]; - - return ( -
    • - - {message} - -
    • - ); - }) - } -
    - - ); -}; - -export default HelpLinks; diff --git a/webapp/channels/src/components/help/components/mentioning.tsx b/webapp/channels/src/components/help/components/mentioning.tsx deleted file mode 100644 index 5f9c516d88..0000000000 --- a/webapp/channels/src/components/help/components/mentioning.tsx +++ /dev/null @@ -1,125 +0,0 @@ -// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. -// See LICENSE.txt for license information. - -import React from 'react'; -import {FormattedMessage} from 'react-intl'; - -import FormattedMarkdownMessage from 'components/formatted_markdown_message'; -import HelpLinks from 'components/help/components/help_links'; -import {HelpLink} from 'components/help/types'; -import ExternalLink from 'components/external_link'; - -export default function Mentioning(): JSX.Element { - return ( -
    -

    - -

    -
    -

    - -

    -

    - -

    -

    - -

    -

    - -

    -

    - {msg}, - link: (msg: React.ReactNode) => ( - - {msg} - - ), - }} - /> -

    -
    - - - -
    -

    -

    - -

    -

    - -

    -

    - -

    -
    - - - -
    -

    - -

    -

    - -

    -

    - -

    -

    - -

    - -
    - ); -} diff --git a/webapp/channels/src/components/help/components/messaging.tsx b/webapp/channels/src/components/help/components/messaging.tsx deleted file mode 100644 index 9e0b66e532..0000000000 --- a/webapp/channels/src/components/help/components/messaging.tsx +++ /dev/null @@ -1,87 +0,0 @@ -// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. -// See LICENSE.txt for license information. - -import React from 'react'; -import {FormattedMessage} from 'react-intl'; - -import FormattedMarkdownMessage from 'components/formatted_markdown_message'; -import HelpLinks from 'components/help/components/help_links'; -import {HelpLink} from 'components/help/types'; -import ExternalLink from 'components/external_link'; - -export default function Messaging(): JSX.Element { - return ( -
    -

    - -

    -
    - -

    - -

    -

    - -

    -

    - Reply Arrow icon -

    -

    - -

    -

    - -

    -

    - Use Markdown in your messages -

    -

    - Add Emoji: Type ":" to open an emoji autocomplete. If the existing emojis don\'t say what you want to express, you can also create your own Custom Emoji.'} - values={{ - strong: (msg: React.ReactNode) => {msg}, - link: (msg: React.ReactNode) => ( - - {msg} - - ), - }} - /> -

    -

    - -

    - -
    - ); -} diff --git a/webapp/channels/src/components/help/help_controller.tsx b/webapp/channels/src/components/help/help_controller.tsx deleted file mode 100644 index d714190b03..0000000000 --- a/webapp/channels/src/components/help/help_controller.tsx +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. -// See LICENSE.txt for license information. - -import React from 'react'; -import ReactDOM from 'react-dom'; -import {Switch, Route} from 'react-router-dom'; - -import Messaging from './components/messaging'; -import Composing from './components/composing'; -import Mentioning from './components/mentioning'; -import Formatting from './components/formatting'; -import Attaching from './components/attaching'; -import Commands from './components/commands'; - -type Props = { - match: { - url: string; - }; -} - -export default class HelpController extends React.PureComponent { - public componentDidUpdate(): void { - const helpControllerNode = ReactDOM.findDOMNode(this); - - if (helpControllerNode && helpControllerNode instanceof HTMLDivElement) { - helpControllerNode.scrollIntoView(); - } - } - - public render(): JSX.Element { - return ( -
    -
    - - - - - - - - -
    -
    - ); - } -} diff --git a/webapp/channels/src/components/help/types.ts b/webapp/channels/src/components/help/types.ts deleted file mode 100644 index cfc778443f..0000000000 --- a/webapp/channels/src/components/help/types.ts +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. -// See LICENSE.txt for license information. - -export enum HelpLink { - Messaging = 'Messaging', - Composing = 'Composing', - Mentioning = 'Mentioning', - Formatting = 'Formatting', - Attaching = 'Attaching', - Commands = 'Commands', -} diff --git a/webapp/channels/src/components/integrations/__snapshots__/abstract_incoming_hook.test.tsx.snap b/webapp/channels/src/components/integrations/__snapshots__/abstract_incoming_hook.test.tsx.snap index b8fb192a10..45678e2f48 100644 --- a/webapp/channels/src/components/integrations/__snapshots__/abstract_incoming_hook.test.tsx.snap +++ b/webapp/channels/src/components/integrations/__snapshots__/abstract_incoming_hook.test.tsx.snap @@ -10,7 +10,7 @@ exports[`components/integrations/AbstractIncomingWebhook should call action func > diff --git a/webapp/channels/src/components/integrations/abstract_incoming_webhook.tsx b/webapp/channels/src/components/integrations/abstract_incoming_webhook.tsx index c3079b1f7f..cfeb445fff 100644 --- a/webapp/channels/src/components/integrations/abstract_incoming_webhook.tsx +++ b/webapp/channels/src/components/integrations/abstract_incoming_webhook.tsx @@ -184,7 +184,7 @@ export default class AbstractIncomingWebhook extends PureComponent diff --git a/webapp/channels/src/components/integrations/abstract_outgoing_webhook.jsx b/webapp/channels/src/components/integrations/abstract_outgoing_webhook.jsx index dff8215612..ff25337f81 100644 --- a/webapp/channels/src/components/integrations/abstract_outgoing_webhook.jsx +++ b/webapp/channels/src/components/integrations/abstract_outgoing_webhook.jsx @@ -249,7 +249,7 @@ export default class AbstractOutgoingWebhook extends React.PureComponent { diff --git a/webapp/channels/src/components/integrations/bots/add_bot/__snapshots__/add_bot.test.tsx.snap b/webapp/channels/src/components/integrations/bots/add_bot/__snapshots__/add_bot.test.tsx.snap new file mode 100644 index 0000000000..f5cf10dd4e --- /dev/null +++ b/webapp/channels/src/components/integrations/bots/add_bot/__snapshots__/add_bot.test.tsx.snap @@ -0,0 +1,362 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`components/integrations/bots/AddBot blank 1`] = ` +
    + + + + + + +
    +
    +
    + +
    + +
    + +
    +
    +
    +
    + +
    +
    + bot image +
    +
    + + +
    +
    +
    +
    + +
    + +
    + +
    +
    +
    +
    + +
    + +
    + +
    +
    +
    +
    + +
    + +
    + +
    +
    +
    +
    +
    + +
    +
    +
    + +
    +
    + +
    +
    + +
    +
    +
    +
    + +
    +
    + +
    +
    + +
    +
    +
    +
    + + + + + + } + type="submit" + > + + +
    +
    +
    +
    +`; diff --git a/webapp/channels/src/components/integrations/bots/add_bot/add_bot.test.tsx b/webapp/channels/src/components/integrations/bots/add_bot/add_bot.test.tsx index 5b3b646558..6ad0083e04 100644 --- a/webapp/channels/src/components/integrations/bots/add_bot/add_bot.test.tsx +++ b/webapp/channels/src/components/integrations/bots/add_bot/add_bot.test.tsx @@ -3,9 +3,7 @@ import React from 'react'; import {shallow} from 'enzyme'; -import {FormattedMessage} from 'react-intl'; -// import TestHelper from 'mattermost-redux/test/test_helper'; import {TestHelper} from 'utils/test_helper'; import AddBot from './add_bot'; @@ -49,11 +47,7 @@ describe('components/integrations/bots/AddBot', () => { value={''} />, )).toEqual(true); - expect(wrapper.containsMatchingElement( - , - )).toEqual(true); + expect(wrapper).toMatchSnapshot(); }); it('edit bot', () => { diff --git a/webapp/channels/src/components/integrations/bots/add_bot/add_bot.tsx b/webapp/channels/src/components/integrations/bots/add_bot/add_bot.tsx index 00c31afd06..3aade0e6ec 100644 --- a/webapp/channels/src/components/integrations/bots/add_bot/add_bot.tsx +++ b/webapp/channels/src/components/integrations/bots/add_bot/add_bot.tsx @@ -322,7 +322,7 @@ export default class AddBot extends React.PureComponent { error: ( ), }; @@ -383,7 +383,7 @@ export default class AddBot extends React.PureComponent { render() { let subtitle = ( ); @@ -630,7 +630,7 @@ export default class AddBot extends React.PureComponent {
    ( diff --git a/webapp/channels/src/components/integrations/confirm_integration/__snapshots__/confirm_integration.test.tsx.snap b/webapp/channels/src/components/integrations/confirm_integration/__snapshots__/confirm_integration.test.tsx.snap index 1c3a97c154..551911427b 100644 --- a/webapp/channels/src/components/integrations/confirm_integration/__snapshots__/confirm_integration.test.tsx.snap +++ b/webapp/channels/src/components/integrations/confirm_integration/__snapshots__/confirm_integration.test.tsx.snap @@ -12,7 +12,7 @@ exports[`components/integrations/ConfirmIntegration should match snapshot, comma > ); @@ -100,7 +100,7 @@ const ConfirmIntegration = ({team, location, commands, oauthApps, incomingHooks, headerText = ( ); @@ -137,7 +137,7 @@ const ConfirmIntegration = ({team, location, commands, oauthApps, incomingHooks, headerText = ( ); @@ -175,7 +175,7 @@ const ConfirmIntegration = ({team, location, commands, oauthApps, incomingHooks, headerText = ( ); diff --git a/webapp/channels/src/components/integrations/installed_oauth_apps/__snapshots__/installed_oauth_apps.test.tsx.snap b/webapp/channels/src/components/integrations/installed_oauth_apps/__snapshots__/installed_oauth_apps.test.tsx.snap index fa20d79ce1..38c7aef4c9 100644 --- a/webapp/channels/src/components/integrations/installed_oauth_apps/__snapshots__/installed_oauth_apps.test.tsx.snap +++ b/webapp/channels/src/components/integrations/installed_oauth_apps/__snapshots__/installed_oauth_apps.test.tsx.snap @@ -20,7 +20,7 @@ exports[`components/integrations/InstalledOAuthApps should match snapshot 1`] = header={ } helpText={ diff --git a/webapp/channels/src/components/integrations/installed_oauth_apps/installed_oauth_apps.tsx b/webapp/channels/src/components/integrations/installed_oauth_apps/installed_oauth_apps.tsx index 1a068e8366..2abeaef631 100644 --- a/webapp/channels/src/components/integrations/installed_oauth_apps/installed_oauth_apps.tsx +++ b/webapp/channels/src/components/integrations/installed_oauth_apps/installed_oauth_apps.tsx @@ -134,7 +134,7 @@ export default class InstalledOAuthApps extends React.PureComponent } diff --git a/webapp/channels/src/components/integrations/installed_outgoing_webhook.tsx b/webapp/channels/src/components/integrations/installed_outgoing_webhook.tsx index 0c01d69962..a07e3e63e5 100644 --- a/webapp/channels/src/components/integrations/installed_outgoing_webhook.tsx +++ b/webapp/channels/src/components/integrations/installed_outgoing_webhook.tsx @@ -167,7 +167,7 @@ export default class InstalledOutgoingWebhook extends React.PureComponent > {' - '} diff --git a/webapp/channels/src/components/invitation_modal/invitation_modal.test.tsx b/webapp/channels/src/components/invitation_modal/invitation_modal.test.tsx index 0db5a75825..80c5226eec 100644 --- a/webapp/channels/src/components/invitation_modal/invitation_modal.test.tsx +++ b/webapp/channels/src/components/invitation_modal/invitation_modal.test.tsx @@ -17,6 +17,8 @@ import ResultView from './result_view'; import InviteView from './invite_view'; import NoPermissionsView from './no_permissions_view'; import InvitationModal, {Props, View, InvitationModal as BaseInvitationModal} from './invitation_modal'; +import {SelfHostedProducts} from 'utils/constants'; +import {TestHelper} from 'utils/test_helper'; const defaultProps: Props = deepFreeze({ actions: { @@ -87,6 +89,19 @@ describe('InvitationModal', () => { preferences: { myPreferences: {}, }, + hostedCustomer: { + products: { + productsLoaded: true, + products: { + prod_professional: TestHelper.getProductMock({ + id: 'prod_professional', + name: 'Professional', + sku: SelfHostedProducts.PROFESSIONAL, + price_per_seat: 7.5, + }), + }, + }, + }, }, }; diff --git a/webapp/channels/src/components/invitation_modal/invitation_modal.tsx b/webapp/channels/src/components/invitation_modal/invitation_modal.tsx index 098080d2eb..ff26b555ec 100644 --- a/webapp/channels/src/components/invitation_modal/invitation_modal.tsx +++ b/webapp/channels/src/components/invitation_modal/invitation_modal.tsx @@ -266,7 +266,7 @@ export class InvitationModal extends React.PureComponent { ...state.invite, inviteChannels: { ...state.invite.inviteChannels, - channels, + channels: channels ?? [], }, }, })); diff --git a/webapp/channels/src/components/invitation_modal/invite_as.tsx b/webapp/channels/src/components/invitation_modal/invite_as.tsx index aabcb2674e..a7e552c024 100644 --- a/webapp/channels/src/components/invitation_modal/invite_as.tsx +++ b/webapp/channels/src/components/invitation_modal/invite_as.tsx @@ -14,6 +14,7 @@ import {isCurrentUserSystemAdmin} from 'mattermost-redux/selectors/entities/user import {getSubscriptionProduct, checkHadPriorTrial} from 'mattermost-redux/selectors/entities/cloud'; import {DispatchFunc} from 'mattermost-redux/types/actions'; import {getPrevTrialLicense} from 'mattermost-redux/actions/admin'; +import {deprecateCloudFree} from 'mattermost-redux/selectors/entities/preferences'; import {closeModal, openModal} from 'actions/views/modals'; @@ -43,6 +44,7 @@ export type Props = { export default function InviteAs(props: Props) { const {formatMessage} = useIntl(); const license = useSelector(getLicense); + const cloudFreeDeprecated = useSelector(deprecateCloudFree); const dispatch = useDispatch(); useEffect(() => { @@ -85,7 +87,7 @@ export default function InviteAs(props: Props) { if (isFreeTrial) { ctaExtraContentMsg = formatMessage({id: 'free.professional_feature.professional', defaultMessage: 'Professional feature'}); } else { - ctaExtraContentMsg = hasPriorTrial ? formatMessage({id: 'free.professional_feature.upgrade', defaultMessage: 'Upgrade'}) : formatMessage({id: 'free.professional_feature.try_free', defaultMessage: 'Professional feature- try it out free'}); + ctaExtraContentMsg = (hasPriorTrial || cloudFreeDeprecated) ? formatMessage({id: 'free.professional_feature.upgrade', defaultMessage: 'Upgrade'}) : formatMessage({id: 'free.professional_feature.try_free', defaultMessage: 'Professional feature- try it out free'}); } const restrictedIndicator = ( diff --git a/webapp/channels/src/components/invitation_modal/invite_view.test.tsx b/webapp/channels/src/components/invitation_modal/invite_view.test.tsx index b90af49861..16e49e8f88 100644 --- a/webapp/channels/src/components/invitation_modal/invite_view.test.tsx +++ b/webapp/channels/src/components/invitation_modal/invite_view.test.tsx @@ -11,9 +11,12 @@ import {mountWithThemedIntl} from 'tests/helpers/themed-intl-test-helper'; import deepFreeze from 'mattermost-redux/utils/deep_freeze'; import {Team} from '@mattermost/types/teams'; import {generateId} from 'utils/utils'; +import {TestHelper as TH} from 'utils/test_helper'; import InviteAs, {InviteType} from './invite_as'; import InviteView, {Props} from './invite_view'; +import {SelfHostedProducts} from 'utils/constants'; +import {act} from 'react-dom/test-utils'; const defaultProps: Props = deepFreeze({ setInviteAs: jest.fn(), @@ -99,6 +102,19 @@ describe('InviteView', () => { preferences: { myPreferences: {}, }, + hostedCustomer: { + products: { + productsLoaded: true, + products: { + prod_professional: TH.getProductMock({ + id: 'prod_professional', + name: 'Professional', + sku: SelfHostedProducts.PROFESSIONAL, + price_per_seat: 7.5, + }), + }, + }, + }, }, }; @@ -108,40 +124,46 @@ describe('InviteView', () => { props = defaultProps; }); - it('shows InviteAs component when user can choose to invite guests or users', () => { - const wrapper = mountWithThemedIntl( - - - , - ); - expect(wrapper.find(InviteAs).length).toBe(1); + it('shows InviteAs component when user can choose to invite guests or users', async () => { + await act(async () => { + const wrapper = mountWithThemedIntl( + + + , + ); + expect(wrapper.find(InviteAs).length).toBe(1); + }); }); - it('hides InviteAs component when user can not choose members option', () => { + it('hides InviteAs component when user can not choose members option', async () => { props = { ...defaultProps, canAddUsers: false, }; - const wrapper = mountWithThemedIntl( - - - , - ); - expect(wrapper.find(InviteAs).length).toBe(0); + await act(async () => { + const wrapper = mountWithThemedIntl( + + + , + ); + expect(wrapper.find(InviteAs).length).toBe(0); + }); }); - it('hides InviteAs component when user can not choose guests option', () => { + it('hides InviteAs component when user can not choose guests option', async () => { props = { ...defaultProps, canInviteGuests: false, }; - const wrapper = mountWithThemedIntl( - - - , - ); - expect(wrapper.find(InviteAs).length).toBe(0); + await act(async () => { + const wrapper = mountWithThemedIntl( + + + , + ); + expect(wrapper.find(InviteAs).length).toBe(0); + }); }); }); diff --git a/webapp/channels/src/components/invitation_modal/overage_users_banner_notice/index.tsx b/webapp/channels/src/components/invitation_modal/overage_users_banner_notice/index.tsx index ce1cd6a1c3..fb6c1968a7 100644 --- a/webapp/channels/src/components/invitation_modal/overage_users_banner_notice/index.tsx +++ b/webapp/channels/src/components/invitation_modal/overage_users_banner_notice/index.tsx @@ -16,10 +16,13 @@ import {savePreferences} from 'mattermost-redux/actions/preferences'; import {makeGetCategory} from 'mattermost-redux/selectors/entities/preferences'; import {PreferenceType} from '@mattermost/types/preferences'; import {useExpandOverageUsersCheck} from 'components/common/hooks/useExpandOverageUsersCheck'; -import {LicenseLinks, StatTypes, Preferences} from 'utils/constants'; +import {LicenseLinks, StatTypes, Preferences, ConsolePages} from 'utils/constants'; import './overage_users_banner_notice.scss'; import ExternalLink from 'components/external_link'; +import useCanSelfHostedExpand from 'components/common/hooks/useCanSelfHostedExpand'; +import {getSiteURL} from 'utils/url'; +import {getConfig} from 'mattermost-redux/selectors/entities/admin'; type AdminHasDismissedArgs = { preferenceName: string; @@ -42,6 +45,10 @@ const OverageUsersBannerNotice = () => { const currentUser = useSelector((state: GlobalState) => getCurrentUser(state)); const overagePreferences = useSelector((state: GlobalState) => getPreferencesCategory(state, Preferences.OVERAGE_USERS_BANNER)); const activeUsers = ((stats || {})[StatTypes.TOTAL_USERS]) as number || 0; + const isSelfHostedPurchaseEnabled = useSelector(getConfig)?.ServiceSettings?.SelfHostedPurchase; + const canSelfHostedExpand = useCanSelfHostedExpand() && isSelfHostedPurchaseEnabled; + const siteURL = getSiteURL(); + const { isBetween5PercerntAnd10PercentPurchasedSeats, isOver10PercerntPurchasedSeats, @@ -67,6 +74,7 @@ const OverageUsersBannerNotice = () => { licenseId: license.Id, isWarningState: isBetween5PercerntAnd10PercentPurchasedSeats, banner: 'invite modal', + canSelfHostedExpand: canSelfHostedExpand || false, }); if (!hasPermission || adminHasDismissed({overagePreferences, preferenceName})) { @@ -83,7 +91,27 @@ const OverageUsersBannerNotice = () => { }; let message; - if (!isGovSku) { + + if (canSelfHostedExpand) { + message = ( + Purchase additional seats to remain compliant.'} + values={{ + a: (chunks: React.ReactNode) => { + return ( + + {chunks} + + ); + }, + }} + /> + ); + } else if (!isGovSku) { message = ( { getRequestState: 'IDLE', }, }, + hostedCustomer: { + products: { + productsLoaded: true, + products: { + prod_professional: TestHelper.getProductMock({ + id: 'prod_professional', + name: 'Professional', + sku: SelfHostedProducts.PROFESSIONAL, + price_per_seat: 7.5, + }), + }, + }, + }, }, }; @@ -483,7 +496,7 @@ describe('components/invitation_modal/overage_users_banner_notice', () => { }); }); - it('gov sku sees overage notice but not a call to do true up', () => { + it('gov sku sees overage notice but not a call to do true up', async () => { const store: GlobalState = JSON.parse(JSON.stringify(initialState)); store.entities.admin = { @@ -502,8 +515,10 @@ describe('components/invitation_modal/overage_users_banner_notice', () => { }; store.entities.general.license.IsGovSku = 'true'; - renderComponent({ - store, + await act(async () => { + renderComponent({ + store, + }); }); screen.getByText(text10PercentageState); diff --git a/webapp/channels/src/components/keyboard_shortcuts/keyboard_shortcuts_modal/keyboard_shortcuts_modal.tsx b/webapp/channels/src/components/keyboard_shortcuts/keyboard_shortcuts_modal/keyboard_shortcuts_modal.tsx index b65030dd15..0db9b68ae6 100644 --- a/webapp/channels/src/components/keyboard_shortcuts/keyboard_shortcuts_modal/keyboard_shortcuts_modal.tsx +++ b/webapp/channels/src/components/keyboard_shortcuts/keyboard_shortcuts_modal/keyboard_shortcuts_modal.tsx @@ -11,7 +11,7 @@ import {GlobalState} from 'types/store'; import {suitePluginIds} from 'utils/constants'; import {t} from 'utils/i18n'; -import * as Utils from 'utils/utils'; +import * as UserAgent from 'utils/user_agent'; import KeyboardShortcutSequence, { KEYBOARD_SHORTCUTS, @@ -91,7 +91,7 @@ const KeyboardShortcutsModal = ({onExited}: Props): JSX.Element => { const handleHide = useCallback(() => setShow(false), []); - const isLinux = Utils.isLinux(); + const isLinux = UserAgent.isLinux(); const isCallsEnabled = useSelector((state: GlobalState) => { return Boolean(state.plugins.plugins[suitePluginIds.calls]); diff --git a/webapp/channels/src/components/keyboard_shortcuts/keyboard_shortcuts_sequence/keyboard_shortcuts_sequence.tsx b/webapp/channels/src/components/keyboard_shortcuts/keyboard_shortcuts_sequence/keyboard_shortcuts_sequence.tsx index 21488238da..c5315e36cb 100644 --- a/webapp/channels/src/components/keyboard_shortcuts/keyboard_shortcuts_sequence/keyboard_shortcuts_sequence.tsx +++ b/webapp/channels/src/components/keyboard_shortcuts/keyboard_shortcuts_sequence/keyboard_shortcuts_sequence.tsx @@ -6,7 +6,7 @@ import React, {memo} from 'react'; import {useIntl} from 'react-intl'; import {ShortcutKeyVariant, ShortcutKey} from 'components/shortcut_key'; -import {isMac} from 'utils/utils'; +import {isMac} from 'utils/user_agent'; import {isMessageDescriptor, KeyboardShortcutDescriptor} from './keyboard_shortcuts'; diff --git a/webapp/channels/src/components/learn_more_trial_modal/learn_more_trial_modal.test.tsx b/webapp/channels/src/components/learn_more_trial_modal/learn_more_trial_modal.test.tsx index e9dd3a2147..2194f15855 100644 --- a/webapp/channels/src/components/learn_more_trial_modal/learn_more_trial_modal.test.tsx +++ b/webapp/channels/src/components/learn_more_trial_modal/learn_more_trial_modal.test.tsx @@ -33,6 +33,12 @@ describe('components/learn_more_trial_modal/learn_more_trial_modal', () => { entities: { users: { currentUserId: 'current_user_id', + profiles: { + current_user_id: { + id: 'current_user_id', + roles: '', + }, + }, }, admin: { analytics: { diff --git a/webapp/channels/src/components/learn_more_trial_modal/learn_more_trial_modal.tsx b/webapp/channels/src/components/learn_more_trial_modal/learn_more_trial_modal.tsx index d3a81f9690..c50aa6caa8 100644 --- a/webapp/channels/src/components/learn_more_trial_modal/learn_more_trial_modal.tsx +++ b/webapp/channels/src/components/learn_more_trial_modal/learn_more_trial_modal.tsx @@ -2,7 +2,7 @@ // See LICENSE.txt for license information. import React, {useCallback, useEffect, useMemo, useState} from 'react'; -import {useIntl} from 'react-intl'; +import {FormattedMessage, useIntl} from 'react-intl'; import {useSelector, useDispatch} from 'react-redux'; import {trackEvent} from 'actions/telemetry_actions'; @@ -16,10 +16,13 @@ import MonitorImacLikeSVG from 'components/common/svg_images_components/monitor_ import SystemRolesSVG from 'components/admin_console/feature_discovery/features/images/system_roles_svg'; import CloudStartTrialButton from 'components/cloud_start_trial/cloud_start_trial_btn'; import {BtnStyle} from 'components/common/carousel/carousel_button'; +import useOpenSalesLink from 'components/common/hooks/useOpenSalesLink'; +import ExternalLink from 'components/external_link'; import {closeModal} from 'actions/views/modals'; import {DispatchFunc} from 'mattermost-redux/types/actions'; import {getLicense} from 'mattermost-redux/selectors/entities/general'; +import {deprecateCloudFree} from 'mattermost-redux/selectors/entities/preferences'; import StartTrialBtn from './start_trial_btn'; @@ -43,8 +46,11 @@ const LearnMoreTrialModal = ( const [embargoed, setEmbargoed] = useState(false); const dispatch = useDispatch(); + const [, salesLink] = useOpenSalesLink(); + // Cloud conditions const license = useSelector(getLicense); + const cloudFreeDeprecated = useSelector(deprecateCloudFree); const isCloud = license?.Cloud === 'true'; const handleEmbargoError = useCallback(() => { @@ -78,6 +84,20 @@ const LearnMoreTrialModal = ( extraClass={'btn btn-primary start-cloud-trial-btn'} /> ); + if (cloudFreeDeprecated) { + startTrialBtn = ( + + + + ); + } } const handleOnClose = useCallback(() => { diff --git a/webapp/channels/src/components/learn_more_trial_modal/learn_more_trial_modal_step.tsx b/webapp/channels/src/components/learn_more_trial_modal/learn_more_trial_modal_step.tsx index b9b3bbba43..3b721fea0b 100644 --- a/webapp/channels/src/components/learn_more_trial_modal/learn_more_trial_modal_step.tsx +++ b/webapp/channels/src/components/learn_more_trial_modal/learn_more_trial_modal_step.tsx @@ -2,10 +2,11 @@ // See LICENSE.txt for license information. import React from 'react'; - +import {useSelector} from 'react-redux'; import {FormattedMessage} from 'react-intl'; import TrialBenefitsModalStepMore from 'components/trial_benefits_modal/trial_benefits_modal_step_more'; +import {deprecateCloudFree} from 'mattermost-redux/selectors/entities/preferences'; import './learn_more_trial_modal_step.scss'; import {AboutLinks, LicenseLinks} from 'utils/constants'; @@ -35,6 +36,7 @@ const LearnMoreTrialModalStep = ( buttonLabel, handleOnClose, }: LearnMoreTrialModalStepProps) => { + const cloudFreeDeprecated = useSelector(deprecateCloudFree); return (
    )} -
    - - ( - - {msg} - - ), - linkPrivacy: (msg: React.ReactNode) => ( - - {msg} - - ), - }} - /> - -
    + { + cloudFreeDeprecated ? '' : ( +
    + + ( + + {msg} + + ), + linkPrivacy: (msg: React.ReactNode) => ( + + {msg} + + ), + }} + /> + +
    + ) + } {bottomLeftMessage && (
    {bottomLeftMessage} diff --git a/webapp/channels/src/components/leave_team_modal/leave_team_modal.tsx b/webapp/channels/src/components/leave_team_modal/leave_team_modal.tsx index 27db2843a3..b745a3e125 100644 --- a/webapp/channels/src/components/leave_team_modal/leave_team_modal.tsx +++ b/webapp/channels/src/components/leave_team_modal/leave_team_modal.tsx @@ -12,8 +12,7 @@ import * as UserUtils from 'mattermost-redux/utils/user_utils'; import FormattedMarkdownMessage from 'components/formatted_markdown_message'; import Constants from 'utils/constants'; - -import {isKeyPressed} from 'utils/utils'; +import {isKeyPressed} from 'utils/keyboard'; type Props = { currentUser: UserProfile; diff --git a/webapp/channels/src/components/logged_in/index.ts b/webapp/channels/src/components/logged_in/index.ts index 1b377dc75a..01a2a6b17a 100644 --- a/webapp/channels/src/components/logged_in/index.ts +++ b/webapp/channels/src/components/logged_in/index.ts @@ -16,9 +16,10 @@ import {getCurrentChannelId} from 'mattermost-redux/selectors/entities/channels' import {getLicense, getConfig} from 'mattermost-redux/selectors/entities/general'; import {getCurrentUser, shouldShowTermsOfService} from 'mattermost-redux/selectors/entities/users'; +import {getChannelURL} from 'selectors/urls'; + import {getHistory} from 'utils/browser_history'; import {checkIfMFARequired} from 'utils/route'; -import {getChannelURL} from 'utils/utils'; import {isPermalinkURL} from 'utils/url'; import LoggedIn from './logged_in'; diff --git a/webapp/channels/src/components/login/login.test.tsx b/webapp/channels/src/components/login/login.test.tsx index b1116f4d2c..512c98856f 100644 --- a/webapp/channels/src/components/login/login.test.tsx +++ b/webapp/channels/src/components/login/login.test.tsx @@ -288,4 +288,18 @@ describe('components/login/Login', () => { expect(externalLoginButton.props().label).toEqual('OpenID 2'); expect(externalLoginButton.props().style).toEqual({color: '#00ff00', borderColor: '#00ff00'}); }); + + it('should redirect on login', () => { + mockState.entities.users.currentUserId = 'user1'; + LocalStorageStore.setWasLoggedIn(true); + mockConfig.EnableSignInWithEmail = 'true'; + const redirectPath = '/boards/team/teamID/boardID'; + mockLocation.search = '?redirect_to=' + redirectPath; + mount( + + + , + ); + expect(mockHistoryPush).toHaveBeenCalledWith(redirectPath); + }); }); diff --git a/webapp/channels/src/components/login/login.tsx b/webapp/channels/src/components/login/login.tsx index bed62d7eed..f72e7df0f0 100644 --- a/webapp/channels/src/components/login/login.tsx +++ b/webapp/channels/src/components/login/login.tsx @@ -13,7 +13,7 @@ import {UserProfile} from '@mattermost/types/users'; import {Client4} from 'mattermost-redux/client'; import {getConfig, getLicense} from 'mattermost-redux/selectors/entities/general'; -import {getUseCaseOnboarding, isGraphQLEnabled} from 'mattermost-redux/selectors/entities/preferences'; +import {getIsOnboardingFlowEnabled, isGraphQLEnabled} from 'mattermost-redux/selectors/entities/preferences'; import {getTeamByName, getMyTeamMember} from 'mattermost-redux/selectors/entities/teams'; import {getCurrentUser} from 'mattermost-redux/selectors/entities/users'; import {isSystemAdmin} from 'mattermost-redux/utils/user_utils'; @@ -104,7 +104,7 @@ const Login = ({onCustomizeHeader}: LoginProps) => { const currentUser = useSelector(getCurrentUser); const experimentalPrimaryTeam = useSelector((state: GlobalState) => (ExperimentalPrimaryTeam ? getTeamByName(state, ExperimentalPrimaryTeam) : undefined)); const experimentalPrimaryTeamMember = useSelector((state: GlobalState) => getMyTeamMember(state, experimentalPrimaryTeam?.id ?? '')); - const useCaseOnboarding = useSelector(getUseCaseOnboarding); + const onboardingFlowEnabled = useSelector(getIsOnboardingFlowEnabled); const isCloud = useSelector(isCurrentLicenseCloud); const graphQLEnabled = useSelector(isGraphQLEnabled); @@ -142,6 +142,9 @@ const Login = ({onCustomizeHeader}: LoginProps) => { const enableExternalSignup = enableSignUpWithGitLab || enableSignUpWithOffice365 || enableSignUpWithGoogle || enableSignUpWithOpenId || enableSignUpWithSaml; const showSignup = enableOpenServer && (enableExternalSignup || enableSignUpWithEmail || enableLdap); + const query = new URLSearchParams(search); + const redirectTo = query.get('redirect_to'); + const getExternalLoginOptions = () => { const externalLoginOptions: ExternalLoginButtonType[] = []; @@ -373,6 +376,10 @@ const Login = ({onCustomizeHeader}: LoginProps) => { useEffect(() => { if (currentUser) { + if (redirectTo && redirectTo.match(/^\/([^/]|$)/)) { + history.push(redirectTo); + return; + } redirectUserToDefaultTeam(); return; } @@ -616,9 +623,6 @@ const Login = ({onCustomizeHeader}: LoginProps) => { dispatch(setNeedsLoggedInLimitReachedCheck(true)); } - const query = new URLSearchParams(search); - const redirectTo = query.get('redirect_to'); - setCSRFFromCookie(); // Record a successful login to local storage. If an unintentional logout occurs, e.g. @@ -631,7 +635,7 @@ const Login = ({onCustomizeHeader}: LoginProps) => { } else if (experimentalPrimaryTeamMember.team_id) { // Only set experimental team if user is on that team history.push(`/${ExperimentalPrimaryTeam}`); - } else if (useCaseOnboarding) { + } else if (onboardingFlowEnabled) { // need info about whether admin or not, // and whether admin has already completed // first time onboarding. Instead of fetching and orchestrating that here, diff --git a/webapp/channels/src/components/main_menu/main_menu.tsx b/webapp/channels/src/components/main_menu/main_menu.tsx index 6b42d9c87d..7999bb7128 100644 --- a/webapp/channels/src/components/main_menu/main_menu.tsx +++ b/webapp/channels/src/components/main_menu/main_menu.tsx @@ -9,7 +9,7 @@ import {Permissions} from 'mattermost-redux/constants'; import * as GlobalActions from 'actions/global_actions'; import {FREEMIUM_TO_ENTERPRISE_TRIAL_LENGTH_DAYS} from 'utils/cloud_utils'; import {Constants, LicenseSkus, ModalIdentifiers, MattermostFeatures} from 'utils/constants'; -import {cmdOrCtrlPressed, isKeyPressed} from 'utils/utils'; +import {cmdOrCtrlPressed, isKeyPressed} from 'utils/keyboard'; import {makeUrlSafe} from 'utils/url'; import * as UserAgent from 'utils/user_agent'; import InvitationModal from 'components/invitation_modal'; diff --git a/webapp/channels/src/components/menu/menu.tsx b/webapp/channels/src/components/menu/menu.tsx index 9e10805fbb..d41703c2a4 100644 --- a/webapp/channels/src/components/menu/menu.tsx +++ b/webapp/channels/src/components/menu/menu.tsx @@ -20,7 +20,7 @@ import {getIsMobileView} from 'selectors/views/browser'; import {openModal, closeModal} from 'actions/views/modals'; import Constants, {A11yClassNames} from 'utils/constants'; -import {isKeyPressed} from 'utils/utils'; +import {isKeyPressed} from 'utils/keyboard'; import CompassDesignProvider from 'components/compass_design_provider'; import Tooltip from 'components/tooltip'; diff --git a/webapp/channels/src/components/menu/menu_item.tsx b/webapp/channels/src/components/menu/menu_item.tsx index 78d75d3324..157afe2a9b 100644 --- a/webapp/channels/src/components/menu/menu_item.tsx +++ b/webapp/channels/src/components/menu/menu_item.tsx @@ -7,7 +7,7 @@ import MuiMenuItem from '@mui/material/MenuItem'; import type {MenuItemProps as MuiMenuItemProps} from '@mui/material/MenuItem'; import Constants from 'utils/constants'; -import {isKeyPressed} from 'utils/utils'; +import {isKeyPressed} from 'utils/keyboard'; export interface Props extends MuiMenuItemProps { diff --git a/webapp/channels/src/components/menu/sub_menu.tsx b/webapp/channels/src/components/menu/sub_menu.tsx index b63260f9e2..0a5f2061d1 100644 --- a/webapp/channels/src/components/menu/sub_menu.tsx +++ b/webapp/channels/src/components/menu/sub_menu.tsx @@ -14,7 +14,7 @@ import {isAnyModalOpen} from 'selectors/views/modals'; import {openModal, closeModal} from 'actions/views/modals'; import Constants, {A11yClassNames} from 'utils/constants'; -import {isKeyPressed} from 'utils/utils'; +import {isKeyPressed} from 'utils/keyboard'; import CompassDesignProvider from 'components/compass_design_provider'; import GenericModal from 'components/generic_modal'; diff --git a/webapp/channels/src/components/mfa/confirm.tsx b/webapp/channels/src/components/mfa/confirm.tsx index 54932f3cc0..b912d65ae4 100644 --- a/webapp/channels/src/components/mfa/confirm.tsx +++ b/webapp/channels/src/components/mfa/confirm.tsx @@ -5,7 +5,7 @@ import React from 'react'; import {FormattedMessage} from 'react-intl'; import Constants from 'utils/constants'; -import {isKeyPressed} from 'utils/utils'; +import {isKeyPressed} from 'utils/keyboard'; import {redirectUserToDefaultTeam} from 'actions/global_actions'; diff --git a/webapp/channels/src/components/multiselect/multiselect_list.tsx b/webapp/channels/src/components/multiselect/multiselect_list.tsx index 4ca33a2b49..cc86ac97e3 100644 --- a/webapp/channels/src/components/multiselect/multiselect_list.tsx +++ b/webapp/channels/src/components/multiselect/multiselect_list.tsx @@ -8,7 +8,7 @@ import {getOptionValue} from 'react-select/src/builtins'; import {FormattedMessage} from 'react-intl'; import Constants from 'utils/constants'; -import {cmdOrCtrlPressed} from 'utils/utils'; +import {cmdOrCtrlPressed} from 'utils/keyboard'; import LoadingScreen from 'components/loading_screen'; diff --git a/webapp/channels/src/components/new_channel_modal/__snapshots__/new_channel_modal.test.tsx.snap b/webapp/channels/src/components/new_channel_modal/__snapshots__/new_channel_modal.test.tsx.snap deleted file mode 100644 index a681256d49..0000000000 --- a/webapp/channels/src/components/new_channel_modal/__snapshots__/new_channel_modal.test.tsx.snap +++ /dev/null @@ -1,96 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`components/new_channel_modal should match snapshot 1`] = ` - -
    - - - -
    -