* DEV: Rnemae channel path to just c Also swap the channel id and channel slug params to be consistent with core. * linting * channel_path * Drop slugify helper and channel route without slug * Request slug and route models through the channel model if possible * DEV: Pass messageId as a dynamic segment instead of a query param * Ensure change is backwards-compatible * drop query param from oneboxes * Correctly extract channelId from routes * Better route organization using siblings for regular and near-message * Ensures sessions are unique even when using parallelism * prevents didReceiveAttrs to clear input mid test * we disable animations in capybara so sometimes the message was barely showing * adds wait * ensures finished loading * is it causing more harm than good? * this check is slowing things for no reason * actually target the button * more resilient select chat message * apply similar fix to bookmark * fix --------- Co-authored-by: Joffrey JAFFEUX <j.jaffeux@gmail.com>
31 lines
876 B
JavaScript
31 lines
876 B
JavaScript
import { registerUnbound } from "discourse-common/lib/helpers";
|
|
import { htmlSafe } from "@ember/template";
|
|
import getURL from "discourse-common/lib/get-url";
|
|
import I18n from "I18n";
|
|
import User from "discourse/models/user";
|
|
|
|
registerUnbound("format-chat-date", function (message, details, mode) {
|
|
let currentUser = User.current();
|
|
|
|
let tz = currentUser ? currentUser.user_option.timezone : moment.tz.guess();
|
|
|
|
let date = moment(new Date(message.created_at), tz);
|
|
|
|
let url = "";
|
|
|
|
if (details) {
|
|
url = getURL(`/chat/c/-/${details.chat_channel_id}/${message.id}`);
|
|
}
|
|
|
|
let title = date.format(I18n.t("dates.long_with_year"));
|
|
|
|
let display =
|
|
mode === "tiny"
|
|
? date.format(I18n.t("chat.dates.time_tiny"))
|
|
: date.format(I18n.t("dates.time"));
|
|
|
|
return htmlSafe(
|
|
`<a title='${title}' class='chat-time' href='${url}'>${display}</a>`
|
|
);
|
|
});
|