Closed Bug 18605 Opened 25 years ago Closed 25 years ago

[Dogfood][Regression] Reply to newsgroup replies to author, not group

Categories

(MailNews Core :: Composition, defect, P3)

defect

Tracking

(Not tracked)

VERIFIED FIXED

People

(Reporter: phil, Assigned: bugzilla)

Details

(Whiteboard: Need a code review for the fix)

Reply to a newsgroup message

Expected result: get a compose window with a Newsgroups header and the name of
the newsgroup.

Actual result: get a compose window with a To header and the email address of
the author of the original message.
This is a regression; it was working at one point (see #6931).
QA Contact: lchiang → esther
Status: NEW → ASSIGNED
Summary: Reply to newsgroup replies to author, not group → [Regression] Reply to newsgroup replies to author, not group
Target Milestone: M12
Summary: [Regression] Reply to newsgroup replies to author, not group → [Dogfood][Regression] Reply to newsgroup replies to author, not group
I have identified the problem. We are loading the composeFields (recipients) in the ui before the backend build them.
That affects also "Reply-to" which is not honored anymore. I need now to find the best way to solve it...

it's a dogfood bug.
Whiteboard: Need a code review for the fix
I get a fix, will seek for a code review...

Index: nsIMsgCompose.idl
===================================================================
RCS file: /cvsroot/mozilla/mailnews/compose/public/nsIMsgCompose.idl,v
retrieving revision 1.18
diff -r1.18 nsIMsgCompose.idl
76a77,83
> [scriptable, uuid(e72c6981-992a-11d3-a449-eb15bb19bc7c)]
> interface nsIMsgComposeStateListener : nsISupports
> {
> 	/* ... */
> 	void        NotifyComposeFieldsReady();
> };
>
88a96,101
>
> 	/* ... */
> 	void RegisterStateListener(in nsIMsgComposeStateListener stateListener);
>
> 	/* ... */
> 	void UnregisterStateListener(in nsIMsgComposeStateListener stateListener);

Index: nsMsgCompose.h
===================================================================
RCS file: /cvsroot/mozilla/mailnews/compose/src/nsMsgCompose.h,v
retrieving revision 1.40
diff -r1.40 nsMsgCompose.h
58a59,60
> 	nsresult 					ConvertAndLoadComposeWindow(nsIEditorShell *aEditorShell, nsString aBuf,
> 															PRBool aQuoted, PRBool aHTMLEditor);
94a97,103
> 	typedef enum {
>     	eComposeFieldsReady
> 	} TStateListenerNotification;
>
> 	// tell the doc state listeners that the doc state has changed
> 	nsresult NotifyStateListeners(TStateListenerNotification aNotificationType);
>
101,102c110,111
<   nsCOMPtr<nsIMsgIdentity>      m_identity;
< 	PRBool						            m_composeHTML;
---
> 	nsCOMPtr<nsIMsgIdentity>      m_identity;
> 	PRBool						  m_composeHTML;
106c115
<   nsCOMPtr<nsIMsgSend>          mMsgSend;   // for composition back end
---
> 	nsCOMPtr<nsIMsgSend>          mMsgSend;   // for composition back end
111,112c120,124
<   nsMsgDocumentStateListener    *mDocumentListener;
<   MSG_ComposeType				mType;		//Message type
---
> 	nsMsgDocumentStateListener    *mDocumentListener;
> 	MSG_ComposeType				  mType;		//Message type
>     nsCOMPtr<nsISupportsArray> 	  mStateListeners;		// contents are nsISupports
>
>     friend class QuotingOutputStreamListener;

Index: nsMsgCompose.cpp
===================================================================
RCS file: /cvsroot/mozilla/mailnews/compose/src/nsMsgCompose.cpp,v
retrieving revision 1.107
diff -r1.107 nsMsgCompose.cpp
55,56d54
< #define TEMP_MESSAGE_IN       "tempMessage.eml"
<
123,124c121
< nsresult
< ConvertAndLoadComposeWindow(nsIEditorShell *aEditorShell, nsString aBuf, PRBool aQuoted, PRBool aHTMLEditor)
---
> nsresult nsMsgCompose::ConvertAndLoadComposeWindow(nsIEditorShell *aEditorShell, nsString aBuf, PRBool aQuoted, PRBool aHTMLEditor)
152a150
>   NotifyStateListeners(nsMsgCompose::eComposeFieldsReady);
240a239,278
> nsresult nsMsgCompose::RegisterStateListener(nsIMsgComposeStateListener *stateListener)
> {
>   nsresult rv = NS_OK;
>
>   if (!stateListener)
>     return NS_ERROR_NULL_POINTER;
>
>   if (!mStateListeners)
>   {
>     rv = NS_NewISupportsArray(getter_AddRefs(mStateListeners));
>     if (NS_FAILED(rv)) return rv;
>   }
>   nsCOMPtr<nsISupports> iSupports = do_QueryInterface(stateListener, &rv);
>   if (NS_FAILED(rv)) return rv;
>
>   // note that this return value is really a PRBool, so be sure to use
>   // NS_SUCCEEDED or NS_FAILED to check it.
>   return mStateListeners->AppendElement(iSupports);
> }
>
> nsresult nsMsgCompose::UnregisterStateListener(nsIMsgComposeStateListener *stateListener)
> {
>   if (!stateListener)
>     return NS_ERROR_NULL_POINTER;
>
>   nsresult rv = NS_OK;
>
>   // otherwise, see if it exists in our list
>   if (!mStateListeners)
>     return (nsresult)PR_FALSE;      // yeah, this sucks, but I'm emulating the behaviour of
>                                     // nsISupportsArray::RemoveElement()
>
>   nsCOMPtr<nsISupports> iSupports = do_QueryInterface(stateListener, &rv);
>   if (NS_FAILED(rv)) return rv;
>
>   // note that this return value is really a PRBool, so be sure to use
>   // NS_SUCCEEDED or NS_FAILED to check it.
>   return mStateListeners->RemoveElement(iSupports);
> }
>
901c939
<       ConvertAndLoadComposeWindow(editor, mMsgBody, PR_TRUE, compHTML);
---
>       mComposeObj->ConvertAndLoadComposeWindow(editor, mMsgBody, PR_TRUE, compHTML);
904c942
<
---
>
1327c1365
<       ConvertAndLoadComposeWindow(editor, tBody, PR_FALSE, compHTML);
---
>       mComposeObj->ConvertAndLoadComposeWindow(editor, tBody, PR_FALSE, compHTML);
1531a1570,1601
> nsresult nsMsgCompose::NotifyStateListeners(TStateListenerNotification aNotificationType)
> {
>   if (!mStateListeners)
>     return NS_OK;    // maybe there just aren't any.
>
>   PRUint32 numListeners;
>   nsresult rv = mStateListeners->Count(&numListeners);
>   if (NS_FAILED(rv)) return rv;
>
>   PRUint32 i;
>   switch (aNotificationType)
>   {
>     case eComposeFieldsReady:
>       for (i = 0; i < numListeners;i++)
>       {
>         nsCOMPtr<nsISupports> iSupports = getter_AddRefs(mStateListeners->ElementAt(i));
>         nsCOMPtr<nsIMsgComposeStateListener> thisListener = do_QueryInterface(iSupports);
>         if (thisListener)
>         {
>           rv = thisListener->NotifyComposeFieldsReady();
>           if (NS_FAILED(rv))
>             break;
>         }
>       }
>       break;
>
>     default:
>       NS_NOTREACHED("Unknown notification");
>   }
>
>   return rv;
> }

Index: MsgComposeCommands.js
===================================================================
RCS file: /cvsroot/mozilla/mailnews/compose/resources/content/MsgComposeCommands.js,v
retrieving revision 1.51
diff -r1.51 MsgComposeCommands.js
52,53c52,54
< var editorDocumentListener = {
< 	NotifyDocumentCreated: function() {
---
> var stateListener = {
> 	NotifyComposeFieldsReady: function() {
> //		dump("\n RECEIVE NotifyComposeFieldsReady\n\n");
54a56
> 		msgCompose.UnregisterStateListener(stateListener);
201,202d202
< 			window.editorShell.RegisterDocumentStateListener(editorDocumentListener);
<
238a239,240
>
> 			msgCompose.RegisterStateListener(stateListener);
Status: ASSIGNED → RESOLVED
Closed: 25 years ago
Resolution: --- → FIXED
Fixed and checked  in
Status: RESOLVED → VERIFIED
Using win32 build 1999111909m12, and build 1999112108m12 on linux and mac this
is fixed, the Reply To:  addresses the Newsgroup.  Verified
Product: MailNews → Core
Product: Core → MailNews Core
You need to log in before you can comment on or make changes to this bug.