* MM-27507: Propagate rate limit errors to client
We return an error from SendInviteEmails instead of just logging it
to let the client know that a rate limit error has happened.
The status code is chosen as 413 (entity too large) instead of 429 (too many requests)
because it's not the request which is rate limited, but the payload inside it which is.
Ideally, the email sending should have been implemented by a queue which would just return
an error to the client when full. That is also why we are not returning an X-Retry-After
and X-Reset-After in the headers because that would mix with the actual rate limiting.
A separate header X-Email-Invite-Reset-After might do the job, but it comes at an extra cost
of additional API surface and a clunky API. Instead, that information is contained in the error
response. The web client needs to just surface the error. An API client will have to do
a bit more work to parse the error if it needs to automatically know when to retry. Given that
an email sending client is not a very common use case, we decide to keep the API clean.
This decision can be revisited if it becomes problematic in the future.
https://mattermost.atlassian.net/browse/MM-27507
* Fixing translations
* Added retry_after and reset_after in API response.
* MM-26575: Move app initialization inside Websocket router out of handler
The websocket router struct is shared amongst multiple handlers. Therefore,
there is a race condition while setting the app field and reading from it.
We move the initialization of the app field when the router struct is initialized.
And we also remove the initializations of some app fields which caused race
conditions by being written from multiple goroutines. They are already being
written once inside the AppInitializedOnce.Do method and it's redundant
to set them again to the same value.
* Add missing fields in server connector
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
* Fix regression in HasPermissionToTeam
* Removing unessisary special case + verify system admins always have permissions.
* Fixing testing and bad cleanup.
* Fixing /test command.
* Add error handling to channels command.
* Switch to using app instead of client in some places.
* Fix lint being confused.
* Join channels automatically.
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Mobile users were having their sessions unexpectedly expired, despite having ServiceSettings.ExtendSessionLengthWithActivity enabled.
Every time a mobile app is opened it called `/api/v4/sessions/device` which calls attachDeviceId which calls `(*Session)SetExpireInDays`. This code above assumed the expiry should be relative to CreateAt which is incorrect when ExtendSessionLengthWithActivity is enabled. Therefore, every time the mobile app was opened, the maximum expiry was set in memory to CreateAt + session_length, even if the session was extended.
(*Session)SetExpireInDays is now deprecated and replaced with (*App)SetSessionExpireInDays which takes into account the ExtendSessionLengthWithActivity setting.
`(a *App) InitServer` was being called from multiple goroutines
and were modifying the fields of the App struct concurrently.
However, the fields were just reflecting the Server fields,
and we already have public getters for those fields.
Therefore, we remove those fields and just change the code to return
the server field directly.
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
* Add psd preview support
* Adding required vendor files
* Adding oov/psd license to NOTICE.txt file
* Adding the license notice for gopherjs to the NOTICE.txt
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
* Add team filters to search teams
Remove unneeded logs
Add team filters to search teams
* Use bool pointers for filters
Re-add include group constrained
Fix lint
Return the union of filters
* MM-27116: Drain push notification channel before closing
Without this, pending push notifications will not be sent when shutting down
or restarting the server.
* Fix race
* Re-arrange server shutdown
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
* MM-27187: Use the correct page offset for cache clear methods
We were just using page and incrementing by 1. This would fetch pages
one by one like (1-100, 2-102, 3-103) rather than (1-100,100-200,200-300).
We fix that to update the correct page offset.
* Trigger CI
Adds the advanced logging config for audit. Existing support for auditing to a single file remains for E0 and E10 licenses instances, and a new config item ExperimentalAuditSettings.AdvancedLoggingConfig is added that behaves like LogSettings.AdvancedLoggingConfig.
Supported destinations:
- file
- syslog (with out without TLS)
- raw TCP socket (with out without TLS)
ExperimentalAuditSettings.AdvancedLoggingConfig can contain a filespec to a config file, a database DSN, or JSON.
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Co-authored-by: Claudio Costa <cstcld91@gmail.com>
* MM-26410 Allow moving channels into Favorites when they're favorited in prefs
* MM-26410 Fix management of Favorites category when updating preferences
* MM-26410 Add management of Favorites category when deleting preferences
* Address feedback 1
* Remove WHERE (1=1) from query
* Remove unnecessary sq.Expr
* Rewrite query to use left join
* Remove redundant where statement and add some more tests
* Fix linting issues
* Rename addChannelToFavoritesCategory to addChannelToFavoritesCategory
* MM-26052: Translate footer text in invite emails
We pass the user locale instead of the default locale to translate
the footer text too.
* Use default server locale
* Migrate command webhook store AppError to error
* Migrate command webhook store AppError to error
* Migrate command webhook store AppError to error
* Migrate command webhook store AppError to error
* Migrate command webhook store AppError to error
* Migrate command webhook store AppError to error
* Migrate command webhook store AppError to error
* Changes requested in the review.
* Changing http status
* fix i18n
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Co-authored-by: Agniva De Sarker <agnivade@yahoo.co.in>