* [MM-55334] Migrate `./components/admin_console/blockable_link/blockable_link.tsx` from Class Component to Function Component
* refactor: use prop destructuring
* fix: Implement useCallback to avoid unwanted renders
* refactor: import mouse event type from react
---------
Co-authored-by: Mattermost Build <build@mattermost.com>
* [MM-55332] Convert `./components/permissions_gates/channel_permission_gate/channel_permission_gate.tsx` from Class Component to Function Component
* refactor: unify the if conditions
---------
Co-authored-by: Mattermost Build <build@mattermost.com>
* Move notification preferences modal to new UI
* fix lint issue
* fix i18n
* fix unit test
* fix type issue and lint errors
* fix test case
* move common components to widget modals dir
* fix css issue
* feedback changes
* fix lint and i18n issues
* more feedback changes
* fix issue with mobile notification ui
* fix test
* clean up
* remove name
* fix test
---------
Co-authored-by: Mattermost Build <build@mattermost.com>
Load tests show that channelstore.GetMember and
channelstore.GetMembersForUser are among the chief
queries that take up CPU in the DB.
In this PR, we attempt some strategic optimizations to
reduce/optimize calls to channelstore.GetMember
1. Optimize `(a *App) HasPermissionToChannel`
We replace GetChannelMember with GetAllChannelMembersForUser
because it's cache backed. So although it gets more data,
it does not hit the DB and saves some latency.
2. Optimize getPostsForChannelAroundLastUnread
We repace getChannelMember with getChannelMemberOnly
which is a lite version of the store call which queries
just the ChannelMembers table. This is because
in the app layer, we just use the LastViewedAt attribute.
Therefore, there is no reason to join with 5 tables when
a single table can do the job.
3. Optimize publishWebsocketEventForPermalinkPost
We use GetAllChannelMembersById instead of GetChannelMembersPage
which again joins with a lot of other tables.
4. Optimize countMentionsFromPost
Again, we replace GetChannelMember which is a costly call joining
multiple tables, with GetAllChannelMembersNotifyPropsForChannel
which is cache-backed and gives us just what we need in the app
layer - notify props.
```release-note
Make small optimizations in several DB calls:
- App.HasPermissionToChannel
- getPostsForChannelAroundLastUnread
- publishWebsocketEventForPermalinkPost
- countMentionsFromPost
```
https://mattermost.atlassian.net/browse/MM-55295
---------
Co-authored-by: Mattermost Build <build@mattermost.com>
- Adds a new section under settings/notifications for adding custom multi-word keywords that get highlighted without notification
- Adds a new classname for highlighting words although the styling is the same as mentions highlights
- Added a few components to the ReduxFromProps pattern
- Adds supported type for the hook of PluginComponent type
- Add upsell for highlight without notification
- Moved 'setting_item.tsx' to the components folder
- Improved prop names and function structure for setting_item, setting_item_max and setting_item_min
- Moved 'toggle_modal_button.tsx' to the components folder
- Removed t and utility messages from a few components
- Fixed bug where the tooltip was not getting rendered on restrictedButtons
- Improved the mobile view of the settings modal
- Adds E2E for the feature
* Convert status_icon_new.tsx to functional component
* run the command run npm run fix and npm run test -- -u
* type check error fixed
* revised the changes
* Unintended changes revised.
* Revised changes
* map moved outside of component
---------
Co-authored-by: Mattermost Build <build@mattermost.com>
* [MM-52445] Fix double url encoding of oauth redirect URI params
* Additional test based on code review
---------
Co-authored-by: Mattermost Build <build@mattermost.com>
* Simplify workflow failure check
Consolidate the workflow failure check directly into *-master.yml. This results in some code duplication, but makes it much clearer as to what's going on. While we're in here, remove the legacy reference to the `monorepo` branch when triggering.
* just remove the workflow in favour of the Argo version
* Change renderWithFullContext to not mock Redux store
* Remove renderWithIntl and renderWithIntlAndStore
* Rename renderWithFullContext to renderWithContext
* Use renderWithContext for WS context
* MM-54238 Initial implementation
* MM-54238 Move websocket hook into app package
* MM-54238 Add tests for mentions in posted websocket messages
* Fix styling
* Fix other styling
* Idiomatic ID naming for new code
* Fix more styles
* Separate hooks to add mentions and followers
* Improved error handling for invalid types in hooks
* Rename HasChanges to ShouldProcess
* Pass broadcast hooks through hubStart
* Add test helper for asserting json unmarshaling
* Fix missing arguments in tests
* Ensure broadcast hooks are sent across the cluster and not to users
* Ensure tests actually cover following a post
* Fix code broken by merge
* Go vet again...
* Deep copy event before processing it with hooks
* Replace RemoveBroadcastHooks with WithoutBroadcastHooks
* Address feedback
* Add helper to fix type information for hook args
* Wrap WebSocketEvent and simplify BroadcastHook
* Address feedback
* Address feedback
* feat(channel-chat): MM-53360 Scroll to the bottom of channel chat
This commit adds new toast to the channel chat, which allows users to
scroll to the bottom quickly.
As it is needed to be along side with the `Search hint toast`, I needed
to adjust the code inside `hint_toast, toast_wrapper` more than
expected.
- [x] Updated tests/snapshots
* refactor(scroll-to-bottom): MM-53360 Replace if block => separated func
* style: MM-53360 Fix order of imports
* refactor(scroll-to-bottom): MM-53360 Simplify hideScrollToBottonToast
* test(scroll-to-bottom): MM-53360 Migrate test from enzyme to react test
This commit migrates unit tests from `enzyme` to `react-testing-library`.
Besides, it adds new test ids for testing purposes.
* fixup! test(scroll-to-bottom): MM-53360 Migrate test from enzyme to react test
* style: MM-53360 Fix eslint error
* style(hint_toast): MM-53360 Update style to match the design
Decrease the size, and increase the font-weight of the shortcut key.
See more at: https://www.figma.com/file/gbnx8ydTX0bTFIbJ8NWGfR/MM-53360-Scroll-to-bottom-of-chat?type=design&node-id=1101-21615&mode=dev
* feat(scroll-to-bottom): MM-53360 Change condition to show toast
- Hide the toast after clicking "Jump to recents".
- Do not show the toast if the user dismissed it before.
* fixup! feat(scroll-to-bottom): MM-53360 Change condition to show toast
---------
Co-authored-by: Mattermost Build <build@mattermost.com>
* update session roles from user roles.
* update so user is not retrieved again
* return error, rather than log warning
* Update session.go
Fix bad merge
---------
Co-authored-by: Mattermost Build <build@mattermost.com>
* feat: add log warn when app is run as root user
* Modify warning message
* Move warning message condition to L415
* move check to cmd/mattermost/main.go
* Update server/channels/app/server.go
Co-authored-by: Ben Schumacher <ben.schumacher@mattermost.com>
* Moved checkForRootUser to root.go
* format root.go
* remove unnecessary space
---------
Co-authored-by: Ben Schumacher <ben.schumacher@mattermost.com>
Co-authored-by: Mattermost Build <build@mattermost.com>
Marshalling a json.RawMessage is not zero overhead. Instead,
it compacts the raw message which starts to have an overhead
at scale.
https://github.com/golang/go/issues/33422
Since we have full control over the message constructed, we
can simply write the byte slice into the network stream.
This gives considerable performance boost.
```
goos: linux
goarch: amd64
pkg: github.com/mattermost/mattermost/server/public/model
cpu: Intel(R) Core(TM) i5-8265U CPU @ 1.60GHz
│ old.txt │ new_2.txt │
│ sec/op │ sec/op vs base │
EncodeJSON-8 1640.5n ± 2% 289.6n ± 1% -82.35% (p=0.000 n=10)
│ old.txt │ new_2.txt │
│ B/op │ B/op vs base │
EncodeJSON-8 528.0 ± 0% 503.0 ± 0% -4.73% (p=0.000 n=10)
│ old.txt │ new_2.txt │
│ allocs/op │ allocs/op vs base │
EncodeJSON-8 5.000 ± 0% 4.000 ± 0% -20.00% (p=0.000 n=10)
```
P.S. No concerns over changing the model API because we are
still using 0.x
https://mattermost.atlassian.net/browse/MM-54998
```release-note
Improve websocket event marshalling performance
```