Bug 1122501 - [Messages][Drafts] Unsaved draft is silently discarded when user tries to forward message. r=schung #27638
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
/*global ActivityHandler, MozActivity */ | ||
/*global MozActivity */ | ||
|
||
(function(exports) { | ||
'use strict'; | ||
|
@@ -76,13 +76,6 @@ var ActivityPicker = { | |
} | ||
}), onsuccess, onerror); | ||
}, | ||
sendMessage: function ap_sendMessage(number) { | ||
// Using ActivityHandler here to navigate to Composer view in the same way | ||
// as it's done for real activity. | ||
ActivityHandler.toView({ | ||
number: number | ||
}); | ||
}, | ||
openSettings: function ap_openSettings(onsuccess, onerror) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Basically after I adressed your suggestion it's clear that There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ya, it looks good 👍 |
||
handleActivity(new MozActivity({ | ||
name: 'configure', | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1105,6 +1105,26 @@ var ThreadUI = { | |
}); | ||
}, | ||
|
||
/** | ||
* Navigates user to Composer panel with custom parameters. | ||
* @param {*} parameters Optional navigation parameters. | ||
* @returns {Promise} Promise that is resolved once navigation is completed. | ||
*/ | ||
navigateToComposer: function(parameters) { | ||
if (Compose.isEmpty()) { | ||
return Navigation.toPanel('composer', parameters); | ||
} | ||
|
||
return Utils.confirm( | ||
'unsent-message-text', | ||
'unsent-message-title', | ||
{ text: 'unsent-message-option-discard', className: 'danger' } | ||
).then(() => { | ||
this.discardDraft(); | ||
return Navigation.toPanel('composer', parameters); | ||
}); | ||
}, | ||
|
||
_onNavigatingBack: function() { | ||
this.stopRendering(); | ||
|
||
|
@@ -2054,14 +2074,11 @@ var ThreadUI = { | |
if (!lineClassList.contains('not-downloaded')) { | ||
params.items.push({ | ||
l10nId: 'forward', | ||
method: function forwardMessage(messageId) { | ||
Navigation.toPanel('composer', { | ||
forward: { | ||
messageId: messageId | ||
} | ||
method: () => { | ||
this.navigateToComposer({ | ||
forward: { messageId: messageId } | ||
}); | ||
}, | ||
params: [messageId] | ||
} | ||
}); | ||
} | ||
|
||
|
@@ -2790,10 +2807,14 @@ var ThreadUI = { | |
if (Settings.supportEmailRecipient) { | ||
items.push({ | ||
l10nId: 'sendMMSToEmail', | ||
method: function oMMS(param) { | ||
ActivityPicker.sendMessage(param); | ||
method: () => { | ||
this.navigateToComposer({ | ||
activity: { number: email } | ||
}); | ||
}, | ||
params: [email] | ||
// As we change panel here, we don't want to call 'complete' that | ||
// changes the panel as well | ||
incomplete: true | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's the fix for a small group-email thread bug, currently it's impossible to send MMS from participants view if you're in group-email thread - if user tries to do that he's just returned to Thread panel There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry I don't quite understand this part and I can't reproduce it... Could you please explain more? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Discussed offline :) |
||
}); | ||
} | ||
} else { | ||
|
@@ -2809,12 +2830,13 @@ var ThreadUI = { | |
|
||
items.push({ | ||
l10nId: 'sendMessage', | ||
method: function oMessage(param) { | ||
ActivityPicker.sendMessage(param); | ||
method: () => { | ||
this.navigateToComposer({ | ||
activity: { number: number } | ||
}); | ||
}, | ||
params: [number], | ||
// As activity picker changes the panel we don't want | ||
// to call 'complete' that changes the panel as well | ||
// As we change panel here, we don't want to call 'complete' that | ||
// changes the panel as well | ||
incomplete: true | ||
}); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure what title will be better here (default or the same for all similar cases), what do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe same for similar case is better? I don't see much benifit if we differentiate the discard confrim here.