Privacy: sensitive content
This commit is contained in:
parent
4b6dd5dee4
commit
73d030dd69
@ -4,7 +4,7 @@
|
||||
* https://github.com/morethanwords/tweb/blob/master/LICENSE
|
||||
*/
|
||||
|
||||
import { SliderSuperTab } from "../../slider";
|
||||
import { SliderSuperTabEventable } from "../../sliderTab";
|
||||
import { SettingSection } from "..";
|
||||
import Row from "../../row";
|
||||
import { AccountPassword, Authorization, InputPrivacyKey } from "../../../layer";
|
||||
@ -27,12 +27,13 @@ import rootScope from "../../../lib/rootScope";
|
||||
import { convertKeyToInputKey } from "../../../helpers/string";
|
||||
import { i18n, LangPackKey, _i18n } from "../../../lib/langPack";
|
||||
import replaceContent from "../../../helpers/dom/replaceContent";
|
||||
import CheckboxField from "../../checkboxField";
|
||||
|
||||
export default class AppPrivacyAndSecurityTab extends SliderSuperTab {
|
||||
export default class AppPrivacyAndSecurityTab extends SliderSuperTabEventable {
|
||||
private activeSessionsRow: Row;
|
||||
private authorizations: Authorization.authorization[];
|
||||
|
||||
protected init() {
|
||||
protected async init() {
|
||||
this.container.classList.add('privacy-container');
|
||||
this.setTitle('PrivacySettings');
|
||||
|
||||
@ -224,6 +225,39 @@ export default class AppPrivacyAndSecurityTab extends SliderSuperTab {
|
||||
updatePrivacyRow(convertKeyToInputKey(update.key._) as any);
|
||||
});
|
||||
}
|
||||
|
||||
{
|
||||
await apiManager.invokeApi('account.getContentSettings').then(settings => {
|
||||
if(!settings.pFlags.sensitive_can_change) {
|
||||
return;
|
||||
}
|
||||
|
||||
const enabled = settings.pFlags.sensitive_enabled;
|
||||
const section = new SettingSection({name: 'Privacy.SensitiveContent'});
|
||||
|
||||
const sensitiveRow = new Row({
|
||||
checkboxField: new CheckboxField({text: 'PrivacyAndSecurity.SensitiveText', checked: enabled}),
|
||||
subtitleLangKey: 'PrivacyAndSecurity.SensitiveDesc',
|
||||
noCheckboxSubtitle: true
|
||||
});
|
||||
|
||||
section.content.append(sensitiveRow.container);
|
||||
|
||||
this.scrollable.append(section.container);
|
||||
|
||||
this.eventListener.addEventListener('destroy', () => {
|
||||
const _enabled = sensitiveRow.checkboxField.checked;
|
||||
const isChanged = _enabled !== enabled;
|
||||
if(!isChanged) {
|
||||
return;
|
||||
}
|
||||
|
||||
apiManager.invokeApi('account.setContentSettings', {
|
||||
sensitive_enabled: _enabled
|
||||
});
|
||||
}, true);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public updateActiveSessions() {
|
||||
|
@ -15,7 +15,7 @@ const App = {
|
||||
id: 1025907,
|
||||
hash: '452b0359b988148995f22ff0f4229750',
|
||||
version: '0.5.7',
|
||||
langPackVersion: '0.2.4',
|
||||
langPackVersion: '0.2.5',
|
||||
langPack: 'macos',
|
||||
langPackCode: 'en',
|
||||
domains: [] as string[],
|
||||
|
@ -82,6 +82,7 @@ const lang = {
|
||||
"one_value": "%1$d device",
|
||||
"other_value": "%1$d devices"
|
||||
},
|
||||
"Privacy.SensitiveContent": "Sensitive Content",
|
||||
"PrivacyModal.Search.Placeholder": "Add Users or Groups...",
|
||||
"Permissions.NoExceptions": "No exceptions",
|
||||
"Permissions.ExceptionsCount": {
|
||||
@ -683,6 +684,8 @@ const lang = {
|
||||
},
|
||||
"PrivacyAndSecurity.Item.On": "On",
|
||||
"PrivacyAndSecurity.Item.Off": "Off",
|
||||
"PrivacyAndSecurity.SensitiveText": "Disable filtering",
|
||||
"PrivacyAndSecurity.SensitiveDesc": "Display sensitive media in public channels on all your Telegram devices.",
|
||||
"PrivacySettings.VoiceCalls": "Calls",
|
||||
"PrivacySettings.Forwards": "Forwarded Messages",
|
||||
"PrivacySettings.Groups": "Groups and Channels",
|
||||
|
Loading…
x
Reference in New Issue
Block a user