Skip to content

Commit

Permalink
History tracking: add tx log entry for neuron undelelete
Browse files Browse the repository at this point in the history
  • Loading branch information
tomka committed Mar 8, 2024
1 parent 677abf3 commit 936e2bb
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion django/applications/catmaid/history.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,13 +270,20 @@ def get_dependent_historic_tx(tx, target_list=None):
return target_list


def undelete_neuron(tx, interactive=False):
def undelete_neuron(project_id, tx, user_id=None, interactive=False):
"""Recreates a neuron and its connections. This simply restores everything
from a delete.neuron transaction. Some materialized views as
treenode_connector_edge or treenode_edge need to be recreated selectively
for the resurrected neuron. Therefore, an update of these views is done for
all skeleton IDs encountered.
"""
if user_id is None:
from .apps import get_system_user
user_id = get_system_user().id
logger.info('No user ID provided, working as system user')

add_log_entry(user_id, 'neurons.undelete', project_id)

tx_matches = get_historic_row_count_affected_by_tx(tx)

if interactive:
Expand Down

0 comments on commit 936e2bb

Please sign in to comment.