Mac Mail Threading

Yes, sigh, I know, again.

1.7 breaks the workaround we had for Mac Mail threading, namely always including “Re:” at the start of the subject

Setting for email subject Re: [%{site_name}] %{optional_pm}%{topic_title}

Unfortunately, Discourse 1.7 sensibly does not include an “In-Reply-To” on the first post, and this results in the first post being threaded separately from the replies in Mac Mail.

I have a hack to put the “In-Reply-To” back:

         @message.header['Message-ID'] = incoming_message_id || post_message_id
-        if post && post.post_number > 1
+        if post
           @message.header['In-Reply-To'] = referenced_post_message_ids.first || topic_message_id
+        end
+        if post && post.post_number > 1
           @message.header['References'] = [topic_message_id, referenced_post_message_ids].flatten.compact.uniq
         end

but this is obviously less than ideal. That said, I’ve got no ideas for any better solution, and the alternative (the initial post being threaded separately from replies) is very bad for those of us using Mailing List Mode since it appears as an unanswered question even though there are answers.

I’m hopeful someone else will have some better idea to restore Mac Mail threading, or a better workaround, or something…? Failing that, at least this documents the issue for anyone else with lots of Mac forum users.

5 Likes

Wait, so this setting no longer works? I’m not totally clear what is being reported here.

It doesn’t make sense to have the first post be a reply of… nothing…

Are you sure Mac Mail only uses the title to do the threading? That would be a huge oversight on their part to not use the References and In-Repy-To headers…

3 Likes

I believe in previous dicussions it was established that yes, it uses the dumb Re: text presence in the title above all else.

It is deeply and profoundly dumb, but it is the status quo for Mac mail, unfortunately.

4 Likes

I’ll make some tests (and fix if needed) to ensure the title doesn’t change.

2 Likes

I thought that the point of this topic was making the Re: always there wasn’t working anymore?

3 Likes

Yup, that’s what I’ll test and fix if needed.

3 Likes

OK, let me try to be more clear on what I was and am seeing.

The only way I have found to get Mac Mail to thread Discourse properly is:

  1. Subject always starts with “Re:” (even the first message).
  2. Mail messages have an “In-Reply-To” header (even the first message).

Discourse 1.7 “fixes” the second case, sensibly omitting the “In-Reply-To” on the first message, which has the side effect of breaking the threading for that first message, resulting in the first message showing up by itself, and the remainder showing up in a separate thread (perhaps separated by other topics).

When I encountered the issue previously, I tried tests with Mac Mail and the various reply/references headers and never found a good alternative solution, even with perfectly formatted headers, except for “Re:” on all messages. But perhaps someone can come up with something that works properly on Mac Mail and that makes sense for Discourse to adopt.

I am not a Mac user and opposed to the idea to break Discourse in order to help those that use a broken Mail app. “Re” has a meaning and if you just use it always, it does not have any meaning anymore. I suggest to push Apple to fix their software or use other software.

5 Likes

No worries. I’m not planning on breaking anything :wink: Just making sure overriding the email subject works.

4 Likes

I did not suggest breaking Discourse. Discourse already supports configurable subjects, and thus has no problem with the hack to always include the “Re:” instead of optionally including the “Re”.

I’m very glad that not everyone has to care about having a large number of Mac Mail readers, and it must be nice to be so optimistic as to think that reporting an issue to Apple (which has been done years ago) would result in a fix.

But sadly, I, and my many Mac Mail using Discourse forum users, have to deal with the fact that Mail is broken in this regard and Apple is not likely to fix it, and so it would be nice if there was some solution for my forum and other similarly Mac-heavy forums.

That said, Discourse’s handling of the In-Reply-To and Message-ID headers is not correct either - if it was I might have a stronger case to take to Apple (who would still do nothing to fix the issue). The change in version 1.7 does take Discourse a step closer to having valid headers in this regard, sadly it just results in worse behaviour with Mac Mail.

In Discourse 1.7, the initial message has a Message ID of something like:

Message-ID: <topic/6118/28585@forum.keyboardmaestro.com>

and the reply to the topic or the first post results in:

In-Reply-To: <topic/6118@forum.keyboardmaestro.com>
References: <topic/6118@forum.keyboardmaestro.com>

Which is referencing a message ID that never exists.

I don’t actually believe that even if this was done Mail would get the threading right, but presumably there is some set of header behaviours that would work.

10 Likes

Hmm he has a point @zogstrip the first post should have just the topic id as the identifier.

5 Likes

The logic was flawed… Hopefully I got it right this time :blush:

https://github.com/discourse/discourse/commit/82555ca7612e497df31f9f4fc6969049a9887988

@peternlewis, can you let me know if it works for you?

7 Likes

Looks great, seems to fix the Mail threading issue.

I changed my subject like to %{optional_re} at the front and it continues to thread correctly which is wonderful.

Thanks!

Will this patch be in 1.7.3?

6 Likes

When is this patch going in to Discourse? It was not in 1.7.3 - is it in 1.7.4?

Thanks.

We only backport security fixes. The patch is already available in the 1.8.0 beta.

Is there anywhere that explains the version numbering and what’s in what version? I had no idea 1.7 development was finished at 1.7.2. Anyway, so not until 1.8 final.

Thanks.

The only 1.7.x releases will contain critical security fixes. As this is not a security fix, it won’t be included.

This is true of every x.y.z release since we started, if the .z number changes, it is exclusively and only due to a security fix for version x.y.

4 Likes

This is good now yes?

3 Likes

Yes, it appears all good, with no need to patch Discourse any further on my part.

Thanks.

5 Likes