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
|
||||
}
|
||||
|
||||
if isCampaignalMutable(cm.Status) {
|
||||
if !canEditCampaign(cm.Status) {
|
||||
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
|
||||
}
|
||||
|
||||
// isCampaignalMutable tells if a campaign's in a state where it's
|
||||
// properties can be mutated.
|
||||
func isCampaignalMutable(status string) bool {
|
||||
return status == models.CampaignStatusRunning ||
|
||||
status == models.CampaignStatusCancelled ||
|
||||
status == models.CampaignStatusFinished
|
||||
// canEditCampaign returns true if a campaign is in a status where updating
|
||||
// its properties is allowed.
|
||||
func canEditCampaign(status string) bool {
|
||||
return status == models.CampaignStatusDraft ||
|
||||
status == models.CampaignStatusPaused ||
|
||||
status == models.CampaignStatusScheduled
|
||||
}
|
||||
|
||||
// makeOptinCampaignMessage makes a default opt-in campaign message body.
|
||||
|
|
|
@ -613,7 +613,7 @@ export default Vue.extend({
|
|||
|
||||
canEdit() {
|
||||
return this.isNew
|
||||
|| this.data.status === 'draft' || this.data.status === 'scheduled';
|
||||
|| this.data.status === 'draft' || this.data.status === 'scheduled' || this.data.status === 'paused';
|
||||
},
|
||||
|
||||
canSchedule() {
|
||||
|
@ -625,7 +625,7 @@ export default Vue.extend({
|
|||
},
|
||||
|
||||
canStart() {
|
||||
return this.data.status === 'draft' && !this.data.sendAt;
|
||||
return this.data.status === 'draft' || this.data.status === 'paused';
|
||||
},
|
||||
|
||||
canArchive() {
|
||||
|
|
Loading…
Reference in a new issue