Skip to content

Commit

Permalink
FIX: Promise should return something.
Browse files Browse the repository at this point in the history
Encrypted titles were not saved which caused issues later.
  • Loading branch information
udan11 committed Oct 4, 2019
1 parent 3a0958e commit 154d282
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions assets/javascripts/discourse/initializers/hook-save.js.es6
Expand Up @@ -96,17 +96,17 @@ export default {
let titlePromise = title
? topicKeyPromise
.then(key => encrypt(key, { raw: title }))
.then(encryptedTitle => {
args.encrypted_title = encryptedTitle;
.then(encryptedTitle => (args.encrypted_title = encryptedTitle))
.finally(() => {
args.title = I18n.t("encrypt.encrypted_topic_title");
})
: Ember.RSVP.Promise.resolve();

let replyPromise = raw
? topicKeyPromise
.then(key => encrypt(key, { raw }, { includeUploads: true }))
.then(encryptedRaw => {
args.encrypted_raw = encryptedRaw;
.then(encryptedRaw => (args.encrypted_raw = encryptedRaw))
.finally(() => {
args.raw = I18n.t("encrypt.encrypted_post");
})
: Ember.RSVP.Promise.resolve();
Expand Down

0 comments on commit 154d282

Please sign in to comment.