mirror of https://github.com/gophish/gophish
Fixed double insertion of results when worker handles campaign (looks like a bug in gorm)
Removed handy abbreviation due to latest commit in gorm (this is why we can't have nice things :smile)pull/24/head
parent
25cbaf92ce
commit
851ba9de30
|
@ -89,7 +89,8 @@ func PostCampaign(c *Campaign, uid int64) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func UpdateCampaignStatus(c *Campaign, s string) error {
|
func UpdateCampaignStatus(c *Campaign, s string) error {
|
||||||
return db.Model(c).UpdateColumn("status", s).Error
|
// This could be made simpler, but I think there's a bug in gorm
|
||||||
|
return db.Debug().Table("campaigns").Where("id=?", c.Id).Update("status", s).Error
|
||||||
}
|
}
|
||||||
|
|
||||||
//DeleteCampaign deletes the specified campaign
|
//DeleteCampaign deletes the specified campaign
|
||||||
|
|
|
@ -189,6 +189,6 @@ func insertTargetIntoGroup(t Target, gid int64) error {
|
||||||
|
|
||||||
func GetTargets(gid int64) ([]Target, error) {
|
func GetTargets(gid int64) ([]Target, error) {
|
||||||
ts := []Target{}
|
ts := []Target{}
|
||||||
err := db.Table("targets t").Select("t.id, t.email").Joins("left join group_targets gt ON t.id = gt.target_id").Where("gt.group_id=?", gid).Scan(&ts).Error
|
err := db.Table("targets").Select("targets.id, targets.email").Joins("left join group_targets gt ON targets.id = gt.target_id").Where("gt.group_id=?", gid).Scan(&ts).Error
|
||||||
return ts, err
|
return ts, err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue