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

Freegle / iznik-server-go / f7a12ccd-31a0-4a5f-bd00-987b7256b963

09 Feb 2026 09:29PM UTC coverage: 79.527%. First build
f7a12ccd-31a0-4a5f-bd00-987b7256b963

Pull #17

circleci

edwh
fix: Add email_queue table creation to test setup

The emailqueue tests need the email_queue table to exist in the test
database. This was missing when all feature branches were merged
together, causing TestQueueEmail_Basic to fail with table not found.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Pull Request #17: feat: Add invitation endpoint (GET, PUT, PATCH)

2479 of 2939 new or added lines in 25 files covered. (84.35%)

9886 of 12431 relevant lines covered (79.53%)

13.94 hits per line

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

66.67
/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
        // TaskEmailDonateExternal sends a notification email to info@ilovefreegle.org when an external donation is recorded.
19
        TaskEmailDonateExternal = "email_donate_external"
20

21
        // TaskEmailInvitation sends an invitation email to a new user on behalf of an existing user.
22
        TaskEmailInvitation = "email_invitation"
23

24
        // TaskEmailForgotPassword sends a password reset email with auto-login link.
25
        TaskEmailForgotPassword = "email_forgot_password"
26

27
        // TaskEmailUnsubscribe sends an unsubscribe confirmation email with auto-login link.
28
        TaskEmailUnsubscribe = "email_unsubscribe"
29
)
30

31
// QueueTask inserts a task into the background_tasks table for async processing by iznik-batch.
32
func QueueTask(taskType string, data map[string]interface{}) error {
16✔
33
        db := database.DBConn
16✔
34

16✔
35
        jsonData, err := json.Marshal(data)
16✔
36
        if err != nil {
16✔
NEW
37
                log.Printf("Failed to marshal task data for type %s: %v", taskType, err)
×
NEW
38
                return err
×
NEW
39
        }
×
40

41
        result := db.Exec(
16✔
42
                "INSERT INTO background_tasks (task_type, data) VALUES (?, ?)",
16✔
43
                taskType, string(jsonData),
16✔
44
        )
16✔
45

16✔
46
        if result.Error != nil {
16✔
NEW
47
                log.Printf("Failed to queue task type %s: %v", taskType, result.Error)
×
NEW
48
                return result.Error
×
NEW
49
        }
×
50

51
        return nil
16✔
52
}
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