+{{end}}
diff --git a/templates/repo/settings/slack_hook.tmpl b/templates/repo/settings/slack_hook.tmpl
new file mode 100644
index 0000000000..e68571a081
--- /dev/null
+++ b/templates/repo/settings/slack_hook.tmpl
@@ -0,0 +1,20 @@
+
+
+
From 72ec3e8da07be695a94935009077035c520ec142 Mon Sep 17 00:00:00 2001
From: fanningert
Date: Sun, 31 Aug 2014 18:03:28 +0200
Subject: [PATCH 009/153] Update locale_de-DE.ini
---
conf/locale/locale_de-DE.ini | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/conf/locale/locale_de-DE.ini b/conf/locale/locale_de-DE.ini
index 80b2245cd3..4a43bdba2c 100644
--- a/conf/locale/locale_de-DE.ini
+++ b/conf/locale/locale_de-DE.ini
@@ -245,7 +245,7 @@ people = Personen
invite_someone = Jemanden einladen
teams = Teams
lower_members = Mitglieder
-lower_Repositorys = Repositorys
+lower_Repositoryies = Repositorys
create_new_team = Neues Team erstellen
org_desc = Beschreibung
team_name = Teamname
@@ -297,7 +297,7 @@ teams.delete_team_success = Team gelöscht
teams.read_permission_desc = Dieses Team erlaubt Lesezugriff: Mitglieder können Team-Repositorys einsehen und klonen.
teams.write_permission_desc = Dieses Team erlaubt Schreibzugriff: Mitglieder können Team-Repositorys einsehen und hinein pushen.
teams.admin_permission_desc = Diese Team erlaubt Adminzugriff: Mitglieder dieses Teams können pullen, pushen und dem Team Mitarbeiter hinzufügen.
-teams.Repositorys = Team Repositorys
+teams.Repositories = Team Repositorys
teams.add_team_repository = Team-Repository hinzufügen
teams.remove_repo = Entfernen
@@ -305,7 +305,7 @@ teams.remove_repo = Entfernen
dashboard = Dashboard
users = Benutzer
organizations = Organisationen
-Repositorys = Repositorys
+Repositories = Repositorys
authentication = Authentifizierung
config = Konfiguration
monitor = Monitoring
From 99e009665c732ea524e24580964902cb7f99f736 Mon Sep 17 00:00:00 2001
From: fanningert
Date: Sun, 31 Aug 2014 18:04:15 +0200
Subject: [PATCH 010/153] Update locale_de-DE.ini
---
conf/locale/locale_de-DE.ini | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/conf/locale/locale_de-DE.ini b/conf/locale/locale_de-DE.ini
index 4a43bdba2c..a3ce7b3d19 100644
--- a/conf/locale/locale_de-DE.ini
+++ b/conf/locale/locale_de-DE.ini
@@ -245,7 +245,7 @@ people = Personen
invite_someone = Jemanden einladen
teams = Teams
lower_members = Mitglieder
-lower_Repositoryies = Repositorys
+lower_Repositories = Repositorys
create_new_team = Neues Team erstellen
org_desc = Beschreibung
team_name = Teamname
From 801fc536f2f4edf9b0381ea78833007c99fa30ca Mon Sep 17 00:00:00 2001
From: fanningert
Date: Sun, 31 Aug 2014 18:05:26 +0200
Subject: [PATCH 011/153] Update locale_de-DE.ini
---
conf/locale/locale_de-DE.ini | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/conf/locale/locale_de-DE.ini b/conf/locale/locale_de-DE.ini
index a3ce7b3d19..97ca5efd06 100644
--- a/conf/locale/locale_de-DE.ini
+++ b/conf/locale/locale_de-DE.ini
@@ -245,7 +245,7 @@ people = Personen
invite_someone = Jemanden einladen
teams = Teams
lower_members = Mitglieder
-lower_Repositories = Repositorys
+lower_repositories = Repositorys
create_new_team = Neues Team erstellen
org_desc = Beschreibung
team_name = Teamname
@@ -297,7 +297,7 @@ teams.delete_team_success = Team gelöscht
teams.read_permission_desc = Dieses Team erlaubt Lesezugriff: Mitglieder können Team-Repositorys einsehen und klonen.
teams.write_permission_desc = Dieses Team erlaubt Schreibzugriff: Mitglieder können Team-Repositorys einsehen und hinein pushen.
teams.admin_permission_desc = Diese Team erlaubt Adminzugriff: Mitglieder dieses Teams können pullen, pushen und dem Team Mitarbeiter hinzufügen.
-teams.Repositories = Team Repositorys
+teams.repositories = Team Repositorys
teams.add_team_repository = Team-Repository hinzufügen
teams.remove_repo = Entfernen
@@ -305,7 +305,7 @@ teams.remove_repo = Entfernen
dashboard = Dashboard
users = Benutzer
organizations = Organisationen
-Repositories = Repositorys
+repositories = Repositorys
authentication = Authentifizierung
config = Konfiguration
monitor = Monitoring
From 36661f53e6cb7bd5fe202157f794255d4d6932af Mon Sep 17 00:00:00 2001
From: Unknwon
Date: Mon, 1 Sep 2014 00:12:37 +0800
Subject: [PATCH 012/153] Update deps
---
modules/setting/setting_memcache.go | 2 +-
modules/setting/setting_redis.go | 4 ++--
public/ng/css/gogs.css | 1 +
public/ng/less/gogs/base.less | 1 +
4 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/modules/setting/setting_memcache.go b/modules/setting/setting_memcache.go
index e509f372d3..26b1cc6f60 100644
--- a/modules/setting/setting_memcache.go
+++ b/modules/setting/setting_memcache.go
@@ -7,7 +7,7 @@
package setting
import (
- _ "github.com/gogits/cache/memcache"
+ _ "github.com/macaron-contrib/cache/memcache"
)
func init() {
diff --git a/modules/setting/setting_redis.go b/modules/setting/setting_redis.go
index 78b31d534f..bfd1694de3 100644
--- a/modules/setting/setting_redis.go
+++ b/modules/setting/setting_redis.go
@@ -7,8 +7,8 @@
package setting
import (
- _ "github.com/gogits/cache/redis"
- _ "github.com/gogits/session/redis"
+ _ "github.com/macaron-contrib/cache/redis"
+ _ "github.com/macaron-contrib/session/redis"
)
func init() {
diff --git a/public/ng/css/gogs.css b/public/ng/css/gogs.css
index d81d6f3149..6ff68a5b28 100644
--- a/public/ng/css/gogs.css
+++ b/public/ng/css/gogs.css
@@ -1,6 +1,7 @@
html,
body {
height: 100%;
+ overflow-y: scroll;
}
.octicon,
.fa {
diff --git a/public/ng/less/gogs/base.less b/public/ng/less/gogs/base.less
index 241846dbbd..8a88450747 100644
--- a/public/ng/less/gogs/base.less
+++ b/public/ng/less/gogs/base.less
@@ -11,6 +11,7 @@
html,
body {
height: 100%;
+ overflow-y: scroll;
}
.octicon,
.fa {
From da8dba53a7e238e55e36d520716f9a06af7e8317 Mon Sep 17 00:00:00 2001
From: fanningert
Date: Sun, 31 Aug 2014 18:28:59 +0200
Subject: [PATCH 013/153] Removed not needed deps
Removed
* github.com/gogits/cache
* github.com/gogits/session
---
.gopmfile | 2 --
1 file changed, 2 deletions(-)
diff --git a/.gopmfile b/.gopmfile
index e06d0caaae..736205ae00 100644
--- a/.gopmfile
+++ b/.gopmfile
@@ -14,11 +14,9 @@ github.com/codegangsta/cli =
github.com/go-sql-driver/mysql =
github.com/go-xorm/core =
github.com/go-xorm/xorm =
-github.com/gogits/cache =
github.com/gogits/gfm =
github.com/gogits/git =
github.com/gogits/oauth2 =
-github.com/gogits/session =
github.com/juju2013/goldap =
github.com/johnweldon/asn1-ber =
github.com/lib/pq =
From c5ce33047e77b03b8d6e289d2b250e15c65ae3d2 Mon Sep 17 00:00:00 2001
From: Unknwon
Date: Mon, 1 Sep 2014 00:33:40 +0800
Subject: [PATCH 014/153] Mirror fix and hide missing pages for 0.5 release
---
conf/locale/locale_zh-CN.ini | 5 +++++
templates/repo/header.tmpl | 4 ++--
templates/repo/home.tmpl | 18 +++++++++---------
.../{gogs_hook.tmpl => hook_gogs.tmpl} | 2 +-
templates/repo/settings/hook_new.tmpl | 4 ++--
.../{slack_hook.tmpl => hook_slack.tmpl} | 2 +-
templates/repo/settings/nav.tmpl | 2 +-
templates/repo/sidebar.tmpl | 12 ++++++------
templates/user/dashboard/nav.tmpl | 10 ++++++----
9 files changed, 33 insertions(+), 26 deletions(-)
rename templates/repo/settings/{gogs_hook.tmpl => hook_gogs.tmpl} (97%)
rename templates/repo/settings/{slack_hook.tmpl => hook_slack.tmpl} (95%)
diff --git a/conf/locale/locale_zh-CN.ini b/conf/locale/locale_zh-CN.ini
index 21442539ab..55d22f23ee 100644
--- a/conf/locale/locale_zh-CN.ini
+++ b/conf/locale/locale_zh-CN.ini
@@ -234,6 +234,11 @@ settings.update_webhook = 更新 Web 钩子
settings.update_hook_success = Web 钩子更新成功!
settings.delete_webhook = 删除 Web 钩子
settings.recent_deliveries = 最近推送记录
+settings.hook_type = 钩子类型
+settings.add_slack_hook_desc = 为您的仓库增加 Slack 集成
+settings.slack_token = 令牌
+settings.slack_domain = 域名
+settings.slack_channel = 频道
[org]
org_name_holder = 组织名称
diff --git a/templates/repo/header.tmpl b/templates/repo/header.tmpl
index 6f3d4c66ca..3812508248 100644
--- a/templates/repo/header.tmpl
+++ b/templates/repo/header.tmpl
@@ -44,14 +44,14 @@
-
+
\ No newline at end of file
diff --git a/templates/repo/home.tmpl b/templates/repo/home.tmpl
index 42b8bdd4b1..0947308477 100644
--- a/templates/repo/home.tmpl
+++ b/templates/repo/home.tmpl
@@ -9,11 +9,11 @@
{{.Repository.Website}}
{{if .PageIsSettingsHooksEdit}}
diff --git a/templates/repo/settings/slack_hook.tmpl b/templates/repo/settings/hook_slack.tmpl
similarity index 95%
rename from templates/repo/settings/slack_hook.tmpl
rename to templates/repo/settings/hook_slack.tmpl
index e68571a081..50d28e2f5e 100644
--- a/templates/repo/settings/slack_hook.tmpl
+++ b/templates/repo/settings/hook_slack.tmpl
@@ -1,4 +1,4 @@
-
+
\ No newline at end of file
diff --git a/templates/repo/sidebar.tmpl b/templates/repo/sidebar.tmpl
index 39d999cabc..f671bfc1b1 100644
--- a/templates/repo/sidebar.tmpl
+++ b/templates/repo/sidebar.tmpl
@@ -3,23 +3,23 @@
{{else}}
From af0741da07ec190804fff2a84c3813fc62a1c3ba Mon Sep 17 00:00:00 2001
From: Christopher Brickley
Date: Mon, 1 Sep 2014 19:19:56 -0400
Subject: [PATCH 019/153] handle initial commit for compareUrl
---
models/action.go | 6 +++++-
models/slack.go | 7 ++++++-
2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/models/action.go b/models/action.go
index 5a8c31697c..f739fc353d 100644
--- a/models/action.go
+++ b/models/action.go
@@ -226,7 +226,11 @@ func CommitRepoAction(userId, repoUserId int64, userName, actEmail string,
}
repoLink := fmt.Sprintf("%s%s/%s", setting.AppUrl, repoUserName, repoName)
- compareUrl := fmt.Sprintf("%s/compare/%s...%s", repoLink, oldCommitId, newCommitId)
+ compareUrl := ""
+ // if not the first commit, set the compareUrl
+ if !strings.HasPrefix(oldCommitId, "0000000") {
+ compareUrl = fmt.Sprintf("%s/compare/%s...%s", repoLink, oldCommitId, newCommitId)
+ }
commits := make([]*PayloadCommit, len(commit.Commits))
for i, cmt := range commit.Commits {
commits[i] = &PayloadCommit{
diff --git a/models/slack.go b/models/slack.go
index 714b2f6ca2..3dd40759af 100644
--- a/models/slack.go
+++ b/models/slack.go
@@ -72,9 +72,14 @@ func getSlackPushPayload(p *Payload, slack *Slack) (*SlackPayload, error) {
if len(p.Commits) == 1 {
commitString = "1 new commit"
+ if p.CompareUrl != "" {
+ commitString = SlackLinkFormatter(p.CompareUrl, commitString)
+ }
} else {
commitString = fmt.Sprintf("%d new commits", len(p.Commits))
- commitString = SlackLinkFormatter(p.CompareUrl, commitString)
+ if p.CompareUrl != "" {
+ commitString = SlackLinkFormatter(p.CompareUrl, commitString)
+ }
}
repoLink := SlackLinkFormatter(p.Repo.Url, p.Repo.Name)
From 1240fef0ca252f03c8cd67ef84d6fd48cd3cb76d Mon Sep 17 00:00:00 2001
From: lunnyxiao
Date: Tue, 2 Sep 2014 11:57:06 +0800
Subject: [PATCH 020/153] bug fixed for migrate and fixed #141
---
models/repo.go | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/models/repo.go b/models/repo.go
index 4703696678..105e8eecda 100644
--- a/models/repo.go
+++ b/models/repo.go
@@ -277,7 +277,7 @@ func MirrorUpdate() {
// MigrateRepository migrates a existing repository from other project hosting.
func MigrateRepository(u *User, name, desc string, private, mirror bool, url string) (*Repository, error) {
- repo, err := CreateRepository(u, name, desc, "", "", private, mirror, false)
+ repo, err := CreateRepository(u, name, desc, "", "", private, true, false)
if err != nil {
return nil, err
}
@@ -307,8 +307,15 @@ func MigrateRepository(u *User, name, desc string, private, mirror bool, url str
return repo, UpdateRepository(repo)
}
- // Clone from local repository.
+ // this command could for both migrate and mirror
_, stderr, err := process.ExecTimeout(10*time.Minute,
+ fmt.Sprintf("MigrateRepository: %s", repoPath),
+ "git", "clone", "--mirror", "--bare", url, repoPath)
+ if err != nil {
+ return repo, errors.New("git clone: " + stderr)
+ }
+ // Clone from local repository.
+ /*_, stderr, err := process.ExecTimeout(10*time.Minute,
fmt.Sprintf("MigrateRepository(git clone): %s", repoPath),
"git", "clone", repoPath, tmpDir)
if err != nil {
@@ -327,7 +334,7 @@ func MigrateRepository(u *User, name, desc string, private, mirror bool, url str
tmpDir, fmt.Sprintf("MigrateRepository(git push): %s", repoPath),
"git", "push", "--tags", "origin", "refs/remotes/upstream/*:refs/heads/*"); err != nil {
return repo, errors.New("git push: " + stderr)
- }
+ }*/
return repo, UpdateRepository(repo)
}
From 8e0aeb4ad5183030a1e669713e8a053957742aaf Mon Sep 17 00:00:00 2001
From: Arpemedia
Date: Tue, 2 Sep 2014 09:20:39 +0200
Subject: [PATCH 021/153] Fix a gramma error and translate two additional
strings
---
conf/locale/locale_de-DE.ini | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/conf/locale/locale_de-DE.ini b/conf/locale/locale_de-DE.ini
index 97ca5efd06..5c7919aefa 100644
--- a/conf/locale/locale_de-DE.ini
+++ b/conf/locale/locale_de-DE.ini
@@ -1,4 +1,4 @@
-app_desc = Ein einfacher, selbst gehostetes Git-Service, geschrieben in Go.
+app_desc = Ein einfacher, selbst gehosteter Git-Service, geschrieben in Go.
home = Home
dashboard = Dashboard
@@ -60,7 +60,7 @@ sign_up_now = Du willst ein Konto? Jetzt registrieren!
confirmation_mail_sent_prompt = A new confirmation e-mail has been sent to %s, please check your inbox within the next %d hours to complete your registration.
sign_in_email = Melden dich mit deiner E-Mail-Adresse an
active_your_account = Aktivieren dein Konto
-resent_limit_prompt = Sorry, you are sending an activation e-mail too frequently. Please wait 3 minutes.
+resent_limit_prompt = Entschuldigung, du versuchst die Bestätigungs E-Mail zu häufig zu versenden. Bitte warte 3 Minuten.
has_unconfirmed_mail = Hi %s, you have an unconfirmed email address(%s). If you haven't received a confirmation e-mail or need to resend a new one, please click on the button below.
resend_mail = Klicke hier, um deine Aktivierungs-E-Mail nochmal zu senden
email_not_associate = Diese E-Mail-Adresse ist mit keinen Konto verknüpft.
@@ -127,7 +127,7 @@ orgs = Organisationen
delete = Konto löschen
public_profile = Öffentliches Profil
-profile_desc = Your Email address is public and will be used for any account related notifications, and any web based operations made via the site.
+profile_desc = Deine E-Mail Adresse ist öffentlich und wird für alle Meldungen im zusammenhang mit dem Benutzerkonto und für alle Operationen, die über die Weboberfläche gestartet werden, verwendet.
full_name = Vollständiger Name
website = Webseite
location = Standort
From 830efc90da2895d65c3a2df32e7ef79cf2a8d556 Mon Sep 17 00:00:00 2001
From: Unknwon
Date: Tue, 2 Sep 2014 07:11:39 -0400
Subject: [PATCH 022/153] update docs and mirror bug fix
---
CONTRIBUTING.md | 66 +++++++++++++++++++++++++++++++++++++---------
README.md | 3 ++-
README_ZH.md | 1 +
gogs.go | 2 +-
models/repo.go | 26 +++---------------
templates/.VERSION | 2 +-
6 files changed, 61 insertions(+), 39 deletions(-)
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 0a8b26f1c2..1917ae8854 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -1,14 +1,54 @@
# Contributing to Gogs
-> Thanks [drone](https://github.com/drone/drone) because this guidelines sheet is forked from its [CONTRIBUTING.md](https://github.com/drone/drone/blob/master/CONTRIBUTING.md).
+> This guidelines sheet is forked from [CONTRIBUTING.md](https://github.com/drone/drone/blob/master/CONTRIBUTING.md).
-Want to hack on Gogs? Awesome! Here are instructions to get you started. They are probably not perfect, please let us know if anything feels wrong or incomplete.
+Gogs is not perfect and it has bugs, or incomplete features for rare cases. You're welcome to tell us or contribute some code. This document describles details about how can you contribute to Gogs project.
## Contribution guidelines
-### Pull requests are always welcome
+Depends on the situation, you will:
-**ALL PULL REQUESTS MUST SEND TO `DEV` BRANCH**
+- Find bug, create an issue
+- Need more functionality, make a feature request
+- Want to contribute code, open a pull request
+- Run into issue, need help
+
+### Bug Report
+
+If you find or consider something is a bug, please create a issue on [GitHub](https://github.com/gogits/gogs/issues). To reduce unnecessary time wasting of interacting and waiting with team members, please use following form as template in the first place:
+
+```
+- **Bug Description**:
+- **Gogs Version**:
+- **Git Version**:
+- **System Type**:
+- **Error Log**:
+- **Other information**:
+```
+
+Please take a moment to check that an issue on [GitHub](https://github.com/gogits/gogs/issues) doesn't already exist documenting your bug report or improvement proposal. If it does, it never hurts to add a quick "+1" or "I have this problem too". This will help prioritize the most common problems and requests.
+
+#### Bug Report Example
+
+- **Bug Description**: Crash when create repository with license|
+- **Gogs Version**: `v0.4.9.0901`
+- **Git Version**: `1.9.0`
+- **System Type**: `Ubuntu 12.04`
+- **Error Log**:
+
+```
+2014/09/01 07:21:49 [E] nil pointer
+```
+
+- **Other information**: Use SQLite3 as database
+
+### Feature Request
+
+There is no standard form of making a feature request, just try to describle the feature as clear as possible because team members may not have experience with the functionality you're talking about.
+
+### Pull Request
+
+Pull requests are always welcome, but note that **ALL PULL REQUESTS MUST SEND TO `DEV` BRANCH**.
We are always thrilled to receive pull requests, and do our best to process them as fast as possible. Not sure if that typo is worth a pull request? Do it! We will appreciate it.
@@ -16,16 +56,16 @@ If your pull request is not accepted on the first try, don't be discouraged! If
We're trying very hard to keep Gogs lean and focused. We don't want it to do everything for everybody. This means that we might decide against incorporating a new feature.
+### Ask For Help
+
+Before open any new issue, please check your problem on [Troubleshooting](http://gogs.io/docs/intro/troubleshooting.md) and [FAQs](http://gogs.io/docs/intro/faqs.html) pages.
+
+## Things To Notice
+
+Please take a moment to check that an issue on [GitHub](https://github.com/gogits/gogs/issues) or card on [Trello](https://trello.com/b/uxAoeLUl/gogs-go-git-service) doesn't already exist documenting your bug report or improvement proposal. If it does, it never hurts to add a quick "+1" or "I have this problem too". This will help prioritize the most common problems and requests.
+
### Discuss your design on the mailing list
We recommend discussing your plans [on the mailing list](https://groups.google.com/forum/#!forum/gogits) before starting to code - especially for more ambitious contributions. This gives other contributors a chance to point you in the right direction, give feedback on your design, and maybe point out if someone else is working on the same thing.
-We may close your pull request if not first discussed on the mailing list. We aren't doing this to be jerks. We are doing this to prevent people from spending large amounts of time on changes that may need to be designed or architected in a specific way, or may not align with the vision of the project.
-
-### Create issues...
-
-Any significant improvement should be documented as [a GitHub issue](https://github.com/gogits/gogs/issues) before anybody starts working on it.
-
-### ...but check for existing issues first!
-
-Please take a moment to check that an issue or card on [Trello](https://trello.com/b/uxAoeLUl/gogs-go-git-service) doesn't already exist documenting your bug report or improvement proposal. If it does, it never hurts to add a quick "+1" or "I have this problem too". This will help prioritize the most common problems and requests.
\ No newline at end of file
+We may close your pull request if not first discussed on the mailing list. We aren't doing this to be jerks. We are doing this to prevent people from spending large amounts of time on changes that may need to be designed or architected in a specific way, or may not align with the vision of the project.
\ No newline at end of file
diff --git a/README.md b/README.md
index 38e081f464..ddb8367e9f 100644
--- a/README.md
+++ b/README.md
@@ -40,6 +40,7 @@ The goal of this project is to make the easiest, fastest and most painless way t
- Gravatar and cache support
- Mail service(register, issue)
- Administration panel
+- Slack webhook integration
- Supports MySQL, PostgreSQL and SQLite3
- Social account login(GitHub, Google, QQ, Weibo)
- Multi-language support(English, Chinese, Germany etc.)
@@ -69,7 +70,7 @@ There are 5 ways to install Gogs:
- Usage and modification from [beego](http://beego.me) modules.
- Thanks [lavachen](http://www.lavachen.cn/) and [Rocker](http://weibo.com/rocker1989) for designing Logo.
- Thanks [gobuild.io](http://gobuild.io) for providing binary compile and download service.
-- Great thanks to [Docker China](http://www.dockboard.org/) for providing [dockerfiles](https://github.com/gogits/gogs/tree/master/dockerfiles).
+- Thanks [Docker China](http://www.dockboard.org/) for providing [dockerfiles](https://github.com/gogits/gogs/tree/master/dockerfiles).
## Contributors
diff --git a/README_ZH.md b/README_ZH.md
index b830d41643..de982baf37 100644
--- a/README_ZH.md
+++ b/README_ZH.md
@@ -31,6 +31,7 @@ Gogs 的目标是打造一个最简单、最快速和最轻松的方式搭建自
- Gravatar 以及缓存支持
- 邮件服务(注册、Issue)
- 管理员面板
+- Slack Web 钩子集成
- 支持 MySQL、PostgreSQL 以及 SQLite3 数据库
- 社交帐号登录(GitHub、Google、QQ、微博)
- 多语言支持(英文、简体中文、德语等等)
diff --git a/gogs.go b/gogs.go
index 1e2150b3c3..a116019078 100644
--- a/gogs.go
+++ b/gogs.go
@@ -17,7 +17,7 @@ import (
"github.com/gogits/gogs/modules/setting"
)
-const APP_VER = "0.4.9.0831 Beta"
+const APP_VER = "0.4.9.0902 Beta"
func init() {
runtime.GOMAXPROCS(runtime.NumCPU())
diff --git a/models/repo.go b/models/repo.go
index 105e8eecda..8f62fa17ae 100644
--- a/models/repo.go
+++ b/models/repo.go
@@ -277,7 +277,7 @@ func MirrorUpdate() {
// MigrateRepository migrates a existing repository from other project hosting.
func MigrateRepository(u *User, name, desc string, private, mirror bool, url string) (*Repository, error) {
- repo, err := CreateRepository(u, name, desc, "", "", private, true, false)
+ repo, err := CreateRepository(u, name, desc, "", "", private, mirror, false)
if err != nil {
return nil, err
}
@@ -305,6 +305,8 @@ func MigrateRepository(u *User, name, desc string, private, mirror bool, url str
}
repo.IsMirror = true
return repo, UpdateRepository(repo)
+ } else {
+ os.RemoveAll(repoPath)
}
// this command could for both migrate and mirror
@@ -314,28 +316,6 @@ func MigrateRepository(u *User, name, desc string, private, mirror bool, url str
if err != nil {
return repo, errors.New("git clone: " + stderr)
}
- // Clone from local repository.
- /*_, stderr, err := process.ExecTimeout(10*time.Minute,
- fmt.Sprintf("MigrateRepository(git clone): %s", repoPath),
- "git", "clone", repoPath, tmpDir)
- if err != nil {
- return repo, errors.New("git clone: " + stderr)
- }
-
- // Add remote and fetch data.
- if _, stderr, err = process.ExecDir(3*time.Minute,
- tmpDir, fmt.Sprintf("MigrateRepository(git pull): %s", repoPath),
- "git", "remote", "add", "-f", "--tags", "upstream", url); err != nil {
- return repo, errors.New("git remote: " + stderr)
- }
-
- // Push data to local repository.
- if _, stderr, err = process.ExecDir(3*time.Minute,
- tmpDir, fmt.Sprintf("MigrateRepository(git push): %s", repoPath),
- "git", "push", "--tags", "origin", "refs/remotes/upstream/*:refs/heads/*"); err != nil {
- return repo, errors.New("git push: " + stderr)
- }*/
-
return repo, UpdateRepository(repo)
}
diff --git a/templates/.VERSION b/templates/.VERSION
index fb2403adf0..5f3c518191 100644
--- a/templates/.VERSION
+++ b/templates/.VERSION
@@ -1 +1 @@
-0.4.9.0831 Beta
\ No newline at end of file
+0.4.9.0902 Beta
\ No newline at end of file
From 399887cc0e3788cdf2df418eb6b89c4b54da47e5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=97=A0=E9=97=BB?=
Date: Tue, 2 Sep 2014 07:13:13 -0400
Subject: [PATCH 023/153] Revert "Fix a gramma error and translate two
additional strings (German translation)"
---
conf/locale/locale_de-DE.ini | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/conf/locale/locale_de-DE.ini b/conf/locale/locale_de-DE.ini
index 5c7919aefa..97ca5efd06 100644
--- a/conf/locale/locale_de-DE.ini
+++ b/conf/locale/locale_de-DE.ini
@@ -1,4 +1,4 @@
-app_desc = Ein einfacher, selbst gehosteter Git-Service, geschrieben in Go.
+app_desc = Ein einfacher, selbst gehostetes Git-Service, geschrieben in Go.
home = Home
dashboard = Dashboard
@@ -60,7 +60,7 @@ sign_up_now = Du willst ein Konto? Jetzt registrieren!
confirmation_mail_sent_prompt = A new confirmation e-mail has been sent to %s, please check your inbox within the next %d hours to complete your registration.
sign_in_email = Melden dich mit deiner E-Mail-Adresse an
active_your_account = Aktivieren dein Konto
-resent_limit_prompt = Entschuldigung, du versuchst die Bestätigungs E-Mail zu häufig zu versenden. Bitte warte 3 Minuten.
+resent_limit_prompt = Sorry, you are sending an activation e-mail too frequently. Please wait 3 minutes.
has_unconfirmed_mail = Hi %s, you have an unconfirmed email address(%s). If you haven't received a confirmation e-mail or need to resend a new one, please click on the button below.
resend_mail = Klicke hier, um deine Aktivierungs-E-Mail nochmal zu senden
email_not_associate = Diese E-Mail-Adresse ist mit keinen Konto verknüpft.
@@ -127,7 +127,7 @@ orgs = Organisationen
delete = Konto löschen
public_profile = Öffentliches Profil
-profile_desc = Deine E-Mail Adresse ist öffentlich und wird für alle Meldungen im zusammenhang mit dem Benutzerkonto und für alle Operationen, die über die Weboberfläche gestartet werden, verwendet.
+profile_desc = Your Email address is public and will be used for any account related notifications, and any web based operations made via the site.
full_name = Vollständiger Name
website = Webseite
location = Standort
From 0730ec408787f27c02d7f71d8e0cb713c0a95b57 Mon Sep 17 00:00:00 2001
From: Arpemedia
Date: Tue, 2 Sep 2014 13:46:18 +0200
Subject: [PATCH 024/153] Fix grammar error in German translation
---
conf/locale/locale_de-DE.ini | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/conf/locale/locale_de-DE.ini b/conf/locale/locale_de-DE.ini
index 3e9936d6e4..19b2b5d11f 100644
--- a/conf/locale/locale_de-DE.ini
+++ b/conf/locale/locale_de-DE.ini
@@ -1,4 +1,4 @@
-app_desc = Ein einfacher, selbst gehostetes Git-Service, geschrieben in Go.
+app_desc = Ein einfacher, selbst gehosteter Git-Service, geschrieben in Go.
home = Home
dashboard = Dashboard
From 9476e58de941624912a3ceb89d52d36e79c03358 Mon Sep 17 00:00:00 2001
From: Vyacheslav Bakhmutov
Date: Tue, 2 Sep 2014 22:48:40 +0700
Subject: [PATCH 025/153] Set headers in js and go files to X-Csrf-Token
---
cmd/web.go | 1 +
1 file changed, 1 insertion(+)
diff --git a/cmd/web.go b/cmd/web.go
index 2199d4ca1e..57164683ac 100644
--- a/cmd/web.go
+++ b/cmd/web.go
@@ -95,6 +95,7 @@ func newMacaron() *macaron.Macaron {
m.Use(csrf.Generate(csrf.Options{
Secret: setting.SecretKey,
SetCookie: true,
+ Header: "X-Csrf-Token",
}))
m.Use(toolbox.Toolboxer(m, toolbox.Options{
HealthCheckFuncs: []*toolbox.HealthCheckFuncDesc{
From 8b0e815d98a02ed271410c5491e7a879818ca995 Mon Sep 17 00:00:00 2001
From: Unknwon
Date: Tue, 2 Sep 2014 13:01:02 -0400
Subject: [PATCH 026/153] Fix #425
---
modules/middleware/auth.go | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/modules/middleware/auth.go b/modules/middleware/auth.go
index 37e3aec454..51ce48c69b 100644
--- a/modules/middleware/auth.go
+++ b/modules/middleware/auth.go
@@ -53,7 +53,7 @@ func Toggle(options *ToggleOptions) macaron.Handler {
return
} else if !ctx.User.IsActive && setting.Service.RegisterEmailConfirm {
ctx.Data["Title"] = ctx.Tr("auth.active_your_account")
- ctx.HTML(200, "user/activate")
+ ctx.HTML(200, "user/auth/activate")
return
}
}
From 2a7a03e5b3ca1f24b35003082902e7dda37991bc Mon Sep 17 00:00:00 2001
From: Vyacheslav Bakhmutov
Date: Wed, 3 Sep 2014 00:04:22 +0700
Subject: [PATCH 027/153] take params for milestone and assignee from query
instead of path args
---
public/js/app.js | 2 +-
routers/repo/issue.go | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/public/js/app.js b/public/js/app.js
index a5bb9569ef..2a7cf08bae 100644
--- a/public/js/app.js
+++ b/public/js/app.js
@@ -870,7 +870,7 @@ function initIssue() {
$.post($m.data("ajax"), {
issue: $('#issue').data("id"),
- milestone: id
+ milestoneid: id
}, function (json) {
if (json.ok) {
//window.location.reload();
diff --git a/routers/repo/issue.go b/routers/repo/issue.go
index 412d03c6e6..59921d5515 100644
--- a/routers/repo/issue.go
+++ b/routers/repo/issue.go
@@ -582,7 +582,7 @@ func UpdateIssueMilestone(ctx *middleware.Context) {
}
oldMid := issue.MilestoneId
- mid := com.StrTo(ctx.Params(":milestone")).MustInt64()
+ mid := com.StrTo(ctx.Query("milestoneid")).MustInt64()
if oldMid == mid {
ctx.JSON(200, map[string]interface{}{
"ok": true,
@@ -627,7 +627,7 @@ func UpdateAssignee(ctx *middleware.Context) {
return
}
- aid := com.StrTo(ctx.Params(":assigneeid")).MustInt64()
+ aid := com.StrTo(ctx.Query("assigneeid")).MustInt64()
// Not check for invalid assignne id and give responsibility to owners.
issue.AssigneeId = aid
if err = models.UpdateIssueUserPairByAssignee(aid, issue.Id); err != nil {
From dcb10a41d4fa7abf2554955cdf3abbcea055adfd Mon Sep 17 00:00:00 2001
From: Michael Dyrynda
Date: Wed, 3 Sep 2014 10:01:32 +0930
Subject: [PATCH 028/153] Add handling to branch switcher label to make label
more consistent with GitHub behaviour
Addresses #431
---
templates/repo/home.tmpl | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/templates/repo/home.tmpl b/templates/repo/home.tmpl
index 0947308477..90633cd0cc 100644
--- a/templates/repo/home.tmpl
+++ b/templates/repo/home.tmpl
@@ -17,7 +17,7 @@
@@ -75,4 +75,4 @@
{{template "repo/sidebar" .}}
-{{template "ng/base/footer" .}}
\ No newline at end of file
+{{template "ng/base/footer" .}}
From 000b9062599d6138cb63775c61d1978283c195c1 Mon Sep 17 00:00:00 2001
From: Tristan Storch
Date: Wed, 3 Sep 2014 16:58:23 +0200
Subject: [PATCH 029/153] Small German update
Cleaning up a misunderstanding I had.
---
conf/locale/locale_de-DE.ini | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/conf/locale/locale_de-DE.ini b/conf/locale/locale_de-DE.ini
index 19b2b5d11f..d8060f0b54 100644
--- a/conf/locale/locale_de-DE.ini
+++ b/conf/locale/locale_de-DE.ini
@@ -127,7 +127,7 @@ orgs = Organisationen
delete = Konto löschen
public_profile = Öffentliches Profil
-profile_desc = Deine E-Mail-Adresse wird nicht veröffentlicht und dient dazu, dir Benachrichtigungen bezüglich deines Kontos und deiner Repositorys zu schicken.
+profile_desc = Deine E-Mail-Adresse ist öffentlich und dient dazu, dir Benachrichtigungen bezüglich deines Kontos und deiner Repositorys zu schicken.
full_name = Vollständiger Name
website = Webseite
location = Standort
From 7df0794e14e713d359ee79d204d75cc574b02c1f Mon Sep 17 00:00:00 2001
From: Tristan Storch
Date: Wed, 3 Sep 2014 17:12:38 +0200
Subject: [PATCH 030/153] docker dev block update
The dev Dockerfile now works without superfluous go get calls.
At this point the -u option is really not what we want.
---
docker/blocks/docker_gogs_dev/Dockerfile | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/docker/blocks/docker_gogs_dev/Dockerfile b/docker/blocks/docker_gogs_dev/Dockerfile
index 1c001e2c06..a016409f52 100644
--- a/docker/blocks/docker_gogs_dev/Dockerfile
+++ b/docker/blocks/docker_gogs_dev/Dockerfile
@@ -1,8 +1,9 @@
FROM ubuntu:14.04
-# This part is taken from the official docker image --------------------
+# This part is derived from the official docker image ------------------
-RUN apt-get update && apt-get install -y \
+RUN DEBIAN_FRONTEND=noninteractive apt-get update && \
+ apt-get install -qy \
build-essential ca-certificates curl \
bzr git mercurial \
--no-install-recommends
@@ -31,10 +32,10 @@ ENV GOGS_PATH $GOPATH/src/github.com/gogits/gogs
ENV GOGS_CUSTOM_CONF_PATH $GOGS_PATH/custom/conf
ENV GOGS_CUSTOM_CONF $GOGS_CUSTOM_CONF_PATH/app.ini
-RUN go get -u -d github.com/gogits/gogs
+RUN git clone -b dev https://github.com/gogits/gogs.git $GOPATH/src/github.com/gogits/gogs
# WORKDIR $GOGS_PATH
WORKDIR /go/src/github.com/gogits/gogs
-RUN git checkout dev; go get -u; git checkout dev; go build
+RUN go get -d && go build
RUN chown -R git $GOGS_PATH
ADD init_gogs.sh /tmp/
From 863a4d5bc4b1e1237e259325ac30c111755c9a02 Mon Sep 17 00:00:00 2001
From: Tristan Storch
Date: Wed, 3 Sep 2014 18:41:20 +0200
Subject: [PATCH 031/153] Use variables, when the're there
Why not use the environment variables, when they are there...
---
docker/blocks/docker_gogs_dev/Dockerfile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/docker/blocks/docker_gogs_dev/Dockerfile b/docker/blocks/docker_gogs_dev/Dockerfile
index a016409f52..d1b96bf4a2 100644
--- a/docker/blocks/docker_gogs_dev/Dockerfile
+++ b/docker/blocks/docker_gogs_dev/Dockerfile
@@ -32,7 +32,7 @@ ENV GOGS_PATH $GOPATH/src/github.com/gogits/gogs
ENV GOGS_CUSTOM_CONF_PATH $GOGS_PATH/custom/conf
ENV GOGS_CUSTOM_CONF $GOGS_CUSTOM_CONF_PATH/app.ini
-RUN git clone -b dev https://github.com/gogits/gogs.git $GOPATH/src/github.com/gogits/gogs
+RUN git clone -b dev https://github.com/gogits/gogs.git $GOGS_PATH
# WORKDIR $GOGS_PATH
WORKDIR /go/src/github.com/gogits/gogs
RUN go get -d && go build
From aee46bac0189de650d3444a34fc463a8c01a8aa8 Mon Sep 17 00:00:00 2001
From: Michael Dyrynda
Date: Thu, 4 Sep 2014 09:12:51 +0930
Subject: [PATCH 032/153] add rel attribute such that font-awesome icons load
correctly
---
templates/ng/base/head.tmpl | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/templates/ng/base/head.tmpl b/templates/ng/base/head.tmpl
index 815453446a..40c3899e91 100644
--- a/templates/ng/base/head.tmpl
+++ b/templates/ng/base/head.tmpl
@@ -12,7 +12,7 @@
{{if CdnMode}}
-
+
{{else}}
@@ -35,4 +35,4 @@
-
\ No newline at end of file
+
From 9fc4ded369a90140a63e064371479f2ef4e4bc4f Mon Sep 17 00:00:00 2001
From: Tristan Storch
Date: Thu, 4 Sep 2014 12:03:29 +0200
Subject: [PATCH 033/153] Standard git user.name and user.email if not set
Git user.name and user.email will now be set to the standard values
- Gogs
- gogitservice@gmail.com
if user.name is not set or empty.
If user.name is set and user.email not, it will leave it this way.
---
models/repo.go | 26 ++++++++++++++++----------
1 file changed, 16 insertions(+), 10 deletions(-)
diff --git a/models/repo.go b/models/repo.go
index 8f62fa17ae..23d44a6b80 100644
--- a/models/repo.go
+++ b/models/repo.go
@@ -99,20 +99,26 @@ func NewRepoContext() {
log.Fatal(4, "Gogs requires Git version greater or equal to 1.8.0")
}
- // Check if server has basic git setting.
- stdout, stderr, err := process.Exec("NewRepoContext(get setting)", "git", "config", "--get", "user.name")
- if err != nil {
- log.Fatal(4, "Fail to get git user.name: %s", stderr)
- } else if err != nil || len(strings.TrimSpace(stdout)) == 0 {
- if _, stderr, err = process.Exec("NewRepoContext(set email)", "git", "config", "--global", "user.email", "gogitservice@gmail.com"); err != nil {
- log.Fatal(4, "Fail to set git user.email: %s", stderr)
- } else if _, stderr, err = process.Exec("NewRepoContext(set name)", "git", "config", "--global", "user.name", "Gogs"); err != nil {
- log.Fatal(4, "Fail to set git user.name: %s", stderr)
+ // Check if server has basic git setting and set if not.
+ if stdout, stderr, err := process.Exec("NewRepoContext(get setting)", "git", "config", "--get", "user.name"); err != nil || strings.TrimSpace(stdout) == "" {
+ // ExitError indicates user.name is not set
+ if _, ok := err.(*exec.ExitError); ok || strings.TrimSpace(stdout) == "" {
+ stndrdUserName := "Gogs"
+ stndrdUserEmail := "gogitservice@gmail.com"
+ if _, stderr, gerr := process.Exec("NewRepoContext(set name)", "git", "config", "--global", "user.name", stndrdUserName); gerr != nil {
+ log.Fatal(4, "Fail to set git user.name(%s): %s", gerr, stderr)
+ }
+ if _, stderr, gerr := process.Exec("NewRepoContext(set email)", "git", "config", "--global", "user.email", stndrdUserEmail); gerr != nil {
+ log.Fatal(4, "Fail to set git user.email(%s): %s", gerr, stderr)
+ }
+ log.Info("Git user.name and user.email set to %s <%s>", stndrdUserName, stndrdUserEmail)
+ } else {
+ log.Fatal(4, "Fail to get git user.name(%s): %s", err, stderr)
}
}
// Set git some configurations.
- if _, stderr, err = process.Exec("NewRepoContext(git config --global core.quotepath false)",
+ if _, stderr, err := process.Exec("NewRepoContext(git config --global core.quotepath false)",
"git", "config", "--global", "core.quotepath", "false"); err != nil {
log.Fatal(4, "Fail to execute 'git config --global core.quotepath false': %s", stderr)
}
From bdfdf3cacba75fe1c36f7a05096748c26f25a2f9 Mon Sep 17 00:00:00 2001
From: Tristan Storch
Date: Thu, 4 Sep 2014 17:19:26 +0200
Subject: [PATCH 034/153] Code dedoublication in models/models.go
Just some code dedoublication in models/models.go
---
models/models.go | 44 +++++++++++++++-----------------------------
1 file changed, 15 insertions(+), 29 deletions(-)
diff --git a/models/models.go b/models/models.go
index 4e2e08cf83..5558ec0062 100644
--- a/models/models.go
+++ b/models/models.go
@@ -55,11 +55,12 @@ func LoadModelsConfig() {
DbCfg.Path = setting.Cfg.MustValue("database", "PATH", "data/gogs.db")
}
-func NewTestEngine(x *xorm.Engine) (err error) {
+func getEngine() (*xorm.Engine, error) {
+ cnnstr := ""
switch DbCfg.Type {
case "mysql":
- x, err = xorm.NewEngine("mysql", fmt.Sprintf("%s:%s@tcp(%s)/%s?charset=utf8",
- DbCfg.User, DbCfg.Pwd, DbCfg.Host, DbCfg.Name))
+ cnnstr = fmt.Sprintf("%s:%s@tcp(%s)/%s?charset=utf8",
+ DbCfg.User, DbCfg.Pwd, DbCfg.Host, DbCfg.Name)
case "postgres":
var host, port = "127.0.0.1", "5432"
fields := strings.Split(DbCfg.Host, ":")
@@ -69,46 +70,31 @@ func NewTestEngine(x *xorm.Engine) (err error) {
if len(fields) > 1 && len(strings.TrimSpace(fields[1])) > 0 {
port = fields[1]
}
- cnnstr := fmt.Sprintf("user=%s password=%s host=%s port=%s dbname=%s sslmode=%s",
+ cnnstr = fmt.Sprintf("user=%s password=%s host=%s port=%s dbname=%s sslmode=%s",
DbCfg.User, DbCfg.Pwd, host, port, DbCfg.Name, DbCfg.SslMode)
- x, err = xorm.NewEngine("postgres", cnnstr)
case "sqlite3":
if !EnableSQLite3 {
- return fmt.Errorf("Unknown database type: %s", DbCfg.Type)
+ return nil, fmt.Errorf("Unknown database type: %s", DbCfg.Type)
}
os.MkdirAll(path.Dir(DbCfg.Path), os.ModePerm)
- x, err = xorm.NewEngine("sqlite3", DbCfg.Path)
+ cnnstr = DbCfg.Path
default:
- return fmt.Errorf("Unknown database type: %s", DbCfg.Type)
+ return nil, fmt.Errorf("Unknown database type: %s", DbCfg.Type)
}
+ return xorm.NewEngine(DbCfg.Type, cnnstr)
+}
+
+func NewTestEngine(x *xorm.Engine) (err error) {
+ x, err = getEngine()
if err != nil {
return fmt.Errorf("models.init(fail to conntect database): %v", err)
}
+
return x.Sync(tables...)
}
func SetEngine() (err error) {
- switch DbCfg.Type {
- case "mysql":
- x, err = xorm.NewEngine("mysql", fmt.Sprintf("%s:%s@tcp(%s)/%s?charset=utf8",
- DbCfg.User, DbCfg.Pwd, DbCfg.Host, DbCfg.Name))
- case "postgres":
- var host, port = "127.0.0.1", "5432"
- fields := strings.Split(DbCfg.Host, ":")
- if len(fields) > 0 && len(strings.TrimSpace(fields[0])) > 0 {
- host = fields[0]
- }
- if len(fields) > 1 && len(strings.TrimSpace(fields[1])) > 0 {
- port = fields[1]
- }
- x, err = xorm.NewEngine("postgres", fmt.Sprintf("user=%s password=%s host=%s port=%s dbname=%s sslmode=%s",
- DbCfg.User, DbCfg.Pwd, host, port, DbCfg.Name, DbCfg.SslMode))
- case "sqlite3":
- os.MkdirAll(path.Dir(DbCfg.Path), os.ModePerm)
- x, err = xorm.NewEngine("sqlite3", DbCfg.Path)
- default:
- return fmt.Errorf("Unknown database type: %s", DbCfg.Type)
- }
+ x, err = getEngine()
if err != nil {
return fmt.Errorf("models.init(fail to conntect database): %v", err)
}
From 31d80118438729119b40fd863e54ee7ca903b18b Mon Sep 17 00:00:00 2001
From: Vyacheslav Bakhmutov
Date: Fri, 5 Sep 2014 08:10:41 +0700
Subject: [PATCH 035/153] Set milestone content field to TEXT orm type
---
models/issue.go | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/models/issue.go b/models/issue.go
index 307ace816d..f16c2e256d 100644
--- a/models/issue.go
+++ b/models/issue.go
@@ -612,7 +612,7 @@ type Milestone struct {
RepoId int64 `xorm:"INDEX"`
Index int64
Name string
- Content string
+ Content string `xorm:"TEXT"`
RenderedContent string `xorm:"-"`
IsClosed bool
NumIssues int
From 6498fce04bdf4fb8503d226036c501901db56114 Mon Sep 17 00:00:00 2001
From: Vyacheslav Bakhmutov
Date: Fri, 5 Sep 2014 09:10:58 +0700
Subject: [PATCH 036/153] Render milestone content as markdown
---
routers/repo/issue.go | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/routers/repo/issue.go b/routers/repo/issue.go
index 59921d5515..934cf3c988 100644
--- a/routers/repo/issue.go
+++ b/routers/repo/issue.go
@@ -940,7 +940,7 @@ func Milestones(ctx *middleware.Context) {
return
}
for _, m := range miles {
- m.RenderedContent = string(base.RenderSpecialLink([]byte(m.Content), ctx.Repo.RepoLink))
+ m.RenderedContent = string(base.RenderMarkdown([]byte(m.Content), ctx.Repo.RepoLink))
m.CalOpenIssues()
}
ctx.Data["Milestones"] = miles
From 8d2fe064c5d3858d76ebd67d5597a0bfccce4ecc Mon Sep 17 00:00:00 2001
From: Christopher Brickley
Date: Wed, 3 Sep 2014 22:13:09 -0400
Subject: [PATCH 037/153] modify grammar undo -> undone
---
conf/locale/locale_en-US.ini | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/conf/locale/locale_en-US.ini b/conf/locale/locale_en-US.ini
index 946d560461..4f1acdcda9 100644
--- a/conf/locale/locale_en-US.ini
+++ b/conf/locale/locale_en-US.ini
@@ -159,7 +159,7 @@ unbind = Unbind
unbind_success = Social account has been unbound.
delete_account = Delete Your Account
-delete_prompt = The operation will delete your account permanently, and CANNOT be undo!
+delete_prompt = The operation will delete your account permanently, and CANNOT be undone!
confirm_delete_account = Confirm Deletion
[repo]
@@ -268,7 +268,7 @@ settings.update_settings = Update Settings
settings.update_setting_success = Organization setting has been successfully updated.
settings.delete = Delete Organization
settings.delete_account = Delete This Organization
-settings.delete_prompt = The operation will delete this organization permanently, and CANNOT be undo!
+settings.delete_prompt = The operation will delete this organization permanently, and CANNOT be undone!
settings.confirm_delete_account = Confirm Deletion
members.public = Public
From 7269b06fd5992776c07ae0303f85e0d05b1e62e9 Mon Sep 17 00:00:00 2001
From: Christopher Brickley
Date: Wed, 3 Sep 2014 22:14:55 -0400
Subject: [PATCH 038/153] HookType is case-sensitive
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Update webhook wasn’t showing up because of the wrong case
---
routers/repo/setting.go | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/routers/repo/setting.go b/routers/repo/setting.go
index fba9eed6a2..7456781222 100644
--- a/routers/repo/setting.go
+++ b/routers/repo/setting.go
@@ -354,11 +354,11 @@ func WebHooksEdit(ctx *middleware.Context) {
case models.SLACK:
{
ctx.Data["SlackHook"] = w.GetSlackHook()
- ctx.Data["HookType"] = "slack"
+ ctx.Data["HookType"] = "Slack"
}
default:
{
- ctx.Data["HookType"] = "gogs"
+ ctx.Data["HookType"] = "Gogs"
}
}
w.GetEvent()
From 85c35a6b8bb7430568d375d1e792e1417bbd7f4b Mon Sep 17 00:00:00 2001
From: Christopher Brickley
Date: Thu, 4 Sep 2014 07:17:00 -0400
Subject: [PATCH 039/153] add organization-level webhooks
---
cmd/web.go | 7 ++++
conf/locale/locale_en-US.ini | 1 +
models/action.go | 16 ++++++-
models/webhook.go | 13 ++++++
public/ng/js/gogs.js | 29 ++++++++-----
routers/org/setting.go | 28 +++++++++++++
routers/repo/setting.go | 56 +++++++++++++++++++++----
templates/org/settings/hook_new.tmpl | 37 ++++++++++++++++
templates/org/settings/hooks.tmpl | 38 +++++++++++++++++
templates/org/settings/nav.tmpl | 3 +-
templates/repo/settings/hook_gogs.tmpl | 2 +-
templates/repo/settings/hook_slack.tmpl | 2 +-
12 files changed, 208 insertions(+), 24 deletions(-)
create mode 100644 templates/org/settings/hook_new.tmpl
create mode 100644 templates/org/settings/hooks.tmpl
diff --git a/cmd/web.go b/cmd/web.go
index 57164683ac..f7b8d92128 100644
--- a/cmd/web.go
+++ b/cmd/web.go
@@ -260,6 +260,13 @@ func runWeb(*cli.Context) {
m.Group("/settings", func(r *macaron.Router) {
r.Get("", org.Settings)
r.Post("", bindIgnErr(auth.UpdateOrgSettingForm{}), org.SettingsPost)
+ r.Get("/hooks", org.SettingsHooks)
+ r.Get("/hooks/new", repo.WebHooksNew)
+ r.Post("/hooks/gogs/new", bindIgnErr(auth.NewWebhookForm{}), repo.WebHooksNewPost)
+ r.Post("/hooks/slack/new", bindIgnErr(auth.NewSlackHookForm{}), repo.SlackHooksNewPost)
+ r.Get("/hooks/:id", repo.WebHooksEdit)
+ r.Post("/hooks/gogs/:id", bindIgnErr(auth.NewWebhookForm{}), repo.WebHooksEditPost)
+ r.Post("/hooks/slack/:id", bindIgnErr(auth.NewSlackHookForm{}), repo.SlackHooksEditPost)
r.Route("/delete", "GET,POST", org.SettingsDelete)
})
diff --git a/conf/locale/locale_en-US.ini b/conf/locale/locale_en-US.ini
index 4f1acdcda9..3969074eee 100644
--- a/conf/locale/locale_en-US.ini
+++ b/conf/locale/locale_en-US.ini
@@ -270,6 +270,7 @@ settings.delete = Delete Organization
settings.delete_account = Delete This Organization
settings.delete_prompt = The operation will delete this organization permanently, and CANNOT be undone!
settings.confirm_delete_account = Confirm Deletion
+settings.hooks_desc = Add webhooks that will be triggered for all repositories under this organization.
members.public = Public
members.public_helper = make private
diff --git a/models/action.go b/models/action.go
index f739fc353d..c0992dba68 100644
--- a/models/action.go
+++ b/models/action.go
@@ -220,8 +220,20 @@ func CommitRepoAction(userId, repoUserId int64, userName, actEmail string,
ws, err := GetActiveWebhooksByRepoId(repoId)
if err != nil {
- return errors.New("action.CommitRepoAction(GetWebhooksByRepoId): " + err.Error())
- } else if len(ws) == 0 {
+ return errors.New("action.CommitRepoAction(GetActiveWebhooksByRepoId): " + err.Error())
+ }
+
+ // check if repo belongs to org and append additional webhooks
+ if repo.Owner.IsOrganization() {
+ // get hooks for org
+ orgws, err := GetActiveWebhooksByOrgId(repo.OwnerId)
+ if err != nil {
+ return errors.New("action.CommitRepoAction(GetActiveWebhooksByOrgId): " + err.Error())
+ }
+ ws = append(ws, orgws...)
+ }
+
+ if len(ws) == 0 {
return nil
}
diff --git a/models/webhook.go b/models/webhook.go
index 0b7b3a9948..5acc83f592 100644
--- a/models/webhook.go
+++ b/models/webhook.go
@@ -45,6 +45,7 @@ type Webhook struct {
IsActive bool
HookTaskType HookTaskType
Meta string `xorm:"TEXT"` // store hook-specific attributes
+ OrgId int64
}
// GetEvent handles conversion from Events to HookEvent.
@@ -120,6 +121,18 @@ func DeleteWebhook(hookId int64) error {
return err
}
+// GetWebhooksByOrgId returns all webhooks for an organization.
+func GetWebhooksByOrgId(orgId int64) (ws []*Webhook, err error) {
+ err = x.Find(&ws, &Webhook{OrgId: orgId})
+ return ws, err
+}
+
+// GetActiveWebhooksByOrgId returns all active webhooks for an organization.
+func GetActiveWebhooksByOrgId(orgId int64) (ws []*Webhook, err error) {
+ err = x.Find(&ws, &Webhook{OrgId: orgId, IsActive: true})
+ return ws, err
+}
+
// ___ ___ __ ___________ __
// / | \ ____ ____ | | _\__ ___/____ _____| | __
// / ~ \/ _ \ / _ \| |/ / | | \__ \ / ___/ |/ /
diff --git a/public/ng/js/gogs.js b/public/ng/js/gogs.js
index c08a887a4c..c60a5cf648 100644
--- a/public/ng/js/gogs.js
+++ b/public/ng/js/gogs.js
@@ -349,17 +349,8 @@ function initRepo() {
})
}
-function initRepoSetting() {
- // Options.
- // Confirmation of changing repository name.
- $('#repo-setting-form').submit(function (e) {
- var $reponame = $('#repo_name');
- if (($reponame.data('repo-name') != $reponame.val()) && !confirm('Repository name has been changed, do you want to continue?')) {
- e.preventDefault();
- return true;
- }
- });
-
+// when user changes hook type, hide/show proper divs
+function initHookTypeChange() {
// web hook type change
$('select#hook-type').on("change", function () {
hookTypes = ['Gogs','Slack'];
@@ -374,6 +365,20 @@ function initRepoSetting() {
}
});
});
+}
+
+function initRepoSetting() {
+ // Options.
+ // Confirmation of changing repository name.
+ $('#repo-setting-form').submit(function (e) {
+ var $reponame = $('#repo_name');
+ if (($reponame.data('repo-name') != $reponame.val()) && !confirm('Repository name has been changed, do you want to continue?')) {
+ e.preventDefault();
+ return true;
+ }
+ });
+
+ initHookTypeChange();
$('#transfer-button').click(function () {
$('#transfer-form').show();
@@ -421,6 +426,8 @@ function initOrgSetting() {
return true;
}
});
+
+ initHookTypeChange();
}
function initInvite() {
diff --git a/routers/org/setting.go b/routers/org/setting.go
index 0ddf0065cc..f853ef0e8e 100644
--- a/routers/org/setting.go
+++ b/routers/org/setting.go
@@ -5,6 +5,7 @@
package org
import (
+ "github.com/Unknwon/com"
"github.com/gogits/gogs/models"
"github.com/gogits/gogs/modules/auth"
"github.com/gogits/gogs/modules/base"
@@ -15,6 +16,7 @@ import (
const (
SETTINGS_OPTIONS base.TplName = "org/settings/options"
SETTINGS_DELETE base.TplName = "org/settings/delete"
+ SETTINGS_HOOKS base.TplName = "org/settings/hooks"
)
func Settings(ctx *middleware.Context) {
@@ -97,3 +99,29 @@ func SettingsDelete(ctx *middleware.Context) {
ctx.HTML(200, SETTINGS_DELETE)
}
+
+func SettingsHooks(ctx *middleware.Context) {
+ ctx.Data["Title"] = ctx.Tr("org.settings")
+ ctx.Data["PageIsSettingsHooks"] = true
+
+ // Delete web hook.
+ remove := com.StrTo(ctx.Query("remove")).MustInt64()
+ if remove > 0 {
+ if err := models.DeleteWebhook(remove); err != nil {
+ ctx.Handle(500, "DeleteWebhook", err)
+ return
+ }
+ ctx.Flash.Success(ctx.Tr("repo.settings.remove_hook_success"))
+ ctx.Redirect(ctx.Org.OrgLink + "/settings/hooks")
+ return
+ }
+
+ ws, err := models.GetWebhooksByOrgId(ctx.Org.Organization.Id)
+ if err != nil {
+ ctx.Handle(500, "GetWebhooksByOrgId", err)
+ return
+ }
+
+ ctx.Data["Webhooks"] = ws
+ ctx.HTML(200, SETTINGS_HOOKS)
+}
diff --git a/routers/repo/setting.go b/routers/repo/setting.go
index 7456781222..81747d43ed 100644
--- a/routers/repo/setting.go
+++ b/routers/repo/setting.go
@@ -6,6 +6,7 @@ package repo
import (
"encoding/json"
+ "errors"
"fmt"
"strings"
"time"
@@ -26,6 +27,7 @@ const (
COLLABORATION base.TplName = "repo/settings/collaboration"
HOOKS base.TplName = "repo/settings/hooks"
HOOK_NEW base.TplName = "repo/settings/hook_new"
+ ORG_HOOK_NEW base.TplName = "org/settings/hook_new"
)
func Settings(ctx *middleware.Context) {
@@ -284,7 +286,14 @@ func WebHooksNew(ctx *middleware.Context) {
ctx.Data["PageIsSettingsHooksNew"] = true
ctx.Data["Webhook"] = models.Webhook{HookEvent: &models.HookEvent{}}
renderHookTypes(ctx)
- ctx.HTML(200, HOOK_NEW)
+ orgId, repoId, _ := getOrgRepoCtx(ctx)
+ if repoId > 0 {
+ ctx.HTML(200, HOOK_NEW)
+ } else if orgId > 0 {
+ ctx.HTML(200, ORG_HOOK_NEW)
+ } else {
+ ctx.Handle(500, "WebHooksEdit(DetermineContext)", errors.New("Can't determine hook context"))
+ }
}
func WebHooksNewPost(ctx *middleware.Context, form auth.NewWebhookForm) {
@@ -293,6 +302,8 @@ func WebHooksNewPost(ctx *middleware.Context, form auth.NewWebhookForm) {
ctx.Data["PageIsSettingsHooksNew"] = true
ctx.Data["Webhook"] = models.Webhook{HookEvent: &models.HookEvent{}}
+ orgId, repoId, link := getOrgRepoCtx(ctx)
+
if ctx.HasError() {
ctx.HTML(200, HOOK_NEW)
return
@@ -304,7 +315,7 @@ func WebHooksNewPost(ctx *middleware.Context, form auth.NewWebhookForm) {
}
w := &models.Webhook{
- RepoId: ctx.Repo.Repository.Id,
+ RepoId: repoId,
Url: form.PayloadUrl,
ContentType: ct,
Secret: form.Secret,
@@ -314,6 +325,7 @@ func WebHooksNewPost(ctx *middleware.Context, form auth.NewWebhookForm) {
IsActive: form.Active,
HookTaskType: models.GOGS,
Meta: "",
+ OrgId: orgId,
}
if err := w.UpdateEvent(); err != nil {
@@ -325,7 +337,7 @@ func WebHooksNewPost(ctx *middleware.Context, form auth.NewWebhookForm) {
}
ctx.Flash.Success(ctx.Tr("repo.settings.add_hook_success"))
- ctx.Redirect(ctx.Repo.RepoLink + "/settings/hooks")
+ ctx.Redirect(link + "/settings/hooks")
}
func WebHooksEdit(ctx *middleware.Context) {
@@ -363,7 +375,14 @@ func WebHooksEdit(ctx *middleware.Context) {
}
w.GetEvent()
ctx.Data["Webhook"] = w
- ctx.HTML(200, HOOK_NEW)
+ orgId, repoId, _ := getOrgRepoCtx(ctx)
+ if repoId > 0 {
+ ctx.HTML(200, HOOK_NEW)
+ } else if orgId > 0 {
+ ctx.HTML(200, ORG_HOOK_NEW)
+ } else {
+ ctx.Handle(500, "WebHooksEdit(DetermineContext)", errors.New("Can't determine hook context"))
+ }
}
func WebHooksEditPost(ctx *middleware.Context, form auth.NewWebhookForm) {
@@ -413,9 +432,10 @@ func WebHooksEditPost(ctx *middleware.Context, form auth.NewWebhookForm) {
ctx.Handle(500, "WebHooksEditPost", err)
return
}
+ _, _, link := getOrgRepoCtx(ctx)
ctx.Flash.Success(ctx.Tr("repo.settings.update_hook_success"))
- ctx.Redirect(fmt.Sprintf("%s/settings/hooks/%d", ctx.Repo.RepoLink, hookId))
+ ctx.Redirect(fmt.Sprintf("%s/settings/hooks/%d", link, hookId))
}
func SlackHooksNewPost(ctx *middleware.Context, form auth.NewSlackHookForm) {
@@ -428,6 +448,7 @@ func SlackHooksNewPost(ctx *middleware.Context, form auth.NewSlackHookForm) {
ctx.HTML(200, HOOK_NEW)
return
}
+ orgId, repoId, link := getOrgRepoCtx(ctx)
meta, err := json.Marshal(&models.Slack{
Domain: form.Domain,
@@ -440,7 +461,7 @@ func SlackHooksNewPost(ctx *middleware.Context, form auth.NewSlackHookForm) {
}
w := &models.Webhook{
- RepoId: ctx.Repo.Repository.Id,
+ RepoId: repoId,
Url: models.GetSlackURL(form.Domain, form.Token),
ContentType: models.JSON,
Secret: "",
@@ -450,6 +471,7 @@ func SlackHooksNewPost(ctx *middleware.Context, form auth.NewSlackHookForm) {
IsActive: form.Active,
HookTaskType: models.SLACK,
Meta: string(meta),
+ OrgId: orgId,
}
if err := w.UpdateEvent(); err != nil {
ctx.Handle(500, "UpdateEvent", err)
@@ -460,7 +482,7 @@ func SlackHooksNewPost(ctx *middleware.Context, form auth.NewSlackHookForm) {
}
ctx.Flash.Success(ctx.Tr("repo.settings.add_hook_success"))
- ctx.Redirect(ctx.Repo.RepoLink + "/settings/hooks")
+ ctx.Redirect(link + "/settings/hooks")
}
func SlackHooksEditPost(ctx *middleware.Context, form auth.NewSlackHookForm) {
@@ -514,7 +536,25 @@ func SlackHooksEditPost(ctx *middleware.Context, form auth.NewSlackHookForm) {
ctx.Handle(500, "SlackHooksEditPost", err)
return
}
+ _, _, link := getOrgRepoCtx(ctx)
ctx.Flash.Success(ctx.Tr("repo.settings.update_hook_success"))
- ctx.Redirect(fmt.Sprintf("%s/settings/hooks/%d", ctx.Repo.RepoLink, hookId))
+ ctx.Redirect(fmt.Sprintf("%s/settings/hooks/%d", link, hookId))
+}
+
+func getOrgRepoCtx(ctx *middleware.Context) (int64, int64, string) {
+ orgId := int64(0)
+ repoId := int64(0)
+ link := ""
+ if _, ok := ctx.Data["RepoLink"]; ok {
+ repoId = ctx.Repo.Repository.Id
+ link = ctx.Repo.RepoLink
+ }
+
+ if _, ok := ctx.Data["OrgLink"]; ok {
+ orgId = ctx.Org.Organization.Id
+ link = ctx.Org.OrgLink
+ }
+
+ return orgId, repoId, link
}
diff --git a/templates/org/settings/hook_new.tmpl b/templates/org/settings/hook_new.tmpl
new file mode 100644
index 0000000000..6e7ee53604
--- /dev/null
+++ b/templates/org/settings/hook_new.tmpl
@@ -0,0 +1,37 @@
+{{template "ng/base/head" .}}
+{{template "ng/base/header" .}}
+{{template "org/base/header" .}}
+
-
\ No newline at end of file
+
diff --git a/templates/repo/settings/hook_gogs.tmpl b/templates/repo/settings/hook_gogs.tmpl
index 35b5899532..31a04ce09a 100644
--- a/templates/repo/settings/hook_gogs.tmpl
+++ b/templates/repo/settings/hook_gogs.tmpl
@@ -1,5 +1,5 @@