Skip to content

Commit a3b73ef

Browse files
committed
Pull request 2632: AGDNS-3866 fix browsing security and parental control settings translations
Squashed commit of the following: commit 8a12d4f Author: Ildar Kamalov <ik@adguard.com> Date: Tue Apr 14 17:15:22 2026 +0300 changelog commit 6443155 Author: Ildar Kamalov <ik@adguard.com> Date: Tue Apr 14 17:13:38 2026 +0300 AGDNS-3866 fix browsing security and parental control translations
1 parent 1241dea commit a3b73ef

3 files changed

Lines changed: 27 additions & 57 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ In this release, the schema version has changed from 33 to 34.
6161

6262
### Fixed
6363

64+
- Safe Browsing and Parental Control labels on the General Settings page not updating after changing the UI language.
65+
6466
- Incorrect forwarding of root domain requests when domain-specific upstreams are configured ([#7058]).
6567

6668
- The strict SNI check setting is not persisted when the TLS configuration is changed ([#8327]).

client/src/actions/index.tsx

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -79,27 +79,17 @@ export const initSettingsRequest = createAction('SETTINGS_INIT_REQUEST');
7979
export const initSettingsFailure = createAction('SETTINGS_INIT_FAILURE');
8080
export const initSettingsSuccess = createAction('SETTINGS_INIT_SUCCESS');
8181

82-
export const initSettings =
83-
(
84-
settingsList = {
85-
safebrowsing: {},
86-
parental: {},
87-
},
88-
) =>
89-
async (dispatch: any) => {
82+
export const initSettings = () => async (dispatch: any) => {
9083
dispatch(initSettingsRequest());
9184
try {
9285
const safebrowsingStatus = await apiClient.getSafebrowsingStatus();
9386
const parentalStatus = await apiClient.getParentalStatus();
9487
const safesearchStatus = await apiClient.getSafesearchStatus();
95-
const { safebrowsing, parental } = settingsList;
9688
const newSettingsList = {
9789
safebrowsing: {
98-
...safebrowsing,
9990
enabled: safebrowsingStatus.enabled,
10091
},
10192
parental: {
102-
...parental,
10393
enabled: parentalStatus.enabled,
10494
},
10595
safesearch: {

client/src/components/Settings/index.tsx

Lines changed: 24 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -16,29 +16,10 @@ import PageTitle from '../ui/PageTitle';
1616

1717
import Card from '../ui/Card';
1818

19-
import { getObjectKeysSorted, captitalizeWords } from '../../helpers/helpers';
19+
import { captitalizeWords } from '../../helpers/helpers';
2020
import './Settings.css';
2121
import { SettingsData } from '../../initialState';
2222

23-
const ORDER_KEY = 'order';
24-
25-
const SETTINGS = {
26-
safebrowsing: {
27-
enabled: false,
28-
title: i18next.t('use_adguard_browsing_sec'),
29-
subtitle: i18next.t('use_adguard_browsing_sec_hint'),
30-
testId: 'safebrowsing',
31-
[ORDER_KEY]: 0,
32-
},
33-
parental: {
34-
enabled: false,
35-
title: i18next.t('use_adguard_parental'),
36-
subtitle: i18next.t('use_adguard_parental_hint'),
37-
testId: 'parental',
38-
[ORDER_KEY]: 1,
39-
},
40-
};
41-
4223
interface SettingsProps {
4324
initSettings: (...args: unknown[]) => unknown;
4425
settings: SettingsData;
@@ -82,7 +63,7 @@ interface SettingsProps {
8263

8364
class Settings extends Component<SettingsProps> {
8465
componentDidMount() {
85-
this.props.initSettings(SETTINGS);
66+
this.props.initSettings();
8667

8768
this.props.getStatsConfig();
8869

@@ -91,31 +72,9 @@ class Settings extends Component<SettingsProps> {
9172
this.props.getFilteringStatus();
9273
}
9374

94-
renderSettings = (settings: any) =>
95-
getObjectKeysSorted(SETTINGS, ORDER_KEY).map((key: any) => {
96-
const setting = settings[key];
97-
const { enabled, title, subtitle, testId } = setting;
98-
99-
return (
100-
<div key={key} className="form__group form__group--checkbox">
101-
<Checkbox
102-
data-testid={testId}
103-
value={enabled}
104-
title={title}
105-
subtitle={subtitle}
106-
onChange={(checked) => this.props.toggleSetting(key, !checked)}
107-
/>
108-
</div>
109-
);
110-
});
111-
11275
renderSafeSearch = () => {
113-
const {
114-
settings: {
115-
settingsList: { safesearch },
116-
},
117-
} = this.props;
118-
const { enabled } = safesearch || {};
76+
const safesearch = this.props.settings.settingsList?.safesearch || {};
77+
const { enabled } = safesearch;
11978
const searches = { ...(safesearch || {}) };
12079
delete searches.enabled;
12180

@@ -164,6 +123,8 @@ class Settings extends Component<SettingsProps> {
164123
setFiltersConfig,
165124
t,
166125
} = this.props;
126+
const safebrowsingEnabled = settings.settingsList?.safebrowsing?.enabled ?? false;
127+
const parentalEnabled = settings.settingsList?.parental?.enabled ?? false;
167128

168129
const isDataReady = !settings.processing && !stats.processingGetConfig && !queryLogs.processingGetConfig;
169130

@@ -187,7 +148,24 @@ class Settings extends Component<SettingsProps> {
187148
processing={filtering.processingSetConfig}
188149
setFiltersConfig={setFiltersConfig}
189150
/>
190-
{this.renderSettings(settings.settingsList)}
151+
<div className="form__group form__group--checkbox">
152+
<Checkbox
153+
data-testid="safebrowsing"
154+
value={safebrowsingEnabled}
155+
title={t('use_adguard_browsing_sec')}
156+
subtitle={t('use_adguard_browsing_sec_hint')}
157+
onChange={(checked) => this.props.toggleSetting('safebrowsing', !checked)}
158+
/>
159+
</div>
160+
<div className="form__group form__group--checkbox">
161+
<Checkbox
162+
data-testid="parental"
163+
value={parentalEnabled}
164+
title={t('use_adguard_parental')}
165+
subtitle={t('use_adguard_parental_hint')}
166+
onChange={(checked) => this.props.toggleSetting('parental', !checked)}
167+
/>
168+
</div>
191169
{this.renderSafeSearch()}
192170
</div>
193171
</Card>

0 commit comments

Comments
 (0)