File tree Expand file tree Collapse file tree 1 file changed +18
-11
lines changed Expand file tree Collapse file tree 1 file changed +18
-11
lines changed Original file line number Diff line number Diff line change @@ -1997,19 +1997,26 @@ angular.module('mm.core')
19971997 } , function ( ) {
19981998 return undefined ; // No previous status.
19991999 } ) . then ( function ( previousStatus ) {
2000- return db . insert ( mmFilepoolPackagesStore , {
2001- id : packageId ,
2002- component : component ,
2003- componentId : componentId ,
2004- status : status ,
2005- previous : previousStatus ,
2006- revision : revision ,
2007- timemodified : timemodified ,
2008- updated : new Date ( ) . getTime ( )
2009- } ) . then ( function ( result ) {
2000+ var promise ;
2001+ if ( previousStatus === status ) {
2002+ // The package already has this status, no need to change it.
2003+ promise = $q . when ( ) ;
2004+ } else {
2005+ promise = db . insert ( mmFilepoolPackagesStore , {
2006+ id : packageId ,
2007+ component : component ,
2008+ componentId : componentId ,
2009+ status : status ,
2010+ previous : previousStatus ,
2011+ revision : revision ,
2012+ timemodified : timemodified ,
2013+ updated : new Date ( ) . getTime ( )
2014+ } ) ;
2015+ }
2016+
2017+ return promise . then ( function ( ) {
20102018 // Success inserting, trigger event.
20112019 self . _triggerPackageStatusChanged ( siteId , component , componentId , status ) ;
2012- return result ;
20132020 } ) ;
20142021 } ) ;
20152022 } ) ;
You can’t perform that action at this time.
0 commit comments