@@ -44,29 +44,34 @@ const prplSuggestedTasksWidget = {
4444 per_page : prplSuggestedTask . maxItemsPerCategory [ category ] ,
4545 } ) ;
4646
47- // Inject pending celebration tasks.
48- celebrationPromises . push (
49- prplSuggestedTask
50- . injectItemsFromCategory ( {
51- category,
52- status : [ 'pending' ] ,
53- per_page : 100 ,
54- } )
55- . then ( ( data ) => {
56- // If there were pending tasks.
57- if ( data . length ) {
58- // Set post status to trash.
59- data . forEach ( ( task ) => {
60- const post =
61- new wp . api . models . Prpl_recommendations ( {
62- id : task . id ,
63- } ) ;
64- // Destroy the post, without the force parameter.
65- post . destroy ( { url : post . url ( ) } ) ;
66- } ) ;
67- }
68- } )
69- ) ;
47+ // We trigger celebration only on Progress Planner dashboard page.
48+ if ( 'dashboard' !== window . pagenow ) {
49+ // Inject pending celebration tasks.
50+ celebrationPromises . push (
51+ prplSuggestedTask
52+ . injectItemsFromCategory ( {
53+ category,
54+ status : [ 'pending' ] ,
55+ per_page : 100 ,
56+ } )
57+ . then ( ( data ) => {
58+ // If there were pending tasks.
59+ if ( data . length ) {
60+ // Set post status to trash.
61+ data . forEach ( ( task ) => {
62+ const post =
63+ new wp . api . models . Prpl_recommendations (
64+ {
65+ id : task . id ,
66+ }
67+ ) ;
68+ // Destroy the post, without the force parameter.
69+ post . destroy ( { url : post . url ( ) } ) ;
70+ } ) ;
71+ }
72+ } )
73+ ) ;
74+ }
7075 }
7176
7277 // Trigger celebration once, for all categories.
0 commit comments