From 5d15ed3c2b11c6f8685633a5314abfc78ddd07e4 Mon Sep 17 00:00:00 2001 From: annrra Date: Tue, 17 Dec 2024 21:13:20 +0200 Subject: [PATCH 1/2] [PROD-8394] Replace "arguments" as reserved keyword when strict mode enabled --- .../bp-nouveau/js/bb-activity-reacted.js | 14 +++++++------- .../bp-nouveau/js/bb-activity-reacted.min.js | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/bp-templates/bp-nouveau/js/bb-activity-reacted.js b/src/bp-templates/bp-nouveau/js/bb-activity-reacted.js index 6e4ee30233..64e69b6da0 100644 --- a/src/bp-templates/bp-nouveau/js/bb-activity-reacted.js +++ b/src/bp-templates/bp-nouveau/js/bb-activity-reacted.js @@ -261,14 +261,14 @@ window.bp = window.bp || {}; $( element ).addClass( 'loading' ); paged = parseInt( paged, 10 ) + 1; - var arguments = { + var params = { item_id: this.options.item_id, item_type: this.options.item_type, reaction_id: reaction_id, page: paged }; - var selected_collection = arguments.item_id + '_' + arguments.reaction_id; + var selected_collection = params.item_id + '_' + params.reaction_id; if ( 'undefined' == typeof bp.Nouveau.ActivityReaction.collections[ selected_collection ] ) { bp.Nouveau.ActivityReaction.collections[ selected_collection ] = new bp.Collections.ActivityReactionCollection(); @@ -284,20 +284,20 @@ window.bp = window.bp || {}; }; if ( this.collection.length > 0 ) { - Object.assign( arguments, { + Object.assign( params, { before: this.collection.last().get( 'id' ), } ); } _.extend( this.collection.options, - _.pick( arguments, [ 'page', 'item_id', 'item_type', 'reaction_id', 'before' ] ) + _.pick( params, [ 'page', 'item_id', 'item_type', 'reaction_id', 'before' ] ) ); this.args.collection = this.collection; this.collection.fetch( { - data: _.pick( arguments, [ 'page', 'item_id', 'item_type', 'reaction_id' ] ), + data: _.pick( params, [ 'page', 'item_id', 'item_type', 'reaction_id' ] ), success: _.bind( this.onLoadMoreSuccessRender, this, target ), error: _.bind( this.onLoadMoreFailedRender, this, target ), } @@ -448,14 +448,14 @@ window.bp = window.bp || {}; targetElement.find( '.activity_reaction_popup_error' ).remove(); targetElement.append( this.loader.show() ); - var arguments = { + var params = { item_id: this.options.item_id, item_type: this.options.item_type, reaction_id: targetElement.data( 'reaction-id' ), page: targetElement.data( 'paged' ) }; - var selected_collection = arguments.item_id + '_' + arguments.reaction_id; + var selected_collection = params.item_id + '_' + params.reaction_id; if ( 'undefined' == typeof bp.Nouveau.ActivityReaction.collections[ selected_collection ] ) { bp.Nouveau.ActivityReaction.collections[ selected_collection ] = new bp.Collections.ActivityReactionCollection(); diff --git a/src/bp-templates/bp-nouveau/js/bb-activity-reacted.min.js b/src/bp-templates/bp-nouveau/js/bb-activity-reacted.min.js index d6018d2fe8..cba84c7231 100644 --- a/src/bp-templates/bp-nouveau/js/bb-activity-reacted.min.js +++ b/src/bp-templates/bp-nouveau/js/bb-activity-reacted.min.js @@ -1 +1 @@ -window.wp=window.wp||{},window.bp=window.bp||{},function(c){"undefined"!=typeof BP_Nouveau&&(_.extend(bp,_.pick(wp,"Backbone","ajax","template")),bp.Models=bp.Models||{},bp.Collections=bp.Collections||{},bp.Views=bp.Views||{},bp.Nouveau=bp.Nouveau||{},bp.Nouveau.ActivityReaction={start:function(){this.views=new Backbone.Collection,this.collections=[],this.types=[],this.fetchXhr=null,this.loader=[],this.loader_html=c('

'),this.addListeners(),this.Initialize()},addListeners:function(){c(document).on("click",".activity-state-reactions",this.showActivityReactions)},Initialize:function(){},showActivityReactions:function(t){t.preventDefault();var e=bp.Nouveau.ActivityReaction,i=c(t.currentTarget),a=i.next(".activity-state-popup"),o=0,t="",t=0 ul")&&(n=this).targetElement.find(".activity-state-popup_tab_item > ul").each(function(){c(this).on("scroll",_.bind(n.onScrollLoadMore,n))})):this.onOpenFailedRender(t,e,i),this},onOpenFailedRender:function(t,e,i){this.loader.remove(),void 0!==e.statusText&&"abort"===e.statusText||(e={collection:i.collection,data:e.success?{}:e.data},this.targetElement.find(".activity_reaction_popup_error").remove(),e=new bp.Views.ReactionErrorHandle(e),this.targetElement.append(e.render().el))},onScrollLoadMore:function(t){var e,i,a,arguments,o,n=t.currentTarget,s=c(n);c(n).hasClass("loading")||(e=n.scrollHeight-s.scrollTop()-s.outerHeight(),i=s.parents(".activity-state-popup_tab_item").attr("data-reaction-id"),a=parseInt(s.parents(".activity-state-popup_tab_item").attr("data-total-pages")),void 0===(o=s.parents(".activity-state-popup_tab_item").attr("data-paged"))&&(o=1),e<=10&&o a",_.bind(this.LoadTabData,this)),this.args={collection:this.options.collection,item_id:this.options.item_id,item_type:this.options.item_type,model:this.model}},render:function(){return this.$el.html(this.template(this.options.data)),this},LoadTabData:function(t){var arguments,e=c(t.currentTarget),i=e.data("tab"),e=e.parents(".activity-state-popup_tab").find("."+i);0

'),this.addListeners(),this.Initialize()},addListeners:function(){s(document).on("click",".activity-state-reactions",this.showActivityReactions)},Initialize:function(){},showActivityReactions:function(t){t.preventDefault();var e=bp.Nouveau.ActivityReaction,t=s(t.currentTarget),i=t.next(".activity-state-popup"),a=0,o="",o=0 ul")&&(n=this).targetElement.find(".activity-state-popup_tab_item > ul").each(function(){s(this).on("scroll",_.bind(n.onScrollLoadMore,n))})):this.onOpenFailedRender(t,e,i),this},onOpenFailedRender:function(t,e,i){this.loader.remove(),void 0!==e.statusText&&"abort"===e.statusText||(i={collection:i.collection,data:e.success?{}:e.data},this.targetElement.find(".activity_reaction_popup_error").remove(),e=new bp.Views.ReactionErrorHandle(i),this.targetElement.append(e.render().el))},onScrollLoadMore:function(t){var e,i,a,o,t=t.currentTarget,n=s(t);s(t).hasClass("loading")||(a=t.scrollHeight-n.scrollTop()-n.outerHeight(),e=n.parents(".activity-state-popup_tab_item").attr("data-reaction-id"),o=parseInt(n.parents(".activity-state-popup_tab_item").attr("data-total-pages")),void 0===(i=n.parents(".activity-state-popup_tab_item").attr("data-paged"))&&(i=1),a<=10&&i a",_.bind(this.LoadTabData,this)),this.args={collection:this.options.collection,item_id:this.options.item_id,item_type:this.options.item_type,model:this.model}},render:function(){return this.$el.html(this.template(this.options.data)),this},LoadTabData:function(t){var e,t=s(t.currentTarget),i=t.data("tab"),t=t.parents(".activity-state-popup_tab").find("."+i);0 Date: Tue, 17 Dec 2024 21:22:38 +0200 Subject: [PATCH 2/2] [PROD-8394] Replace "arguments" as reserved keyword when strict mode enabled --- src/bp-templates/bp-nouveau/js/bb-activity-reacted.js | 2 +- src/bp-templates/bp-nouveau/js/bb-activity-reacted.min.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/bp-templates/bp-nouveau/js/bb-activity-reacted.js b/src/bp-templates/bp-nouveau/js/bb-activity-reacted.js index 64e69b6da0..63ae20217d 100644 --- a/src/bp-templates/bp-nouveau/js/bb-activity-reacted.js +++ b/src/bp-templates/bp-nouveau/js/bb-activity-reacted.js @@ -466,7 +466,7 @@ window.bp = window.bp || {}; this.args.collection = this.collection; this.collection.fetch( { - data: _.pick( arguments, [ 'page', 'per_page', 'item_id', 'item_type', 'reaction_id' ] ), + data: _.pick( params, [ 'page', 'per_page', 'item_id', 'item_type', 'reaction_id' ] ), success: _.bind( this.onTabChangeSuccessRender, this, targetElement ), error: _.bind( this.onTabChangeFailedRender, this, targetElement ), } diff --git a/src/bp-templates/bp-nouveau/js/bb-activity-reacted.min.js b/src/bp-templates/bp-nouveau/js/bb-activity-reacted.min.js index cba84c7231..bca11c853f 100644 --- a/src/bp-templates/bp-nouveau/js/bb-activity-reacted.min.js +++ b/src/bp-templates/bp-nouveau/js/bb-activity-reacted.min.js @@ -1 +1 @@ -window.wp=window.wp||{},window.bp=window.bp||{},function(s){"undefined"!=typeof BP_Nouveau&&(_.extend(bp,_.pick(wp,"Backbone","ajax","template")),bp.Models=bp.Models||{},bp.Collections=bp.Collections||{},bp.Views=bp.Views||{},bp.Nouveau=bp.Nouveau||{},bp.Nouveau.ActivityReaction={start:function(){this.views=new Backbone.Collection,this.collections=[],this.types=[],this.fetchXhr=null,this.loader=[],this.loader_html=s('

'),this.addListeners(),this.Initialize()},addListeners:function(){s(document).on("click",".activity-state-reactions",this.showActivityReactions)},Initialize:function(){},showActivityReactions:function(t){t.preventDefault();var e=bp.Nouveau.ActivityReaction,t=s(t.currentTarget),i=t.next(".activity-state-popup"),a=0,o="",o=0 ul")&&(n=this).targetElement.find(".activity-state-popup_tab_item > ul").each(function(){s(this).on("scroll",_.bind(n.onScrollLoadMore,n))})):this.onOpenFailedRender(t,e,i),this},onOpenFailedRender:function(t,e,i){this.loader.remove(),void 0!==e.statusText&&"abort"===e.statusText||(i={collection:i.collection,data:e.success?{}:e.data},this.targetElement.find(".activity_reaction_popup_error").remove(),e=new bp.Views.ReactionErrorHandle(i),this.targetElement.append(e.render().el))},onScrollLoadMore:function(t){var e,i,a,o,t=t.currentTarget,n=s(t);s(t).hasClass("loading")||(a=t.scrollHeight-n.scrollTop()-n.outerHeight(),e=n.parents(".activity-state-popup_tab_item").attr("data-reaction-id"),o=parseInt(n.parents(".activity-state-popup_tab_item").attr("data-total-pages")),void 0===(i=n.parents(".activity-state-popup_tab_item").attr("data-paged"))&&(i=1),a<=10&&i a",_.bind(this.LoadTabData,this)),this.args={collection:this.options.collection,item_id:this.options.item_id,item_type:this.options.item_type,model:this.model}},render:function(){return this.$el.html(this.template(this.options.data)),this},LoadTabData:function(t){var e,t=s(t.currentTarget),i=t.data("tab"),t=t.parents(".activity-state-popup_tab").find("."+i);0

'),this.addListeners(),this.Initialize()},addListeners:function(){s(document).on("click",".activity-state-reactions",this.showActivityReactions)},Initialize:function(){},showActivityReactions:function(t){t.preventDefault();var e=bp.Nouveau.ActivityReaction,t=s(t.currentTarget),i=t.next(".activity-state-popup"),a=0,o="",o=0 ul")&&(n=this).targetElement.find(".activity-state-popup_tab_item > ul").each(function(){s(this).on("scroll",_.bind(n.onScrollLoadMore,n))})):this.onOpenFailedRender(t,e,i),this},onOpenFailedRender:function(t,e,i){this.loader.remove(),void 0!==e.statusText&&"abort"===e.statusText||(i={collection:i.collection,data:e.success?{}:e.data},this.targetElement.find(".activity_reaction_popup_error").remove(),e=new bp.Views.ReactionErrorHandle(i),this.targetElement.append(e.render().el))},onScrollLoadMore:function(t){var e,i,a,o,t=t.currentTarget,n=s(t);s(t).hasClass("loading")||(a=t.scrollHeight-n.scrollTop()-n.outerHeight(),e=n.parents(".activity-state-popup_tab_item").attr("data-reaction-id"),o=parseInt(n.parents(".activity-state-popup_tab_item").attr("data-total-pages")),void 0===(i=n.parents(".activity-state-popup_tab_item").attr("data-paged"))&&(i=1),a<=10&&i a",_.bind(this.LoadTabData,this)),this.args={collection:this.options.collection,item_id:this.options.item_id,item_type:this.options.item_type,model:this.model}},render:function(){return this.$el.html(this.template(this.options.data)),this},LoadTabData:function(t){var e,t=s(t.currentTarget),i=t.data("tab"),t=t.parents(".activity-state-popup_tab").find("."+i);0