Added fallback if renaming cant move an upload
This commit is contained in:
parent
891d904d9c
commit
76ed54f119
3 changed files with 40 additions and 4 deletions
|
|
@ -17,6 +17,8 @@ type CreatePostParams struct {
|
|||
}
|
||||
|
||||
func (s *Service) UpdatePost(ctx context.Context, params CreatePostParams) (*models.Post, error) {
|
||||
now := time.Now()
|
||||
|
||||
site, ok := models.GetSite(ctx)
|
||||
if !ok {
|
||||
return nil, models.SiteRequiredError
|
||||
|
|
@ -29,14 +31,14 @@ func (s *Service) UpdatePost(ctx context.Context, params CreatePostParams) (*mod
|
|||
|
||||
post.Title = params.Title
|
||||
post.Body = params.Body
|
||||
post.UpdatedAt = time.Now()
|
||||
post.UpdatedAt = now
|
||||
post.Slug = post.BestSlug()
|
||||
oldState := post.State
|
||||
|
||||
switch strings.ToLower(params.Action) {
|
||||
case "publish":
|
||||
post.State = models.StatePublished
|
||||
post.PublishedAt = time.Now()
|
||||
post.PublishedAt = now
|
||||
case "save draft":
|
||||
post.State = models.StateDraft
|
||||
post.PublishedAt = time.Time{}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue