1
0
Fork 0

[DEV-3514] Display message explaining why quote is locked

Prior to this change, a single generic message was always shown simply
stating that the quote had been locked. These changes now allow for
different messages to be displayed in different circumstances.
master
Andrew Fanton 2019-05-22 11:09:12 -04:00
parent 5a5c2ca629
commit f569a7e94d
4 changed files with 16 additions and 9 deletions

View File

@ -2206,6 +2206,9 @@ module.exports = Class( 'Client' )
var client = this,
explicit_step = this._quote.getExplicitLockStep();
var lock_msg = this._quote.getExplicitLockReason() ||
"The quote is locked and cannot be modified.";
// if the step is locked to step 1, then there is no noticable effect;
// don't bother
if ( explicit_step == 1 )
@ -2222,9 +2225,7 @@ module.exports = Class( 'Client' )
{
client.ui.showNotifyBar(
$( '<div>' ).append(
$( '<div class="text">' ).html(
"The quote is locked and cannot be modified."
)
$( '<div class="text">' ).html( lock_msg )
)
);
}, 25 );

View File

@ -745,7 +745,7 @@ module.exports = Class( 'BaseQuote' )
'public getExplicitLockReason': function()
{
return ( this.isBound() )
? 'Quote has been bound'
? 'This quote has been bound and cannot be modified.'
: this._explicitLock;
},

View File

@ -737,7 +737,7 @@ module.exports = Class( 'Server' )
)
} ];
lock = 'concurrent-access';
lock = 'Quote is locked due to concurrent access.';
}
// decrypt bucket contents, if necessary, and return

View File

@ -27,6 +27,12 @@ const { BaseQuote } = require( '../../' ).quote;
const Program = require( '../../src/program/Program' ).Program;
const Util = require( '../../src/test/program/util' );
const messages = {
expire: 'This quote has expired and cannot be modified. ' +
'Please contact support with any questions.',
bound: 'This quote has been bound and cannot be modified.'
};
describe( 'BaseQuote', () =>
{
describe( 'accessors & mutators', () =>
@ -143,7 +149,7 @@ describe( 'BaseQuote', () =>
},
{
description: 'bound quote',
reason: { given: '', expected: 'Quote has been bound' },
reason: { given: '', expected: messages.bound },
step: 0,
bound: true,
imported: false,
@ -159,7 +165,7 @@ describe( 'BaseQuote', () =>
},
{
description: 'bound and imported quote',
reason: { given: '', expected: 'Quote has been bound' },
reason: { given: '', expected: messages.bound },
step: 0,
bound: true,
imported: true,
@ -167,7 +173,7 @@ describe( 'BaseQuote', () =>
},
{
description: 'bound quote with a lock on step #2',
reason: { given: '', expected: 'Quote has been bound' },
reason: { given: '', expected: messages.bound },
step: { given: 2, expected: 0 },
bound: true,
imported: false,
@ -218,7 +224,7 @@ describe( 'BaseQuote', () =>
expect( quote.isLocked() ).to.equal( locks );
quote.clearExplicitLock();
expect( quote.getExplicitLockReason() ).to.equal( bound ? 'Quote has been bound' : '' );
expect( quote.getExplicitLockReason() ).to.equal( bound ? messages.bound : '' );
expect( quote.getExplicitLockStep() ).to.equal( 0 );
} );
} );