Merge branch 'develop' into travis/3pid-invites

This commit is contained in:
Travis Ralston 2020-09-15 08:53:32 -06:00
commit 246b802206
9 changed files with 11 additions and 31 deletions

View file

@ -394,16 +394,6 @@ $left-gutter: 64px;
opacity: 1; opacity: 1;
} }
.mx_EventTile_e2eIcon_hidden {
display: none;
}
/* always override hidden attribute for blocked and warning */
.mx_EventTile_e2eIcon_hidden[src*="img/e2e-blocked.svg"],
.mx_EventTile_e2eIcon_hidden[src*="img/e2e-warning.svg"] {
display: block;
}
.mx_EventTile_keyRequestInfo { .mx_EventTile_keyRequestInfo {
font-size: $font-12px; font-size: $font-12px;
} }

View file

@ -33,6 +33,7 @@ import Modal from './Modal';
import SettingsStore from "./settings/SettingsStore"; import SettingsStore from "./settings/SettingsStore";
import { hideToast as hideNotificationsToast } from "./toasts/DesktopNotificationsToast"; import { hideToast as hideNotificationsToast } from "./toasts/DesktopNotificationsToast";
import {SettingLevel} from "./settings/SettingLevel"; import {SettingLevel} from "./settings/SettingLevel";
import {isPushNotifyDisabled} from "./settings/controllers/NotificationControllers";
/* /*
* Dispatches: * Dispatches:
@ -258,7 +259,7 @@ export const Notifier = {
} }
// set the notifications_hidden flag, as the user has knowingly interacted // set the notifications_hidden flag, as the user has knowingly interacted
// with the setting we shouldn't nag them any further // with the setting we shouldn't nag them any further
this.setToolbarHidden(true); this.setPromptHidden(true);
}, },
isEnabled: function() { isEnabled: function() {
@ -283,7 +284,7 @@ export const Notifier = {
return SettingsStore.getValue("audioNotificationsEnabled"); return SettingsStore.getValue("audioNotificationsEnabled");
}, },
setToolbarHidden: function(hidden: boolean, persistent = true) { setPromptHidden: function(hidden: boolean, persistent = true) {
this.toolbarHidden = hidden; this.toolbarHidden = hidden;
Analytics.trackEvent('Notifier', 'Set Toolbar Hidden', hidden); Analytics.trackEvent('Notifier', 'Set Toolbar Hidden', hidden);
@ -296,17 +297,17 @@ export const Notifier = {
} }
}, },
shouldShowToolbar: function() { shouldShowPrompt: function() {
const client = MatrixClientPeg.get(); const client = MatrixClientPeg.get();
if (!client) { if (!client) {
return false; return false;
} }
const isGuest = client.isGuest(); const isGuest = client.isGuest();
return !isGuest && this.supportsDesktopNotifications() && return !isGuest && this.supportsDesktopNotifications() && !isPushNotifyDisabled() &&
!this.isEnabled() && !this._isToolbarHidden(); !this.isEnabled() && !this._isPromptHidden();
}, },
_isToolbarHidden: function() { _isPromptHidden: function() {
// Check localStorage for any such meta data // Check localStorage for any such meta data
if (global.localStorage) { if (global.localStorage) {
return global.localStorage.getItem("notifications_hidden") === "true"; return global.localStorage.getItem("notifications_hidden") === "true";

View file

@ -1363,7 +1363,7 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
this.firstSyncComplete = true; this.firstSyncComplete = true;
this.firstSyncPromise.resolve(); this.firstSyncPromise.resolve();
if (Notifier.shouldShowToolbar()) { if (Notifier.shouldShowPrompt()) {
showNotificationsToast(); showNotificationsToast();
} }

View file

@ -1027,11 +1027,7 @@ class E2ePadlock extends React.Component {
tooltip = <Tooltip className="mx_EventTile_e2eIcon_tooltip" label={this.props.title} dir="auto" />; tooltip = <Tooltip className="mx_EventTile_e2eIcon_tooltip" label={this.props.title} dir="auto" />;
} }
let classes = `mx_EventTile_e2eIcon mx_EventTile_e2eIcon_${this.props.icon}`; const classes = `mx_EventTile_e2eIcon mx_EventTile_e2eIcon_${this.props.icon}`;
if (!SettingsStore.getValue("alwaysShowEncryptionIcons")) {
classes += ' mx_EventTile_e2eIcon_hidden';
}
return ( return (
<div <div
className={classes} className={classes}

View file

@ -52,7 +52,6 @@ export default class PreferencesUserSettingsTab extends React.Component {
]; ];
static ADVANCED_SETTINGS = [ static ADVANCED_SETTINGS = [
'alwaysShowEncryptionIcons',
'Pill.shouldShowPillAvatar', 'Pill.shouldShowPillAvatar',
'TagPanel.enableTagPanel', 'TagPanel.enableTagPanel',
'promptBeforeInviteUnknownUsers', 'promptBeforeInviteUnknownUsers',

View file

@ -474,7 +474,6 @@
"Show timestamps in 12 hour format (e.g. 2:30pm)": "Show timestamps in 12 hour format (e.g. 2:30pm)", "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", "Always show message timestamps": "Always show message timestamps",
"Autoplay GIFs and videos": "Autoplay GIFs and videos", "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", "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", "Enable automatic language detection for syntax highlighting": "Enable automatic language detection for syntax highlighting",
"Show avatars in user and room mentions": "Show avatars in user and room mentions", "Show avatars in user and room mentions": "Show avatars in user and room mentions",

View file

@ -275,11 +275,6 @@ export const SETTINGS: {[setting: string]: ISetting} = {
displayName: _td('Autoplay GIFs and videos'), displayName: _td('Autoplay GIFs and videos'),
default: false, default: false,
}, },
"alwaysShowEncryptionIcons": {
supportedLevels: LEVELS_ACCOUNT_SETTINGS,
displayName: _td('Always show encryption icons'),
default: true,
},
"showRoomRecoveryReminder": { "showRoomRecoveryReminder": {
supportedLevels: LEVELS_ACCOUNT_SETTINGS, supportedLevels: LEVELS_ACCOUNT_SETTINGS,
displayName: _td('Show a reminder to enable Secure Message Recovery in encrypted rooms'), displayName: _td('Show a reminder to enable Secure Message Recovery in encrypted rooms'),

View file

@ -24,7 +24,7 @@ import {PushProcessor} from "matrix-js-sdk/src/pushprocessor";
// .m.rule.master being enabled means all events match that push rule // .m.rule.master being enabled means all events match that push rule
// default action on this rule is dont_notify, but it could be something else // default action on this rule is dont_notify, but it could be something else
function isPushNotifyDisabled(): boolean { export function isPushNotifyDisabled(): boolean {
// Return the value of the master push rule as a default // Return the value of the master push rule as a default
const processor = new PushProcessor(MatrixClientPeg.get()); const processor = new PushProcessor(MatrixClientPeg.get());
const masterRule = processor.getPushRuleById(".m.rule.master"); const masterRule = processor.getPushRuleById(".m.rule.master");

View file

@ -24,7 +24,7 @@ const onAccept = () => {
}; };
const onReject = () => { const onReject = () => {
Notifier.setToolbarHidden(true); Notifier.setPromptHidden(true);
}; };
const TOAST_KEY = "desktopnotifications"; const TOAST_KEY = "desktopnotifications";