Merge branch 'master' into MM-51019-add-feature-flag-for-in-product-expansion

Этот коммит содержится в:
Mattermost Build
2023-03-02 22:40:26 +02:00
коммит произвёл GitHub
родитель 871f35326c 9c7aab24f5
Коммит f45ba2e593
21 изменённых файлов: 961 добавлений и 865 удалений

Просмотреть файл

@@ -1,801 +0,0 @@
version: 2.1
orbs:
aws-s3: circleci/aws-s3@3.0.0
executors:
ubuntu:
working_directory: ~/mattermost/
resource_class: 2xlarge
machine:
image: "ubuntu-2004:202201-02"
environment:
COMPOSE_PROJECT_NAME: "circleci"
ubuntu_xlarge:
working_directory: ~/mattermost/
resource_class: xlarge
machine:
image: "ubuntu-2004:202201-02"
environment:
COMPOSE_PROJECT_NAME: "circleci"
jobs:
setup-multi-product-repositories:
parameters:
target-branch:
type: string
default: '$(curl -s $(echo https://api.github.com/repos/${CIRCLE_PULL_REQUEST:19} | sed "s/\/pull\//\/pulls\//") | jq ".base.ref" | tr -d "\042" )'
working_directory: /mnt/ramdisk/mattermost-server
docker:
- image: cimg/go:1.18
resource_class: large
steps:
- checkout
- run: |
cd ..
git clone --depth=1 --no-single-branch https://github.com/mattermost/focalboard.git
cd focalboard
git checkout $CIRCLE_BRANCH || git checkout <<parameters.target-branch>> || git checkout rolling-stable
echo $(git rev-parse HEAD)
cd ../mattermost-server
make setup-go-work
cd ../focalboard
EXCLUDE_ENTERPRISE=TRUE make templates-archive
- persist_to_workspace:
root: /mnt/ramdisk
paths:
- mattermost-server
- focalboard
setup-mattermost-webapp:
working_directory: /mnt/ramdisk/
docker:
- image: mattermost/mattermost-build-webapp:20220802_node-16.10.0@sha256:3272aa759f10c2ef1719ed08cc82ddb07224bec5be86f09800c72f5e2a623c3d
resource_class: xlarge
steps:
- run: |
git clone --depth=1 --no-single-branch https://github.com/mattermost/mattermost-webapp.git
cd mattermost-webapp
git checkout $CIRCLE_BRANCH || git checkout master
export WEBAPP_GIT_COMMIT=$(git rev-parse HEAD)
echo "$WEBAPP_GIT_COMMIT"
FILE_DIST=dist.tar.gz
curl --version
runtime="2 minute"
endtime=$(date -ud "$runtime" +%s)
while [[ $(date -u +%s) -le $endtime ]]; do
if curl -s --max-time 30 -f -o $FILE_DIST https://pr-builds.mattermost.com/mattermost-webapp/commit/$WEBAPP_GIT_COMMIT/mattermost-webapp.tar.gz; then
break
fi
echo "Waiting for webapp git commit $WEBAPP_GIT_COMMIT with sleep 5: `date +%H:%M:%S`"
sleep 5
done
if [[ -f "$FILE_DIST" ]]; then
echo "Precompiled version of web app found"
mkdir dist && tar -xf $FILE_DIST -C dist --strip-components=1
else
echo "Building web app from source"
make dist
fi
- persist_to_workspace:
root: /mnt/ramdisk
paths:
- mattermost-webapp
setup-focalboard-product:
working_directory: /mnt/ramdisk/
docker:
- image: cimg/go:1.18-node
resource_class: large
steps:
- attach_workspace:
at: /mnt/ramdisk
- run: |
cd focalboard
echo "Building Boards product for web app"
# make prebuild build-product # TODO figure out how to get this to run without bypassing the Makefile
make prebuild
cd mattermost-plugin/webapp
npm run build:product
cd ../..
- persist_to_workspace:
root: /mnt/ramdisk
paths:
- focalboard/mattermost-plugin/webapp/dist
check-app-layers:
docker:
- image: cimg/go:1.18
resource_class: medium
working_directory: /mnt/ramdisk
steps:
- attach_workspace:
at: /mnt/ramdisk
- run:
command: |
cd mattermost-server
make app-layers
if [[ -n $(git status --porcelain) ]]; then echo "Please update the app layers using make app-layers"; exit 1; fi
check-generate-worktemplates:
docker:
- image: cimg/go:1.18
resource_class: medium
working_directory: /mnt/ramdisk
steps:
- attach_workspace:
at: /mnt/ramdisk
- run:
command: |
cd mattermost-server
make generate-worktemplates
if [[ -n $(git status --porcelain) ]]; then echo "Please update the worktemplates using make generate-worktemplates"; exit 1; fi
check-go-mod-tidy:
docker:
- image: cimg/go:1.18
resource_class: medium+
working_directory: /mnt/ramdisk
steps:
- attach_workspace:
at: /mnt/ramdisk
- run:
command: |
cd mattermost-server
make modules-tidy
if [[ -n $(git status --porcelain) ]]; then echo "Please tidy up the Go modules using make modules-tidy"; git diff; exit 1; fi
check-store-layers:
docker:
- image: cimg/go:1.18
resource_class: medium
working_directory: /mnt/ramdisk
steps:
- attach_workspace:
at: /mnt/ramdisk
- run:
command: |
cd mattermost-server
make store-layers
if [[ -n $(git status --porcelain) ]]; then echo "Please update the store layers using make store-layers"; exit 1; fi
check-mocks:
docker:
- image: cimg/go:1.18
resource_class: xlarge
working_directory: /mnt/ramdisk
steps:
- attach_workspace:
at: /mnt/ramdisk
- run:
command: |
cd mattermost-server
make mocks
if [[ -n $(git status --porcelain) ]]; then echo "Please update the mocks using `make mocks`"; exit 1; fi
check-email-templates:
docker:
- image: cimg/go:1.18-node
resource_class: medium+
working_directory: /mnt/ramdisk
steps:
- attach_workspace:
at: /mnt/ramdisk
- run:
command: |
cd mattermost-server
sudo npm install -g mjml@4.9.0
make build-templates
if [[ -n $(git status --porcelain) ]]; then echo "Please update the email templates using `make build-templates`"; exit 1; fi
check-gen-serialized:
docker:
- image: cimg/go:1.18
resource_class: small
working_directory: /mnt/ramdisk
steps:
- attach_workspace:
at: /mnt/ramdisk
- run:
command: |
cd mattermost-server
make gen-serialized
if [[ -n $(git status --porcelain) ]]; then echo "Please update the serialized files using 'make gen-serialized'"; exit 1; fi
check-migrations:
docker:
- image: cimg/go:1.18
resource_class: small
working_directory: /mnt/ramdisk
steps:
- attach_workspace:
at: /mnt/ramdisk
- run:
command: |
cd mattermost-server
make migrations-extract
if [[ -n $(git status --porcelain) ]]; then echo "Please update the migrations using make migrations-extract"; exit 1; fi
# Dedicated job for golangci-lint it does not need anything only the server code for that
# and to make more clear when the job fails
check-golangci-lint:
docker:
# Keep the version in sync with the command in Makefile
- image: golangci/golangci-lint:v1.50.1
resource_class: xlarge
working_directory: /mnt/ramdisk
steps:
- attach_workspace:
at: /mnt/ramdisk
- run:
command: |
cd mattermost-server
go vet ./...
make golangci-lint
# Dedicate job for mattermost-vet to make more clear when the job fails
check-mattermost-vet:
docker:
- image: mattermost/mattermost-build-server:20230118_golang-1.19.5
resource_class: xlarge
working_directory: /mnt/ramdisk
steps:
- attach_workspace:
at: /mnt/ramdisk
- run:
command: |
export GOBIN=${PWD}/mattermost-server/bin
export PATH=$PATH:$GOBIN
cd mattermost-server
make config-reset
make plugin-checker
make vet BUILD_NUMBER='${CIRCLE_BRANCH}-${CIRCLE_BUILD_NUM}' MM_NO_ENTERPRISE_LINT=true MM_VET_OPENSPEC_PATH='${PWD}/../mattermost-api-reference/v4/html/static/mattermost-openapi-v4.yaml'
build-api-spec:
docker:
- image: cimg/node:lts
working_directory: /mnt/ramdisk
steps:
- attach_workspace:
at: /mnt/ramdisk
- run:
command: |
git clone --depth=1 --no-single-branch https://github.com/mattermost/mattermost-api-reference.git
cd mattermost-api-reference
echo "Trying to checkout the same branch on mattermost-api-reference as mattermost-server"
git checkout ${CIRCLE_BRANCH} || true
make build
build-focalboard:
docker:
- image: mattermost/mattermost-build-server:20230118_golang-1.19.5
resource_class: medium
working_directory: /mnt/ramdisk
steps:
- attach_workspace:
at: /mnt/ramdisk
- run:
command: |
cd focalboard
make server-linux
build-mattermost-server:
docker:
- image: mattermost/mattermost-build-server:20230118_golang-1.19.5
resource_class: xlarge
working_directory: /mnt/ramdisk
steps:
- attach_workspace:
at: /mnt/ramdisk
- run:
command: |
cd mattermost-server
make config-reset
make build-cmd BUILD_NUMBER='${CIRCLE_BRANCH}-${CIRCLE_BUILD_NUM}'
make package BUILD_NUMBER='${CIRCLE_BRANCH}-${CIRCLE_BUILD_NUM}'
- store_artifacts:
path: /mnt/ramdisk/mattermost-server/dist/mattermost-team-linux-amd64.tar.gz
- store_artifacts:
path: /mnt/ramdisk/mattermost-server/dist/mattermost-team-osx-amd64.tar.gz
- store_artifacts:
path: /mnt/ramdisk/mattermost-server/dist/mattermost-team-linux-arm64.tar.gz
- store_artifacts:
path: /mnt/ramdisk/mattermost-server/dist/mattermost-team-osx-arm64.tar.gz
- store_artifacts:
path: /mnt/ramdisk/mattermost-server/dist/mattermost-team-windows-amd64.zip
- persist_to_workspace:
root: /mnt/ramdisk
paths:
- mattermost-server/dist
upload-artifacts-to-s3:
docker:
- image: cimg/python:3.10
working_directory: /mnt/ramdisk/
steps:
- attach_workspace:
at: /mnt/ramdisk/
- run:
command: |
cd /mnt/ramdisk/mattermost-server/dist/
rm -rf mattermost
- aws-s3/copy:
from: /mnt/ramdisk/mattermost-server/dist/
to: "s3://pr-builds.mattermost.com/mattermost-server/commit/${CIRCLE_SHA1}/"
arguments: --acl public-read --cache-control "no-cache" --recursive
- aws-s3/copy:
from: /mnt/ramdisk/mattermost-server/dist/
to: s3://pr-builds.mattermost.com/mattermost-server/$(echo "${CIRCLE_BRANCH}" | sed 's/pull\//PR-/g')/
arguments: --acl public-read --cache-control "no-cache" --recursive
build-docker:
working_directory: /mnt/ramdisk/
docker:
- image: cimg/base:stable
steps:
- attach_workspace:
at: /mnt/ramdisk/
- setup_remote_docker:
version: 20.10.7
- run:
command: |
export TAG="${CIRCLE_SHA1:0:7}"
cd mattermost-server/build
export DOCKER_CLI_EXPERIMENTAL=enabled
echo $DOCKER_PASSWORD | docker login --username $DOCKER_USERNAME --password-stdin
export MM_PACKAGE=https://pr-builds.mattermost.com/mattermost-server/commit/${CIRCLE_SHA1}/mattermost-team-linux-amd64.tar.gz
docker buildx build --push --build-arg MM_PACKAGE=$MM_PACKAGE -t mattermost/mm-te-test:${TAG} .
# Dedicate job for sentry it does not need anything only the server code for that
# and to make more clear when the job fails
sentry:
docker:
- image: getsentry/sentry-cli:1.64.1
working_directory: /mnt/ramdisk/
steps:
- checkout
- run:
command: apk add git
- run:
command: |
sentry-cli --log-level=debug releases new --finalize -p mattermost-server `git rev-parse HEAD`
sentry-cli --log-level=debug releases set-commits --auto `git rev-parse HEAD`
test:
executor:
name: ubuntu
parameters:
dbdriver:
type: string
dbsource:
type: string
racemode:
type: string
steps:
- attach_workspace:
at: ~/mattermost
- run:
name: Run Docker compose
command: |
cd mattermost-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
background: true
- run:
name: Wait for docker compose
command: |
until docker network inspect circleci_mm-test; do echo "Waiting for Docker Compose Network..."; sleep 1; done;
docker run --net circleci_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 circleci_mm-test appropriate/curl:latest sh -c "until curl --max-time 5 --output - http://elasticsearch:9200; do echo waiting for elasticsearch; sleep 5; done;"
- run:
name: Run Tests
command: |
mkdir -p mattermost-server/client/plugins
cd mattermost-server/build
docker run -it --net circleci_mm-test \
--env-file=dotenv/test.env \
--env MM_SQLSETTINGS_DATASOURCE="<<parameters.dbsource>>" \
--env MM_SQLSETTINGS_DRIVERNAME=<<parameters.dbdriver>> \
--env CIRCLECI=true \
-v ~/mattermost:/mattermost \
-w /mattermost/mattermost-server \
mattermost/mattermost-build-server:20230118_golang-1.19.5 \
bash -c "ulimit -n 8096; make test-server<< parameters.racemode >> BUILD_NUMBER=$CIRCLE_BRANCH-$CIRCLE_PREVIOUS_BUILD_NUM TESTFLAGS= TESTFLAGSEE=" \
bash -c scripts/diff-email-templates.sh
no_output_timeout: 2h
- run:
name: Capture docker logs
when: always
command: |
cd mattermost-server/build
# Capture docker logs
mkdir -p logs
docker-compose logs --tail="all" -t --no-color > logs/docker-compose_logs
docker ps -a --no-trunc > logs/docker_ps
docker stats -a --no-stream > logs/docker_stats
tar -czvf logs/docker_logs.tar.gz logs/docker-compose_logs logs/docker_ps logs/docker_stats
- store_artifacts:
path: ~/mattermost/mattermost-server/build/logs
- run:
when: always
command: |
cd mattermost-server
mkdir -p test-results
cp report.xml test-results
- store_test_results:
path: ~/mattermost/mattermost-server/test-results/
- store_artifacts:
path: ~/mattermost/mattermost-server/test-results/
test-schema:
executor:
name: ubuntu_xlarge
steps:
- attach_workspace:
at: ~/mattermost
- run:
name: Run Docker compose
command: |
cd mattermost-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
background: true
- run:
name: Wait for docker compose
command: |
until docker network inspect circleci_mm-test; do echo "Waiting for Docker Compose Network..."; sleep 1; done;
docker run --net circleci_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 circleci_mm-test appropriate/curl:latest sh -c "until curl --max-time 5 --output - http://elasticsearch:9200; do echo waiting for elasticsearch; sleep 5; done;"
- run:
name: Postgres schema migration validation
command: |
cd mattermost-server/build
mkdir -p mattermost-server/client/plugins
echo "Creating databases"
docker-compose --no-ansi exec -T postgres sh -c 'exec echo "CREATE DATABASE migrated; CREATE DATABASE latest;" | exec psql -U mmuser mattermost_test'
echo "Importing postgres dump from version 6.0.0"
docker-compose --no-ansi exec -T postgres psql -U mmuser -d migrated < ../scripts/mattermost-postgresql-6.0.0.sql
docker-compose --no-ansi exec -T postgres psql -U mmuser -d migrated -c "INSERT INTO Systems (Name, Value) VALUES ('Version', '6.0.0')"
docker run -it --net circleci_mm-test \
--env-file="dotenv/test-schema-validation.env" \
--env MM_SQLSETTINGS_DATASOURCE="postgres://mmuser:mostest@postgres:5432/migrated?sslmode=disable&connect_timeout=10" \
--env MM_SQLSETTINGS_DRIVERNAME=postgres \
-v ~/mattermost:/mattermost \
-w /mattermost/mattermost-server \
mattermost/mattermost-build-server:20230118_golang-1.19.5 \
bash -c "ulimit -n 8096; make ARGS='db migrate' run-cli && make MM_SQLSETTINGS_DATASOURCE='postgres://mmuser:mostest@postgres:5432/latest?sslmode=disable&connect_timeout=10' ARGS='db migrate' run-cli"
echo "Generating dump"
docker-compose --no-ansi exec -T postgres pg_dump --schema-only -d migrated -U mmuser > migrated.sql
docker-compose --no-ansi exec -T postgres pg_dump --schema-only -d latest -U mmuser > latest.sql
echo "Removing databases created for db comparison"
docker-compose --no-ansi exec -T postgres sh -c 'exec echo "DROP DATABASE migrated; DROP DATABASE latest;" | exec psql -U mmuser mattermost_test'
echo "Generating diff"
diff migrated.sql latest.sql > diff.txt && echo "Both schemas are same" || (echo "Schema mismatch" && cat diff.txt && exit 1)
no_output_timeout: 1h
- run:
name: MySQL schema migration validation
command: |
cd mattermost-server/build
mkdir -p mattermost-server/client/plugins
echo "Creating databases"
docker-compose --no-ansi exec -T mysql mysql -uroot -pmostest -e "CREATE DATABASE migrated; CREATE DATABASE latest; GRANT ALL PRIVILEGES ON migrated.* TO mmuser; GRANT ALL PRIVILEGES ON latest.* TO mmuser"
echo "Importing mysql dump from version 6.0.0"
docker-compose --no-ansi exec -T mysql mysql -D migrated -uroot -pmostest < ../scripts/mattermost-mysql-6.0.0.sql
docker-compose --no-ansi exec -T mysql mysql -D migrated -uroot -pmostest -e "INSERT INTO Systems (Name, Value) VALUES ('Version', '6.0.0')"
docker run -it --net circleci_mm-test \
--env-file="dotenv/test-schema-validation.env" \
--env MM_SQLSETTINGS_DATASOURCE="mmuser:mostest@tcp(mysql:3306)/migrated?charset=utf8mb4,utf8&readTimeout=30s&writeTimeout=30s" \
--env MM_SQLSETTINGS_DRIVERNAME=mysql \
-v ~/mattermost:/mattermost \
-w /mattermost/mattermost-server \
mattermost/mattermost-build-server:20230118_golang-1.19.5 \
bash -c "ulimit -n 8096; make ARGS='db migrate' run-cli && make MM_SQLSETTINGS_DATASOURCE='mmuser:mostest@tcp(mysql:3306)/latest?charset=utf8mb4,utf8&readTimeout=30s&writeTimeout=30s' ARGS='db migrate' run-cli"
echo "Generating dump"
docker-compose --no-ansi exec -T mysql mysqldump --skip-opt --no-data --compact -u root -pmostest migrated > migrated.sql
docker-compose --no-ansi exec -T mysql mysqldump --skip-opt --no-data --compact -u root -pmostest latest > latest.sql
echo "Removing databases created for db comparison"
docker-compose --no-ansi exec -T mysql mysql -uroot -pmostest -e 'DROP DATABASE migrated; DROP DATABASE latest'
echo "Generating diff"
diff migrated.sql latest.sql > diff.txt && echo "Both schemas are same" || (echo "Schema mismatch" && cat diff.txt && exit 1)
no_output_timeout: 1h
workflows:
version: 2
untagged-build:
jobs:
- setup-multi-product-repositories:
context:
- matterbuild-github-token
filters:
branches:
ignore:
- master
- /^release-.*/
- setup-mattermost-webapp:
filters:
branches:
ignore:
- master
- /^release-.*/
- setup-focalboard-product:
filters:
branches:
ignore:
- master
- /^release-.*/
requires:
- setup-multi-product-repositories
- check-go-mod-tidy:
requires:
- setup-multi-product-repositories
- check-golangci-lint:
requires:
- setup-multi-product-repositories
- check-app-layers:
requires:
- setup-multi-product-repositories
- check-generate-worktemplates:
requires:
- setup-multi-product-repositories
- check-store-layers:
requires:
- setup-multi-product-repositories
- check-mocks:
requires:
- setup-multi-product-repositories
- check-email-templates:
requires:
- setup-multi-product-repositories
- check-gen-serialized:
requires:
- setup-multi-product-repositories
- check-mattermost-vet:
requires:
- setup-multi-product-repositories
- check-migrations:
requires:
- setup-multi-product-repositories
- build-api-spec:
requires:
- setup-multi-product-repositories
- build-mattermost-server:
requires:
- check-go-mod-tidy
- check-golangci-lint
- check-app-layers
- check-generate-worktemplates
- check-store-layers
- check-mocks
- check-email-templates
- check-gen-serialized
- check-mattermost-vet
- check-migrations
- build-api-spec
- setup-mattermost-webapp
- setup-focalboard-product
- build-focalboard:
requires:
- check-go-mod-tidy
- check-golangci-lint
- check-app-layers
- check-generate-worktemplates
- check-store-layers
- check-mocks
- check-email-templates
- check-gen-serialized
- check-mattermost-vet
- check-migrations
- build-api-spec
- setup-mattermost-webapp
- test:
name: test-mysql
dbdriver: mysql
dbsource: mmuser:mostest@tcp(mysql:3306)/mattermost_test?charset=utf8mb4,utf8&multiStatements=true
racemode: ""
requires:
- check-go-mod-tidy
- check-golangci-lint
- check-app-layers
- check-generate-worktemplates
- check-store-layers
- check-mocks
- check-email-templates
- check-gen-serialized
- check-mattermost-vet
- check-migrations
- build-api-spec
- setup-mattermost-webapp
- setup-focalboard-product
- test:
name: test-postgres-normal
dbdriver: postgres
dbsource: postgres://mmuser:mostest@postgres:5432/mattermost_test?sslmode=disable&connect_timeout=10
racemode: ""
requires:
- check-go-mod-tidy
- check-golangci-lint
- check-app-layers
- check-generate-worktemplates
- check-store-layers
- check-mocks
- check-email-templates
- check-gen-serialized
- check-mattermost-vet
- check-migrations
- build-api-spec
- setup-mattermost-webapp
- setup-focalboard-product
- test:
name: test-postgres-binary
dbdriver: postgres
dbsource: postgres://mmuser:mostest@postgres:5432/mattermost_test?sslmode=disable&connect_timeout=10&binary_parameters=yes
racemode: ""
requires:
- check-go-mod-tidy
- check-golangci-lint
- check-app-layers
- check-generate-worktemplates
- check-store-layers
- check-mocks
- check-email-templates
- check-gen-serialized
- check-mattermost-vet
- check-migrations
- build-api-spec
- setup-mattermost-webapp
- setup-focalboard-product
- test-schema:
requires:
- check-go-mod-tidy
- check-golangci-lint
- check-app-layers
- check-generate-worktemplates
- check-store-layers
- check-mocks
- check-email-templates
- check-gen-serialized
- check-mattermost-vet
- check-migrations
- build-api-spec
- setup-mattermost-webapp
- setup-focalboard-product
- upload-artifacts-to-s3:
context: mattermost-ci-pr-builds-s3
requires:
- build-mattermost-server
- build-focalboard
- build-docker:
context: matterbuild-docker
requires:
- upload-artifacts-to-s3
release-build:
jobs:
- setup-multi-product-repositories:
context:
- matterbuild-github-token
filters:
branches:
only:
- master
- /^release-.*/
- cloud
- setup-mattermost-webapp:
filters:
branches:
only:
- master
- /^release-.*/
- cloud
- setup-focalboard-product:
filters:
branches:
only:
- master
- /^release-.*/
- cloud
requires:
- setup-multi-product-repositories
- check-go-mod-tidy:
requires:
- setup-multi-product-repositories
- check-golangci-lint:
requires:
- setup-multi-product-repositories
- check-app-layers:
requires:
- setup-multi-product-repositories
- check-generate-worktemplates:
requires:
- setup-multi-product-repositories
- check-store-layers:
requires:
- setup-multi-product-repositories
- check-mocks:
requires:
- setup-multi-product-repositories
- check-email-templates:
requires:
- setup-multi-product-repositories
- check-gen-serialized:
requires:
- setup-multi-product-repositories
- check-mattermost-vet:
requires:
- setup-multi-product-repositories
- check-migrations:
requires:
- setup-multi-product-repositories
- build-api-spec:
requires:
- setup-multi-product-repositories
- sentry:
context: matterbuild-sentry
requires:
- setup-multi-product-repositories
- build-mattermost-server:
requires:
- check-go-mod-tidy
- check-golangci-lint
- check-app-layers
- check-generate-worktemplates
- check-store-layers
- check-mocks
- check-email-templates
- check-gen-serialized
- check-mattermost-vet
- check-migrations
- build-api-spec
- setup-mattermost-webapp
- setup-focalboard-product
- build-focalboard:
requires:
- check-go-mod-tidy
- check-golangci-lint
- check-app-layers
- check-generate-worktemplates
- check-store-layers
- check-mocks
- check-email-templates
- check-gen-serialized
- check-mattermost-vet
- check-migrations
- build-api-spec
- setup-mattermost-webapp
- test:
name: test-mysql
dbdriver: mysql
dbsource: mmuser:mostest@tcp(mysql:3306)/mattermost_test?charset=utf8mb4,utf8&multiStatements=true
racemode: "-race"
requires:
- check-go-mod-tidy
- check-golangci-lint
- check-app-layers
- check-generate-worktemplates
- check-store-layers
- check-mocks
- check-email-templates
- check-gen-serialized
- check-mattermost-vet
- check-migrations
- build-api-spec
- test:
name: test-postgres-normal
dbdriver: postgres
dbsource: postgres://mmuser:mostest@postgres:5432/mattermost_test?sslmode=disable&connect_timeout=10
racemode: "-race"
requires:
- check-go-mod-tidy
- check-golangci-lint
- check-app-layers
- check-generate-worktemplates
- check-store-layers
- check-mocks
- check-email-templates
- check-gen-serialized
- check-mattermost-vet
- check-migrations
- build-api-spec
- test:
name: test-postgres-binary
dbdriver: postgres
dbsource: postgres://mmuser:mostest@postgres:5432/mattermost_test?sslmode=disable&connect_timeout=10&binary_parameters=yes
racemode: ""
requires:
- check-go-mod-tidy
- check-golangci-lint
- check-app-layers
- check-generate-worktemplates
- check-store-layers
- check-mocks
- check-email-templates
- check-gen-serialized
- check-mattermost-vet
- check-migrations
- build-api-spec

