def create_comment(object_id, task_status_id, person_id, text, object_type="Task", files={}, checklist=[]): """ Create a new comment for given object (by default, it considers this object as a Task). """ comment = Comment.create( object_id=object_id, object_type=object_type, task_status_id=task_status_id, person_id=person_id, mentions=get_comment_mentions(object_id, text), checklist=checklist, text=text, ) comment = comment.serialize(relations=True) if "file" in files: uploaded_file = files["file"] attachment_file = create_attachment(comment, uploaded_file) comment["attachment_files"] = [attachment_file] events.emit("comment:new", {"comment_id": comment["id"]}) return comment
def create_comment(object_id, task_status_id, person_id, text, object_type="Task"): comment = Comment.create(object_id=object_id, object_type=object_type, task_status_id=task_status_id, person_id=person_id, text=text) return comment.serialize()
def new_comment( task_id, task_status_id, person_id, text, object_type="Task", files={}, checklist=[], created_at="", ): """ Create a new comment for given object (by default, it considers this object as a Task). """ created_at_date = None task = tasks_service.get_task(task_id) if created_at is not None and len(created_at) > 0: try: created_at_date = fields.get_date_object( created_at, date_format="%Y-%m-%d %H:%M:%S") except ValueError: pass comment = Comment.create( object_id=task_id, object_type=object_type, task_status_id=task_status_id, person_id=person_id, mentions=get_comment_mentions(task_id, text), checklist=checklist, text=text, created_at=created_at_date, ) comment = comment.serialize(relations=True) comment["attachment_files"] = [] for uploaded_file in files.values(): attachment_file = create_attachment(comment, uploaded_file) comment["attachment_files"].append(attachment_file) events.emit( "comment:new", { "comment_id": comment["id"], "task_id": task_id }, project_id=task["project_id"], ) return comment
def create_comment( object_id, task_status_id, person_id, text, object_type="Task" ): """ Create a new comment for given object (by default, it considers this object as a Task). """ comment = Comment.create( object_id=object_id, object_type=object_type, task_status_id=task_status_id, person_id=person_id, mentions=get_comment_mentions(object_id, text), text=text, ) events.emit("comment:new", {"comment_id": comment.id}) return comment.serialize(relations=True)
def create_comment( object_id, task_status_id, person_id, text, object_type="Task" ): """ Create a new comment for given object (by default, it considers this object as a Task). """ comment = Comment.create( object_id=object_id, object_type=object_type, task_status_id=task_status_id, person_id=person_id, text=text ) return comment.serialize()