Fixed @all not working as intended (#3335)
Этот коммит содержится в:
коммит произвёл
Joram Wilander
родитель
ba77aefe02
Коммит
dbcf8572e5
@@ -515,14 +515,10 @@ func sendNotifications(c *Context, post *model.Post, team *model.Team, channel *
|
|||||||
keywordMap[profile.FirstName] = append(keywordMap[profile.FirstName], profile.Id)
|
keywordMap[profile.FirstName] = append(keywordMap[profile.FirstName], profile.Id)
|
||||||
}
|
}
|
||||||
|
|
||||||
//Add @all to keywords if user has them turned on
|
// Add @channel and @all to keywords if user has them turned on
|
||||||
if profile.NotifyProps["all"] == "true" {
|
|
||||||
keywordMap["@all"] = append(keywordMap["@all"], profile.Id)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add @channel to keywords if user has them turned on
|
|
||||||
if profile.NotifyProps["channel"] == "true" {
|
if profile.NotifyProps["channel"] == "true" {
|
||||||
keywordMap["@channel"] = append(keywordMap["@channel"], profile.Id)
|
keywordMap["@channel"] = append(keywordMap["@channel"], profile.Id)
|
||||||
|
keywordMap["@all"] = append(keywordMap["@all"], profile.Id)
|
||||||
}
|
}
|
||||||
|
|
||||||
if profile.NotifyProps["push"] == model.USER_NOTIFY_ALL &&
|
if profile.NotifyProps["push"] == model.USER_NOTIFY_ALL &&
|
||||||
|
|||||||
@@ -208,7 +208,6 @@ func (u *User) SetDefaultNotifications() {
|
|||||||
u.NotifyProps["desktop"] = USER_NOTIFY_ALL
|
u.NotifyProps["desktop"] = USER_NOTIFY_ALL
|
||||||
u.NotifyProps["desktop_sound"] = "true"
|
u.NotifyProps["desktop_sound"] = "true"
|
||||||
u.NotifyProps["mention_keys"] = u.Username + ",@" + u.Username
|
u.NotifyProps["mention_keys"] = u.Username + ",@" + u.Username
|
||||||
u.NotifyProps["all"] = "true"
|
|
||||||
u.NotifyProps["channel"] = "true"
|
u.NotifyProps["channel"] = "true"
|
||||||
|
|
||||||
if u.FirstName == "" {
|
if u.FirstName == "" {
|
||||||
|
|||||||
@@ -125,12 +125,9 @@ export default class ChannelHeader extends React.Component {
|
|||||||
if (user.notify_props && user.notify_props.mention_keys) {
|
if (user.notify_props && user.notify_props.mention_keys) {
|
||||||
const termKeys = UserStore.getMentionKeys(user.id);
|
const termKeys = UserStore.getMentionKeys(user.id);
|
||||||
|
|
||||||
if (user.notify_props.all === 'true' && termKeys.indexOf('@all') !== -1) {
|
if (user.notify_props.channel === 'true' && termKeys.indexOf('@channel') !== -1 && termKeys.indexOf('@all') !== -1) {
|
||||||
termKeys.splice(termKeys.indexOf('@all'), 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (user.notify_props.channel === 'true' && termKeys.indexOf('@channel') !== -1) {
|
|
||||||
termKeys.splice(termKeys.indexOf('@channel'), 1);
|
termKeys.splice(termKeys.indexOf('@channel'), 1);
|
||||||
|
termKeys.splice(termKeys.indexOf('@all'), 1);
|
||||||
}
|
}
|
||||||
terms = termKeys.join(' ');
|
terms = termKeys.join(' ');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,7 +39,6 @@ function getNotificationsStateFromStores() {
|
|||||||
var mentionKey = false;
|
var mentionKey = false;
|
||||||
var customKeys = '';
|
var customKeys = '';
|
||||||
var firstNameKey = false;
|
var firstNameKey = false;
|
||||||
var allKey = false;
|
|
||||||
var channelKey = false;
|
var channelKey = false;
|
||||||
|
|
||||||
if (user.notify_props) {
|
if (user.notify_props) {
|
||||||
@@ -67,10 +66,6 @@ function getNotificationsStateFromStores() {
|
|||||||
firstNameKey = user.notify_props.first_name === 'true';
|
firstNameKey = user.notify_props.first_name === 'true';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (user.notify_props.all) {
|
|
||||||
allKey = user.notify_props.all === 'true';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (user.notify_props.channel) {
|
if (user.notify_props.channel) {
|
||||||
channelKey = user.notify_props.channel === 'true';
|
channelKey = user.notify_props.channel === 'true';
|
||||||
}
|
}
|
||||||
@@ -87,7 +82,6 @@ function getNotificationsStateFromStores() {
|
|||||||
customKeys,
|
customKeys,
|
||||||
customKeysChecked: customKeys.length > 0,
|
customKeysChecked: customKeys.length > 0,
|
||||||
firstNameKey,
|
firstNameKey,
|
||||||
allKey,
|
|
||||||
channelKey
|
channelKey
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -132,7 +126,6 @@ class NotificationsTab extends React.Component {
|
|||||||
this.updateUsernameKey = this.updateUsernameKey.bind(this);
|
this.updateUsernameKey = this.updateUsernameKey.bind(this);
|
||||||
this.updateMentionKey = this.updateMentionKey.bind(this);
|
this.updateMentionKey = this.updateMentionKey.bind(this);
|
||||||
this.updateFirstNameKey = this.updateFirstNameKey.bind(this);
|
this.updateFirstNameKey = this.updateFirstNameKey.bind(this);
|
||||||
this.updateAllKey = this.updateAllKey.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);
|
||||||
this.onCustomChange = this.onCustomChange.bind(this);
|
this.onCustomChange = this.onCustomChange.bind(this);
|
||||||
@@ -228,9 +221,6 @@ class NotificationsTab extends React.Component {
|
|||||||
updateFirstNameKey(val) {
|
updateFirstNameKey(val) {
|
||||||
this.setState({firstNameKey: val});
|
this.setState({firstNameKey: val});
|
||||||
}
|
}
|
||||||
updateAllKey(val) {
|
|
||||||
this.setState({allKey: val});
|
|
||||||
}
|
|
||||||
updateChannelKey(val) {
|
updateChannelKey(val) {
|
||||||
this.setState({channelKey: val});
|
this.setState({channelKey: val});
|
||||||
}
|
}
|
||||||
@@ -730,7 +720,6 @@ class NotificationsTab extends React.Component {
|
|||||||
let handleUpdateFirstNameKey;
|
let handleUpdateFirstNameKey;
|
||||||
let handleUpdateUsernameKey;
|
let handleUpdateUsernameKey;
|
||||||
let handleUpdateMentionKey;
|
let handleUpdateMentionKey;
|
||||||
let handleUpdateAllKey;
|
|
||||||
let handleUpdateChannelKey;
|
let handleUpdateChannelKey;
|
||||||
|
|
||||||
if (user.first_name) {
|
if (user.first_name) {
|
||||||
@@ -807,27 +796,6 @@ class NotificationsTab extends React.Component {
|
|||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
||||||
handleUpdateAllKey = function handleAllKeyChange(e) {
|
|
||||||
this.updateAllKey(e.target.checked);
|
|
||||||
}.bind(this);
|
|
||||||
inputs.push(
|
|
||||||
<div key='userNotificationAllOption'>
|
|
||||||
<div className='checkbox hidden'>
|
|
||||||
<label>
|
|
||||||
<input
|
|
||||||
type='checkbox'
|
|
||||||
checked={this.state.allKey}
|
|
||||||
onChange={handleUpdateAllKey}
|
|
||||||
/>
|
|
||||||
<FormattedMessage
|
|
||||||
id='user.settings.notifications.teamWide'
|
|
||||||
defaultMessage='Team-wide mentions "@all"'
|
|
||||||
/>
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
|
|
||||||
handleUpdateChannelKey = function handleChannelKeyChange(e) {
|
handleUpdateChannelKey = function handleChannelKeyChange(e) {
|
||||||
this.updateChannelKey(e.target.checked);
|
this.updateChannelKey(e.target.checked);
|
||||||
}.bind(this);
|
}.bind(this);
|
||||||
|
|||||||
@@ -170,8 +170,7 @@ export default {
|
|||||||
POST: 5
|
POST: 5
|
||||||
},
|
},
|
||||||
|
|
||||||
//SPECIAL_MENTIONS: ['all', 'channel'],
|
SPECIAL_MENTIONS: ['all', 'channel'],
|
||||||
SPECIAL_MENTIONS: ['channel'],
|
|
||||||
CHARACTER_LIMIT: 4000,
|
CHARACTER_LIMIT: 4000,
|
||||||
IMAGE_TYPES: ['jpg', 'gif', 'bmp', 'png', 'jpeg'],
|
IMAGE_TYPES: ['jpg', 'gif', 'bmp', 'png', 'jpeg'],
|
||||||
AUDIO_TYPES: ['mp3', 'wav', 'wma', 'm4a', 'flac', 'aac', 'ogg'],
|
AUDIO_TYPES: ['mp3', 'wav', 'wma', 'm4a', 'flac', 'aac', 'ogg'],
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user