Deleting a notebook forever now updates the user's storage usage accordingly.
This commit is contained in:
parent
079f7e6f98
commit
45f94aa188
|
@ -872,7 +872,7 @@ class Notebooks( object ):
|
||||||
@type user_id: unicode or NoneType
|
@type user_id: unicode or NoneType
|
||||||
@param user_id: id of current logged-in user (if any)
|
@param user_id: id of current logged-in user (if any)
|
||||||
@rtype dict
|
@rtype dict
|
||||||
@return {}
|
@return: { 'storage_bytes': current storage usage by user }
|
||||||
@raise Access_error: the current user doesn't have access to the given notebook
|
@raise Access_error: the current user doesn't have access to the given notebook
|
||||||
@raise Validation_error: one of the arguments is invalid
|
@raise Validation_error: one of the arguments is invalid
|
||||||
"""
|
"""
|
||||||
|
@ -894,9 +894,10 @@ class Notebooks( object ):
|
||||||
raise Access_error()
|
raise Access_error()
|
||||||
|
|
||||||
self.__database.execute( user.sql_remove_notebook( notebook_id ), commit = False )
|
self.__database.execute( user.sql_remove_notebook( notebook_id ), commit = False )
|
||||||
|
user = self.__users.update_storage( user_id, commit = False )
|
||||||
self.__database.commit()
|
self.__database.commit()
|
||||||
|
|
||||||
return dict()
|
return dict( storage_bytes = user.storage_bytes )
|
||||||
|
|
||||||
@expose( view = Json )
|
@expose( view = Json )
|
||||||
@grab_user_id
|
@grab_user_id
|
||||||
|
|
|
@ -1544,9 +1544,10 @@ Wiki.prototype.delete_notebook_forever = function ( event, notebook_id ) {
|
||||||
if ( items.length == 0 )
|
if ( items.length == 0 )
|
||||||
removeElement( "deleted_notebooks" );
|
removeElement( "deleted_notebooks" );
|
||||||
|
|
||||||
|
var self = this;
|
||||||
this.invoker.invoke( "/notebooks/delete_forever", "POST", {
|
this.invoker.invoke( "/notebooks/delete_forever", "POST", {
|
||||||
"notebook_id": notebook_id
|
"notebook_id": notebook_id
|
||||||
} );
|
}, function ( result ) { self.display_storage_usage( result.storage_bytes ); } );
|
||||||
|
|
||||||
event.stop();
|
event.stop();
|
||||||
}
|
}
|
||||||
|
|
Reference in New Issue