PLT-4762 Prevent turn off of (at)mentions (webapp) (#4715)
Этот коммит содержится в:
коммит произвёл
Joram Wilander
родитель
e57cba15ea
Коммит
3ea49822b3
@@ -52,14 +52,13 @@ function getNotificationsStateFromStores() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let usernameKey = false;
|
let usernameKey = false;
|
||||||
let mentionKey = false;
|
|
||||||
let customKeys = '';
|
let customKeys = '';
|
||||||
let firstNameKey = false;
|
let firstNameKey = false;
|
||||||
let channelKey = false;
|
let channelKey = false;
|
||||||
|
|
||||||
if (user.notify_props) {
|
if (user.notify_props) {
|
||||||
if (user.notify_props.mention_keys) {
|
if (user.notify_props.mention_keys) {
|
||||||
var keys = user.notify_props.mention_keys.split(',');
|
const keys = user.notify_props.mention_keys.split(',');
|
||||||
|
|
||||||
if (keys.indexOf(user.username) === -1) {
|
if (keys.indexOf(user.username) === -1) {
|
||||||
usernameKey = false;
|
usernameKey = false;
|
||||||
@@ -68,13 +67,6 @@ function getNotificationsStateFromStores() {
|
|||||||
keys.splice(keys.indexOf(user.username), 1);
|
keys.splice(keys.indexOf(user.username), 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (keys.indexOf('@' + user.username) === -1) {
|
|
||||||
mentionKey = false;
|
|
||||||
} else {
|
|
||||||
mentionKey = true;
|
|
||||||
keys.splice(keys.indexOf('@' + user.username), 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
customKeys = keys.join(',');
|
customKeys = keys.join(',');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -95,7 +87,6 @@ function getNotificationsStateFromStores() {
|
|||||||
pushStatus,
|
pushStatus,
|
||||||
desktopSound: sound,
|
desktopSound: sound,
|
||||||
usernameKey,
|
usernameKey,
|
||||||
mentionKey,
|
|
||||||
customKeys,
|
customKeys,
|
||||||
customKeysChecked: customKeys.length > 0,
|
customKeysChecked: customKeys.length > 0,
|
||||||
firstNameKey,
|
firstNameKey,
|
||||||
@@ -117,7 +108,6 @@ export default class NotificationsTab extends React.Component {
|
|||||||
this.onListenerChange = this.onListenerChange.bind(this);
|
this.onListenerChange = this.onListenerChange.bind(this);
|
||||||
this.handleEmailRadio = this.handleEmailRadio.bind(this);
|
this.handleEmailRadio = this.handleEmailRadio.bind(this);
|
||||||
this.updateUsernameKey = this.updateUsernameKey.bind(this);
|
this.updateUsernameKey = this.updateUsernameKey.bind(this);
|
||||||
this.updateMentionKey = this.updateMentionKey.bind(this);
|
|
||||||
this.updateFirstNameKey = this.updateFirstNameKey.bind(this);
|
this.updateFirstNameKey = this.updateFirstNameKey.bind(this);
|
||||||
this.updateChannelKey = this.updateChannelKey.bind(this);
|
this.updateChannelKey = this.updateChannelKey.bind(this);
|
||||||
this.updateCustomMentionKeys = this.updateCustomMentionKeys.bind(this);
|
this.updateCustomMentionKeys = this.updateCustomMentionKeys.bind(this);
|
||||||
@@ -129,7 +119,7 @@ export default class NotificationsTab extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
handleSubmit() {
|
handleSubmit() {
|
||||||
var data = {};
|
const data = {};
|
||||||
data.user_id = this.props.user.id;
|
data.user_id = this.props.user.id;
|
||||||
data.email = this.state.enableEmail;
|
data.email = this.state.enableEmail;
|
||||||
data.desktop_sound = this.state.desktopSound;
|
data.desktop_sound = this.state.desktopSound;
|
||||||
@@ -139,15 +129,12 @@ export default class NotificationsTab extends React.Component {
|
|||||||
data.push_status = this.state.pushStatus;
|
data.push_status = this.state.pushStatus;
|
||||||
data.comments = this.state.notifyCommentsLevel;
|
data.comments = this.state.notifyCommentsLevel;
|
||||||
|
|
||||||
var mentionKeys = [];
|
const mentionKeys = [];
|
||||||
if (this.state.usernameKey) {
|
if (this.state.usernameKey) {
|
||||||
mentionKeys.push(this.props.user.username);
|
mentionKeys.push(this.props.user.username);
|
||||||
}
|
}
|
||||||
if (this.state.mentionKey) {
|
|
||||||
mentionKeys.push('@' + this.props.user.username);
|
|
||||||
}
|
|
||||||
|
|
||||||
var stringKeys = mentionKeys.join(',');
|
let stringKeys = mentionKeys.join(',');
|
||||||
if (this.state.customKeys.length > 0 && this.state.customKeysChecked) {
|
if (this.state.customKeys.length > 0 && this.state.customKeysChecked) {
|
||||||
stringKeys += ',' + this.state.customKeys;
|
stringKeys += ',' + this.state.customKeys;
|
||||||
}
|
}
|
||||||
@@ -229,10 +216,6 @@ export default class NotificationsTab extends React.Component {
|
|||||||
this.setState({usernameKey: val});
|
this.setState({usernameKey: val});
|
||||||
}
|
}
|
||||||
|
|
||||||
updateMentionKey(val) {
|
|
||||||
this.setState({mentionKey: val});
|
|
||||||
}
|
|
||||||
|
|
||||||
updateFirstNameKey(val) {
|
updateFirstNameKey(val) {
|
||||||
this.setState({firstNameKey: val});
|
this.setState({firstNameKey: val});
|
||||||
}
|
}
|
||||||
@@ -242,10 +225,10 @@ export default class NotificationsTab extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
updateCustomMentionKeys() {
|
updateCustomMentionKeys() {
|
||||||
var checked = this.refs.customcheck.checked;
|
const checked = this.refs.customcheck.checked;
|
||||||
|
|
||||||
if (checked) {
|
if (checked) {
|
||||||
var text = this.refs.custommentions.value;
|
const text = this.refs.custommentions.value;
|
||||||
|
|
||||||
// remove all spaces and split string into individual keys
|
// remove all spaces and split string into individual keys
|
||||||
this.setState({customKeys: text.replace(/ /g, ''), customKeysChecked: true});
|
this.setState({customKeys: text.replace(/ /g, ''), customKeysChecked: true});
|
||||||
@@ -524,8 +507,8 @@ export default class NotificationsTab extends React.Component {
|
|||||||
const serverError = this.state.serverError;
|
const serverError = this.state.serverError;
|
||||||
const user = this.props.user;
|
const user = this.props.user;
|
||||||
|
|
||||||
var keysSection;
|
let keysSection;
|
||||||
var handleUpdateKeysSection;
|
let handleUpdateKeysSection;
|
||||||
if (this.props.activeSection === 'keys') {
|
if (this.props.activeSection === 'keys') {
|
||||||
const inputs = [];
|
const inputs = [];
|
||||||
|
|
||||||
@@ -579,30 +562,6 @@ export default class NotificationsTab extends React.Component {
|
|||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
||||||
const handleUpdateMentionKey = (e) => {
|
|
||||||
this.updateMentionKey(e.target.checked);
|
|
||||||
};
|
|
||||||
inputs.push(
|
|
||||||
<div key='userNotificationMentionOption'>
|
|
||||||
<div className='checkbox'>
|
|
||||||
<label>
|
|
||||||
<input
|
|
||||||
type='checkbox'
|
|
||||||
checked={this.state.mentionKey}
|
|
||||||
onChange={handleUpdateMentionKey}
|
|
||||||
/>
|
|
||||||
<FormattedMessage
|
|
||||||
id='user.settings.notifications.usernameMention'
|
|
||||||
defaultMessage='Your username mentioned "@{username}"'
|
|
||||||
values={{
|
|
||||||
username: user.username
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
|
|
||||||
const handleUpdateChannelKey = (e) => {
|
const handleUpdateChannelKey = (e) => {
|
||||||
this.updateChannelKey(e.target.checked);
|
this.updateChannelKey(e.target.checked);
|
||||||
};
|
};
|
||||||
@@ -667,9 +626,6 @@ export default class NotificationsTab extends React.Component {
|
|||||||
if (this.state.usernameKey) {
|
if (this.state.usernameKey) {
|
||||||
keys.push(user.username);
|
keys.push(user.username);
|
||||||
}
|
}
|
||||||
if (this.state.mentionKey) {
|
|
||||||
keys.push('@' + user.username);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.state.channelKey) {
|
if (this.state.channelKey) {
|
||||||
keys.push('@channel');
|
keys.push('@channel');
|
||||||
@@ -680,7 +636,7 @@ export default class NotificationsTab extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let describe = '';
|
let describe = '';
|
||||||
for (var i = 0; i < keys.length; i++) {
|
for (let i = 0; i < keys.length; i++) {
|
||||||
if (keys[i] !== '') {
|
if (keys[i] !== '') {
|
||||||
describe += '"' + keys[i] + '", ';
|
describe += '"' + keys[i] + '", ';
|
||||||
}
|
}
|
||||||
@@ -710,10 +666,10 @@ export default class NotificationsTab extends React.Component {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
var commentsSection;
|
let commentsSection;
|
||||||
var handleUpdateCommentsSection;
|
let handleUpdateCommentsSection;
|
||||||
if (this.props.activeSection === 'comments') {
|
if (this.props.activeSection === 'comments') {
|
||||||
var commentsActive = [false, false, false];
|
const commentsActive = [false, false, false];
|
||||||
if (this.state.notifyCommentsLevel === 'never') {
|
if (this.state.notifyCommentsLevel === 'never') {
|
||||||
commentsActive[2] = true;
|
commentsActive[2] = true;
|
||||||
} else if (this.state.notifyCommentsLevel === 'root') {
|
} else if (this.state.notifyCommentsLevel === 'root') {
|
||||||
|
|||||||
@@ -2046,7 +2046,6 @@
|
|||||||
"user.settings.notifications.sounds_info": "Notification sounds are available on IE11, Edge, Safari, Chrome and Mattermost Desktop Apps.",
|
"user.settings.notifications.sounds_info": "Notification sounds are available on IE11, Edge, Safari, Chrome and Mattermost Desktop Apps.",
|
||||||
"user.settings.notifications.teamWide": "Team-wide mentions \"@all\"",
|
"user.settings.notifications.teamWide": "Team-wide mentions \"@all\"",
|
||||||
"user.settings.notifications.title": "Notification Settings",
|
"user.settings.notifications.title": "Notification Settings",
|
||||||
"user.settings.notifications.usernameMention": "Your username mentioned \"@{username}\"",
|
|
||||||
"user.settings.notifications.wordsTrigger": "Words that trigger mentions",
|
"user.settings.notifications.wordsTrigger": "Words that trigger mentions",
|
||||||
"user.settings.push_notification.allActivity": "For all activity",
|
"user.settings.push_notification.allActivity": "For all activity",
|
||||||
"user.settings.push_notification.allActivityAway": "For all activity when away or offline",
|
"user.settings.push_notification.allActivityAway": "For all activity when away or offline",
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user