board icon indicating copy to clipboard operation
board copied to clipboard

Don't delete activities when a card is removed

Open bseclier opened this issue 7 years ago • 11 comments

Hi, I don't know if it is a bug or if it's just not implemented but I found a problem : When I delete a card, it would be nice to delete all activities related. I'm in 0.6.2 and it's not the case. Here is the proof :

restyaboard=# select id,type,card_id from activities where card_id=1601;
   id   |     type      | card_id 
--------+---------------+---------
 228012 | delete_card   |    1601
 228011 | archived_card |    1601
 228010 | add_comment   |    1601
 228009 | add_comment   |    1601
 228008 | add_comment   |    1601
 228007 | add_card      |    1601

Is it possible to correct/add this ? Thanks,

bseclier avatar Mar 30 '18 13:03 bseclier

@bseclier

It's actually a feature. Without activities, you won't know what is happening in the board when there are many users.

rrjanbiah avatar Mar 30 '18 13:03 rrjanbiah

Yes, but what's the point to keep all this stuff when a card is deleted ? Besides, when we delete a card, we have this message : "All actions will be removed from the activity feed and you won't be able to reopen the card. "

bseclier avatar Mar 30 '18 13:03 bseclier

Internal note

Research more about this. Are we using soft delete?

For me, it seems to work correct as we can check what is deleted from admin activities. But, admin can't seem to restore it

CC @ssivachidambaram

rrjanbiah avatar Mar 30 '18 13:03 rrjanbiah

Do you see any contraindication to delete these "orphan" activities with the following SQL request (fields maybe used somewhere else in restya) ? delete from activities where card_id not in (select id from cards);

bseclier avatar Mar 30 '18 14:03 bseclier

@bseclier I'm sorry. I think, you're right. Comments are actually getting hard-deleted. Intended behavior is that comments are getting soft-deleted so that admin can revert back when required.

rrjanbiah avatar Apr 01 '18 05:04 rrjanbiah

I don't understand your answer. You don't want to delete all activities related to a deleted card just to let the possibility to an admin to restore the card ? Can you tell me where an admin can restore a card, I don't see it. Besides, I don't want (as admin) to be able to do such a restoration, can I do the DELETE sql statement above without damaging the database, somewhere else ? Thanks for your answer.

bseclier avatar Apr 03 '18 07:04 bseclier

@bseclier

You don't want to delete all activities related to a deleted card just to let the possibility to an admin to restore the card ?

Yes. In a typical enterprise setup, admin should be able to handle any vandalism

Can you tell me where an admin can restore a card, I don't see it.

Yes, currently there is no such thing as it was mistakenly not done yet

Besides, I don't want (as admin) to be able to do such a restoration, can I do the DELETE sql statement above without damaging the database, somewhere else ?

Perhaps have to setup a button for admin to prune such histories?

rrjanbiah avatar Apr 03 '18 09:04 rrjanbiah

Yes, this kind of button would be awesome !

bseclier avatar Apr 03 '18 10:04 bseclier

Related #1712

rrjanbiah avatar Apr 07 '18 11:04 rrjanbiah

I used this command in order to purge my boards : delete from activities where card_id not in (select id from cards) AND card_id != 0;

bseclier avatar May 10 '19 11:05 bseclier

@bseclier Please take a backup of your Restyaboard before executing the below command to purge your boards

select * from activities where card_id NOT IN (select id from cards) AND card_id != 0 OR card_id != NULL;

srileka avatar Nov 08 '19 06:11 srileka