)]}'
{"openstack_dashboard/static/app/core/openstack-service-api/policy.service.js":[{"author":{"_account_id":7665,"name":"Travis Tripp","email":"os.travis.tripp@gmail.com","username":"travis.tripp"},"change_message_id":"b3aac09c44b23cfd155845b6335dbb913420d4ac","unresolved":false,"context_lines":[{"line_number":91,"context_line":"     * @description"},{"line_number":92,"context_line":"     * Wrapper function for check that returns a deferred promise."},{"line_number":93,"context_line":"     * Resolves if the response is allowed, rejects otherwise."},{"line_number":94,"context_line":"     */"},{"line_number":95,"context_line":"    function ifAllowed(policyRules) {"},{"line_number":96,"context_line":"      var deferred \u003d $q.defer();"},{"line_number":97,"context_line":"      service.check(policyRules).then(function success(response) {"}],"source_content_type":"text/javascript","patch_set":2,"id":"da20952f_8ab913ef","line":94,"updated":"2015-09-02 05:11:10.000000000","message":"I bit more description here. How about something like:\n\n    /**\n     * @name ifAllowed\n     * @description\n     * Wrapper function for check that returns a deferred promise.\n     * Resolves if the response is allowed, rejects otherwise.\n     *\n     * The policyRules input is the same as the check function. Please\n     * refer to it for more information on the input.\n     *\n     * @example\n     *\n     * Assume if the users isn\u0027t allowed to delete an object,\n     * you will delete the object, otherwise, you will do something else.\n     *\n     ```js\n     policyService.ifAllowed(myRules).then(deleteObject, doSomethingElse);\n     ```","commit_id":"22581b3ee6e54f171993c3c20915846c018ed6d7"},{"author":{"_account_id":9576,"name":"Thai Tran","email":"tqtran@us.ibm.com","username":"tqtran"},"change_message_id":"13a86151e56905b734eb96680afb45cc648b0358","unresolved":false,"context_lines":[{"line_number":91,"context_line":"     * @description"},{"line_number":92,"context_line":"     * Wrapper function for check that returns a deferred promise."},{"line_number":93,"context_line":"     * Resolves if the response is allowed, rejects otherwise."},{"line_number":94,"context_line":"     */"},{"line_number":95,"context_line":"    function ifAllowed(policyRules) {"},{"line_number":96,"context_line":"      var deferred \u003d $q.defer();"},{"line_number":97,"context_line":"      service.check(policyRules).then(function success(response) {"}],"source_content_type":"text/javascript","patch_set":2,"id":"da20952f_9067eab6","line":94,"in_reply_to":"da20952f_8ab913ef","updated":"2015-09-02 16:42:02.000000000","message":"Done","commit_id":"22581b3ee6e54f171993c3c20915846c018ed6d7"},{"author":{"_account_id":7665,"name":"Travis Tripp","email":"os.travis.tripp@gmail.com","username":"travis.tripp"},"change_message_id":"b3aac09c44b23cfd155845b6335dbb913420d4ac","unresolved":false,"context_lines":[{"line_number":98,"context_line":"        if (response.data.allowed) { deferred.resolve(); }"},{"line_number":99,"context_line":"        else { deferred.reject(); }"},{"line_number":100,"context_line":"      });"},{"line_number":101,"context_line":"      return deferred.promise;"},{"line_number":102,"context_line":"    }"},{"line_number":103,"context_line":"  }"},{"line_number":104,"context_line":"}());"}],"source_content_type":"text/javascript","patch_set":2,"id":"da20952f_0ae74313","line":101,"updated":"2015-09-02 05:11:10.000000000","message":"I think the function would be easier to read if formatted like this:\n\n    function ifAllowed(policyRules) {\n      var deferred \u003d $q.defer();\n\n      service.check(policyRules).then(onResponse);\n\n      function onResponse(response) {\n        if (response.data.allowed) {\n          deferred.resolve();\n        } else {\n          deferred.reject();\n        }\n      }\n\n      return deferred.promise;\n    }","commit_id":"22581b3ee6e54f171993c3c20915846c018ed6d7"},{"author":{"_account_id":9576,"name":"Thai Tran","email":"tqtran@us.ibm.com","username":"tqtran"},"change_message_id":"13a86151e56905b734eb96680afb45cc648b0358","unresolved":false,"context_lines":[{"line_number":98,"context_line":"        if (response.data.allowed) { deferred.resolve(); }"},{"line_number":99,"context_line":"        else { deferred.reject(); }"},{"line_number":100,"context_line":"      });"},{"line_number":101,"context_line":"      return deferred.promise;"},{"line_number":102,"context_line":"    }"},{"line_number":103,"context_line":"  }"},{"line_number":104,"context_line":"}());"}],"source_content_type":"text/javascript","patch_set":2,"id":"da20952f_1012fa09","line":101,"in_reply_to":"da20952f_0ae74313","updated":"2015-09-02 16:42:02.000000000","message":"I\u0027ll move the success function out, but prefer to keep the if and else as one liners.","commit_id":"22581b3ee6e54f171993c3c20915846c018ed6d7"}]}