290
.github/workflows/ci.yml поставляемый Обычный файл
Просмотреть файл

@@ -0,0 +1,290 @@
name: mattermost-build
on:
pull_request:
push:
branches:
- master
- cloud
- release-*
jobs:
check-mocks:
name: Check mocks
runs-on: ubuntu-22.04
steps:
- name: Checkout mattermost-server
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
- name: Generate mocks
run: make mocks
- name: Check mocks
run: if [[ -n $(git status --porcelain) ]]; then echo "Please update the mocks using `make mocks`"; exit 1; fi
check-go-mod-tidy:
name: Check go mod tidy
runs-on: ubuntu-22.04
steps:
- name: Checkout mattermost-server
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
- name: Run go mod tidy
run: make modules-tidy
- name: Check modules
run: if [[ -n $(git status --porcelain) ]]; then echo "Please tidy up the Go modules using make modules-tidy"; git diff; exit 1; fi
check-gen-serialized:
name: Check serialization methods for hot structs
runs-on: ubuntu-22.04
steps:
- name: Checkout mattermost-server
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
- 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
steps:
- name: Checkout mattermost-server
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
- name: Checkout focalboard
run: |
cd ..
git clone --depth=1 --no-single-branch https://github.com/mattermost/focalboard.git
cd focalboard
git checkout $GITHUB_HEAD_REF || git checkout $GITHUB_BASE_REF || git checkout rolling-stable
echo $(git rev-parse HEAD)
cd ../mattermost-server
make setup-go-work
- name: Reset config
run: make config-reset
- name: Run plugin-checker
run: make plugin-checker
- name: Run mattermost-vet
run: make vet BUILD_NUMBER='${GITHUB_HEAD_REF}' MM_NO_ENTERPRISE_LINT=true MM_VET_OPENSPEC_PATH='${PWD}/../mattermost-api-reference/v4/html/static/mattermost-openapi-v4.yaml'
check-migrations:
name: Check migration files
runs-on: ubuntu-22.04
steps:
- name: Checkout mattermost-server
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
- name: Extract migrations files
run: make migrations-extract
- name: Check migration files
run: if [[ -n $(git status --porcelain) ]]; then echo "Please update the migrations using make migrations-extract"; exit 1; fi
build-api-spec:
name: Build API specification
runs-on: ubuntu-22.04
steps:
- name: Checkout mattermost-server
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
- name: Checkout mattermost-api-reference
run: |
cd ..
git clone --depth=1 --no-single-branch https://github.com/mattermost/mattermost-api-reference.git
cd mattermost-api-reference
echo "Trying to checkout the same branch on mattermost-api-reference as mattermost-server"
git checkout $GITHUB_HEAD_REF || git checkout $GITHUB_BASE_REF || true
make build
cd ../mattermost-server
check-generate-work-templates:
name: Generate work templates
runs-on: ubuntu-22.04
steps:
- name: Checkout mattermost-server
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
- name: Generate work templates
run: make generate-worktemplates
- name: Check generated work templates
run: if [[ -n $(git status --porcelain) ]]; then echo "Please update the worktemplates using make generate-worktemplates"; exit 1; fi
check-email-templates:
name: Generate email templates
runs-on: ubuntu-22.04
steps:
- name: Checkout mattermost-server
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
- name: Generate email templates
run: |
sudo npm install -g mjml@4.9.0
make build-templates
- name: Check generated email templates
run: if [[ -n $(git status --porcelain) ]]; then echo "Please update the email templates using `make build-templates`"; exit 1; fi
check-store-layers:
name: Check store layers
runs-on: ubuntu-22.04
steps:
- name: Checkout mattermost-server
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
- name: Generate store layers
run: make store-layers
- name: Check generated code
run: if [[ -n $(git status --porcelain) ]]; then echo "Please update the store layers using make store-layers"; exit 1; fi
check-app-layers:
name: Check app layers
runs-on: ubuntu-22.04
steps:
- name: Checkout mattermost-server
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
- name: Generate app layers
run: make app-layers
- name: Check generated code
run: if [[ -n $(git status --porcelain) ]]; then echo "Please update the app layers using make app-layers"; exit 1; fi
test-postgres-binary:
name: Run tests on postgres with binary parameters
needs: check-mattermost-vet
uses: ./.github/workflows/test.yml
with:
datasource: postgres://mmuser:mostest@postgres:5432/mattermost_test?sslmode=disable&connect_timeout=10&binary_parameters=yes
drivername: postgres
test-postgres-normal:
name: Run tests on postgres
needs: check-mattermost-vet
uses: ./.github/workflows/test.yml
with:
datasource: postgres://mmuser:mostest@postgres:5432/mattermost_test?sslmode=disable&connect_timeout=10
drivername: postgres
test-mysql:
name: Run tests on mysql
needs: check-mattermost-vet
uses: ./.github/workflows/test.yml
with:
datasource: mmuser:mostest@tcp(mysql:3306)/mattermost_test?charset=utf8mb4,utf8&multiStatements=true
drivername: mysql
build-mattermost-server:
name: Build mattermost-server
runs-on: ubuntu-latest-8-cores
needs: check-mattermost-vet
steps:
- name: Checkout mattermost-server
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
- name: Checkout mattermost-webapp
run: |
cd ..
git clone --depth=1 --no-single-branch https://github.com/mattermost/mattermost-webapp.git
cd mattermost-webapp
git checkout $GITHUB_HEAD_REF || git checkout master
export WEBAPP_GIT_COMMIT=$(git rev-parse HEAD)
echo "$WEBAPP_GIT_COMMIT"
FILE_DIST=dist.tar.gz
runtime="2 minute"
endtime=$(date -ud "$runtime" +%s)
while [[ $(date -u +%s) -le $endtime ]]; do
if curl -s --max-time 30 -f -o $FILE_DIST https://pr-builds.mattermost.com/mattermost-webapp/commit/$WEBAPP_GIT_COMMIT/mattermost-webapp.tar.gz; then
break
fi
echo "Waiting for webapp git commit $WEBAPP_GIT_COMMIT with sleep 5: `date +%H:%M:%S`"
sleep 5
done
if [[ -f "$FILE_DIST" ]]; then
echo "Precompiled version of web app found"
mkdir dist && tar -xf $FILE_DIST -C dist --strip-components=1
else
echo "Building web app from source"
make dist
fi
cd ../mattermost-server
- name: Checkout and build focalboard
run: |
cd ..
git clone --depth=1 --no-single-branch https://github.com/mattermost/focalboard.git
cd focalboard
git checkout $GITHUB_HEAD_REF || git checkout $GITHUB_BASE_REF || git checkout rolling-stable
echo $(git rev-parse HEAD)
make server-linux
echo "Building Boards product for web app"
# make prebuild build-product # TODO figure out how to get this to run without bypassing the Makefile
make prebuild
cd mattermost-plugin/webapp
npm run build:product
cd ../../../mattermost-server
make setup-go-work
- name: Build
run: |
make config-reset
make build-cmd BUILD_NUMBER='${GITHUB_HEAD_REF}-${GITHUB_RUN_ID}'
make package BUILD_NUMBER='${GITHUB_HEAD_REF}-${GITHUB_RUN_ID}'
- name: Persist dist artifacts
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
with:
name: server-dist-artifact
path: dist/
retention-days: 14
- name: Persist build artifacts
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
with:
name: server-build-artifact
path: build/
retention-days: 14
upload-s3:
name: Upload to S3 bucket
runs-on: ubuntu-22.04
needs:
- build-mattermost-server
- test-mysql
- test-postgres-binary
- test-postgres-normal
env:
REPO_NAME: ${{ github.event.repository.name }}
steps:
- name: Download dist artifacts
uses: actions/download-artifact@e9ef242655d12993efdcda9058dee2db83a2cb9b # v3.0.2
with:
name: server-dist-artifact
path: dist/
- name: Configure AWS
uses: aws-actions/configure-aws-credentials@07c2f971bac433df982ccc261983ae443861db49 # v1-node16
with:
aws-region: us-east-1
aws-access-key-id: ${{ secrets.MM_SERVER_AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.MM_SERVER_AWS_SECRET_ACCESS_KEY }}
# We need to sanitize the branch name before using it
- name: ci/sanitize-branch-name
id: branch
uses: transferwise/sanitize-branch-name@b10b4d524ac5a7b645b43a3527db3a6cca017b9d # v1
# Search for the string "pull" and replace it with "PR" in branch-name
- name: ci/sanitize-branch-name-replace-pull-with-PR-
run: echo "BRANCH_NAME=$(echo ${{ steps.branch.outputs.sanitized-branch-name }} | sed 's/^pull\//PR-/g')" >> $GITHUB_ENV
- name: ci/artifact-upload
run: |
aws s3 cp dist/ s3://pr-builds.mattermost.com/$REPO_NAME/$BRANCH_NAME/ --acl public-read --cache-control "no-cache" --recursive
aws s3 cp dist/ s3://pr-builds.mattermost.com/$REPO_NAME/commit/${{ github.sha }}/ --acl public-read --cache-control "no-cache" --recursive
build-docker:
name: Build docker image
runs-on: ubuntu-22.04
needs: upload-s3
steps:
- name: Download build artifacts
uses: actions/download-artifact@e9ef242655d12993efdcda9058dee2db83a2cb9b # v3.0.2
with:
name: server-build-artifact
path: build/
- name: Login to Docker Hub
uses: docker/login-action@3da7dc6e2b31f99ef2cb9fb4c50fb0971e0d0139 # v2.1.0
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@11e8a2e2910826a92412015c515187a2d6750279 # v2.4
- name: 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 build
export DOCKER_CLI_EXPERIMENTAL=enabled
export MM_PACKAGE=https://pr-builds.mattermost.com/mattermost-server/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} .
sentry:
name: Send build info to sentry
runs-on: ubuntu-22.04
needs:
- test-postgres-binary
- test-postgres-normal
- test-mysql
- build-mattermost-server
if: ${{ github.event_name == 'push' }}
env:
SENTRY_AUTH_TOKEN: ${{ secrets.MM_SERVER_SENTRY_AUTH_TOKEN }}
SENTRY_ORG: ${{ secrets.MM_SERVER_SENTRY_ORG }}
SENTRY_PROJECT: ${{ secrets.MM_SERVER_SENTRY_PROJECT }}
steps:
- name: Checkout mattermost-server
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
- name: Create Sentry release
uses: getsentry/action-release@85e0095193a153d57c458995f99d0afd81b9e5ea # v1.3.0

