mirror of
				https://github.com/superseriousbusiness/gotosocial.git
				synced 2025-10-30 22:42:24 -05:00 
			
		
		
		
	[chore] deinterface the typeutils.Converter and update to use state structure (#2217)
* update typeconverter to use state structure * deinterface the typeutils.TypeConverter -> typeutils.Converter * finish copying over old type converter code comments * fix cherry-pick merge issues, fix tests pointing to old typeutils interface type still
This commit is contained in:
		
					parent
					
						
							
								1b848aa1e5
							
						
					
				
			
			
				commit
				
					
						8f67dd583d
					
				
			
		
					 119 changed files with 611 additions and 742 deletions
				
			
		|  | @ -35,7 +35,6 @@ func (p *Processor) RulesGet( | |||
| 	ctx context.Context, | ||||
| ) ([]*apimodel.AdminInstanceRule, gtserror.WithCode) { | ||||
| 	rules, err := p.state.DB.GetActiveRules(ctx) | ||||
| 
 | ||||
| 	if err != nil { | ||||
| 		return nil, gtserror.NewErrorInternalError(err) | ||||
| 	} | ||||
|  | @ -43,7 +42,7 @@ func (p *Processor) RulesGet( | |||
| 	apiRules := make([]*apimodel.AdminInstanceRule, len(rules)) | ||||
| 
 | ||||
| 	for i := range rules { | ||||
| 		apiRules[i] = p.tc.InstanceRuleToAdminAPIRule(&rules[i]) | ||||
| 		apiRules[i] = p.converter.InstanceRuleToAdminAPIRule(&rules[i]) | ||||
| 	} | ||||
| 
 | ||||
| 	return apiRules, nil | ||||
|  | @ -59,7 +58,7 @@ func (p *Processor) RuleGet(ctx context.Context, id string) (*apimodel.AdminInst | |||
| 		return nil, gtserror.NewErrorInternalError(err) | ||||
| 	} | ||||
| 
 | ||||
| 	return p.tc.InstanceRuleToAdminAPIRule(rule), nil | ||||
| 	return p.converter.InstanceRuleToAdminAPIRule(rule), nil | ||||
| } | ||||
| 
 | ||||
| // RuleCreate adds a new rule to the instance. | ||||
|  | @ -78,7 +77,7 @@ func (p *Processor) RuleCreate(ctx context.Context, form *apimodel.InstanceRuleC | |||
| 		return nil, gtserror.NewErrorInternalError(err) | ||||
| 	} | ||||
| 
 | ||||
| 	return p.tc.InstanceRuleToAdminAPIRule(rule), nil | ||||
| 	return p.converter.InstanceRuleToAdminAPIRule(rule), nil | ||||
| } | ||||
| 
 | ||||
| // RuleUpdate updates text for an existing rule. | ||||
|  | @ -96,12 +95,11 @@ func (p *Processor) RuleUpdate(ctx context.Context, id string, form *apimodel.In | |||
| 	rule.Text = form.Text | ||||
| 
 | ||||
| 	updatedRule, err := p.state.DB.UpdateRule(ctx, rule) | ||||
| 
 | ||||
| 	if err != nil { | ||||
| 		return nil, gtserror.NewErrorInternalError(err) | ||||
| 	} | ||||
| 
 | ||||
| 	return p.tc.InstanceRuleToAdminAPIRule(updatedRule), nil | ||||
| 	return p.converter.InstanceRuleToAdminAPIRule(updatedRule), nil | ||||
| } | ||||
| 
 | ||||
| // RuleDelete deletes an existing rule. | ||||
|  | @ -118,10 +116,9 @@ func (p *Processor) RuleDelete(ctx context.Context, id string) (*apimodel.AdminI | |||
| 
 | ||||
| 	rule.Deleted = util.Ptr(true) | ||||
| 	deletedRule, err := p.state.DB.UpdateRule(ctx, rule) | ||||
| 
 | ||||
| 	if err != nil { | ||||
| 		return nil, gtserror.NewErrorInternalError(err) | ||||
| 	} | ||||
| 
 | ||||
| 	return p.tc.InstanceRuleToAdminAPIRule(deletedRule), nil | ||||
| 	return p.converter.InstanceRuleToAdminAPIRule(deletedRule), nil | ||||
| } | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue