коммит произвёл
Christopher Speller
родитель
7d91f17914
Коммит
4476adf131
@@ -440,7 +440,7 @@ func SlackConvertChannelMentions(channels []SlackChannel, posts map[string][]Sla
|
|||||||
l4g.Warn(utils.T("api.slackimport.slack_convert_channel_mentions.compile_regexp_failed.warn"), channel.Id, channel.Name)
|
l4g.Warn(utils.T("api.slackimport.slack_convert_channel_mentions.compile_regexp_failed.warn"), channel.Id, channel.Name)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
regexes["!"+channel.Name] = r
|
regexes["~"+channel.Name] = r
|
||||||
}
|
}
|
||||||
|
|
||||||
for channelName, channelPosts := range posts {
|
for channelName, channelPosts := range posts {
|
||||||
|
|||||||
@@ -110,10 +110,10 @@ func TestSlackConvertChannelMentions(t *testing.T) {
|
|||||||
expectedPosts := map[string][]SlackPost{
|
expectedPosts := map[string][]SlackPost{
|
||||||
"test-channel": {
|
"test-channel": {
|
||||||
{
|
{
|
||||||
Text: "Go to !one.",
|
Text: "Go to ~one.",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Text: "Try !two for this.",
|
Text: "Try ~two for this.",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ class ChannelMentionSuggestion extends Suggestion {
|
|||||||
className += ' suggestion--selected';
|
className += ' suggestion--selected';
|
||||||
}
|
}
|
||||||
|
|
||||||
const description = '(!' + item.channel.name + ')';
|
const description = '(~' + item.channel.name + ')';
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
@@ -72,7 +72,7 @@ function filterChannelsByPrefix(channels, prefix, limit) {
|
|||||||
|
|
||||||
export default class ChannelMentionProvider {
|
export default class ChannelMentionProvider {
|
||||||
handlePretextChanged(suggestionId, pretext) {
|
handlePretextChanged(suggestionId, pretext) {
|
||||||
const captured = (/(^|\s)(!([^!]*))$/i).exec(pretext.toLowerCase());
|
const captured = (/(^|\s)(~([^~]*))$/i).exec(pretext.toLowerCase());
|
||||||
if (captured) {
|
if (captured) {
|
||||||
const prefix = captured[3];
|
const prefix = captured[3];
|
||||||
|
|
||||||
@@ -122,7 +122,7 @@ export default class ChannelMentionProvider {
|
|||||||
|
|
||||||
const wrapped = wrappedChannels.concat(wrappedMoreChannels);
|
const wrapped = wrappedChannels.concat(wrappedMoreChannels);
|
||||||
|
|
||||||
const mentions = wrapped.map((item) => '!' + item.channel.name);
|
const mentions = wrapped.map((item) => '~' + item.channel.name);
|
||||||
|
|
||||||
SuggestionStore.clearSuggestions(suggestionId);
|
SuggestionStore.clearSuggestions(suggestionId);
|
||||||
SuggestionStore.addSuggestions(suggestionId, mentions, wrapped, ChannelMentionSuggestion, captured[2]);
|
SuggestionStore.addSuggestions(suggestionId, mentions, wrapped, ChannelMentionSuggestion, captured[2]);
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import XRegExp from 'xregexp';
|
|||||||
const cjkPattern = /[\u3000-\u303f\u3040-\u309f\u30a0-\u30ff\uff00-\uff9f\u4e00-\u9faf\u3400-\u4dbf]/;
|
const cjkPattern = /[\u3000-\u303f\u3040-\u309f\u30a0-\u30ff\uff00-\uff9f\u4e00-\u9faf\u3400-\u4dbf]/;
|
||||||
|
|
||||||
// Performs formatting of user posts including highlighting mentions and search terms and converting urls, hashtags,
|
// Performs formatting of user posts including highlighting mentions and search terms and converting urls, hashtags,
|
||||||
// @mentions and !channels to links by taking a user's message and returning a string of formatted html. Also takes
|
// @mentions and ~channels to links by taking a user's message and returning a string of formatted html. Also takes
|
||||||
// a number of options as part of the second parameter:
|
// a number of options as part of the second parameter:
|
||||||
// - searchTerm - If specified, this word is highlighted in the resulting html. Defaults to nothing.
|
// - searchTerm - If specified, this word is highlighted in the resulting html. Defaults to nothing.
|
||||||
// - mentionHighlight - Specifies whether or not to highlight mentions of the current user. Defaults to true.
|
// - mentionHighlight - Specifies whether or not to highlight mentions of the current user. Defaults to true.
|
||||||
@@ -26,7 +26,7 @@ const cjkPattern = /[\u3000-\u303f\u3040-\u309f\u30a0-\u30ff\uff00-\uff9f\u4e00-
|
|||||||
// links that can be handled by a special click handler.
|
// links that can be handled by a special click handler.
|
||||||
// - usernameMap - An object mapping usernames to users. If provided, at mentions will be replaced with internal links that can
|
// - usernameMap - An object mapping usernames to users. If provided, at mentions will be replaced with internal links that can
|
||||||
// be handled by a special click handler (Utils.handleFormattedTextClick)
|
// be handled by a special click handler (Utils.handleFormattedTextClick)
|
||||||
// - channelNamesMap - An object mapping channel display names to channels. If provided, !channel mentions will be replaced with
|
// - channelNamesMap - An object mapping channel display names to channels. If provided, ~channel mentions will be replaced with
|
||||||
// links to the relevant channel.
|
// links to the relevant channel.
|
||||||
// - team - The current team.
|
// - team - The current team.
|
||||||
export function formatText(text, inputOptions) {
|
export function formatText(text, inputOptions) {
|
||||||
@@ -217,7 +217,7 @@ function autolinkChannelMentions(text, tokens, channelNamesMap, team) {
|
|||||||
|
|
||||||
if (channelMentionExists(channelNameLower)) {
|
if (channelMentionExists(channelNameLower)) {
|
||||||
// Exact match
|
// Exact match
|
||||||
const alias = addToken(channelNameLower, mention, '!' + channelNamesMap[channelNameLower].display_name);
|
const alias = addToken(channelNameLower, mention, '~' + channelNamesMap[channelNameLower].display_name);
|
||||||
return spacer + alias;
|
return spacer + alias;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -230,7 +230,7 @@ function autolinkChannelMentions(text, tokens, channelNamesMap, team) {
|
|||||||
|
|
||||||
if (channelMentionExists(channelNameLower)) {
|
if (channelMentionExists(channelNameLower)) {
|
||||||
const suffix = originalChannelName.substr(c - 1);
|
const suffix = originalChannelName.substr(c - 1);
|
||||||
const alias = addToken(channelNameLower, '!' + channelNameLower, '!' + channelNamesMap[channelNameLower].display_name);
|
const alias = addToken(channelNameLower, '~' + channelNameLower, '~' + channelNamesMap[channelNameLower].display_name);
|
||||||
return spacer + alias + suffix;
|
return spacer + alias + suffix;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -243,7 +243,7 @@ function autolinkChannelMentions(text, tokens, channelNamesMap, team) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let output = text;
|
let output = text;
|
||||||
output = output.replace(/(^|\s)(!([a-z0-9.\-_]*))/gi, replaceChannelMentionWithToken);
|
output = output.replace(/(^|\s)(~([a-z0-9.\-_]*))/gi, replaceChannelMentionWithToken);
|
||||||
|
|
||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user