48
.github/workflows/test.yml поставляемый Обычный файл
Просмотреть файл

@@ -0,0 +1,48 @@
name: Test
on:
workflow_call:
inputs:
datasource:
required: true
type: string
drivername:
required: true
type: string
jobs:
run-tests:
runs-on: ubuntu-latest-8-cores
env:
COMPOSE_PROJECT_NAME: ghactions
BUILD_IMAGE: mattermost/mattermost-build-server:20230118_golang-1.19.5
steps:
- name: Checkout mattermost-server
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
- name: Run docker compose
run: |
cd 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
cd ..
- 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: Run Tests
run: |
if [[ ${{ github.event_name }} == 'push' ]]; then
export RACE_MODE="-race"
fi
mkdir -p client/plugins
cd build
docker run --net ghactions_mm-test \
--ulimit nofile=8096:8096 \
--env-file=dotenv/test.env \
--env MM_SQLSETTINGS_DRIVERNAME="${{ inputs.drivername }}" \
--env MM_SQLSETTINGS_DATASOURCE="${{ inputs.datasource }}" \
-v ~/work/mattermost-server:/mattermost-server \
-w /mattermost-server/mattermost-server \
$BUILD_IMAGE \
make test-server$RACE_MODE BUILD_NUMBER=$GITHUB_HEAD_REF-$GITHUB_RUN_ID TESTFLAGS= TESTFLAGSEE=

