Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions config/sync_settings.production.toml
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ notion_tasks_team = "Team"
notion_tasks_milestone_relation = "Milestones"
notion_tasks_text_assignee = "Text Assignee (Desktop)"
notion_tasks_labels = "Keywords (Desktop)"
notion_tasks_target_milestone = "Target Milestone"
notion_tasks_whiteboard = "Whiteboard (Desktop)"
notion_tasks_repository = ""
notion_tasks_review_url = "Patch URL"
Expand Down
5 changes: 3 additions & 2 deletions mzla_notion/sync/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ def __init__(
self._setup_prop(tasks_properties, "notion_tasks_text_assignee", "rich_text_space_set")
self._setup_prop(tasks_properties, "notion_tasks_repository", "select", unknown="skip")
self._setup_prop(tasks_properties, "notion_tasks_labels", "multi_select", unknown="skip")

self._setup_prop(tasks_properties, "notion_tasks_target_milestone", "rich_text")
self._setup_prop(tasks_properties, "notion_tasks_whiteboard", "rich_text")
self._setup_date_prop(tasks_properties, "notion_tasks_dates")
self._setup_date_prop(tasks_properties, "notion_tasks_openclose")
Expand Down Expand Up @@ -402,9 +402,10 @@ async def _get_task_notion_data(self, tracker_issue, parent_milestone_pages=None
reviewers = [user.notion_user for user in tracker_issue.reviewers if user.notion_user is not None]
self._set_if_prop(notion_data, "notion_tasks_reviewers", reviewers)

# Labels and Whiteboard
# Labels and Whiteboard and Target Milestone
self._set_if_prop(notion_data, "notion_tasks_labels", tracker_issue.labels or [])
self._set_if_prop(notion_data, "notion_tasks_whiteboard", tracker_issue.whiteboard)
self._set_if_prop(notion_data, "notion_tasks_target_milestone", tracker_issue.target_milestone)

# Repository
repomap = self.propnames.get("notion_tasks_repository_map") or {}
Expand Down
3 changes: 2 additions & 1 deletion mzla_notion/tracker/bugzilla.py
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ def _set_if(data, prop, bzname):
async def _get_bugzilla_bugs(self, bugids, sub_issues=False):
issues = {}
review_urls = {}
fields = "id,summary,status,resolution,product,cf_user_story,assigned_to,priority,cf_fx_points,depends_on,blocks,attachments,comments,see_also,creation_time,cf_last_resolved,keywords,whiteboard"
fields = "id,summary,status,resolution,product,cf_user_story,assigned_to,priority,cf_fx_points,depends_on,blocks,attachments,comments,see_also,creation_time,cf_last_resolved,keywords,whiteboard,target_milestone"

response = await self.client.get("/bug", params={"id": ",".join(bugids), "include_fields": fields})
response_json = response.json()
Expand Down Expand Up @@ -364,6 +364,7 @@ async def _get_bugzilla_bugs(self, bugids, sub_issues=False):
state=status,
labels=labels,
whiteboard=bug["whiteboard"] or "",
target_milestone=bug["target_milestone"] if bug["target_milestone"] != "---" else None,
description=bug["cf_user_story"] or getnestedattr(lambda: bug["comments"][0]["text"], ""),
assignees={User(self.user_map, tracker_user=assignee)} if assignee else set(),
priority=bug["priority"] if bug["priority"] != "--" else None,
Expand Down
2 changes: 2 additions & 0 deletions mzla_notion/tracker/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ class Issue(IssueRef):
sprint: Sprint = None
sub_issues: list = field(default_factory=list)
whiteboard: str = ""
target_milestone: str = ""
requested_ref: IssueRef = None


Expand Down Expand Up @@ -103,6 +104,7 @@ class IssueTracker:
"notion_tasks_reviewers": "", # Default is disabled
"notion_tasks_labels": "", # Default is disabled
"notion_tasks_whiteboard": "", # Default is disabled
"notion_tasks_target_milestone": "", # Default is disabled
"notion_tasks_repository": "", # Default is disabled
"notion_tasks_openclose": "", # Default is disabled
"notion_milestones_team": "", # Default is disabled
Expand Down
85 changes: 43 additions & 42 deletions test/fixtures/bugzilla/bug1849476.json
Original file line number Diff line number Diff line change
@@ -1,44 +1,45 @@
{
"assigned_to" : "user1@example.com",
"assigned_to_detail" : {
"email" : "user1@example.com",
"id" : 550104,
"name" : "user1@example.com",
"nick" : "TbSync",
"real_name" : "John Bieling (:TbSync)"
},
"attachments" : [
{
"attacher" : "user1@example.com",
"bug_id" : 1849476,
"content_type" : "text/x-phabricator-request",
"creation_time" : "2025-02-05T09:23:43Z",
"creator" : "user1@example.com",
"creator_detail" : {},
"data" : "aHR0cHM6Ly9waGFicmljYXRvci5zZXJ2aWNlcy5tb3ppbGxhLmNvbS9EMjM2ODM2",
"description" : "Bug 1849476 - Make messages.move/copy() set mail.last_msg_movecopy_* preferences. r=#thunderbird-reviewers",
"file_name" : "phabricator-D236836-url.txt",
"flags" : [],
"id" : 9463983,
"is_obsolete" : 0,
"is_patch" : 0,
"is_private" : 0,
"last_change_time" : "2025-02-05T09:25:02Z",
"size" : 48,
"summary" : "Bug 1849476 - Make messages.move/copy() set mail.last_msg_movecopy_* preferences. r=#thunderbird-reviewers"
}
],
"blocks" : [],
"cf_last_resolved" : "2025-02-06T10:18:39Z",
"cf_user_story" : "",
"creation_time" : "2023-08-19T18:40:32Z",
"depends_on" : [],
"id" : 1849476,
"priority" : "--",
"see_also" : [],
"status" : "RESOLVED",
"resolution": "FIXED",
"keywords": [],
"whiteboard": "",
"summary" : "messages.move/copy() doesn't set mail.last_msg_movecopy_target_uri"
"assigned_to": "user1@example.com",
"assigned_to_detail": {
"email": "user1@example.com",
"id": 550104,
"name": "user1@example.com",
"nick": "TbSync",
"real_name": "John Bieling (:TbSync)"
},
"attachments": [
{
"attacher": "user1@example.com",
"bug_id": 1849476,
"content_type": "text/x-phabricator-request",
"creation_time": "2025-02-05T09:23:43Z",
"creator": "user1@example.com",
"creator_detail": {},
"data": "aHR0cHM6Ly9waGFicmljYXRvci5zZXJ2aWNlcy5tb3ppbGxhLmNvbS9EMjM2ODM2",
"description": "Bug 1849476 - Make messages.move/copy() set mail.last_msg_movecopy_* preferences. r=#thunderbird-reviewers",
"file_name": "phabricator-D236836-url.txt",
"flags": [],
"id": 9463983,
"is_obsolete": 0,
"is_patch": 0,
"is_private": 0,
"last_change_time": "2025-02-05T09:25:02Z",
"size": 48,
"summary": "Bug 1849476 - Make messages.move/copy() set mail.last_msg_movecopy_* preferences. r=#thunderbird-reviewers"
}
],
"blocks": [],
"cf_last_resolved": "2025-02-06T10:18:39Z",
"cf_user_story": "",
"creation_time": "2023-08-19T18:40:32Z",
"depends_on": [],
"id": 1849476,
"priority": "--",
"see_also": [],
"status": "RESOLVED",
"resolution": "FIXED",
"keywords": [],
"whiteboard": "",
"target_milestone": "---",
"summary": "messages.move/copy() doesn't set mail.last_msg_movecopy_target_uri"
}
9 changes: 3 additions & 6 deletions test/fixtures/bugzilla/bug1944850.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,8 @@
"cf_last_resolved": null,
"creation_time": "2025-01-30T13:59:24Z",
"assigned_to": "nobody@mozilla.org",
"blocks": [
1944847
],
"depends_on": [
1944885
],
"blocks": [1944847],
"depends_on": [1944885],
"id": 1944850,
"see_also": [],
"priority": "--",
Expand All @@ -36,6 +32,7 @@
"attachments": [],
"keywords": [],
"whiteboard": "",
"target_milestone": "---",
"assigned_to_detail": {
"nick": "nobody",
"id": 1,
Expand Down
5 changes: 2 additions & 3 deletions test/fixtures/bugzilla/bug1944885.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"summary": "Read Calendar Event - Acceptance Widget",
"keywords": [],
"whiteboard": "",
"target_milestone": "154 Branch",
"attachments": [
{
"file_name": "phabricator-D248065-url.txt",
Expand Down Expand Up @@ -91,7 +92,5 @@
"nick": "user1",
"email": "user1@example.com"
},
"blocks": [
1944850
]
"blocks": [1944850]
}
2 changes: 2 additions & 0 deletions test/test_project_bugzilla.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ async def test_bugzilla_get_issues_by_number(self):
self.assertEqual(issue.description, "Rebuild the Read Event dialog based on designs in blabla")
self.assertEqual(issue.assignees, set())
self.assertEqual(issue.priority, None)
self.assertEqual(issue.target_milestone, None)
self.assertEqual(issue.estimate, "")
self.assertEqual(issue.parents, [IssueRef(repo="bugzilla.dev", id="1944847")])
self.assertEqual(len(issue.sub_issues), 1)
Expand All @@ -153,6 +154,7 @@ async def test_bugzilla_get_issues_by_number(self):
self.assertEqual(issue.state, "IN REVIEW")
self.assertEqual(issue.review_url, "https://phabricator.services.mozilla.com/D248065")
self.assertEqual(issue.notion_url, "https://www.notion.so/mzthunderbird/b183c949289f4282864cd373cb8b2cb7")
self.assertEqual(issue.target_milestone, "154 Branch")
self.assertEqual(issue.estimate, "8")

async def test_bugzilla_get_issues_reviewers(self):
Expand Down