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

3204 Коммитов

Автор SHA1 Сообщение Дата
Ibrahim Serdar Acikgoz
f31380f577 product/hooks: hooks service no longer requires channels service start (#21861) 2022-12-15 12:29:33 +03:00
Ibrahim Serdar Acikgoz
8d90c7042f [MM-48883] Remove app package dependency for products (#21853) 2022-12-14 15:24:04 +03:00
Tim Scheuermann
61317883bf Allow S3 uploads without a timeout for exports (#21774) 2022-12-13 20:36:40 +01:00
Nathaniel Allred
a8fa3f29e9 Self-hosted in-product purchase (#21804)
* Self-hosted admins can purchase licenses in-app when `ServiceSettings,SelfHostedPurchase` is true (the default)
* Content Security Policy enables loading assets from `js.stripe.com/v3` when `ServiceSettings.SelfHostedPurchase` is true (the default).
* Add `hosted_customer` API subpath
* Add status of SelfHostedPurchase to telemetry config report.
* Support showing admins self-hosted invoices when `ServiceSettings.SelfHostedPurchase` is true (the default)

Co-authored-by: Conor Macpherson <116016004+ConorMacpherson@users.noreply.github.com>
2022-12-13 13:36:18 -06:00
Claudio Costa
6fd174a95f [MM-48946] Fix read after write issue when uploading data (#21868)
* Fix read after write issue when uploading data

* Prefer request.CTX interface
2022-12-13 11:47:05 -06:00
emmyni
4cd205027c [MM-48091]: Remove is_paid_tier (#21850) 2022-12-13 08:57:46 -05:00
Tim Scheuermann
731c81cd10 [MM-46417] Added more logging to the import (#21764) 2022-12-12 21:56:45 +01:00
Agniva De Sarker
9ab1d8f805 MM-48984: Add missing timeout while creating a connection (#21847)
If a timeout is missing, this goroutine waits indefinitely trying
to get a connection. Leading to a goroutine accumulation in a scenario
where the DB is somehow not release connections.

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

```release-note
NONE
```

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2022-12-12 14:59:47 +05:30
Alejandro García Montoro
3b043c1f12 Skip "block user by domain but allow bot" test (#21841)
See https://mattermost.atlassian.net/browse/MM-48973 for more details.
2022-12-09 11:03:03 +01:00
Ibrahim Serdar Acikgoz
fc31b1713e [MM-48947] app/platform: do not restart metrics on every config save (#21831) 2022-12-09 08:28:22 +03:00
emmyni
a0fe5014a9 [MM-48649]: Call the SendSubscriptionHistoryEvent function in a GO routine (#21836) 2022-12-08 17:07:34 -05:00
Agniva De Sarker
7606fd9725 MM-48651: Log error while queuing telemetry (#21821)
We didn't use to handle the error returned from the Enqueue
method. We fix that.

Additionally, we add a verbosity flag that can allow us to
look into verbose logs from the rudder client. This can
help us to debug issues regarding telemetry not being sent.

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

```release-note
NONE
```
2022-12-08 21:25:00 +05:30
Mylon Suren
8c206c1fd4 [MM-48921] Don't return error when deleting Draft if Draft DNE (#21818)
* set global drafts feature flag to true

* Don't return error on deleteDraft when draft doesn't exist in server

* undo accidental feature flag change

* address comments

* change log level to debug

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2022-12-08 09:40:14 -05:00
Kyriakos Z
8d554a3621 Fixes wrong err check (#21823)
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2022-12-08 15:00:39 +02:00
Ibrahim Serdar Acikgoz
d8e2859b0b Minimize app dependency on platform service (#21548) 2022-12-07 20:31:03 +03:00
Ibrahim Serdar Acikgoz
617c024476 app: avoid plugin env check for RunMultiHook and use pluginslock while accessing plugin env (#21803)
* app/channels: use pluginslock while accessing plugins environment

* when using RunMultiHook we don't need to do a nil check on plugin env

* trigger ci
2022-12-07 10:00:47 +03:00
Michael Kochell
c3c81cb3d6 MM-48120/MM-48623 Patch plugin bundle react-dom on webapp extract (#21171)
Automatic Merge
2022-12-06 19:44:48 +02:00
Ibrahim Serdar Acikgoz
43e26ccda2 MPA: move product hooks out of plugins environment (#21772)
* product: add new hooks manager for porducts

* move product hooks out of plugins environment

* add hooks for plugin
2022-12-05 20:16:35 +01:00
emmyni
9e79ca7160 [MM-48472]: Update the Upgrade Confirmation Email for yearly subscriptions (#21766) 2022-12-05 12:10:00 -05:00
Konstantinos Pittas
3059abdd88 [MM-44765] Add API method for getting post's information from permalink (#21518)
* add api for getting post's information

* add information about current user state

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2022-12-05 16:04:44 +02:00
Shivashis Padhi
0c64252c9f [MM-48521] Fix for batch notification email not rendering properly (#21736)
* Add MessageAttachment field to postdata while rendering batched email notifications

* Add test for SlackAttachments body generator

* Add context to changes

* Add license text to new test file

* Use app/email/notification_email.go as single source for attachment generation
2022-12-05 16:47:28 +05:30
Shivashis Padhi
ed3f3fec46 [MM-43850] Separate leave_team events for associated user and team (#21231)
* Separate leave_team events for associated user and team

* Remove unnecessary change of sending mode

* Remove redundant get, set of message.broadcast

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2022-11-30 11:53:16 +05:30
Julien Tant
3e928f57fb [MM-48031] Work template read API (#21661) 2022-11-29 14:53:03 -07:00
Kyriakos Z
a240cd53eb MM-48614: saves priority for drafts (#21752)
* MM-48614: saves priority for drafts

Adds a new column in the drafts table, "priority".
This way we can save post's priority in the draft.

Fixes OmitConnectionId, which when you published a ws event for a user
was getting bypassed.

Fixes Get for drafts returns deleted ones as well, which is needed for
upsert.

* Adds test case for the OmitConnectionId

* Addresses review comments, removes DeleteAt

* Vets

* Adds missing translation

* Re-instates DeleteAt column

* Adds separate case to get draft including deleted

* Fixes Update Draft

* Empty
2022-11-29 23:36:47 +02:00
emmyni
2455de99ff [MM-47565]: In product true up for yearly products (#21704) 2022-11-29 11:47:51 -05:00
emmyni
cfa008e9c3 [MM-48097]: Delinquency Email Spacing/Wording Changes (#21740) 2022-11-28 14:46:48 -05:00
Tim Scheuermann
6965585aa8 [MM-48391] Store the server info in the export version line (#21709) 2022-11-28 17:35:47 +01:00
Martin Kraft
3e7a8d8426 MM-48181: Invalidate cache to reflect permissions changes from a team scheme. (#21735)
* MM-48181: Bust the allChannelMembersForUserCache when assigning a team scheme.

* MM-48181: Tests cache fix.
2022-11-28 11:18:17 -05:00
Martin Kraft
98a14c8c55 gofmt fixes. (#21742) 2022-11-28 11:16:47 -05:00
Miguel de la Cruz
e031b16b16 Adds support for clustered websocket messages for products (#21737)
* Adds support for clustered websocket messages for products

* Update app/cluster_handlers.go

Co-authored-by: Ibrahim Serdar Acikgoz <serdaracikgoz86@gmail.com>

Co-authored-by: Ibrahim Serdar Acikgoz <serdaracikgoz86@gmail.com>
2022-11-25 18:02:30 +01:00
Ibrahim Serdar Acikgoz
372653a921 Revert "app/pluginservice: move plugin out from the Channels product (#21697)" (#21725)
This reverts commit 6c55c4d356.
2022-11-24 19:22:36 +05:30
Martin Kraft
a05dd722ed New isrole replacement (#21688)
* Adds new function to use in place of isRole that includes team and channel schemes.

* Adds tests. Fixes code.

* Adds warning to isRole.

* Fixes phrasing.

* Added more docs.

* Moved from strings to constants.

* Added some spacing and improved some comments.

* Renames some functions.

* Rename isNotRole to isNotExactRole. Add a new isNotRole function.

* Switch to only checking prefix.

* Ignores unused function warning.

* Lint fix.

* Switch from unused to deadcode.

* Adds test for isNotRole.
2022-11-24 07:41:09 -05:00
Ibrahim Serdar Acikgoz
6c55c4d356 app/pluginservice: move plugin out from the Channels product (#21697) 2022-11-24 11:13:29 +03:00
Kyriakos Z
5e5769c4ee MM-45317: global drafts endpoints and ws events (#20614)
* MM-23881: global drafts endpoints and ws events

Adds endpoints:
- create/update drafts
- delete draft
- get drafts

Adds WS events:
- draft_updated
- draft_created
- draft_deleted

* Ordering and WS event name fixes

* Adds PostID to the drafts table

In the future the drafts will include edited posts, this commit adds the
post id in the combined pkey of the table.

* Fixes route for deleting a thread draft

* Fixes failed checks

* Fixes migrations

* Fixes migration

* Extract translation strings

* Removes PostID since we won't sync editing posts

* Fixes tests

* Fixes i18n

* Update migrations for global drafts

* update branch with latest master changes

* Add feature flag for global drafts

* Set global drafts feature flag default to true

* Added support for files in drafts

* Fix failing i18n check

* Added support for deleting files in drafts

* Revert "Added support for deleting files in drafts"

This reverts commit 45dfd04a760359de2e8814d652c9ef46daf994f6.

* Triggering new test server

* Add config setting 'AllowSyncedDrafts' for syncing drafts with server

* Triggering new test server

* Triggering new test server

* Add guard for config setting and add initial tests

* Fix i18n and lint errors

* Triggering new test server

* Add tests for drafts

* fix lint issues

* Add tests for model/draft

* Triggering new test server

* Triggering new test server

* Trigger new test server

* Address PR comments

* Change left join to regular join in GetDraftsForUser

* Fix broken test

Maybe consider adding an inclDeleted field if we want to get deleted drafts in the future

* fix translations

* Add store tests for drafts

* fix test naming

* remove comment

* update migrations

* set feature flag default to false

* update migrations

Co-authored-by: Mylon Suren <mylonsuren@gmail.com>
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2022-11-23 22:21:40 -05:00
Kyriakos Z
27db854089 MM-47750: Adds PostAcknowledgements table and apis (#21689)
* MM-46410: adds urgency on mention counts

We have introduced priority for posts in
https://github.com/mattermost/mattermost-webapp/pull/10951.
We do need to color the mention badges in the webapp with a prominent
color when a mention is posted in an urgent message.
A thread has urgent mentions if the root post is marked as urgent, and
the replies contain mentions to the user viewing the thread.

This PR adds two columns, urgentmentioncount, and isurgent, in
channelmembers, and threads tables respectively.
Furthermore when asking for team/thread mention counts, we also return
urgent mention counts for the user.

* Fixes method in tests

* empty commit

* Fixes method call

* Fixes single thread response is_urgent

* Fixes errors

* Fixes mysql migration and adds graphql schema

* Fixes tests

* Refactors IsUrgent and Adds PostsPriority table

Changes:
- removes is_urgent from the threads table
- adds a new table to hold posts priorities
- refactors priority out of the props and into the new table

* Fixes

* Adds translation strings

* Fixes migrations and tests

* Fixes tests

* empty

* Adds Priority to Copy

* empty

* Fixes priority not saved when boards is enabled

We are nilifying Metadata when post.ForPlugin(), which didn't save Priority
for a post when Boards was enabled.
This commit copies metadata again to the post, so metadata are
reinstated.

* Fixes tests

* Adding store tests and fixes syntax error

* Uses threads.ThreadTeamId

* Fixes error

* Adds UrgentMentionCount in graphql api test

* Fetches post priority in batches

* Addresses review comments

* Restore only priority on create post

* Fixes tests

* Nits

* Some refactoring

* Fixes get thread options when post priority enabled

* Adds missing translation

* Use the constant instead of "urgent" string

* Renames urgent constant

* MM-47750: Adds PostAcknowledgements table and apis

- Adds post acknowledgement api/app/store methods to be able to save and
delete post acknowledgements by users.
- Adds wesbsocket events for acknowledgement created/deleted
- Returns post acknowledgements in the post's metadata

* Empty

* Fixes incorrect urgent count when marking a post as unread

* Adds license

* Fixes ACK api, and adds tests

* Fixes vet

* Fixes tests

* Addresses review comments

* Remove unnecessary lines

* Adds config option and changes return of delete ack

* Empty

* Empty

* Enable config by default

* Fixes intl

* Fixes test after setting config default true

* Changes endpoints to PostForUser

* Avoids replica lag

* Fixes error in merge

* Fixes RetryLayer tests due to merge

* Empty

* Empty

* Empty

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2022-11-23 19:41:23 -05:00
Kyriakos Z
c44d37629a MM-46410: adds urgency on mention counts (#20999)
* MM-46410: adds urgency on mention counts

We have introduced priority for posts in
https://github.com/mattermost/mattermost-webapp/pull/10951.
We do need to color the mention badges in the webapp with a prominent
color when a mention is posted in an urgent message.
A thread has urgent mentions if the root post is marked as urgent, and
the replies contain mentions to the user viewing the thread.

This PR adds a column, urgentmentioncount, in channelmembers.
Furthermore when asking for team/thread mention counts, we also return
urgent mention counts for the user.

Adds a new table to hold posts priorities
Refactors priority out of the props and into the new table

We are nilifying Metadata when post.ForPlugin(), which didn't save Priority
for a post when Boards was enabled.
This commit copies metadata again to the post, so metadata are
reinstated.

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Co-authored-by: Vishal Choudhary <vish9812@gmail.com>
2022-11-23 21:08:21 +02:00
Nick Misasi
ff1ea0599e [MM-48560] LastAccessiblePostTime not removed on upgrade to Professional (#21708)
* Delete system value for LastAccessibleFileTime and LastAccessiblePostTime if the limits are 0 and a value is set

* Update tests
2022-11-23 14:06:29 -05:00
Javier Aguirre
7f419ea091 [MM-48542] Removing integration limits (#21282)
* Removing integration limits

* Remove freemium limit test

* Remove test assertion regarding cloud limits

* Remove GetIntegrationsUsage

* Removing integrations usage notifications

* This shouldn't be removed

* Removing client call and websocket event

* Remove old translations

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2022-11-23 10:42:23 +01:00
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
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
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
Shota Gvinepadze
98e685f07c Move Thread.GetPosts to PostStore.GetPostsByThread (#21633)
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2022-11-16 13:42:26 +04:00
Shota Gvinepadze
9f9e19e05d [MM-48161] Change data types for collections and topics (#21634)
* Change data types for collections and topics

* Address suggestions

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2022-11-15 00:57:04 +04:00
Shivashis Padhi
2171ad8abf [MM-46216] P3 Bugfix - Oauth redirectURI with query parameters generates malformed redirect URL (#20854)
* Parse and reconstruct URI, instead of using string concatenation

* Rename parse error, add test

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2022-11-14 10:27:47 +05:30
Shota Gvinepadze
b9d00a1f28 Simplify thread_store/GetThreadForUser (#21588) 2022-11-09 12:16:20 +04:00
Said Atrahouch
534a9bcbf0 Merge pull request #21507 from mattermost/mm-47415-email-templates-cloud-starter-to-free
[MM-47415] remove all mentions from Cloud Starter to Cloud Free
2022-11-08 14:46:59 +01:00
Tim Scheuermann
033bdd6f1a Fix unchecked request when saving channel (#21043) 2022-11-07 11:28:31 +01:00
Tim Scheuermann
b73bf144aa MM-47171 Export direct channel favorites (#21570) 2022-11-04 17:13:14 +01:00