File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed
app/controllers/events/view/speakers Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -10,23 +10,24 @@ export default class extends Controller {
1010 try {
1111 this . set ( 'isLoading' , true ) ;
1212 this . model . speaker . event = this . model . event ;
13- if ( ! sessionDetails ) {
13+ const shouldSaveNewSession = ! sessionDetails && this . model . session ?. title ;
14+ if ( shouldSaveNewSession ) {
1415 await this . model . session . save ( ) ;
1516 }
1617 const newSpeaker = this . model . speaker ;
1718 if ( newSpeaker . isEmailOverridden ) {
1819 newSpeaker . set ( 'email' , null ) ;
1920 }
2021 await newSpeaker . save ( ) ;
21- if ( ! sessionDetails ) {
22+ if ( shouldSaveNewSession ) {
2223 this . model . speaker . sessions . pushObject ( this . model . session ) ;
2324 await this . model . session . save ( ) ;
24- } else {
25+ } else if ( sessionDetails ) {
2526 this . model . speaker . sessions . pushObject ( sessionDetails ) ;
2627 }
2728
2829 await this . model . speaker . save ( ) ;
29- this . notify . success ( this . l10n . t ( 'Your session has been saved' ) ) ;
30+ this . notify . success ( this . l10n . t ( 'Your speaker has been saved' ) ) ;
3031 this . transitionToRoute ( 'events.view.speakers' , this . model . event . id ) ;
3132 } catch ( e ) {
3233 console . error ( 'Error while saving session' , e ) ;
You can’t perform that action at this time.
0 commit comments