DEV: Remove decorateCookedElement id parameters (#23544)

These are no longer required per https://github.com/discourse/discourse/pull/23543
This commit is contained in:
David Taylor
2023-09-12 16:32:04 +01:00
committed by GitHub
parent e0d8dae0b3
commit c3061d580c
14 changed files with 126 additions and 177 deletions
@@ -120,34 +120,31 @@ export default {
// we want to decorate the chat quote dates regardless
// of whether the current user has chat enabled
api.decorateCookedElement(
(elem) => {
const currentUser = getOwner(this).lookup("service:current-user");
const currentUserTimezone = currentUser?.user_option?.timezone;
const chatTranscriptElements =
elem.querySelectorAll(".chat-transcript");
api.decorateCookedElement((elem) => {
const currentUser = getOwner(this).lookup("service:current-user");
const currentUserTimezone = currentUser?.user_option?.timezone;
const chatTranscriptElements =
elem.querySelectorAll(".chat-transcript");
chatTranscriptElements.forEach((el) => {
const dateTimeRaw = el.dataset["datetime"];
const dateTimeEl = el.querySelector(
".chat-transcript-datetime a, .chat-transcript-datetime span"
chatTranscriptElements.forEach((el) => {
const dateTimeRaw = el.dataset["datetime"];
const dateTimeEl = el.querySelector(
".chat-transcript-datetime a, .chat-transcript-datetime span"
);
if (currentUserTimezone) {
dateTimeEl.innerText = moment
.tz(dateTimeRaw, currentUserTimezone)
.format(I18n.t("dates.long_no_year"));
} else {
dateTimeEl.innerText = moment(dateTimeRaw).format(
I18n.t("dates.long_no_year")
);
}
if (currentUserTimezone) {
dateTimeEl.innerText = moment
.tz(dateTimeRaw, currentUserTimezone)
.format(I18n.t("dates.long_no_year"));
} else {
dateTimeEl.innerText = moment(dateTimeRaw).format(
I18n.t("dates.long_no_year")
);
}
dateTimeEl.dataset.dateFormatted = true;
});
},
{ id: "chat-transcript-datetime" }
);
dateTimeEl.dataset.dateFormatted = true;
});
});
if (!this.chatService.userCanChat) {
return;