Просмотреть файл

@@ -216,7 +216,9 @@ func (a *App) SanitizePostMetadataForUser(c request.CTX, post *model.Post, userI
}
if previewedChannel != nil && !a.HasPermissionToReadChannel(c, userID, previewedChannel) {
post.Metadata.Embeds[0].Data = nil
for _, embed := range post.Metadata.Embeds {
embed.Data = nil
}
}
return post, nil

Просмотреть файл

@@ -3292,4 +3292,19 @@ func TestGetTopDMsForUserSince(t *testing.T) {
require.Equal(t, topDMs.Items[0].SecondParticipant.Id, u3.Id)
require.Equal(t, topDMs.Items[0].MessageCount, int64(4))
})
t.Run("topDMs will not consider deleted second user", func(t *testing.T) {
// u4 only takes part in one conversation
topDMs, err := th.App.GetTopDMsForUserSince(u4.Id, &model.InsightsOpts{StartUnixMilli: 100, Page: 0, PerPage: 100})
require.Nil(t, err)
// len of topDMs.Items should be 1
require.Len(t, topDMs.Items, 1)
// delete user3
err = th.App.PermanentDeleteUser(th.Context, u3)
require.Nil(t, err)
topDMs, err = th.App.GetTopDMsForUserSince(u4.Id, &model.InsightsOpts{StartUnixMilli: 100, Page: 0, PerPage: 100})
require.Nil(t, err)
// len of topDMs.Items should be 0 since u3 is deleted
require.Len(t, topDMs.Items, 0)
})
}

