forked from GNUsocial/gnu-social
[ATTACHMENTS] Further refactoring
Some key points: - Components and Plugins shouldn't extend Module directly - Avatars should be fetched via GSActor ID, not by nickname as that isn't unique - Avatar now is a separate Component - Common file utilities are now to be placed in Core\GSFile, this will handle storage and trigger validation - Some bug fixes
This commit is contained in:
@@ -201,12 +201,12 @@ class Attachment extends Entity
|
||||
$files = [];
|
||||
if ($cascade) {
|
||||
// An avatar can own a file, and it becomes invalid if the file is deleted
|
||||
$avatar = DB::findBy('avatar', ['file_id' => $this->id]);
|
||||
$avatar = DB::findBy('avatar', ['attachment_id' => $this->id]);
|
||||
foreach ($avatar as $a) {
|
||||
$files[] = $a->getFilePath();
|
||||
$a->delete($flush, $delete_files_now, $cascading = true);
|
||||
}
|
||||
foreach (DB::findBy('file_thumbnail', ['file_id' => $this->id]) as $ft) {
|
||||
foreach (DB::findBy('attachment_thumbnail', ['attachment_id' => $this->id]) as $ft) {
|
||||
$files[] = $ft->delete($flush, $delete_files_now, $cascading);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user