Merge pull request #7749 from appwrite/feat-seperate-image

Feat seperate image IDs
This commit is contained in:
Torsten Dittmann 2024-03-07 20:32:49 +01:00 committed by GitHub
commit 6ba69b1299
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 11 additions and 3 deletions

View file

@ -2945,7 +2945,11 @@ App::post('/v1/messaging/messages/push')
throw new Exception(Exception::STORAGE_FILE_NOT_PUBLIC);
}
$image = "{$protocol}://{$host}/v1/storage/buckets/{$bucket->getId()}/files/{$file->getId()}/view?project={$project->getId()}";
$image = [
'bucketId' => $bucket->getId(),
'fileId' => $file->getId(),
'url' => "{$protocol}://{$host}/v1/storage/buckets/{$bucket->getId()}/files/{$file->getId()}/view?project={$project->getId()}",
];
}
$pushData = [];
@ -3770,7 +3774,11 @@ App::patch('/v1/messaging/messages/push/:messageId')
throw new Exception(Exception::STORAGE_FILE_NOT_PUBLIC);
}
$pushData['image'] = "{$protocol}://{$host}/v1/storage/buckets/{$bucket->getId()}/files/{$file->getId()}/view?project={$project->getId()}";
$pushData['image'] = [
'bucketId' => $bucket->getId(),
'fileId' => $file->getId(),
'url' => "{$protocol}://{$host}/v1/storage/buckets/{$bucket->getId()}/files/{$file->getId()}/view?project={$project->getId()}"
];
}
$message->setAttribute('data', $pushData);

View file

@ -627,7 +627,7 @@ class Messaging extends Action
$body = $message['data']['body'];
$data = $message['data']['data'] ?? null;
$action = $message['data']['action'] ?? null;
$image = $message['data']['image'] ?? null;
$image = $message['data']['image']['url'] ?? null;
$sound = $message['data']['sound'] ?? null;
$icon = $message['data']['icon'] ?? null;
$color = $message['data']['color'] ?? null;