Просмотреть файл

@@ -579,14 +579,14 @@ func (s *Server) startInterClusterServices(license *model.License) error {
// Remote Cluster service
// License check
if !*license.Features.RemoteClusterService {
// License check (assume enabled if shared channels enabled)
if !*license.Features.RemoteClusterService && !license.HasSharedChannels() {
mlog.Debug("License does not have Remote Cluster services enabled")
return nil
}
// Config check
if !*s.platform.Config().ExperimentalSettings.EnableRemoteClusterService {
if !*s.platform.Config().ExperimentalSettings.EnableRemoteClusterService && !*s.platform.Config().ExperimentalSettings.EnableSharedChannels {
mlog.Debug("Remote Cluster Service disabled via config")
return nil
}
@@ -606,7 +606,7 @@ func (s *Server) startInterClusterServices(license *model.License) error {
s.remoteClusterService = rcs
s.serviceMux.Unlock()
// Shared Channels service
// Shared Channels service (depends on remote cluster service)
// License check
if !license.HasSharedChannels() {

Просмотреть файл

@@ -58,7 +58,7 @@ RUN apt-get update \
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+deb10u4 \
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 \
@@ -79,11 +79,11 @@ RUN apt-get update \
# Set mattermost group/user and download Mattermost
RUN mkdir -p /mattermost/data /mattermost/plugins /mattermost/client/plugins \
&& addgroup -gid ${PGID} mattermost \
&& adduser -q --disabled-password --uid ${PUID} --gid ${PGID} --gecos "" --home /mattermost mattermost \
&& if [ -n "$MM_PACKAGE" ]; then curl $MM_PACKAGE | tar -xvz ; \
else echo "please set the MM_PACKAGE" ; exit 127 ; fi \
&& chown -R mattermost:mattermost /mattermost /mattermost/data /mattermost/plugins /mattermost/client/plugins
&& addgroup -gid ${PGID} mattermost \
&& adduser -q --disabled-password --uid ${PUID} --gid ${PGID} --gecos "" --home /mattermost mattermost \
&& if [ -n "$MM_PACKAGE" ]; then curl $MM_PACKAGE | tar -xvz ; \
else echo "please set the MM_PACKAGE" ; exit 127 ; fi \
&& chown -R mattermost:mattermost /mattermost /mattermost/data /mattermost/plugins /mattermost/client/plugins
# We should refrain from running as privileged user
USER mattermost

Просмотреть файл

@@ -4785,7 +4785,7 @@
},
{
"id": "web.error.unsupported_browser.min_os_version.windows",
"translation": "Windows 8.1+"
"translation": "Windows 10+"
},
{
"id": "web.error.unsupported_browser.min_os_version.mac",
@@ -4793,19 +4793,19 @@
},
{
"id": "web.error.unsupported_browser.min_browser_version.safari",
"translation": "Version 14.1+"
"translation": "Version 16.2+"
},
{
"id": "web.error.unsupported_browser.min_browser_version.firefox",
"translation": "Version 91+"
"translation": "Version 102+"
},
{
"id": "web.error.unsupported_browser.min_browser_version.edge",
"translation": "Version 95+"
"translation": "Version 110+"
},
{
"id": "web.error.unsupported_browser.min_browser_version.chrome",
"translation": "Version 106+"
"translation": "Version 110+"
},
{
"id": "web.error.unsupported_browser.learn_more",
@@ -10001,5 +10001,9 @@
{
"id": "api.system.logs.invalidFilter",
"translation": "Ungültiger Protokollfilter"
},
{
"id": "api.server.cws.delete_workspace.app_error",
"translation": "CWS Server kann Arbeitsbereich nicht löschen."
}
]

Просмотреть файл

@@ -61,7 +61,7 @@
},
{
"id": "web.error.unsupported_browser.min_os_version.windows",
"translation": "Windows 8.1+"
"translation": "Windows 10+"
},
{
"id": "web.error.unsupported_browser.min_os_version.mac",
@@ -69,19 +69,19 @@
},
{
"id": "web.error.unsupported_browser.min_browser_version.safari",
"translation": "Version 12+"
"translation": "Version 16.2+"
},
{
"id": "web.error.unsupported_browser.min_browser_version.firefox",
"translation": "Version 91+"
"translation": "Version 102+"
},
{
"id": "web.error.unsupported_browser.min_browser_version.edge",
"translation": "Version 95+"
"translation": "Version 110+"
},
{
"id": "web.error.unsupported_browser.min_browser_version.chrome",
"translation": "Version 106+"
"translation": "Version 110+"
},
{
"id": "web.error.unsupported_browser.learn_more",
@@ -9965,5 +9965,41 @@
{
"id": "api.command_templates.desc",
"translation": "Open the create from template window"
},
{
"id": "app.worktemplates.execute_work_template.name_too_long",
"translation": "The name field cannot contain more than 64 characters."
},
{
"id": "app.team.create_onboarding_linked_board.product_key_not_found",
"translation": "product key not found"
},
{
"id": "app.team.create_onboarding_linked_board.itf_not_of_type",
"translation": "interface not of expected type"
},
{
"id": "app.team.create_onboarding_linked_board.error_no_board",
"translation": "error no board created"
},
{
"id": "app.team.create_onboarding_linked_board.error_patching_board",
"translation": "error while patching board"
},
{
"id": "app.team.create_onboarding_linked_board.error_getting_templates",
"translation": "error getting boards templates"
},
{
"id": "app.team.create_onboarding_linked_board.error_duplicating_board",
"translation": "error duplicating board"
},
{
"id": "api.system.logs.invalidFilter",
"translation": "Invalid log filter"
},
{
"id": "api.server.cws.delete_workspace.app_error",
"translation": "CWS Server failed to delete workspace."
}
]

Просмотреть файл

@@ -6085,7 +6085,7 @@
},
{
"id": "api.slackimport.slack_add_channels.added",
"translation": "\nکانال ها اضافه شدند:\n"
"translation": "\nکانالها اضافه شدند:\n"
},
{
"id": "api.slackimport.slack_add_bot_user.unable_import",
@@ -6755,7 +6755,7 @@
},
{
"id": "api.license.request-trial.can-start-trial.not-allowed",
"translation": "این کلید مجوز آزمایشی برای Mattermost Enterprise Edition منقضی شده است و دیگر معتبر نیست. اگر می‌خواهید دوره آزمایشی خود را تمدید کنید، لطفاً [با تیم فروش ما تماس بگیرید] (https://mattermost.com/contact-us/)."
"translation": "نمی‌توان مجوز دوره آزمایشی جدیدی اعمال کرد. شما از قبل یک مجوز دوره آزمایشی در این مترموست اعمال کرده‌اید. اگر می‌خواهید دوره آزمایشی خود را تمدید کنید، لطفاً [با بخش فروش ما تماس بگیرید] (https://mattermost.com/contact-us/)."
},
{
"id": "api.license.request-trial.can-start-trial.error",
@@ -7239,7 +7239,7 @@
},
{
"id": "api.emoji.create.too_large.app_error",
"translation": "شکلک ایجاد نمی شود. اندازه تصویر باید کمتر از 1 مگابایت باشد."
"translation": "نمی‌توان شکلک را ایجاد کرد. اندازه تصویر باید کمتر از 512 کیلوبایت باشد."
},
{
"id": "api.emoji.create.parse.app_error",
@@ -7862,7 +7862,7 @@
},
{
"id": "api.command_invite.private_channel.app_error",
"translation": "کانال {{.Channel}} پیدا نشد. لطفاً از هندل کانال برای شناسایی کانال ها استفاده کنید."
"translation": "کانال {{.Channel}} پیدا نشد. لطفاً از [شناساگر کانال](https://docs.mattermost.com/messaging/managing-channels.html#naming-a-channel) برای شناسایی کانالها استفاده کنید."
},
{
"id": "api.command_invite.permission.app_error",
@@ -7874,15 +7874,15 @@
},
{
"id": "api.command_invite.missing_user.app_error",
"translation": "کاربر را پیدا نکردیم. ممکن است توسط مدیر سیستم غیرفعال شده باشد."
"translation": "کاربر {{.User}} را پیدا نکردیم. ممکن است توسط مدیر سامانه غیرفعال شده باشد."
},
{
"id": "api.command_invite.missing_message.app_error",
"translation": "نام کاربری و کانال از دست رفته است."
"translation": "نام کاربری و یا کانال فراموش شده است."
},
{
"id": "api.command_invite.hint",
"translation": "@[username] ~[channel]"
"translation": "@[username]... ~[channel]..."
},
{
"id": "api.command_invite.group_constrained_user_denied",
@@ -7986,7 +7986,7 @@
},
{
"id": "api.command_help.desc",
"translation": "صفحه راهنمای Mattermost را باز کنید"
"translation": "نمایش متن راهنمای مترموست"
},
{
"id": "api.command_groupmsg.permission.app_error",

Просмотреть файл

@@ -9246,5 +9246,21 @@
{
"id": "model.config.is_valid.amazons3_timeout.app_error",
"translation": "Valeur de délai d'attente non valide {{.Value}}. Doit être un nombre positif."
},
{
"id": "api.admin.syncables_error",
"translation": "échec de l'ajout de l'utilisateur dans group-teams et group-channels"
},
{
"id": "api.acknowledgement.save.archived_channel.app_error",
"translation": "Vous ne pouvez pas acquitter dans un canal archivé."
},
{
"id": "api.acknowledgement.delete.deadline.app_error",
"translation": "Vous ne pouvez pas supprimer un acquittement après 5 minutes."
},
{
"id": "api.acknowledgement.delete.archived_channel.app_error",
"translation": "Vous ne pouvez par retirer un acquittement dans un canal archivé."
}
]

Просмотреть файл

@@ -4737,7 +4737,7 @@
},
{
"id": "web.error.unsupported_browser.min_os_version.windows",
"translation": "Windows 8.1+"
"translation": "Windows 10+"
},
{
"id": "web.error.unsupported_browser.min_os_version.mac",
@@ -4745,19 +4745,19 @@
},
{
"id": "web.error.unsupported_browser.min_browser_version.safari",
"translation": "Version 14.1+"
"translation": "Version 16.2+"
},
{
"id": "web.error.unsupported_browser.min_browser_version.firefox",
"translation": "Version 91+"
"translation": "Version 102+"
},
{
"id": "web.error.unsupported_browser.min_browser_version.edge",
"translation": "Version 95+"
"translation": "Version 110+"
},
{
"id": "web.error.unsupported_browser.min_browser_version.chrome",
"translation": "Version 106+"
"translation": "Version 110+"
},
{
"id": "web.error.unsupported_browser.learn_more",
@@ -9946,5 +9946,57 @@
{
"id": "api.command_templates.name",
"translation": "templates"
},
{
"id": "api.server.cws.delete_workspace.app_error",
"translation": "CWS サーバーはワークスペースの削除に失敗しました。"
},
{
"id": "api.command_templates.desc",
"translation": "テンプレートウィンドウから作成を開く"
},
{
"id": "app.worktemplates.execute_work_template.name_too_long",
"translation": "名称欄には64文字以上入力できません。"
},
{
"id": "app.team.create_onboarding_linked_board.product_key_not_found",
"translation": "プロダクトキーが見つかりませんでした"
},
{
"id": "app.team.create_onboarding_linked_board.itf_not_of_type",
"translation": "インターフェースが期待された型ではありませんでした"
},
{
"id": "app.team.create_onboarding_linked_board.error_patching_board",
"translation": "Boardへのパッチ適用エラー"
},
{
"id": "app.team.create_onboarding_linked_board.error_no_board",
"translation": "Board作成エラー"
},
{
"id": "app.team.create_onboarding_linked_board.error_getting_templates",
"translation": "Boardsテンプレート取得エラー"
},
{
"id": "app.team.create_onboarding_linked_board.error_duplicating_board",
"translation": "重複したBoardによるエラー"
},
{
"id": "app.import.validate_user_teams_import_data.invalid_auth_service.error",
"translation": "不正な認証サービス: {{.AuthService}}"
},
{
"id": "api.system.logs.invalidFilter",
"translation": "不正なログフィルターです"
},
{
"id": "api.server.cws.needs_enterprise_edition",
"translation": "Mattermost Enterprise Editionでのみ利用可能なサービスです"
},
{
"id": "api.command_templates.unsupported.app_error",
"translation": "あなたのデバイスではテンプレートコマンドはサポートされていません。"
}
]

Просмотреть файл

@@ -4765,7 +4765,7 @@
},
{
"id": "web.error.unsupported_browser.min_os_version.windows",
"translation": "Windows 8.1+"
"translation": "Windows 10+"
},
{
"id": "web.error.unsupported_browser.min_os_version.mac",
@@ -4773,19 +4773,19 @@
},
{
"id": "web.error.unsupported_browser.min_browser_version.safari",
"translation": "Versie 14.1+"
"translation": "Versie 16.2+"
},
{
"id": "web.error.unsupported_browser.min_browser_version.firefox",
"translation": "Versie 91+"
"translation": "Versie 102+"
},
{
"id": "web.error.unsupported_browser.min_browser_version.edge",
"translation": "Versie 95+"
"translation": "Versie 110+"
},
{
"id": "web.error.unsupported_browser.min_browser_version.chrome",
"translation": "Versie 106+"
"translation": "Versie 110+"
},
{
"id": "web.error.unsupported_browser.learn_more",
@@ -9997,5 +9997,13 @@
{
"id": "app.team.create_onboarding_linked_board.error_duplicating_board",
"translation": "fout bij het dupliceren van het bord"
},
{
"id": "api.system.logs.invalidFilter",
"translation": "Ongeldig logboekfilter"
},
{
"id": "api.server.cws.delete_workspace.app_error",
"translation": "CWS-server kon de werkruimte niet verwijderen."
}
]

