| 
									
										
										
										
											2023-02-24 13:25:02 -03:00
										 |  |  | # frozen_string_literal: true | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-03-14 16:03:50 -03:00
										 |  |  | module ::DiscourseAi | 
					
						
							| 
									
										
										
										
											2023-02-28 11:17:03 -03:00
										 |  |  |   class PostClassificator < Classificator | 
					
						
							| 
									
										
										
										
											2023-02-24 13:25:02 -03:00
										 |  |  |     private | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-03-07 15:39:28 -03:00
										 |  |  |     def flag!(post, classification, verdicts, accuracies) | 
					
						
							|  |  |  |       post.hide!(ReviewableScore.types[:inappropriate]) | 
					
						
							| 
									
										
										
										
											2023-02-24 13:25:02 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-03-07 15:39:28 -03:00
										 |  |  |       reviewable = | 
					
						
							| 
									
										
										
										
											2023-03-14 16:03:50 -03:00
										 |  |  |         ReviewableAiPost.needs_review!( | 
					
						
							| 
									
										
										
										
											2023-03-07 15:39:28 -03:00
										 |  |  |           created_by: Discourse.system_user, | 
					
						
							|  |  |  |           target: post, | 
					
						
							|  |  |  |           reviewable_by_moderator: true, | 
					
						
							|  |  |  |           potential_spam: false, | 
					
						
							|  |  |  |           payload: { | 
					
						
							|  |  |  |             classification: classification, | 
					
						
							|  |  |  |             accuracies: accuracies, | 
					
						
							|  |  |  |             verdicts: verdicts, | 
					
						
							|  |  |  |           }, | 
					
						
							|  |  |  |         ) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       add_score(reviewable) | 
					
						
							| 
									
										
										
										
											2023-02-24 13:25:02 -03:00
										 |  |  |     end | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | end |