<?xml version="1.0" encoding="UTF-8"?>
<templates xml:space="preserve">
    <t t-inherit="mail.Chatter" t-inherit-mode="extension">
        <!-- Send message/Log note/Activity/History: HR-officer tooling,
             hidden from a regular employee viewing their own leave (see
             chatter_history_patch.js's xenoChatterButtonsVisible). Every
             other model's chatter is unaffected (xenoChatterButtonsVisible
             defaults true there). -->
        <xpath expr="//button[hasclass('o-mail-Chatter-sendMessage')]" position="attributes">
            <attribute name="t-if">state.xenoChatterButtonsVisible</attribute>
        </xpath>
        <xpath expr="//button[hasclass('o-mail-Chatter-logNote')]" position="attributes">
            <attribute name="t-if">state.xenoChatterButtonsVisible</attribute>
        </xpath>
        <xpath expr="//button[hasclass('o-mail-Chatter-activity')]" position="attributes">
            <attribute name="t-if">props.has_activities and state.xenoChatterButtonsVisible</attribute>
        </xpath>
        <xpath expr="//span[hasclass('o-mail-Chatter-topbarGrow')]" position="before">
            <!-- History toggle for every allow-listed history form
                 (xenoIsHistoryModel): hr.leave + the custom Company Policies
                 and Announcements forms, same button style across all. -->
            <button t-if="xenoIsHistoryModel and state.xenoChatterButtonsVisible"
                    class="o-mail-Chatter-history btn btn-secondary text-nowrap ms-1"
                    t-att-class="{ 'active': state.xenoShowHistory, 'my-2': !props.compactHeight }"
                    data-hotkey="shift+h" t-on-click="xenoToggleHistory">
                <span>History</span>
            </button>
        </xpath>
        <xpath expr="//Thread" position="replace">
            <!-- xenoShowHistory can only ever flip true via the History
                 button above, which is itself gated on
                 xenoChatterButtonsVisible. So on any allow-listed history
                 form the timeline stays hidden until History is clicked;
                 every other form shows its Thread exactly as before. -->
            <t t-elif="!xenoIsHistoryModel or state.xenoShowHistory">
                <Thread thread="state.thread" t-key="state.thread.localId" order="'desc'"
                        scrollRef="rootRef" jumpPresent="state.jumpThreadPresent"/>
            </t>
        </xpath>
    </t>
</templates>
