RestyaPlatform / board

Trello like kanban board. Based on Restya platform.
http://restya.com/board/
Open Software License 3.0
2.04k stars 383 forks source link

Don't delete activities when a card is removed #1710

Open bseclier opened 6 years ago

bseclier commented 6 years ago

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,

rrjanbiah commented 6 years ago

@bseclier

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

bseclier commented 6 years ago

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. "

rrjanbiah commented 6 years ago

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

bseclier commented 6 years ago

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);

rrjanbiah commented 6 years ago

@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.

bseclier commented 6 years ago

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.

rrjanbiah commented 6 years ago

@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?

bseclier commented 6 years ago

Yes, this kind of button would be awesome !

rrjanbiah commented 6 years ago

Related #1712

bseclier commented 5 years ago

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;

srileka commented 5 years ago

@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;