Просмотреть файл

@@ -4745,7 +4745,7 @@
},
{
"id": "web.error.unsupported_browser.min_os_version.windows",
"translation": "Windows 8.1+"
"translation": "Windows 10+"
},
{
"id": "web.error.unsupported_browser.min_os_version.mac",
@@ -4753,19 +4753,19 @@
},
{
"id": "web.error.unsupported_browser.min_browser_version.safari",
"translation": "Wersja 14.1+"
"translation": "Wersja 16.2+"
},
{
"id": "web.error.unsupported_browser.min_browser_version.firefox",
"translation": "Wersja 91+"
"translation": "Wersja 102+"
},
{
"id": "web.error.unsupported_browser.min_browser_version.edge",
"translation": "Wersja 95+"
"translation": "Wersja 110+"
},
{
"id": "web.error.unsupported_browser.min_browser_version.chrome",
"translation": "Wersja 106+"
"translation": "Wersja 110+"
},
{
"id": "web.error.unsupported_browser.learn_more",
@@ -9998,5 +9998,13 @@
{
"id": "app.team.create_onboarding_linked_board.error_duplicating_board",
"translation": "błąd duplikowania tablicy"
},
{
"id": "api.system.logs.invalidFilter",
"translation": "Nieprawidłowy filtr dziennika"
},
{
"id": "api.server.cws.delete_workspace.app_error",
"translation": "CWS Server nie potrafił usunąć przestrzeni roboczej."
}
]

Просмотреть файл

@@ -61,7 +61,7 @@
},
{
"id": "web.error.unsupported_browser.min_os_version.windows",
"translation": "Windows 8.1+"
"translation": "Windows 10+"
},
{
"id": "web.error.unsupported_browser.min_os_version.mac",
@@ -69,19 +69,19 @@
},
{
"id": "web.error.unsupported_browser.min_browser_version.safari",
"translation": "Version 14.1+"
"translation": "Version 16.2+"
},
{
"id": "web.error.unsupported_browser.min_browser_version.firefox",
"translation": "Version 91+"
"translation": "Version 102+"
},
{
"id": "web.error.unsupported_browser.min_browser_version.edge",
"translation": "Version 95+"
"translation": "Version 110+"
},
{
"id": "web.error.unsupported_browser.min_browser_version.chrome",
"translation": "Version 106+"
"translation": "Version 110+"
},
{
"id": "web.error.unsupported_browser.learn_more",
@@ -9997,5 +9997,13 @@
{
"id": "api.command_templates.desc",
"translation": "Öppna fönstret Skapa från mall"
},
{
"id": "api.system.logs.invalidFilter",
"translation": "Felaktigt logg-filter"
},
{
"id": "api.server.cws.delete_workspace.app_error",
"translation": "CWS-servern kunde inte radera arbetsytan."
}
]

