File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ module ::CommunityCustomFields
2323 product_area : :string ,
2424 status : :string ,
2525 outcome : :string ,
26+ closed_at : :datetime ,
2627 snoozed_until : :datetime ,
2728 waiting_since : :datetime ,
2829 waiting_id : :integer
@@ -77,6 +78,18 @@ module ::CommunityCustomFields
7778 topic . custom_fields [ :status ] = "open"
7879 topic . custom_fields [ :snoozed_until ] = nil
7980 end
81+
82+ if topic . custom_fields [ :status ] == "closed"
83+ if topic . custom_fields [ :last_assigned_to_id ] . nil? || Time . iso8601 ( topic . custom_fields [ :closed_at ] ) < 1 . month . ago . iso8601
84+ topic . custom_fields [ :status ] = "new"
85+ else
86+ topic . custom_fields [ :status ] = "open"
87+ topic . custom_fields [ :assignee_id ] = topic . custom_fields [ :last_assigned_to_id ]
88+ topic . custom_fields [ :last_assigned_at ] = Time . now . utc . iso8601
89+ end
90+ topic . custom_fields [ :outcome ] = nil
91+ topic . custom_fields [ :closed_at ] = nil
92+ end
8093 end
8194
8295 topic . save_custom_fields
You can’t perform that action at this time.
0 commit comments