@@ -10,6 +10,8 @@ import TaggableMixin from 'ember-osf/mixins/taggable-mixin';
1010
1111import loadAll from 'ember-osf/utils/load-relationship' ;
1212
13+ import fixSpecialChar from 'ember-osf/utils/fix-special-char' ;
14+
1315// Enum of available upload states > New project or existing project?
1416export const State = Object . freeze ( Ember . Object . create ( {
1517 START : 'start' ,
@@ -268,15 +270,19 @@ export default Ember.Controller.extend(Analytics, BasicsValidations, NodeActions
268270 basicsTags : Ember . computed ( 'node' , function ( ) {
269271 // Pending tags
270272 let node = this . get ( 'node' ) ;
271- return node ? node . get ( 'tags' ) : Ember . A ( ) ;
273+ let newTags = null ;
274+ if ( node != null ) {
275+ newTags = node . get ( 'tags' ) . slice ( 0 ) . map ( fixSpecialChar ) ;
276+ }
277+ return node ? newTags : Ember . A ( ) ;
272278 } ) ,
273279 tagsChanged : Ember . computed ( 'basicsTags' , 'node.tags' , function ( ) {
274280 // Does the list of pending tags differ from the saved tags in the db?
275281 let basicsTags = this . get ( 'basicsTags' ) ;
276282 let nodeTags = this . get ( 'node.tags' ) ;
277283 let changed = false ;
278284 if ( basicsTags && nodeTags ) {
279- changed = ! ( basicsTags . length === nodeTags . length && basicsTags . every ( ( v , i ) => v === nodeTags [ i ] ) ) ;
285+ changed = ! ( basicsTags . length === nodeTags . length && basicsTags . every ( ( v , i ) => fixSpecialChar ( v ) === fixSpecialChar ( nodeTags [ i ] ) ) ) ;
280286 }
281287 return changed ;
282288 } ) ,
@@ -502,6 +508,7 @@ export default Ember.Controller.extend(Analytics, BasicsValidations, NodeActions
502508 } ) ;
503509 let node = this . get ( 'node' ) ;
504510 this . set ( 'basicsAbstract' , this . get ( 'node.description' ) || null ) ;
511+
505512 if ( node . get ( 'title' ) !== this . get ( 'nodeTitle' ) ) {
506513 let currentTitle = node . get ( 'title' ) ;
507514 node . set ( 'title' , this . get ( 'nodeTitle' ) ) ;
@@ -615,8 +622,10 @@ export default Ember.Controller.extend(Analytics, BasicsValidations, NodeActions
615622 let currentFile = this . get ( 'store' ) . peekRecord ( 'file' , this . get ( 'model.primaryFile.id' ) ) ;
616623 this . set ( 'file' , null ) ;
617624 this . set ( 'selectedFile' , currentFile ) ;
625+
618626 this . set ( 'nodeTitle' , this . get ( 'node.title' ) ) ;
619627 this . set ( 'titleValid' , true ) ;
628+
620629 } ,
621630 clearDownstreamFields ( section ) {
622631 //If user goes back and changes a section inside Upload, all fields downstream of that section need to clear.
@@ -658,7 +667,7 @@ export default Ember.Controller.extend(Analytics, BasicsValidations, NodeActions
658667 action : 'click' ,
659668 label : `Preprints - ${ this . get ( 'editMode' ) ? 'Edit' : 'Submit' } - Discard Basics Changes`
660669 } ) ;
661- this . set ( 'basicsTags' , this . get ( 'node.tags' ) . slice ( 0 ) ) ;
670+ this . set ( 'basicsTags' , this . get ( 'node.tags' ) . slice ( 0 ) . map ( fixSpecialChar ) ) ;
662671 this . set ( 'basicsAbstract' , this . get ( 'node.description' ) ) ;
663672 this . set ( 'basicsDOI' , this . get ( 'model.doi' ) ) ;
664673 let date = new Date ( ) ;
@@ -779,6 +788,7 @@ export default Ember.Controller.extend(Analytics, BasicsValidations, NodeActions
779788 } ) ;
780789 let tags = this . get ( 'basicsTags' ) . slice ( 0 ) ;
781790 Ember . A ( tags ) ;
791+
782792 tags . pushObject ( tag ) ;
783793 this . set ( 'basicsTags' , tags ) ;
784794 return tags ;
@@ -801,7 +811,7 @@ export default Ember.Controller.extend(Analytics, BasicsValidations, NodeActions
801811
802812 /*
803813 Discipline section
804- */
814+ */
805815 setSubjects ( subjects ) {
806816 // Sets subjectsList with pending subjects. Does not save.
807817 this . toggleProperty ( 'disciplineModifiedToggle' ) ; // Need to observe if discipline in nested array has changed. Toggling this will force 'disciplineChanged' to be recalculated
0 commit comments