File tree Expand file tree Collapse file tree 2 files changed +10
-6
lines changed
src/app/ideation/components Expand file tree Collapse file tree 2 files changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -229,7 +229,8 @@ export class AddIdeaComponent {
229229
230230 if ( this . app . addIdea . value || this . app . editIdea . value ) {
231231 const isValueChanged = text && prevValue && text !== prevValue ;
232- const isNotSubscribed = ! this . autosaveSubscription || this . autosaveSubscription . closed
232+ const isNotSubscribed =
233+ ! this . autosaveSubscription || this . autosaveSubscription . closed ;
233234
234235 if ( isValueChanged && isNotSubscribed && ! this . isPublished ) {
235236 this . startAutosave ( ) ;
@@ -241,7 +242,8 @@ export class AddIdeaComponent {
241242 if ( this . app . addIdea . value || this . app . editIdea . value ) {
242243 this . ideaForm . controls [ key ] . markAsUntouched ( ) ;
243244
244- const isNotSubscribed = ! this . autosaveSubscription || this . autosaveSubscription . closed
245+ const isNotSubscribed =
246+ ! this . autosaveSubscription || this . autosaveSubscription . closed ;
245247
246248 if (
247249 key === 'statement' &&
@@ -287,15 +289,14 @@ export class AddIdeaComponent {
287289 }
288290
289291 close ( ) {
290- if (
291- this . ideaForm . controls [ 'statement' ] . value ||
292- this . ideaForm . controls [ 'description' ] . value
293- ) {
292+ const isSubscribed = this . autosaveSubscription ?. closed === false ;
293+ if ( isSubscribed ) {
294294 const dialog = this . dialog . open ( CloseWithoutSavingDialogComponent ) ;
295295
296296 dialog . afterClosed ( ) . subscribe ( {
297297 next : ( res ) => {
298298 if ( ! res ) {
299+ this , this . saveIdea ( IdeaStatus . draft ) ;
299300 this . app . addIdea . next ( false ) ;
300301 this . clear ( ) ;
301302 }
Original file line number Diff line number Diff line change @@ -182,6 +182,9 @@ export class EditIdeaComponent extends AddIdeaComponent {
182182 }
183183
184184 ideaEditMode ( ) {
185+ if ( this . idea . status === IdeaStatus . draft ) {
186+ this . saveIdea ( IdeaStatus . draft ) ;
187+ }
185188 this . ideaForm . patchValue ( { statement : this . idea . statement } ) ;
186189 this . ideaForm . patchValue ( { description : this . idea . description } ) ;
187190 this . showEdit . emit ( false ) ;
You can’t perform that action at this time.
0 commit comments