Skip to content

Commit

Permalink
fix: environment webhooks shows current date, not created date (#2555)
Browse files Browse the repository at this point in the history
Co-authored-by: Ben Rometsch <[email protected]>
  • Loading branch information
matthewelwell and dabeeeenster authored Aug 1, 2023
1 parent f526bdc commit 94fb957
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Generated by Django 3.2.20 on 2023-08-01 09:14

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('organisations', '0042_alter_subscription_payment_method'),
]

operations = [
migrations.AddField(
model_name='organisationwebhook',
name='created_at',
field=models.DateTimeField(blank=True, null=True),
),
migrations.AddField(
model_name='organisationwebhook',
name='updated_at',
field=models.DateTimeField(blank=True, null=True),
),
migrations.AlterField(
model_name='organisationwebhook',
name='created_at',
field=models.DateTimeField(auto_now_add=True, blank=True, null=True),
),
migrations.AlterField(
model_name='organisationwebhook',
name='updated_at',
field=models.DateTimeField(auto_now=True, blank=True, null=True),
)
]
2 changes: 2 additions & 0 deletions api/organisations/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,8 @@ class OrganisationWebhook(AbstractBaseExportableWebhookModel):
organisation = models.ForeignKey(
Organisation, on_delete=models.CASCADE, related_name="webhooks"
)
created_at = models.DateTimeField(null=True, auto_now_add=True)
updated_at = models.DateTimeField(null=True, auto_now=True)

class Meta:
ordering = ("id",) # explicit ordering to prevent pagination warnings
Expand Down
2 changes: 1 addition & 1 deletion api/organisations/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ class PortalUrlSerializer(serializers.Serializer):
class OrganisationWebhookSerializer(serializers.ModelSerializer):
class Meta:
model = OrganisationWebhook
fields = ("id", "url", "enabled", "secret")
fields = ("id", "url", "enabled", "secret", "created_at", "updated_at")
read_only_fields = ("id",)


Expand Down
2 changes: 1 addition & 1 deletion frontend/web/components/pages/EnvironmentSettingsPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -791,7 +791,7 @@ const EnvironmentSettingsPage = class extends Component {
<Button theme='text'>{webhook.url}</Button>
<div className='list-item-footer faint'>
Created{' '}
{moment(webhook.created_date).format(
{moment(webhook.created_at).format(
'DD/MMM/YYYY',
)}
</div>
Expand Down
14 changes: 8 additions & 6 deletions frontend/web/components/pages/OrganisationSettingsPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -1248,12 +1248,14 @@ const OrganisationSettingsPage = class extends Component {
<Button theme='text'>
{webhook.url}
</Button>
<div className='list-item-footer faint'>
Created{' '}
{moment(webhook.created_date).format(
'DD/MMM/YYYY',
)}
</div>
{webhook.created_at ? (
<div className='list-item-footer faint'>
Created{' '}
{moment(webhook.created_at).format(
'DD/MMM/YYYY',
)}
</div>
) : null}
</div>
<Row>
<Switch checked={webhook.enabled} />
Expand Down

3 comments on commit 94fb957

@vercel
Copy link

@vercel vercel bot commented on 94fb957 Aug 1, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on 94fb957 Aug 1, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

docs – ./docs

docs-git-main-flagsmith.vercel.app
docs.flagsmith.com
docs-flagsmith.vercel.app
docs.bullet-train.io

@vercel
Copy link

@vercel vercel bot commented on 94fb957 Aug 1, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.