mirror of https://github.com/zulip/zulip.git
typeahead: Show the time typeahead irrespective of text before syntax.
Uptil now, on typing "<time" after some other autocompleteable token like a mention or emoji, the timezone aware time typeahead would not get triggered since the time syntax was checked after the earlier syntax had been mistakenly used to (wrongly) tokenize the precursor text. Now the code has been fixed to detect the time syntax the same way as the rest: checking each character in the precursor text from end to start, and tokenize it correctly. Fixes: #23998.
This commit is contained in:
parent
ba443cac03
commit
25eff08324
|
@ -1274,6 +1274,7 @@ test("begins_typeahead", ({override, override_rewire}) => {
|
|||
assert_typeahead_equals("@zulip :ta", emoji_list);
|
||||
assert_stream_list(":tada: #foo");
|
||||
assert_typeahead_equals("#foo\n~~~py", lang_list);
|
||||
assert_typeahead_equals(":tada: <time:", ["translated: Mention a time-zone-aware time"]);
|
||||
|
||||
assert_typeahead_equals("@", all_mentions);
|
||||
assert_typeahead_equals("@_", people_only);
|
||||
|
|
|
@ -314,6 +314,11 @@ export function tokenize_compose_str(s) {
|
|||
return s.slice(i);
|
||||
}
|
||||
break;
|
||||
case "<":
|
||||
if (s.indexOf("<time", i) === i) {
|
||||
return s.slice(i);
|
||||
}
|
||||
break;
|
||||
case ">":
|
||||
// topic_jump
|
||||
//
|
||||
|
@ -333,11 +338,6 @@ export function tokenize_compose_str(s) {
|
|||
}
|
||||
}
|
||||
|
||||
const timestamp_index = s.indexOf("<time");
|
||||
if (timestamp_index >= 0) {
|
||||
return s.slice(timestamp_index);
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue