Open Silver-IT opened 5 months ago
According to the discussion in this thread, to delete the attachments which belongs to a specific contract is a part of deleting contract.
So this issue seems to be one of the steps of the #1524.
@corrideat, while thinking deeply about the solution of this issue, I found one misunderstanding problem which is that
Now. the private owner of the resources(attachments) is the group creator, not a group contract itself. Since the users are able to create several groups, and to be group creators for several groups, how can we select and delete only the resources that belongs to the specific group?
Example Situation:
User1
is the owner of GroupA
and also GroupB
. There are many attachments in GroupA
, and also GroupB
. The private owner of those resources is same, that's User1
. Here, User1
tries to delete GroupA
. Do we have a way to choose the attachments only from the GroupA
?
@Silver-IT Well, the 'owner' is defined in tiers, you can see how accounting works in the wiki.
So, if you set the billableContractId
of an attachment to the chatroom, it'll be correctly registered as belonging to that chatroom, and, when contract deletion gets implemented, those files could be deleted as well.
The reason you have to be the group creator to delete an attachment is more of a permissions issue (i.e., regular users shouldn't be able to delete each other's files, just like they can't delete messages). However, the files are stored as belonging to the chatroom, which is stored as belonging to the group, which is stored as belonging to the group creator. So, it's possible, on the server, to remove a group and all associated contracts and files, or to remove a chatroom and all it's associated files.
User1 is the owner of GroupA and also GroupB. There are many attachments in GroupA, and also GroupB. The private owner of those resources is same, that's User1. Here, User1 tries to delete GroupA. Do we have a way to choose the attachments only from the GroupA?
In this case, yes, only things related to GroupA
can be deleted, provided the correct billableContractID
was used when creating those resources.
Problem
We remove attachments when user tries to remove an attachment of a message as well as to try to remove the message itself. Now, let's think about the case when user tries to remove the chatroom. Here, we should think about the usefulness of attachments of the chatroom, and remove them too. What the meaning of usefulness is that they could be used in another chatroom. REF: #1881
Solution
Implement it