Граф коммитов

262 Коммитов

Автор SHA1 Сообщение Дата
Carrie Warner (Mattermost)
dcd66d2146 MM-41988 Updated links to legacy domain about.mm.com (#19552)
* Updated links to legacy domain about.mm.com

* Legacy link updates

* Reverting - only need to change en.json

* Reverting - only need to change en.json

* Reverting - only need to change en.json

* Reverting - only need to change en.json

* Reverting - only need to change en.json

* Reverting - only need to change en.json

* Reverting - only need to change en.json

* Reverting - only need to change en.json

* Reverting - only need to change en.json

* Reverting - only need to change en.json

* Reverting - only need to change en.json

* Reverting - only need to change en.json

* Reverting - only need to change en.json

* Reverting - only need to change en.json

* Reverting - only need to change en.json

* Reverting - only need to change en.json

* Reverting - only need to change en.json

* Reverting - only need to change en.json

* Reverting - only need to change en.json

* about.mm.com URL updates

* mattermost.org URL updates

* forum.mm.org URL update

* Update .github/ISSUE_TEMPLATE.md

* Update .github/ISSUE_TEMPLATE.md

* Un-deleted language files

* Update README.md

* Update tests/test-config.json

* fix some test due to url updating (#19787)

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Co-authored-by: Harrison Healey <harrisonmhealey@gmail.com>
Co-authored-by: Ibrahim Serdar Acikgoz <serdaracikgoz86@gmail.com>
2022-03-16 19:47:57 +08:00
Ibrahim Serdar Acikgoz
b03d87af40 [MM-41576] Add schema version to the client configuration (#19757)
* revamp db version and add applied migrations endpoint

* replace old schema version with new

* add db version subcommand

* add to local api

* reflect review comments

* log errors

* remove setting the version from model.CurrentVersion

* fix a test

* use different field for schema version

* add build hash and current version to the support packet

* add tests

* update test to use new assets
2022-03-15 16:39:23 +03:00
Agniva De Sarker
7664c9d709 MM-40818: Pass filestore to channels (#19677)
We move away from referencing server struct
but pass the filestore service to Channels
explicitly.

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

```release-note
NONE
```

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2022-03-10 19:49:05 +05:30
Pablo Andrés Vélez Vidal
4deedbbfd3 MM-42049 - license endpoint not working (#19686) (#19748)
Automatic Merge
2022-03-08 19:16:58 -04:00
Jesse Hallam
a2a78577e9 Revert "[MM-41576] Revamp database schema version (#19586)" (#19746)
* Revert "[MM-41576] Revamp database schema version (#19586)"

This reverts commit 645fee3fe3.

* Revert "MM-42049 - license endpoint not working (#19686)"

This reverts commit 4fe89e5847.
2022-03-08 16:28:28 -04:00
Pablo Andrés Vélez Vidal
4fe89e5847 MM-42049 - license endpoint not working (#19686)
Automatic Merge
2022-03-08 20:14:19 +02:00
Ibrahim Serdar Acikgoz
645fee3fe3 [MM-41576] Revamp database schema version (#19586)
* revamp db version and add applied migrations endpoint

* replace old schema version with new

* add db version subcommand

* add to local api

* reflect review comments

* log errors

* remove setting the version from model.CurrentVersion

* fix a test
2022-03-08 18:13:37 +03:00
Agniva De Sarker
05503440a6 MM-42378: Fix server crash while loading license (#19733)
* MM-42378: Fix server crash while loading license

The user service needs to be created before
loading license.

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

```release-note
NONE
```

* Further fix

```release-note
NONE
```
2022-03-08 22:58:29 +08:00
Agniva De Sarker
a2fc602bc2 MM-40813: Use config service more extensively (#19679)
https://mattermost.atlassian.net/browse/MM-40816

```release-note
NONE
```

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2022-03-07 20:48:55 +05:30
Agniva De Sarker
84a733ed56 Move cluster init during server start (#19684)
After refactoring the channels init, the
config service under channels won't have
the config hash until the product gets
started. This caused an issue during
cluster initialization.

Therefore moved it after the product start.

```release-note
NONE
```

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2022-03-07 19:41:52 +05:30
Agniva De Sarker
ab8de49f0a MM-40818: Refactor product initialization to happen late (#19658)
This is more of a general refactor of the initialization
process which should allow us to pass services more
easily.

The changes are minimal to keep the scope limited.
For now, the objective is to pass the file service
to the Channels product. For that, it was required
to move some of the enterprise interfaces under Channels
from Server.

We also create a filestore field in the server to
avoid creating filestore reference every time
we make a filestore operation. This will be later
passed on to the Channels product.

Also removed an unnecessary test. 
The test was working so far because we were creating
the filebackend every time for every request. But
we should go via UpdateConfig call which would fail,
were we to assign an invalid filestore name.

So we were actually testing for a different thing.
Therefore, removed the test.

```release-note
NONE
```
2022-03-03 12:22:10 +05:30
Julien Tant
dd100a3a69 [MM-41785] Show error in invitation popin when email can't be send (#19617)
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2022-03-02 14:26:57 -07:00
Ibrahim Serdar Acikgoz
f2471200f9 [MM-40817] Add license wrapper (#19648)
* add license service interface

* add wrapper

* remove wrapper from channels struct until its being used

* add comments
2022-03-01 15:14:43 +03:00
Allan Guwatudde
8d6d1c51c2 [MM-40917] - Inactive Server Email Notification (#19374)
* [MM-40917] - Inactive Server Email Notification

* add email template

* make store layers

* add some store tests

* fix translations

* fix logic

* improve

* fix lint

* feedback-impl

* fix wrong text

* optimize queries

* move feature flag check

* feedback impl-1

* add line

* feedback impl

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2022-02-22 20:41:58 +03:00
Agniva De Sarker
dbf779b828 MM-40813: Add config interface (#19571)
We create the basic boilerplate to pass services
to each product. The basic idea is to have a map
containing service names and the services.

The server will pass all services to all products.
But it is on the product, to choose what services
they will actually consume.

Each product will cast the received service to
an interface with the methods that product requires.

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

```release-note
NONE
```
2022-02-21 21:41:04 +05:30
Julien Tant
d4378a6b42 [MM-41668] Remove "add support email" admin advisor notifications (#19567)
Automatic Merge
2022-02-19 00:04:18 +02:00
Jesús Espino
2c3e289509 Working on refactoring jobs service (#19205)
* Working on refactoring jobs service

* Making more consistent with the previous existing code

* Remove no longer needed functions

* Making a base PeridicScheduler to use it in most of the schedulers implementations

* Removing accidental complexity from on of the jobs

* Removing accidental complexity from expirynotify

* Fixing compilation from previous commit

* Remove accidental complexity from the export_delete job

* Simplifying the workers by making a reusable worker

* Using simple worker for export_delete job

* Simpliying export process job

* Simpliying extract content job

* Simpliying import delete job

* Simpliying import process job

* Simpliying product noticies job

* Simpliying fix crt channel unreads job (only removing the uneeded register function)

* Simpliying migrations job (only removing the uneeded register function)

* fixup

* Simpliying plugins job (only removing the uneeded register function)

* Simpliying bleve indexing job (only removing the uneeded register function)

* Simpliying resend invitation email job (only removing the uneeded register function)

* Fixing tests

* Simplifying migration tests infrastructure

* Adding missed license to files

* Adding an empty file to imports package to ensure this package exist even without enterprise repo

* Regenerating einterfaces mocks

* Adding missed license to files

* Updating i18n/en.json file

* help fixing enterprise tests compilation

* Adding new DailyScheduler

* Fixing typo and changing the waitTime type for periodic sechduler

* Making the daily scheduler more generic

* Adding comments to clarify not used parameters in interface scheduler interface implementations

* Using merror to handle multiple errors in jobs workers

* Fixing linter errors

* Addressing PR review comments

* Reverting go.tools.mod changes

* Removing the static check for worker type in the model (moving it to the insertion of new jobs

* Moving migrations job to the jobs directory

* Fixing (and improving a bit) tests

* Apply suggestions from code review

Co-authored-by: Doug Lauder <wiggin77@warpmail.net>

* Fixing enterprise tests

* Removing unneeded InitWorkers/InitSchedulers calls

* Fix expirenotify job when error happens

* Fixing govet errors

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Co-authored-by: Doug Lauder <wiggin77@warpmail.net>
2022-02-14 18:21:18 +01:00
Ibrahim Serdar Acikgoz
e03384c4d1 [MM-40712] config: Bugfix on path resolution; fail if given config does not exist (#19360)
* config: bugfix on path resolution; fail if given config does not exist

* reflect review comments

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2022-01-31 17:15:32 +03:00
Agniva De Sarker
7988810fc0 Disable sentry tracing completely (#19410)
We don't do instrumentation of Sentry transactions
anywhere in the code. Only opentracing code is present.

One has to explicitly add custom instrumentation for it
to work: https://docs.sentry.io/platforms/go/performance/instrumentation/custom-instrumentation/

It's likely someone is running custom code and sending
transaction data to Sentry. It's not super hard to pick
off the sentry DSN string from the binary.

The PR is more of a best effort to stop any future
transaction events to be sent.

```release-note
NONE
```
2022-01-28 12:47:46 +05:30
Ashish Bhate
a55bd001b4 Revert "[MM-37013] Async job to fix CRT channel unreads (#18340)" (#19319)
This reverts commit 0da249c651.
2022-01-12 18:51:47 +05:30
Kirill Krotov
0dbc74f6d5 [GH-18965] - Pass expire time from outside Cleanup method (#19008)
Pass expire time from outside Cleanup method

Fixes #18965
2021-12-22 14:57:30 +05:30
Allan Guwatudde
81409ee7c4 [MM-40407] - Do not show the Renew Now if the license id does not exist in the portal (#19188)
* [MM-40407] - Do not show the Renew Now if the license id does not exist in the portal

* improvements

* impl mock

* fix translations

* feedback impl

* fix typo

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2021-12-21 09:46:02 +03:00
Agniva De Sarker
129f0aabd3 Remove the remaining fields from *app.Server (#19113)
We move these fields to Channels:
```
uploadLockMapMut sync.Mutex
uploadLockMap    map[string]bool
imgDecoder *imaging.Decoder
imgEncoder *imaging.Encoder
dndTaskMut sync.Mutex
dndTask    *model.ScheduledTask
```

I think this PR should conclue the initial phase
of migrating stuff from Server to Channels.

The remaining task would be to focus on continue
to create the remaining services from the
common things like users, teams, push notifications,
clustering for other products to consume.

https://community-daily.mattermost.com/boards/workspace/zyoahc9uapdn3xdptac6jb69ic/285b80a3-257d-41f6-8cf4-ed80ca9d92e5/495cdb4d-c13a-4992-8eb9-80cfee2819a4/87df1e15-588e-49ff-8bd1-ffa9651b8c82

```release-note
NONE
```
2021-12-07 21:53:24 +05:30
Agniva De Sarker
5ab3ad9bfd Move enterprise features under Channels (#19010)
* Move enterprise features under Channels

We move the EE features which are Channels related.

While here, we also move some code under *Server.Start()
from NewServer.

```release-note
NONE
```

* move saml and ldap back to server

```release-note
NONE
```

* fix test

```release-note
NONE
```

* try again

```release-note
NONE
```
2021-11-25 10:07:43 +05:30
Ashish Bhate
0da249c651 [MM-37013] Async job to fix CRT channel unreads (#18340)
Summary
The addition of the TotalMsgCountRoot and MsgCountRoot columns to support CRT caused several issues with previously read threads and channels being marked as unread. Previously we attempted to fix this purely in a SQL migration [MM-35345][MM-35494] fixes for incorrect mentions and unreads for threads and channels #17803 but that turned out to be too heavy and it was decided to break up some of the fixes into async jobs.
This PR implements an async job to mark channels as read if there are no user posts since the last time the user viewed the channel. 

Ticket Link
https://mattermost.atlassian.net/browse/MM-37013
2021-11-18 15:31:18 +05:30
Agniva De Sarker
a850704afe Move pluginCommands into Channels (#18974)
* Move pluginCommands into Channels

We move pluginCommands, pluginCommandsLock
into Channels.

We also move the plugin related route handlers
under Channels and move the init code under
NewChannels. To achieve this, the router initialization
is bumped up.

Along with it, we clean up some App methods
which were just wrappers over Channel methods.
Instead, we call the Channel method directly
to make things more readable and easy to understand.

```release-note
NONE
```

* fix tests

```release-note
NONE
```
2021-11-12 10:35:14 +05:30
Agniva De Sarker
0a3e7f4d55 Ordering clarifications (#18964)
Automatic Merge
2021-11-09 10:15:15 +01:00
Agniva De Sarker
25257d6ef6 Move plugins under Channels (#18938)
* Move plugins under Channels

We move all plugin related fields under *Channels.
This essentially migrates several methods from being under
*Server to under *Channels.

We also move the plugin startup and shutdown code
to be under Channels.Start and Channels.Shutdown.

While here, we remove the getPluginPublicKeyFiles
method which was a one-line method which uselessly
returned an error.

Lastly, we fix the product initialization order which
was incorrect previously. Products are dependent on
the main server.

So startup should be products -> server.
And shutdown should be server -> products.

```release-note
NONE
```

* Added app layer

```release-note
NONE
```

* Incorporate suggestions

```release-note
NONE
```
2021-11-08 11:57:22 +05:30
Agniva De Sarker
3bc151bbda Revert "Ordering clarifications (#18937)" (#18948)
Automatic Merge
2021-11-04 19:15:15 +01:00
Maria A Nunez
7e728d0b6f MM-39804 - Remove license expiration checks for cloud (#18921) 2021-11-04 12:26:28 -04:00
Agniva De Sarker
f921e69fe8 Ordering clarifications (#18937)
* Ordering clarifications

Clearly outline the dependency graph
during server bootup.

```release-note
NONE
```

* More clarifications

```release-note
NONE
```

* lint fix

```release-note
NONE
```
2021-11-04 19:22:23 +05:30
Agniva De Sarker
83b3090eb9 Fix PluginHealthCheckJob (#18927)
* Fix PluginHealthCheckJob

We were incorrectly calling to start PluginHealthCheckJob
without initializing the plugins environment.

To fix this, we move the code inside initPlugins right after
the environment is initialized.

To respond to config changes, we call it again from pluginsEnvironment.Shutdown
which gets called from ConfigListener when plugins are disabled. And initPlugins
is anyways called again from ConfigListener which plugins are enabled,
so we can avoid checking for PluginSettings.Enable again in the call.

We also rename the method to better indicate its nature.

During this, we also uncover and fix another bug where disabling
plugins would not shut down plugins at all because we were calling
s.GetPluginsEnvironment() directly which returns nil if plugins
were disabled. The approach we follow is to manually acquire the lock
whenever we need access to the struct ignoring config setting.
We fix that as well.

https://community-daily.mattermost.com/boards/workspace/zyoahc9uapdn3xdptac6jb69ic/285b80a3-257d-41f6-8cf4-ed80ca9d92e5/495cdb4d-c13a-4992-8eb9-80cfee2819a4?c=6ef6178c-3512-4e57-8edd-1d2b66a09c9e
```release-note
NONE
```

* Fix test

```release-note
NONE
```
2021-11-04 08:54:03 +05:30
Agniva De Sarker
5ad7fb5b6f Remove job server dependency searchengine (#18908)
* Remove job server dependency searchengine

The job server field was not being used. We remove it
as part of a cleanup of server initialization refactor.

https://community-daily.mattermost.com/boards/workspace/zyoahc9uapdn3xdptac6jb69ic/285b80a3-257d-41f6-8cf4-ed80ca9d92e5/495cdb4d-c13a-4992-8eb9-80cfee2819a4?c=8a171d5e-4398-4bc9-8fbf-8b9b14f37069

```release-note
NONE
```

* Fix missing field

```release-note
NONE
```
2021-11-03 18:44:57 +01:00
Doug Lauder
ceee3f4b5f re-config logger when config changes (#18860) 2021-10-28 08:06:34 -04:00
Agniva De Sarker
6bc6243131 Move some more atomic values under Channels (#18837)
* Move some more atomic values under Channels

The following fields were moved:

```
asymmetricSigningKey atomic.Value
clientConfig         atomic.Value
clientConfigHash     atomic.Value
limitedClientConfig  atomic.Value
```

And also moved the initialization order from NewServer
to Channels.Start to better reflect the order of things.

Removed AsymmetricSigningKey from ConfigService
as it was no longer used.

Removed calling regenerateClientConfig during startup explicitly
because it was anyways called from ensureAsymmetricSigningKey.

https://community-daily.mattermost.com/boards/workspace/zyoahc9uapdn3xdptac6jb69ic/285b80a3-257d-41f6-8cf4-ed80ca9d92e5/495cdb4d-c13a-4992-8eb9-80cfee2819a4?c=87df1e15-588e-49ff-8bd1-ffa9651b8c82
```release-note
NONE
```

* Fix lint error

```release-note
NONE
```
2021-10-26 00:05:11 +05:30
Agniva De Sarker
d949bd1638 Remove app initialization from WebHub (#18687)
- Make it a Server method.
- Pass Server instead of App.
- Remove global app instance from NewServer, rather
create local instances whenever needed.
- Remove App from Websocket router, and create dynamically
on every request.
- Remove HubStart and HubStop from App methods.
- Explicitly using s.Log instead of the global logger
to indicate dependency on Server. We could have passed the logger
explicitly but it doesn't look ideal.

```release-note
NONE
```
2021-10-18 12:36:13 +05:30
Agniva De Sarker
c27814393d Improve API4 initialization (#18680)
* Improve API4 initialization

- Refactored openGraphDataCache to be inside app layer.
- Moved the cache instance from global variable to be inside server.
- Moved out the app instantiation from the global commands package
to be instantiated on every call. Only the server instance is passed.
- Moved InitLocal to be called from inside Init.

```release-note
NONE
```

* Remove commented line

```release-note
NONE
```
2021-10-15 19:57:05 +05:30
Agniva De Sarker
43a99a5783 Move cloud init back to initEnterprise (#18668)
* Move cloud init back to initEnterprise

```release-note
NONE
```

* Remove debug lines

```release-note
NONE
```

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2021-10-15 19:29:06 +05:30
Agniva De Sarker
99e6039472 Add functionality to cleanup old jobs (#18646)
* Add functionality to cleanup old jobs

Historically, we never cleaned up old jobs from the DB
leading to them being accumulated forever.

This PR introduces functionality to cleanup old jobs
older than a defined threshold.

The functionality is set to false by default and has
to be enabled for it to work.

```release-note
2 new config settings were added.

JobSettings.CleanupOldJobs: This indicates whether to clean up old jobs
from the DB or not. Default is false.

JobSettings.CleanupJobsThresholdHours: This defines the time gap in hours beyond
which older jobs will be removed. This has no effect if the above config
setting is set to false. Default is -1
```

* fix copy pasta

```release-note
NONE
```

* address review comments

```release-note
NONE
```

* Fix lint

```release-note
NONE
```

* Use single config option for everything

```release-note
NONE
```

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2021-10-15 11:03:54 +05:30
darkLord19
98284a79eb remove timedDND feature flag (#18346) 2021-10-14 11:54:09 -04:00
Agniva De Sarker
850fef1ad1 Move ImageProxy inside Channels (#18656)
* Move ImageProxy inside Channels

```release-note
NONE
```

* Move back httpService

```release-note
NONE
```

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2021-10-14 13:57:04 +05:30
Ibrahim Serdar Acikgoz
be203d9bf3 Initial team service implementation (#18279)
* initial service implementation

* reflect review comments
2021-10-13 15:20:40 +03:00
Agniva De Sarker
f0ecdcc5f5 Move Channels into App (#18623)
* Move Channels into App

In this PR, we make Channels as part of App
instead of Server. This is part of the transition period
of moving fields from Server to Channels.

For now, Channels contains Server. So the hierarchy is

App -> Channels -> Server.

And as a first step, we also move httpService to Channels.

```release-note
NONE
```

* Fixing another test

```release-note
NONE
```

* new method

```release-note
NONE
```
2021-10-12 11:39:49 +05:30
Agniva De Sarker
561bc968c8 Creating empty Channels shell (#18611)
* Creating empty Channels shell

This is the first step in moving to a product-based
isolated architecture.

For now, Channels is empty and does not contain anything.

Next step is to change App to contain Channels instead
of Server. Some of the initialization code in NewServer
would need to be moved inside NewChannels.

This would complete the full pass-through mode of accessing
everything.

The last step would be to gradually move Channels related
fields from Server into Channels, keeping Server to be
just the global level struct.

```release-note
NONE
```

* fix vet failure

```release-note
NONE
```
2021-10-11 19:24:50 +05:30
Claudio Costa
e542842bd1 Disable admin support status job on server startup (#18341) 2021-09-14 09:02:08 +02:00
Doug Lauder
bb659d03fd Fix plugin logging missing context fields
Fix an issue where context fields logged by server on behalf of plugins didn't contain correct name/value pairs:
- bump Logr version to add key/value methods to sugar logger
- expose factory args when configuring logging with custom target types (needed for FocalBoard to create log target adapter that converts typed fields into slices of interface{} as per plugin logging API)
2021-09-13 10:12:18 -04:00
Ibrahim Serdar Acikgoz
b66fd1f89e move users service to app directory (#18257) 2021-08-24 10:10:40 +03:00
Doug Lauder
a4507327a7 MM-36764 mlog refactor (#18118)
Refactor mlog
- simplify mlog by removing redundant code
- remove Zap dependency
- update unit test helpers
- update logging config
- update auditing
2021-08-17 16:08:04 -04:00
Ben Schumacher
757dc96461 [MM-37772] Idiomatic naming (URL, URI, API) (#18128)
* s/Url/URL/g & s/Uri/URI/g

* s/Api/API/g
2021-08-16 19:46:44 +02:00
Agniva De Sarker
d1b164ab1f Improve session cleanup (#18123)
- We move logging statements to the upper layer.
Store functions are low-level methods and should return error
upwards rather than logging.
- Used IN instead of any (array ()) which is equivalent.
- Made the delay to be of type time.Duration and un-exported it.
- Unexported the batch size constant.

```release-note
NONE
```
2021-08-13 20:15:24 +05:30