From e7ab87e4a89df323a22bec1cbeb42039e477935b Mon Sep 17 00:00:00 2001 From: izie <238573415+IzieStratt@users.noreply.github.com> Date: Tue, 24 Nov 2026 22:24:26 -0500 Subject: [PATCH] fix(LocalTime): patch BroadcastPreamble as well as BaseBroadcastPreamble Co-Authored-By: Claude Sonnet 5.5 --- CHANGELOG.md | 1 + src/plugins/LocalTime/index.tsx | 44 +++++++++++++++++++-------------- 2 files changed, 26 insertions(+), 19 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d61e9ea..a97e45b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ In a PR that changes something users will notice, add a line under **Unreleased* - CustomAppIcon's System appearance follows macOS light and dark mode instead of Slack's theme. - UserPronouns shows pronouns on channel messages again. +- LocalTime shows local times on channel messages again. ## Build 162 diff --git a/src/plugins/LocalTime/index.tsx b/src/plugins/LocalTime/index.tsx index 8e7563e..d8aca53 100644 --- a/src/plugins/LocalTime/index.tsx +++ b/src/plugins/LocalTime/index.tsx @@ -118,25 +118,31 @@ export default class LocalTime extends SlickPlugin { } private patchMessages() { - this.api.patchComponent('BaseBroadcastPreamble', (Original) => (props) => { - if (!isPerson(props.msg)) return ; - - const children = React.Children.toArray(props.children); - const timestamp = children.findIndex(isTimestamp); - const anchor = timestamp === -1 ? children.findIndex(isSender) : timestamp; - if (anchor === -1) return ; - - children.splice( - anchor + 1, - 0, - , - ); - return {children}; - }); + // Slack flips between these two names across builds. + for (const name of ['BroadcastPreamble', 'BaseBroadcastPreamble']) { + this.api.patchComponent(name, (Original) => (props) => { + if (!isPerson(props.msg)) return ; + + const children = React.Children.toArray(props.children); + if (children.some((child) => React.isValidElement(child) && child.type === this.Clock)) { + return ; + } + const timestamp = children.findIndex(isTimestamp); + const anchor = timestamp === -1 ? children.findIndex(isSender) : timestamp; + if (anchor === -1) return ; + + children.splice( + anchor + 1, + 0, + , + ); + return {children}; + }); + } this.api.patchComponent('ThreadSenderAndTimestampGeneric', (Original) => (props) => { if (props.adjacent || props.visible === false || !isPerson(props.msg)) return ;