Skip to content

Commit

Permalink
forge-read-topic-review-requests: Offer organization teams
Browse files Browse the repository at this point in the history
Record organization teams for each repository.  The duplicated data
is tiny and it is simpler this way.  Only use it when reading actors
to request a review from, because topics cannot be assigned to teams.

Re #304.
  • Loading branch information
tarsius committed Jan 9, 2025
1 parent e5a2901 commit 7cdf978
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
8 changes: 7 additions & 1 deletion lisp/forge-db.el
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
(object-class :initform 'forge-repository)
(file :initform 'forge-database-file)
(schemata :initform 'forge--db-table-schemata)
(version :initform 13)))
(version :initform 14)))

(defvar forge--override-connection-class nil)

Expand Down Expand Up @@ -122,6 +122,7 @@
(milestones :default eieio-unbound)
issues-until
pullreqs-until
teams
])

(assignee
Expand Down Expand Up @@ -534,6 +535,11 @@
id))
(closql--db-set-version db (setq version 13))
(message "Upgrading Forge database from version 12 to 13...done"))
(when (= version 13)
(message "Upgrading Forge database from version 13 to 14...")
(emacsql db [:alter-table repository :add-column teams :default nil])
(closql--db-set-version db (setq version 14))
(message "Upgrading Forge database from version 13 to 14...done"))
)
(cl-call-next-method)))

Expand Down
3 changes: 2 additions & 1 deletion lisp/forge-github.el
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,8 @@
(oset repo issues-p .hasIssuesEnabled)
(oset repo wiki-p .hasWikiEnabled)
(oset repo stars .stargazers.totalCount)
(oset repo watchers .watchers.totalCount)))
(oset repo watchers .watchers.totalCount)
(oset repo teams (mapcar #'cdar .owner.teams))))

(cl-defmethod forge--update-revnotes ((repo forge-github-repository) data)
(closql-with-transaction (forge-db)
Expand Down
3 changes: 2 additions & 1 deletion lisp/forge-repo.el
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@
(worktree :initform nil)
(milestones :closql-table milestone)
(issues-until :initform nil)
(pullreqs-until :initform nil))
(pullreqs-until :initform nil)
(teams :initform nil))
:abstract t)

(defclass forge-unusedapi-repository (forge-repository) () :abstract t)
Expand Down
3 changes: 2 additions & 1 deletion lisp/forge-topic.el
Original file line number Diff line number Diff line change
Expand Up @@ -752,7 +752,8 @@ can be selected from the start."
(defun forge-read-topic-review-requests (&optional topic)
(let* ((repo (forge-get-repository (or topic :tracked)))
(value (and topic (oref topic review-requests)))
(choices (mapcar #'cadr (oref repo assignees)))
(choices (nconc (mapcar #'cadr (oref repo assignees))
(oref repo teams)))
(crm-separator ","))
(magit-completing-read-multiple
"Request review from: " choices nil
Expand Down

0 comments on commit 7cdf978

Please sign in to comment.