This commit is contained in:
Jaiwanth 2021-07-21 11:48:37 +05:30
parent 1ed316851a
commit 6dd3631a17
5 changed files with 22 additions and 23 deletions

View file

@ -193,7 +193,7 @@ const ExportDialog: React.FC<IProps> = ({ room, onFinished }) => {
const exportTypeOptions = Object.keys(exportTypes).map((type) => {
return (
<option key={type} value={type}>
{textForType(type)}
{ textForType(type) }
</option>
);
});
@ -229,7 +229,7 @@ const ExportDialog: React.FC<IProps> = ({ room, onFinished }) => {
<p>{ _t("The export was cancelled successfully") }</p>
<DialogButtons
primaryButton={ _t("Okay") }
primaryButton={_t("Okay")}
hasCancel={false}
onPrimaryButtonClick={onFinished}
/>
@ -331,9 +331,9 @@ const ExportDialog: React.FC<IProps> = ({ room, onFinished }) => {
fixedWidth={true}
>
<p>
{_t(
{ _t(
"Are you sure you want to stop exporting your data? If you do, you'll need to start over.",
)}
) }
</p>
<DialogButtons
primaryButton={_t("Stop")}

View file

@ -125,7 +125,6 @@ export function presentableTextForFile(content: IContent, withSize = true): stri
interface IProps extends IBodyProps {
/* whether or not to show the default placeholder for the file. Defaults to true. */
showGenericPlaceholder: boolean;
forExport?: boolean;
}
interface IState {
@ -174,9 +173,9 @@ export default class MFileBody extends React.Component<IProps, IState> {
placeholder = (
<div className="mx_MFileBody_info">
<span className="mx_MFileBody_info_icon">
{this.props.forExport ?
{ this.props.forExport ?
<img alt="Attachment" className="mx_export_attach_icon" src="icons/attach.svg" />
: null}
: null }
</span>
<span className="mx_MFileBody_info_filename">
{ presentableTextForFile(content, false) }

View file

@ -287,8 +287,8 @@ const RoomSummaryCard: React.FC<IProps> = ({ room, onClose }) => {
<Button className="mx_RoomSummaryCard_icon_settings" onClick={onRoomSettingsClick}>
{ _t("Room settings") }
</Button>
<Button className="mx_RoomSummaryCard_icon_export" onClick = {onRoomExportClick}>
{_t("Export chat")}
<Button className="mx_RoomSummaryCard_icon_export" onClick={onRoomExportClick}>
{ _t("Export chat") }
</Button>
</Group>

View file

@ -63,7 +63,7 @@ export default class HTMLExporter extends Exporter {
name={this.room.name}
title={this.room.name}
url={blob ? avatarPath : null}
resizeMethod={"crop"}
resizeMethod="crop"
/>
);
return renderToStaticMarkup(avatar);
@ -83,31 +83,31 @@ export default class HTMLExporter extends Exporter {
const exportedText = renderToStaticMarkup(
<p>
{_t(
{ _t(
"This is the start of export of <roomName/>. Exported by <exporterDetails/> at %(exportDate)s.",
{
exportDate,
},
{
roomName: () => <b>{this.room.name}</b>,
roomName: () => <b>{ this.room.name }</b>,
exporterDetails: () => (
<a
href={`https://matrix.to/#/${exporter}`}
target="_blank"
rel="noopener noreferrer"
>
{exporterName ? (
{ exporterName ? (
<>
<b>{exporterName}</b>
{exporter}
<b>{ exporterName }</b>
{ exporter }
</>
) : (
<b>{exporter}</b>
)}
<b>{ exporter }</b>
) }
</a>
),
},
)}
) }
</p>,
);
@ -232,7 +232,7 @@ export default class HTMLExporter extends Exporter {
return renderToStaticMarkup(dateSeparator);
}
protected _wantsDateSeparator(event: MatrixEvent, prevEvent: MatrixEvent) {
protected needsDateSeparator(event: MatrixEvent, prevEvent: MatrixEvent) {
if (prevEvent == null) return true;
return wantsDateSeparator(prevEvent.getDate(), event.getDate());
}
@ -341,8 +341,8 @@ export default class HTMLExporter extends Exporter {
if (this.cancelled) return this.cleanUp();
if (!haveTileForEvent(event)) continue;
content += this._wantsDateSeparator(event, prevEvent) ? this.getDateSeparator(event) : "";
const shouldBeJoined = !this._wantsDateSeparator(event, prevEvent)
content += this.needsDateSeparator(event, prevEvent) ? this.getDateSeparator(event) : "";
const shouldBeJoined = !this.needsDateSeparator(event, prevEvent)
&& shouldFormContinuation(prevEvent, event, false);
const body = await this.createMessageBody(event, shouldBeJoined);
this.totalSize += Buffer.byteLength(body);

View file

@ -59,7 +59,7 @@ export default class PlainTextExporter extends Exporter {
return `<${rplName}${rplSource}> ${rplText}`;
};
protected _textForEvent = async (mxEv: MatrixEvent) => {
protected plainTextForEvent = async (mxEv: MatrixEvent) => {
const senderDisplayName = mxEv.sender && mxEv.sender.name ? mxEv.sender.name : mxEv.getSender();
let mediaText = "";
if (this.isAttachment(mxEv)) {
@ -94,7 +94,7 @@ export default class PlainTextExporter extends Exporter {
this.updateProgress(`Processing event ${i + 1} out of ${events.length}`, false, true);
if (this.cancelled) return this.cleanUp();
if (!haveTileForEvent(event)) continue;
const textForEvent = await this._textForEvent(event);
const textForEvent = await this.plainTextForEvent(event);
content += textForEvent && `${new Date(event.getTs()).toLocaleString()} - ${textForEvent}\n`;
}
return content;