* created selfhosted endpoint
* make autogenerated mocks
* add test
* add user id
* remove user id requirement
* add tests
* send user id with request
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
* 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>
* 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
* Honor the ShowEmailAddress setting for the `/api/v4/teams/[teamid]/regenerate_invite_id` and `/api/v4/users/me/teams` API paths. Fixes MM-47982 and MM-47983
* Fix linter error in test code
* 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>
* [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>
Co-authored-by: Martin Kraft <martin@upspin.org>
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Co-authored-by: Shivashis Padhi <shivashispadhi@gmail.com>
* 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>
* 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>
* 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>
* 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>
* 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>
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
```
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
```
* 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
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
```
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
```
* 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>
* 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