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

Freegle / Iznik / 10785

07 May 2026 03:19PM UTC coverage: 72.851% (-0.06%) from 72.912%
10785

Pull #385

circleci

edwh
fix(compose): block submit when message is empty skeleton on all 4 wizard pages

After a successful post clearMessages() runs, but the next page mount
re-seeds an empty skeleton {type:'Offer'}. The four 'Freegle it!'
pages only checked login/email/postcode in canSubmit — messageValid
was imported but never wired in, so a logged-in user could fire with
no item or description (exactly what user 42537414 did 7 times in a row).

Extracts a makeCanSubmit() helper from useCompose.js that takes all
required refs explicitly. All four pages now use it; logged-in users
cannot submit an empty skeleton.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Pull Request #385: fix(compose): block submit when message is empty skeleton on all 4 wizard pages

13769 of 20714 branches covered (66.47%)

Branch coverage included in aggregate %.

23 of 23 new or added lines in 1 file covered. (100.0%)

233 existing lines in 7 files now uncovered.

98796 of 133800 relevant lines covered (73.84%)

22.91 hits per line

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

66.67
/iznik-server-go/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
        // TaskEmailCharitySignup sends a notification email to partnerships@ilovefreegle.org when a charity signs up.
19
        TaskEmailCharitySignup = "email_charity_signup"
20

21
        // TaskEmailDonateExternal sends a notification email to info@ilovefreegle.org when an external donation is recorded.
22
        TaskEmailDonateExternal = "email_donate_external"
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
        // TaskEmailMerge sends merge offer emails to both users involved in a merge.
31
        TaskEmailMerge = "email_merge"
32

33
        // TaskEmailVerify sends a verification email when a user adds a new email address.
34
        TaskEmailVerify = "email_verify"
35

36
        // TaskFreebieAlertsAdd notifies freebiealerts.app about a new Offer post.
37
        TaskFreebieAlertsAdd = "freebie_alerts_add"
38

39
        // TaskFreebieAlertsRemove removes a post from freebiealerts.app when it's taken/received.
40
        TaskFreebieAlertsRemove = "freebie_alerts_remove"
41

42
        // TaskRemapPostcodes triggers postcode-to-area remapping after a location geometry change.
43
        TaskRemapPostcodes = "remap_postcodes"
44

45
        // TaskUserForget immediately wipes a user's personal data (GDPR erasure).
46
        // Queued by admin/support DELETE /user; processed by iznik-batch UserManagementService::forgetUser().
47
        TaskUserForget = "user_forget"
48
)
49

50
// QueueTask inserts a task into the background_tasks table for async processing by iznik-batch.
51
func QueueTask(taskType string, data map[string]interface{}) error {
105✔
52
        db := database.DBConn
105✔
53

105✔
54
        jsonData, err := json.Marshal(data)
105✔
55
        if err != nil {
105✔
UNCOV
56
                log.Printf("Failed to marshal task data for type %s: %v", taskType, err)
×
UNCOV
57
                return err
×
UNCOV
58
        }
×
59

60
        result := db.Exec(
105✔
61
                "INSERT INTO background_tasks (task_type, data) VALUES (?, ?)",
105✔
62
                taskType, string(jsonData),
105✔
63
        )
105✔
64

105✔
65
        if result.Error != nil {
105✔
66
                log.Printf("Failed to queue task type %s: %v", taskType, result.Error)
×
67
                return result.Error
×
68
        }
×
69

70
        return nil
105✔
71
}
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