Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Be more positive with setting labels #2504

Merged
merged 4 commits into from
Jan 28, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/MatrixClientPeg.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ class MatrixClientPeg {
userId: creds.userId,
deviceId: creds.deviceId,
timelineSupport: true,
forceTURN: SettingsStore.getValue('webRtcForceTURN', false),
forceTURN: !SettingsStore.getValue('webRtcForcePeerToPeer', false),
verificationMethods: [verificationMethods.SAS]
};

Expand Down
2 changes: 1 addition & 1 deletion src/autocomplete/EmojiProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ export default class EmojiProvider extends AutocompleteProvider {
}

async getCompletions(query: string, selection: SelectionRange, force?: boolean): Array<Completion> {
if (SettingsStore.getValue("MessageComposerInput.dontSuggestEmoji")) {
if (!SettingsStore.getValue("MessageComposerInput.suggestEmoji")) {
return []; // don't give any suggestions if the user doesn't want them
}

Expand Down
2 changes: 1 addition & 1 deletion src/components/structures/BottomLeftMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ module.exports = React.createClass({
const SettingsButton = sdk.getComponent('elements.SettingsButton');
const GroupsButton = sdk.getComponent('elements.GroupsButton');

const groupsButton = SettingsStore.getValue("TagPanel.disableTagPanel") ?
const groupsButton = !SettingsStore.getValue("TagPanel.enableTagPanel") ?
<GroupsButton tooltip={true} /> : null;

return (
Expand Down
2 changes: 1 addition & 1 deletion src/components/structures/LeftPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ const LeftPanel = React.createClass({
const SearchBox = sdk.getComponent('structures.SearchBox');
const CallPreview = sdk.getComponent('voip.CallPreview');

const tagPanelEnabled = !SettingsStore.getValue("TagPanel.disableTagPanel");
const tagPanelEnabled = SettingsStore.getValue("TagPanel.enableTagPanel");
const tagPanel = tagPanelEnabled ? <TagPanel /> : <div />;

const containerClasses = classNames(
Expand Down
2 changes: 1 addition & 1 deletion src/components/structures/RoomView.js
Original file line number Diff line number Diff line change
Expand Up @@ -1838,7 +1838,7 @@ module.exports = React.createClass({
const messagePanel = (
<TimelinePanel ref={this._gatherTimelinePanelRef}
timelineSet={this.state.room.getUnfilteredTimelineSet()}
showReadReceipts={!SettingsStore.getValue('hideReadReceipts')}
showReadReceipts={SettingsStore.getValue('showReadReceipts')}
manageReadReceipts={!this.state.isPeeking}
manageReadMarkers={!this.state.isPeeking}
hidden={hideMessagePanel}
Expand Down
24 changes: 12 additions & 12 deletions src/components/structures/UserSettings.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,22 +65,22 @@ const SIMPLE_SETTINGS = [
{ id: "autoplayGifsAndVideos" },
{ id: "alwaysShowEncryptionIcons" },
{ id: "showRoomRecoveryReminder" },
{ id: "hideReadReceipts" },
{ id: "dontSendTypingNotifications" },
{ id: "showReadReceipts" },
{ id: "sendTypingNotifications" },
{ id: "alwaysShowTimestamps" },
{ id: "showTwelveHourTimestamps" },
{ id: "hideJoinLeaves" },
{ id: "hideAvatarChanges" },
{ id: "hideDisplaynameChanges" },
{ id: "showJoinLeaves" },
{ id: "showAvatarChanges" },
{ id: "showDisplaynameChanges" },
{ id: "useCompactLayout" },
{ id: "hideRedactions" },
{ id: "showRedactions" },
{ id: "enableSyntaxHighlightLanguageDetection" },
{ id: "MessageComposerInput.autoReplaceEmoji" },
{ id: "MessageComposerInput.dontSuggestEmoji" },
{ id: "Pill.shouldHidePillAvatar" },
{ id: "TextualBody.disableBigEmoji" },
{ id: "MessageComposerInput.suggestEmoji" },
{ id: "Pill.shouldShowPillAvatar" },
{ id: "TextualBody.enableBigEmoji" },
{ id: "VideoView.flipVideoHorizontally" },
{ id: "TagPanel.disableTagPanel" },
{ id: "TagPanel.enableTagPanel" },
{ id: "enableWidgetScreenshots" },
{ id: "pinMentionedRooms" },
{ id: "pinUnreadRooms" },
Expand All @@ -101,9 +101,9 @@ const ANALYTICS_SETTINGS = [
// These settings must be defined in SettingsStore
const WEBRTC_SETTINGS = [
{
id: 'webRtcForceTURN',
id: 'webRtcForcePeerToPeer',
fn: (val) => {
MatrixClientPeg.get().setForceTURN(val);
MatrixClientPeg.get().setForceTURN(!val);
},
},
];
Expand Down
4 changes: 2 additions & 2 deletions src/components/views/messages/TextualBody.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ module.exports = React.createClass({
},

pillifyLinks: function(nodes) {
const shouldShowPillAvatar = !SettingsStore.getValue("Pill.shouldHidePillAvatar");
const shouldShowPillAvatar = SettingsStore.getValue("Pill.shouldShowPillAvatar");
let node = nodes[0];
while (node) {
let pillified = false;
Expand Down Expand Up @@ -436,7 +436,7 @@ module.exports = React.createClass({

const stripReply = ReplyThread.getParentEventId(mxEvent);
let body = HtmlUtils.bodyToHtml(content, this.props.highlights, {
disableBigEmoji: SettingsStore.getValue('TextualBody.disableBigEmoji'),
disableBigEmoji: !SettingsStore.getValue('TextualBody.enableBigEmoji'),
// Part of Replies fallback support
stripReplyFallback: stripReply,
});
Expand Down
4 changes: 2 additions & 2 deletions src/components/views/rooms/MessageComposerInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ export default class MessageComposerInput extends React.Component {
}

sendTyping(isTyping) {
if (SettingsStore.getValue('dontSendTypingNotifications')) return;
if (!SettingsStore.getValue('sendTypingNotifications')) return;
MatrixClientPeg.get().sendTyping(
this.props.room.roomId,
this.isTyping, TYPING_SERVER_TIMEOUT,
Expand Down Expand Up @@ -1443,7 +1443,7 @@ export default class MessageComposerInput extends React.Component {
const url = data.get('href');
const completion = data.get('completion');

const shouldShowPillAvatar = !SettingsStore.getValue("Pill.shouldHidePillAvatar");
const shouldShowPillAvatar = SettingsStore.getValue("Pill.shouldShowPillAvatar");
const Pill = sdk.getComponent('elements.Pill');

if (completion === '@room') {
Expand Down
20 changes: 10 additions & 10 deletions src/components/views/settings/tabs/PreferencesSettingsTab.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ const PlatformPeg = require("../../../../PlatformPeg");
export default class PreferencesSettingsTab extends React.Component {
static COMPOSER_SETTINGS = [
'MessageComposerInput.autoReplaceEmoji',
'MessageComposerInput.dontSuggestEmoji', // TODO: Positive wording
'dontSendTypingNotifications', // TODO: Positive wording
'MessageComposerInput.suggestEmoji',
'sendTypingNotifications',
];

static ROOM_LIST_SETTINGS = [
Expand All @@ -38,21 +38,21 @@ export default class PreferencesSettingsTab extends React.Component {
static TIMELINE_SETTINGS = [
'autoplayGifsAndVideos',
'urlPreviewsEnabled',
'TextualBody.disableBigEmoji', // TODO: Positive wording
'hideReadReceipts', // TODO: Positive wording
'TextualBody.enableBigEmoji',
'showReadReceipts',
'showTwelveHourTimestamps',
'alwaysShowTimestamps',
'hideRedactions', // TODO: Positive wording ("Show a placeholder for removed messages")
'showRedactions',
'enableSyntaxHighlightLanguageDetection',
'hideJoinLeaves', // TODO: Positive wording
'hideAvatarChanges', // TODO: Positive wording
'hideDisplaynameChanges', // TODO: Positive wording
'showJoinLeaves',
'showAvatarChanges',
'showDisplaynameChanges',
];

static ADVANCED_SETTINGS = [
'alwaysShowEncryptionIcons',
'Pill.shouldHidePillAvatar', // TODO: Positive wording
'TagPanel.disableTagPanel', // TODO: Positive wording
'Pill.shouldShowPillAvatar',
'TagPanel.enableTagPanel',
'promptBeforeInviteUnknownUsers',
// Start automatically after startup (electron-only)
// Autocomplete delay (niche text box)
Expand Down
7 changes: 3 additions & 4 deletions src/components/views/settings/tabs/VoiceSettingsTab.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ export default class VoiceSettingsTab extends React.Component {
CallMediaHandler.setVideoInput(e.target.value);
};

_setForceTurn = (forced) => {
MatrixClientPeg.get().setForceTURN(forced);
_changeWebRtcMethod = (p2p) => {
MatrixClientPeg.get().setForceTURN(!p2p);
};

_renderDeviceOptions(devices, category) {
Expand Down Expand Up @@ -159,7 +159,6 @@ export default class VoiceSettingsTab extends React.Component {
}
}

// TODO: Make 'webRtcForceTURN' be positively worded
return (
<div className="mx_SettingsTab mx_VoiceSettingsTab">
<div className="mx_SettingsTab_heading">{_t("Voice & Video")}</div>
Expand All @@ -169,7 +168,7 @@ export default class VoiceSettingsTab extends React.Component {
{microphoneDropdown}
{webcamDropdown}
<SettingsFlag name='VideoView.flipVideoHorizontally' level={SettingLevel.ACCOUNT} />
<SettingsFlag name='webRtcForceTURN' level={SettingLevel.DEVICE} onChange={this._setForceTurn} />
<SettingsFlag name='webRtcForcePeerToPeer' level={SettingLevel.DEVICE} onChange={this._changeWebRtcMethod} />
</div>
</div>
);
Expand Down
20 changes: 10 additions & 10 deletions src/i18n/strings/en_EN.json
Original file line number Diff line number Diff line change
Expand Up @@ -267,26 +267,26 @@
"Increase performance by only loading room members on first view": "Increase performance by only loading room members on first view",
"Backup of encryption keys to server": "Backup of encryption keys to server",
"Render simple counters in room header": "Render simple counters in room header",
"Enable Emoji suggestions while typing": "Enable Emoji suggestions while typing",
"Two-way device verification using short text": "Two-way device verification using short text",
"Disable Emoji suggestions while typing": "Disable Emoji suggestions while typing",
"Use compact timeline layout": "Use compact timeline layout",
"Hide removed messages": "Hide removed messages",
"Hide join/leave messages (invites/kicks/bans unaffected)": "Hide join/leave messages (invites/kicks/bans unaffected)",
"Hide avatar changes": "Hide avatar changes",
"Hide display name changes": "Hide display name changes",
"Hide read receipts": "Hide read receipts",
"Show a placeholder for removed messages": "Show a placeholder for removed messages",
"Show join/leave messages (invites/kicks/bans unaffected)": "Show join/leave messages (invites/kicks/bans unaffected)",
"Show avatar changes": "Show avatar changes",
"Show display name changes": "Show display name changes",
"Show read receipts": "Show read receipts",
"Show timestamps in 12 hour format (e.g. 2:30pm)": "Show timestamps in 12 hour format (e.g. 2:30pm)",
"Always show message timestamps": "Always show message timestamps",
"Autoplay GIFs and videos": "Autoplay GIFs and videos",
"Always show encryption icons": "Always show encryption icons",
"Show a reminder to enable Secure Message Recovery in encrypted rooms": "Show a reminder to enable Secure Message Recovery in encrypted rooms",
"Enable automatic language detection for syntax highlighting": "Enable automatic language detection for syntax highlighting",
"Hide avatars in user and room mentions": "Hide avatars in user and room mentions",
"Disable big emoji in chat": "Disable big emoji in chat",
"Don't send typing notifications": "Don't send typing notifications",
"Show avatars in user and room mentions": "Show avatars in user and room mentions",
"Enable big emoji in chat": "Enable big emoji in chat",
"Send typing notifications": "Send typing notifications",
"Automatically replace plain text Emoji": "Automatically replace plain text Emoji",
"Mirror local video feed": "Mirror local video feed",
"Disable Community Filter Panel": "Disable Community Filter Panel",
"Enable Community Filter Panel": "Enable Community Filter Panel",
"Disable Peer-to-Peer for 1:1 calls": "Disable Peer-to-Peer for 1:1 calls",
"Send analytics data": "Send analytics data",
"Never send encrypted messages to unverified devices from this device": "Never send encrypted messages to unverified devices from this device",
Expand Down
84 changes: 52 additions & 32 deletions src/settings/Settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,15 @@ export const SETTINGS = {
// // settings. The first element is treated as "most preferred". The "default"
// // level is always appended to the end.
// supportedLevelsAreOrdered: false,
//
// // Optional value to invert a boolean setting's value. The string given will
// // be read as the setting's ID instead of the one provided as the key for the
// // setting definition. By setting this, the returned value will automatically
// // be inverted, except for when the default value is returned. Inversion will
// // occur after the controller is asked for an override. This should be used by
// // historical settings which we don't want existing user's values be wiped. Do
// // not use this for new settings.
// invertedSettingName: "my-negative-setting",
// },
"feature_pinning": {
isFeature: true,
Expand Down Expand Up @@ -122,40 +131,46 @@ export const SETTINGS = {
supportedLevels: LEVELS_FEATURE,
default: false,
},
"MessageComposerInput.dontSuggestEmoji": {
"MessageComposerInput.suggestEmoji": {
supportedLevels: LEVELS_ACCOUNT_SETTINGS,
displayName: _td('Disable Emoji suggestions while typing'),
default: false,
displayName: _td('Enable Emoji suggestions while typing'),
default: true,
invertedSettingName: 'MessageComposerInput.dontSuggestEmoji',
},
"useCompactLayout": {
supportedLevels: LEVELS_ACCOUNT_SETTINGS,
displayName: _td('Use compact timeline layout'),
default: false,
},
"hideRedactions": {
"showRedactions": {
supportedLevels: LEVELS_ROOM_SETTINGS_WITH_ROOM,
displayName: _td('Hide removed messages'),
default: false,
displayName: _td('Show a placeholder for removed messages'),
default: true,
invertedSettingName: 'hideRedactions',
},
"hideJoinLeaves": {
"showJoinLeaves": {
supportedLevels: LEVELS_ROOM_SETTINGS_WITH_ROOM,
displayName: _td('Hide join/leave messages (invites/kicks/bans unaffected)'),
default: false,
displayName: _td('Show join/leave messages (invites/kicks/bans unaffected)'),
default: true,
invertedSettingName: 'hideJoinLeaves',
},
"hideAvatarChanges": {
"showAvatarChanges": {
supportedLevels: LEVELS_ROOM_SETTINGS_WITH_ROOM,
displayName: _td('Hide avatar changes'),
default: false,
displayName: _td('Show avatar changes'),
default: true,
invertedSettingName: 'hideAvatarChanges',
},
"hideDisplaynameChanges": {
"showDisplaynameChanges": {
supportedLevels: LEVELS_ROOM_SETTINGS_WITH_ROOM,
displayName: _td('Hide display name changes'),
default: false,
displayName: _td('Show display name changes'),
default: true,
invertedSettingName: 'hideDisplaynameChanges',
},
"hideReadReceipts": {
"showReadReceipts": {
supportedLevels: LEVELS_ROOM_SETTINGS,
displayName: _td('Hide read receipts'),
default: false,
displayName: _td('Show read receipts'),
default: true,
invertedSettingName: 'hideReadReceipts',
},
"showTwelveHourTimestamps": {
supportedLevels: LEVELS_ACCOUNT_SETTINGS,
Expand Down Expand Up @@ -187,15 +202,17 @@ export const SETTINGS = {
displayName: _td('Enable automatic language detection for syntax highlighting'),
default: false,
},
"Pill.shouldHidePillAvatar": {
"Pill.shouldShowPillAvatar": {
supportedLevels: LEVELS_ACCOUNT_SETTINGS,
displayName: _td('Hide avatars in user and room mentions'),
default: false,
displayName: _td('Show avatars in user and room mentions'),
default: true,
invertedSettingName: 'Pill.shouldHidePillAvatar',
},
"TextualBody.disableBigEmoji": {
"TextualBody.enableBigEmoji": {
supportedLevels: LEVELS_ACCOUNT_SETTINGS,
displayName: _td('Disable big emoji in chat'),
default: false,
displayName: _td('Enable big emoji in chat'),
default: true,
invertedSettingName: 'TextualBody.disableBigEmoji',
},
"MessageComposerInput.isRichTextEnabled": {
supportedLevels: LEVELS_ACCOUNT_SETTINGS,
Expand All @@ -205,10 +222,11 @@ export const SETTINGS = {
supportedLevels: LEVELS_ACCOUNT_SETTINGS,
default: false,
},
"dontSendTypingNotifications": {
"sendTypingNotifications": {
supportedLevels: LEVELS_ACCOUNT_SETTINGS,
displayName: _td("Don't send typing notifications"),
default: false,
displayName: _td("Send typing notifications"),
default: true,
invertedSettingName: 'dontSendTypingNotifications',
},
"MessageComposerInput.autoReplaceEmoji": {
supportedLevels: LEVELS_ACCOUNT_SETTINGS,
Expand All @@ -220,19 +238,21 @@ export const SETTINGS = {
displayName: _td('Mirror local video feed'),
default: false,
},
"TagPanel.disableTagPanel": {
"TagPanel.enableTagPanel": {
supportedLevels: LEVELS_ACCOUNT_SETTINGS,
displayName: _td('Disable Community Filter Panel'),
default: false,
displayName: _td('Enable Community Filter Panel'),
default: true,
invertedSettingName: 'TagPanel.disableTagPanel',
},
"theme": {
supportedLevels: ['config'],
default: "dharma",
},
"webRtcForceTURN": {
"webRtcForcePeerToPeer": {
supportedLevels: LEVELS_DEVICE_ONLY_SETTINGS_WITH_CONFIG,
displayName: _td('Disable Peer-to-Peer for 1:1 calls'),
default: false,
default: true,
invertedSettingName: 'webRtcForceTURN',
},
"webrtc_audiooutput": {
supportedLevels: LEVELS_DEVICE_ONLY_SETTINGS,
Expand Down
Loading