mirror of
https://github.com/gophish/gophish
synced 2024-11-14 00:07:19 +00:00
Fix new records being added on completing a campaign (#2599)
There were new records with name '[Deleted]' being added when a campaign was completed. This used to happen when the resource associated with a campaign (template, page, profile) was deleted before marking the campaign as completed. The save gorm call used to upsert these values and ended up adding rogue records.
This commit is contained in:
parent
095a9ba20c
commit
cec2da5128
1 changed files with 2 additions and 1 deletions
|
@ -661,7 +661,8 @@ func CompleteCampaign(id int64, uid int64) error {
|
|||
// Mark the campaign as complete
|
||||
c.CompletedDate = time.Now().UTC()
|
||||
c.Status = CampaignComplete
|
||||
err = db.Where("id=? and user_id=?", id, uid).Save(&c).Error
|
||||
err = db.Model(&Campaign{}).Where("id=? and user_id=?", id, uid).
|
||||
Select([]string{"completed_date", "status"}).UpdateColumns(&c).Error
|
||||
if err != nil {
|
||||
log.Error(err)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue