示例#1
0
    def validate(self, comment):
        messages = []
        annotations = comment.annotations()
        
        if 'update_review' in annotations:
            cc = CodeCollabClient()
            user = cc.get_current_user()
            author = cc.get_review_author(annotations['update_review'])
            if user != author:
                messages.append("You are not the author of review %s.  Please ensure you have the correct review id for @update_review." % annotations['update_review'])
                
            status = cc.get_review_status(annotations['update_review'])
            if status == 'Completed':
                messages.append("The review specified (%s) is already Complete.  Create a new review with @reviewers" % annotations['update_review'])

        return messages