Skip to content

Commit

Permalink
Revert "automatically set category in OpenProject"
Browse files Browse the repository at this point in the history
This reverts commit fb83be2 b/c
we haven't heard back from this contributor wrt relicensing this
contribution under AGPLv3+.

Their previous contribution in 9bd3a6e
has been already removed in favor of my changes in
2458774.
  • Loading branch information
atodorov committed Jun 13, 2024
1 parent 78cb39f commit 0297db9
Showing 1 changed file with 0 additions and 26 deletions.
26 changes: 0 additions & 26 deletions trackers_integration/issuetracker/openproject.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,6 @@ def get_workpackage_types(self, project_id):
url = f"{self.base_url}/projects/{project_id}/types"
return self._request("GET", url, auth=self.auth)

def get_workpackage_categories(self, project_id):
url = f"{self.base_url}/projects/{project_id}/categories"
return self._request("GET", url, auth=self.auth)


class OpenProject(base.IssueTrackerType):
Expand Down Expand Up @@ -167,23 +164,6 @@ def get_workpackage_type(self, project_id, name):
except Exception as err:
raise RuntimeError("WorkPackage Type not found") from err

def get_workpackage_category(self, project_id, name):
"""
Return a WorkPackage category matching by name.
If there is no match then return None.
.. versionadded:: 12.6
"""
try:
categories = self.rpc.get_workpackage_categories(project_id)
for category in categories["_embedded"]["elements"]:
if category["name"].lower() == name.lower():
return category

return None
except Exception as err:
raise RuntimeError("WorkPackage Category not found") from err

def _report_issue(self, execution, user):
project = self.get_project_by_name(execution.build.version.product.name)
project_id = project["id"]
Expand All @@ -193,19 +173,13 @@ def _report_issue(self, execution, user):
project_id, getattr(settings, "OPENPROJECT_WORKPACKAGE_TYPE_NAME", "Bug")
)

category = self.get_workpackage_category(
project_id, execution.case.category.name
)

arguments = {
"subject": f"Failed test: {execution.case.summary}",
"description": {"raw": self._report_comment(execution, user)},
"_links": {
"type": _type["_links"]["self"],
},
}
if category:
arguments["_links"]["category"] = category["_links"]["self"]

new_issue = self.rpc.create_workpackage(project_id, arguments)
_id = new_issue["id"]
Expand Down

0 comments on commit 0297db9

Please sign in to comment.