Explicitly declare cli and use alt attribute for images

This commit is contained in:
Jaiwanth 2021-06-07 12:22:02 +05:30
parent 2b432a7718
commit b68ea48444
2 changed files with 10 additions and 8 deletions

View file

@ -177,7 +177,7 @@ export default class MFileBody extends React.Component {
<div className="mx_MFileBody_info">
<span className="mx_MFileBody_info_icon" >
{this.props.isExporting ?
<img className="mx_export_attach_icon" src="icons/attach.svg" />
<img alt="Attachment" className="mx_export_attach_icon" src="icons/attach.svg" />
: null}
</span>
<span className="mx_MFileBody_info_filename">{this.presentableTextForFile(content, false)}</span>

View file

@ -21,6 +21,7 @@ import { _t } from "../../../languageHandler";
import MatrixClientContext from "../../../contexts/MatrixClientContext";
import { formatFullDate } from "../../../DateUtils";
import SettingsStore from "../../../settings/SettingsStore";
import { MatrixClientPeg } from "../../../MatrixClientPeg";
interface IProps {
mxEvent: MatrixEvent;
@ -28,8 +29,9 @@ interface IProps {
}
const RedactedBody = React.forwardRef<any, IProps>(({mxEvent, isExporting}, ref) => {
const cli: MatrixClient = useContext(MatrixClientContext);
let cli: MatrixClient = useContext(MatrixClientContext);
// As context doesn't propagate during export, we'll have to explicitly declare
if (isExporting) cli = MatrixClientPeg.get();
let text = _t("Message deleted");
const unsigned = mxEvent.getUnsigned();
const redactedBecauseUserId = unsigned && unsigned.redacted_because && unsigned.redacted_because.sender;
@ -45,7 +47,7 @@ const RedactedBody = React.forwardRef<any, IProps>(({mxEvent, isExporting}, ref)
return (
<span className="mx_RedactedBody" ref={ref} title={titleText}>
{ isExporting ? <img className="mx_export_trash_icon" src="icons/trash.svg" title="Redacted" /> : null }
{ isExporting ? <img alt="Redacted" className="mx_export_trash_icon" src="icons/trash.svg" /> : null }
{ text }
</span>
);