From f0a86b2de36ad3cc5714af91f1298f4209dac085 Mon Sep 17 00:00:00 2001 From: Logan Allen Date: Thu, 11 Feb 2021 18:42:46 -0600 Subject: [PATCH 1/7] contact-store: add timestamp to %edit --- pkg/arvo/app/contact-store.hoon | 4 +++- pkg/arvo/lib/contact-store.hoon | 2 ++ pkg/arvo/sur/contact-store.hoon | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/pkg/arvo/app/contact-store.hoon b/pkg/arvo/app/contact-store.hoon index 04909bf992..3ff7c3039b 100644 --- a/pkg/arvo/app/contact-store.hoon +++ b/pkg/arvo/app/contact-store.hoon @@ -132,10 +132,12 @@ state(rolodex (~(del by rolodex) ship)) :: ++ handle-edit - |= [=ship =edit-field:store] + |= [=ship =edit-field:store timestamp=date] |^ ^- (quip card _state) =/ old (~(got by rolodex) ship) + ?: (lth timestamp last-updated.old) + [~ state] =/ contact (edit-contact old edit-field) ?: =(old contact) [~ state] diff --git a/pkg/arvo/lib/contact-store.hoon b/pkg/arvo/lib/contact-store.hoon index b1c643b9e4..5f546d11f6 100644 --- a/pkg/arvo/lib/contact-store.hoon +++ b/pkg/arvo/lib/contact-store.hoon @@ -42,6 +42,7 @@ %- pairs :~ [%ship (ship ship.upd)] [%edit-field (edit edit-field.upd)] + [%timestamp (time timestamp.upd)] == :: %allow @@ -140,6 +141,7 @@ %- ot :~ [%ship (su ;~(pfix sig fed:ag))] [%edit-field edit] + [%timestamp di] == :: ++ beings diff --git a/pkg/arvo/sur/contact-store.hoon b/pkg/arvo/sur/contact-store.hoon index fb6e853303..5acfd823e6 100644 --- a/pkg/arvo/sur/contact-store.hoon +++ b/pkg/arvo/sur/contact-store.hoon @@ -32,7 +32,7 @@ $% [%initial =rolodex is-public=?] [%add =ship =contact] [%remove =ship] - [%edit =ship =edit-field] + [%edit =ship =edit-field timestamp=@da] [%allow =beings] [%disallow =beings] [%set-public public=?] From 1ddf9f5b84290fb5c93961ea6b05414962ff4c56 Mon Sep 17 00:00:00 2001 From: Logan Allen Date: Thu, 11 Feb 2021 18:47:36 -0600 Subject: [PATCH 2/7] contact-store: set last-updated appropriately and send last-updated in JS --- pkg/arvo/app/contact-store.hoon | 3 +-- pkg/interface/src/logic/api/contacts.ts | 3 ++- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/arvo/app/contact-store.hoon b/pkg/arvo/app/contact-store.hoon index 3ff7c3039b..8f26d409e7 100644 --- a/pkg/arvo/app/contact-store.hoon +++ b/pkg/arvo/app/contact-store.hoon @@ -117,7 +117,6 @@ !=(contact(last-updated *@da) u.old(last-updated *@da)) == [~ state] - =. last-updated.contact now.bowl :- (send-diff [%add ship contact] =(ship our.bowl)) state(rolodex (~(put by rolodex) ship contact)) :: @@ -141,7 +140,7 @@ =/ contact (edit-contact old edit-field) ?: =(old contact) [~ state] - =. last-updated.contact now.bowl + =. last-updated.contact timestamp :- (send-diff [%edit ship edit-field] =(ship our.bowl)) state(rolodex (~(put by rolodex) ship contact)) :: diff --git a/pkg/interface/src/logic/api/contacts.ts b/pkg/interface/src/logic/api/contacts.ts index 5bf0a659f6..ca1f0a338a 100644 --- a/pkg/interface/src/logic/api/contacts.ts +++ b/pkg/interface/src/logic/api/contacts.ts @@ -6,6 +6,7 @@ import { GroupPolicy, Resource } from '~/types/group-update'; export default class ContactsApi extends BaseApi { add(ship: Patp, contact: any) { + contact['last-updated'] = Date.now(); return this.storeAction({ add: { ship, contact } }); } @@ -25,11 +26,11 @@ export default class ContactsApi extends BaseApi { {add-group: {ship, name}} {remove-group: {ship, name}} */ - console.log(ship, editField); return this.storeAction({ edit: { ship, 'edit-field': editField, + timestamp: Date.now() }, }); } From 2d81eb5fdcf5c3eaa87a92865499ce33285e17b4 Mon Sep 17 00:00:00 2001 From: Logan Allen Date: Thu, 11 Feb 2021 18:52:26 -0600 Subject: [PATCH 3/7] contact-store: compiles --- pkg/arvo/app/contact-store.hoon | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/arvo/app/contact-store.hoon b/pkg/arvo/app/contact-store.hoon index 8f26d409e7..0d564af1dd 100644 --- a/pkg/arvo/app/contact-store.hoon +++ b/pkg/arvo/app/contact-store.hoon @@ -131,7 +131,7 @@ state(rolodex (~(del by rolodex) ship)) :: ++ handle-edit - |= [=ship =edit-field:store timestamp=date] + |= [=ship =edit-field:store timestamp=@da] |^ ^- (quip card _state) =/ old (~(got by rolodex) ship) @@ -141,7 +141,7 @@ ?: =(old contact) [~ state] =. last-updated.contact timestamp - :- (send-diff [%edit ship edit-field] =(ship our.bowl)) + :- (send-diff [%edit ship edit-field timestamp] =(ship our.bowl)) state(rolodex (~(put by rolodex) ship contact)) :: ++ edit-contact From eb082decf3ef172243c0afb2edd649f9b67f8cb7 Mon Sep 17 00:00:00 2001 From: Liam Fitzgerald Date: Fri, 12 Feb 2021 10:55:17 +1000 Subject: [PATCH 4/7] ImageInput: mark explicitly as type="button" --- pkg/interface/src/views/components/ImageInput.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/pkg/interface/src/views/components/ImageInput.tsx b/pkg/interface/src/views/components/ImageInput.tsx index d95851becf..d234462b13 100644 --- a/pkg/interface/src/views/components/ImageInput.tsx +++ b/pkg/interface/src/views/components/ImageInput.tsx @@ -65,6 +65,7 @@ export function ImageInput(props: ImageInputProps) { {canUpload && ( <>