Apply prettier formatting

This commit is contained in:
Michael Weimann 2022-12-12 12:24:14 +01:00
parent 1cac306093
commit 526645c791
No known key found for this signature in database
GPG key ID: 53F535A266BB9584
1576 changed files with 65385 additions and 62478 deletions

View file

@ -17,18 +17,18 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
import React from 'react';
import React from "react";
import { Room } from "matrix-js-sdk/src/models/room";
import { _t, _td } from '../../../languageHandler';
import { _t, _td } from "../../../languageHandler";
import SettingsStore from "../../../settings/SettingsStore";
import dis from "../../../dispatcher/dispatcher";
import { MatrixClientPeg } from "../../../MatrixClientPeg";
import { Action } from "../../../dispatcher/actions";
import { SettingLevel } from "../../../settings/SettingLevel";
import SettingsFlag from "../elements/SettingsFlag";
import SettingsFieldset from '../settings/SettingsFieldset';
import AccessibleButton from '../elements/AccessibleButton';
import SettingsFieldset from "../settings/SettingsFieldset";
import AccessibleButton from "../elements/AccessibleButton";
interface IProps {
room: Room;
@ -52,24 +52,28 @@ export default class UrlPreviewSettings extends React.Component<IProps> {
// Only show account setting state and room state setting state in non-e2ee rooms where they apply
const accountEnabled = SettingsStore.getValueAt(SettingLevel.ACCOUNT, "urlPreviewsEnabled");
if (accountEnabled) {
previewsForAccount = (
_t("You have <a>enabled</a> URL previews by default.", {}, {
'a': (sub) => <AccessibleButton
kind='link_inline'
onClick={this.onClickUserSettings}>
{ sub }
</AccessibleButton>,
})
previewsForAccount = _t(
"You have <a>enabled</a> URL previews by default.",
{},
{
a: (sub) => (
<AccessibleButton kind="link_inline" onClick={this.onClickUserSettings}>
{sub}
</AccessibleButton>
),
},
);
} else {
previewsForAccount = (
_t("You have <a>disabled</a> URL previews by default.", {}, {
'a': (sub) => <AccessibleButton
kind='link_inline'
onClick={this.onClickUserSettings}>
{ sub }
</AccessibleButton>,
})
previewsForAccount = _t(
"You have <a>disabled</a> URL previews by default.",
{},
{
a: (sub) => (
<AccessibleButton kind="link_inline" onClick={this.onClickUserSettings}>
{sub}
</AccessibleButton>
),
},
);
}
@ -86,37 +90,44 @@ export default class UrlPreviewSettings extends React.Component<IProps> {
);
} else {
let str = _td("URL previews are enabled by default for participants in this room.");
if (!SettingsStore.getValueAt(SettingLevel.ROOM, "urlPreviewsEnabled", roomId, /*explicit=*/true)) {
if (!SettingsStore.getValueAt(SettingLevel.ROOM, "urlPreviewsEnabled", roomId, /*explicit=*/ true)) {
str = _td("URL previews are disabled by default for participants in this room.");
}
previewsForRoom = (<label>{ _t(str) }</label>);
previewsForRoom = <label>{_t(str)}</label>;
}
} else {
previewsForAccount = (
_t("In encrypted rooms, like this one, URL previews are disabled by default to ensure that your " +
previewsForAccount = _t(
"In encrypted rooms, like this one, URL previews are disabled by default to ensure that your " +
"homeserver (where the previews are generated) cannot gather information about links you see in " +
"this room.")
"this room.",
);
}
const previewsForRoomAccount = ( // in an e2ee room we use a special key to enforce per-room opt-in
<SettingsFlag name={isEncrypted ? 'urlPreviewsEnabled_e2ee' : 'urlPreviewsEnabled'}
level={SettingLevel.ROOM_ACCOUNT}
roomId={roomId} />
);
const previewsForRoomAccount = // in an e2ee room we use a special key to enforce per-room opt-in
(
<SettingsFlag
name={isEncrypted ? "urlPreviewsEnabled_e2ee" : "urlPreviewsEnabled"}
level={SettingLevel.ROOM_ACCOUNT}
roomId={roomId}
/>
);
const description = <>
<p>
{ _t('When someone puts a URL in their message, a URL preview can be shown to give more ' +
'information about that link such as the title, description, and an image from the website.') }
</p>
<p>{ previewsForAccount }</p>
</>;
const description = (
<>
<p>
{_t(
"When someone puts a URL in their message, a URL preview can be shown to give more " +
"information about that link such as the title, description, and an image from the website.",
)}
</p>
<p>{previewsForAccount}</p>
</>
);
return (
<SettingsFieldset legend={_t("URL Previews")} description={description}>
{ previewsForRoom }
<label>{ previewsForRoomAccount }</label>
{previewsForRoom}
<label>{previewsForRoomAccount}</label>
</SettingsFieldset>
);
}