This repository was archived by the owner on Sep 11, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 809
MSC3531 - Implementing message hiding pending moderation #7518
Merged
Merged
Changes from 1 commit
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
1b2b353
MSC3531 - Implementing message hiding pending moderation
Yoric 91171c2
WIP
Yoric 0fc9e2b
FIXUP: i18n
Yoric f6a26aa
WIP
Yoric 2b550c1
FIXUP: Clarifying class name/method name
Yoric 0324938
FIXUP: i18n, this time after nuking all dependencies
Yoric fd04cb3
Refactoring MSC3531 to better handle reply-to and possibly other corn…
Yoric 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 hidden or 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 hidden or 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 hidden or 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,37 @@ | ||
| /* | ||
| Copyright 2020 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. | ||
| */ | ||
|
|
||
| .mx_HiddenBody { | ||
| white-space: pre-wrap; | ||
| color: $muted-fg-color; | ||
| vertical-align: middle; | ||
|
|
||
| padding-left: 20px; | ||
| position: relative; | ||
|
|
||
| &::before { | ||
| height: 14px; | ||
| width: 14px; | ||
| background-color: $muted-fg-color; | ||
| mask-image: url('$(res)/img/element-icons/hide.svg'); | ||
|
|
||
| mask-repeat: no-repeat; | ||
| mask-position: center; | ||
| mask-size: contain; | ||
| content: ''; | ||
| position: absolute; | ||
| top: 1px; | ||
| left: 0; | ||
| } | ||
| } | ||
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,55 @@ | ||
| /* | ||
| Copyright 2020 - 2021 The Matrix.org Foundation C.I.C. | ||
|
Yoric marked this conversation as resolved.
Outdated
|
||
|
|
||
| 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 { MatrixEvent } from "matrix-js-sdk/src/models/event"; | ||
|
|
||
| import { _t } from "../../../languageHandler"; | ||
| import { IBodyProps } from "./IBodyProps"; | ||
|
|
||
| interface IProps { | ||
| mxEvent: MatrixEvent; | ||
| } | ||
|
|
||
| /** | ||
| * A message hidden from the user pending moderation. | ||
| * | ||
| * Note: This component must not be used when the user is the author of the message | ||
| * or has a sufficient powerlevel to see the message. | ||
| */ | ||
| const HiddenBody = React.forwardRef<any, IProps | IBodyProps>(({ mxEvent }, ref) => { | ||
| let text; | ||
| const visibility = mxEvent.messageVisibility(); | ||
| switch (visibility.visible) { | ||
| case true: | ||
| throw new Error("HiddenBody should only be applied to hidden messages"); | ||
| case false: | ||
| if (visibility.reason) { | ||
| text = _t("Message pending moderation: %(reason)s", { reason: visibility.reason }); | ||
| } else { | ||
| text = _t("Message pending moderation"); | ||
| } | ||
| break; | ||
| } | ||
|
|
||
| return ( | ||
| <span className="mx_HiddenBody" ref={ref}> | ||
| { text } | ||
| </span> | ||
| ); | ||
| }); | ||
|
|
||
| export default HiddenBody; | ||
This file contains hidden or 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 hidden or 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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.