Skip to content

Commit

Permalink
Merge pull request goplus#17 from Baihhh/merge
Browse files Browse the repository at this point in the history
fix: upload picture & edit
  • Loading branch information
IRONICBo committed Jan 22, 2024
2 parents 5d23634 + 14f3579 commit 8d8b195
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 2,043 deletions.
16 changes: 1 addition & 15 deletions cmd/gopcomm/community_yap.gox
Original file line number Diff line number Diff line change
Expand Up @@ -156,25 +156,12 @@ get "/edit/:id", ctx => {
}
// uid := "70f6a615-c0d5-4315-a5ac-34ca845450ed"
id := ctx.param("id")
//doc := {
// "ID": id,
//}
if id != "" {
if editable, _ := community.canEditable(todo, uid, id); !editable {
// TODO: can't edit this article
zlog.Error("no permissions")
ctx.json {
"code": 403,
"err": "no permissions",
}
http.Redirect(ctx.ResponseWriter, ctx.Request, "/error", http.StatusTemporaryRedirect)
}
article, _ := community.article(todo, id)
// doc["Title"] = article.Title
// doc["Content"] = article.Content
// doc["Tags"] = article.Tags
// doc["Cover"] = article.Cover
// doc["Ctime"] = article.Ctime
// doc["User"] = article.User
ctx.yap "edit", article
}
}
Expand Down Expand Up @@ -247,7 +234,6 @@ post "/translate", ctx => {
"err": "no token",
}
}

uid, err := community.GetUserId(token.Value)
if err != nil {
ctx.json {
Expand Down
2 changes: 1 addition & 1 deletion cmd/gopcomm/yap/edit_yap.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Markdown</title>
<script type="module" crossorigin src="/assets/index-KOgtDMdL.js"></script>
<script type="module" crossorigin src="/assets/index-kBFUOeCi.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-oISNCb2V.css">
</head>
<body>
Expand Down
2,018 changes: 0 additions & 2,018 deletions cmd/gopcomm/yap/static/assets/index-iHukN-OO.js

This file was deleted.

Large diffs are not rendered by default.

11 changes: 5 additions & 6 deletions internal/core/community.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@ func (p *Community) Article(ctx context.Context, id string) (article *Article, e
// return
// }
// article.User = *user

// get html url
fileKey, err := p.GetMediaUrl(ctx, htmlId)
article.HtmlUrl = fmt.Sprintf("%s%s", p.domain, fileKey)
Expand Down Expand Up @@ -327,11 +326,11 @@ func (p *Community) SearchArticle(ctx context.Context, searchValue string) (item
return []*ArticleEntry{}, err
}
// add author info
user, err := p.GetUser(article.UId)
if err != nil {
return []*ArticleEntry{}, err
}
article.User = *user
// user, err := p.GetUser(article.UId)
// if err != nil {
// return []*ArticleEntry{}, err
// }
// article.User = *user

items = append(items, article)
}
Expand Down
1 change: 0 additions & 1 deletion internal/core/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package core

import (
"os"

"github.com/casdoor/casdoor-go-sdk/casdoorsdk"
)

Expand Down

0 comments on commit 8d8b195

Please sign in to comment.