lightningrodlabs / we-tauri

Creating a group coherence with holochain apps
https://lightningrodlabs.org/we
Other
43 stars 4 forks source link

Add attachment drawer #15

Open guillemcordoba opened 2 years ago

guillemcordoba commented 2 years ago

Applet functions:

Imagine an event attaching a note:

Attaching a note


sequenceDiagram

EventsApplet->>We: get_all_attachment_types()
We->>NoteApplet: get_attachment_types()
We->>TheadApplet: get_attachment_types()
We-->>EventsApplet: note, thread
EventsApplet->>EventsApplet: choose_attachment(note)
EventsApplet->>EventsApplet: store attachment

Seeing the note that is attached to the event


sequenceDiagram

EventsApplet->>We: select_attachment_hash()
We->>EventsApplet: get_all_attachments_for(calendar_events_hash)
EventsApplet->>We: Vec<(DnaHash, AnyDhtHash)>
We->>NoteApplet: render(anyDhtHash)
attach
matthme commented 1 year ago

I was thinking how one could implement backlinking of attachments and I think it would be difficult with the approach above since the information of the linking is stored only in the "receiving" applet and it would seem cumbersome to add that information also to the originating applet. I came up with an alternative pattern but I remembered our discussion and I think this approach would probably have limitations on federation of attachments or at least make it more complicated:


sequenceDiagram

EventsApplet->>We UI (drawer): emit('record-selected', payload: { AnyDhtHash })
We UI (drawer)->>We attachment DNA: get_attachments_for_hash()
We attachment DNA->>We UI (drawer): Vec<(DnaHash, AnyDhtHash)>
We UI (drawer)->>We attachment DNA: attached_by_for_hash()<br>(backlinking)
We attachment DNA->>We UI (drawer): Vec<(DnaHash, AnyDhtHash)>
We UI (drawer)->>TheadApplet: render_entry(hash)
We UI (drawer)->>NoteApplet: render_entry(hash)
We UI (drawer)->>We attachment DNA: add_attachment_for_hash()
guillemcordoba commented 1 year ago

Mmm I think the information should be in the two applets, and they can handle that info in the way that they want... Why can't be the case with the original design?

guillemcordoba commented 1 year ago

With a general "we attachments dna" I'm also worried about migrations, read access control...

matthme commented 1 year ago

Continued over here: https://discord.com/channels/880213578366459955/890704247056924682/1047451916839419984