FIX: Open drafts for PMs from Activity > Drafts screen.

FIX: Open drafts for PMs from Activity > Drafts screen.

Draft.get sometimes returns only the sequence number.

diff --git a/app/assets/javascripts/discourse/components/user-stream.js.es6 b/app/assets/javascripts/discourse/components/user-stream.js.es6
index c29b80b..7054358 100644
--- a/app/assets/javascripts/discourse/components/user-stream.js.es6
+++ b/app/assets/javascripts/discourse/components/user-stream.js.es6
@@ -70,13 +70,16 @@ export default Ember.Component.extend(LoadMore, {
       } else {
         Draft.get(item.draft_key)
           .then(d => {
-            if (d.draft) {
-              composer.open({
-                draft: d.draft,
-                draftKey: item.draft_key,
-                draftSequence: d.draft_sequence
-              });
+            const draft = d.draft || item.data;
+            if (!draft) {
+              return;
             }
+
+            composer.open({
+              draft,
+              draftKey: item.draft_key,
+              draftSequence: d.draft_sequence
+            });
           })
           .catch(error => {
             popupAjaxError(error);

GitHub sha: 520d54d8

This should have an associated test.

1 Like