mirror of
				https://github.com/superseriousbusiness/gotosocial.git
				synced 2025-10-30 21:52:31 -05:00 
			
		
		
		
	[bugfix] updated pinned counts on status delete (#3188)
* include pinned status when incrementing / decrementing status counts * remove the pinned increment on status creation * code comments * microoptimize decr
This commit is contained in:
		
					parent
					
						
							
								4a3ece0c6c
							
						
					
				
			
			
				commit
				
					
						865b3aeaac
					
				
			
		
					 4 changed files with 36 additions and 28 deletions
				
			
		|  | @ -251,10 +251,7 @@ func (p *clientAPI) CreateStatus(ctx context.Context, cMsg *messages.FromClientA | |||
| 	// If pending approval is true then status must | ||||
| 	// reply to a status (either one of ours or a | ||||
| 	// remote) that requires approval for the reply. | ||||
| 	pendingApproval := util.PtrOrValue( | ||||
| 		status.PendingApproval, | ||||
| 		false, | ||||
| 	) | ||||
| 	pendingApproval := util.PtrOrZero(status.PendingApproval) | ||||
| 
 | ||||
| 	switch { | ||||
| 	case pendingApproval && !status.PreApproved: | ||||
|  | @ -816,7 +813,7 @@ func (p *clientAPI) UndoAnnounce(ctx context.Context, cMsg *messages.FromClientA | |||
| 	} | ||||
| 
 | ||||
| 	// Update stats for the origin account. | ||||
| 	if err := p.utils.decrementStatusesCount(ctx, cMsg.Origin); err != nil { | ||||
| 	if err := p.utils.decrementStatusesCount(ctx, cMsg.Origin, status); err != nil { | ||||
| 		log.Errorf(ctx, "error updating account stats: %v", err) | ||||
| 	} | ||||
| 
 | ||||
|  | @ -873,7 +870,7 @@ func (p *clientAPI) DeleteStatus(ctx context.Context, cMsg *messages.FromClientA | |||
| 	} | ||||
| 
 | ||||
| 	// Update stats for the origin account. | ||||
| 	if err := p.utils.decrementStatusesCount(ctx, cMsg.Origin); err != nil { | ||||
| 	if err := p.utils.decrementStatusesCount(ctx, cMsg.Origin, status); err != nil { | ||||
| 		log.Errorf(ctx, "error updating account stats: %v", err) | ||||
| 	} | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue