From 10673417dcf5e27bb0a654dee3a2129f3fc2ebfc Mon Sep 17 00:00:00 2001
From: Unknwon <joe2010xtmf@163.com>
Date: Thu, 25 Sep 2014 22:42:31 -0400
Subject: [PATCH] Mirror fix on transfer repo

---
 conf/locale/locale_en-US.ini | 2 +-
 conf/locale/locale_zh-CN.ini | 2 +-
 models/action.go             | 7 +++++++
 3 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/conf/locale/locale_en-US.ini b/conf/locale/locale_en-US.ini
index 6595cbe41..5d9f22141 100644
--- a/conf/locale/locale_en-US.ini
+++ b/conf/locale/locale_en-US.ini
@@ -574,7 +574,7 @@ create_repo = created repository <a href="%s/%s">%s</a>
 commit_repo = pushed to <a href="%s/%s/src/%s">%s</a> at <a href="%s/%s">%s</a>
 create_issue = opened issue <a href="%s/%s/issues/%s">%s#%s</a>
 comment_issue = commented on issue <a href="%s/%s/issues/%s">%s#%s</a>
-transfer_repo = transfered repository <code>%s</code> to <a href="%s%s">%s</a>
+transfer_repo = transfered repository <code>%s</code> to <a href="/%s%s">%s</a>
 
 [tool]
 ago = ago
diff --git a/conf/locale/locale_zh-CN.ini b/conf/locale/locale_zh-CN.ini
index 9b337621a..b21fa5730 100644
--- a/conf/locale/locale_zh-CN.ini
+++ b/conf/locale/locale_zh-CN.ini
@@ -572,7 +572,7 @@ create_repo = 创建了仓库 <a href="%s/%s">%s</a>
 commit_repo = 推送了 <a href="%s/%s/src/%s">%s</a> 分支的代码到 <a href="%s/%s">%s</a>
 create_issue = 创建了工单 <a href="%s/%s/issues/%s">%s#%s</a>
 comment_issue = 评论了工单 <a href="%s/%s/issues/%s">%s#%s</a>
-transfer_repo = 将仓库 <code>%s</code> 转移至 <a href="%s%s">%s</a>
+transfer_repo = 将仓库 <code>%s</code> 转移至 <a href="/%s%s">%s</a>
 
 [tool]
 ago = 之前
diff --git a/models/action.go b/models/action.go
index 3fb33f939..9bd9da67c 100644
--- a/models/action.go
+++ b/models/action.go
@@ -366,6 +366,13 @@ func TransferRepoAction(u, newUser *User, repo *Repository) (err error) {
 		return err
 	}
 
+	// Remove watch for organization.
+	if repo.Owner.IsOrganization() {
+		if err = WatchRepo(repo.Owner.Id, repo.Id, false); err != nil {
+			log.Error(4, "WatchRepo", err)
+		}
+	}
+
 	log.Trace("action.TransferRepoAction: %s/%s", u.Name, repo.Name)
 	return err
 }