Beispiel #1
0
 def link_to_parent_comment(self, comment, vsts_data, thread_id, graph):
     '''
     link to parent comment
     '''
     parent_id = vsts_data.get("parentCommentId", "0")
     if parent_id == 0:
         return
     else:
         parent = list(Comment.select(graph, thread_id))
         parent_comment = {}
         if parent:
             comment.ParentComment.add(parent[0])
         else:
             parent_comment = Comment()
             parent_comment.Id = comment.get_id(parent_id, thread_id)
             comment.ParentComment.add(parent_comment)
Beispiel #2
0
    def make_comment_node(self, vsts_data, thread_id, graph, url):
        '''
        make a node so we can link things to and later save
        '''
        raw_id = vsts_data.get('id')
        if raw_id is None:
            print("comment was not added id could not be generated")
            return None

        comment = Comment.select(graph, raw_id).first()
        if comment is None:
            comment = Comment()
        comment.Id = comment.get_id(raw_id, thread_id)
        if "commentType" in vsts_data:
            comment.CommentType = vsts_data.get("commentType", "")
        comment.Content = vsts_data.get("content", "")
        comment.LastContentUpdatedDate = vsts_data.get("lastContentUpdatedDate", "")
        comment.LastUpdatedDate = vsts_data.get("lastUpdatedDate", "")
        comment.PublishedDate = vsts_data.get("publishedDate", "")
        comment.Url = url
        return comment