pxlrbt / filament-excel

Excel Export for Filament Admin Resources
MIT License
323 stars 68 forks source link

Filament Database Notification Deleted File #174

Closed Umar-Farooq-Shafi closed 1 week ago

Umar-Farooq-Shafi commented 6 months ago

The notification shows the export even if the file is deleted after the first click.

Remove the notification or not delete the file if the user has already downloaded the file!

MasterAdmin2 commented 6 months ago

The notification shows the export even if the file is deleted after the first click.

Remove the notification or not delete the file if the user has already downloaded the file!

yes, it saves the server space, if you repeatedly save all files of all exports it will consume space,

pxlrbt commented 6 months ago

@MasterAdmin2 That's not what the issue is about. It's about the Notification still showing even when the file was removed already.

Umar-Farooq-Shafi commented 6 months ago

Yes

MasterAdmin2 commented 5 months ago

@MasterAdmin2 That's not what the issue is about. It's about the Notification still showing even when the file was removed.

@pxlrbt @Umar-Farooq-Shafi corrected function is - In vendor/pxlrbt/filament-excel/src/FilamentExcelServiceProvider.php

if (Filament::getCurrentPanel()->hasDatabaseNotifications()) {
                Notification::make(data_get($export, 'id'))
                ->title(__('filament-excel::notifications.download_ready.title'))
                ->body(__('filament-excel::notifications.download_ready.body'))
                ->success()
                ->icon('heroicon-o-arrow-down-tray')
                ->actions([
                    Action::make('download')
                        ->label(__('filament-excel::notifications.download_ready.download'))
                        ->url($url, shouldOpenInNewTab: true)
                        ->button()
                        ->close(),
                ])
                ->persistent()
                ->sendToDatabase(auth()->user());

You missed adding the close-after button in the file. that's why that notification was there even after the download

salvationarinze commented 4 months ago

Please is there a quick fix for this or do we wait for a merge?

muzhawir commented 1 week ago

Please is there a quick fix for this or do we wait for a merge?

I hope this fix is merged :pray: , because those who use database notifications will definitely get this error message when pressing the download button a second time:

image

pxlrbt commented 1 week ago

Should be solved with release v2.3.2

muzhawir commented 1 week ago

Thank you very much!