Просмотреть файл

@@ -5377,7 +5377,7 @@
},
{
"id": "model.channel.is_valid.name.app_error",
"translation": "无效的频道名。用户 id 不能作为私信以外的频道名。"
"translation": "频道名称不能为 16 进制格式。请输入其他的频道名。"
},
{
"id": "model.config.is_valid.bleve_search.enable_autocomplete.app_error",
@@ -5813,27 +5813,27 @@
},
{
"id": "web.error.unsupported_browser.min_os_version.windows",
"translation": "Windows 8.1+"
"translation": "Windows 10+"
},
{
"id": "web.error.unsupported_browser.min_os_version.mac",
"translation": "macOS 10.14+"
"translation": "macOS 11+"
},
{
"id": "web.error.unsupported_browser.min_browser_version.safari",
"translation": "版本 14.1+"
"translation": "版本 16.2+"
},
{
"id": "web.error.unsupported_browser.min_browser_version.firefox",
"translation": "版本 91+"
"translation": "版本 102+"
},
{
"id": "web.error.unsupported_browser.min_browser_version.edge",
"translation": "版本 95+"
"translation": "版本 110+"
},
{
"id": "web.error.unsupported_browser.min_browser_version.chrome",
"translation": "版本 106+"
"translation": "版本 110+"
},
{
"id": "web.error.unsupported_browser.learn_more",
@@ -9498,5 +9498,365 @@
{
"id": "api.command_templates.desc",
"translation": "打开从模板创建窗口"
},
{
"id": "api.templates.delinquency_30.subtitle1",
"translation": "您还有时间保持您的 Mattermost {{.Plan}} 可用,但是在那之前您需要解决一些与支付有关的问题。"
},
{
"id": "worktemplate.category.product_teams",
"translation": "产品团队"
},
{
"id": "worktemplate.category.leadership",
"translation": "领导"
},
{
"id": "worktemplate.category.devops",
"translation": "Dev Ops"
},
{
"id": "worktemplate.category.companywide",
"translation": "全公司"
},
{
"id": "model.insights.get_start_of_day_for_time_range.time_range.app_error",
"translation": "不正确的时间范围。"
},
{
"id": "model.group.name.reserved_name.app_error",
"translation": "群组名称已作为保留名称存在"
},
{
"id": "model.draft.is_valid.user_id.app_error",
"translation": "不正确的 user id。"
},
{
"id": "model.draft.is_valid.update_at.app_error",
"translation": "更新与必须是一个合法的时间。"
},
{
"id": "model.draft.is_valid.root_id.app_error",
"translation": "不正确的 root id。"
},
{
"id": "model.draft.is_valid.props.app_error",
"translation": "不正确的 props。"
},
{
"id": "model.draft.is_valid.priority.app_error",
"translation": "不正确的优先级"
},
{
"id": "model.draft.is_valid.msg.app_error",
"translation": "不正确的消息。"
},
{
"id": "model.draft.is_valid.file_ids.app_error",
"translation": "不正确的 file id。"
},
{
"id": "model.draft.is_valid.create_at.app_error",
"translation": "创建于必须是一个合法的时间。"
},
{
"id": "model.draft.is_valid.channel_id.app_error",
"translation": "不正确的 channel id。"
},
{
"id": "model.acknowledgement.is_valid.user_id.app_error",
"translation": "不正确的 user id。"
},
{
"id": "model.acknowledgement.is_valid.post_id.app_error",
"translation": "不正确的 post id。"
},
{
"id": "ent.saml.configure.certificate_parse_error.app_error",
"translation": "SAML 无法成功读取认证公钥,请联系您的系统管理员。"
},
{
"id": "ent.elasticsearch.create_client.client_key_missing",
"translation": "无法打开 Elasticsearch 客户密钥文件"
},
{
"id": "ent.elasticsearch.create_client.client_cert_missing",
"translation": "无法打开 Elasticsearch 客户证书"
},
{
"id": "ent.elasticsearch.create_client.client_cert_malformed",
"translation": "解码 Elasticsearch 客户证书失败"
},
{
"id": "ent.elasticsearch.create_client.ca_cert_missing",
"translation": "无法打开 Elasticsearch CA 文件"
},
{
"id": "ent.elasticsearch.create_client.ca_cert_malformed",
"translation": "解码 Elasticsearch CA 失败"
},
{
"id": "app.worktemplates.get_templates.app_error",
"translation": "无法取得作业模板"
},
{
"id": "app.worktemplates.get_categories.app_error",
"translation": "无法取得作业模板目录"
},
{
"id": "app.worktemplates.execute_work_template.playbooks.find_channel_error",
"translation": "找不到与 Playbook 关联的频道。"
},
{
"id": "app.worktemplates.execute_work_template.playbooks.create_error",
"translation": "创建 Playbook 时发生错误。"
},
{
"id": "app.worktemplates.execute_work_template.name_too_long",
"translation": "名称栏目中无法输入超过 64 个字符的内容。"
},
{
"id": "app.worktemplates.execute_work_template.channels.create_error",
"translation": "在创建频道时发生错误。"
},
{
"id": "app.worktemplates.execute_work_template.boards.create_error",
"translation": "在创建 Board 时发生错误。"
},
{
"id": "app.worktemplates.execute_work_template.app_error",
"translation": "在执行作业模板时发生错误。"
},
{
"id": "app.worktemplate.execution_request.license_cannot_create_private_playbook",
"translation": "您的授权不支持私密 Playbook。"
},
{
"id": "app.worktemplate.execution_request.cannot_create_public_playbook",
"translation": "您没有创建公开 Playbook 的权限。"
},
{
"id": "app.worktemplate.execution_request.cannot_create_public_channel",
"translation": "您没有创建公开频道的权限。"
},
{
"id": "app.worktemplate.execution_request.cannot_create_public_board",
"translation": "您没有创建公开 Board 的权限。"
},
{
"id": "app.worktemplate.execution_request.cannot_create_private_playbook",
"translation": "您没有创建私密 Playbook 的权限。"
},
{
"id": "app.worktemplate.execution_request.cannot_create_private_channel",
"translation": "您没有创建私密频道的权限。"
},
{
"id": "app.worktemplate.execution_request.cannot_create_private_board",
"translation": "您没有创建私密 Board 的权限。"
},
{
"id": "app.user.get_badge_count.app_error",
"translation": "无法获取用户的奖章数目。"
},
{
"id": "app.team.create_onboarding_linked_board.product_key_not_found",
"translation": "未找到产品密钥"
},
{
"id": "app.team.create_onboarding_linked_board.itf_not_of_type",
"translation": "接口不是预期的类型"
},
{
"id": "app.team.create_onboarding_linked_board.error_patching_board",
"translation": "更新 Board 时发生错误"
},
{
"id": "app.team.create_onboarding_linked_board.error_no_board",
"translation": "在创建 Board 时发生错误"
},
{
"id": "app.team.create_onboarding_linked_board.error_getting_templates",
"translation": "在取得 Board 模板时发生错误"
},
{
"id": "app.team.create_onboarding_linked_board.error_duplicating_board",
"translation": "在复制 Board 时发生错误"
},
{
"id": "app.post_prority.get_for_post.app_error",
"translation": "无法取得消息的优先级"
},
{
"id": "app.plugin.product_mode.app_error",
"translation": "在生产模式中无法启用 {{.Name}} 插件。"
},
{
"id": "app.notify_admin.send_notification_post.app_error",
"translation": "无法发送通知消息。"
},
{
"id": "app.notify_admin.save.app_error",
"translation": "无法保存通知数据。"
},
{
"id": "app.last_accessible_file.app_error",
"translation": "在取得最后访问的文件时发生错误"
},
{
"id": "app.job.error",
"translation": "作业执行过程中发生错误。"
},
{
"id": "app.import.validate_user_teams_import_data.invalid_auth_service.error",
"translation": "无效的认证服务:{{.AuthService}}"
},
{
"id": "app.group.username_conflict",
"translation": "用户名“{{.Username}}”已存在。"
},
{
"id": "app.file.cloud.get.app_error",
"translation": "由于云订阅的限制,无法取得文件。"
},
{
"id": "app.draft.update.app_error",
"translation": "无法更新草稿。"
},
{
"id": "app.draft.save.app_error",
"translation": "无法保存草稿。"
},
{
"id": "app.draft.get_for_draft.app_error",
"translation": "无法取得草稿的文件。"
},
{
"id": "app.draft.get_drafts.app_error",
"translation": "无法取得用户的草稿。"
},
{
"id": "app.draft.get.app_error",
"translation": "无法取得草稿。"
},
{
"id": "app.draft.feature_disabled",
"translation": "草稿功能已被禁用。"
},
{
"id": "app.draft.delete.app_error",
"translation": "无法删除草稿。"
},
{
"id": "app.collection.add_topic.exists.app_error",
"translation": "Topic 类型已存在。"
},
{
"id": "app.collection.add_collection.exists.app_error",
"translation": "Collection 类型已存在。"
},
{
"id": "app.cloud.upgrade_plan_bot_message_single",
"translation": "来自工作区 {{.WorkspaceName}} 的 {{.UsersNum}} 位成员已申请工作区的升级: "
},
{
"id": "app.cloud.upgrade_plan_bot_message",
"translation": "来自工作区 {{.WorkspaceName}} 的 {{.UsersNum}} 位成员已要求工作区的升级: "
},
{
"id": "app.cloud.trial_plan_bot_message_single",
"translation": "来自工作区 {{.WorkspaceName}} 的 {{.UsersNum}} 位成员已申请 Enterprise 版的试用: "
},
{
"id": "app.cloud.trial_plan_bot_message",
"translation": "来自工作区 {{.WorkspaceName}} 的 {{.UsersNum}} 位成员已申请 Enterprise 版的试用: "
},
{
"id": "app.cloud.get_subscription_delinquency_date.app_error",
"translation": "订阅状态正常"
},
{
"id": "app.cloud.get_subscription.app_error",
"translation": "无法取得云订阅信息"
},
{
"id": "app.cloud.get_current_plan_name.app_error",
"translation": "无法获取当前 Plan 的名字"
},
{
"id": "app.cloud.get_cloud_products.app_error",
"translation": "无法取得云产品信息"
},
{
"id": "app.channel.get_priority_for_posts.app_error",
"translation": "无法取得消息的优先级"
},
{
"id": "app.acknowledgement.save.save.app_error",
"translation": "无法为消息保存已读确认。"
},
{
"id": "app.acknowledgement.getforpost.get.app_error",
"translation": "无法从消息中获得已读确认。"
},
{
"id": "app.channel.count_urgent_posts_since.app_error",
"translation": "指定日期之后的紧急消息无法计数。"
},
{
"id": "app.acknowledgement.get.app_error",
"translation": "无法获得已读确认。"
},
{
"id": "app.acknowledgement.delete.app_error",
"translation": "无法删除已读确认。"
},
{
"id": "api.work_templates.disabled",
"translation": "工作模板已被禁用。"
},
{
"id": "api.user.get_users.validation.app_error",
"translation": "在获取用户权限的过程中发生错误。"
},
{
"id": "api.user.add_user_to_group_syncables.not_ldap_user.app_error",
"translation": "不是 LADP 用户"
},
{
"id": "api.upload.create.upload_too_large.app_error",
"translation": "无法上传文件。文件尺寸过大。"
},
{
"id": "api.templates.delinquency_90.title",
"translation": "您的 Mattermost workspace 已经被降级"
},
{
"id": "api.templates.delinquency_90.subtitle3",
"translation": "要解除冻结您的数据并继续使用付费功能,请更新您的支付信息。"
},
{
"id": "api.templates.delinquency_90.subtitle1",
"translation": "您将无法在重要业务操作中继续使用 Cloud Professional 或者 Enterprise 的功能,同时您将经历性能降级的体验。"
},
{
"id": "api.system.logs.invalidFilter",
"translation": "无效的日志过滤器"
},
{
"id": "api.server.hosted_signup_unavailable.error",
"translation": "Portal 无法在自托管实例中使用。"
},
{
"id": "api.server.cws.needs_enterprise_edition",
"translation": "该服务仅在 Mattermost Enterprise 版本中可用"
},
{
"id": "api.server.cws.delete_workspace.app_error",
"translation": "CWS 服务器删除工作区时失败。"
},
{
"id": "api.command_templates.unsupported.app_error",
"translation": "您的设备不支持模板命令。"
}
]

