• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Freegle / iznik-server-go / a6197cd2-9a47-4d17-bf05-7e7d9973b2fc

10 Feb 2026 04:13PM UTC coverage: 72.579%. First build
a6197cd2-9a47-4d17-bf05-7e7d9973b2fc

Pull #11

circleci

edwh
fix: Add higher-ID guard to newsfeed Seen handler

Prevents overwriting a higher seen-ID with a lower one, which would cause
duplicate digest emails. Matches PHP behavior that checks existing record
before REPLACE INTO.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Pull Request #11: feat: Add newsfeed write handlers

358 of 453 new or added lines in 4 files covered. (79.03%)

7231 of 9963 relevant lines covered (72.58%)

8.51 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

83.33
/queue/queue.go
1
package queue
2

3
import (
4
        "encoding/json"
5
        "github.com/freegle/iznik-server-go/database"
6
        "log"
7
)
8

9
// Task types for the background_tasks queue.
10
// Go inserts rows with these types; iznik-batch processes them.
11
const (
12
        // TaskPushNotifyGroupMods sends FCM push notifications to all moderators of a group.
13
        TaskPushNotifyGroupMods = "push_notify_group_mods"
14

15
        // TaskEmailChitchatReport sends a report email to ChitChat support when a newsfeed post is reported.
16
        TaskEmailChitchatReport = "email_chitchat_report"
17
)
18

19
// QueueTask inserts a task into the background_tasks table for async processing by iznik-batch.
20
func QueueTask(taskType string, data map[string]interface{}) error {
6✔
21
        db := database.DBConn
6✔
22

6✔
23
        jsonData, err := json.Marshal(data)
6✔
24
        if err != nil {
6✔
NEW
25
                log.Printf("Failed to marshal task data for type %s: %v", taskType, err)
×
NEW
26
                return err
×
NEW
27
        }
×
28

29
        result := db.Exec(
6✔
30
                "INSERT INTO background_tasks (task_type, data) VALUES (?, ?)",
6✔
31
                taskType, string(jsonData),
6✔
32
        )
6✔
33

6✔
34
        if result.Error != nil {
7✔
35
                log.Printf("Failed to queue task type %s: %v", taskType, result.Error)
1✔
36
                return result.Error
1✔
37
        }
1✔
38

39
        return nil
5✔
40
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc