* Add DeleteSidebarCategory method and channel category API tests
* Add test to verify channels move to default categories when custom category is deleted
* rename channel category tests and remove duplicate context
* TestNotifications fix
---------
Co-authored-by: Fume <contact@fumedev.com>
Co-authored-by: Ben Schumacher <ben.schumacher@mattermost.com>
Co-authored-by: Mattermost Build <build@mattermost.com>
* Enable eslint-plugin-jsx-a11y and add standard rules as warnings or errors
* Fix jsx-a11y/anchor-has-content in BooleanSetting and add SettingSet
The invisible anchor was presumably supposed to let people jump from one
setting's help text to another setting. That didn't work for boolean
settings because there's no element with the ID of the setting. Instead
of an empty anchor, we needed to give something else that ID.
To improve the semantics of those settings, I also put those settings
into a fieldset with a legend containing the setting's label text
instead of using an actual label element as per how it's done on the
MDN. We'll probably end up using the SettingSet for other settings as
well.
Finally, I also fixed the link used by admin.service.useLetsEncryptDescription.disabled
to point to the right place and made it so that the link would open in
the current tab. Ideally, I'd also remove the Markdown from that help
text, but there's a lot here already.
* Fix jsx-a11y/anchor-has-content in CheckboxSetting
* Use SettingSet in PasswordSettings to improve semantics and layout
The main reason for doing this is to use a proper legend and fieldset
for these settings, but it also has the benefit of removing the extra
spacing from in between these settings.
* Change CopyText to use a button and require an aria-label for it
This fixes two ESLint warnings:
- This was failing jsx-a11y/anchor-has-content because it was an empty
anchor element. I fixed that by giving it an aria-label matching the
tooltip of the CopyText, but that required that the label was a string,
so I had to change how CopyText is used. I also made the label required
so that people give an accessible explanation of what is being copied.
- This was also failing jsx-a11y/anchor-is-valid because it should be a
button instead of a link. I applied the btn-link class and made it so
that that doesn't override the link's height which hopefully doesn't
cause problems anywhere else.
This is to fix jsx-a11y/anchor-has-content and jsx-a11y/anchor-is-valid
in the component. The ESLint plugin is complaining that this component
is using an anchor instead of a button element, so I changed that
* Turn jsx-a11y/anchor-has-content to be an error
* Update snapshots
* Remove lingering reference to nested prop which has been removed
* Changing system console password settings to a list and update padding for alerts in it
* Fix typo in SettingSet
* Update E2E tests to enable Elasticsearch by ID and remove duplicate enableElasticSearch helper
* Update E2E test to look for a legend instead of a label
* Fix typo in snapshot
After https://github.com/mattermost/mattermost/pull/29209, there were some more
strings which were left out. Sending another PR to fix all of them.
The config validation strings are made generic for simplicity, because they
are called before the search backend is started, and even though you could
check for the config setting, it forces the code order. Therefore, changed
the words to just say "Search" for simplicity.
I tried to use Aider initially for a little while, but ended up fighting
a lot with the search/replace and having to repeat myself over and over again
to get it to do the refactoring. Eventually gave up and did rest of the changes
myself.
```release-note
NONE
```
* reduce usage of Utils.localizeMessage
As we begin to transition to react-intl's `formatjs` for extraction, our custom wrappers like `Utils.localizeMessage` prevent an adoption roadblock.
This is the first in a series of PRs to begin to migrate away in favour of:
* `useIntl` when inside React functional component
* use `injectIntl` and use access the `intl` prop from class components
* use the new `getIntl`, leveraging a memoized `createIntl` and the store outside of React components
I'm pausing in this effort to get a feel from peers on both the substance of these changes and best practices in supporting them.
* prefer shallowWithIntl, renderWithContext, and local injectIntl wrapping
* revert unintentional whitespaces
* clarify getIntl, add minor unit test
* avoid triggering mmjstool
* update e2e tests
---------
Co-authored-by: Mattermost Build <build@mattermost.com>
This test failed because TestWebHubCloseConnOnDBFail failed
and therefore the ChannelMembers table failed to be
renamed back.
We can see that in the logs:
```
teams","request_id":"sdxjxsd1wibd9mb7kc3ixj6g1w","ip_addr":"127.0.0.1","user_id":"afw9qqjh7pnddqakraxnjf1oph","method":"POST","user_id":"afw9qqjh7pnddqakraxnjf1oph","team_id":"bocubwmn4jyrmc1p9uxrc4pwfc","error":"JoinDefaultChannels: Unable to save direct channel., channel_members_save: Error 1146 (42S02): Table 'dbrt3jzcosj3nb8g6mgwmqyss9rh.ChannelMembers' doesn't exist"}
{"timestamp":"2024-11-10 13:52:34.260 Z","level":"error","msg":"Error while invalidating channel member cache","caller":"platform/web_hub.go:524","user_id":"afw9qqjh7pnddqakraxnjf1oph","error":"failed to find ChannelMembers, TeamScheme and ChannelScheme data: Error 1146 (42S02): Table 'dbrt3jzcosj3nb8g6mgwmqyss9rh.ChannelMembers' doesn't exist"}
{"timestamp":"2024-11-10 13:52:34.260 Z","level":"error","msg":"Error while invalidating channel member cache","caller":"platform/web_hub.go:524","user_id":"afw9qqjh7pnddqakraxnjf1oph","error":"failed to find ChannelMembers, TeamScheme and ChannelScheme data: Error 1146 (42S02): Table 'dbrt3jzcosj3nb8g6mgwmqyss9rh.ChannelMembers' doesn't exist"}
```
There is nothing wrong with this test. And while
we are here, we slightly improve the for-select loop
to exit faster.
https://mattermost.atlassian.net/browse/MM-61699
```release-note
NONE
```
Finally I figured out why the log message for
/api/v4/websocket does not appear. It is because
the log gets generated only when the request returns,
and for websockets, the request doesn't return
until the client closes. And because we were closing
the client in a defer clause, the flushing of the logger
would happen before closing the client, therefore
leading to a race condition of the log not appearing
from time to time.
https://mattermost.atlassian.net/browse/MM-61698
```release-note
NONE
```
* feat: Migrate MM-53377 regression test from Cypress to Playwright
* fix: Update mm_53377 regression test to use admin client for setup
* fix: Correct admin client usage in mm_53377 regression test
* refactor: Standardize mm_53377 Playwright test with consistent naming and imports
* fix: Mark MM-T53377 test as fixme for investigation
* Migrating mm_53377_regression_test_spec.js cypress test to playwright
* Fixing linter errors
* Addressing PR review comment
* Fixing broken test
* feat: Migrate actions.js to TypeScript with type annotations
* feat: Migrate actions.js to TypeScript with correct action types
* feat: Add actions plugin for webapp channels
* feat: Migrate actions.js to TypeScript with type annotations
* feat: Add interactive dialog plugin for webapp channels
* feat: Migrate interactive_dialog.js to TypeScript with type definitions
* feat: Add export plugin module for webapp channels
* feat: Migrate export.js to TypeScript with type declarations
* feat: Add initial plugin index file for webapp channels
* feat: migrate plugins/index.js to TypeScript with type definitions
* test: Add export plugin test file
* feat: Migrate export.test.js to TypeScript with type assertions
* feat: Add emoji actions file to webapp channels
* feat: Migrate emoji_actions.js to TypeScript with full type support
* Fixing some issues
* Revert "feat: Migrate emoji_actions.js to TypeScript with full type support"
This reverts commit e64aabe9fc6d36938cbaa40b7acb3356729a6686.
* fixing linter errors
* Fixing CI
* Addressing pr review comments
* Apply suggestions from code review
Co-authored-by: Harrison Healey <harrisonmhealey@gmail.com>
* Fixing linter errors
* Fixing CI
---------
Co-authored-by: Harrison Healey <harrisonmhealey@gmail.com>
https://github.com/mattermost/mattermost/pull/29214 fixed the
race condition in web_hub initialization.
The failure in the test is strange because there's no log
for the websocket request. It's as if th.CreateWebSocketClientWithClient()
never got called at all.
I am re-arranging the lines so that even if it fails,
the table rename happens anyways. But overall, I don't see
any reason for the failure.
https://mattermost.atlassian.net/browse/MM-61698
```release-note
NONE
```
While investigating https://mattermost.atlassian.net/browse/MM-61529,
I noticed that we weren't adding the internal error which made
it impossible to understand what was really happening.
```release-note
NONE
```
I was planning to kick off a campaign for this. But aider can do this just fine.
Starting off with a single file for now. But will slowly send more PRs with larger
commit diffs.
```release-note
NONE
```
Co-authored-by: Mattermost Build <build@mattermost.com>
Drop the legacy `X` suffix from `GetMasterX` and `GetReplicaX`. The
presence of the suffix suggests there's a `non-X` version: but in fact
we migrated these away a long time ago, so remove the cognitive
overhead.
As an aside, this additionally helps avoid trip up LLMs that interpret
this as "something to fix".
We were incorrectly not broadcasting status cache updates
inspite of that being an LRU cache.
We were also not doing it for profilesInChannel cache.
Now we fix it by properly checking the invalidationEvent
which is something local to the cache itself rather
than the cache provider.
https://mattermost.atlassian.net/browse/MM-62077
```release-note
NONE
```
* Add dummy MMReduxAction type and use it in its ActionFunc types
* Use MMReduxAction in mattermost-redux reducers
I updated most reducers except for the following:
- I couldn't figure out how to type the request reducers because of
handleRequest, and it wasn't worth spending time on because it's
stable and we don't really use those.
- The typing reducers are weird because they use WS event names as
constants. They should be given their own action types separate from
the event names, and they probably shouldn't be in mattermost-redux.
There's also a few places that still use AnyAction, but those are for
helpers for individual reducers. In the future, we should probably pass
the data from the action directly into those.
* Add dummy MMAction type and use it in the web app ActionFunc types
* Use MMAction in web app reducers
* Re-export ActionFunc types from mattermost-redux from types/store
* Start using ActionFunc types from types/store instead of mattermost-redux
These are all the places where the type checker failed when I added the
web app version of ActionFunc. I'll move all the other files in a
separate commit.
* Use ActionFunc types from types/store everywhere outside mattermost-redux
* Make types/store versions of ActionFunc use web app GlobalState
* Stop passing GlobalState into ActionFunc explicitly
* Stop casting as GlobalState where it's no longer needed
* Prevent importing mattermost-redux version of ActionFunc in the rest of the app
* Fix no-restricted-imports applying incorrectly to mattermost-redux and types/store