mirror of
				https://github.com/superseriousbusiness/gotosocial.git
				synced 2025-10-31 02:42:25 -05:00 
			
		
		
		
	
					parent
					
						
							
								5543fd5340
							
						
					
				
			
			
				commit
				
					
						540edef0c2
					
				
			
		
					 15 changed files with 597 additions and 54 deletions
				
			
		|  | @ -36,6 +36,7 @@ func (p *Processor) Update( | |||
| 	id string, | ||||
| 	title *string, | ||||
| 	repliesPolicy *gtsmodel.RepliesPolicy, | ||||
| 	exclusive *bool, | ||||
| ) (*apimodel.List, gtserror.WithCode) { | ||||
| 	list, errWithCode := p.getList( | ||||
| 		// Use barebones ctx; no embedded | ||||
|  | @ -49,7 +50,7 @@ func (p *Processor) Update( | |||
| 	} | ||||
| 
 | ||||
| 	// Only update columns we're told to update. | ||||
| 	columns := make([]string, 0, 2) | ||||
| 	columns := make([]string, 0, 3) | ||||
| 
 | ||||
| 	if title != nil { | ||||
| 		list.Title = *title | ||||
|  | @ -61,6 +62,11 @@ func (p *Processor) Update( | |||
| 		columns = append(columns, "replies_policy") | ||||
| 	} | ||||
| 
 | ||||
| 	if exclusive != nil { | ||||
| 		list.Exclusive = exclusive | ||||
| 		columns = append(columns, "exclusive") | ||||
| 	} | ||||
| 
 | ||||
| 	if err := p.state.DB.UpdateList(ctx, list, columns...); err != nil { | ||||
| 		if errors.Is(err, db.ErrAlreadyExists) { | ||||
| 			err = errors.New("you already have a list with this title") | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue