Mac Mail Threading

(Peter N Lewis) #1

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

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.

(Jeff Atwood) #2

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

(Régis Hanol) #3

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…

(Jeff Atwood) #4

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.

(Régis Hanol) #5

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

(Kane York) #6

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

(Régis Hanol) #7

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

(Peter N Lewis) #8

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.

(Robert) #9

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.

(Régis Hanol) #10

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

(Peter N Lewis) #11

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/>

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

In-Reply-To: <topic/>
References: <topic/>

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.

(Jeff Atwood) #12

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

(Régis Hanol) #13

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

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

(Peter N Lewis) #14

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.


Will this patch be in 1.7.3?

(Peter N Lewis) #15

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


(Régis Hanol) #16

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

(Peter N Lewis) #17

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.


(Jeff Atwood) #18

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.

(Jeff Atwood) #19

This is good now yes?

(Peter N Lewis) #20

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