Delint
This commit is contained in:
parent
1ed316851a
commit
6dd3631a17
5 changed files with 22 additions and 23 deletions
|
@ -193,7 +193,7 @@ const ExportDialog: React.FC<IProps> = ({ room, onFinished }) => {
|
||||||
const exportTypeOptions = Object.keys(exportTypes).map((type) => {
|
const exportTypeOptions = Object.keys(exportTypes).map((type) => {
|
||||||
return (
|
return (
|
||||||
<option key={type} value={type}>
|
<option key={type} value={type}>
|
||||||
{textForType(type)}
|
{ textForType(type) }
|
||||||
</option>
|
</option>
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
@ -229,7 +229,7 @@ const ExportDialog: React.FC<IProps> = ({ room, onFinished }) => {
|
||||||
<p>{ _t("The export was cancelled successfully") }</p>
|
<p>{ _t("The export was cancelled successfully") }</p>
|
||||||
|
|
||||||
<DialogButtons
|
<DialogButtons
|
||||||
primaryButton={ _t("Okay") }
|
primaryButton={_t("Okay")}
|
||||||
hasCancel={false}
|
hasCancel={false}
|
||||||
onPrimaryButtonClick={onFinished}
|
onPrimaryButtonClick={onFinished}
|
||||||
/>
|
/>
|
||||||
|
@ -331,9 +331,9 @@ const ExportDialog: React.FC<IProps> = ({ room, onFinished }) => {
|
||||||
fixedWidth={true}
|
fixedWidth={true}
|
||||||
>
|
>
|
||||||
<p>
|
<p>
|
||||||
{_t(
|
{ _t(
|
||||||
"Are you sure you want to stop exporting your data? If you do, you'll need to start over.",
|
"Are you sure you want to stop exporting your data? If you do, you'll need to start over.",
|
||||||
)}
|
) }
|
||||||
</p>
|
</p>
|
||||||
<DialogButtons
|
<DialogButtons
|
||||||
primaryButton={_t("Stop")}
|
primaryButton={_t("Stop")}
|
||||||
|
|
|
@ -125,7 +125,6 @@ export function presentableTextForFile(content: IContent, withSize = true): stri
|
||||||
interface IProps extends IBodyProps {
|
interface IProps extends IBodyProps {
|
||||||
/* whether or not to show the default placeholder for the file. Defaults to true. */
|
/* whether or not to show the default placeholder for the file. Defaults to true. */
|
||||||
showGenericPlaceholder: boolean;
|
showGenericPlaceholder: boolean;
|
||||||
forExport?: boolean;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
interface IState {
|
interface IState {
|
||||||
|
@ -174,9 +173,9 @@ export default class MFileBody extends React.Component<IProps, IState> {
|
||||||
placeholder = (
|
placeholder = (
|
||||||
<div className="mx_MFileBody_info">
|
<div className="mx_MFileBody_info">
|
||||||
<span className="mx_MFileBody_info_icon">
|
<span className="mx_MFileBody_info_icon">
|
||||||
{this.props.forExport ?
|
{ this.props.forExport ?
|
||||||
<img alt="Attachment" className="mx_export_attach_icon" src="icons/attach.svg" />
|
<img alt="Attachment" className="mx_export_attach_icon" src="icons/attach.svg" />
|
||||||
: null}
|
: null }
|
||||||
</span>
|
</span>
|
||||||
<span className="mx_MFileBody_info_filename">
|
<span className="mx_MFileBody_info_filename">
|
||||||
{ presentableTextForFile(content, false) }
|
{ presentableTextForFile(content, false) }
|
||||||
|
|
|
@ -287,8 +287,8 @@ const RoomSummaryCard: React.FC<IProps> = ({ room, onClose }) => {
|
||||||
<Button className="mx_RoomSummaryCard_icon_settings" onClick={onRoomSettingsClick}>
|
<Button className="mx_RoomSummaryCard_icon_settings" onClick={onRoomSettingsClick}>
|
||||||
{ _t("Room settings") }
|
{ _t("Room settings") }
|
||||||
</Button>
|
</Button>
|
||||||
<Button className="mx_RoomSummaryCard_icon_export" onClick = {onRoomExportClick}>
|
<Button className="mx_RoomSummaryCard_icon_export" onClick={onRoomExportClick}>
|
||||||
{_t("Export chat")}
|
{ _t("Export chat") }
|
||||||
</Button>
|
</Button>
|
||||||
</Group>
|
</Group>
|
||||||
|
|
||||||
|
|
|
@ -63,7 +63,7 @@ export default class HTMLExporter extends Exporter {
|
||||||
name={this.room.name}
|
name={this.room.name}
|
||||||
title={this.room.name}
|
title={this.room.name}
|
||||||
url={blob ? avatarPath : null}
|
url={blob ? avatarPath : null}
|
||||||
resizeMethod={"crop"}
|
resizeMethod="crop"
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
return renderToStaticMarkup(avatar);
|
return renderToStaticMarkup(avatar);
|
||||||
|
@ -83,31 +83,31 @@ export default class HTMLExporter extends Exporter {
|
||||||
|
|
||||||
const exportedText = renderToStaticMarkup(
|
const exportedText = renderToStaticMarkup(
|
||||||
<p>
|
<p>
|
||||||
{_t(
|
{ _t(
|
||||||
"This is the start of export of <roomName/>. Exported by <exporterDetails/> at %(exportDate)s.",
|
"This is the start of export of <roomName/>. Exported by <exporterDetails/> at %(exportDate)s.",
|
||||||
{
|
{
|
||||||
exportDate,
|
exportDate,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
roomName: () => <b>{this.room.name}</b>,
|
roomName: () => <b>{ this.room.name }</b>,
|
||||||
exporterDetails: () => (
|
exporterDetails: () => (
|
||||||
<a
|
<a
|
||||||
href={`https://matrix.to/#/${exporter}`}
|
href={`https://matrix.to/#/${exporter}`}
|
||||||
target="_blank"
|
target="_blank"
|
||||||
rel="noopener noreferrer"
|
rel="noopener noreferrer"
|
||||||
>
|
>
|
||||||
{exporterName ? (
|
{ exporterName ? (
|
||||||
<>
|
<>
|
||||||
<b>{exporterName}</b>
|
<b>{ exporterName }</b>
|
||||||
{exporter}
|
{ exporter }
|
||||||
</>
|
</>
|
||||||
) : (
|
) : (
|
||||||
<b>{exporter}</b>
|
<b>{ exporter }</b>
|
||||||
)}
|
) }
|
||||||
</a>
|
</a>
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
)}
|
) }
|
||||||
</p>,
|
</p>,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -232,7 +232,7 @@ export default class HTMLExporter extends Exporter {
|
||||||
return renderToStaticMarkup(dateSeparator);
|
return renderToStaticMarkup(dateSeparator);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected _wantsDateSeparator(event: MatrixEvent, prevEvent: MatrixEvent) {
|
protected needsDateSeparator(event: MatrixEvent, prevEvent: MatrixEvent) {
|
||||||
if (prevEvent == null) return true;
|
if (prevEvent == null) return true;
|
||||||
return wantsDateSeparator(prevEvent.getDate(), event.getDate());
|
return wantsDateSeparator(prevEvent.getDate(), event.getDate());
|
||||||
}
|
}
|
||||||
|
@ -341,8 +341,8 @@ export default class HTMLExporter extends Exporter {
|
||||||
if (this.cancelled) return this.cleanUp();
|
if (this.cancelled) return this.cleanUp();
|
||||||
if (!haveTileForEvent(event)) continue;
|
if (!haveTileForEvent(event)) continue;
|
||||||
|
|
||||||
content += this._wantsDateSeparator(event, prevEvent) ? this.getDateSeparator(event) : "";
|
content += this.needsDateSeparator(event, prevEvent) ? this.getDateSeparator(event) : "";
|
||||||
const shouldBeJoined = !this._wantsDateSeparator(event, prevEvent)
|
const shouldBeJoined = !this.needsDateSeparator(event, prevEvent)
|
||||||
&& shouldFormContinuation(prevEvent, event, false);
|
&& shouldFormContinuation(prevEvent, event, false);
|
||||||
const body = await this.createMessageBody(event, shouldBeJoined);
|
const body = await this.createMessageBody(event, shouldBeJoined);
|
||||||
this.totalSize += Buffer.byteLength(body);
|
this.totalSize += Buffer.byteLength(body);
|
||||||
|
|
|
@ -59,7 +59,7 @@ export default class PlainTextExporter extends Exporter {
|
||||||
return `<${rplName}${rplSource}> ${rplText}`;
|
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();
|
const senderDisplayName = mxEv.sender && mxEv.sender.name ? mxEv.sender.name : mxEv.getSender();
|
||||||
let mediaText = "";
|
let mediaText = "";
|
||||||
if (this.isAttachment(mxEv)) {
|
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);
|
this.updateProgress(`Processing event ${i + 1} out of ${events.length}`, false, true);
|
||||||
if (this.cancelled) return this.cleanUp();
|
if (this.cancelled) return this.cleanUp();
|
||||||
if (!haveTileForEvent(event)) continue;
|
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`;
|
content += textForEvent && `${new Date(event.getTs()).toLocaleString()} - ${textForEvent}\n`;
|
||||||
}
|
}
|
||||||
return content;
|
return content;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue