@all and @channel now auto-complete
Этот коммит содержится в:
@@ -9,7 +9,7 @@ module.exports = React.createClass({
|
|||||||
return (
|
return (
|
||||||
<div className="mentions-name" onClick={this.handleClick}>
|
<div className="mentions-name" onClick={this.handleClick}>
|
||||||
<img className="mention-img" src={"/api/v1/users/" + this.props.id + "/image"}/>
|
<img className="mention-img" src={"/api/v1/users/" + this.props.id + "/image"}/>
|
||||||
<span>@{this.props.username}</span><span className="mention-fullname">{this.props.name}</span>
|
<span>@{this.props.username}</span><span className="mention-fullname">{this.props.secondary_text}</span>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -74,6 +74,18 @@ module.exports = React.createClass({
|
|||||||
users.push(profiles[id]);
|
users.push(profiles[id]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var all = {};
|
||||||
|
all.username = "all";
|
||||||
|
all.full_name = "";
|
||||||
|
all.secondary_text = "Notifies everyone in the team";
|
||||||
|
users.push(all);
|
||||||
|
|
||||||
|
var channel = {};
|
||||||
|
channel.username = "channel";
|
||||||
|
channel.full_name = "";
|
||||||
|
channel.secondary_text = "Notifies everyone in the channel";
|
||||||
|
users.push(channel);
|
||||||
|
|
||||||
users.sort(function(a,b) {
|
users.sort(function(a,b) {
|
||||||
if (a.username < b.username) return -1;
|
if (a.username < b.username) return -1;
|
||||||
if (a.username > b.username) return 1;
|
if (a.username > b.username) return 1;
|
||||||
@@ -91,6 +103,7 @@ module.exports = React.createClass({
|
|||||||
var splitName = users[i].full_name.split(' ');
|
var splitName = users[i].full_name.split(' ');
|
||||||
firstName = splitName[0].toLowerCase();
|
firstName = splitName[0].toLowerCase();
|
||||||
lastName = splitName.length > 1 ? splitName[splitName.length-1].toLowerCase() : "";
|
lastName = splitName.length > 1 ? splitName[splitName.length-1].toLowerCase() : "";
|
||||||
|
users[i].secondary_text = users[i].full_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (firstName.lastIndexOf(mentionText,0) === 0
|
if (firstName.lastIndexOf(mentionText,0) === 0
|
||||||
@@ -99,7 +112,7 @@ module.exports = React.createClass({
|
|||||||
<Mention
|
<Mention
|
||||||
ref={'mention' + index}
|
ref={'mention' + index}
|
||||||
username={users[i].username}
|
username={users[i].username}
|
||||||
name={users[i].full_name}
|
secondary_text={users[i].secondary_text}
|
||||||
id={users[i].id}
|
id={users[i].id}
|
||||||
handleClick={this.handleClick} />
|
handleClick={this.handleClick} />
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -153,7 +153,7 @@ module.exports = React.createClass({
|
|||||||
var mentions = [];
|
var mentions = [];
|
||||||
for (var i = 0; i < matches.length; i++) {
|
for (var i = 0; i < matches.length; i++) {
|
||||||
var m = matches[i].substring(1,matches[i].length).trim();
|
var m = matches[i].substring(1,matches[i].length).trim();
|
||||||
if (m in profileMap && mentions.indexOf(m) === -1) {
|
if ((m in profileMap && mentions.indexOf(m) === -1) || Constants.SPECIAL_MENTIONS.indexOf(m) !== -1) {
|
||||||
mentions.push(m);
|
mentions.push(m);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ module.exports = {
|
|||||||
SERVER_ACTION: null,
|
SERVER_ACTION: null,
|
||||||
VIEW_ACTION: null
|
VIEW_ACTION: null
|
||||||
}),
|
}),
|
||||||
|
SPECIAL_MENTIONS: ['all', 'channel'],
|
||||||
CHARACTER_LIMIT: 4000,
|
CHARACTER_LIMIT: 4000,
|
||||||
IMAGE_TYPES: ['jpg', 'gif', 'bmp', 'png'],
|
IMAGE_TYPES: ['jpg', 'gif', 'bmp', 'png'],
|
||||||
AUDIO_TYPES: ['mp3', 'wav', 'wma', 'm4a', 'flac', 'aac'],
|
AUDIO_TYPES: ['mp3', 'wav', 'wma', 'm4a', 'flac', 'aac'],
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user