mirror of
https://github.com/zulip/zulip.git
synced 2025-11-06 23:13:25 +00:00
message_feed: Improve edited/moved tooltip.
This commit improves the edited/moved tippy tooltip to now include a second italic line: "Click to view history" This line is visible only when 'realm_allow_edit_history' is true for any organization settings. Additionally, the first line is changed to display "Last edited today at 00:00 AM" The date is in lowercase if it doesn't contain a number for example 'today' unless the first alphabet is uppercase. 'tippy-zulip-delayed-tooltip' was used as a common class to implement tippy tooltips in addition to other elements in the 'edited_notice.hbs' file. However, now we need to make some changes in tippyjs inside the onShow function to decide whether to show the second line of a tooltip or not. Therefore, we need to use a unique class for the edited_notice tooltips. Hence, removed the 'tippy-zulip-delayed-tooltip' class from the edited_notice.hbs file and used the 'message_edit_notice' class instead. Fixes: #23075
This commit is contained in:
committed by
Tim Abbott
parent
a7b9e67c06
commit
ef9645a509
@@ -287,10 +287,17 @@ export class MessageListView {
|
||||
if (last_edit_timestamp !== undefined) {
|
||||
const last_edit_time = new Date(last_edit_timestamp * 1000);
|
||||
const today = new Date();
|
||||
let date = timerender.render_date(last_edit_time, today)[0].textContent;
|
||||
// If the date is today or yesterday, we don't want to show the date as capitalized.
|
||||
// Thus, we need to check if the date string contains a digit or not using regex,
|
||||
// since any other date except today/yesterday will contain a digit.
|
||||
if (date && !/\d/.test(date)) {
|
||||
date = date.toLowerCase();
|
||||
}
|
||||
return $t(
|
||||
{defaultMessage: "{date} at {time}"},
|
||||
{
|
||||
date: timerender.render_date(last_edit_time, today)[0].textContent,
|
||||
date,
|
||||
time: timerender.stringify_time(last_edit_time),
|
||||
},
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user