mirror of
https://github.com/knadh/listmonk.git
synced 2025-03-01 00:35:28 +08:00
Make paused campaigns editable.
This commit is contained in:
parent
5ba0adcb0b
commit
3d383cd537
2 changed files with 9 additions and 9 deletions
|
@ -248,7 +248,7 @@ func handleUpdateCampaign(c echo.Context) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if isCampaignalMutable(cm.Status) {
|
if !canEditCampaign(cm.Status) {
|
||||||
return echo.NewHTTPError(http.StatusBadRequest, app.i18n.T("campaigns.cantUpdate"))
|
return echo.NewHTTPError(http.StatusBadRequest, app.i18n.T("campaigns.cantUpdate"))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -597,12 +597,12 @@ func validateCampaignFields(c campaignReq, app *App) (campaignReq, error) {
|
||||||
return c, nil
|
return c, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// isCampaignalMutable tells if a campaign's in a state where it's
|
// canEditCampaign returns true if a campaign is in a status where updating
|
||||||
// properties can be mutated.
|
// its properties is allowed.
|
||||||
func isCampaignalMutable(status string) bool {
|
func canEditCampaign(status string) bool {
|
||||||
return status == models.CampaignStatusRunning ||
|
return status == models.CampaignStatusDraft ||
|
||||||
status == models.CampaignStatusCancelled ||
|
status == models.CampaignStatusPaused ||
|
||||||
status == models.CampaignStatusFinished
|
status == models.CampaignStatusScheduled
|
||||||
}
|
}
|
||||||
|
|
||||||
// makeOptinCampaignMessage makes a default opt-in campaign message body.
|
// makeOptinCampaignMessage makes a default opt-in campaign message body.
|
||||||
|
|
|
@ -613,7 +613,7 @@ export default Vue.extend({
|
||||||
|
|
||||||
canEdit() {
|
canEdit() {
|
||||||
return this.isNew
|
return this.isNew
|
||||||
|| this.data.status === 'draft' || this.data.status === 'scheduled';
|
|| this.data.status === 'draft' || this.data.status === 'scheduled' || this.data.status === 'paused';
|
||||||
},
|
},
|
||||||
|
|
||||||
canSchedule() {
|
canSchedule() {
|
||||||
|
@ -625,7 +625,7 @@ export default Vue.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
canStart() {
|
canStart() {
|
||||||
return this.data.status === 'draft' && !this.data.sendAt;
|
return this.data.status === 'draft' || this.data.status === 'paused';
|
||||||
},
|
},
|
||||||
|
|
||||||
canArchive() {
|
canArchive() {
|
||||||
|
|
Loading…
Reference in a new issue