Improve formatting

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
This commit is contained in:
Šimon Brandner 2021-04-29 19:57:02 +02:00
parent 46bfbbadf9
commit 232b87a3b4
No known key found for this signature in database
GPG key ID: 9760693FDD98A790
17 changed files with 193 additions and 163 deletions

View file

@ -148,13 +148,15 @@ function _onGroupAddRoomFinished(groupId, addrs, addRoomsPublicly) {
const ErrorDialog = sdk.getComponent("dialogs.ErrorDialog"); const ErrorDialog = sdk.getComponent("dialogs.ErrorDialog");
Modal.createTrackedDialog( Modal.createTrackedDialog(
'Failed to add the following room to the group', 'Failed to add the following room to the group',
'', ErrorDialog, '',
ErrorDialog,
{ {
title: _t( title: _t(
"Failed to add the following rooms to %(groupId)s:", "Failed to add the following rooms to %(groupId)s:",
{groupId}, {groupId},
), ),
description: errorList.join(", "), description: errorList.join(", "),
}); },
);
}); });
} }

View file

@ -547,17 +547,23 @@ function textForMjolnirEvent(event) {
// else the entity !== prevEntity - count as a removal & add // else the entity !== prevEntity - count as a removal & add
if (USER_RULE_TYPES.includes(event.getType())) { if (USER_RULE_TYPES.includes(event.getType())) {
return _t("%(senderName)s changed a rule that was banning users matching %(oldGlob)s to matching " + return _t(
"%(senderName)s changed a rule that was banning users matching %(oldGlob)s to matching " +
"%(newGlob)s for %(reason)s", "%(newGlob)s for %(reason)s",
{senderName, oldGlob: prevEntity, newGlob: entity, reason}); {senderName, oldGlob: prevEntity, newGlob: entity, reason},
);
} else if (ROOM_RULE_TYPES.includes(event.getType())) { } else if (ROOM_RULE_TYPES.includes(event.getType())) {
return _t("%(senderName)s changed a rule that was banning rooms matching %(oldGlob)s to matching " + return _t(
"%(senderName)s changed a rule that was banning rooms matching %(oldGlob)s to matching " +
"%(newGlob)s for %(reason)s", "%(newGlob)s for %(reason)s",
{senderName, oldGlob: prevEntity, newGlob: entity, reason}); {senderName, oldGlob: prevEntity, newGlob: entity, reason},
);
} else if (SERVER_RULE_TYPES.includes(event.getType())) { } else if (SERVER_RULE_TYPES.includes(event.getType())) {
return _t("%(senderName)s changed a rule that was banning servers matching %(oldGlob)s to matching " + return _t(
"%(senderName)s changed a rule that was banning servers matching %(oldGlob)s to matching " +
"%(newGlob)s for %(reason)s", "%(newGlob)s for %(reason)s",
{senderName, oldGlob: prevEntity, newGlob: entity, reason}); {senderName, oldGlob: prevEntity, newGlob: entity, reason},
);
} }
// Unknown type. We'll say something but we shouldn't end up here. // Unknown type. We'll say something but we shouldn't end up here.

View file

@ -50,8 +50,8 @@ const LONG_DESC_PLACEHOLDER = _td(
</p> </p>
<p> <p>
You can even add images with Matrix URLs <img src="mxc://url" /> You can even add images with Matrix URLs <img src="mxc://url" />
</p> </p>`,
`); );
const RoomSummaryType = PropTypes.shape({ const RoomSummaryType = PropTypes.shape({
room_id: PropTypes.string.isRequired, room_id: PropTypes.string.isRequired,
@ -110,7 +110,8 @@ class CategoryRoomList extends React.Component {
const ErrorDialog = sdk.getComponent("dialogs.ErrorDialog"); const ErrorDialog = sdk.getComponent("dialogs.ErrorDialog");
Modal.createTrackedDialog( Modal.createTrackedDialog(
'Failed to add the following room to the group summary', 'Failed to add the following room to the group summary',
'', ErrorDialog, '',
ErrorDialog,
{ {
title: _t( title: _t(
"Failed to add the following rooms to the summary of %(groupId)s:", "Failed to add the following rooms to the summary of %(groupId)s:",
@ -146,8 +147,7 @@ class CategoryRoomList extends React.Component {
let catHeader = <div />; let catHeader = <div />;
if (this.props.category && this.props.category.profile) { if (this.props.category && this.props.category.profile) {
catHeader = <div catHeader = <div className="mx_GroupView_featuredThings_category">
className="mx_GroupView_featuredThings_category">
{ this.props.category.profile.name } { this.props.category.profile.name }
</div>; </div>;
} }
@ -292,7 +292,8 @@ class RoleUserList extends React.Component {
{groupId: this.props.groupId}, {groupId: this.props.groupId},
), ),
description: errorList.join(", "), description: errorList.join(", "),
}); },
);
}); });
}, },
}, /*className=*/null, /*isPriority=*/false, /*isStatic=*/true); }, /*className=*/null, /*isPriority=*/false, /*isStatic=*/true);
@ -355,7 +356,8 @@ class FeaturedUser extends React.Component {
const ErrorDialog = sdk.getComponent("dialogs.ErrorDialog"); const ErrorDialog = sdk.getComponent("dialogs.ErrorDialog");
Modal.createTrackedDialog( Modal.createTrackedDialog(
'Failed to remove user from community summary', 'Failed to remove user from community summary',
'', ErrorDialog, '',
ErrorDialog,
{ {
title: _t( title: _t(
"Failed to remove a user from the summary of %(groupId)s", "Failed to remove a user from the summary of %(groupId)s",
@ -1059,7 +1061,8 @@ export default class GroupView extends React.Component {
return null; return null;
} }
const membershipButtonClasses = classnames([ const membershipButtonClasses = classnames(
[
'mx_RoomHeader_textButton', 'mx_RoomHeader_textButton',
'mx_GroupView_textButton', 'mx_GroupView_textButton',
], ],

View file

@ -884,7 +884,8 @@ export default class ScrollPanel extends React.Component {
// give the <ol> an explicit role=list because Safari+VoiceOver seems to think an ordered-list with // give the <ol> an explicit role=list because Safari+VoiceOver seems to think an ordered-list with
// list-style-type: none; is no longer a list // list-style-type: none; is no longer a list
return (<AutoHideScrollbar return (
<AutoHideScrollbar
wrappedRef={this._collectScroll} wrappedRef={this._collectScroll}
onScroll={this.onScroll} onScroll={this.onScroll}
className={`mx_ScrollPanel ${this.props.className}`} className={`mx_ScrollPanel ${this.props.className}`}

View file

@ -116,8 +116,12 @@ export default class RoomSettingsDialog extends React.Component {
const roomName = MatrixClientPeg.get().getRoom(this.props.roomId).name; const roomName = MatrixClientPeg.get().getRoom(this.props.roomId).name;
return ( return (
<BaseDialog className='mx_RoomSettingsDialog' hasCancel={true} <BaseDialog
onFinished={this.props.onFinished} title={_t("Room Settings - %(roomName)s", {roomName})}> className='mx_RoomSettingsDialog'
hasCancel={true}
onFinished={this.props.onFinished}
title={_t("Room Settings - %(roomName)s", {roomName})}
>
<div className='mx_SettingsDialog_content'> <div className='mx_SettingsDialog_content'>
<TabbedView tabs={this._getTabs()} /> <TabbedView tabs={this._getTabs()} />
</div> </div>

View file

@ -45,7 +45,8 @@ export default class StorageEvictedDialog extends React.Component {
let logRequest; let logRequest;
if (SdkConfig.get().bug_report_endpoint_url) { if (SdkConfig.get().bug_report_endpoint_url) {
logRequest = _t( logRequest = _t(
"To help us prevent this in future, please <a>send us logs</a>.", {}, "To help us prevent this in future, please <a>send us logs</a>.",
{},
{ {
a: text => <a href="#" onClick={this._sendBugReport}>{text}</a>, a: text => <a href="#" onClick={this._sendBugReport}>{text}</a>,
}, },

View file

@ -155,8 +155,12 @@ export default class UserSettingsDialog extends React.Component {
const BaseDialog = sdk.getComponent('views.dialogs.BaseDialog'); const BaseDialog = sdk.getComponent('views.dialogs.BaseDialog');
return ( return (
<BaseDialog className='mx_UserSettingsDialog' hasCancel={true} <BaseDialog
onFinished={this.props.onFinished} title={_t("Settings")}> className='mx_UserSettingsDialog'
hasCancel={true}
onFinished={this.props.onFinished}
title={_t("Settings")}
>
<div className='mx_SettingsDialog_content'> <div className='mx_SettingsDialog_content'>
<TabbedView tabs={this._getTabs()} initialTabId={this.props.initialTabId} /> <TabbedView tabs={this._getTabs()} initialTabId={this.props.initialTabId} />
</div> </div>

View file

@ -70,9 +70,12 @@ export default class WidgetOpenIDPermissionsDialog extends React.Component {
const DialogButtons = sdk.getComponent('views.elements.DialogButtons'); const DialogButtons = sdk.getComponent('views.elements.DialogButtons');
return ( return (
<BaseDialog className='mx_WidgetOpenIDPermissionsDialog' hasCancel={true} <BaseDialog
className='mx_WidgetOpenIDPermissionsDialog'
hasCancel={true}
onFinished={this.props.onFinished} onFinished={this.props.onFinished}
title={_t("Allow this widget to verify your identity")}> title={_t("Allow this widget to verify your identity")}
>
<div className='mx_WidgetOpenIDPermissionsDialog_content'> <div className='mx_WidgetOpenIDPermissionsDialog_content'>
<p> <p>
{_t("The widget will verify your user ID, but won't be able to perform actions for you:")} {_t("The widget will verify your user ID, but won't be able to perform actions for you:")}

View file

@ -43,7 +43,8 @@ export default class ConfirmDestroyCrossSigningDialog extends React.Component {
className='mx_ConfirmDestroyCrossSigningDialog' className='mx_ConfirmDestroyCrossSigningDialog'
hasCancel={true} hasCancel={true}
onFinished={this.props.onFinished} onFinished={this.props.onFinished}
title={_t("Destroy cross-signing keys?")}> title={_t("Destroy cross-signing keys?")}
>
<div className='mx_ConfirmDestroyCrossSigningDialog_content'> <div className='mx_ConfirmDestroyCrossSigningDialog_content'>
<p> <p>
{_t( {_t(

View file

@ -373,15 +373,18 @@ export default class RestoreKeyBackupDialog extends React.PureComponent {
{_t( {_t(
"If you've forgotten your Security Phrase you can "+ "If you've forgotten your Security Phrase you can "+
"<button1>use your Security Key</button1> or " + "<button1>use your Security Key</button1> or " +
"<button2>set up new recovery options</button2>" "<button2>set up new recovery options</button2>",
, {}, { {},
button1: s => <AccessibleButton className="mx_linkButton" {
button1: s => <AccessibleButton
className="mx_linkButton"
element="span" element="span"
onClick={this._onUseRecoveryKeyClick} onClick={this._onUseRecoveryKeyClick}
> >
{s} {s}
</AccessibleButton>, </AccessibleButton>,
button2: s => <AccessibleButton className="mx_linkButton" button2: s => <AccessibleButton
className="mx_linkButton"
element="span" element="span"
onClick={this._onResetRecoveryClick} onClick={this._onResetRecoveryClick}
> >
@ -435,15 +438,17 @@ export default class RestoreKeyBackupDialog extends React.PureComponent {
</div> </div>
{_t( {_t(
"If you've forgotten your Security Key you can "+ "If you've forgotten your Security Key you can "+
"<button>set up new recovery options</button>" "<button>set up new recovery options</button>",
, {}, { {},
{
button: s => <AccessibleButton className="mx_linkButton" button: s => <AccessibleButton className="mx_linkButton"
element="span" element="span"
onClick={this._onResetRecoveryClick} onClick={this._onResetRecoveryClick}
> >
{s} {s}
</AccessibleButton>, </AccessibleButton>,
})} },
)}
</div>; </div>;
} }

View file

@ -127,8 +127,12 @@ export default class EditableItemList extends React.Component {
_renderNewItemField() { _renderNewItemField() {
return ( return (
<form onSubmit={this._onItemAdded} autoComplete="off" <form
noValidate={true} className="mx_EditableItemList_newItem"> onSubmit={this._onItemAdded}
autoComplete="off"
noValidate={true}
className="mx_EditableItemList_newItem"
>
<Field label={this.props.placeholder} type="text" <Field label={this.props.placeholder} type="text"
autoComplete="off" value={this.props.newItem || ""} onChange={this._onNewItemChanged} autoComplete="off" value={this.props.newItem || ""} onChange={this._onNewItemChanged}
list={this.props.suggestionsListId} /> list={this.props.suggestionsListId} />

View file

@ -82,9 +82,7 @@ export default class MKeyVerificationConclusion extends React.Component {
} }
// User isn't actually verified // User isn't actually verified
if (!MatrixClientPeg.get() if (!MatrixClientPeg.get().checkUserTrust(request.otherUserId).isCrossSigningVerified()) {
.checkUserTrust(request.otherUserId)
.isCrossSigningVerified()) {
return false; return false;
} }

View file

@ -187,8 +187,7 @@ export default class ReadReceiptMarker extends React.PureComponent {
} }
return ( return (
<NodeAnimator <NodeAnimator startStyles={this.state.startStyles}>
startStyles={this.state.startStyles} >
<MemberAvatar <MemberAvatar
member={this.props.member} member={this.props.member}
fallbackUserId={this.props.fallbackUserId} fallbackUserId={this.props.fallbackUserId}

View file

@ -785,8 +785,14 @@ export default class EventIndex extends EventEmitter {
* @returns {Promise<boolean>} Resolves to true if events were added to the * @returns {Promise<boolean>} Resolves to true if events were added to the
* timeline, false otherwise. * timeline, false otherwise.
*/ */
async populateFileTimeline(timelineSet, timeline, room, limit = 10, async populateFileTimeline(
fromEvent = null, direction = EventTimeline.BACKWARDS) { timelineSet,
timeline,
room,
limit = 10,
fromEvent = null,
direction = EventTimeline.BACKWARDS,
) {
const matrixEvents = await this.loadFileEvents(room, limit, fromEvent, direction); const matrixEvents = await this.loadFileEvents(room, limit, fromEvent, direction);
// If this is a normal fill request, not a pagination request, we need // If this is a normal fill request, not a pagination request, we need

View file

@ -124,17 +124,17 @@ class CustomRoomTagStore extends EventEmitter {
const tags = Object.assign({}, oldTags, tag); const tags = Object.assign({}, oldTags, tag);
this._setState({tags}); this._setState({tags});
} }
}
break; break;
}
case 'on_client_not_viable': case 'on_client_not_viable':
case 'on_logged_out': { case 'on_logged_out': {
// we assume to always have a tags object in the state // we assume to always have a tags object in the state
this._state = {tags: {}}; this._state = {tags: {}};
RoomListStore.instance.off(LISTS_UPDATE_EVENT, this._onListsUpdated); RoomListStore.instance.off(LISTS_UPDATE_EVENT, this._onListsUpdated);
}
break; break;
} }
} }
}
_getUpdatedTags() { _getUpdatedTags() {
if (!SettingsStore.getValue("feature_custom_tags")) { if (!SettingsStore.getValue("feature_custom_tags")) {

View file

@ -310,8 +310,7 @@ function unpackMegolmKeyFile(data) {
// look for the end line // look for the end line
while (1) { while (1) {
const lineEnd = fileStr.indexOf('\n', lineStart); const lineEnd = fileStr.indexOf('\n', lineStart);
const line = fileStr.slice(lineStart, lineEnd < 0 ? undefined : lineEnd) const line = fileStr.slice(lineStart, lineEnd < 0 ? undefined : lineEnd).trim();
.trim();
if (line === TRAILER_LINE) { if (line === TRAILER_LINE) {
break; break;
} }

View file

@ -245,8 +245,7 @@ describe('MemberEventListSummary', function() {
); );
}); });
it('truncates multiple sequences of repetitions with other events between', it('truncates multiple sequences of repetitions with other events between', function() {
function() {
const events = generateEvents([ const events = generateEvents([
{ {
userId: "@user_1:some.domain", userId: "@user_1:some.domain",
@ -297,8 +296,7 @@ describe('MemberEventListSummary', function() {
"user_1 was unbanned, joined and left 2 times, was banned, " + "user_1 was unbanned, joined and left 2 times, was banned, " +
"joined and left 3 times and was invited", "joined and left 3 times and was invited",
); );
}, });
);
it('handles multiple users following the same sequence of memberships', function() { it('handles multiple users following the same sequence of memberships', function() {
const events = generateEvents([ const events = generateEvents([
@ -396,8 +394,7 @@ describe('MemberEventListSummary', function() {
); );
}); });
it('correctly orders sequences of transitions by the order of their first event', it('correctly orders sequences of transitions by the order of their first event', function() {
function() {
const events = generateEvents([ const events = generateEvents([
{ {
userId: "@user_2:some.domain", userId: "@user_2:some.domain",
@ -446,8 +443,7 @@ describe('MemberEventListSummary', function() {
"user_2 was unbanned and joined and left 2 times, user_1 was unbanned, " + "user_2 was unbanned and joined and left 2 times, user_1 was unbanned, " +
"joined and left 2 times and was banned", "joined and left 2 times and was banned",
); );
}, });
);
it('correctly identifies transitions', function() { it('correctly identifies transitions', function() {
const events = generateEvents([ const events = generateEvents([
@ -570,8 +566,7 @@ describe('MemberEventListSummary', function() {
); );
}); });
it('handles invitation plurals correctly when there are multiple invites', it('handles invitation plurals correctly when there are multiple invites', function() {
function() {
const events = generateEvents([ const events = generateEvents([
{ {
userId: "@user_1:some.domain", userId: "@user_1:some.domain",
@ -603,8 +598,7 @@ describe('MemberEventListSummary', function() {
expect(summaryText).toBe( expect(summaryText).toBe(
"user_1 rejected their invitation 2 times", "user_1 rejected their invitation 2 times",
); );
}, });
);
it('handles a summary length = 2, with no "others"', function() { it('handles a summary length = 2, with no "others"', function() {
const events = generateEvents([ const events = generateEvents([