How to disable Incoming Email modal

Hi kynic,

onPageChange might be a little too broad for usage (and unreliable if you load/update posts).
You can use decorateCookedElement instead. It’s called for every post-cooked element.

Additionally, here is a way to disable the email indicator. It’s just some hack to not include the HTML. If you are curious, you can see the original code here.

<script type="text/discourse-plugin" version="0.8">
    api.reopenWidget("post-meta-data", {
        html(attrs) {
            if (!attrs.via_email) {
                return this._super(attrs);
            }
          
            // Do not generate "post-email-indicator" widget.
            attrs.via_email = false;
            const html = this._super(attrs);
            attrs.via_email = true;
          
            return html;
        }
    })

    api.decorateCookedElement((element, helper) => {
        if (helper?.getModel().via_email) {
            element.querySelector('details.elided').remove();
        }
        
    }, { onlyStream: true });
</script>

You could also use CSS only to hide them.

.post-info.via-email,
.cooked details.elided {
    display: none;
}