Beispiel #1
0
    def post(self, task_id, comment_id):
        is_movie = self.get_arguments()

        task = tasks_service.get_task(task_id)
        if not permissions.has_manager_permissions():
            user_service.check_assigned(task_id)

        comment = tasks_service.get_comment(comment_id)
        task_status = tasks_service.get_task_status(comment.task_status_id)
        person = persons_service.get_current_user()

        if not task_status["is_reviewable"]:
            return {
                "error":
                "Comment status is not reviewable, you cannot link a "
                "preview to it."
            }, 400

        revision = tasks_service.get_next_preview_revision(task_id)
        preview = files_service.create_preview_file(task["name"], revision,
                                                    task["id"], person["id"],
                                                    is_movie)
        comment.update({"preview_file_id": preview["id"]})
        events.emit("preview:add", {
            "comment_id": comment_id,
            "task_id": task_id,
            "preview": preview
        })

        return preview, 201
Beispiel #2
0
    def post(self, task_id, comment_id):
        is_movie = self.get_arguments()

        task = tasks_service.get_task(task_id)
        user_service.check_project_access(task["project_id"])

        comment = tasks_service.get_comment_raw(comment_id)
        task_status = tasks_service.get_task_status(
            comment.task_status_id
        )
        person = persons_service.get_current_user()

        if not task_status["is_reviewable"]:
            return {
                "error": "Comment status is not reviewable, you cannot link a "
                         "preview to it."
            }, 400

        revision = tasks_service.get_next_preview_revision(task_id)
        preview = files_service.create_preview_file(
            task["name"],
            revision,
            task["id"],
            person["id"],
            is_movie
        )
        comment.update({"preview_file_id": preview["id"]})

        return preview, 201