Make sending references configurable

This commit is contained in:
Mark Veidemanis 2023-03-14 09:38:39 +00:00
parent dce33ca11c
commit a855e7e5b5
Signed by: m
GPG Key ID: 5ACFCEED46C0904F
4 changed files with 24 additions and 1 deletions

View File

@ -817,7 +817,8 @@ class LocalPlatformClient(ABC):
ad_obj = self.instance.get_ad(ad_id)
if ad_obj:
await self.send_bank_details(currency, trade_id, ad_obj)
await self.send_reference(trade_id, reference)
if ad_obj.send_reference is True:
await self.send_reference(trade_id, reference)
else:
log.warning(f"Could not get ad object for {ad_id}.")
# return

View File

@ -160,6 +160,7 @@ class AdForm(RestrictedFormMixin, ModelForm):
"platforms",
"aggregators",
"account_whitelist",
"send_reference",
"visible",
"enabled",
)
@ -175,6 +176,7 @@ class AdForm(RestrictedFormMixin, ModelForm):
"platforms": "Enabled platforms for this ad",
"aggregators": "Enabled aggregators for this ad",
"account_whitelist": "List of account IDs to use, one per line.",
"send_reference": "Whether or not to send the reference on new trades.",
"visible": "Whether or not this ad is visible.",
"enabled": "Whether or not this ad is enabled.",
}

View File

@ -0,0 +1,18 @@
# Generated by Django 4.1.7 on 2023-03-14 09:36
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0023_alter_trade_linked'),
]
operations = [
migrations.AddField(
model_name='ad',
name='send_reference',
field=models.BooleanField(default=True),
),
]

View File

@ -403,6 +403,8 @@ class Ad(models.Model):
account_map = models.JSONField(default=dict)
account_whitelist = models.TextField(null=True, blank=True)
send_reference = models.BooleanField(default=True)
visible = models.BooleanField(default=True)
enabled = models.BooleanField(default=True)