From a742ee543ef3faf6374625c9c6d065c0a46b5549 Mon Sep 17 00:00:00 2001
From: Unknown <joe2010xtmf@163.com>
Date: Thu, 8 May 2014 17:17:45 -0400
Subject: Add change assignee back end

---
 models/issue.go | 12 ++++++++++++
 1 file changed, 12 insertions(+)

(limited to 'models')

diff --git a/models/issue.go b/models/issue.go
index 525e75f2c3..a84fb0541e 100644
--- a/models/issue.go
+++ b/models/issue.go
@@ -338,6 +338,18 @@ func UpdateIssueUserPairsByStatus(iid int64, isClosed bool) error {
 	return err
 }
 
+// UpdateIssueUserPairByAssignee updates issue-user pair for assigning.
+func UpdateIssueUserPairByAssignee(aid, iid int64) error {
+	rawSql := "UPDATE `issue_user` SET is_assigned = ? WHERE issue_id = ?"
+	if _, err := orm.Exec(rawSql, false, iid); err != nil {
+		return err
+	}
+
+	rawSql = "UPDATE `issue_user` SET is_assigned = true WHERE uid = ? AND issue_id = ?"
+	_, err := orm.Exec(rawSql, true, aid, iid)
+	return err
+}
+
 // UpdateIssueUserPairByRead updates issue-user pair for reading.
 func UpdateIssueUserPairByRead(uid, iid int64) error {
 	rawSql := "UPDATE `issue_user` SET is_read = ? WHERE uid = ? AND issue_id = ?"
-- 
cgit v1.2.3