Treat usernames of length 4 as valid.
This commit is contained in:
parent
eadf411679
commit
0bf3e7f0e6
@ -1322,7 +1322,7 @@ vector<Slice> find_mentions(Slice str) {
|
|||||||
auto mentions = match_mentions(str);
|
auto mentions = match_mentions(str);
|
||||||
td::remove_if(mentions, [](Slice mention) {
|
td::remove_if(mentions, [](Slice mention) {
|
||||||
mention.remove_prefix(1);
|
mention.remove_prefix(1);
|
||||||
if (mention.size() >= 5) {
|
if (mention.size() >= 4) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
auto lowered_mention = to_lower(mention);
|
auto lowered_mention = to_lower(mention);
|
||||||
|
@ -49,7 +49,8 @@ TEST(MessageEntities, mention) {
|
|||||||
check_mention("нет@mention", {});
|
check_mention("нет@mention", {});
|
||||||
check_mention(
|
check_mention(
|
||||||
"@ya @gif @wiki @vid @bing @pic @bold @imdb @ImDb @coub @like @vote @giff @cap ya cap @y @yar @bingg @bin",
|
"@ya @gif @wiki @vid @bing @pic @bold @imdb @ImDb @coub @like @vote @giff @cap ya cap @y @yar @bingg @bin",
|
||||||
{"@gif", "@wiki", "@vid", "@bing", "@pic", "@bold", "@imdb", "@ImDb", "@coub", "@like", "@vote", "@bingg"});
|
{"@gif", "@wiki", "@vid", "@bing", "@pic", "@bold", "@imdb", "@ImDb", "@coub", "@like", "@vote", "@giff",
|
||||||
|
"@bingg"});
|
||||||
}
|
}
|
||||||
|
|
||||||
static void check_bot_command(const td::string &str, const td::vector<td::string> &expected) {
|
static void check_bot_command(const td::string &str, const td::vector<td::string> &expected) {
|
||||||
|
Loading…
Reference in New Issue
Block a user