Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Due date not saving when set via API #8179

Closed
2 of 7 tasks
bobemoe opened this issue Sep 14, 2019 · 10 comments · Fixed by #8696
Closed
2 of 7 tasks

Due date not saving when set via API #8179

bobemoe opened this issue Sep 14, 2019 · 10 comments · Fixed by #8696
Labels
modifies/api This PR adds API routes or modifies them type/bug
Milestone

Comments

@bobemoe
Copy link
Contributor

bobemoe commented Sep 14, 2019

  • Gitea version (or commit ref): 1.10.0+dev-288-g7a8e299c7
  • Git version: 2.11.0
  • Operating system: Devuan Ascii (Debian Stretch)
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
    • Not relevant
  • Log gist:

Description

When using API to set a due date the timeline shows it has been set, but the due date comes back null.

curl -X PATCH "https://xxx/api/v1/repos/jhodges/test/issues/11" -H  "accept: application/json" -H  "Content-Type: application/json" -d "{ \"due_date\": \"2019-09-14T15:46:01.026Z\" }"

{"id":1116, ... "due_date":null, ...}

The same API call works just fine on try.gitea.io so it must be something local. Any ideas? edit: not true

Screenshots

You can see the timeline showing my attempts to add a date, yet still it is not shown in the due date field on the right bar.

2019-09-14-165952_1099x235_scrot

@bobemoe
Copy link
Contributor Author

bobemoe commented Sep 14, 2019

Oh and setting the date in the web interface works just fine

@lunny lunny added modifies/api This PR adds API routes or modifies them type/bug labels Sep 15, 2019
@bobemoe
Copy link
Contributor Author

bobemoe commented Sep 15, 2019

I've just tried a clean install: stop gitea, move aside config/data, dropping the db, starting gitea, recreating an admin user, repo, issue and testing again. Still the same problem.

@bobemoe
Copy link
Contributor Author

bobemoe commented Sep 28, 2019

Just tried this again but this time using SQLite. Same issue.

Also tried on try.gitea.io again and this time it is also NOT working!!

curl -X PATCH "https://bobemoe:[email protected]/api/v1/repos/bobemoe/test/issues/1" -H  "accept: application/json" -H  "Content-Type: application/json" -d "{ \"due_date\": \"2019-10-15T16:46:01.026Z\" }"

I was either mistaken the first time or some regression has happened. Hmmm. I've updated the issue to reflect this new info.

@bobemoe
Copy link
Contributor Author

bobemoe commented Sep 28, 2019

Same issue on 1.9.3

@bobemoe
Copy link
Contributor Author

bobemoe commented Sep 28, 2019

OK, I'm tracking this down:

Seems there is a separate API endpoint for setting a "deadline" POST try.gitea.io/api/v1/repos/bobemoe/test/issues/1/deadline which sets the date just fine!

So why does this specific field have its own endpoint? And how come it half works (generates timeline message) when set with other fields on the "normal" endpoint?

@bobemoe
Copy link
Contributor Author

bobemoe commented Sep 29, 2019

So now my script is using the correct endpoint I'm having better luck setting due dates. Now I have noticed that if I PATCH the issue to change the issue body, that the timeline notice says I've removed the due date, even though due date was not in the post fields, and is not actually removed!

curl -X PATCH "https://bobemoe:[email protected]/api/v1/repos/bobemoe/test/issues/1" -H  "accept: application/json" -H  "Content-Type: application/json" -d "{  \"body\": \"test\"}"

Guess this is the same functionality that erroneously said I'd added a due date from above!

@lunny lunny added this to the 1.9.4 milestone Sep 30, 2019
@lunny
Copy link
Member

lunny commented Oct 7, 2019

@bobemoe do you have permission of writing issues? The deadline only be set when users have write permission of issues unit. Otherwise it will be ignored.

@lunny lunny modified the milestones: 1.9.4, 1.9.5 Oct 8, 2019
@browcio
Copy link

browcio commented Oct 18, 2019

I have also encountered this issue.

We have repo with issues disabled. When I try to set Due Date on pull request my API call result in 403 Forbidden. I also see red box with message: "The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'. "

Gitea ver: 1.10-rc1.

@bobemoe
Copy link
Contributor Author

bobemoe commented Oct 18, 2019

That doesn't quite sound like the issue I was describing... I don't get 403 or that message. What API call are you using?

@davidsvantesson
Copy link
Contributor

I've found two bugs in the code

  • API is calling models.UpdateIssue which updates all columns, but the issue structure is not updated with new deadline
  • UpdateIssueDeadline is called even if form.Deadline is not set (causing an issue comment, but it is overwritten due to above point)

This affects at least issue and pull request update API. Creation API should also be checked.

@go-gitea go-gitea locked and limited conversation to collaborators Nov 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
modifies/api This PR adds API routes or modifies them type/bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants