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
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Show a tile at beginning of visible history (#5887)
- Loading branch information
Showing
6 changed files
with
83 additions
and
4 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/* | ||
Copyright 2021 Robin Townsend <robin@robin.town> | ||
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_HistoryTile::before { | ||
background-color: $header-panel-text-primary-color; | ||
mask-image: url('$(res)/img/element-icons/hide.svg'); | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* | ||
Copyright 2021 Robin Townsend <robin@robin.town> | ||
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, { useContext } from "react"; | ||
import { EventTimeline } from "matrix-js-sdk/src/models/event-timeline"; | ||
|
||
import EventTileBubble from "../messages/EventTileBubble"; | ||
import RoomContext from "../../../contexts/RoomContext"; | ||
import { _t } from "../../../languageHandler"; | ||
|
||
const HistoryTile = () => { | ||
const { room } = useContext(RoomContext); | ||
|
||
const oldState = room.getLiveTimeline().getState(EventTimeline.BACKWARDS); | ||
const encryptionState = oldState.getStateEvents("m.room.encryption")[0]; | ||
const historyState = oldState.getStateEvents("m.room.history_visibility")[0]?.getContent().history_visibility; | ||
|
||
let subtitle; | ||
if (historyState == "invited") { | ||
subtitle = _t("You don't have permission to view messages from before you were invited."); | ||
} else if (historyState == "joined") { | ||
subtitle = _t("You don't have permission to view messages from before you joined."); | ||
} else if (encryptionState) { | ||
subtitle = _t("Encrypted messages before this point are unavailable."); | ||
} | ||
|
||
return <EventTileBubble | ||
className="mx_HistoryTile" | ||
title={_t("You can't see earlier messages")} | ||
subtitle={subtitle} | ||
/>; | ||
}; | ||
|
||
export default HistoryTile; |
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