Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
X
xxdk-wasm
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
elixxir
xxdk-wasm
Commits
7b208c2e
Commit
7b208c2e
authored
2 years ago
by
Jono Wenger
Browse files
Options
Downloads
Plain Diff
Merge remote-tracking branch 'origin/release' into release
parents
0a418a71
59b98750
No related branches found
No related tags found
1 merge request
!67
fix for latest client release
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
indexedDb/impl/dm/implementation.go
+10
-2
10 additions, 2 deletions
indexedDb/impl/dm/implementation.go
with
10 additions
and
2 deletions
indexedDb/impl/dm/implementation.go
+
10
−
2
View file @
7b208c2e
...
@@ -10,6 +10,7 @@
...
@@ -10,6 +10,7 @@
package
main
package
main
import
(
import
(
"bytes"
"crypto/ed25519"
"crypto/ed25519"
"encoding/json"
"encoding/json"
"strings"
"strings"
...
@@ -42,7 +43,7 @@ type wasmModel struct {
...
@@ -42,7 +43,7 @@ type wasmModel struct {
// upsertConversation is used for joining or updating a Conversation.
// upsertConversation is used for joining or updating a Conversation.
func
(
w
*
wasmModel
)
upsertConversation
(
nickname
string
,
func
(
w
*
wasmModel
)
upsertConversation
(
nickname
string
,
pubKey
ed25519
.
PublicKey
,
dmToken
uint32
,
codeset
uint8
,
blocked
bool
)
error
{
pubKey
ed25519
.
PublicKey
,
dmToken
uint32
,
codeset
uint8
,
blocked
bool
)
error
{
parentErr
:=
errors
.
New
(
"failed to upsertConversation"
)
parentErr
:=
errors
.
New
(
"
[DM indexedDB]
failed to upsertConversation"
)
// Build object
// Build object
newConvo
:=
Conversation
{
newConvo
:=
Conversation
{
...
@@ -231,6 +232,8 @@ func (w *wasmModel) receiveWrapper(messageID message.ID, parentID *message.ID, n
...
@@ -231,6 +232,8 @@ func (w *wasmModel) receiveWrapper(messageID message.ID, parentID *message.ID, n
return
0
,
err
return
0
,
err
}
else
{
}
else
{
// If there is no extant Conversation, create one.
// If there is no extant Conversation, create one.
jww
.
DEBUG
.
Printf
(
"[DM indexedDB] Joining conversation with %s"
,
nickname
)
err
=
w
.
upsertConversation
(
nickname
,
partnerKey
,
dmToken
,
err
=
w
.
upsertConversation
(
nickname
,
partnerKey
,
dmToken
,
codeset
,
false
)
codeset
,
false
)
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -243,7 +246,12 @@ func (w *wasmModel) receiveWrapper(messageID message.ID, parentID *message.ID, n
...
@@ -243,7 +246,12 @@ func (w *wasmModel) receiveWrapper(messageID message.ID, parentID *message.ID, n
"[DM indexedDB] Conversation with %s already joined"
,
nickname
)
"[DM indexedDB] Conversation with %s already joined"
,
nickname
)
// Update Conversation if nickname was altered
// Update Conversation if nickname was altered
if
result
.
Nickname
!=
nickname
{
isFromPartner
:=
bytes
.
Equal
(
result
.
Pubkey
,
senderKey
)
nicknameChanged
:=
result
.
Nickname
!=
nickname
if
isFromPartner
&&
nicknameChanged
{
jww
.
DEBUG
.
Printf
(
"[DM indexedDB] Updating from nickname %s to %s"
,
result
.
Nickname
,
nickname
)
err
=
w
.
upsertConversation
(
nickname
,
result
.
Pubkey
,
result
.
Token
,
err
=
w
.
upsertConversation
(
nickname
,
result
.
Pubkey
,
result
.
Token
,
result
.
CodesetVersion
,
result
.
Blocked
)
result
.
CodesetVersion
,
result
.
Blocked
)
if
err
!=
nil
{
if
err
!=
nil
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment