119 Коммитов

Автор SHA1 Сообщение Дата
Agniva De Sarker
0bdae41603 MM-61215: Clarify to use --bypass-upload flag (#29761)
https://mattermost.atlassian.net/browse/MM-61215

```release-note
NONE
```

Co-authored-by: Mattermost Build <build@mattermost.com>
2025-02-07 22:12:33 +05:30
Christopher Poile
3a73b517e2 [MM-62775] Fix: Bulk export not completing (#30044)
* do not error on exportFile error

* add tests for local and s3 storage exporting with missing file

* linting

* fix attachment path validation in mmctl
2025-02-04 17:56:11 -05:00
AulakhHarsh
bec3bbf88f add e2e tests for sendPasswordResetEmail cmd (#29907) 2025-01-29 23:29:37 +00:00
Christopher Poile
28c561d643 [MM-62179] Fix: mmctl debug error when setting email (#29953)
* only GetUserByEmail if arg is an email

* fixing tests

* fix typo
2025-01-29 23:45:11 +01:00
Agniva De Sarker
05cdb36886 MM-49353: Setup intermediate signal handlers for plugin shutdown (#28653)
There are several steps that a server runs through inside (*Server).Start
after ch.initPlugins() till the signal handler is reached which handles
the server shutdown procedure.

The issue arises when the server is shutdown after ch.initPlugins() completes
but before (*Server).Start finishes. In that case, the plugins are all started
but they won't be shut down cleanly.

To fix this edge-case, we set up an intermediate signal handler, which
attaches itself as soon as ch.initPlugins is finished, allowing us to run
the cleanup code in case the shutdown happens before (*Server).Start finishes.

And when we do reach the main signal handler, we don't need this intermediate
handler any more. So we just reset the handlers and use the main signal handler
which takes care of shutting down the whole server.

Note: This is still not 100% bug-proof because ch.initPlugins() will initialize
_all_ plugins, and the shutdown can happen just after one plugin is initialized.
To handle that case will require the need to set up signal handlers after every
plugin init which feels like overkill to me.

A sample flow diagram to visualize better:

Edge-case
server.Start()
|
ch.initPlugins()
|
<ctrl-c>
|
execute signal handler, os.Exit(1)

Happy-path
server.Start()
|
ch.initPlugins()
|
server.Start() finished
|
reset old signal handler
|
setup main signal handler
|
server runs on as usual until shutdown

https://mattermost.atlassian.net/browse/MM-49353

```release-note
NONE
```
2025-01-21 11:15:19 +05:30
Ben Schumacher
8d4bf4bae0 [MM-54288] Support Packet V2 (#29403) 2025-01-13 20:23:09 +01:00
Christopher Poile
aba4434dab MM-59966 - Compliance Export overhaul - feature branch (#29789)
* [MM-59089] Add a compliance export constant (#27919)

* add a useful constant

* i18n

* another constant

* another i18n

* [MM-60422] Add GetChannelsWithActivityDuring (#28301)

* modify GetUsersInChannelDuring to accept a slice of channelIds

* add GetChannelsWithActivityDuring

* add compliance export progress message; remove unused custom status

* linting

* tests running too fast

* add batch size config settings

* add store tests

* linting

* empty commit

* i18n changes

* fix i18n ordering

* MM-60570 - Server-side changes consolidating the export CLI with server/ent code (#28640)

* add an i18n field; add the CLI's export directory

* int64 -> int

* Add UntilUpdateAt for MessageExport and AnalyticsPostCount

to merge

* remove now-unused i18n strings

* add TranslationsPreInitFromBuffer to allow CLI to use i18n

* use GetBuilder to simplify; rename TranslationsPreInitFromFileBytes

* [MM-59089] Improve compliance export timings (#1733 - Enterprise repo)

* MM-60422 - Performance and logic fixes for Compliance Exports (#1757 - Enterprise repo)

* MM-60570 - Enterprise-side changes consolidating the export CLI with server/ent code (#1769 - Enterprise repo)

* merge conflicts; missed file from ent branch

* MM-61038 - Add an option to sqlstore.New (#28702)

remove useless comment

add test

add an option to sqlstore.New

* MM-60976: Remove RunExport command from Mattermost binary (#28805)

* remove RunExport command from mattermost binary

* remove the code it was calling

* fix i18n

* remove test (was only testing license, not functionality)

* empty commit

* fix flaky GetChannelsWithActivityDuring test

* MM-60063: Dedicated Export Filestore fix, redo of #1772 (enterprise) (#28803)

* redo filestore fix #1772 (enterprise repo) on top of MM-59966 feature

* add new e2e tests for export filestore

* golint

* ok, note to self: shadowing bad, actually (when there's a defer)

* empty commit

* MM-61137 - Message export: Support 7.8.11 era dbs (#28824)

* support 7.8.11 era dbs by wrapping the store using only what we need

* fix flaky GetChannelsWithActivityDuring test

* add a comment

* only need to define the MEFileInfoStore (the one that'll be overridden)

* blank commit

* MM-60974 - Message Export: Add performance metrics (#28836)

* support 7.8.11 era dbs by wrapping the store using only what we need

* fix flaky GetChannelsWithActivityDuring test

* add a comment

* only need to define the MEFileInfoStore (the one that'll be overridden)

* performance metrics

* cleanup unneeded named returns

* blank commit

* MM-60975 - Message export: Add startTime and endTime to export folder name (#28840)

* support 7.8.11 era dbs by wrapping the store using only what we need

* fix flaky GetChannelsWithActivityDuring test

* add a comment

* only need to define the MEFileInfoStore (the one that'll be overridden)

* performance metrics

* output startTime and endTime in export folder

* empty commit

* merge conflict

* MM-60978 - Message export: Improve xml fields; fix delete semantics (#28873)

* support 7.8.11 era dbs by wrapping the store using only what we need

* fix flaky GetChannelsWithActivityDuring test

* add a comment

* only need to define the MEFileInfoStore (the one that'll be overridden)

* performance metrics

* output startTime and endTime in export folder

* empty commit

* add xml fields, omit when empty, tests

* fix delete semantics; test (and test for update semantics)

* clarify comments

* simplify edited post detection, now there's no edge case.

* add some spacing to help fast running tests

* merge conflicts/updates needed for new deleted post semantics

* linting; fixing tests from upstream merge

* use SafeDereference

* linting

* stronger typing; better wrapped errors; better formatting

* blank commit

* goimports formatting

* fix merge mistake

* minor fixes due to changes in master

* MM-61755 - Simplifying and Support reporting to the db from the CLI (#29281)

* finally clean up JobData struct and stringMap; prep for CLI using db

* and now simplify using StringMapToJobDataWithZeroValues

* remove unused fn

* create JobDataExported; clean up errors

* MM-60176 - Message Export: Global relay cleanup (#29168)

* move global relay logic into global_relay_export

* blank commit

* blank commit

* improve errors

* MM-60693 - Refactor CSV to use same codepath as Actiance (#29191)

* move global relay logic into global_relay_export

* blank commit

* refactor (and simplify) ExportParams into shared

* blank commit

* remove unused fn

* csv now uses pre-calculated joins/leaves like actiance

* improve errors

* remove nil post check; remove ignoredPosts metric

* remove unneeded copy

* MM-61696 - Refactor GlobalRelay to use same codepath as Actiance (#29225)

* move global relay logic into global_relay_export

* blank commit

* refactor (and simplify) ExportParams into shared

* blank commit

* remove unused fn

* csv now uses pre-calculated joins/leaves like actiance

* remove newly unneeded function and its test. goodbye.

* refactor GetPostAttachments for csv + global relay to share

* refactor global_relay_export and fix tests (no changes to output)

* improve errors

* remove nil post check; remove ignoredPosts metric

* remove unneeded copy

* remove unneeded nil check

* PR comments

* MM-61715 - Generalize e2e to all export types 🤖  (#29369)

* move global relay logic into global_relay_export

* blank commit

* refactor (and simplify) ExportParams into shared

* blank commit

* remove unused fn

* csv now uses pre-calculated joins/leaves like actiance

* remove newly unneeded function and its test. goodbye.

* refactor GetPostAttachments for csv + global relay to share

* refactor global_relay_export and fix tests (no changes to output)

* improve errors

* remove nil post check; remove ignoredPosts metric

* remove unneeded copy

* remove unneeded nil check

* PR comments

* refactor isDeletedMsg for all export types

* fix start and endtime, nasty csv createAt bug; bring closer to Actiance

* align unit tests with new logic (e.g. starttime / endtime)

* refactor a TimestampConvert fn for code + tests

* bug: pass templates to global relay (hurray for e2e tests, otherwise...)

* add global relay zip to allowed list (only for tests)

* test helpers

* new templates for e2e tests

* e2e tests... phew.

* linting

* merge conflicts

* unexport PostToRow; add test helper marker

* cleanup, shortening, thanks to PR comments

* MM-61972 - Generalize export data path - Actiance (#29399)

* extract and generalize the export data generation functions

* finish moving test (bc of previous extraction)

* lift a function from common -> shared (to break an import cycle)

* actiance now takes general export data, processes it into actiance data

* bring tests in line with correct sorting rules (upadateAt, messageId)

* fixups, PR comments

* turn strings.Repeat into a more descriptive const

amended: one letter fix; bad rebase

* MM-62009 - e2e clock heisenbug (#29434)

* consolidate assertions; output debuggable diffs (keeping for future)

* refactor test output generator to generators file

* waitUntilZeroPosts + pass through until to job = fix all clock issues

* simplify messages to model.NewId(); remove unneeded waitUntilZeroPosts

* model.NewId() -> storetest.NewTestID()

* MM-61980 - Generalize export data path - CSV (#29482)

* simple refactoring

* increase sleep times for (very) rare test failures

* add extra information to the generic export for CSV

* adj Actiance to handle new generic export (no difference in its output)

* no longer need mergePosts (yay), move getJoinLeavePosts for everyone

* adjust tests for new csv semantics (detailed in summary)

* and need to add the new exported data to the export_data_tests

* rearrange csv writing to happen after data export (more logical)

* linting

* remove debug statements

* figured out what was wrong with global relay e2e test 3; solid now

* PR comments

* MM-61718 - Generalize export data path - Global Relay (#29508)

* move global relay over to using the generalized export data

* performance pass -- not much can be done

* Update server/enterprise/message_export/global_relay_export/global_relay_export.go

Co-authored-by: Claudio Costa <cstcld91@gmail.com>

---------

Co-authored-by: Claudio Costa <cstcld91@gmail.com>

* MM-62058 - Align CSV with Actiance (#29551)

* refactoring actiance files and var names for clarity

* bug found in exported attachments (we used to miss some start/ends)

* changes needed for actiance due to new generic exports

* bringing CSV up to actiance standards

* fixing global relay b/c of new semantics (adding a note on an edge case)

* aligning e2e tests, adding comments to clarify what is expected/tested

* necessary changes; 1 more test for added functionality (ignoreDeleted)

* comment style

* MM-62059 - Align Global Relay with Actiance/CSV; many fixes (#29665)

* core logic changes to general export_data and the specific export paths

* unit tests and e2e tests, covering all new edge cases and all logic

* linting

* better var naming, const value, and cleaning up functions calls

* MM-62436 - Temporarily skip cypress tests that require download link (#29772)

---------

Co-authored-by: Claudio Costa <cstcld91@gmail.com>
2025-01-10 16:56:02 -05:00
Ibrahim Serdar Acikgoz
424ce2b8db [MM-59503] export: enable exporting configuration with mmctl (#28412) 2024-12-17 10:23:52 +01:00
Jesús Espino
d316df6d28 Replacing interface{} with any everywhere (except generated mocks) (#29446) 2024-12-15 21:11:36 +01:00
Vishal
746eb70e01 [MM-60689] Add Webhook ID in the logs (#28846)
* add webhook id to logs

* Move hook_id context to api level from app level.

* pass errCtx to other references of same app-error-id

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
2024-11-21 13:53:10 +05:30
Seth Foss
2117a4ed30 MM-56632 Display warning if requested mage size exceeds max (#26022) (#27216) 2024-11-06 15:45:56 +01:00
Bernhard Fröhlich
d3c18ee369 Fix mmctl build for FreeBSD (#29112) 2024-11-05 17:57:15 +01:00
Ibrahim Serdar Acikgoz
f41d2d7774 [MM-58745] export/import: enable exporting and importing bots canonically (#28214) 2024-11-01 19:44:30 +01:00
Ben Schumacher
707144d358 [MM-61132] Fix example for mmctl permissions role show command (#28816) 2024-10-24 14:03:21 +02:00
Daniel Espino García
2d96053012 Use flags for create post (#28857)
* Use flags for create post

* Remove unintended file

* Fix unintended change and types

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
2024-10-22 16:00:26 +02:00
Ben Schumacher
2c139a293b Add missing parenthesis in mmctl webhook list (#28778)
* Add missing parenthesis in mmctl webhook list

* Use generics in StoreResult
2024-10-17 07:45:10 +02:00
Nicolas Le Cam
845b5806c0 server: Fix typo in Makefile (#28710) 2024-10-14 10:32:43 +02:00
Agniva De Sarker
a258fd80b2 Remove remaining references to model.NewXX (#28678)
And we remove the deprecated functions to force uses
only of the new function.
```release-note
NONE
```
2024-10-10 22:15:22 +05:30
Ben Cooke
b3c7ef0b97 [MM-56073] MMCTL delete post command (#27539)
Co-authored-by: Ben Schumacher <ben.schumacher@mattermost.com>
2024-10-08 16:45:31 +02:00
Ibrahim Serdar Acikgoz
076a3cb0d5 cmd/mmctl/user: attempt to improve migrate-auth documentation (#28330) 2024-10-01 12:46:06 +02:00
Ben Schumacher
3428cd15b6 [MM-60648] Don't start server until all routes are registered (#28291) 2024-09-26 13:57:48 +02:00
Ben Schumacher
d9e47522a0 Remove unnecessary copies of loop variables (#28138) 2024-09-11 16:51:30 +02:00
Ibrahim Serdar Acikgoz
4b3de1861f [MM-59519] preserve DM/GM unread/read state over export and import (#27707) 2024-08-26 17:04:48 +02:00
Matthew Straughn
8ccdca0954 [MM-21473] Review archiveTeamsCmdF function to return an error in case of a failure (#26622)
Co-authored-by: Ben Schumacher <ben.schumacher@mattermost.com>
2024-08-13 16:49:40 +02:00
Agniva De Sarker
c3ed07e679 OSF: Used model.NewPointer everywhere (#27838)
```release-note
NONE
```
2024-08-06 09:15:00 +05:30
Ben Schumacher
1158e6358c [MM-54593] HA aware Support Packet (#27598) 2024-08-03 16:11:13 +02:00
Scott Bishel
08ed72f060 MM-54502 - Update regex to force first character to be alpha (#24675)
Automatic Merge
2024-07-31 17:27:52 +03:00
Devin Binnie
aa85a13c8f [MM-58492][MM-58523] Fixed some access control bugs around archived channels by replacing the permission check with HasPermissionToReadChannel (#27409)
* [MM-58492][MM-58523] Fixed some access control bugs around archived channels by replacing the permission check with HasPermissionToReadChannel

* Fix lint, add ChannelId to uploads

* Fix MMCTL tests and remove unnecessary check for the error message that doesn't work anyways

* Include channel map for getting flagged posts

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
2024-07-29 10:05:20 -04:00
Jesse Hallam
9304c404df MM-58756: paginate webhooks list (#27368)
* MM-58756: paginate webhooks list

* show error if webhook list fails
2024-07-17 10:02:07 -03:00
Agniva De Sarker
177389d224 MM-53962: Adding ES8 dependency (#24399)
* Adding ES8 dependency

```release-note
NONE
```


Co-authored-by: Mattermost Build <build@mattermost.com>
2024-07-11 13:13:31 +05:30
Ben Schumacher
3513d310af [MM-58003] Allow setting AdvancedLoggingJSON via mmctl (#27388) 2024-07-08 21:20:25 +02:00
Miguel de la Cruz
bc49f348bf Correctly merge plugin configuration on mmctl config patch (#26647)
* Adds a step to the config patch command to merge plugin configurations

* Fix linter

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
2024-07-08 11:54:40 +02:00
Akis Maziotis
762ff9b96c [chore] migration of plugin-store (#27506)
Plugin store is gradually migrated from:
- https://plugins-store.test.mattermost.com
to
- https://plugins.releases.mattermost.com

We reflect that change here

Note: Currently both CDN's are working as expected, to facilitate the mgiration. Upon succesfull migration, https://plugins-store.test.mattermost.com will be decomissioned
2024-07-03 08:23:43 +03:00
Ben Schumacher
213ebc57fb Print panic message when mmctl panics (#27390) 2024-07-02 13:58:37 +02:00
Ben Cooke
9187c772b6 [MM-56074] mmctl job commands (#26855)
* add job list and update  job status command to mmctl
2024-06-17 12:07:05 -04:00
Jesse Hallam
cd51dec6e5 Centralize the GetPackagePath (#27004) 2024-05-15 12:05:13 -03:00
Jesse Hallam
630bd40141 Eliminate MM_SERVER_PATH (#24968) 2024-05-10 18:13:05 -03:00
Ben Schumacher
09c39cf3ec [MM-58020] Improve error message of NotFound errors in store (#26870)
* Improve error message of NotFound errors in store

* update mmctl tests
2024-05-07 15:30:48 +02:00
Ezekiel
b7e830f4a1 Print & Return errors using multierror if an error happens (#26625)
* Print & Return errors using multierror if an error happens

* Group up errors assertion in test

* Remove trailing newspace

* Remove WrappedErrors loop

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
2024-04-30 22:16:05 +02:00
Ben Schumacher
af031b4d0c Fix merge error (#26933) 2024-04-30 16:02:28 +02:00
Ezekiel
b6a8965969 Gh 19916 mmctl list deactivated users only (#26646) 2024-04-30 14:49:50 +02:00
Agniva De Sarker
10a59619c7 MM-57997: Fix bypass-upload in HA mode (#26850)
Now we throw an error if the server is in HA. This is
because there is no guarantee that the server where the
request lands has access to the file locally.

https://mattermost.atlassian.net/browse/MM-57997
```release-note
NONE
```
2024-04-30 14:14:45 +05:30
Ben Schumacher
32d93fd469 [MM-57743] Enable errcheck linter (#26723) 2024-04-29 11:23:01 +02:00
Ben Schumacher
30d450c4d8 Cleanup usage of global logger (#26835) 2024-04-24 11:52:33 +02:00
Ben Schumacher
92a6c6517d [MM-56854] Add shell completion to mmctl user active|deactivate (#26358)
Co-authored-by: Mattermost Build <build@mattermost.com>
2024-04-24 10:14:20 +02:00
Ben Schumacher
3dae305dc7 [MM-56000] Add LDAP job command to mmctl (#25633) 2024-04-22 12:19:53 +02:00
Claudio Costa
446c763fa8 [MM-57500] Streaming support for importing file attachments (#26629)
* Bulk import: stream file attachments uploads

* Add comment with context on buffer size

* Add file name to logs

* Use sha256 to do checksum

* Fix bad merge

* Fix import file

* Update test

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
2024-04-19 15:49:33 -06:00
Julien Tant
ffc08858cf [MM-54730] Don't use old hardcoded rule for validating imported posts (#25823)
* don't use old hardcoded rule for validating imported posts

* fix http verb in doc

* Use client config

* Handle local mode

* E2E tests

* Enforce default if unable to use real limit

* Unit tests

* Fix tests

* Use model.PostMessageMaxRunesV2 as lower default

* Update direct post message length validation

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
Co-authored-by: streamer45 <cstcld91@gmail.com>
2024-04-19 11:45:32 -06:00
Ben Schumacher
b56c65ec2d Simplify page size in mmctl (#26664) 2024-04-10 12:47:06 +02:00
Ezekiel
db2cfe953b updated modifyTeamsCmdF to return error instead of nil when encounting error (#26606) 2024-04-10 11:02:41 +05:30