mirror of
				https://github.com/superseriousbusiness/gotosocial.git
				synced 2025-10-31 14:32:24 -05:00 
			
		
		
		
	don't panic on non-fully populated status edits, it may not always be possible (#4006)
This commit is contained in:
		
					parent
					
						
							
								6ff0d3355c
							
						
					
				
			
			
				commit
				
					
						a07ca92752
					
				
			
		
					 1 changed files with 7 additions and 5 deletions
				
			
		|  | @ -21,6 +21,7 @@ import ( | ||||||
| 	"slices" | 	"slices" | ||||||
| 	"time" | 	"time" | ||||||
| 
 | 
 | ||||||
|  | 	"github.com/superseriousbusiness/gotosocial/internal/log" | ||||||
| 	"github.com/superseriousbusiness/gotosocial/internal/util/xslices" | 	"github.com/superseriousbusiness/gotosocial/internal/util/xslices" | ||||||
| ) | ) | ||||||
| 
 | 
 | ||||||
|  | @ -272,14 +273,15 @@ func (s *Status) IsLocalOnly() bool { | ||||||
| 	return s.Federated == nil || !*s.Federated | 	return s.Federated == nil || !*s.Federated | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // AllAttachmentIDs gathers ALL media attachment IDs from both the | // AllAttachmentIDs gathers ALL media attachment IDs from both | ||||||
| // receiving Status{}, and any historical Status{}.Edits. Note that | // the receiving Status{}, and any historical Status{}.Edits. | ||||||
| // this function will panic if Status{}.Edits is not populated. |  | ||||||
| func (s *Status) AllAttachmentIDs() []string { | func (s *Status) AllAttachmentIDs() []string { | ||||||
| 	var total int | 	var total int | ||||||
| 
 | 
 | ||||||
| 	if len(s.EditIDs) != len(s.Edits) { | 	// Check if this is being correctly | ||||||
| 		panic("status edits not populated") | 	// called on fully populated status. | ||||||
|  | 	if !s.EditsPopulated() { | ||||||
|  | 		log.Warnf(nil, "status edits not populated for %s", s.URI) | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	// Get count of attachment IDs. | 	// Get count of attachment IDs. | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue