mirror of
				https://github.com/superseriousbusiness/gotosocial.git
				synced 2025-10-30 20:22:25 -05:00 
			
		
		
		
	* [bugfix] Don't throw error when parent statuses are missing (#2011) * Split missing parent status case from error check
This commit is contained in:
		
					parent
					
						
							
								ad93e57d08
							
						
					
				
			
			
				commit
				
					
						8f8093aea4
					
				
			
		
					 1 changed files with 7 additions and 2 deletions
				
			
		|  | @ -202,7 +202,7 @@ func (s *statusDB) PopulateStatus(ctx context.Context, status *gtsmodel.Status) | ||||||
| 				gtscontext.SetBarebones(ctx), | 				gtscontext.SetBarebones(ctx), | ||||||
| 				status.InReplyToID, | 				status.InReplyToID, | ||||||
| 			) | 			) | ||||||
| 			if err != nil { | 			if err != nil && !errors.Is(err, db.ErrNoEntries) { | ||||||
| 				errs.Appendf("error populating status parent: %w", err) | 				errs.Appendf("error populating status parent: %w", err) | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
|  | @ -561,10 +561,15 @@ func (s *statusDB) GetStatusParents(ctx context.Context, status *gtsmodel.Status | ||||||
| 
 | 
 | ||||||
| 	for id := status.InReplyToID; id != ""; { | 	for id := status.InReplyToID; id != ""; { | ||||||
| 		parent, err := s.GetStatusByID(ctx, id) | 		parent, err := s.GetStatusByID(ctx, id) | ||||||
| 		if err != nil { | 		if err != nil && !errors.Is(err, db.ErrNoEntries) { | ||||||
| 			return nil, err | 			return nil, err | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
|  | 		if parent == nil { | ||||||
|  | 			// Parent status not found (e.g. deleted) | ||||||
|  | 			break | ||||||
|  | 		} | ||||||
|  | 
 | ||||||
| 		// Append parent status to slice | 		// Append parent status to slice | ||||||
| 		parents = append(parents, parent) | 		parents = append(parents, parent) | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue