Revert "verificationhelper: add callback for when other user reports done"
Some checks are pending
Go / Lint (latest) (push) Waiting to run
Go / Build (old, libolm) (push) Waiting to run
Go / Build (latest, libolm) (push) Waiting to run
Go / Build (old, goolm) (push) Waiting to run
Go / Build (latest, goolm) (push) Waiting to run

This reverts commit 363fdfa3b2.
This commit is contained in:
Sumner Evans 2024-11-19 16:09:18 -07:00
commit d575cc79ef
No known key found for this signature in database
5 changed files with 0 additions and 23 deletions

View file

@ -25,7 +25,6 @@ type baseVerificationCallbacks struct {
verificationsRequested map[id.UserID][]id.VerificationTransactionID
qrCodesShown map[id.VerificationTransactionID]*verificationhelper.QRCode
qrCodesScanned map[id.VerificationTransactionID]struct{}
otherDoneTransactions map[id.VerificationTransactionID]struct{}
doneTransactions map[id.VerificationTransactionID]struct{}
verificationCancellation map[id.VerificationTransactionID]*event.VerificationCancelEventContent
emojisShown map[id.VerificationTransactionID][]rune
@ -37,7 +36,6 @@ func newBaseVerificationCallbacks() *baseVerificationCallbacks {
verificationsRequested: map[id.UserID][]id.VerificationTransactionID{},
qrCodesShown: map[id.VerificationTransactionID]*verificationhelper.QRCode{},
qrCodesScanned: map[id.VerificationTransactionID]struct{}{},
otherDoneTransactions: map[id.VerificationTransactionID]struct{}{},
doneTransactions: map[id.VerificationTransactionID]struct{}{},
verificationCancellation: map[id.VerificationTransactionID]*event.VerificationCancelEventContent{},
emojisShown: map[id.VerificationTransactionID][]rune{},
@ -62,11 +60,6 @@ func (c *baseVerificationCallbacks) WasOurQRCodeScanned(txnID id.VerificationTra
return ok
}
func (c *baseVerificationCallbacks) OtherReportedDone(txnID id.VerificationTransactionID) bool {
_, ok := c.otherDoneTransactions[txnID]
return ok
}
func (c *baseVerificationCallbacks) IsVerificationDone(txnID id.VerificationTransactionID) bool {
_, ok := c.doneTransactions[txnID]
return ok
@ -95,10 +88,6 @@ func (c *baseVerificationCallbacks) VerificationCancelled(ctx context.Context, t
}
}
func (c *baseVerificationCallbacks) OtherReportsDone(ctx context.Context, txnID id.VerificationTransactionID) {
c.otherDoneTransactions[txnID] = struct{}{}
}
func (c *baseVerificationCallbacks) VerificationDone(ctx context.Context, txnID id.VerificationTransactionID) {
c.doneTransactions[txnID] = struct{}{}
}

View file

@ -115,10 +115,6 @@ type RequiredCallbacks interface {
// VerificationCancelled is called when the verification is cancelled.
VerificationCancelled(ctx context.Context, txnID id.VerificationTransactionID, code event.VerificationCancelCode, reason string)
// OtherReportsDone is called when the other user has reported that the
// verification is done.
OtherReportsDone(ctx context.Context, txnID id.VerificationTransactionID)
// VerificationDone is called when the verification is done.
VerificationDone(ctx context.Context, txnID id.VerificationTransactionID)
}
@ -156,7 +152,6 @@ type VerificationHelper struct {
supportedMethods []event.VerificationMethod
verificationRequested func(ctx context.Context, txnID id.VerificationTransactionID, from id.UserID)
verificationCancelledCallback func(ctx context.Context, txnID id.VerificationTransactionID, code event.VerificationCancelCode, reason string)
otherReportsDone func(ctx context.Context, txnID id.VerificationTransactionID)
verificationDone func(ctx context.Context, txnID id.VerificationTransactionID)
showSAS func(ctx context.Context, txnID id.VerificationTransactionID, emojis []rune, decimals []int)
@ -184,7 +179,6 @@ func NewVerificationHelper(client *mautrix.Client, mach *crypto.OlmMachine, call
} else {
helper.verificationRequested = c.VerificationRequested
helper.verificationCancelledCallback = c.VerificationCancelled
helper.otherReportsDone = c.OtherReportsDone
helper.verificationDone = c.VerificationDone
}
@ -886,7 +880,6 @@ func (vh *VerificationHelper) onVerificationDone(ctx context.Context, txn *verif
}
txn.ReceivedTheirDone = true
vh.otherReportsDone(ctx, txn.TransactionID)
if txn.SentOurDone {
delete(vh.activeTransactions, txn.TransactionID)
vh.verificationDone(ctx, txn.TransactionID)

View file

@ -99,7 +99,6 @@ func TestCrossSignVerification_ScanQRAndConfirmScan(t *testing.T) {
assert.Equal(t, txnID, doneEvt.TransactionID)
ts.dispatchToDevice(t, ctx, sendingClient)
assert.True(t, sendingCallbacks.OtherReportedDone(txnID))
} else { // receiving scans QR
// Emulate scanning the QR code shown by the sending device on
// the receiving device.
@ -138,7 +137,6 @@ func TestCrossSignVerification_ScanQRAndConfirmScan(t *testing.T) {
assert.Equal(t, txnID, doneEvt.TransactionID)
ts.dispatchToDevice(t, ctx, receivingClient)
assert.True(t, receivingCallbacks.OtherReportedDone(txnID))
}
// Ensure that both devices have marked the verification as done.

View file

@ -200,7 +200,6 @@ func TestSelfVerification_ScanQRAndConfirmScan(t *testing.T) {
assert.Equal(t, txnID, doneEvt.TransactionID)
ts.dispatchToDevice(t, ctx, sendingClient)
assert.True(t, sendingCallbacks.OtherReportedDone(txnID))
} else { // receiving scans QR
// Emulate scanning the QR code shown by the sending device on
// the receiving device.
@ -239,7 +238,6 @@ func TestSelfVerification_ScanQRAndConfirmScan(t *testing.T) {
assert.Equal(t, txnID, doneEvt.TransactionID)
ts.dispatchToDevice(t, ctx, receivingClient)
assert.True(t, receivingCallbacks.OtherReportedDone(txnID))
}
// Ensure that both devices have marked the verification as done.

View file

@ -269,7 +269,6 @@ func TestVerification_SAS(t *testing.T) {
// twice to process and drain all of the events.
ts.dispatchToDevice(t, ctx, sendingClient)
ts.dispatchToDevice(t, ctx, receivingClient)
assert.True(t, receivingCallbacks.OtherReportedDone(txnID))
ts.dispatchToDevice(t, ctx, sendingClient)
ts.dispatchToDevice(t, ctx, receivingClient)
assert.True(t, sendingCallbacks.IsVerificationDone(txnID))