diff options
Diffstat (limited to 'internal/db/bundb/report.go')
-rw-r--r-- | internal/db/bundb/report.go | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/internal/db/bundb/report.go b/internal/db/bundb/report.go index 7c1dd16e7..9e4ba5b29 100644 --- a/internal/db/bundb/report.go +++ b/internal/db/bundb/report.go @@ -186,6 +186,19 @@ func (r *reportDB) PopulateReport(ctx context.Context, report *gtsmodel.Report) } } + if l := len(report.RuleIDs); l > 0 && l != len(report.Rules) { + // Report target rules not set, fetch from the database. + + for _, v := range report.RuleIDs { + rule, err := r.state.DB.GetRuleByID(ctx, v) + if err != nil { + errs.Appendf("error populating report rules: %w", err) + } else { + report.Rules = append(report.Rules, rule) + } + } + } + if report.ActionTakenByAccountID != "" && report.ActionTakenByAccount == nil { // Report action account is not set, fetch from the database. |