16
20
Fork 16

Allow Peers to Store History #316

Zusammengeführt
dan hat 1 Commits von peer_history nach master 2020-07-08 22:32:48 +00:00 zusammengeführt
Besitzer
Keine Beschreibung angegeben.
dan wurde von sarah 2020-07-08 18:30:53 +00:00 zugewiesen
Mitglied
Drone Build Status: success https://build.openprivacy.ca/cwtch.im/cwtch/769
Mitglied
Drone Build Status: success https://build.openprivacy.ca/cwtch.im/cwtch/771
dan hat 2020-07-08 19:52:58 +00:00 Änderungen angefragt
@ -258,6 +260,10 @@ func (ps *ProfileStoreV1) load() error {
contact.Authorization = model.AuthApproved
}
}
Besitzer

like above, prolly better to check at load if the attribute is set or not and set it accordingly instead of the double initializer for it you have in the event handler below. Also since this is a required attribute, should also be added to cwtchPeer.AddContact, line 194 has the attributes being initialized.

then we can create a stream store only where needed, then the event handler can just reach for the stream store and if there is one, use it, if not, not use it, simplifying that code a bunch in the event handler

BUT it does mean then doing processing of the SavePeerHistory event and creating or deleting stream stores there.
but that's actually good as right now we don't capture that, so we never delete history when its changed? which means when someone turns it off, the existing history sits there, forever being loaded, but never updated, which isn't great, so that event does need handling regardless

also prolly want a ps.save after the loop to capture and save any new defaults added

like above, prolly better to check at load if the attribute is set or not and set it accordingly instead of the double initializer for it you have in the event handler below. Also since this is a required attribute, should also be added to cwtchPeer.AddContact, line 194 has the attributes being initialized. then we can create a stream store only where needed, then the event handler can just reach for the stream store and if there is one, use it, if not, not use it, simplifying that code a bunch in the event handler BUT it does mean then doing processing of the SavePeerHistory event and creating or deleting stream stores there. but that's actually good as right now we don't capture that, so we never delete history when its changed? which means when someone turns it off, the existing history sits there, forever being loaded, but never updated, which isn't great, so that event does need handling regardless also prolly want a ps.save after the loop to capture and save any new defaults added
@ -346,0 +368,4 @@
ss.Write(message)
}
}
case event.DontSaveHistoryDefault:
Besitzer

very rust of you? :P
but we can just have hte one empty default

very rust of you? :P but we can just have hte one empty default
@ -346,0 +376,4 @@
}
}
}
ps.save()
Besitzer

shouldn't need this if we aren't setting a default here

shouldn't need this if we aren't setting a default here
@ -346,0 +382,4 @@
}
case event.NewMessageFromPeer:
contact, exists := ps.profile.GetContact(ev.Data[event.RemotePeer])
if exists {
Besitzer

also this is copy/pasted, should be pulled out into a function instead

also this is copy/pasted, should be pulled out into a function instead
sarah hat ein Review von dan 2020-07-08 20:26:56 +00:00 angefragt
Mitglied
Drone Build Status: success https://build.openprivacy.ca/cwtch.im/cwtch/773
Mitglied
Drone Build Status: failure https://build.openprivacy.ca/cwtch.im/cwtch/775
sarah hat den Titel von WIP: Allow Peers to Store History zu Allow Peers to Store History 2020-07-08 21:33:08 +00:00 geändert
Mitglied
Drone Build Status: success https://build.openprivacy.ca/cwtch.im/cwtch/777
dan hat Commit 2c13feb71e in master 2020-07-08 22:32:48 +00:00 gemerged
Anmelden, um an der Diskussion teilzunehmen.
Keine Reviewer
dan
Kein Meilenstein
Niemand zuständig
3 Beteiligte
Nachrichten
Fällig am
Das Fälligkeitsdatum ist ungültig oder außerhalb des zulässigen Bereichs. Bitte verwende das Format „jjjj-mm-tt“.

Kein Fälligkeitsdatum gesetzt.

Abhängigkeiten

Keine Abhängigkeiten gesetzt.

Referenz: cwtch.im/cwtch#316
Keine Beschreibung angegeben.