Use length variable, Comment deprecation of GetOnion
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/pr Build is failing Details

This commit is contained in:
Sarah Jamie Lewis 2021-11-01 14:09:46 -07:00
parent ead6a2698f
commit c62ecd6f71
3 changed files with 7 additions and 4 deletions

View File

@ -143,10 +143,10 @@ func (g *Group) GetMessage(index int) (bool, Message, int) {
length := len(g.Timeline.Messages) length := len(g.Timeline.Messages)
if len(g.Timeline.Messages) > index { if length > index {
return true, g.Timeline.Messages[index], length return true, g.Timeline.Messages[index], length
} }
return false, Message{}, len(g.Timeline.Messages) return false, Message{}, length
} }
// AddMessage takes a DecryptedGroupMessage and adds it to the Groups Timeline // AddMessage takes a DecryptedGroupMessage and adds it to the Groups Timeline

View File

@ -249,6 +249,9 @@ type CwtchPeer interface {
StartServerConnections() StartServerConnections()
Shutdown() Shutdown()
// GetOnion is deprecated. If you find yourself needing to rely on this method it is time
// to consider replacing this with a GetAddress(es) function that can fully expand cwtch beyond the boundaries
// of tor v3 onion services.
// Deprecated // Deprecated
GetOnion() string GetOnion() string

View File

@ -108,7 +108,7 @@ func TestProfileStoreChangePassword(t *testing.T) {
event.TimestampReceived: time.Now().Format(time.RFC3339Nano), event.TimestampReceived: time.Now().Format(time.RFC3339Nano),
event.RemotePeer: profile.Onion, event.RemotePeer: profile.Onion,
event.Data: testMessage, event.Data: testMessage,
event.Signature: base64.StdEncoding.EncodeToString([]byte{byte(i)}), event.Signature: base64.StdEncoding.EncodeToString([]byte{byte(i)}),
})) }))
} }
@ -131,7 +131,7 @@ func TestProfileStoreChangePassword(t *testing.T) {
event.TimestampReceived: time.Now().Format(time.RFC3339Nano), event.TimestampReceived: time.Now().Format(time.RFC3339Nano),
event.RemotePeer: profile.Onion, event.RemotePeer: profile.Onion,
event.Data: testMessage, event.Data: testMessage,
event.Signature: base64.StdEncoding.EncodeToString([]byte{0x01, byte(i)}), event.Signature: base64.StdEncoding.EncodeToString([]byte{0x01, byte(i)}),
})) }))
} }
time.Sleep(3 * time.Second) time.Sleep(3 * time.Second)