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

Commit

Permalink
Use allow/deny instead of whitelist/blacklist for terminology
Browse files Browse the repository at this point in the history
  • Loading branch information
turt2live committed Mar 26, 2019
1 parent 3654c89 commit 69fcebf
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/WidgetMessaging.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,11 +131,11 @@ export default class WidgetMessaging {
const widgetSecurityKey = WidgetUtils.getWidgetSecurityKey(this.widgetId, this.widgetUrl, this.isUserWidget);

const settings = SettingsStore.getValue("widgetOpenIDPermissions");
if (settings.blacklist && settings.blacklist.includes(widgetSecurityKey)) {
if (settings.deny && settings.deny.includes(widgetSecurityKey)) {
this.fromWidget.sendResponse(rawEv, {state: "blocked"});
return;
}
if (settings.whitelist && settings.whitelist.includes(widgetSecurityKey)) {
if (settings.allow && settings.allow.includes(widgetSecurityKey)) {
const responseBody = {state: "allowed"};
const credentials = await MatrixClientPeg.get().getOpenIdToken();
Object.assign(responseBody, credentials);
Expand Down
6 changes: 3 additions & 3 deletions src/components/views/dialogs/WidgetOpenIDPermissionsDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,14 @@ export default class WidgetOpenIDPermissionsDialog extends React.Component {
console.log(`Remembering ${this.props.widgetId} as allowed=${allowed} for OpenID`);

const currentValues = SettingsStore.getValue("widgetOpenIDPermissions");
if (!currentValues.whitelist) currentValues.whitelist = [];
if (!currentValues.blacklist) currentValues.blacklist = [];
if (!currentValues.allow) currentValues.allow = [];
if (!currentValues.deny) currentValues.deny = [];

const securityKey = WidgetUtils.getWidgetSecurityKey(
this.props.widgetId,
this.props.widgetUrl,
this.props.isUserWidget);
(allowed ? currentValues.whitelist : currentValues.blacklist).push(securityKey);
(allowed ? currentValues.allow : currentValues.deny).push(securityKey);
SettingsStore.setValue("widgetOpenIDPermissions", null, SettingLevel.DEVICE, currentValues);
}

Expand Down
4 changes: 2 additions & 2 deletions src/settings/Settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -343,8 +343,8 @@ export const SETTINGS = {
"widgetOpenIDPermissions": {
supportedLevels: LEVELS_DEVICE_ONLY_SETTINGS,
default: {
whitelist: [],
blacklist: [],
allow: [],
deny: [],
},
},
"RoomList.orderByImportance": {
Expand Down

0 comments on commit 69fcebf

Please sign in to comment.