Rename key name from 'reason' to 'registration_decline_reason'

Currently whenever Foundation admins decline a vendor registration
request.  A key/value pair will be added to the vendor properties field
with the key name as 'reason'.  Since the key/value data will be shown
as-is in the response from the 'v1/vendors/{vendor_id} API call. This
patch renames the key name to a more descriptive one.

Change-Id: I6a43f7671a61a05bb2f0186dc52031eb6760eb59
This commit is contained in:
Catherine Diep 2016-11-16 14:33:02 -08:00
parent 0d494be2f9
commit 717c7b036a
3 changed files with 10 additions and 8 deletions

View File

@ -33,9 +33,9 @@
</div> </div>
<div class="row"> <div class="row">
<div ng-if="ctrl.vendorProperties.reason"> <div ng-if="ctrl.vendorProperties.registration_decline_reason">
<hr /> <hr />
<strong>Decline reason:</strong> {{ctrl.vendorProperties.reason}}<br /> <strong>Registration decline reason:</strong> {{ctrl.vendorProperties.registration_decline_reason}}<br />
</div> </div>
</div> </div>
@ -65,10 +65,10 @@
</tr> </tr>
</tbody> </tbody>
</table> </table>
<div class="row form-group"> <div class="row form-group">
<div class="col-md-6"> <div class="col-md-6">
<label for="new_user">Add user to vendor:</label> <label for="new_user">Add user to vendor:</label>
<input type="text" <input type="text"
class="form-control" class="form-control"
id="new_user" id="new_user"

View File

@ -112,7 +112,8 @@
confirmModal('Please input decline reason', function(reason) { confirmModal('Please input decline reason', function(reason) {
var url = [refstackApiUrl, '/vendors/', ctrl.vendorId, var url = [refstackApiUrl, '/vendors/', ctrl.vendorId,
'/action'].join(''); '/action'].join('');
$http.post(url, {deny: null, reason: reason}).success( var content = {deny: null, registration_decline_reason: reason};
$http.post(url, content).success(
function() { function() {
ctrl.getVendor(); ctrl.getVendor();
}).error(function(error) { }).error(function(error) {

View File

@ -224,7 +224,7 @@ class VendorsController(validation.BaseRestControllerWithValidation):
elif 'cancel' in params: elif 'cancel' in params:
self.cancel(vendor) self.cancel(vendor)
else: else:
self.deny(vendor, kw.get('reason')) self.deny(vendor, kw.get('registration_decline_reason'))
def register(self, vendor): def register(self, vendor):
"""Handler for applying for registration with Foundation.""" """Handler for applying for registration with Foundation."""
@ -290,14 +290,15 @@ class VendorsController(validation.BaseRestControllerWithValidation):
_check_is_not_foundation(vendor['id']) _check_is_not_foundation(vendor['id'])
if not reason: if not reason:
raise api_exc.ValidationError('Param "reason" can not be empty') raise api_exc.ValidationError(
'The decline reason can not be empty')
if vendor['type'] != const.PENDING_VENDOR: if vendor['type'] != const.PENDING_VENDOR:
raise api_exc.ValidationError( raise api_exc.ValidationError(
'Invalid organization state for this action.') 'Invalid organization state for this action.')
props = vendor.get('properties') props = vendor.get('properties')
props = json.loads(props) if props else {} props = json.loads(props) if props else {}
props['reason'] = reason props['registration_decline_reason'] = reason
# change vendor type back to private # change vendor type back to private
org_info = { org_info = {