From 03c9e8221109502abf6b204f629d33ac14e909a5 Mon Sep 17 00:00:00 2001 From: Michael Mayer Date: Thu, 23 Sep 2021 15:38:55 +0200 Subject: [PATCH] Albums: Fix share expiration date in field label #621 Looks like a pure frontend issue: It tried finding a date in "UpdatedAt" while the actual field name is "ModifiedAt". --- frontend/src/model/link.js | 4 ++-- frontend/tests/unit/model/link_test.js | 4 ++-- internal/entity/link.go | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/frontend/src/model/link.js b/frontend/src/model/link.js index ccb6ae407..263972485 100644 --- a/frontend/src/model/link.js +++ b/frontend/src/model/link.js @@ -107,9 +107,9 @@ export default class Link extends Model { } expires() { - return DateTime.fromISO(this.UpdatedAt) + return DateTime.fromISO(this.ModifiedAt) .plus({ seconds: this.Expires }) - .toLocaleString(DateTime.DATE_SHORT); + .toLocaleString(DateTime.DATE_MED); } static getCollectionResource() { diff --git a/frontend/tests/unit/model/link_test.js b/frontend/tests/unit/model/link_test.js index bbefd1d54..81b84b145 100644 --- a/frontend/tests/unit/model/link_test.js +++ b/frontend/tests/unit/model/link_test.js @@ -79,11 +79,11 @@ describe("model/link", () => { Slug: "friends", Share: "family", Expires: 80000, - UpdatedAt: "2012-07-08T14:45:39Z", + ModifiedAt: "2012-07-08T14:45:39Z", }; const link = new Link(values); const result = link.expires(); - assert.equal(result, "7/9/2012"); + assert.equal(result, "Jul 9, 2012"); }); it("should get collection resource", () => { diff --git a/internal/entity/link.go b/internal/entity/link.go index 8b234b198..17eae9c6b 100644 --- a/internal/entity/link.go +++ b/internal/entity/link.go @@ -26,7 +26,7 @@ type Link struct { CanComment bool `json:"CanComment" yaml:"CanComment,omitempty"` CanEdit bool `json:"CanEdit" yaml:"CanEdit,omitempty"` CreatedAt time.Time `deepcopier:"skip" json:"CreatedAt" yaml:"CreatedAt"` - ModifiedAt time.Time `deepcopier:"skip" yaml:"ModifiedAt"` + ModifiedAt time.Time `deepcopier:"skip" json:"ModifiedAt" yaml:"ModifiedAt"` } // BeforeCreate creates a random UID if needed before inserting a new row to the database.