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

2968 Коммитов

Автор SHA1 Сообщение Дата
Kyriakos Z
3391adb67b MM-44568: sanitizes profiles in posts (#20291)
* MM-44568: sanitizes profiles in posts

* Fixes tests

* Adds test

* Satisfy vet
2022-05-26 15:41:06 +03:00
Ibrahim Serdar Acikgoz
9985e22dab app: add permissions wrapper (#20242) 2022-05-26 14:03:47 +03:00
Michael Kochell
ea5bfe3fd9 Cloud Freemium - Integrations (#20185)
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2022-05-25 12:36:08 -04:00
Nick Misasi
50d069e86d [MM-44307] On Limits Change, archive or restore teams according to the limits (#20247)
Automatic Merge
2022-05-24 16:16:24 +03:00
Kyriakos Z
9a67ae9ac6 MM-38982: fixes SVG uploading (#20141)
* MM-38982: fixes SVG uploading

Uploading SVG files was "almost" treated like an image in some places,
resulting in not showing the SVG on the client.
This is happening because when we fail to generate a mini preview for an
image, we prepend "invalid-" to the MimeType.

This commit adds a check to guard against SVG files in methods that make
no sense for SVGs.

* Reverts invalid-{mimetype} fix

* Uses fileInfo.IsSvg() where it can
2022-05-20 10:26:21 -04:00
Vishal
2a9f78536f [MM-43798] Change default CRT option from Disabled to AlwaysOn (#20114)
* MM-32692 Add two more CRT options

* [MM-43798] Change CRT default to AlwaysOn

* Rename variable

* fix test

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Co-authored-by: Ashish Bhate <ashish.bhate@mattermost.com>
2022-05-18 18:53:41 +02:00
Agniva De Sarker
1f9657106b MM-31353: Fix flaky TestNoticeValidation/notice_with_specific_date_check (#20238)
We now generate the current time in UTC to avoid date transitions
when running the tests at different local times.

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

```release-note
NONE
```
2022-05-18 18:53:41 +05:30
Vishal
fd703a365b [MM-43917] Cloud Freemium limits API: messages/posts (#20152)
* WIP - Add api and app funcs

* Add test cases

* Add utils testcases

* Exclude deleted posts

* Add doc for func

* Move api from cloud to usage

* Allow api access to authenticated users

* Change int to int64

* Fix lint issue

* Simplify err check

Co-authored-by: Ashish Bhate <ashish.bhate@mattermost.com>

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Co-authored-by: Ashish Bhate <ashish.bhate@mattermost.com>
2022-05-17 13:30:40 +02:00
Agniva De Sarker
aa59c28b04 POC: Cross-team recent search (#20027)
Just a quick POC to move fast :P

We use a search pointer to keep track of
the next row to inesrt to. For every new search
we increment the pointer and do modulo 5.
This means that the value will always remain
between 0-4. And that way, we will always overwrite
the oldest entry on every search.

And while getting the results, we get
all results for that user.

The search parameters are json marshalled
and stored as a JSON blob. This is because
there is no need to search/filter them
in the DB.

Pending items:
Tests obviously.

To improve:
The client needs to send the channel ids
instead of channel names.
2022-05-16 13:16:11 +05:30
Ashish Bhate
a99d5a34b7 MM-44148: fix race in CRT settings test (#20196)
* MM-44148: Remove test parallization to prevent race

* don't export pointer to loop variable

* capture whole loop variable
2022-05-13 12:38:38 +02:00
Miguel de la Cruz
bcd65c513b Fixes a null pointer if the plugin requests the limits on a non-cloud server (#20197) 2022-05-12 17:05:44 +02:00
Agniva De Sarker
acae0031d1 MM-44101: GraphQL: Add sidebar categories at the top level (#20178)
Also, add a negate parameter to the team members to get
all sidebarcategories except the default team.

```release-note
NONE
```
2022-05-12 20:03:47 +05:30
Agniva De Sarker
9dcd1df8f8 MM-44148: Skip racy TestIsCRTEnabledForUser (#20194)
https://mattermost.atlassian.net/browse/MM-44148

```release-note
NONE
```
2022-05-12 14:34:53 +05:30
Vishal
1092c60bc6 [MM-32692] Add two more CRT options (#20088)
* MM-32692 Add two more CRT options deafult_on and always_on

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2022-05-12 12:03:59 +05:30
Agniva De Sarker
231db2df1e MM-43775: Use conn.NetConn() to get TCP conn from tls.Conn (#20180)
We use the new API in Go 1.18 to set TCP_NO_DELAY for tls connections
as well.

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

```release-note
NONE
```
2022-05-11 15:07:30 +05:30
Nick Misasi
340612ec10 Divide TrialEnd date by 1000 to account for it being in ms (#20173)
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2022-05-10 13:55:21 -04:00
Claudio Costa
aee68c7ae4 [MM-44056] Make Calls plugin's state on Cloud controllable by feature flag (#20161)
* Make Calls plugin's state on Cloud controllable by feature flag

* Prepackage Calls v0.4.9 (#20148)

* Update app/plugin.go

Co-authored-by: Jesse Hallam <jesse.hallam@gmail.com>

* Update app/plugin_install.go

Co-authored-by: Jesse Hallam <jesse.hallam@gmail.com>

* Bump Calls version to latest

Co-authored-by: Jesse Hallam <jesse.hallam@gmail.com>
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2022-05-10 19:29:48 +02:00
Ibrahim Serdar Acikgoz
81700598ec app/cluster.go: add PublishWebSocketEvent method (#20171) 2022-05-10 17:25:57 +03:00
Daniel Espino García
50eaec6695 Respect send push proxy notification configuration on test notifications (#20063)
* Respect send push proxy notification configuration on test notifications

* Unify notifications check

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2022-05-10 12:37:47 +02:00
Ibrahim Serdar Acikgoz
3f921bf170 app/server: shutdown producst before closing the store (#20159) 2022-05-10 10:55:40 +03:00
Nathaniel Allred
6f87eb67fc MM-43084 update product limits through webhook and websocket (#20076)
* Define interfaces for updating subscriptions and product limits from CWS webhook.
2022-05-09 08:05:50 -05:00
Agniva De Sarker
fed5404166 GraphQL: Unlock goroutine throttle to match batch capacity (#20146)
We were throttling the amount of concurrent resolvers
at a given time. The idea behind this was to avoid overloading
the database with too many requests.

However, with the introduction of dataloaders, this limitation
actually becomes a bottleneck because all DB calls are actually
batched, so we are unnecessarily throttling the amount of
items that can be processed in a single batch.

The only caveat with this is that now all resolvers
need to backed by dataloaders, or otherwise not be queried
as part of a loop.

In a subsequent PR, we will be removing channel stats
from under channel to be a top-level object to be returned
for a given channel.

```release-note
NONE
```
2022-05-06 21:53:29 +05:30
Allan Guwatudde
37fd699175 [MM-43920] - Set Workspace Inactivity Email to only fire once and change subject (#20134)
* [MM-43920] - Set Workspace Inactivity Email to only fire once and change subject

* feedback impl

* temp change

* revert

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2022-05-06 11:54:38 +03:00
Agniva De Sarker
2c5f816e02 MM-43341: Fix flaky TestImportImportUser (#20140)
We use the specifically created NewTestId
to circumvent any clashes with reserved words.

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

```release-note
NONE
```
2022-05-05 20:03:37 +05:30
Agniva De Sarker
3c83187c5b MM-43929: Ignore archived team memberships in GraphQL (#20130)
https://mattermost.atlassian.net/browse/MM-43929

```release-note
NONE
```
2022-05-04 19:43:02 +05:30
Agniva De Sarker
89fac9d485 MM-41153: Add seats deployed to support packet (#20125)
Support packet contains 2 new fields:
1. Active users.
2. License supported users.

We refactor the code to its separate file.

```release-note
NONE
```
2022-05-03 21:13:16 +05:30
lkyuchukov
79a0d3dac4 Don't log error when SendEmailNotifications is set to false (#20007)
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2022-04-29 14:45:24 +05:30
Agniva De Sarker
b6239243e7 MM-43848: Skip flaky TestUserStore/LocalCache+MySQL/UpdateUpdateAt (#20094)
https://mattermost.atlassian.net/browse/MM-43848
https://mattermost.atlassian.net/browse/MM-43871

```release-note
NONE
```
2022-04-29 13:47:26 +05:30
Martin Kraft
cb3d8f0a1c MM-41211: Replaces SessionLength*InDays with SessionLength*InHours. (#19838)
* MM-41211: Replaces SessionLength[Web|Mobile|SSO]InDays with SessionLength[Web|Mobile|SSO]InHours.

* MM-41211: Clear the value of the old config settings.
2022-04-28 17:31:35 -04:00
Nick Misasi
373c4655e6 [MM-43337] Updating email templates for trial will end and trial ended emails (#19976)
* Updating email templates for trial will end and trial will end emails

* put back variable

* Rebuilding

* fix tests

* Updates

* [MM-43339] Add Cloud Subscription Upgrade Confirmation Email (#19989)

* Add Cloud Upgrade Confirmation email

* Updates

* String change

* i18n-extract

* Updates

* make email-mocks

* Appease linter

* Add a test

* GMAIL NEVER RENDERS RIGHT

* Important EVERYWHERE because gmail just cant deal

* l

* Last one

* Update image

* Update tests

* Fix tests

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2022-04-28 10:06:16 -04:00
Michel Engelen
bb308b1a87 [MM-43393]: replace .Decoder() method with .Token() (#19988)
Automatic Merge
2022-04-27 19:27:06 +03:00
Mylon Suren
52ac449012 [MM-42739] Insights - Top Channels API Endpoint (#19953)
* [MM-42739] Initial setup for top channels for team

* [MM-42739] Add initial tests

* [MM-42739] Update tests

* [MM-42739] Add top channels for user

* [MM-42739] Fix query

* [MM-42739] Update query

* [MM-42739] Improve query performance

* [MM-42739] Remove rank

* [MM-42739] Fix tests to use new time range today

* [MM-42739] Add tests for top channels for user

* [MM-42739] Add test for pagination

* Remove top channels by time struct

* [MM-42739] Update test names

* [MM-42739] Remove rank from top reactions

* [MM-42739] Return empty array instead of nil when result is empty

* [MM-42739] Add additional tests and update permissions check for teams

* [MM-42739] Add excluded channel tests for top reactions

* [MM-42739] Move insights to api4/insights and keep time range as string until required

* [MM-42739] Update queries only check DeleteAt after union

* [MM-42739] Improve query performance by using publicchannels table

* [MM-42739] Fix broken query after merge
2022-04-26 14:42:24 -04:00
Claudio Costa
92c5c256ef Allow per connection WebSocket broadcasts (#19993) 2022-04-22 15:53:42 +02:00
Jesse Hallam
5bd223c836 MM-43045: minimize JOIN Posts (#19934) 2022-04-19 17:06:31 -03:00
Agniva De Sarker
98e7bb9ee9 Bump golangci to use 1.18 (#20010)
https://mattermost.atlassian.net/browse/MM-42148

```release-note
NONE
```
2022-04-18 13:53:07 +05:30
Agniva De Sarker
c09c36ce5e MM-43448: Bump the CI to use Go 1.18.1 (#20005)
https://mattermost.atlassian.net/browse/MM-43448

```release-note
NONE
```
2022-04-18 12:12:44 +05:30
Kyriakos Z
b15cd9d29f MM-41565,MM-42473: fixes incorrect unread thread count (#19962)
* MM-41565,MM-42473: fixes incorrect unread thread count

The infamous "-1 unread threads" bug, was due to incorrectly counting
previous unread mentions and replies.

When we calculate the previous counts, we didn't take into account if
a thread was newly followed one or not. So when a user gets added to a
thread via a mention receives a WS event with the previous count values
calculated by subtracting "1" from the current count values.
In the result the webapp subtracts the previous values for the thread
from the total values of all threads for the user.

This is wrong since the user just followed the thread those previous values
should be 0. Which results into showing a negative value of unread
threads to the user.

This commit fixes this issue by zeroing the previous count values when
the user was not following the thread previously.

* Adds test, and addresses comments

* Changes test's description

* Removes unneeded assertion

* Empty commit just to re-build
2022-04-15 12:47:04 -04:00
Kyriakos Z
79e36d4596 [MM-41185]: new API to mark thread as unread (#19951)
* [MM-41185]: new API to mark thread as unread

Until now we mark a thread as read/unread by sending a timestamp to the
server. This created some issues when marking a thread as unread from a
post. We needed to send the post.create_at - 1 as a timestamp but we
didn't do so consistently.

This commit adds a new API to set a thread as unread by post id.
Making all clients agnostic of the timestamp, and thus solving consistency issues.

Endpoint: /api/v4/users/{user_id}/teams/{team_id}/threads/{thread_id}/set_unread/{post_id}

* Updates client.go adding SetThreadUnreadByPostId

* Guards endpoint behind read channel permission

* Returns status 400 if post_id not belong in thread

* Root post as post_id should be permitted
2022-04-15 10:55:47 +03:00
Ibrahim Serdar Acikgoz
6ab7cd0f1a jobs: add config cleanup job (#19987) 2022-04-15 10:31:10 +03:00
Mylon Suren
99f02fe96e [MM-42742] Add top reactions endpoint (#19850) 2022-04-14 13:09:35 -04:00
Agniva De Sarker
289bb9fa6f MM-43341: Skip TestImportImportUser (#19970)
* MM-43341: Skip TestImportImportUser

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

```release-note
NONE
```

* ignore lint

```release-note
NONE
```
2022-04-13 16:21:13 +03:00
Kevin Sicong Jiang
5cb31a114a MM-41909: Allow 1 char channel name (#19845)
* [ MM-41909 ] Allow 1 character channel names

Change minimal length to 1

* [ MM-41909 ] Fix localization string

* [ MM-41909 ] Modify condition to allow 1 char channel name

* [ MM-41909 ] fix formatting

* [MM-41909] Linting fix

* [MM-41909] Fix regex

* [MM-41909] Localization update

* [MM-41909] Attempt to fix test

Co-authored-by: Kevin Jiang <>
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2022-04-12 11:17:15 -04:00
Agniva De Sarker
053e92a683 MM-43252: Skip TestPreparePostForClient (#19959)
https://mattermost.atlassian.net/browse/MM-43252

```release-note
NONE
```
2022-04-12 08:43:01 +05:30
Michel Engelen
ca8aea9a06 [MM-41993]: fixed counting thread mentions in unread root post (#19874)
* removed appending the root post to the posts list

also changed `UpdateAt` to `CreateAt` in thread_store.go in accordance with kyriakos

* fixed failing test after latest change

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2022-04-11 12:43:14 -04:00
Agniva De Sarker
7f0d1cf0dd MM-43144: Add teams loader (#19960)
```release-note
NONE
```

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2022-04-11 20:51:33 +05:30
Agniva De Sarker
16b1cbd6e3 spelling (#19956)
* spelling: activated

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: attachments

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: categories

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: category

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: cellspacing

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: channel

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: compliance

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: constraint

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: counts

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: createat

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: deactivate

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: destination

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: exceeded

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: failed

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: foreign

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: hours

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: inactivity

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: inappropriate

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: initialization

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: initialized

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: management

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: mismatch

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: recipients

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: scheme

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: signature

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: subscription

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: suggestions

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: sync

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: telemetry

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: webhook

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* Trigger CI
```release-note
NONE
```

Co-authored-by: Josh Soref <jsoref@users.noreply.github.com>
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2022-04-11 19:31:19 +05:30
Agniva De Sarker
d1de4857aa MM-43145: channels loader (#19957)
Add channels dataloader

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

```release-note
NONE
```
2022-04-11 13:41:09 +05:30
Pablo Andrés Vélez Vidal
4b354685e9 MM-39058 - invite people to join team and channels (#19849)
* MM-39058-invite-to-team-from-add-channel

* fix tests by validating the memberInvite is not nil

* fix i18n texts

* fix lint problem

* fix translation lines

* fix the data structure

* modify api4-team_local file to match with the expected structure

* fix unit tests, fix translation tests

* remove go routine cause not necesary

* add unit test for invite to team and channel

* remove unnecessary validation

* allow both data structures, simple string array and object with memberInvite struct

* fix texts

* fix linter

* fix problems with graceful invites workflow

* handle error while parsing body

* fix unit tests

* take the address just once

* rename channels to channelIds

* fix unit tests

* add tests and fix local channels invite support

Co-authored-by: Pablo Velez Vidal <pablo.velez@mattermost.com>
2022-04-08 12:20:44 -05:00
Agniva De Sarker
ba2f116ed1 Bump tool dependencies (#19946)
```release-note
NONE
```
2022-04-08 12:16:38 +05:30
Ibrahim Serdar Acikgoz
54cb6d889f app: add channels wrapper (#19861) 2022-04-08 08:59:37 +03:00