summaryrefslogtreecommitdiffstats
path: root/models/publickey.go
diff options
context:
space:
mode:
authorYixin Hao <haoyixin@live.cn>2015-08-21 15:27:38 +0800
committerYixin Hao <haoyixin@live.cn>2015-08-21 15:27:38 +0800
commit50cd67cd4bf9e03a555cbf44bcd76ca12a315b97 (patch)
tree55a8e7dc63ae4a8171be2874fb3f2e285b1607ee /models/publickey.go
parent78b717f202dd989f3871fccd0bc8935fe709fac1 (diff)
parent461f715ae4699557571652d9d3baec9a4438796f (diff)
downloadgitea-50cd67cd4bf9e03a555cbf44bcd76ca12a315b97.tar.gz
gitea-50cd67cd4bf9e03a555cbf44bcd76ca12a315b97.zip
Merge pull request #2 from gogits/develop
Update Develop
Diffstat (limited to 'models/publickey.go')
-rw-r--r--models/publickey.go10
1 files changed, 9 insertions, 1 deletions
diff --git a/models/publickey.go b/models/publickey.go
index 400486eba7..e5516526bc 100644
--- a/models/publickey.go
+++ b/models/publickey.go
@@ -466,7 +466,15 @@ func deletePublicKey(e *xorm.Session, key *PublicKey) error {
}
// DeletePublicKey deletes SSH key information both in database and authorized_keys file.
-func DeletePublicKey(key *PublicKey) (err error) {
+func DeletePublicKey(id int64) (err error) {
+ key := &PublicKey{ID: id}
+ has, err := x.Id(key.ID).Get(key)
+ if err != nil {
+ return err
+ } else if !has {
+ return nil
+ }
+
sess := x.NewSession()
defer sessionRelease(sess)
if err = sess.Begin(); err != nil {