Change copy if the widget is unpinned
This commit is contained in:
parent
12fb1ee1cf
commit
f412f8defe
2 changed files with 20 additions and 5 deletions
|
@ -17,6 +17,8 @@ limitations under the License.
|
|||
import React from 'react';
|
||||
import { MatrixEvent } from "matrix-js-sdk/src/models/event";
|
||||
import { _t } from "../../../languageHandler";
|
||||
import WidgetStore from "../../../stores/WidgetStore";
|
||||
import { WidgetType } from "../../../widgets/WidgetType";
|
||||
|
||||
interface IProps {
|
||||
mxEvent: MatrixEvent;
|
||||
|
@ -36,12 +38,24 @@ export default class MJitsiWidgetEvent extends React.PureComponent<IProps, IStat
|
|||
const prevUrl = this.props.mxEvent.getPrevContent()['url'];
|
||||
const senderName = this.props.mxEvent.sender?.name || this.props.mxEvent.getSender();
|
||||
|
||||
// XXX: We are assuming that there will only be one Jitsi widget per room, which isn't entirely
|
||||
// safe but if there's more than 1 the user will be super confused anyways - the copy doesn't
|
||||
// need to concern itself with this.
|
||||
const roomInfo = WidgetStore.instance.getRoom(this.props.mxEvent.getRoomId());
|
||||
const isPinned = roomInfo?.widgets
|
||||
.some(w => WidgetType.JITSI.matches(w.type) && WidgetStore.instance.isPinned(w.id));
|
||||
|
||||
let joinCopy = _t('Join the conference at the top of this room');
|
||||
if (!isPinned) {
|
||||
joinCopy = _t('Join the conference from the room information card on the right');
|
||||
}
|
||||
|
||||
if (!url) {
|
||||
// removed
|
||||
return (
|
||||
<div className='mx_EventTile_bubble mx_MJitsiWidgetEvent'>
|
||||
<div className='mx_MJitsiWidgetEvent_title'>
|
||||
{_t("Video conference ended by %(senderName)s", {senderName})}
|
||||
{_t('Video conference ended by %(senderName)s', {senderName})}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
@ -50,10 +64,10 @@ export default class MJitsiWidgetEvent extends React.PureComponent<IProps, IStat
|
|||
return (
|
||||
<div className='mx_EventTile_bubble mx_MJitsiWidgetEvent'>
|
||||
<div className='mx_MJitsiWidgetEvent_title'>
|
||||
{_t("Video conference updated by %(senderName)s", {senderName})}
|
||||
{_t('Video conference updated by %(senderName)s', {senderName})}
|
||||
</div>
|
||||
<div className='mx_MJitsiWidgetEvent_subtitle'>
|
||||
{_t("Join the conference at the top of this room.")}
|
||||
{joinCopy}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
@ -65,7 +79,7 @@ export default class MJitsiWidgetEvent extends React.PureComponent<IProps, IStat
|
|||
{_t("Video conference started by %(senderName)s", {senderName})}
|
||||
</div>
|
||||
<div className='mx_MJitsiWidgetEvent_subtitle'>
|
||||
{_t("Join the conference at the top of this room.")}
|
||||
{joinCopy}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
|
|
@ -1402,9 +1402,10 @@
|
|||
"Invalid file%(extra)s": "Invalid file%(extra)s",
|
||||
"Error decrypting image": "Error decrypting image",
|
||||
"Show image": "Show image",
|
||||
"Join the conference at the top of this room": "Join the conference at the top of this room",
|
||||
"Join the conference from the room information card on the right": "Join the conference from the room information card on the right",
|
||||
"Video conference ended by %(senderName)s": "Video conference ended by %(senderName)s",
|
||||
"Video conference updated by %(senderName)s": "Video conference updated by %(senderName)s",
|
||||
"Join the conference at the top of this room.": "Join the conference at the top of this room.",
|
||||
"Video conference started by %(senderName)s": "Video conference started by %(senderName)s",
|
||||
"You have ignored this user, so their message is hidden. <a>Show anyways.</a>": "You have ignored this user, so their message is hidden. <a>Show anyways.</a>",
|
||||
"You verified %(name)s": "You verified %(name)s",
|
||||
|
|
Loading…
Reference in a new issue