Skip to content

Commit

Permalink
PRJ-58: Refactor variable position and rename updateActionType
Browse files Browse the repository at this point in the history
- Moved variable position for better code organization
- Renamed `updateActionType` to `nameDocumentAsMedia` to align with the document create popup functionality, as the class uses 'bb-rl-media-move-file'
  • Loading branch information
jitendrabanjara1991 committed Feb 6, 2025
1 parent 5b09c74 commit 8796bf2
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5009,7 +5009,8 @@ window.bp = window.bp || {};
event.preventDefault();

var itemId, destinationId, containerClass, selectedIdClass,
nameDocumentAsMedia = 'document' === actionType ? 'media' : actionType;
updateActionType = 'document_folder' === actionType ? 'document' : actionType,
nameDocumentAsMedia = 'document' === actionType ? 'media' : actionType;

if ( 'document_folder' === actionType ) {
itemId = target.attr( 'id' );
Expand Down Expand Up @@ -5082,8 +5083,7 @@ window.bp = window.bp || {};
data: data,
success: function ( response ) {
if ( response.success ) {
var updateActionType = 'document_folder' === actionType ? 'document' : actionType;
var isDir = 'is_' + updateActionType + '_directory';
var isDir = 'is_' + updateActionType + '_directory';
if ( 'yes' === bbRlMedia[ isDir ] ) {
var store = bp.Nouveau.getStorage( 'bp-' + updateActionType );
var scope = store.scope, selector;
Expand Down Expand Up @@ -5136,7 +5136,7 @@ window.bp = window.bp || {};
$( document ).removeClass( 'open-popup' );
}
if ( 'document_folder' !== actionType ) {
target.closest( '.bb-rl-' + updateActionType + '-move-file' ).find( '.bb-rl-ac-' + updateActionType + '-close-button' ).trigger( 'click' );
target.closest( '.bb-rl-' + nameDocumentAsMedia + '-move-file' ).find( '.bb-rl-ac-' + updateActionType + '-close-button' ).trigger( 'click' );
if ( 'media' === actionType ) {
$( document ).find( 'a.bb-rl-open-' + nameDocumentAsMedia + '-theatre[data-id="' + itemId + '"]' ).data( 'album-id', destinationId );
}
Expand Down

0 comments on commit 8796bf2

Please sign in to comment.