From 8738c29008421eb638343893857449af0f4613e3 Mon Sep 17 00:00:00 2001 From: avadesian Date: Tue, 3 Aug 2021 16:29:30 +0800 Subject: [PATCH 01/30] merge contributors having different names or different emails --- routers/repo/view.go | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/routers/repo/view.go b/routers/repo/view.go index 76593ecc7..5c116285f 100644 --- a/routers/repo/view.go +++ b/routers/repo/view.go @@ -569,10 +569,19 @@ func safeURL(address string) string { } type ContributorInfo struct { - UserInfo *models.User - Email string // for contributor who is not a registered user + UserInfo *models.User // nil for contributor who is not a registered user + Email string + CommitCnt int } +func getContributorInfo(contributorInfos []*ContributorInfo, email string) *ContributorInfo{ + for _, c := range contributorInfos { + if strings.Compare(c.Email,email) == 0 { + return c + } + } + return nil +} // Home render repository home page func Home(ctx *context.Context) { if len(ctx.Repo.Units) > 0 { @@ -583,12 +592,17 @@ func Home(ctx *context.Context) { for _, c := range contributors { user, err := models.GetUserByEmail(c.Email) if err == nil { - contributorInfos = append(contributorInfos, &ContributorInfo{ - user, c.Email, - }) + existedContributorInfo := getContributorInfo(contributorInfos,user.Email) + if existedContributorInfo != nil { + existedContributorInfo.CommitCnt += c.CommitCnt + }else{ + contributorInfos = append(contributorInfos, &ContributorInfo{ + user, user.Email,c.CommitCnt, + }) + } } else { contributorInfos = append(contributorInfos, &ContributorInfo{ - nil, c.Email, + nil, c.Email,c.CommitCnt, }) } } From d0e86b957eed0ec2e39987dae69b1c19ff1d2304 Mon Sep 17 00:00:00 2001 From: zouap Date: Tue, 3 Aug 2021 16:31:03 +0800 Subject: [PATCH 02/30] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E9=9B=86=E5=9B=A2=E9=98=9F=E6=98=BE=E7=A4=BA=E5=8F=8A=E4=B8=8B?= =?UTF-8?q?=E8=BD=BD=E6=8E=A7=E5=88=B6=E9=80=BB=E8=BE=91=EF=BC=8C=E5=8F=A6?= =?UTF-8?q?=E5=A4=96=E5=B0=9D=E8=AF=95=E4=B8=8A=E4=BC=A0=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E9=9B=86=E6=97=B6=E5=8F=8A=E6=97=B6=E5=88=A0=E9=99=A4js?= =?UTF-8?q?=E5=AF=B9=E8=B1=A1=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- routers/repo/attachment.go | 29 +++++++++++++++++++++++++++-- routers/repo/dataset.go | 33 ++++++++++++++++++++++++++++----- web_src/js/components/MinioUploader.vue | 1 + 3 files changed, 56 insertions(+), 7 deletions(-) diff --git a/routers/repo/attachment.go b/routers/repo/attachment.go index b59f4ffc7..a79955e8c 100755 --- a/routers/repo/attachment.go +++ b/routers/repo/attachment.go @@ -141,6 +141,28 @@ func DeleteAttachment(ctx *context.Context) { }) } +func DownloadUserIsOrg(ctx *context.Context, attach *models.Attachment) bool { + dataset, err := models.GetDatasetByID(attach.DatasetID) + if err != nil { + log.Info("query dataset error") + } else { + repo, err := models.GetRepositoryByID(dataset.RepoID) + if err != nil { + log.Info("query repo error.") + } else { + repo.GetOwner() + if repo.Owner.IsOrganization() { + log.Info("ower is org.") + if repo.Owner.IsUserPartOfOrg(ctx.User.ID) { + log.Info("user may be visit the attach.") + return false + } + } + } + } + return true +} + // GetAttachment serve attachements func GetAttachment(ctx *context.Context) { typeCloudBrain := ctx.QueryInt("type") @@ -167,11 +189,14 @@ func GetAttachment(ctx *context.Context) { } if repository == nil { //If not linked - if !(ctx.IsSigned && attach.UploaderID == ctx.User.ID) && attach.IsPrivate { //We block if not the uploader + //if !(ctx.IsSigned && attach.UploaderID == ctx.User.ID) && attach.IsPrivate { //We block if not the uploader + if !(ctx.IsSigned && attach.UploaderID == ctx.User.ID) && DownloadUserIsOrg(ctx, attach) { //We block if not the uploader ctx.Error(http.StatusNotFound) return } + } else { //If we have the repository we check access + perm, err := models.GetUserRepoPermission(repository, ctx.User) if err != nil { ctx.Error(http.StatusInternalServerError, "GetUserRepoPermission", err.Error()) @@ -205,7 +230,7 @@ func GetAttachment(ctx *context.Context) { if setting.Attachment.StoreType == storage.MinioStorageType { url := "" if typeCloudBrain == models.TypeCloudBrainOne { - url, err = storage.Attachments.PresignedGetURL(setting.Attachment.Minio.BasePath + attach.RelativePath(), attach.Name) + url, err = storage.Attachments.PresignedGetURL(setting.Attachment.Minio.BasePath+attach.RelativePath(), attach.Name) if err != nil { ctx.ServerError("PresignedGetURL", err) return diff --git a/routers/repo/dataset.go b/routers/repo/dataset.go index 3be36fbe4..e5bc54b7d 100755 --- a/routers/repo/dataset.go +++ b/routers/repo/dataset.go @@ -1,15 +1,13 @@ package repo import ( - "sort" - - "code.gitea.io/gitea/modules/setting" - "code.gitea.io/gitea/models" "code.gitea.io/gitea/modules/auth" "code.gitea.io/gitea/modules/base" "code.gitea.io/gitea/modules/context" "code.gitea.io/gitea/modules/log" + "code.gitea.io/gitea/modules/setting" + "sort" ) const ( @@ -36,7 +34,32 @@ func filterPrivateAttachments(ctx *context.Context, list []*models.Attachment) [ } return publicList } +} + +func newFilterPrivateAttachments(ctx *context.Context, list []*models.Attachment, repo *models.Repository) []*models.Attachment { + if ctx.Repo.CanWrite(models.UnitTypeDatasets) { + log.Info("can write.") + return list + } else { + var publicList []*models.Attachment + for _, attach := range list { + if !attach.IsPrivate { + publicList = append(publicList, attach) + } else { + if repo.Owner == nil { + repo.GetOwner() + } + if repo.Owner.IsOrganization() { + if repo.Owner.IsUserPartOfOrg(ctx.User.ID) { + log.Info("user is member of org.") + publicList = append(publicList, attach) + } + } + } + } + return publicList + } } func DatasetIndex(ctx *context.Context) { @@ -60,7 +83,7 @@ func DatasetIndex(ctx *context.Context) { ctx.ServerError("GetDatasetAttachments", err) return } - attachments := filterPrivateAttachments(ctx, dataset.Attachments) + attachments := newFilterPrivateAttachments(ctx, dataset.Attachments, repo) ctx.Data["SortType"] = ctx.Query("sort") switch ctx.Query("sort") { diff --git a/web_src/js/components/MinioUploader.vue b/web_src/js/components/MinioUploader.vue index 9d845650a..1dc92e4b3 100755 --- a/web_src/js/components/MinioUploader.vue +++ b/web_src/js/components/MinioUploader.vue @@ -335,6 +335,7 @@ export default { async function uploadMinio(url, e) { const res = await axios.put(url, e.target.result); + delete e.target.result etags[currentChunk] = res.headers.etag; } From 89d699987664cc6e5334886517fe4fc10c5a56a9 Mon Sep 17 00:00:00 2001 From: zouap Date: Tue, 3 Aug 2021 16:51:44 +0800 Subject: [PATCH 03/30] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=EF=BC=8C=E4=BF=AE=E6=AD=A3=E6=96=B9=E6=B3=95=E5=91=BD=E5=90=8D?= =?UTF-8?q?=E5=B8=A6=E4=BA=86=E8=BF=94=E5=9B=9E=E5=80=BC=E6=B7=B7=E6=B7=86?= =?UTF-8?q?=E9=97=AE=E9=A2=98=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- routers/repo/attachment.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/routers/repo/attachment.go b/routers/repo/attachment.go index a79955e8c..3e92471bb 100755 --- a/routers/repo/attachment.go +++ b/routers/repo/attachment.go @@ -152,15 +152,15 @@ func DownloadUserIsOrg(ctx *context.Context, attach *models.Attachment) bool { } else { repo.GetOwner() if repo.Owner.IsOrganization() { - log.Info("ower is org.") + //log.Info("ower is org.") if repo.Owner.IsUserPartOfOrg(ctx.User.ID) { - log.Info("user may be visit the attach.") - return false + log.Info("user may visit the attach.") + return true } } } } - return true + return false } // GetAttachment serve attachements @@ -190,7 +190,7 @@ func GetAttachment(ctx *context.Context) { if repository == nil { //If not linked //if !(ctx.IsSigned && attach.UploaderID == ctx.User.ID) && attach.IsPrivate { //We block if not the uploader - if !(ctx.IsSigned && attach.UploaderID == ctx.User.ID) && DownloadUserIsOrg(ctx, attach) { //We block if not the uploader + if !(ctx.IsSigned && attach.UploaderID == ctx.User.ID) && !DownloadUserIsOrg(ctx, attach) { //We block if not the uploader ctx.Error(http.StatusNotFound) return } From a36d39ce4dfe7aaf0ce52b8cb8a9fe4de7c193e8 Mon Sep 17 00:00:00 2001 From: zouap Date: Tue, 3 Aug 2021 16:56:33 +0800 Subject: [PATCH 04/30] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=97=A0=E7=94=A8?= =?UTF-8?q?=E7=9A=84=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- routers/repo/dataset.go | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/routers/repo/dataset.go b/routers/repo/dataset.go index e5bc54b7d..53a2969fb 100755 --- a/routers/repo/dataset.go +++ b/routers/repo/dataset.go @@ -22,20 +22,6 @@ func MustEnableDataset(ctx *context.Context) { } } -func filterPrivateAttachments(ctx *context.Context, list []*models.Attachment) []*models.Attachment { - if ctx.Repo.CanWrite(models.UnitTypeDatasets) { - return list - } else { - var publicList []*models.Attachment - for _, attach := range list { - if !attach.IsPrivate { - publicList = append(publicList, attach) - } - } - return publicList - } -} - func newFilterPrivateAttachments(ctx *context.Context, list []*models.Attachment, repo *models.Repository) []*models.Attachment { if ctx.Repo.CanWrite(models.UnitTypeDatasets) { From 69992b0198340572ba207a37c5920bb531ffc730 Mon Sep 17 00:00:00 2001 From: hit172587zpz Date: Tue, 3 Aug 2021 17:35:01 +0800 Subject: [PATCH 05/30] fix issue 185 --- web_src/less/_repository.less | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web_src/less/_repository.less b/web_src/less/_repository.less index 0382595b3..9103d7e24 100644 --- a/web_src/less/_repository.less +++ b/web_src/less/_repository.less @@ -2685,7 +2685,7 @@ tbody.commit-list { width: 1127px; } th .message-wrapper { - max-width: 680px; + max-width: 510px; } } From 43e65fce265c7d6d50f82276f27f421f39937e47 Mon Sep 17 00:00:00 2001 From: lewis <747342561@qq.com> Date: Tue, 3 Aug 2021 19:48:05 +0800 Subject: [PATCH 06/30] fix-186 --- routers/secure/user.go | 15 +++++++++++++++ routers/user/auth.go | 14 +++++++++++++- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/routers/secure/user.go b/routers/secure/user.go index 8c06b0dab..1e88a7381 100755 --- a/routers/secure/user.go +++ b/routers/secure/user.go @@ -104,6 +104,21 @@ func CreateUser(ctx *context.Context, form api.CreateUserOption) { } return } + + err := models.AddEmailAddress(&models.EmailAddress{ + UID: u.ID, + Email: form.Email, + IsActivated: !setting.Service.RegisterEmailConfirm, + }) + + if err != nil { + log.Error("AddEmailAddress failed:%v", err.Error(), ctx.Data["MsgID"]) + ctx.JSON(http.StatusInternalServerError, map[string]string{ + "error_msg": err.Error(), + }) + return + } + log.Trace("Account created (%s): %s", ctx.User.Name, u.Name, ctx.Data["MsgID"]) // Send email notification. diff --git a/routers/user/auth.go b/routers/user/auth.go index dc5c5536b..dd66fcb8b 100755 --- a/routers/user/auth.go +++ b/routers/user/auth.go @@ -1165,7 +1165,19 @@ func SignUpPost(ctx *context.Context, cpt *captcha.Captcha, form auth.RegisterFo } return } - log.Trace("Account created: %s", u.Name) + log.Trace("Account created: %s", u.Name, ctx.Data["MsgID"]) + + err := models.AddEmailAddress(&models.EmailAddress{ + UID: u.ID, + Email: form.Email, + IsActivated: !setting.Service.RegisterEmailConfirm, + }) + + if err != nil { + log.Error("AddEmailAddress failed:%v", err.Error(), ctx.Data["MsgID"]) + ctx.ServerError("AddEmailAddress", err) + return + } // Auto-set admin for the only user. if models.CountUsers() == 1 { From ac942c95f80c425647e217621a1ee3a7e8f2e55d Mon Sep 17 00:00:00 2001 From: hit172587zpz Date: Wed, 4 Aug 2021 10:09:43 +0800 Subject: [PATCH 07/30] fix issue-183 --- options/locale/locale_en-US.ini | 2 +- options/locale/locale_zh-CN.ini | 1 + templates/status/500.tmpl | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index e809a33e8..b81dc9694 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -90,7 +90,7 @@ loading = Loading… error404_index = Request forbidden by administrative rules error500_index = Internal Server Error error404 = The page you are trying to reach either does not exist or you are not authorized to view it. - +error500= Sorry, the site has encountered some problems, we are trying to fix the page, please try again later. [error] occurred = An error has occurred report_message = An error has occurred diff --git a/options/locale/locale_zh-CN.ini b/options/locale/locale_zh-CN.ini index 9747bc7dc..5ac54f6c8 100755 --- a/options/locale/locale_zh-CN.ini +++ b/options/locale/locale_zh-CN.ini @@ -90,6 +90,7 @@ loading=正在加载... error404_index = 您的访问受限! error500_index = 抱歉!您指定的网页无法访问。 error404=您正尝试访问的页面 不存在您尚未被授权 查看该页面。 +error500=抱歉,站点遇到一些问题,我们正尝试修复网页,请您稍后再试。 [error] occurred=发生错误 diff --git a/templates/status/500.tmpl b/templates/status/500.tmpl index e4ea06d3d..ca7336f82 100644 --- a/templates/status/500.tmpl +++ b/templates/status/500.tmpl @@ -6,7 +6,7 @@

{{.i18n.Tr "error500_index"}}

-

{{.i18n.Tr "error404" | Safe}}

+

{{.i18n.Tr "error500" | Safe}}

From fe0e093a1d6189e1ea9259921a4fd9e1c7e8dfde Mon Sep 17 00:00:00 2001 From: zouap Date: Wed, 4 Aug 2021 10:21:40 +0800 Subject: [PATCH 08/30] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E9=9B=86=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E5=A2=9E=E5=8A=A0=E5=8D=8F=E4=BD=9C=E8=80=85=E5=8F=AF?= =?UTF-8?q?=E4=BB=A5=E6=9F=A5=E7=9C=8B=E5=8F=8A=E4=B8=8B=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- routers/repo/attachment.go | 11 ++++++++--- routers/repo/dataset.go | 25 +++++++++++++++++-------- 2 files changed, 25 insertions(+), 11 deletions(-) diff --git a/routers/repo/attachment.go b/routers/repo/attachment.go index 3e92471bb..830f193ee 100755 --- a/routers/repo/attachment.go +++ b/routers/repo/attachment.go @@ -141,7 +141,7 @@ func DeleteAttachment(ctx *context.Context) { }) } -func DownloadUserIsOrg(ctx *context.Context, attach *models.Attachment) bool { +func DownloadUserIsOrgOrCollaboration(ctx *context.Context, attach *models.Attachment) bool { dataset, err := models.GetDatasetByID(attach.DatasetID) if err != nil { log.Info("query dataset error") @@ -154,10 +154,15 @@ func DownloadUserIsOrg(ctx *context.Context, attach *models.Attachment) bool { if repo.Owner.IsOrganization() { //log.Info("ower is org.") if repo.Owner.IsUserPartOfOrg(ctx.User.ID) { - log.Info("user may visit the attach.") + log.Info("org user may visit the attach.") return true } } + isCollaborator, _ := repo.IsCollaborator(ctx.User.ID) + if isCollaborator { + log.Info("Collaborator user may visit the attach.") + return true + } } } return false @@ -190,7 +195,7 @@ func GetAttachment(ctx *context.Context) { if repository == nil { //If not linked //if !(ctx.IsSigned && attach.UploaderID == ctx.User.ID) && attach.IsPrivate { //We block if not the uploader - if !(ctx.IsSigned && attach.UploaderID == ctx.User.ID) && !DownloadUserIsOrg(ctx, attach) { //We block if not the uploader + if !(ctx.IsSigned && attach.UploaderID == ctx.User.ID) && !DownloadUserIsOrgOrCollaboration(ctx, attach) { //We block if not the uploader ctx.Error(http.StatusNotFound) return } diff --git a/routers/repo/dataset.go b/routers/repo/dataset.go index 53a2969fb..8b2f2abd3 100755 --- a/routers/repo/dataset.go +++ b/routers/repo/dataset.go @@ -28,19 +28,28 @@ func newFilterPrivateAttachments(ctx *context.Context, list []*models.Attachment log.Info("can write.") return list } else { + if repo.Owner == nil { + repo.GetOwner() + } + permission := false + if repo.Owner.IsOrganization() { + if repo.Owner.IsUserPartOfOrg(ctx.User.ID) { + log.Info("user is member of org.") + permission = true + } + } + isCollaborator, _ := repo.IsCollaborator(ctx.User.ID) + if isCollaborator { + log.Info("Collaborator user may visit the attach.") + permission = true + } var publicList []*models.Attachment for _, attach := range list { if !attach.IsPrivate { publicList = append(publicList, attach) } else { - if repo.Owner == nil { - repo.GetOwner() - } - if repo.Owner.IsOrganization() { - if repo.Owner.IsUserPartOfOrg(ctx.User.ID) { - log.Info("user is member of org.") - publicList = append(publicList, attach) - } + if permission { + publicList = append(publicList, attach) } } } From c4cff584dfd284d105b3cbd6b2b47c8173da11d9 Mon Sep 17 00:00:00 2001 From: hit172587zpz Date: Wed, 4 Aug 2021 10:28:11 +0800 Subject: [PATCH 09/30] fix issue-180 --- templates/home.tmpl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/templates/home.tmpl b/templates/home.tmpl index 35790cbba..3ac2935d5 100755 --- a/templates/home.tmpl +++ b/templates/home.tmpl @@ -127,7 +127,7 @@
- 开发要素统一管理 + 开发要素统一管理
平台提供了AI开发四大要素:模型代码、数据集、模型和执行环境的统一管理
@@ -138,7 +138,7 @@
- 数据协同与共享 + 数据协同与共享
通过在项目中上传数据集,项目成员多人协作完成数据预处理;也可以通过将数据设置为公有数据集,与社区开发者共同建立更好的模型
@@ -149,7 +149,7 @@
- 模型管理与共享 + 模型管理与共享
将模型与代码版本建立关联,可以基于代码历史版本,使用不同的方式调整模型,并将结果保存下来;训练好的模型可以开放共享,让更多人的使用模型测试并提出反馈
@@ -160,7 +160,7 @@
- 一次配置,多次使用 + 一次配置,多次使用
提供执行环境共享,一次配置,多次使用,降低模型开发门槛,避免花费重复的时间配置复杂的环境
From 555330464c6b9d8d68577bc8be6efc4c376d4b16 Mon Sep 17 00:00:00 2001 From: zouap Date: Wed, 4 Aug 2021 10:34:30 +0800 Subject: [PATCH 10/30] =?UTF-8?q?-m=E5=A2=9E=E5=8A=A0=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E9=9B=86=E5=8D=8F=E4=BD=9C=E8=80=85=E6=98=BE=E7=A4=BA=E5=8F=8A?= =?UTF-8?q?=E4=B8=8B=E8=BD=BD=E6=9D=83=E9=99=90=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- routers/repo/dataset.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/routers/repo/dataset.go b/routers/repo/dataset.go index 8b2f2abd3..bdadd2066 100755 --- a/routers/repo/dataset.go +++ b/routers/repo/dataset.go @@ -38,11 +38,14 @@ func newFilterPrivateAttachments(ctx *context.Context, list []*models.Attachment permission = true } } - isCollaborator, _ := repo.IsCollaborator(ctx.User.ID) - if isCollaborator { - log.Info("Collaborator user may visit the attach.") - permission = true + if !permission { + isCollaborator, _ := repo.IsCollaborator(ctx.User.ID) + if isCollaborator { + log.Info("Collaborator user may visit the attach.") + permission = true + } } + var publicList []*models.Attachment for _, attach := range list { if !attach.IsPrivate { From f628b36ce8618ab602510d483f506227975bc7e0 Mon Sep 17 00:00:00 2001 From: hit172587zpz Date: Wed, 4 Aug 2021 11:15:56 +0800 Subject: [PATCH 11/30] fix issue-182 --- templates/repo/home.tmpl | 40 ++++++++++++++++++++++++++++++++-------- 1 file changed, 32 insertions(+), 8 deletions(-) diff --git a/templates/repo/home.tmpl b/templates/repo/home.tmpl index 7d632ea14..f1c47167e 100644 --- a/templates/repo/home.tmpl +++ b/templates/repo/home.tmpl @@ -155,37 +155,61 @@
-

简介

+

简介 + +

- {{if .Repository.DescriptionHTML}} - {{.Repository.DescriptionHTML}} - {{else}} - {{.i18n.Tr "repo.no_desc"}} - {{end}} - {{.Repository.Website}} + {{if .Repository.DescriptionHTML}} + {{.Repository.DescriptionHTML}} + {{else}} + {{.i18n.Tr "repo.no_desc"}} + {{end}} +

+
+ + + {{if .Repository.Website}} +

+ + {{.Repository.Website}} +

+ {{else}} + + {{end}} +

{{range .Topics}}{{.Name}}{{end}} {{if and .Permission.IsAdmin (not .Repository.IsArchived)}}{{.i18n.Tr "repo.topic.manage_topics"}}{{end}}

- + {{if .LanguageStats}}

{{range .LanguageStats}} {{.Language}} {{end}}

+ + {{else}} + + {{end}} + {{if .LICENSE}}

{{if .LICENSE}} {{.LICENSE}} {{end}}

+ {{else}} + + {{end}}
From 77c40c7889046e80959449bff1d1ad610520d2dd Mon Sep 17 00:00:00 2001 From: avadesian Date: Wed, 4 Aug 2021 11:26:42 +0800 Subject: [PATCH 12/30] merge duplicate committers who are not system users --- routers/repo/view.go | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/routers/repo/view.go b/routers/repo/view.go index 5c116285f..945f6b0e0 100644 --- a/routers/repo/view.go +++ b/routers/repo/view.go @@ -590,20 +590,31 @@ func Home(ctx *context.Context) { if err == nil && contributors != nil { var contributorInfos []*ContributorInfo for _, c := range contributors { + // get user info from committer email user, err := models.GetUserByEmail(c.Email) if err == nil { + // committer is system user, get info through user's primary email existedContributorInfo := getContributorInfo(contributorInfos,user.Email) if existedContributorInfo != nil { + // existed: same primary email, different committer name existedContributorInfo.CommitCnt += c.CommitCnt }else{ + // new committer info contributorInfos = append(contributorInfos, &ContributorInfo{ user, user.Email,c.CommitCnt, }) } } else { - contributorInfos = append(contributorInfos, &ContributorInfo{ - nil, c.Email,c.CommitCnt, - }) + // committer is not system user + existedContributorInfo := getContributorInfo(contributorInfos,c.Email) + if existedContributorInfo != nil { + // existed: same primary email, different committer name + existedContributorInfo.CommitCnt += c.CommitCnt + }else{ + contributorInfos = append(contributorInfos, &ContributorInfo{ + nil, c.Email,c.CommitCnt, + }) + } } } ctx.Data["ContributorInfo"] = contributorInfos From cad94c529c4b190efbffcb32fd04519021cbd95b Mon Sep 17 00:00:00 2001 From: lewis <747342561@qq.com> Date: Wed, 4 Aug 2021 14:33:21 +0800 Subject: [PATCH 13/30] fix --- modules/convert/convert.go | 1 + modules/structs/user.go | 2 ++ 2 files changed, 3 insertions(+) mode change 100644 => 100755 modules/convert/convert.go mode change 100644 => 100755 modules/structs/user.go diff --git a/modules/convert/convert.go b/modules/convert/convert.go old mode 100644 new mode 100755 index ec18b1305..fa2e8f2e7 --- a/modules/convert/convert.go +++ b/modules/convert/convert.go @@ -335,6 +335,7 @@ func ToUser(user *models.User, signed, authed bool) *api.User { AvatarURL: user.AvatarLink(), FullName: markup.Sanitize(user.FullName), Created: user.CreatedUnix.AsTime(), + IsActive: user.IsActive, } // hide primary email if API caller is anonymous or user keep email private if signed && (!user.KeepEmailPrivate || authed) { diff --git a/modules/structs/user.go b/modules/structs/user.go old mode 100644 new mode 100755 index bf52cc9ed..d6e7298cc --- a/modules/structs/user.go +++ b/modules/structs/user.go @@ -26,6 +26,8 @@ type User struct { Language string `json:"language"` // Is the user an administrator IsAdmin bool `json:"is_admin"` + // Is the user active + IsActive bool `json:"is_active"` // swagger:strfmt date-time LastLogin time.Time `json:"last_login,omitempty"` // swagger:strfmt date-time From db6cf3ee40894e1c1d011756bf99a9578c435bc7 Mon Sep 17 00:00:00 2001 From: lewis <747342561@qq.com> Date: Wed, 4 Aug 2021 16:14:15 +0800 Subject: [PATCH 14/30] fix left problem of 186 --- models/user_mail.go | 12 ++++++++++++ routers/user/auth.go | 9 +++++++++ routers/user/setting/profile.go | 12 ++++++++++++ 3 files changed, 33 insertions(+) mode change 100644 => 100755 models/user_mail.go mode change 100644 => 100755 routers/user/setting/profile.go diff --git a/models/user_mail.go b/models/user_mail.go old mode 100644 new mode 100755 index af9602e71..7244ec378 --- a/models/user_mail.go +++ b/models/user_mail.go @@ -80,6 +80,18 @@ func GetEmailAddressByID(uid, id int64) (*EmailAddress, error) { return email, nil } +// GetEmailAddressByIDAndEmail gets a user's email address by ID and email +func GetEmailAddressByIDAndEmail(uid int64, emailAddr string) (*EmailAddress, error) { + // User ID is required for security reasons + email := &EmailAddress{UID: uid, Email: emailAddr} + if has, err := x.Get(email); err != nil { + return nil, err + } else if !has { + return nil, nil + } + return email, nil +} + func isEmailActive(e Engine, email string, userID, emailID int64) (bool, error) { if len(email) == 0 { return true, nil diff --git a/routers/user/auth.go b/routers/user/auth.go index dd66fcb8b..13e338565 100755 --- a/routers/user/auth.go +++ b/routers/user/auth.go @@ -1266,6 +1266,15 @@ func Activate(ctx *context.Context) { log.Error("Error storing session: %v", err) } + email, err := models.GetEmailAddressByIDAndEmail(user.ID, user.Email) + if err != nil || email == nil{ + log.Error("GetEmailAddressByIDAndEmail failed", ctx.Data["MsgID"]) + } else { + if err := email.Activate(); err != nil { + log.Error("Activate failed: %v", err, ctx.Data["MsgID"]) + } + } + ctx.Flash.Success(ctx.Tr("auth.account_activated")) ctx.Redirect(setting.AppSubURL + "/") return diff --git a/routers/user/setting/profile.go b/routers/user/setting/profile.go old mode 100644 new mode 100755 index d6f25f913..a385f2cac --- a/routers/user/setting/profile.go +++ b/routers/user/setting/profile.go @@ -96,6 +96,18 @@ func ProfilePost(ctx *context.Context, form auth.UpdateProfileForm) { ctx.User.Location = form.Location ctx.User.Language = form.Language ctx.User.Description = form.Description + isUsed, err := models.IsEmailUsed(form.Email) + if err != nil { + ctx.ServerError("IsEmailUsed", err) + return + } + + if isUsed { + ctx.Flash.Error(ctx.Tr("form.email_been_used")) + ctx.Redirect(setting.AppSubURL + "/user/settings") + return + } + if err := models.UpdateUserSetting(ctx.User); err != nil { if _, ok := err.(models.ErrEmailAlreadyUsed); ok { ctx.Flash.Error(ctx.Tr("form.email_been_used")) From 374ae4611bdd2d1d26ff1687f2e0b0bc1f2870de Mon Sep 17 00:00:00 2001 From: OpenIhu Date: Wed, 4 Aug 2021 17:24:28 +0800 Subject: [PATCH 15/30] =?UTF-8?q?ContributorInfo=E8=B6=85=E8=BF=873?= =?UTF-8?q?=E4=B8=AA=E6=8A=98=E5=8F=A0=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- templates/repo/home.tmpl | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/templates/repo/home.tmpl b/templates/repo/home.tmpl index 7d632ea14..8065ce12d 100644 --- a/templates/repo/home.tmpl +++ b/templates/repo/home.tmpl @@ -193,13 +193,16 @@

贡献者 ({{len .ContributorInfo}})

- -
+ +
{{range .ContributorInfo}} - {{/*  {{.UserInfo.Name}}*/}} {{if .UserInfo}} {{else if .Email}} @@ -215,4 +218,12 @@
+ + {{template "base/footer" .}} From f1ef62479d1443a1d4e1f0f78c2750a56faf03c9 Mon Sep 17 00:00:00 2001 From: lewis <747342561@qq.com> Date: Wed, 4 Aug 2021 17:35:37 +0800 Subject: [PATCH 16/30] mod err msg --- routers/routes/routes.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/routers/routes/routes.go b/routers/routes/routes.go index 100ff009f..b3565878e 100755 --- a/routers/routes/routes.go +++ b/routers/routes/routes.go @@ -1129,7 +1129,7 @@ func RegisterRoutes(m *macaron.Macaron) { //secure api, m.Group("/secure", func() { - m.Post("/user", binding.Bind(structs.CreateUserOption{}), secure.CreateUser) + m.Post("/user", binding.BindIgnErr(structs.CreateUserOption{}), secure.CreateUser) }, reqBasicAuth) m.Group("/api/internal", func() { From 4945ca4bdba7a96dce61778c72dfd28a5be9974e Mon Sep 17 00:00:00 2001 From: OpenIhu Date: Wed, 4 Aug 2021 21:28:16 +0800 Subject: [PATCH 17/30] =?UTF-8?q?=E8=B0=83=E6=95=B4ContributorInfo?= =?UTF-8?q?=E8=B6=85=E8=BF=8725=E4=B8=AA=E6=8A=98=E5=8F=A0=EF=BC=8C?= =?UTF-8?q?=E5=B9=B6=E8=B0=83=E6=95=B4=E9=82=AE=E4=BB=B6=E8=81=94=E7=B3=BB?= =?UTF-8?q?=E8=80=85=E6=98=BE=E7=A4=BA=E9=A3=8E=E6=A0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- templates/repo/home.tmpl | 53 ++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 45 insertions(+), 8 deletions(-) diff --git a/templates/repo/home.tmpl b/templates/repo/home.tmpl index 8065ce12d..a7eb085de 100644 --- a/templates/repo/home.tmpl +++ b/templates/repo/home.tmpl @@ -4,6 +4,48 @@ font-size: 1.0em; margin-bottom: 1.0rem; } +#contributorInfo > a:nth-child(n+25){ + display:none; +} +#contributorInfo > a{ + width: 2.0em; + float: left; + margin: .25em; +} +#contributorInfo > a.circular{ + height: 2.0em; + padding: 0; + overflow: hidden; + letter-spacing:1.0em; + text-indent: 0.6em; + line-height: 2.0em; + text-transform:capitalize; + color: #FFF; +} +#contributorInfo > a.circular:nth-child(9n+1){ + background-color: #00ADD8; +} +#contributorInfo > a.circular:nth-child(9n+2){ + background-color: #796218; +} +#contributorInfo > a.circular:nth-child(9n+3){ + background-color: #772c5a; +} +#contributorInfo > a.circular:nth-child(9n+4){ + background-color: #33225c; +} +#contributorInfo > a.circular:nth-child(9n+5){ + background-color: #146e5b; +} +#contributorInfo > a.circular:nth-child(9n+6){ + background-color: #26557c; +} +#contributorInfo > a.circular:nth-child(9n+7){ + background-color: #5c223a; +} +#contributorInfo > a.circular:nth-child(9n+8){ + background-color: #3f5720; +}
{{template "repo/header" .}} @@ -196,17 +238,12 @@ 全部 {{svg "octicon-chevron-right" 16}}
-
{{range .ContributorInfo}} {{if .UserInfo}} - + {{else if .Email}} - + {{.Email}} {{end}} {{end}}
@@ -222,7 +259,7 @@ From 29ed7e81bca9fb0c6dba0a8dd52837017fc530c4 Mon Sep 17 00:00:00 2001 From: OpenIhu Date: Wed, 4 Aug 2021 21:41:22 +0800 Subject: [PATCH 18/30] =?UTF-8?q?=E8=B0=83=E6=95=B4ContributorInfo?= =?UTF-8?q?=E9=82=AE=E4=BB=B6=E8=81=94=E7=B3=BB=E8=80=85=E5=A4=B4=E5=83=8F?= =?UTF-8?q?=E9=A3=8E=E6=A0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- templates/repo/home.tmpl | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/templates/repo/home.tmpl b/templates/repo/home.tmpl index a7eb085de..75cee742e 100644 --- a/templates/repo/home.tmpl +++ b/templates/repo/home.tmpl @@ -23,28 +23,28 @@ color: #FFF; } #contributorInfo > a.circular:nth-child(9n+1){ - background-color: #00ADD8; + background-color: #4ccdec; } #contributorInfo > a.circular:nth-child(9n+2){ - background-color: #796218; + background-color: #e0b265; } #contributorInfo > a.circular:nth-child(9n+3){ - background-color: #772c5a; + background-color: #d884b7; } #contributorInfo > a.circular:nth-child(9n+4){ - background-color: #33225c; + background-color: #8c6bdc; } #contributorInfo > a.circular:nth-child(9n+5){ - background-color: #146e5b; + background-color: #3cb99f; } #contributorInfo > a.circular:nth-child(9n+6){ - background-color: #26557c; + background-color: #6995b9; } #contributorInfo > a.circular:nth-child(9n+7){ - background-color: #5c223a; + background-color: #ab91a7; } #contributorInfo > a.circular:nth-child(9n+8){ - background-color: #3f5720; + background-color: #bfd0aa; }
From 0344e2ca388b346b764d9f69627c7fb2cca571fa Mon Sep 17 00:00:00 2001 From: hit172587zpz Date: Thu, 5 Aug 2021 09:34:31 +0800 Subject: [PATCH 19/30] modified the issue 182 --- package-lock.json | 48 +++++++++++++ package.json | 1 + templates/repo/home.tmpl | 2 +- web_src/js/components/EditAboutInfo.vue | 96 ++++++++++++++++++++++++++ web_src/js/components/basic/editDialog.vue | 104 +++++++++++++++++++++++++++++ web_src/js/index.js | 20 +++++- 6 files changed, 269 insertions(+), 2 deletions(-) create mode 100644 web_src/js/components/EditAboutInfo.vue create mode 100644 web_src/js/components/basic/editDialog.vue diff --git a/package-lock.json b/package-lock.json index 2c3c983e6..b0b0acad0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1841,6 +1841,14 @@ "async-done": "^1.2.2" } }, + "async-validator": { + "version": "1.8.5", + "resolved": "https://registry.npmjs.org/async-validator/-/async-validator-1.8.5.tgz", + "integrity": "sha512-tXBM+1m056MAX0E8TL2iCjg8WvSyXu0Zc8LNtYqrVeyoL3+esHRZ4SieE9fKQyyU09uONjnMEjrNBMqT0mbvmA==", + "requires": { + "babel-runtime": "6.x" + } + }, "asynckit": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", @@ -1934,6 +1942,11 @@ } } }, + "babel-helper-vue-jsx-merge-props": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/babel-helper-vue-jsx-merge-props/-/babel-helper-vue-jsx-merge-props-2.0.3.tgz", + "integrity": "sha512-gsLiKK7Qrb7zYJNgiXKpXblxbV5ffSwR0f5whkPAaBAR4fhi6bwRZxX9wBlIc5M/v8CCkXUbXZL4N/nSE97cqg==" + }, "babel-loader": { "version": "8.1.0", "resolved": "https://registry.npmjs.org/babel-loader/-/babel-loader-8.1.0.tgz", @@ -3882,6 +3895,26 @@ "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.437.tgz", "integrity": "sha512-PBQn2q68ErqMyBUABh9Gh8R6DunGky8aB5y3N5lPM7OVpldwyUbAK5AX9WcwE/5F6ceqvQ+iQLYkJYRysAs6Bg==" }, + "element-ui": { + "version": "2.15.5", + "resolved": "https://registry.npmjs.org/element-ui/-/element-ui-2.15.5.tgz", + "integrity": "sha512-B/YCdz2aRY2WnFXzbTRTHPKZHBD/2KV6u88EBnkaARC/Lyxnap+7vpvrcW5UNTyVwjItS5Fj1eQyRy6236lbXg==", + "requires": { + "async-validator": "~1.8.1", + "babel-helper-vue-jsx-merge-props": "^2.0.0", + "deepmerge": "^1.2.0", + "normalize-wheel": "^1.0.1", + "resize-observer-polyfill": "^1.5.0", + "throttle-debounce": "^1.0.1" + }, + "dependencies": { + "deepmerge": { + "version": "1.5.2", + "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-1.5.2.tgz", + "integrity": "sha512-95k0GDqvBjZavkuvzx/YqVLv/6YYa17fz6ILMSf7neqQITCPbnfEnQvEgMPNjH4kgobe7+WIL0yJEHku+H3qtQ==" + } + } + }, "elliptic": { "version": "6.5.4", "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.4.tgz", @@ -9186,6 +9219,11 @@ "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-3.3.0.tgz", "integrity": "sha512-U+JJi7duF1o+u2pynbp2zXDW2/PADgC30f0GsHZtRh+HOcXHnw137TrNlyxxRvWW5fjKd3bcLHPxofWuCjaeZg==" }, + "normalize-wheel": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/normalize-wheel/-/normalize-wheel-1.0.1.tgz", + "integrity": "sha1-rsiGr/2wRQcNhWRH32Ls+GFG7EU=" + }, "now-and-later": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/now-and-later/-/now-and-later-2.0.1.tgz", @@ -11687,6 +11725,11 @@ "resolved": "https://registry.npmjs.org/reselect/-/reselect-4.0.0.tgz", "integrity": "sha512-qUgANli03jjAyGlnbYVAV5vvnOmJnODyABz51RdBN7M4WaVu8mecZWgyQNkG8Yqe3KRGRt0l4K4B3XVEULC4CA==" }, + "resize-observer-polyfill": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/resize-observer-polyfill/-/resize-observer-polyfill-1.5.1.tgz", + "integrity": "sha512-LwZrotdHOo12nQuZlHEmtuXdqGoOD0OhaxopaNFxWzInpEgaLWoVuAMbTzixuosCx2nEG58ngzW3vxdWoxIgdg==" + }, "resolve": { "version": "1.17.0", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.17.0.tgz", @@ -13526,6 +13569,11 @@ "resolved": "https://registry.npmjs.org/textextensions/-/textextensions-2.6.0.tgz", "integrity": "sha512-49WtAWS+tcsy93dRt6P0P3AMD2m5PvXRhuEA0kaXos5ZLlujtYmpmFsB+QvWUSxE1ZsstmYXfQ7L40+EcQgpAQ==" }, + "throttle-debounce": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/throttle-debounce/-/throttle-debounce-1.1.0.tgz", + "integrity": "sha512-XH8UiPCQcWNuk2LYePibW/4qL97+ZQ1AN3FNXwZRBNPPowo/NRU5fAlDCSNBJIYCKbioZfuYtMhG4quqoJhVzg==" + }, "through": { "version": "2.3.8", "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", diff --git a/package.json b/package.json index 4afc213e7..bda9843e8 100644 --- a/package.json +++ b/package.json @@ -19,6 +19,7 @@ "cssnano": "4.1.10", "domino": "2.1.5", "dropzone": "5.7.2", + "element-ui": "2.15.5", "esdk-obs-browserjs": "3.20.7", "esdk-obs-nodejs": "3.20.11", "fast-glob": "3.2.2", diff --git a/templates/repo/home.tmpl b/templates/repo/home.tmpl index f1c47167e..5e33aa7be 100644 --- a/templates/repo/home.tmpl +++ b/templates/repo/home.tmpl @@ -155,7 +155,7 @@
-

简介 +

简介 diff --git a/web_src/js/components/EditAboutInfo.vue b/web_src/js/components/EditAboutInfo.vue new file mode 100644 index 000000000..53e4915a0 --- /dev/null +++ b/web_src/js/components/EditAboutInfo.vue @@ -0,0 +1,96 @@ + + + + + diff --git a/web_src/js/components/basic/editDialog.vue b/web_src/js/components/basic/editDialog.vue new file mode 100644 index 000000000..810a73a11 --- /dev/null +++ b/web_src/js/components/basic/editDialog.vue @@ -0,0 +1,104 @@ + + + + diff --git a/web_src/js/index.js b/web_src/js/index.js index 1a4326f7d..e7e57d1b9 100755 --- a/web_src/js/index.js +++ b/web_src/js/index.js @@ -6,6 +6,8 @@ import './publicpath.js'; import './polyfills.js'; import Vue from 'vue'; +import ElementUI from 'element-ui'; +import 'element-ui/lib/theme-chalk/index.css'; import 'jquery.are-you-sure'; import './vendor/semanticdropdown.js'; import {svg} from './utils.js'; @@ -29,8 +31,10 @@ import { } from './features/notification.js'; import {createCodeEditor} from './features/codeeditor.js'; import MinioUploader from './components/MinioUploader.vue'; -import ObsUploader from './components/ObsUploader.vue' +import ObsUploader from './components/ObsUploader.vue'; +import EditAboutInfo from './components/EditAboutInfo.vue'; +Vue.use(ElementUI); const {AppSubUrl, StaticUrlPrefix, csrf} = window.config; function htmlEncode(text) { @@ -2957,6 +2961,7 @@ $(document).ready(async () => { initVueApp(); initVueUploader(); initObsUploader(); + initVueEditAbout(); initTeamSettings(); initCtrlEnterSubmit(); initNavbarContentToggle(); @@ -3642,6 +3647,19 @@ function initVueUploader() { }); } +function initVueEditAbout() { + const el = document.getElementById('about-desc'); + console.log(el) + if (!el) { + return; + } + + new Vue({ + el: '#about-desc', + render: h => h(EditAboutInfo) + }); +} + // 新增 function initObsUploader() { const el = document.getElementById('obsUploader'); From c9f19b30baf5680ef4a6f35734bcb554e2af7995 Mon Sep 17 00:00:00 2001 From: hit172587zpz Date: Thu, 5 Aug 2021 09:37:15 +0800 Subject: [PATCH 20/30] fix bug --- templates/repo/home.tmpl | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/templates/repo/home.tmpl b/templates/repo/home.tmpl index 5e33aa7be..a50b6e83f 100644 --- a/templates/repo/home.tmpl +++ b/templates/repo/home.tmpl @@ -178,8 +178,8 @@ {{.Repository.Website}}

- {{else}} - + {{end}}

@@ -196,19 +196,19 @@ {{end}}

- {{else}} - + {{end}} {{if .LICENSE}}

- {{if .LICENSE}} + {{.LICENSE}} - {{end}} +

- {{else}} - + {{end}}
From f368edf4bdd35266bedbfb7dcdc453a8b4f25431 Mon Sep 17 00:00:00 2001 From: hit172587zpz Date: Thu, 5 Aug 2021 09:42:54 +0800 Subject: [PATCH 21/30] modified the issue --- templates/home.tmpl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/templates/home.tmpl b/templates/home.tmpl index 3ac2935d5..97a2a7fc9 100755 --- a/templates/home.tmpl +++ b/templates/home.tmpl @@ -127,7 +127,7 @@

- 开发要素统一管理 +

开发要素统一管理

平台提供了AI开发四大要素:模型代码、数据集、模型和执行环境的统一管理
@@ -138,7 +138,7 @@
- 数据协同与共享 +

数据协同与共享

通过在项目中上传数据集,项目成员多人协作完成数据预处理;也可以通过将数据设置为公有数据集,与社区开发者共同建立更好的模型
@@ -149,7 +149,7 @@
- 模型管理与共享 +

模型管理与共享

将模型与代码版本建立关联,可以基于代码历史版本,使用不同的方式调整模型,并将结果保存下来;训练好的模型可以开放共享,让更多人的使用模型测试并提出反馈
@@ -160,7 +160,7 @@
- 一次配置,多次使用 +

一次配置,多次使用

提供执行环境共享,一次配置,多次使用,降低模型开发门槛,避免花费重复的时间配置复杂的环境
From b93808dddf02f318905d289c92607376efff06ff Mon Sep 17 00:00:00 2001 From: zouap Date: Thu, 5 Aug 2021 10:48:03 +0800 Subject: [PATCH 22/30] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=B8=B8=E5=AE=A2?= =?UTF-8?q?=E8=AE=BF=E9=97=AE=E6=97=B6=EF=BC=8C=E7=94=A8=E6=88=B7=E4=BF=A1?= =?UTF-8?q?=E6=81=AF=E4=B8=BA=E7=A9=BA=E7=9A=84=E6=83=85=E5=86=B5=E5=88=A4?= =?UTF-8?q?=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- routers/repo/attachment.go | 19 ++++++++++--------- routers/repo/dataset.go | 4 ++-- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/routers/repo/attachment.go b/routers/repo/attachment.go index 830f193ee..6fa89420d 100755 --- a/routers/repo/attachment.go +++ b/routers/repo/attachment.go @@ -151,18 +151,19 @@ func DownloadUserIsOrgOrCollaboration(ctx *context.Context, attach *models.Attac log.Info("query repo error.") } else { repo.GetOwner() - if repo.Owner.IsOrganization() { - //log.Info("ower is org.") - if repo.Owner.IsUserPartOfOrg(ctx.User.ID) { - log.Info("org user may visit the attach.") + if ctx.User != nil { + if repo.Owner.IsOrganization() { + if repo.Owner.IsUserPartOfOrg(ctx.User.ID) { + log.Info("org user may visit the attach.") + return true + } + } + isCollaborator, _ := repo.IsCollaborator(ctx.User.ID) + if isCollaborator { + log.Info("Collaborator user may visit the attach.") return true } } - isCollaborator, _ := repo.IsCollaborator(ctx.User.ID) - if isCollaborator { - log.Info("Collaborator user may visit the attach.") - return true - } } } return false diff --git a/routers/repo/dataset.go b/routers/repo/dataset.go index bdadd2066..b2da4b8d8 100755 --- a/routers/repo/dataset.go +++ b/routers/repo/dataset.go @@ -32,13 +32,13 @@ func newFilterPrivateAttachments(ctx *context.Context, list []*models.Attachment repo.GetOwner() } permission := false - if repo.Owner.IsOrganization() { + if repo.Owner.IsOrganization() && ctx.User != nil { if repo.Owner.IsUserPartOfOrg(ctx.User.ID) { log.Info("user is member of org.") permission = true } } - if !permission { + if !permission && ctx.User != nil { isCollaborator, _ := repo.IsCollaborator(ctx.User.ID) if isCollaborator { log.Info("Collaborator user may visit the attach.") From cafa013fa58fdfb95d1c45ec80f82c9a51310663 Mon Sep 17 00:00:00 2001 From: zouap Date: Thu, 5 Aug 2021 11:32:04 +0800 Subject: [PATCH 23/30] =?UTF-8?q?=E5=BD=93=E6=95=B0=E6=8D=AE=E9=9B=86?= =?UTF-8?q?=E6=98=AF=E5=85=AC=E6=9C=89=E6=97=B6=EF=BC=8C=E4=B8=94=E7=99=BB?= =?UTF-8?q?=E5=BD=95=E7=94=A8=E6=88=B7=E5=A6=82=E6=9E=9C=E8=83=BD=E7=9C=8B?= =?UTF-8?q?=E5=88=B0=EF=BC=8C=E9=82=A3=E4=B9=88=E5=B0=B1=E5=8F=AF=E4=BB=A5?= =?UTF-8?q?=E4=B8=8B=E8=BD=BD=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- routers/repo/attachment.go | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/routers/repo/attachment.go b/routers/repo/attachment.go index 6fa89420d..ed9f7c47e 100755 --- a/routers/repo/attachment.go +++ b/routers/repo/attachment.go @@ -177,7 +177,6 @@ func GetAttachment(ctx *context.Context) { ctx.ServerError("checkTypeCloudBrain failed", err) return } - attach, err := models.GetAttachmentByUUID(ctx.Params(":uuid")) if err != nil { if models.IsErrAttachmentNotExist(err) { @@ -187,22 +186,19 @@ func GetAttachment(ctx *context.Context) { } return } - repository, unitType, err := attach.LinkedRepository() if err != nil { ctx.ServerError("LinkedRepository", err) return } - if repository == nil { //If not linked //if !(ctx.IsSigned && attach.UploaderID == ctx.User.ID) && attach.IsPrivate { //We block if not the uploader - if !(ctx.IsSigned && attach.UploaderID == ctx.User.ID) && !DownloadUserIsOrgOrCollaboration(ctx, attach) { //We block if not the uploader + if !(ctx.IsSigned && attach.UploaderID == ctx.User.ID) && attach.IsPrivate && !DownloadUserIsOrgOrCollaboration(ctx, attach) { //We block if not the uploader ctx.Error(http.StatusNotFound) return } } else { //If we have the repository we check access - perm, err := models.GetUserRepoPermission(repository, ctx.User) if err != nil { ctx.Error(http.StatusInternalServerError, "GetUserRepoPermission", err.Error()) @@ -213,7 +209,6 @@ func GetAttachment(ctx *context.Context) { return } } - dataSet, err := attach.LinkedDataSet() if err != nil { ctx.ServerError("LinkedDataSet", err) From eebd5aa32bac4540ac9ac1170c02f0ea30fe0f4d Mon Sep 17 00:00:00 2001 From: zouap Date: Thu, 5 Aug 2021 16:32:31 +0800 Subject: [PATCH 24/30] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E5=88=9B=E5=BB=BA=E8=80=85=E4=B8=8D=E8=83=BD=E4=B8=8B=E8=BD=BD?= =?UTF-8?q?=20=E5=8D=8F=E4=BD=9C=E8=80=85=E4=B8=8A=E4=BC=A0=E7=9A=84?= =?UTF-8?q?=E7=A7=81=E6=9C=89=E6=95=B0=E6=8D=AE=E9=9B=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- routers/repo/attachment.go | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/routers/repo/attachment.go b/routers/repo/attachment.go index ed9f7c47e..cdb73c8a0 100755 --- a/routers/repo/attachment.go +++ b/routers/repo/attachment.go @@ -152,6 +152,7 @@ func DownloadUserIsOrgOrCollaboration(ctx *context.Context, attach *models.Attac } else { repo.GetOwner() if ctx.User != nil { + if repo.Owner.IsOrganization() { if repo.Owner.IsUserPartOfOrg(ctx.User.ID) { log.Info("org user may visit the attach.") @@ -177,6 +178,7 @@ func GetAttachment(ctx *context.Context) { ctx.ServerError("checkTypeCloudBrain failed", err) return } + attach, err := models.GetAttachmentByUUID(ctx.Params(":uuid")) if err != nil { if models.IsErrAttachmentNotExist(err) { @@ -186,22 +188,31 @@ func GetAttachment(ctx *context.Context) { } return } + repository, unitType, err := attach.LinkedRepository() if err != nil { ctx.ServerError("LinkedRepository", err) return } + dataSet, err := attach.LinkedDataSet() + + if repository == nil && dataSet != nil { + repository, _ = models.GetRepositoryByID(dataSet.RepoID) + unitType = models.UnitTypeDatasets + } + if repository == nil { //If not linked //if !(ctx.IsSigned && attach.UploaderID == ctx.User.ID) && attach.IsPrivate { //We block if not the uploader + //log.Info("ctx.IsSigned =" + fmt.Sprintf("%v", ctx.IsSigned)) if !(ctx.IsSigned && attach.UploaderID == ctx.User.ID) && attach.IsPrivate && !DownloadUserIsOrgOrCollaboration(ctx, attach) { //We block if not the uploader ctx.Error(http.StatusNotFound) return } } else { //If we have the repository we check access - perm, err := models.GetUserRepoPermission(repository, ctx.User) - if err != nil { - ctx.Error(http.StatusInternalServerError, "GetUserRepoPermission", err.Error()) + perm, errPermission := models.GetUserRepoPermission(repository, ctx.User) + if errPermission != nil { + ctx.Error(http.StatusInternalServerError, "GetUserRepoPermission", errPermission.Error()) return } if !perm.CanRead(unitType) { @@ -209,12 +220,11 @@ func GetAttachment(ctx *context.Context) { return } } - dataSet, err := attach.LinkedDataSet() + //dataSet, err := attach.LinkedDataSet() if err != nil { ctx.ServerError("LinkedDataSet", err) return } - if dataSet != nil { isPermit, err := models.GetUserDataSetPermission(dataSet, ctx.User) if err != nil { From 495addb579311ca31b46398b34db55a1f766a5e4 Mon Sep 17 00:00:00 2001 From: zouap Date: Thu, 5 Aug 2021 16:50:27 +0800 Subject: [PATCH 25/30] =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E9=9B=86=E7=9A=84=E9=94=99=E8=AF=AF=E5=88=A4=E6=96=AD=E9=80=BB?= =?UTF-8?q?=E8=BE=91=E5=BE=80=E4=B8=8A=E6=8F=90=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- routers/repo/attachment.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/routers/repo/attachment.go b/routers/repo/attachment.go index cdb73c8a0..fea7a3384 100755 --- a/routers/repo/attachment.go +++ b/routers/repo/attachment.go @@ -195,6 +195,10 @@ func GetAttachment(ctx *context.Context) { return } dataSet, err := attach.LinkedDataSet() + if err != nil { + ctx.ServerError("LinkedDataSet", err) + return + } if repository == nil && dataSet != nil { repository, _ = models.GetRepositoryByID(dataSet.RepoID) @@ -220,11 +224,7 @@ func GetAttachment(ctx *context.Context) { return } } - //dataSet, err := attach.LinkedDataSet() - if err != nil { - ctx.ServerError("LinkedDataSet", err) - return - } + if dataSet != nil { isPermit, err := models.GetUserDataSetPermission(dataSet, ctx.User) if err != nil { From abfcb9984cae133935da78c87ca93d9c3ee62d6f Mon Sep 17 00:00:00 2001 From: lewis <747342561@qq.com> Date: Thu, 5 Aug 2021 17:58:49 +0800 Subject: [PATCH 26/30] ignore blockchain error --- models/user.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/models/user.go b/models/user.go index 3dcd2eee9..42e688358 100755 --- a/models/user.go +++ b/models/user.go @@ -976,12 +976,12 @@ func CreateUser(u *User) (err error) { result, err := blockchain.CreateBlockchainAccount() if err != nil { log.Error("createBlockchainAccount failed:", err.Error()) - return err + //return err + } else { + u.PublicKey = result.Payload["publickey"].(string) + u.PrivateKey = result.Payload["privatekey"].(string) } - u.PublicKey = result.Payload["publickey"].(string) - u.PrivateKey = result.Payload["privatekey"].(string) - sess := x.NewSession() defer sess.Close() if err = sess.Begin(); err != nil { From 2202e4b4b90c3145954f10273f30ccc907df2de5 Mon Sep 17 00:00:00 2001 From: hit172587zpz Date: Fri, 6 Aug 2021 09:38:49 +0800 Subject: [PATCH 27/30] fix issue-182 issue-181 and new create the edit about desc link fucntion --- templates/repo/home.tmpl | 16 ++--- web_src/js/components/EditAboutInfo.vue | 96 ++++++++++++++++++++++-------- web_src/js/components/basic/editDialog.vue | 9 +-- web_src/js/index.js | 4 ++ 4 files changed, 86 insertions(+), 39 deletions(-) diff --git a/templates/repo/home.tmpl b/templates/repo/home.tmpl index a50b6e83f..ca064b990 100644 --- a/templates/repo/home.tmpl +++ b/templates/repo/home.tmpl @@ -178,8 +178,7 @@ {{.Repository.Website}}

- + {{end}}

@@ -188,7 +187,7 @@ {{if and .Permission.IsAdmin (not .Repository.IsArchived)}}{{.i18n.Tr "repo.topic.manage_topics"}}{{end}}

- {{if .LanguageStats}} +

{{range .LanguageStats}} @@ -196,19 +195,14 @@ {{end}}

- - {{end}} + {{if .LICENSE}}

- - {{.LICENSE}} - + {{.LICENSE}}

- + {{end}}
diff --git a/web_src/js/components/EditAboutInfo.vue b/web_src/js/components/EditAboutInfo.vue index 53e4915a0..76157008f 100644 --- a/web_src/js/components/EditAboutInfo.vue +++ b/web_src/js/components/EditAboutInfo.vue @@ -11,17 +11,19 @@ v-model="editDataDialog" :deleteCallback="editDataFunc" :deleteLoading ="editDataListLoading" + deleteParam = "ruleForm" + @input="initForm" >
- - - + + + - - + +
@@ -30,13 +32,9 @@