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
2152b118
Commit
2152b118
authored
1 year ago
by
Jake Taylor
Browse files
Options
Downloads
Patches
Plain Diff
refactored receiveWrapper logic
parent
1b742574
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
+18
-6
18 additions, 6 deletions
indexedDb/impl/dm/implementation.go
with
18 additions
and
6 deletions
indexedDb/impl/dm/implementation.go
+
18
−
6
View file @
2152b118
...
...
@@ -216,7 +216,10 @@ func (w *wasmModel) receiveWrapper(messageID message.ID, parentID *message.ID, n
data
string
,
partnerKey
,
senderKey
ed25519
.
PublicKey
,
dmToken
uint32
,
codeset
uint8
,
timestamp
time
.
Time
,
round
rounds
.
Round
,
mType
dm
.
MessageType
,
status
dm
.
Status
)
(
uint64
,
error
)
{
conversationUpdated
:=
false
// Keep track of whether a Conversation was altered
var
convoToUpdate
*
Conversation
// Determine whether Conversation needs to be created
result
,
err
:=
w
.
getConversation
(
partnerKey
)
if
err
!=
nil
{
if
!
strings
.
Contains
(
err
.
Error
(),
impl
.
ErrDoesNotExist
)
{
...
...
@@ -225,7 +228,13 @@ func (w *wasmModel) receiveWrapper(messageID message.ID, parentID *message.ID, n
// If there is no extant Conversation, create one.
jww
.
DEBUG
.
Printf
(
"[DM indexedDB] Joining conversation with %s"
,
nickname
)
conversationUpdated
=
true
convoToUpdate
=
&
Conversation
{
Pubkey
:
senderKey
,
Nickname
:
nickname
,
Token
:
dmToken
,
CodesetVersion
:
codeset
,
Blocked
:
false
,
}
}
}
else
{
jww
.
DEBUG
.
Printf
(
...
...
@@ -238,7 +247,8 @@ func (w *wasmModel) receiveWrapper(messageID message.ID, parentID *message.ID, n
jww
.
DEBUG
.
Printf
(
"[DM indexedDB] Updating from nickname %s to %s"
,
result
.
Nickname
,
nickname
)
conversationUpdated
=
true
convoToUpdate
=
result
convoToUpdate
.
Nickname
=
nickname
}
// Fix conversation if dmToken is altered
...
...
@@ -247,14 +257,16 @@ func (w *wasmModel) receiveWrapper(messageID message.ID, parentID *message.ID, n
jww
.
WARN
.
Printf
(
"[DM indexedDB] Updating from dmToken %d to %d"
,
result
.
Token
,
dmToken
)
conversationUpdated
=
true
convoToUpdate
=
result
convoToUpdate
.
Token
=
dmToken
}
}
// Update the conversation in storage, if needed
conversationUpdated
:=
convoToUpdate
!=
nil
if
conversationUpdated
{
err
=
w
.
upsertConversation
(
nickname
,
result
.
Pubkey
,
result
.
Token
,
result
.
CodesetVersion
,
result
.
Blocked
)
err
=
w
.
upsertConversation
(
convoToUpdate
.
Nickname
,
convoToUpdate
.
Pubkey
,
convoToUpdate
.
Token
,
convoToUpdate
.
CodesetVersion
,
convoToUpdate
.
Blocked
)
if
err
!=
nil
{
return
0
,
err
}
...
...
This diff is collapsed.
Click to expand it.
Richard T. Carback III
@carback1
·
1 year ago
Maintainer
Alright thats reasonable, LGTM
Alright thats reasonable, LGTM
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