(self, issue: Dict)
| 93 | self.add_task_to_queue(self.feed_issue, issue=issue) |
| 94 | |
| 95 | def feed_issue(self, issue: Dict): |
| 96 | updated_at = dateutil.parser.parse(issue["updated_at"]) |
| 97 | if self._is_prior_to_last_index_time(doc_time=updated_at): |
| 98 | logger.info(f"Issue {issue['id']} is too old, skipping") |
| 99 | return |
| 100 | |
| 101 | comments_url = \ |
| 102 | f"{self.gitlab_config.url}/api/v4/projects/{issue['project_id']}/issues/{issue['iid']}/notes?sort=asc" |
| 103 | raw_comments = self._get_all_paginated(comments_url) |
| 104 | comments = [] |
| 105 | issue_url = issue['web_url'] |
| 106 | |
| 107 | for raw_comment in raw_comments: |
| 108 | if raw_comment["system"]: |
| 109 | continue |
| 110 | |
| 111 | comments.append(BasicDocument( |
| 112 | id=raw_comment["id"], |
| 113 | data_source_id=self._data_source_id, |
| 114 | type=DocumentType.COMMENT, |
| 115 | title=raw_comment["author"]["name"], |
| 116 | content=raw_comment["body"], |
| 117 | author=raw_comment["author"]["name"], |
| 118 | author_image_url=raw_comment["author"]["avatar_url"], |
| 119 | location=issue['references']['full'].replace("/", " / "), |
| 120 | url=issue_url, |
| 121 | timestamp=dateutil.parser.parse(raw_comment["updated_at"]) |
| 122 | )) |
| 123 | |
| 124 | status = gitlab_status_to_doc_status(issue["state"]) |
| 125 | is_active = status == DocumentStatus.OPEN |
| 126 | doc = BasicDocument( |
| 127 | id=issue["id"], |
| 128 | data_source_id=self._data_source_id, |
| 129 | type=DocumentType.ISSUE, |
| 130 | title=issue['title'], |
| 131 | content=issue.get("description") or "", |
| 132 | author=issue['author']['name'], |
| 133 | author_image_url=issue['author']['avatar_url'], |
| 134 | location=issue['references']['full'].replace("/", " / "), |
| 135 | url=issue['web_url'], |
| 136 | timestamp=updated_at, |
| 137 | status=issue["state"], |
| 138 | is_active=is_active, |
| 139 | children=comments |
| 140 | ) |
| 141 | IndexQueue.get_instance().put_single(doc=doc) |
nothing calls this directly
no test coverage detected