feat: free edit and publish/unpublish toggle for paid listings within 30-day period

This commit is contained in:
2026-02-08 10:07:47 +01:00
parent c66b77dbf8
commit e7c73f85b9
12 changed files with 152 additions and 24 deletions

View File

@@ -2,6 +2,7 @@ import { t, i18n } from '../../i18n.js'
import { router } from '../../router.js'
import { auth } from '../../services/auth.js'
import { directus } from '../../services/directus.js'
import { listingsService } from '../../services/listings.js'
import { categoriesService } from '../../services/categories.js'
import { SUPPORTED_CURRENCIES, getDisplayCurrency } from '../../services/currency.js'
import { createInvoice, openCheckout, getPendingInvoice, savePendingInvoice, clearPendingInvoice, getInvoiceStatus } from '../../services/btcpay.js'
@@ -17,6 +18,7 @@ class PageCreate extends HTMLElement {
super()
this.editMode = false
this.editId = null
this.editListing = null
this.existingImages = []
this.formData = this.loadDraft() || this.getEmptyFormData()
this.imageFiles = []
@@ -102,6 +104,8 @@ class PageCreate extends HTMLElement {
return
}
this.editListing = listing
this.formData = {
title: listing.title || '',
description: listing.description || '',
@@ -606,6 +610,12 @@ class PageCreate extends HTMLElement {
}
}
if (this.editListing && !listingsService.isPaidAndActive(this.editListing)) {
await directus.updateListing(this.editId, listingData)
await this.startPayment(this.editId, formElements.currency)
return
}
await directus.updateListing(this.editId, listingData)
router.navigate(`/listing/${this.editId}`)
} else {