This repository has been archived by the owner on Sep 11, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 833
Use semantic headings in user settings - Ignored users #11006
Merged
kerryarchibald
merged 15 commits into
develop
from
kerry/24922/user-settings-headings-mjolnir
May 30, 2023
Merged
Changes from 14 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
0c1b0a4
account password section
aea0711
Merge branch 'develop' into kerry/24922/user-settings-headings-account
fb3e965
account email and phone numbers
c594adb
update cypress selectors
f5bcf63
use settingsection for General section
3546013
use semantic headings for profile settings
4189dd2
Merge branch 'develop' into kerry/24922/user-settings-headings-profile
92df4b4
fix show advanced spacing
96e18e9
Merge branch 'develop' into kerry/24922/user-settings-headings-profile
e7e00d6
udpate snapshot
9af71b9
use semantic headings in mjolnir settings
a474819
Merge branch 'develop' into kerry/24922/user-settings-headings-mjolnir
5046ccd
remove debug
07fa635
unit test UI changes for mjolnir settings
8a4a8a0
Merge branch 'develop' into kerry/24922/user-settings-headings-mjolnir
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
test/components/views/settings/tabs/user/MjolnirUserSettingsTab-test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* | ||
Copyright 2023 The Matrix.org Foundation C.I.C. | ||
|
||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
import React from "react"; | ||
import { render } from "@testing-library/react"; | ||
|
||
import { getMockClientWithEventEmitter, mockClientMethodsUser } from "../../../../../test-utils"; | ||
import MjolnirUserSettingsTab from "../../../../../../src/components/views/settings/tabs/user/MjolnirUserSettingsTab"; | ||
import MatrixClientContext from "../../../../../../src/contexts/MatrixClientContext"; | ||
import SettingsStore from "../../../../../../src/settings/SettingsStore"; | ||
|
||
describe("<MjolnirUserSettingsTab />", () => { | ||
const userId = "@alice:server.org"; | ||
const mockClient = getMockClientWithEventEmitter({ | ||
...mockClientMethodsUser(userId), | ||
getRoom: jest.fn(), | ||
}); | ||
|
||
const getComponent = () => | ||
render(<MjolnirUserSettingsTab />, { | ||
wrapper: ({ children }) => ( | ||
<MatrixClientContext.Provider value={mockClient}>{children}</MatrixClientContext.Provider> | ||
), | ||
}); | ||
|
||
it("renders correctly when user has no ignored users", () => { | ||
jest.spyOn(SettingsStore, "getValue").mockReturnValue(null); | ||
const { container } = getComponent(); | ||
|
||
expect(container).toMatchSnapshot(); | ||
}); | ||
}); |
170 changes: 170 additions & 0 deletions
170
test/components/views/settings/tabs/user/__snapshots__/MjolnirUserSettingsTab-test.tsx.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,170 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`<MjolnirUserSettingsTab /> renders correctly when user has no ignored users 1`] = ` | ||
<div> | ||
<div | ||
class="mx_SettingsTab" | ||
> | ||
<div | ||
class="mx_SettingsTab_sections" | ||
> | ||
<div | ||
class="mx_SettingsSection" | ||
> | ||
<h2 | ||
class="mx_Heading_h2" | ||
> | ||
Ignored users | ||
</h2> | ||
<div | ||
class="mx_SettingsSection_subSections" | ||
> | ||
<div | ||
class="mx_SettingsSubsection_text" | ||
> | ||
<span | ||
class="warning" | ||
> | ||
⚠ These settings are meant for advanced users. | ||
</span> | ||
<p> | ||
<span> | ||
Add users and servers you want to ignore here. Use asterisks to have Element match any characters. For example, | ||
<code> | ||
@bot:* | ||
</code> | ||
would ignore all users that have the name 'bot' on any server. | ||
</span> | ||
</p> | ||
<p> | ||
Ignoring people is done through ban lists which contain rules for who to ban. Subscribing to a ban list means the users/servers blocked by that list will be hidden from you. | ||
</p> | ||
</div> | ||
<div | ||
class="mx_SettingsSubsection" | ||
> | ||
<div | ||
class="mx_SettingsSubsectionHeading" | ||
> | ||
<h3 | ||
class="mx_Heading_h3 mx_SettingsSubsectionHeading_heading" | ||
> | ||
Personal ban list | ||
</h3> | ||
</div> | ||
<div | ||
class="mx_SettingsSubsection_description" | ||
> | ||
<div | ||
class="mx_SettingsSubsection_text" | ||
> | ||
Your personal ban list holds all the users/servers you personally don't want to see messages from. After ignoring your first user/server, a new room will show up in your room list named 'My Ban List' - stay in this room to keep the ban list in effect. | ||
</div> | ||
</div> | ||
<div | ||
class="mx_SettingsSubsection_content" | ||
> | ||
<i> | ||
You have not ignored anyone. | ||
</i> | ||
<form | ||
autocomplete="off" | ||
> | ||
<div | ||
class="mx_Field mx_Field_input" | ||
> | ||
<input | ||
id="mx_Field_1" | ||
label="Server or user ID to ignore" | ||
placeholder="eg: @bot:* or example.org" | ||
type="text" | ||
value="" | ||
/> | ||
<label | ||
for="mx_Field_1" | ||
> | ||
Server or user ID to ignore | ||
</label> | ||
</div> | ||
<div | ||
class="mx_AccessibleButton mx_AccessibleButton_hasKind mx_AccessibleButton_kind_primary" | ||
role="button" | ||
tabindex="0" | ||
type="submit" | ||
> | ||
Ignore | ||
</div> | ||
</form> | ||
</div> | ||
</div> | ||
<div | ||
class="mx_SettingsSubsection" | ||
> | ||
<div | ||
class="mx_SettingsSubsectionHeading" | ||
> | ||
<h3 | ||
class="mx_Heading_h3 mx_SettingsSubsectionHeading_heading" | ||
> | ||
Subscribed lists | ||
</h3> | ||
</div> | ||
<div | ||
class="mx_SettingsSubsection_description" | ||
> | ||
<div | ||
class="mx_SettingsSubsection_text" | ||
> | ||
<span | ||
class="warning" | ||
> | ||
Subscribing to a ban list will cause you to join it! | ||
</span> | ||
|
||
<span> | ||
If this isn't what you want, please use a different tool to ignore users. | ||
</span> | ||
</div> | ||
</div> | ||
<div | ||
class="mx_SettingsSubsection_content" | ||
> | ||
<i> | ||
You are not subscribed to any lists | ||
</i> | ||
<form | ||
autocomplete="off" | ||
> | ||
<div | ||
class="mx_Field mx_Field_input" | ||
> | ||
<input | ||
id="mx_Field_2" | ||
label="Room ID or address of ban list" | ||
placeholder="Room ID or address of ban list" | ||
type="text" | ||
value="" | ||
/> | ||
<label | ||
for="mx_Field_2" | ||
> | ||
Room ID or address of ban list | ||
</label> | ||
</div> | ||
<div | ||
class="mx_AccessibleButton mx_AccessibleButton_hasKind mx_AccessibleButton_kind_primary" | ||
role="button" | ||
tabindex="0" | ||
type="submit" | ||
> | ||
Subscribe | ||
</div> | ||
</form> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
`; |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No longer used anywhere