mirror of
				https://github.com/invoiceninja/invoiceninja.git
				synced 2025-11-01 20:17:35 -04:00 
			
		
		
		
	Fixes for Email histoyr
This commit is contained in:
		
							parent
							
								
									0694378bb5
								
							
						
					
					
						commit
						fb3c0120ec
					
				| @ -31,11 +31,11 @@ class EmailHistoryController extends BaseController | ||||
|                  ->where('category_id', SystemLog::CATEGORY_MAIL) | ||||
|                  ->orderBy('id', 'DESC') | ||||
|                  ->cursor() | ||||
|                  ->map(function ($system_log) { | ||||
|                      if(($system_log->log['history'] && $system_log->log['history']['events'] && count($system_log->log['history']['events']) >=1) ?? false) { | ||||
|                         return $system_log->log['history']; | ||||
|                      } | ||||
|                  }); | ||||
|                 ->filter(function ($system_log) { | ||||
|                     return ($system_log->log['history'] && isset($system_log->log['history']['events']) && count($system_log->log['history']['events']) >=1) !== false; | ||||
|                 })->map(function  ($system_log) { | ||||
|                     return $system_log->log['history']; | ||||
|                 })->values()->all(); | ||||
| 
 | ||||
|         return response()->json($data, 200); | ||||
| 
 | ||||
| @ -51,16 +51,17 @@ class EmailHistoryController extends BaseController | ||||
|         /** @var \App\Models\User $user */ | ||||
|         $user = auth()->user(); | ||||
| 
 | ||||
| 
 | ||||
|         $data = SystemLog::where('company_id', $user->company()->id) | ||||
|                 ->where('category_id', SystemLog::CATEGORY_MAIL) | ||||
|                 ->whereJsonContains('log->history->entity_id', $this->encodePrimaryKey($request->entity_id)) | ||||
|                 ->orderBy('id', 'DESC') | ||||
|                 ->cursor() | ||||
|                 ->map(function ($system_log) { | ||||
|                     if(($system_log->log['history'] && $system_log->log['history']['events'] && count($system_log->log['history']['events']) >=1) ?? false) { | ||||
|                         return $system_log->log['history']; | ||||
|                     } | ||||
|                 }); | ||||
|         ->where('category_id', SystemLog::CATEGORY_MAIL) | ||||
|         ->whereJsonContains('log->history->entity_id', $this->encodePrimaryKey($request->entity_id)) | ||||
|         ->orderBy('id', 'DESC') | ||||
|         ->cursor() | ||||
|         ->filter(function ($system_log) { | ||||
|             return ($system_log->log['history'] && isset($system_log->log['history']['events']) && count($system_log->log['history']['events']) >=1) !== false; | ||||
|         })->map(function  ($system_log) { | ||||
|             return $system_log->log['history']; | ||||
|         })->values()->all(); | ||||
| 
 | ||||
|         return response()->json($data, 200); | ||||
| 
 | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user