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

1634 Коммитов

Автор SHA1 Сообщение Дата
Claudio Costa
0509e78744 [MM-48523] Expose resumable uploads API to plugins (#21700)
* Expose resumable uploads API to plugins

* Update translations
2022-11-22 15:26:22 -06:00
Nick Misasi
a1e16f7b02 Call Cloud HandleLicenseChange when license is changed in Cloud (#21583)
* Call Cloud HandleLicenseChange when license is changed in a cloud context

* Remove UpdateSubscriptionFromHook as its no longer necessary

* Update mocks

* Remove another reference

* Remove translation

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2022-11-22 13:22:45 -05:00
Ben Cooke
76f7872a50 [MM-46692] Channel group member count (#21270)
* tools updates

* Revert "tools updates"

This reverts commit 6293297b55803c5a263e200ebd80192899666ae9.

* adding channel member count to groups request

* fixing models

* adding a new test

* removing unused var

Co-authored-by: Benjamin Cooke <benjamincooke@Benjamins-MacBook-Pro.local>
Co-authored-by: Benjamin Cooke <benjamincooke@Benjamins-MBP.ht.home>
Co-authored-by: Benjamin Cooke <benjamincooke@Benjamins-MBP.fritz.box>
Co-authored-by: Benjamin Cooke <benjamincooke@Benjamins-MacBook-Pro.fritz.box>
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2022-11-22 11:31:04 -05:00
Shivashis Padhi
ee40eb956c [MM-47384] Make OpenID Connect free for all (#21556)
* wip: make OpenID Connect free-for-all

* Deprecation note: GoogleOAuth, Office365OAuth

* Improve deprecation comments

Co-authored-by: Martin Kraft <martin@upspin.org>

* Lint fix

* Add model/oauthproviders, move google, openid, office365 from enterprise

* Vet fixes

* Remove redundant log

Co-authored-by: Martin Kraft <martin@upspin.org>
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2022-11-22 11:09:04 +05:30
Martin Kraft
fcd45de73b MM-48186: Add a new API endpoint to add a user to their default GroupChannels and GroupTeams. (#21591)
* MM-48186: Add a new API endpoint to add a user to their default GroupChannels and GroupTeams.

* MM-48186: Removed unrelated lint fixes.

* MM-48186: Removed variable from previous iteration.

* MM-48186: Adds translation.

* MM-48186: Not upgrading golang.org/x/text in this pr.

* MM-48186: Validate user ID and auth service.

* MM-48186: Use user id from struct.

* MM-48186: Added basic client test.

* MM-48186: Adds empty translation.

* MM-48186: Added translations.

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2022-11-21 13:36:41 -05:00
Ben Cooke
25bb1d0ebd [MM-47145] My Insights license change (#21443)
* tools updates

* Revert "tools updates"

This reverts commit 6293297b55803c5a263e200ebd80192899666ae9.

* remove license checks for my insights endpoints

* removing new config

* remove license checks from insights test

* adding some license tests for team endpoints

* fixing tests

Co-authored-by: Benjamin Cooke <benjamincooke@Benjamins-MacBook-Pro.local>
Co-authored-by: Benjamin Cooke <benjamincooke@Benjamins-MBP.ht.home>
Co-authored-by: Benjamin Cooke <benjamincooke@Benjamins-MBP.fritz.box>
Co-authored-by: Benjamin Cooke <benjamincooke@Benjamins-MacBook-Pro.fritz.box>
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2022-11-18 11:29:06 -05:00
Agniva De Sarker
06ad69a406 MM-47465: Fix flaky TestDeleteChannel (#21686)
Creating the post in a separate goroutine would create a race condition
because that method also calls GetChannel. This can cause a bug
if the cache was wiped before the the other goroutine would get
a chance to update the cache. And if that happens, then
it would populate the cache with the old value.

Pseudo-code

```
func deleteChannel() {
    go func() {
        getFromCache()
    }()
    updateDB()
    wipeCache() // a
}

func getFromCache() {
    err := checkCache()
    if err == ErrNotFound {
        getFromDB() // x
        updateCache() // y
    }
}

func Test() {
    deleteChannel()
    getFromCache()
}
```

If the sequence of events happen like
- x
- a
- y

Then the getFromCache() call later will get the wrong
value from cache.

The fix is to make the call synchronous.

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

Special thanks to @noxer for finding the root cause.

```release-note
NONE
```
2022-11-17 20:44:18 +05:30
Shivashis Padhi
5be8557247 [MM-44168] Add feature to restore archived user groups (#20369)
* Add undelete feature, add mocks, tests

* Rename undelete->restore

* make store-layers

* make app-layers

* Store -> Store()

* Lint fixes

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2022-11-17 14:53:54 +05:30
Alejandro García Montoro
10bdea85a5 Skip flaky test in TestRequestTrialLicense (#21665)
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2022-11-15 10:52:54 +01:00
Shota Gvinepadze
b9d00a1f28 Simplify thread_store/GetThreadForUser (#21588) 2022-11-09 12:16:20 +04:00
Ben Cooke
d855916c6e [MM-48049] Including users who were removed from group in not_in_group response (#21559)
Automatic Merge
2022-11-04 19:10:26 +02:00
Tim Scheuermann
8844ed1c1c [MM-48060] Added context for emoji (#21561)
Co-authored-by: Tim Scheuermann <tim.scheuermann@mattermost.com>
2022-11-03 08:54:59 +01:00
Nick Misasi
a541cda9d0 Invalidate cloud caches when a new license is loaded (#21579)
Automatic Merge
2022-11-02 22:40:26 +02:00
Zubair Ahmed
79e4959d02 Return empty list of channels when requesting more channels at the end of cursor (#21557) 2022-11-02 15:10:51 +05:30
Agniva De Sarker
0b7dd5b965 MM-46450: Enable skipped test (#21526)
After looking at this for some time, I don't see
any way for this test to fail other than model.NewId
returning the same value for BasicUser and BasicUser2.

I think edge cases like this can exist from time to time.
Nothing much we can do about it.

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

```release-note
NONE
```
2022-10-27 13:57:46 +05:30
Harrison Healey
b316e1384e Change status code to 400 when attempting to enable Boards plugin with product enabled (#21521) 2022-10-26 18:15:19 -04:00
Agniva De Sarker
0323e40d3c MM-46874: Change to 400 for failed to upgrade ws (#21492)
https://mattermost.atlassian.net/browse/MM-46874

```release-note
NONE
```
2022-10-26 13:15:16 +05:30
cyrilzhang-mm
a648ced221 [MM-42421] Prevent guests from seeing users through groups API (#21151) 2022-10-25 11:54:51 -04:00
Julian Mondragón
757c4e041a MM-46528_Verify Invitation Flow Tracking Telemetry (#21227) 2022-10-24 16:20:56 -05:00
Emmy Ni
eb67874cd6 Merge remote-tracking branch 'upstream/master' into MM-47560 2022-10-21 13:08:59 -04:00
Emmy Ni
2bed35ec1c update recurring_interval values 2022-10-21 12:59:29 -04:00
Emmy Ni
e9b34ee037 fix tests 2022-10-21 10:23:31 -04:00
cyrilzhang-mm
093c657e56 [MM-45052] Add error checking in insights API (#21048) 2022-10-20 14:37:24 -04:00
Pablo Andrés Vélez Vidal
c39c05e93c Replace 500 errors with more meaningful error codes (#21439)
* Replace 500 errors with more meaningful error codes

* replace forbidden with badrequest for cloud customer fetch, rename parameter name
2022-10-20 16:01:15 +02:00
Shivashis Padhi
312bf283a8 [MM-47538] Pass handler functions directly while creating API endpoints (#21441)
* Pass handler functions directly without permission check middlewares

* Create necessary handlers in api4/group_local.go

* Refactor GetGroupsByTeam, GetGroupsByChannel to a common function for local and API
2022-10-20 10:08:09 +05:30
Ibrahim Serdar Acikgoz
6aec81eb6e add nil check for license manager (#21364) 2022-10-18 13:30:22 +03:00
Agniva De Sarker
21bf5b5dd5 MM-47465: Skip flaky TestDeleteChannel (#21392)
https://mattermost.atlassian.net/browse/MM-47465

```release-note
NONE
```
2022-10-14 16:11:45 -04:00
Agniva De Sarker
c57706e6f4 GraphQL: Remove channel stats from the API (#21377)
Channel Stats isn't optimized with dataloaders.

And it's a heavy call, therefore clients
can mistakenly call this with multiple channels
and bring down the server.

Since there is no advantage compared to a REST API,
let's just remove it and keep things safe.

```release-note
NONE
```
2022-10-14 14:17:43 +05:30
Agniva De Sarker
279c448da3 MM-36295: Do not convert thumbnails/previews to jpeg for png images (#21230)
We were applying a white background to transparent images
and converting them to jpegs. This was to make text be legible
behind a black preview background.

However, this has led to a poor user experience, as users rarely
download the full image but always click on previews. Therefore,
we need the previews to remain as pngs.

To fix this, we just re-encode them as pngs instead of jpgs.

```release-note
NONE
```
2022-10-11 19:04:09 +05:30
Agniva De Sarker
9bf94bf6c1 MM-47249: Blocklist focalboard plugin in product mode (#21243)
We prevent the plugin from starting if in product mode,
and also give pretty errors to make it clear to the users.

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

```release-note
NONE
```

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2022-10-08 10:21:22 +05:30
Pablo Andrés Vélez Vidal
9a804a96fe MM-47228 - restrict guest invitation flow if subscription plan does n… (#21195)
* MM-47228 - restrict guest invitation flow if subscription plan does not support it

* fix i18n texts and add unit test

* test the scenario where guest invites are blocked by subscription

* cover the success scenarios for cloud free trial and paid subscription

* fix go vet

* use the cloud prefix for the sku

* fix unit tests

* check the licence value to determine if the guest accounts are enabled

* remove unnecessary changes for getting the subscription information

* restrict user demotion if guestAccounts is not available in license

Co-authored-by: Pablo Velez Vidal <pablo.velez@mattermost.com>
2022-10-07 15:57:44 +02:00
Ibrahim Serdar Acikgoz
5e69c6b02f Move cluster, webhub and store out of Server (#20899) 2022-10-06 11:04:21 +03:00
Nathaniel Allred
7186689f54 Mm 46065 (#20893)
* if thread is archived, allow the archived time to be returned instead of throwing an error
2022-09-30 13:20:26 -05:00
Michael Kochell
15b5b1c191 Avoid counting top channel posts for posts made by plugins and OAuth apps (#20943)
* add from_integration prop to oauth posts to:
- oauth app posts
- plugin posts
- slash command responses
- incoming webhook posts

* tests

* include check for bot posts

* use from_plugin and from_oauth_app props

* fix test

* avoid counting top channel posts for posts made by plugins and oauth apps
2022-09-30 04:12:15 -04:00
cyrilzhang-mm
aee1600d49 [MM-42400] Prevent making groups with reserved names (#21040) 2022-09-29 09:23:27 -04:00
Vishal
f5f036d94b [MM-44489] Cloud limits: enforcing files (#20703)
* Update last accessible file time

* Filter fileInfos

* Set inaccessible header

* Fix lint issue

* Fix lint issue

* Fix i18n

* add nil check

* Fix merge conflicts

* Add helper functions to clear out inaccessible files content

* Remove content for inaccessible files

* Fix typo

* wip

* Remove InaccessibleContent field, instead use Archived

* Add store tests

* Add tests

* Add separate funcs to ignore cloud limits

* Use separate query for MySql

* Use GetReplicaX

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2022-09-28 12:52:53 -04:00
Orlando Romo
b9834a2fc2 [MM-42191]: Include deleted posts (#19985)
* MM-42191: Include deleted posts: Add includeDeleted query parameter for getPostsForChannel

* MM-42191: Fix error typo for includeDeleted query parameter

* MM-42191: Include deleted posts: Set permission error when deleted posts are requested by non system admins

* MM-42191: Include deleted posts: Refactor replyCountSubQuery and conditions when includeDeleted is not presented, refactor getRootPosts

* MM-42191: Include deleted posts: Refactor getRootPosts function along with skipFetchThreads and includeDeleted

* MM-42191: Include deleted posts: Rename includeDeleted to include_deleted param

* MM-42191: Include deleted posts: Fix failed posts unit tests

* MM-42191: Include deleted posts: Add missing include deleted option in multiple queries

* MM-42191: Include deleted posts: Add tests for include deleted option in TestGetPostsForChannel, TestGetPostsBefore, TestGetPostsAfter

* MM-42191: include deleted posts: Add tests cases for post store test

* MM-42191: Include deleted posts: Add extra unit test to ensure not returning deleted posts when IncludeDelete is false

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2022-09-27 14:00:42 -04:00
Mattermod
99c9957fcf Merge branch 'master' into MM-45580-notify-admin-delinquency-update-billing 2022-09-13 14:35:21 +03:00
Said Atrahouch
10ae097589 [MM-45580] Send deliquency since to end users and allow new notify admin request 2022-09-12 17:39:17 +02:00
Shivashis Padhi
38aaa9e3d3 [MM-46603] P1 - Improvements in handling '0 posts' channels (#20905)
Automatic Merge
2022-09-09 20:34:00 +03:00
Shivashis Padhi
8b328386c5 MM-46911: P1 - Fix MySQL query to filter bots out of TopDM (#20965)
Automatic Merge
2022-09-09 18:34:00 +03:00
Daniel Espino García
56bf9cec50 Add missing field "sortOrder" to graphQL schema (#20956)
* Add missing field "sortOrder" to graphQL schema

* Add test

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2022-09-08 09:30:53 +02:00
Agniva De Sarker
1fc5fcd900 MM-46911: Skip flaky TestGetTopDMsForUserSince (#20962)
https://mattermost.atlassian.net/browse/MM-46911

```release-note
NONE
```
2022-09-08 11:43:49 +05:30
Shivashis Padhi
4ffdf6b859 [MM-46667] P1 Fix top DM insights pagination (#20896)
Automatic Merge
2022-09-07 23:34:01 +03:00
Agniva De Sarker
f67c7cbbdf MM-46902: Skip TestFileinfosForPost (#20955)
https://mattermost.atlassian.net/browse/MM-46902

```release-note
NONE
```
2022-09-07 09:31:20 +05:30
Agniva De Sarker
a0ab03a31e MM-46869: Fix channel props not appearing in GraphQL (#20944)
The props map was being null, but the schema did not
allow nulls. Therefore, the whole response was being
set to null. There was no error which created more
confusion.

To avoid making the property nillable, which would
mean sending pointers to maps, we just create
empty maps if they are nil.

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

```release-note
NONE
```
2022-09-07 08:38:41 +05:30
Agniva De Sarker
696b9e0872 Optimize CI test runtime
This PR makes 2 main changes to the tests:
1. User logins were a huge part of the total CPU time because of the constant hashing of the password. There were 3 logins every time for every `Setup()` call. We remove the `LoginSystemManager` from the Setup call as it wasn't used in a lot of tests, and call that as needed.
2. We add the new app migrations that got added after the last preload optimization was done.

This shaves off around 3 mins from the test runtime. They are down from ~18m to ~15m.

```release-note
NONE
```

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2022-09-06 13:55:06 +05:30
Allan Guwatudde
bd42f0cd8c [MM-45564] - Notify Admin v2 (#20777)
* [MM-45564] - Notify Admin v2

* add dummy data

* update dummy data

* add store methods

* experiment with recurring task

* complete saving of the notification

* make improvements

* make improvements

* add store layer tests

* fix lint

* update store layer tests

* add app layer unit tests

* add store layers

* add app layer tests

* fix lint

* fix lint

* fix tests

* fix tests lint

* fix lint

* fix lint

* fix retry layer test

* add notifications manual trigger

* filter notifications based on current plan

* add test case

* temp change

* feedback impl

* fix translations

* change job scheduler

* refactor job

* fix store layer tests

* extract i18n

* fix lint

* fix translations

* fix translations

* add license statement for new file

* feedback impl-2

* fix lint

* update make file

* add intl ids

* improve

* fix lint

* feedback impl

* move code and rename files

* fix lint

* feedback impl

* add config for trigger notifications api

* fix tests

* tmp change

* undo temp changes

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2022-09-02 13:52:48 +03:00
Kyriakos Z
c11ad8995f Adds OmitConnection parameter to broadcast (#20723)
* Adds OmitConnection parameter to broadcast

Currently we have no means to omit sending a websocket event to a
specific connection id.
This is needed mainly so that the initiator won't receive an event for
the action it just initiated.
Will be used for the global drafts feature, so that we won't update
drafts through ws when a user is typing.

This commit adds OmitConnection to the Broadcast struct and to the
NewWebSocketEvent function signature.
shouldSendEvent should return false for that specific connection.

* Return early only if connection id matches the omitted

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2022-09-02 13:17:22 +03:00
Agniva De Sarker
c72e9131f4 MM-46577: Remove empty translation strings (#20876)
We replace the empty translation key with <untranslated>
which is ignored by the translation check tool.

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

```release-note
NONE
```
2022-08-25 19:59:16 +05:30