Просмотреть файл

@@ -8677,6 +8677,30 @@ func (c *Client4) SelfHostedSignupConfirm(form *SelfHostedConfirmPaymentMethodRe
return BuildResponse(r), &response, nil
}
func (c *Client4) GetSelfHostedInvoices() (*Response, []*Invoice, error) {
r, err := c.DoAPIGet(c.hostedCustomerRoute()+"/invoices", "")
if err != nil {
return BuildResponse(r), nil, err
}
data, err := io.ReadAll(r.Body)
if err != nil {
return BuildResponse(r), nil, err
}
defer closeBody(r)
invoices := []*Invoice{}
err = json.Unmarshal(data, &invoices)
if err != nil {
return BuildResponse(r), nil, err
}
defer closeBody(r)
return BuildResponse(r), invoices, nil
}
func (c *Client4) GetPostInfo(postId string) (*PostInfo, *Response, error) {
r, err := c.DoAPIGet(c.postRoute(postId)+"/info", "")
if err != nil {

Просмотреть файл

@@ -75,7 +75,7 @@ func (p *HelpPlugin) OnConfigurationChange() error {
return errors.Wrapf(err, "failed to find team %s", configuration.TeamName)
}
channel, err := p.API.GetChannelByName(configuration.ChannelName, team.Id, false)
channel, err := p.API.GetChannelByName(team.Id, configuration.ChannelName, false)
if err != nil {
return errors.Wrapf(err, "failed to find channel %s", configuration.ChannelName)
}

Просмотреть файл

@@ -33,7 +33,7 @@ func (ls SqlLicenseStore) Save(license *model.LicenseRecord) (*model.LicenseReco
return nil, err
}
query := ls.getQueryBuilder().
Select("*").
Select("Id, CreateAt, Bytes").
From("Licenses").
Where(sq.Eq{"Id": license.Id})
queryString, args, err := query.ToSql()
@@ -64,7 +64,7 @@ func (ls SqlLicenseStore) Save(license *model.LicenseRecord) (*model.LicenseReco
// http.StatusNotFound in the StatusCode field.
func (ls SqlLicenseStore) Get(id string) (*model.LicenseRecord, error) {
query := ls.getQueryBuilder().
Select("*").
Select("Id, CreateAt, Bytes").
From("Licenses").
Where(sq.Eq{"Id": id})
@@ -82,7 +82,7 @@ func (ls SqlLicenseStore) Get(id string) (*model.LicenseRecord, error) {
func (ls SqlLicenseStore) GetAll() ([]*model.LicenseRecord, error) {
query := ls.getQueryBuilder().
Select("*").
Select("Id, CreateAt, Bytes").
From("Licenses")
queryString, _, err := query.ToSql()

Просмотреть файл

@@ -3170,10 +3170,14 @@ func (s *SqlPostStore) GetTopDMsForUserSince(userID string, since int64, offset
},
}).GroupBy("vch.id")
topDMsBuilder = topDMsBuilder.OrderBy("MessageCount DESC").Limit(uint64(limit + 1)).Offset(uint64(offset))
// following where clause filters out all archived DMs with "deleted" users, that has only 1 user-id in Participants column.
archivedDMsFilter := s.getQueryBuilder().Select("MessageCount", "Participants", "ChannelId").FromSelect(topDMsBuilder, "top_dms").
Where(sq.Expr("POSITION(',' IN Participants) > 0"))
archivedDMsFilter = archivedDMsFilter.OrderBy("MessageCount DESC").Limit(uint64(limit + 1)).Offset(uint64(offset))
topDMs := make([]*model.TopDM, 0)
sql, args, err := topDMsBuilder.ToSql()
sql, args, err := archivedDMsFilter.ToSql()
if err != nil {
return nil, errors.Wrap(err, "GetTopDMsForUserSince_ToSql")
}

Просмотреть файл

@@ -4901,7 +4901,7 @@ func testGetTopDMsForUserSince(t *testing.T, ss store.Store, s SqlStore) {
require.NoError(t, err)
}
// for u4-u3: 4 posts
_, err = ss.Post().Save(&model.Post{
u3u4Post1, err := ss.Post().Save(&model.Post{
ChannelId: chUser3User4.Id,
UserId: u3.Id,
})
@@ -4911,7 +4911,7 @@ func testGetTopDMsForUserSince(t *testing.T, ss store.Store, s SqlStore) {
UserId: u4.Id,
})
require.NoError(t, err)
_, err = ss.Post().Save(&model.Post{
u3u4Post2, err := ss.Post().Save(&model.Post{
ChannelId: chUser3User4.Id,
UserId: u3.Id,
})
@@ -4965,6 +4965,28 @@ func testGetTopDMsForUserSince(t *testing.T, ss store.Store, s SqlStore) {
// len of topDMs.Items should be 3
require.Len(t, topDMs.Items, 2)
})
t.Run("topDMs will not consider deleted second user", func(t *testing.T) {
// u4 only takes part in one conversation
topDMs, err := ss.Post().GetTopDMsForUserSince(u4.Id, 100, 0, 100)
require.NoError(t, err)
// len of topDMs.Items should be 1
require.Len(t, topDMs.Items, 1)
// delete user3
err = ss.User().PermanentDelete(u3.Id)
require.NoError(t, err)
// delete user3 posts
err = ss.Post().Delete(u3u4Post1.Id, 200, u3.Id)
require.NoError(t, err)
err = ss.Post().Delete(u3u4Post2.Id, 200, u3.Id)
require.NoError(t, err)
// delete channel memberships
err = ss.Channel().PermanentDeleteMembersByUser(u3.Id)
require.NoError(t, err)
topDMs, err = ss.Post().GetTopDMsForUserSince(u4.Id, 100, 0, 100)
require.NoError(t, err)
// len of topDMs.Items should be 0 since u3 is deleted
require.Len(t, topDMs.Items, 0)
})
}
func testGetEditHistoryForPost(t *testing.T, ss store.Store) {