* update more_channels for ui and show all channels
* update searchable channel list
* fix style
* fix tests
* fix style for delete icon
* fix failing tests
* fix style
* remove dot
* remove header button
* put back header button
* Fix duplicate keys in CombinedSystemMessage component (#23507)
* MM-52873 : Switch to npm's 'reselect' for Playbooks (#23396)
* Enable golangci-lint (attempt 2) (#23517)
This time we are just using the Makefile command
to see if that makes a difference
```release-note
NONE
```
* MM-52888 Always load users mentioned in message attachments (#23460)
Co-authored-by: Mattermost Build <build@mattermost.com>
* Prepare: run E2E smoketests with GitHub actions (#23301)
- Port E2E testing scripts from cypress-ui-automation
- Move server to docker-compose, move E2E images to ecrpublic
* Integrate General channel renaming, fixes
- Add local automation-dashboard
- Add readme
- Add E2E smoketests
- Bump postgres to 12
---------
Co-authored-by: Mattermost Build <build@mattermost.com>
Co-authored-by: Saturnino Abril <saturnino.abril@gmail.com>
Co-authored-by: Antonis Stamatiou <stamatiou.antonis@gmail.com>
* MM-47064/MM-34345/MM-47072 Remove inheritance from Suggestion components and migrate to TS (#23455)
* MM-47064 Remove inheritance from Suggestion components
* Address feedback
* Fix users without DM channels not appearing in the channel switcher
---------
Co-authored-by: Mattermost Build <build@mattermost.com>
* MM-52544 Fix missing reply bar mention highlight (#23534)
* MM-52513: fixes deleting a reply (#23177)
* MM-52513: fixes deleting a reply
Currently when we receive a WS event for a reply being deleted we might
accidentally push it to a wrong team's store. This might happen if the
thread is already loaded in store and we are viewing another team.
In that case we were fetching the thread from the API using the team id
of the current team. The API returns the thread, even though the team id
is not the one which the thread belongs to.
This commit is fixing the above issue by getting the team id in which
the thread belongs to, or current team id in the case of DM/GM messages,
and using that to fetch the thread from the API.
PS: the fetching is needed since we don't send a thread_update WS event
upon deleting a reply, and we need to get the new participants list.
* Fixes team id on another occasion
* Refactors a bit
* Reverts returning empty string as team id
* Refactor a bit to pass the post as argument
---------
Co-authored-by: Kyriakos Ziakoulis <koox00@Kyriakoss-MacBook-Pro.local>
Co-authored-by: Kyriakos Ziakoulis <koox00@192.168.2.3>
Co-authored-by: Harrison Healey <harrisonmhealey@gmail.com>
* Avoid calling the user count query in future if we get a count > 0 (#23545)
* Avoid calling the user count query in future if we get a count > 0
* re-adding mock session to avoid adding the old mitigation in future
* adjustments based on feedback
* MM-52365 - fix JS error banner (#23501)
* MM-52365 - fix js error banner
* add null type to bindings as an optional type
* Make used of typed atomic.Pointer (#23550)
* Make save_post_spec less affected by other E2E tests (#23541)
* Revert "Prepare: run E2E smoketests with GitHub actions (#23301)" (#23553)
This reverts commit 68be3a6bcd.
* adding debug log when executing query (#23559)
* server/docker-compose.yml: updates to run HA in local after monorepo (#23552)
* [MM-52919] Remove all uses of window.desktop.version from webapp (#23558)
Co-authored-by: Mattermost Build <build@mattermost.com>
* [MM-21096] webapp: Migrate "components/suggestion/search_channel_with_permissions_provider.jsx" to Typescript (#23323)
* migrate to ts
* linting
* fix test
* refactor
* Remove accidental comments from merge
---------
Co-authored-by: Mattermost Build <build@mattermost.com>
Co-authored-by: Harrison Healey <harrisonmhealey@gmail.com>
* fix server ci after renaming the project (#23576)
* Temporarily let AdvancedLoggingConfig take precedence over AdvancedLoggingJSON (#23578)
* Temporarily let AdvancedLoggingConfig take precedence over AdvancedLoggingJSON
* Repo name ci fixes (#23569)
* mattermost-server -> mattermost
* mattermost-server -> mattermost
* Empty-Commit
* Empty-Commit
* Empty-Commit
---------
Co-authored-by: Antonis Stamatiou <stamatiou.antonis@gmail.com>
Co-authored-by: Mattermost Build <build@mattermost.com>
Co-authored-by: Akis Maziotis <akis.maziotis@mattermost.com>
* MM-51585 : Fix duplicated date separator in center channel when Pinned posts RHS is open (#23068)
* Fix references from 'packages/*' to 'platform/*' in READMEs (#23498)
* [MM-52541] Mark files as deleted along with thread (#23226)
* mark thread files as deleted
* add missing check
* improve query
* Stopped rendering post preview if post is deleted
* Fixed lint error
* Fixed test
* updated types
* Removed deleted post from other post's embed data
* Added tests
* Apply suggestions from code review
Co-authored-by: Daniel Espino García <larkox@gmail.com>
* lint fix
---------
Co-authored-by: Konstantinos Pittas <konstantinos.pittas@mattermost.com>
Co-authored-by: Harshil Sharma <harshilsharma63@gmail.com>
Co-authored-by: Mattermost Build <build@mattermost.com>
Co-authored-by: Harshil Sharma <18575143+harshilsharma63@users.noreply.github.com>
Co-authored-by: Daniel Espino García <larkox@gmail.com>
* MM-52476 Fix guest users access to playbooks. (#23279)
* Fix guest users access to playbooks.
* Fix guest access.
* Add guests list restriction.
* Update PULL_REQUEST_TEMPLATE.md to include Jira ticket for contributors (#23589)
* [MM-52836] : Migrate "components/admin_console/admin_definition_constants.jsx" to TypeScript (#23566)
* MM-52297 Fix reactions disappearing with search open and add testing utilities (#23510)
* MM-52297 Fix reactions disappearing when search is open
* Add unit tests and extra utilities
* Fix typing issue
* MM-53002: Fix ESR CI (#23599)
* Do not use the mattermost path
The /mattermost path is used by the image and it seems to conflict with
the container running the binary
* Use a regular machine in the esr-upgrade-diff job
* Add missing space
* [MM-52955] Fix panic for not found posts (#23561)
* [MM-52973] Avoid thundering herd problem in IsFirstUserAccount (#23549)
* [MM-45802] Clear CRT notification on deleted reply (#23568)
* reduce the counter on post deletion
* add test
* change translations
* fix collecting mentions for DMs
* add translation texts
* extract logic for getting mentions
* send WS event
* add e2e tests
* tidy mod
* WIP
* Deleting notification async
* Fixed a unit test
* Added more tests
* Updated i18n
* CI
* mattermost-server -> mattermost
* mattermost-server -> mattermost
---------
Co-authored-by: Konstantinos Pittas <konstantinos.pittas@mattermost.com>
Co-authored-by: Mattermost Build <build@mattermost.com>
* Includes mmctl into the mono-repo (#23091)
* Includes mmctl into the mono-repo
* Update to use the new public module paths
* Adds docs check to the mmctl CI
* Fix public utils import path
* Tidy up modules
* Fix linter
* Update CI tasks to use the new file structure
* Update CI references
* [MM-30432]: Allow users to specify different desktop notification sounds per channel (#21671)
* [MM-44165]: When Help link is left blank Help Resources option should not be visible in the help menu (#23609)
* Clean up at .github due to repo rename (#23580)
* update .github after repo rename
* update
* Update PULL_REQUEST_TEMPLATE.md
---------
Co-authored-by: M-ZubairAhmed <m-zubairahmed@protonmail.com>
Co-authored-by: Mattermost Build <build@mattermost.com>
* MM-52819 : "medical_symbol", "male_sign" and "female_sign" emojis are broken (#23538)
* [MM-52979]: Remove code around abandoned MUI modal migration (#23556)
* Re-export all React Testing Library functions (#23522)
* Fix panic if JSON null value is passed as channel update (#23629)
* MM-52818 - create config setting to enable/disable playbooks product (#23508)
* create config setting to enable/disable playbooks product
* fix to config name
* fix typo
* revert changes to package-lock.json
* update name of test
---------
Co-authored-by: Mattermost Build <build@mattermost.com>
* [MM-52926] Deprecating work templates (#23466)
Co-authored-by: Mattermost Build <build@mattermost.com>
* [MM-52839]: Migrate "components/admin_console/remove_file_setting.jsx" to Typescript (#23565)
* [MM-52833]: Migrate "components/admin_console/multiselect_settings.jsx" to Typescript (#23542)
* [MM-52835]: Migrate "components/admin_console/settings_group.jsx" and tests to Typescript (#23563)
* fix typo in index name for idx_teammembers_create_at (#23632)
* [MM-49989] Pass a context.Context to Client4 methods (#22922)
* Migrate all method in model/client4.go to accept a context.Context
* Fix th.*Client
* Fix remaining issues
* Empty commit to triger CI
* Fix test
* Add cancellation test
* Test that returned error is context.Canceled
* Fix bad merge
* Update mmctl code
---------
Co-authored-by: Mattermost Build <build@mattermost.com>
* Service environment (#23443)
* fix fileutils.TestFindFile on MacOS
* introduce model.ExternalServiceEnvironment
* pick license public key from external service env
* pick Stripe public key from external service env
* pick Rudder key from external service env
* configure Sentry DSN from external service env
* always log external_service_environment, Unsetenv
* clear faked BuildEnv, improve logging
* strip out unset GOTAGS
* fix Sentry tests
* simplify to just ServiceEnvironment
* relocate ServiceEnvironment in client config
* initialize CWS URLs based on service environment
* unset rudder key for boards dev
* harden service environment to avoid accidental production
* fix TestSentry again
* fix DEFAULT -> ENTERPRISE
* s/dev/test when naming playbooks rudder key
* simplify boards rudder key switch
* use uniform rudderKey variable names
* retain compatibility with existing pipeline
* reduce to just production/test
* unit test with valid test license
* simplify Playbooks telemetry initialization
* restore dev service environment
* emit ServiceEnvironment when running e2e tests
* [MM 22957] webapp a11y: fix sso btns focus issue (#23326)
* make suggested changes
* added form tag and removed event handler
* fix snapshot
---------
Co-authored-by: Mattermost Build <build@mattermost.com>
* Upgrade docker CI image to 23.0.1 (#23664)
Automatic Merge
* MM-52995: Fix opening DM/GM thread from thread footer (#23579)
* MM-52487: fix more playbooks tests (#23475)
* fix playbooks/channels/rhs/template_spec.js
* fix playbooks/channels/update_request_post_spec.js
* fix playbooks/runs/rdp_rhs_runinfo_spec.js
* fix playbooks/runs/rdp_rhs_statusupdates_spec.js
* remove enableexperimentalfeatures flag in e2e tests
* rdp_main_header_spec: simplify channel loaded assertion
* playbooks rhs participants: fix infinite fetch loop
* improved onboarding skipping
* simplify participants fetching
* Support json.RawMessage in configuration env overrides (#23610)
* support json.RawMessage in env overrides
* update more_channels for ui and show all channels
* remove header button
* put back header button
* [MM-52979]: Remove code around abandoned MUI modal migration (#23556)
* fix import
* update snapshot
* Update e2e-tests/cypress/tests/integration/channels/enterprise/accessibility/accessibility_modals_dialogs_spec.js
* fix e2e tests
---------
Co-authored-by: Mattermost Build <build@mattermost.com>
Co-authored-by: Harrison Healey <harrisonmhealey@gmail.com>
Co-authored-by: M-ZubairAhmed <m-zubairahmed@protonmail.com>
Co-authored-by: Agniva De Sarker <agnivade@yahoo.co.in>
Co-authored-by: mvitale1989 <mvitale1989@hotmail.com>
Co-authored-by: Saturnino Abril <saturnino.abril@gmail.com>
Co-authored-by: Antonis Stamatiou <stamatiou.antonis@gmail.com>
Co-authored-by: Kyriakos Z <3829551+koox00@users.noreply.github.com>
Co-authored-by: Kyriakos Ziakoulis <koox00@Kyriakoss-MacBook-Pro.local>
Co-authored-by: Kyriakos Ziakoulis <koox00@192.168.2.3>
Co-authored-by: Ben Cooke <benkcooke@gmail.com>
Co-authored-by: Pablo Andrés Vélez Vidal <pablovv2012@gmail.com>
Co-authored-by: Ben Schumacher <ben.schumacher@mattermost.com>
Co-authored-by: Ibrahim Serdar Acikgoz <serdaracikgoz86@gmail.com>
Co-authored-by: Devin Binnie <52460000+devinbinnie@users.noreply.github.com>
Co-authored-by: Sai Deepesh <saideepesh000@gmail.com>
Co-authored-by: Doug Lauder <wiggin77@warpmail.net>
Co-authored-by: Harshil Sharma <18575143+harshilsharma63@users.noreply.github.com>
Co-authored-by: Akis Maziotis <akis.maziotis@mattermost.com>
Co-authored-by: Hideaki Matsunami <mahaker@users.noreply.github.com>
Co-authored-by: Konstantinos Pittas <konstantinos.pittas+github@gmail.com>
Co-authored-by: Konstantinos Pittas <konstantinos.pittas@mattermost.com>
Co-authored-by: Harshil Sharma <harshilsharma63@gmail.com>
Co-authored-by: Daniel Espino García <larkox@gmail.com>
Co-authored-by: Christopher Speller <crspeller@gmail.com>
Co-authored-by: Tejas Karelia <tejas.karelia17@gmail.com>
Co-authored-by: Alejandro García Montoro <alejandro.garciamontoro@gmail.com>
Co-authored-by: Miguel de la Cruz <miguel@mcrx.me>
Co-authored-by: KyeongSoo Kim <gaganso71@korea.ac.kr>
Co-authored-by: Matheus <20505926+MattSilvaa@users.noreply.github.com>
Co-authored-by: Scott Bishel <scott.bishel@mattermost.com>
Co-authored-by: Julien Tant <785518+JulienTant@users.noreply.github.com>
Co-authored-by: Karan Mishra <karan.m2704@gmail.com>
Co-authored-by: Judy Hanson <106325339+Esterjudith@users.noreply.github.com>
Co-authored-by: Jesse Hallam <jesse.hallam@gmail.com>
Co-authored-by: Caleb Roseland <caleb@calebroseland.com>
This folder contains a number of packages intended to be built and shipped separately on NPM as well as a few legacy packages for internal use only (reselect and mattermost-redux). The following documentation only applies to the newer packages and not to the legacy ones.
Importing a subpackage
Subpackages should be imported using their full name, both inside the web app and when installing them using npm. They should not be imported using a relative path, and the src folder shouldn't be necessary to include.
// Correct
import {Client4} from '@mattermost/client';
import {UserProfile} from '@mattermost/types/users';
// Incorrect
import Client4 from 'packages/client/src/client4.ts';
import {UserProfile} from '../../types/src/users';
Some tools have difficulty doing this on their own, but they often support import path aliases so that we can keep them consistent acrosss the code base. More details on how to do this will be provided in packages where this is necessary such as types.
Importing one subpackage into another
When building packages that depend on each other, be careful to:
- Avoid import loops. While JavaScript lets us get away with these in most cases within a project, we cannot have two packages that depend directly with each other.
- Not compile one subpackage into another. We don't want the published libraries to include code from one subpackage into another. They should be set up so that they're peer dependencies in the
package.json, and if a project wants to use multiple packages, they can install them each separately.
As above, some tooling may need additional configuration to have one subpackage use code from another. For example, in packages compiled with the TypeScript compiler (tsc), you'll need to have the tsconfig.json from the dependent pacakge reference its dependency using the references field.
Versioning subpackages
At this time, we'll have the version of each package match the version of the web app. Versions can be incremented for each affected package by using npm version, and then npm install should be run to propagate those changes into the shared package-lock.json.
# Set a version of a single package
npm version 6.7.8 --workspace=packages/apple
# Increment the version of each package to the next minor version
npm version minor --workspaces
## Increment the version of a package to a pre-release version of the next minor version
npm version preminor --workspace=packages/apple
When a subpackage imports another, it should be set to depend on the * version of the other subpackage.
Adding a new subpackage
To set up a new package:
- Add a
package.jsonandREADME.mdfor that package. - Ensure all source files are located in
srcand all compiled files are built tolib. - Add an entry to the
workspacessection of the rootpackage.jsonso that NPM is aware of your package. - Set up import aliases so that the package is visible from the web app to the following tools:
-
TypeScript - In the root
tsconfig.json, add an entry to thecompilerOptions.pathssection pointing to thesrcfolder and an entry to thereferencessection pointing to the root of your package which should contain its owntsconfig.json.Note that the
compilerOptions.pathsentry will differ based on if your package exports just a single module (ie a singleindex.jsfile) or if it exports multiple submodules.{ "compilerOptions": { "paths": { "@mattermost/apple": ["packages/apple/lib"], // import * as Apple from '@mattermost/apple'; "@mattermost/banana/*": ["packages/banana/lib/*"], // import Yellow from '@mattermost/banana/yellow'; } }, "references": [ {"path": "./packages/apple"}, {"path": "./packages/banana"}, ] } -
Jest - Add an entry to the
jest.moduleNameMappersection of the rootjest.config.jsfor your package. Since that setting supports regexes, you can add these to the existing patterns used by theclientandtypespackages.Similar to TypeScript, this will differ based on if the package exports a single module or multiple modules.
{ "jest": { "moduleNameMapper": { "^@mattermost/(apple|client)$": "<rootDir>/packages/$1/src", "^@mattermost/(banana|types)/(.*)$": "<rootDir>/packages/$1/src/$2", } } }
-
- Add the compiled code to the CircleCI dependency cache. This is done by modifying the
pathsused by thesave_cachestep in.circleci/config.ymlaliases: - &save_cache save_cache: paths: - ~/mattermost/mattermost-webapp/packages/apple/lib - ~/mattermost/mattermost-webapp/packages/banana/lib
Publishing a subpackage
The following is the rough process for releasing these packages. They'll require someone with write access on our NPM organization to run them, and they'll likely change over time as we improve this process.
For full releases accompanying new versions of Mattermost:
-
Clean the repo.
make clean -
Update the version of the desired packages to match the server/web app as described above.
-
Download an up to date copy of the dependencies and update package-lock.json.
make node_modules -
Check in the changes to the package-lock.json.
-
Build the desired packages.
npm run build --workspace=packages/apple --workspace=packages/banana -
Test everything in the web app. This will be needed until the packages get their own standalone tests.
make check-style check-types test -
Assuming those pass, you can now publish those packages to npm. You can also do a dry run first or use
npm packto see exactly which files will be pushed.# Run a dry run which will list all the files to be included in the published package. npm publish --dry-run --workspace=packages/apple # Generate the tar file that will be uploaded to NPM for inspection. npm pack --workspace=packages/apple # Actually publish these packages. You can also use --workspaces to publish everything. npm publish --access=public --workspace=packages/apple --workspace=packages/bananaThe packages have now been published! There's still a few remaining cleanup tasks to do though.
-
Tag the commit for each package that has been updated. The tag name should be of the form
@mattermost/package-name@x.y.z. -
Push that commit and the corresponding tags up to GitHub
git push release-x.y git push origin @mattermost/apple@x.y.z @mattermost/banana@x.y.z
Publishing a pre-release version
Similarly, you can publish a pre-release version of the package. This can be done either to use changes from master while developing another product/plugin or to generate a release candidate.
This process is the same as above, except the version will have a suffix like -1, -2, etc. As explained above, this can be automatically done by using npm version preminor for minor releases, npm version premajor for major releases, and npm version prerelease for patch releases. These versions won't be automatically installed when people add them using npm add without a version, but they can be installed by specifying the version number manually.
Caveats
-
Currently, all packages are treated by CI as if they're part of the web app. This means that, for example, their style checking and tests are ran as part of the web app. In turn, that means that regardless of what tooling we use to build each package, they'll be compiled into the web app using webpack directly from source, and that it's possible for them to behave slightly differently in development compared to after release.
Eventually, we hope to get these building in parallel (so instead of having webpack watch the whole repo for changes during development, we'll have multiple watchers for the web app and each package) which should solve this issue, but that requires much larger changes that we're not ready to do yet.
-
For packages that export multiple submodules (such as
types), we've chosen to expose these using Node's subpath exports feature. Some tools like Webpack support this natively, but others like TypeScript and Jest don't support it yet. We've provided steps on how to support this in theREADME.mdfor thetypespackage, but this may vary depending on the project's setup.