You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

issue.go 18 kB

Allow cross-repository dependencies on issues (#7901) * in progress changes for #7405, added ability to add cross-repo dependencies * removed unused repolink var * fixed query that was breaking ci tests; fixed check in issue dependency add so that the id of the issue and dependency is checked rather than the indexes * reverted removal of string in local files becasue these are done via crowdin, not updated manually * removed 'Select("issue.*")' from getBlockedByDependencies and getBlockingDependencies based on comments in PR review * changed getBlockedByDependencies and getBlockingDependencies to use a more xorm-like query, also updated the sidebar as a result * simplified the getBlockingDependencies and getBlockedByDependencies methods; changed the sidebar to show the dependencies in a different format where you can see the name of the repository * made some changes to the issue view in the dependencies (issue name on top, repo full name on separate line). Change view of issue in the dependency search results (also showing the full repo name on separate line) * replace call to FindUserAccessibleRepoIDs with SearchRepositoryByName. The former was hardcoded to use isPrivate = false on the repo search, but this code needed it to be true. The SearchRepositoryByName method is used more in the code including on the user's dashboard * some more tweaks to the layout of the issues when showing dependencies and in the search box when you add new dependencies * added Name to the RepositoryMeta struct * updated swagger doc * fixed total count for link header on SearchIssues * fixed indentation * fixed aligment of remove icon on dependencies in issue sidebar * removed unnecessary nil check (unnecessary because issue.loadRepo is called prior to this block) * reverting .css change, somehow missed or forgot that less is used * updated less file and generated css; updated sidebar template with styles to line up delete and issue index * added ordering to the blocked by/depends on queries * fixed sorting in issue dependency search and the depends on/blocks views to show issues from the current repo first, then by created date descending; added a "all cross repository dependencies" setting to allow this feature to be turned off, if turned off, the issue dependency search will work the way it did before (restricted to the current repository) * re-applied my swagger changes after merge * fixed split string condition in issue search * changed ALLOW_CROSS_REPOSITORY_DEPENDENCIES description to sound more global than just the issue dependency search; returning 400 in the cross repo issue search api method if not enabled; fixed bug where the issue count did not respect the state parameter * when adding a dependency to an issue, added a check to make sure the issue and dependency are in the same repo if cross repo dependencies is not enabled * updated sortIssuesSession call in PullRequests, another commit moved this method from pull.go to pull_list.go so I had to re-apply my change here * fixed incorrect setting of user id parameter in search repos call
6 years ago
Allow cross-repository dependencies on issues (#7901) * in progress changes for #7405, added ability to add cross-repo dependencies * removed unused repolink var * fixed query that was breaking ci tests; fixed check in issue dependency add so that the id of the issue and dependency is checked rather than the indexes * reverted removal of string in local files becasue these are done via crowdin, not updated manually * removed 'Select("issue.*")' from getBlockedByDependencies and getBlockingDependencies based on comments in PR review * changed getBlockedByDependencies and getBlockingDependencies to use a more xorm-like query, also updated the sidebar as a result * simplified the getBlockingDependencies and getBlockedByDependencies methods; changed the sidebar to show the dependencies in a different format where you can see the name of the repository * made some changes to the issue view in the dependencies (issue name on top, repo full name on separate line). Change view of issue in the dependency search results (also showing the full repo name on separate line) * replace call to FindUserAccessibleRepoIDs with SearchRepositoryByName. The former was hardcoded to use isPrivate = false on the repo search, but this code needed it to be true. The SearchRepositoryByName method is used more in the code including on the user's dashboard * some more tweaks to the layout of the issues when showing dependencies and in the search box when you add new dependencies * added Name to the RepositoryMeta struct * updated swagger doc * fixed total count for link header on SearchIssues * fixed indentation * fixed aligment of remove icon on dependencies in issue sidebar * removed unnecessary nil check (unnecessary because issue.loadRepo is called prior to this block) * reverting .css change, somehow missed or forgot that less is used * updated less file and generated css; updated sidebar template with styles to line up delete and issue index * added ordering to the blocked by/depends on queries * fixed sorting in issue dependency search and the depends on/blocks views to show issues from the current repo first, then by created date descending; added a "all cross repository dependencies" setting to allow this feature to be turned off, if turned off, the issue dependency search will work the way it did before (restricted to the current repository) * re-applied my swagger changes after merge * fixed split string condition in issue search * changed ALLOW_CROSS_REPOSITORY_DEPENDENCIES description to sound more global than just the issue dependency search; returning 400 in the cross repo issue search api method if not enabled; fixed bug where the issue count did not respect the state parameter * when adding a dependency to an issue, added a check to make sure the issue and dependency are in the same repo if cross repo dependencies is not enabled * updated sortIssuesSession call in PullRequests, another commit moved this method from pull.go to pull_list.go so I had to re-apply my change here * fixed incorrect setting of user id parameter in search repos call
6 years ago
Allow cross-repository dependencies on issues (#7901) * in progress changes for #7405, added ability to add cross-repo dependencies * removed unused repolink var * fixed query that was breaking ci tests; fixed check in issue dependency add so that the id of the issue and dependency is checked rather than the indexes * reverted removal of string in local files becasue these are done via crowdin, not updated manually * removed 'Select("issue.*")' from getBlockedByDependencies and getBlockingDependencies based on comments in PR review * changed getBlockedByDependencies and getBlockingDependencies to use a more xorm-like query, also updated the sidebar as a result * simplified the getBlockingDependencies and getBlockedByDependencies methods; changed the sidebar to show the dependencies in a different format where you can see the name of the repository * made some changes to the issue view in the dependencies (issue name on top, repo full name on separate line). Change view of issue in the dependency search results (also showing the full repo name on separate line) * replace call to FindUserAccessibleRepoIDs with SearchRepositoryByName. The former was hardcoded to use isPrivate = false on the repo search, but this code needed it to be true. The SearchRepositoryByName method is used more in the code including on the user's dashboard * some more tweaks to the layout of the issues when showing dependencies and in the search box when you add new dependencies * added Name to the RepositoryMeta struct * updated swagger doc * fixed total count for link header on SearchIssues * fixed indentation * fixed aligment of remove icon on dependencies in issue sidebar * removed unnecessary nil check (unnecessary because issue.loadRepo is called prior to this block) * reverting .css change, somehow missed or forgot that less is used * updated less file and generated css; updated sidebar template with styles to line up delete and issue index * added ordering to the blocked by/depends on queries * fixed sorting in issue dependency search and the depends on/blocks views to show issues from the current repo first, then by created date descending; added a "all cross repository dependencies" setting to allow this feature to be turned off, if turned off, the issue dependency search will work the way it did before (restricted to the current repository) * re-applied my swagger changes after merge * fixed split string condition in issue search * changed ALLOW_CROSS_REPOSITORY_DEPENDENCIES description to sound more global than just the issue dependency search; returning 400 in the cross repo issue search api method if not enabled; fixed bug where the issue count did not respect the state parameter * when adding a dependency to an issue, added a check to make sure the issue and dependency are in the same repo if cross repo dependencies is not enabled * updated sortIssuesSession call in PullRequests, another commit moved this method from pull.go to pull_list.go so I had to re-apply my change here * fixed incorrect setting of user id parameter in search repos call
6 years ago
Allow cross-repository dependencies on issues (#7901) * in progress changes for #7405, added ability to add cross-repo dependencies * removed unused repolink var * fixed query that was breaking ci tests; fixed check in issue dependency add so that the id of the issue and dependency is checked rather than the indexes * reverted removal of string in local files becasue these are done via crowdin, not updated manually * removed 'Select("issue.*")' from getBlockedByDependencies and getBlockingDependencies based on comments in PR review * changed getBlockedByDependencies and getBlockingDependencies to use a more xorm-like query, also updated the sidebar as a result * simplified the getBlockingDependencies and getBlockedByDependencies methods; changed the sidebar to show the dependencies in a different format where you can see the name of the repository * made some changes to the issue view in the dependencies (issue name on top, repo full name on separate line). Change view of issue in the dependency search results (also showing the full repo name on separate line) * replace call to FindUserAccessibleRepoIDs with SearchRepositoryByName. The former was hardcoded to use isPrivate = false on the repo search, but this code needed it to be true. The SearchRepositoryByName method is used more in the code including on the user's dashboard * some more tweaks to the layout of the issues when showing dependencies and in the search box when you add new dependencies * added Name to the RepositoryMeta struct * updated swagger doc * fixed total count for link header on SearchIssues * fixed indentation * fixed aligment of remove icon on dependencies in issue sidebar * removed unnecessary nil check (unnecessary because issue.loadRepo is called prior to this block) * reverting .css change, somehow missed or forgot that less is used * updated less file and generated css; updated sidebar template with styles to line up delete and issue index * added ordering to the blocked by/depends on queries * fixed sorting in issue dependency search and the depends on/blocks views to show issues from the current repo first, then by created date descending; added a "all cross repository dependencies" setting to allow this feature to be turned off, if turned off, the issue dependency search will work the way it did before (restricted to the current repository) * re-applied my swagger changes after merge * fixed split string condition in issue search * changed ALLOW_CROSS_REPOSITORY_DEPENDENCIES description to sound more global than just the issue dependency search; returning 400 in the cross repo issue search api method if not enabled; fixed bug where the issue count did not respect the state parameter * when adding a dependency to an issue, added a check to make sure the issue and dependency are in the same repo if cross repo dependencies is not enabled * updated sortIssuesSession call in PullRequests, another commit moved this method from pull.go to pull_list.go so I had to re-apply my change here * fixed incorrect setting of user id parameter in search repos call
6 years ago
Allow cross-repository dependencies on issues (#7901) * in progress changes for #7405, added ability to add cross-repo dependencies * removed unused repolink var * fixed query that was breaking ci tests; fixed check in issue dependency add so that the id of the issue and dependency is checked rather than the indexes * reverted removal of string in local files becasue these are done via crowdin, not updated manually * removed 'Select("issue.*")' from getBlockedByDependencies and getBlockingDependencies based on comments in PR review * changed getBlockedByDependencies and getBlockingDependencies to use a more xorm-like query, also updated the sidebar as a result * simplified the getBlockingDependencies and getBlockedByDependencies methods; changed the sidebar to show the dependencies in a different format where you can see the name of the repository * made some changes to the issue view in the dependencies (issue name on top, repo full name on separate line). Change view of issue in the dependency search results (also showing the full repo name on separate line) * replace call to FindUserAccessibleRepoIDs with SearchRepositoryByName. The former was hardcoded to use isPrivate = false on the repo search, but this code needed it to be true. The SearchRepositoryByName method is used more in the code including on the user's dashboard * some more tweaks to the layout of the issues when showing dependencies and in the search box when you add new dependencies * added Name to the RepositoryMeta struct * updated swagger doc * fixed total count for link header on SearchIssues * fixed indentation * fixed aligment of remove icon on dependencies in issue sidebar * removed unnecessary nil check (unnecessary because issue.loadRepo is called prior to this block) * reverting .css change, somehow missed or forgot that less is used * updated less file and generated css; updated sidebar template with styles to line up delete and issue index * added ordering to the blocked by/depends on queries * fixed sorting in issue dependency search and the depends on/blocks views to show issues from the current repo first, then by created date descending; added a "all cross repository dependencies" setting to allow this feature to be turned off, if turned off, the issue dependency search will work the way it did before (restricted to the current repository) * re-applied my swagger changes after merge * fixed split string condition in issue search * changed ALLOW_CROSS_REPOSITORY_DEPENDENCIES description to sound more global than just the issue dependency search; returning 400 in the cross repo issue search api method if not enabled; fixed bug where the issue count did not respect the state parameter * when adding a dependency to an issue, added a check to make sure the issue and dependency are in the same repo if cross repo dependencies is not enabled * updated sortIssuesSession call in PullRequests, another commit moved this method from pull.go to pull_list.go so I had to re-apply my change here * fixed incorrect setting of user id parameter in search repos call
6 years ago
Allow cross-repository dependencies on issues (#7901) * in progress changes for #7405, added ability to add cross-repo dependencies * removed unused repolink var * fixed query that was breaking ci tests; fixed check in issue dependency add so that the id of the issue and dependency is checked rather than the indexes * reverted removal of string in local files becasue these are done via crowdin, not updated manually * removed 'Select("issue.*")' from getBlockedByDependencies and getBlockingDependencies based on comments in PR review * changed getBlockedByDependencies and getBlockingDependencies to use a more xorm-like query, also updated the sidebar as a result * simplified the getBlockingDependencies and getBlockedByDependencies methods; changed the sidebar to show the dependencies in a different format where you can see the name of the repository * made some changes to the issue view in the dependencies (issue name on top, repo full name on separate line). Change view of issue in the dependency search results (also showing the full repo name on separate line) * replace call to FindUserAccessibleRepoIDs with SearchRepositoryByName. The former was hardcoded to use isPrivate = false on the repo search, but this code needed it to be true. The SearchRepositoryByName method is used more in the code including on the user's dashboard * some more tweaks to the layout of the issues when showing dependencies and in the search box when you add new dependencies * added Name to the RepositoryMeta struct * updated swagger doc * fixed total count for link header on SearchIssues * fixed indentation * fixed aligment of remove icon on dependencies in issue sidebar * removed unnecessary nil check (unnecessary because issue.loadRepo is called prior to this block) * reverting .css change, somehow missed or forgot that less is used * updated less file and generated css; updated sidebar template with styles to line up delete and issue index * added ordering to the blocked by/depends on queries * fixed sorting in issue dependency search and the depends on/blocks views to show issues from the current repo first, then by created date descending; added a "all cross repository dependencies" setting to allow this feature to be turned off, if turned off, the issue dependency search will work the way it did before (restricted to the current repository) * re-applied my swagger changes after merge * fixed split string condition in issue search * changed ALLOW_CROSS_REPOSITORY_DEPENDENCIES description to sound more global than just the issue dependency search; returning 400 in the cross repo issue search api method if not enabled; fixed bug where the issue count did not respect the state parameter * when adding a dependency to an issue, added a check to make sure the issue and dependency are in the same repo if cross repo dependencies is not enabled * updated sortIssuesSession call in PullRequests, another commit moved this method from pull.go to pull_list.go so I had to re-apply my change here * fixed incorrect setting of user id parameter in search repos call
6 years ago
Allow cross-repository dependencies on issues (#7901) * in progress changes for #7405, added ability to add cross-repo dependencies * removed unused repolink var * fixed query that was breaking ci tests; fixed check in issue dependency add so that the id of the issue and dependency is checked rather than the indexes * reverted removal of string in local files becasue these are done via crowdin, not updated manually * removed 'Select("issue.*")' from getBlockedByDependencies and getBlockingDependencies based on comments in PR review * changed getBlockedByDependencies and getBlockingDependencies to use a more xorm-like query, also updated the sidebar as a result * simplified the getBlockingDependencies and getBlockedByDependencies methods; changed the sidebar to show the dependencies in a different format where you can see the name of the repository * made some changes to the issue view in the dependencies (issue name on top, repo full name on separate line). Change view of issue in the dependency search results (also showing the full repo name on separate line) * replace call to FindUserAccessibleRepoIDs with SearchRepositoryByName. The former was hardcoded to use isPrivate = false on the repo search, but this code needed it to be true. The SearchRepositoryByName method is used more in the code including on the user's dashboard * some more tweaks to the layout of the issues when showing dependencies and in the search box when you add new dependencies * added Name to the RepositoryMeta struct * updated swagger doc * fixed total count for link header on SearchIssues * fixed indentation * fixed aligment of remove icon on dependencies in issue sidebar * removed unnecessary nil check (unnecessary because issue.loadRepo is called prior to this block) * reverting .css change, somehow missed or forgot that less is used * updated less file and generated css; updated sidebar template with styles to line up delete and issue index * added ordering to the blocked by/depends on queries * fixed sorting in issue dependency search and the depends on/blocks views to show issues from the current repo first, then by created date descending; added a "all cross repository dependencies" setting to allow this feature to be turned off, if turned off, the issue dependency search will work the way it did before (restricted to the current repository) * re-applied my swagger changes after merge * fixed split string condition in issue search * changed ALLOW_CROSS_REPOSITORY_DEPENDENCIES description to sound more global than just the issue dependency search; returning 400 in the cross repo issue search api method if not enabled; fixed bug where the issue count did not respect the state parameter * when adding a dependency to an issue, added a check to make sure the issue and dependency are in the same repo if cross repo dependencies is not enabled * updated sortIssuesSession call in PullRequests, another commit moved this method from pull.go to pull_list.go so I had to re-apply my change here * fixed incorrect setting of user id parameter in search repos call
6 years ago
Allow cross-repository dependencies on issues (#7901) * in progress changes for #7405, added ability to add cross-repo dependencies * removed unused repolink var * fixed query that was breaking ci tests; fixed check in issue dependency add so that the id of the issue and dependency is checked rather than the indexes * reverted removal of string in local files becasue these are done via crowdin, not updated manually * removed 'Select("issue.*")' from getBlockedByDependencies and getBlockingDependencies based on comments in PR review * changed getBlockedByDependencies and getBlockingDependencies to use a more xorm-like query, also updated the sidebar as a result * simplified the getBlockingDependencies and getBlockedByDependencies methods; changed the sidebar to show the dependencies in a different format where you can see the name of the repository * made some changes to the issue view in the dependencies (issue name on top, repo full name on separate line). Change view of issue in the dependency search results (also showing the full repo name on separate line) * replace call to FindUserAccessibleRepoIDs with SearchRepositoryByName. The former was hardcoded to use isPrivate = false on the repo search, but this code needed it to be true. The SearchRepositoryByName method is used more in the code including on the user's dashboard * some more tweaks to the layout of the issues when showing dependencies and in the search box when you add new dependencies * added Name to the RepositoryMeta struct * updated swagger doc * fixed total count for link header on SearchIssues * fixed indentation * fixed aligment of remove icon on dependencies in issue sidebar * removed unnecessary nil check (unnecessary because issue.loadRepo is called prior to this block) * reverting .css change, somehow missed or forgot that less is used * updated less file and generated css; updated sidebar template with styles to line up delete and issue index * added ordering to the blocked by/depends on queries * fixed sorting in issue dependency search and the depends on/blocks views to show issues from the current repo first, then by created date descending; added a "all cross repository dependencies" setting to allow this feature to be turned off, if turned off, the issue dependency search will work the way it did before (restricted to the current repository) * re-applied my swagger changes after merge * fixed split string condition in issue search * changed ALLOW_CROSS_REPOSITORY_DEPENDENCIES description to sound more global than just the issue dependency search; returning 400 in the cross repo issue search api method if not enabled; fixed bug where the issue count did not respect the state parameter * when adding a dependency to an issue, added a check to make sure the issue and dependency are in the same repo if cross repo dependencies is not enabled * updated sortIssuesSession call in PullRequests, another commit moved this method from pull.go to pull_list.go so I had to re-apply my change here * fixed incorrect setting of user id parameter in search repos call
6 years ago
Issue due date (#3794) * Started adding deadline to ui * Implemented basic issue due date managing * Improved UI for due date managing * Added at least write access to the repo in order to modify issue due dates * Ui improvements * Added issue comments creation when adding/modifying/removing a due date * Show due date in issue list * Added api support for issue due dates * Fixed lint suggestions * Added deadline to sdk * Updated css * Added support for adding/modifiying deadlines for pull requests via api * Fixed comments not created when updating or removing a deadline * update sdk (will do properly once go-gitea/go-sdk#103 is merged) * enhanced updateIssueDeadline * Removed unnessecary Issue.DeadlineString * UI improvements * Small improvments to comment creation + ui & validation improvements * Check if an issue is overdue is now a seperate function * Updated go-sdk with govendor as it was merged * Simplified isOverdue method * removed unessecary deadline to 0 set * Update swagger definitions * Added missing return * Added an explanary comment * Improved updateIssueDeadline method so it'll only update `deadline_unix` * Small changes and improvements * no need to explicitly load the issue when updating a deadline, just use whats already there * small optimisations * Added check if a deadline was modified before updating it * Moved comment creating logic into its own function * Code cleanup for creating deadline comment * locale improvement * When modifying a deadline, the old deadline is saved with the comment * small improvments to xorm session handling when updating an issue deadline + style nitpicks * style nitpicks * Moved checking for if the user has write acces to middleware
7 years ago
Issue due date (#3794) * Started adding deadline to ui * Implemented basic issue due date managing * Improved UI for due date managing * Added at least write access to the repo in order to modify issue due dates * Ui improvements * Added issue comments creation when adding/modifying/removing a due date * Show due date in issue list * Added api support for issue due dates * Fixed lint suggestions * Added deadline to sdk * Updated css * Added support for adding/modifiying deadlines for pull requests via api * Fixed comments not created when updating or removing a deadline * update sdk (will do properly once go-gitea/go-sdk#103 is merged) * enhanced updateIssueDeadline * Removed unnessecary Issue.DeadlineString * UI improvements * Small improvments to comment creation + ui & validation improvements * Check if an issue is overdue is now a seperate function * Updated go-sdk with govendor as it was merged * Simplified isOverdue method * removed unessecary deadline to 0 set * Update swagger definitions * Added missing return * Added an explanary comment * Improved updateIssueDeadline method so it'll only update `deadline_unix` * Small changes and improvements * no need to explicitly load the issue when updating a deadline, just use whats already there * small optimisations * Added check if a deadline was modified before updating it * Moved comment creating logic into its own function * Code cleanup for creating deadline comment * locale improvement * When modifying a deadline, the old deadline is saved with the comment * small improvments to xorm session handling when updating an issue deadline + style nitpicks * style nitpicks * Moved checking for if the user has write acces to middleware
7 years ago
Issue due date (#3794) * Started adding deadline to ui * Implemented basic issue due date managing * Improved UI for due date managing * Added at least write access to the repo in order to modify issue due dates * Ui improvements * Added issue comments creation when adding/modifying/removing a due date * Show due date in issue list * Added api support for issue due dates * Fixed lint suggestions * Added deadline to sdk * Updated css * Added support for adding/modifiying deadlines for pull requests via api * Fixed comments not created when updating or removing a deadline * update sdk (will do properly once go-gitea/go-sdk#103 is merged) * enhanced updateIssueDeadline * Removed unnessecary Issue.DeadlineString * UI improvements * Small improvments to comment creation + ui & validation improvements * Check if an issue is overdue is now a seperate function * Updated go-sdk with govendor as it was merged * Simplified isOverdue method * removed unessecary deadline to 0 set * Update swagger definitions * Added missing return * Added an explanary comment * Improved updateIssueDeadline method so it'll only update `deadline_unix` * Small changes and improvements * no need to explicitly load the issue when updating a deadline, just use whats already there * small optimisations * Added check if a deadline was modified before updating it * Moved comment creating logic into its own function * Code cleanup for creating deadline comment * locale improvement * When modifying a deadline, the old deadline is saved with the comment * small improvments to xorm session handling when updating an issue deadline + style nitpicks * style nitpicks * Moved checking for if the user has write acces to middleware
7 years ago
Issue due date (#3794) * Started adding deadline to ui * Implemented basic issue due date managing * Improved UI for due date managing * Added at least write access to the repo in order to modify issue due dates * Ui improvements * Added issue comments creation when adding/modifying/removing a due date * Show due date in issue list * Added api support for issue due dates * Fixed lint suggestions * Added deadline to sdk * Updated css * Added support for adding/modifiying deadlines for pull requests via api * Fixed comments not created when updating or removing a deadline * update sdk (will do properly once go-gitea/go-sdk#103 is merged) * enhanced updateIssueDeadline * Removed unnessecary Issue.DeadlineString * UI improvements * Small improvments to comment creation + ui & validation improvements * Check if an issue is overdue is now a seperate function * Updated go-sdk with govendor as it was merged * Simplified isOverdue method * removed unessecary deadline to 0 set * Update swagger definitions * Added missing return * Added an explanary comment * Improved updateIssueDeadline method so it'll only update `deadline_unix` * Small changes and improvements * no need to explicitly load the issue when updating a deadline, just use whats already there * small optimisations * Added check if a deadline was modified before updating it * Moved comment creating logic into its own function * Code cleanup for creating deadline comment * locale improvement * When modifying a deadline, the old deadline is saved with the comment * small improvments to xorm session handling when updating an issue deadline + style nitpicks * style nitpicks * Moved checking for if the user has write acces to middleware
7 years ago
Issue due date (#3794) * Started adding deadline to ui * Implemented basic issue due date managing * Improved UI for due date managing * Added at least write access to the repo in order to modify issue due dates * Ui improvements * Added issue comments creation when adding/modifying/removing a due date * Show due date in issue list * Added api support for issue due dates * Fixed lint suggestions * Added deadline to sdk * Updated css * Added support for adding/modifiying deadlines for pull requests via api * Fixed comments not created when updating or removing a deadline * update sdk (will do properly once go-gitea/go-sdk#103 is merged) * enhanced updateIssueDeadline * Removed unnessecary Issue.DeadlineString * UI improvements * Small improvments to comment creation + ui & validation improvements * Check if an issue is overdue is now a seperate function * Updated go-sdk with govendor as it was merged * Simplified isOverdue method * removed unessecary deadline to 0 set * Update swagger definitions * Added missing return * Added an explanary comment * Improved updateIssueDeadline method so it'll only update `deadline_unix` * Small changes and improvements * no need to explicitly load the issue when updating a deadline, just use whats already there * small optimisations * Added check if a deadline was modified before updating it * Moved comment creating logic into its own function * Code cleanup for creating deadline comment * locale improvement * When modifying a deadline, the old deadline is saved with the comment * small improvments to xorm session handling when updating an issue deadline + style nitpicks * style nitpicks * Moved checking for if the user has write acces to middleware
7 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622
  1. // Copyright 2016 The Gogs Authors. All rights reserved.
  2. // Copyright 2018 The Gitea Authors. All rights reserved.
  3. // Use of this source code is governed by a MIT-style
  4. // license that can be found in the LICENSE file.
  5. package repo
  6. import (
  7. "fmt"
  8. "net/http"
  9. "strings"
  10. "time"
  11. "code.gitea.io/gitea/models"
  12. "code.gitea.io/gitea/modules/context"
  13. issue_indexer "code.gitea.io/gitea/modules/indexer/issues"
  14. "code.gitea.io/gitea/modules/log"
  15. "code.gitea.io/gitea/modules/setting"
  16. api "code.gitea.io/gitea/modules/structs"
  17. "code.gitea.io/gitea/modules/timeutil"
  18. "code.gitea.io/gitea/modules/util"
  19. issue_service "code.gitea.io/gitea/services/issue"
  20. )
  21. // SearchIssues searches for issues across the repositories that the user has access to
  22. func SearchIssues(ctx *context.APIContext) {
  23. // swagger:operation GET /repos/issues/search issue issueSearchIssues
  24. // ---
  25. // summary: Search for issues across the repositories that the user has access to
  26. // produces:
  27. // - application/json
  28. // parameters:
  29. // - name: state
  30. // in: query
  31. // description: whether issue is open or closed
  32. // type: string
  33. // - name: labels
  34. // in: query
  35. // description: comma separated list of labels. Fetch only issues that have any of this labels. Non existent labels are discarded
  36. // type: string
  37. // - name: page
  38. // in: query
  39. // description: page number of requested issues
  40. // type: integer
  41. // - name: q
  42. // in: query
  43. // description: search string
  44. // type: string
  45. // - name: priority_repo_id
  46. // in: query
  47. // description: repository to prioritize in the results
  48. // type: integer
  49. // format: int64
  50. // responses:
  51. // "200":
  52. // "$ref": "#/responses/IssueList"
  53. var isClosed util.OptionalBool
  54. switch ctx.Query("state") {
  55. case "closed":
  56. isClosed = util.OptionalBoolTrue
  57. case "all":
  58. isClosed = util.OptionalBoolNone
  59. default:
  60. isClosed = util.OptionalBoolFalse
  61. }
  62. // find repos user can access (for issue search)
  63. repoIDs := make([]int64, 0)
  64. issueCount := 0
  65. for page := 1; ; page++ {
  66. repos, count, err := models.SearchRepositoryByName(&models.SearchRepoOptions{
  67. Page: page,
  68. PageSize: 15,
  69. Private: true,
  70. Keyword: "",
  71. OwnerID: ctx.User.ID,
  72. TopicOnly: false,
  73. Collaborate: util.OptionalBoolNone,
  74. UserIsAdmin: ctx.IsUserSiteAdmin(),
  75. UserID: ctx.User.ID,
  76. OrderBy: models.SearchOrderByRecentUpdated,
  77. })
  78. if err != nil {
  79. ctx.Error(http.StatusInternalServerError, "SearchRepositoryByName", err)
  80. return
  81. }
  82. if len(repos) == 0 {
  83. break
  84. }
  85. log.Trace("Processing next %d repos of %d", len(repos), count)
  86. for _, repo := range repos {
  87. switch isClosed {
  88. case util.OptionalBoolTrue:
  89. issueCount += repo.NumClosedIssues
  90. case util.OptionalBoolFalse:
  91. issueCount += repo.NumOpenIssues
  92. case util.OptionalBoolNone:
  93. issueCount += repo.NumIssues
  94. }
  95. repoIDs = append(repoIDs, repo.ID)
  96. }
  97. }
  98. var issues []*models.Issue
  99. keyword := strings.Trim(ctx.Query("q"), " ")
  100. if strings.IndexByte(keyword, 0) >= 0 {
  101. keyword = ""
  102. }
  103. var issueIDs []int64
  104. var labelIDs []int64
  105. var err error
  106. if len(keyword) > 0 && len(repoIDs) > 0 {
  107. issueIDs, err = issue_indexer.SearchIssuesByKeyword(repoIDs, keyword)
  108. }
  109. labels := ctx.Query("labels")
  110. if splitted := strings.Split(labels, ","); labels != "" && len(splitted) > 0 {
  111. labelIDs, err = models.GetLabelIDsInReposByNames(repoIDs, splitted)
  112. if err != nil {
  113. ctx.Error(http.StatusInternalServerError, "GetLabelIDsInRepoByNames", err)
  114. return
  115. }
  116. }
  117. // Only fetch the issues if we either don't have a keyword or the search returned issues
  118. // This would otherwise return all issues if no issues were found by the search.
  119. if len(keyword) == 0 || len(issueIDs) > 0 || len(labelIDs) > 0 {
  120. issues, err = models.Issues(&models.IssuesOptions{
  121. RepoIDs: repoIDs,
  122. Page: ctx.QueryInt("page"),
  123. PageSize: setting.UI.IssuePagingNum,
  124. IsClosed: isClosed,
  125. IssueIDs: issueIDs,
  126. LabelIDs: labelIDs,
  127. SortType: "priorityrepo",
  128. PriorityRepoID: ctx.QueryInt64("priority_repo_id"),
  129. })
  130. }
  131. if err != nil {
  132. ctx.Error(http.StatusInternalServerError, "Issues", err)
  133. return
  134. }
  135. apiIssues := make([]*api.Issue, len(issues))
  136. for i := range issues {
  137. apiIssues[i] = issues[i].APIFormat()
  138. }
  139. ctx.SetLinkHeader(issueCount, setting.UI.IssuePagingNum)
  140. ctx.JSON(http.StatusOK, &apiIssues)
  141. }
  142. // ListIssues list the issues of a repository
  143. func ListIssues(ctx *context.APIContext) {
  144. // swagger:operation GET /repos/{owner}/{repo}/issues issue issueListIssues
  145. // ---
  146. // summary: List a repository's issues
  147. // produces:
  148. // - application/json
  149. // parameters:
  150. // - name: owner
  151. // in: path
  152. // description: owner of the repo
  153. // type: string
  154. // required: true
  155. // - name: repo
  156. // in: path
  157. // description: name of the repo
  158. // type: string
  159. // required: true
  160. // - name: state
  161. // in: query
  162. // description: whether issue is open or closed
  163. // type: string
  164. // - name: labels
  165. // in: query
  166. // description: comma separated list of labels. Fetch only issues that have any of this labels. Non existent labels are discarded
  167. // type: string
  168. // - name: page
  169. // in: query
  170. // description: page number of requested issues
  171. // type: integer
  172. // - name: q
  173. // in: query
  174. // description: search string
  175. // type: string
  176. // responses:
  177. // "200":
  178. // "$ref": "#/responses/IssueList"
  179. var isClosed util.OptionalBool
  180. switch ctx.Query("state") {
  181. case "closed":
  182. isClosed = util.OptionalBoolTrue
  183. case "all":
  184. isClosed = util.OptionalBoolNone
  185. default:
  186. isClosed = util.OptionalBoolFalse
  187. }
  188. var issues []*models.Issue
  189. keyword := strings.Trim(ctx.Query("q"), " ")
  190. if strings.IndexByte(keyword, 0) >= 0 {
  191. keyword = ""
  192. }
  193. var issueIDs []int64
  194. var labelIDs []int64
  195. var err error
  196. if len(keyword) > 0 {
  197. issueIDs, err = issue_indexer.SearchIssuesByKeyword([]int64{ctx.Repo.Repository.ID}, keyword)
  198. }
  199. if splitted := strings.Split(ctx.Query("labels"), ","); len(splitted) > 0 {
  200. labelIDs, err = models.GetLabelIDsInRepoByNames(ctx.Repo.Repository.ID, splitted)
  201. if err != nil {
  202. ctx.Error(http.StatusInternalServerError, "GetLabelIDsInRepoByNames", err)
  203. return
  204. }
  205. }
  206. // Only fetch the issues if we either don't have a keyword or the search returned issues
  207. // This would otherwise return all issues if no issues were found by the search.
  208. if len(keyword) == 0 || len(issueIDs) > 0 || len(labelIDs) > 0 {
  209. issues, err = models.Issues(&models.IssuesOptions{
  210. RepoIDs: []int64{ctx.Repo.Repository.ID},
  211. Page: ctx.QueryInt("page"),
  212. PageSize: setting.UI.IssuePagingNum,
  213. IsClosed: isClosed,
  214. IssueIDs: issueIDs,
  215. LabelIDs: labelIDs,
  216. })
  217. }
  218. if err != nil {
  219. ctx.Error(http.StatusInternalServerError, "Issues", err)
  220. return
  221. }
  222. apiIssues := make([]*api.Issue, len(issues))
  223. for i := range issues {
  224. apiIssues[i] = issues[i].APIFormat()
  225. }
  226. ctx.SetLinkHeader(ctx.Repo.Repository.NumIssues, setting.UI.IssuePagingNum)
  227. ctx.JSON(http.StatusOK, &apiIssues)
  228. }
  229. // GetIssue get an issue of a repository
  230. func GetIssue(ctx *context.APIContext) {
  231. // swagger:operation GET /repos/{owner}/{repo}/issues/{index} issue issueGetIssue
  232. // ---
  233. // summary: Get an issue
  234. // produces:
  235. // - application/json
  236. // parameters:
  237. // - name: owner
  238. // in: path
  239. // description: owner of the repo
  240. // type: string
  241. // required: true
  242. // - name: repo
  243. // in: path
  244. // description: name of the repo
  245. // type: string
  246. // required: true
  247. // - name: index
  248. // in: path
  249. // description: index of the issue to get
  250. // type: integer
  251. // format: int64
  252. // required: true
  253. // responses:
  254. // "200":
  255. // "$ref": "#/responses/Issue"
  256. // "404":
  257. // "$ref": "#/responses/notFound"
  258. issue, err := models.GetIssueWithAttrsByIndex(ctx.Repo.Repository.ID, ctx.ParamsInt64(":index"))
  259. if err != nil {
  260. if models.IsErrIssueNotExist(err) {
  261. ctx.NotFound()
  262. } else {
  263. ctx.Error(http.StatusInternalServerError, "GetIssueByIndex", err)
  264. }
  265. return
  266. }
  267. ctx.JSON(http.StatusOK, issue.APIFormat())
  268. }
  269. // CreateIssue create an issue of a repository
  270. func CreateIssue(ctx *context.APIContext, form api.CreateIssueOption) {
  271. // swagger:operation POST /repos/{owner}/{repo}/issues issue issueCreateIssue
  272. // ---
  273. // summary: Create an issue. If using deadline only the date will be taken into account, and time of day ignored.
  274. // consumes:
  275. // - application/json
  276. // produces:
  277. // - application/json
  278. // parameters:
  279. // - name: owner
  280. // in: path
  281. // description: owner of the repo
  282. // type: string
  283. // required: true
  284. // - name: repo
  285. // in: path
  286. // description: name of the repo
  287. // type: string
  288. // required: true
  289. // - name: body
  290. // in: body
  291. // schema:
  292. // "$ref": "#/definitions/CreateIssueOption"
  293. // responses:
  294. // "201":
  295. // "$ref": "#/responses/Issue"
  296. // "403":
  297. // "$ref": "#/responses/forbidden"
  298. // "412":
  299. // "$ref": "#/responses/error"
  300. // "422":
  301. // "$ref": "#/responses/validationError"
  302. var deadlineUnix timeutil.TimeStamp
  303. if form.Deadline != nil && ctx.Repo.CanWrite(models.UnitTypeIssues) {
  304. deadlineUnix = timeutil.TimeStamp(form.Deadline.Unix())
  305. }
  306. issue := &models.Issue{
  307. RepoID: ctx.Repo.Repository.ID,
  308. Repo: ctx.Repo.Repository,
  309. Title: form.Title,
  310. PosterID: ctx.User.ID,
  311. Poster: ctx.User,
  312. Content: form.Body,
  313. DeadlineUnix: deadlineUnix,
  314. }
  315. var assigneeIDs = make([]int64, 0)
  316. var err error
  317. if ctx.Repo.CanWrite(models.UnitTypeIssues) {
  318. issue.MilestoneID = form.Milestone
  319. assigneeIDs, err = models.MakeIDsFromAPIAssigneesToAdd(form.Assignee, form.Assignees)
  320. if err != nil {
  321. if models.IsErrUserNotExist(err) {
  322. ctx.Error(http.StatusUnprocessableEntity, "", fmt.Sprintf("Assignee does not exist: [name: %s]", err))
  323. } else {
  324. ctx.Error(http.StatusInternalServerError, "AddAssigneeByName", err)
  325. }
  326. return
  327. }
  328. // Check if the passed assignees is assignable
  329. for _, aID := range assigneeIDs {
  330. assignee, err := models.GetUserByID(aID)
  331. if err != nil {
  332. ctx.Error(http.StatusInternalServerError, "GetUserByID", err)
  333. return
  334. }
  335. valid, err := models.CanBeAssigned(assignee, ctx.Repo.Repository, false)
  336. if err != nil {
  337. ctx.Error(http.StatusInternalServerError, "canBeAssigned", err)
  338. return
  339. }
  340. if !valid {
  341. ctx.Error(http.StatusUnprocessableEntity, "canBeAssigned", models.ErrUserDoesNotHaveAccessToRepo{UserID: aID, RepoName: ctx.Repo.Repository.Name})
  342. return
  343. }
  344. }
  345. } else {
  346. // setting labels is not allowed if user is not a writer
  347. form.Labels = make([]int64, 0)
  348. }
  349. if err := issue_service.NewIssue(ctx.Repo.Repository, issue, form.Labels, nil, assigneeIDs); err != nil {
  350. if models.IsErrUserDoesNotHaveAccessToRepo(err) {
  351. ctx.Error(http.StatusBadRequest, "UserDoesNotHaveAccessToRepo", err)
  352. return
  353. }
  354. ctx.Error(http.StatusInternalServerError, "NewIssue", err)
  355. return
  356. }
  357. if form.Closed {
  358. if err := issue_service.ChangeStatus(issue, ctx.User, true); err != nil {
  359. if models.IsErrDependenciesLeft(err) {
  360. ctx.Error(http.StatusPreconditionFailed, "DependenciesLeft", "cannot close this issue because it still has open dependencies")
  361. return
  362. }
  363. ctx.Error(http.StatusInternalServerError, "ChangeStatus", err)
  364. return
  365. }
  366. }
  367. // Refetch from database to assign some automatic values
  368. issue, err = models.GetIssueByID(issue.ID)
  369. if err != nil {
  370. ctx.Error(http.StatusInternalServerError, "GetIssueByID", err)
  371. return
  372. }
  373. ctx.JSON(http.StatusCreated, issue.APIFormat())
  374. }
  375. // EditIssue modify an issue of a repository
  376. func EditIssue(ctx *context.APIContext, form api.EditIssueOption) {
  377. // swagger:operation PATCH /repos/{owner}/{repo}/issues/{index} issue issueEditIssue
  378. // ---
  379. // summary: Edit an issue. If using deadline only the date will be taken into account, and time of day ignored.
  380. // consumes:
  381. // - application/json
  382. // produces:
  383. // - application/json
  384. // parameters:
  385. // - name: owner
  386. // in: path
  387. // description: owner of the repo
  388. // type: string
  389. // required: true
  390. // - name: repo
  391. // in: path
  392. // description: name of the repo
  393. // type: string
  394. // required: true
  395. // - name: index
  396. // in: path
  397. // description: index of the issue to edit
  398. // type: integer
  399. // format: int64
  400. // required: true
  401. // - name: body
  402. // in: body
  403. // schema:
  404. // "$ref": "#/definitions/EditIssueOption"
  405. // responses:
  406. // "201":
  407. // "$ref": "#/responses/Issue"
  408. // "403":
  409. // "$ref": "#/responses/forbidden"
  410. // "404":
  411. // "$ref": "#/responses/notFound"
  412. // "412":
  413. // "$ref": "#/responses/error"
  414. issue, err := models.GetIssueByIndex(ctx.Repo.Repository.ID, ctx.ParamsInt64(":index"))
  415. if err != nil {
  416. if models.IsErrIssueNotExist(err) {
  417. ctx.NotFound()
  418. } else {
  419. ctx.Error(http.StatusInternalServerError, "GetIssueByIndex", err)
  420. }
  421. return
  422. }
  423. issue.Repo = ctx.Repo.Repository
  424. err = issue.LoadAttributes()
  425. if err != nil {
  426. ctx.Error(http.StatusInternalServerError, "LoadAttributes", err)
  427. return
  428. }
  429. if !issue.IsPoster(ctx.User.ID) && !ctx.Repo.CanWrite(models.UnitTypeIssues) {
  430. ctx.Status(http.StatusForbidden)
  431. return
  432. }
  433. if len(form.Title) > 0 {
  434. issue.Title = form.Title
  435. }
  436. if form.Body != nil {
  437. issue.Content = *form.Body
  438. }
  439. // Update or remove the deadline, only if set and allowed
  440. if (form.Deadline != nil || form.RemoveDeadline != nil) && ctx.Repo.CanWrite(models.UnitTypeIssues) {
  441. var deadlineUnix timeutil.TimeStamp
  442. if (form.RemoveDeadline == nil || !*form.RemoveDeadline) && !form.Deadline.IsZero() {
  443. deadline := time.Date(form.Deadline.Year(), form.Deadline.Month(), form.Deadline.Day(),
  444. 23, 59, 59, 0, form.Deadline.Location())
  445. deadlineUnix = timeutil.TimeStamp(deadline.Unix())
  446. }
  447. if err := models.UpdateIssueDeadline(issue, deadlineUnix, ctx.User); err != nil {
  448. ctx.Error(http.StatusInternalServerError, "UpdateIssueDeadline", err)
  449. return
  450. }
  451. issue.DeadlineUnix = deadlineUnix
  452. }
  453. // Add/delete assignees
  454. // Deleting is done the GitHub way (quote from their api documentation):
  455. // https://developer.github.com/v3/issues/#edit-an-issue
  456. // "assignees" (array): Logins for Users to assign to this issue.
  457. // Pass one or more user logins to replace the set of assignees on this Issue.
  458. // Send an empty array ([]) to clear all assignees from the Issue.
  459. if ctx.Repo.CanWrite(models.UnitTypeIssues) && (form.Assignees != nil || form.Assignee != nil) {
  460. oneAssignee := ""
  461. if form.Assignee != nil {
  462. oneAssignee = *form.Assignee
  463. }
  464. err = issue_service.UpdateAssignees(issue, oneAssignee, form.Assignees, ctx.User)
  465. if err != nil {
  466. ctx.Error(http.StatusInternalServerError, "UpdateAssignees", err)
  467. return
  468. }
  469. }
  470. if ctx.Repo.CanWrite(models.UnitTypeIssues) && form.Milestone != nil &&
  471. issue.MilestoneID != *form.Milestone {
  472. oldMilestoneID := issue.MilestoneID
  473. issue.MilestoneID = *form.Milestone
  474. if err = issue_service.ChangeMilestoneAssign(issue, ctx.User, oldMilestoneID); err != nil {
  475. ctx.Error(http.StatusInternalServerError, "ChangeMilestoneAssign", err)
  476. return
  477. }
  478. }
  479. if err = models.UpdateIssueByAPI(issue); err != nil {
  480. ctx.Error(http.StatusInternalServerError, "UpdateIssueByAPI", err)
  481. return
  482. }
  483. if form.State != nil {
  484. if err = issue_service.ChangeStatus(issue, ctx.User, api.StateClosed == api.StateType(*form.State)); err != nil {
  485. if models.IsErrDependenciesLeft(err) {
  486. ctx.Error(http.StatusPreconditionFailed, "DependenciesLeft", "cannot close this issue because it still has open dependencies")
  487. return
  488. }
  489. ctx.Error(http.StatusInternalServerError, "ChangeStatus", err)
  490. return
  491. }
  492. }
  493. // Refetch from database to assign some automatic values
  494. issue, err = models.GetIssueByID(issue.ID)
  495. if err != nil {
  496. ctx.InternalServerError(err)
  497. return
  498. }
  499. if err = issue.LoadMilestone(); err != nil {
  500. ctx.InternalServerError(err)
  501. return
  502. }
  503. ctx.JSON(http.StatusCreated, issue.APIFormat())
  504. }
  505. // UpdateIssueDeadline updates an issue deadline
  506. func UpdateIssueDeadline(ctx *context.APIContext, form api.EditDeadlineOption) {
  507. // swagger:operation POST /repos/{owner}/{repo}/issues/{index}/deadline issue issueEditIssueDeadline
  508. // ---
  509. // summary: Set an issue deadline. If set to null, the deadline is deleted. If using deadline only the date will be taken into account, and time of day ignored.
  510. // consumes:
  511. // - application/json
  512. // produces:
  513. // - application/json
  514. // parameters:
  515. // - name: owner
  516. // in: path
  517. // description: owner of the repo
  518. // type: string
  519. // required: true
  520. // - name: repo
  521. // in: path
  522. // description: name of the repo
  523. // type: string
  524. // required: true
  525. // - name: index
  526. // in: path
  527. // description: index of the issue to create or update a deadline on
  528. // type: integer
  529. // format: int64
  530. // required: true
  531. // - name: body
  532. // in: body
  533. // schema:
  534. // "$ref": "#/definitions/EditDeadlineOption"
  535. // responses:
  536. // "201":
  537. // "$ref": "#/responses/IssueDeadline"
  538. // "403":
  539. // "$ref": "#/responses/forbidden"
  540. // "404":
  541. // "$ref": "#/responses/notFound"
  542. issue, err := models.GetIssueByIndex(ctx.Repo.Repository.ID, ctx.ParamsInt64(":index"))
  543. if err != nil {
  544. if models.IsErrIssueNotExist(err) {
  545. ctx.NotFound()
  546. } else {
  547. ctx.Error(http.StatusInternalServerError, "GetIssueByIndex", err)
  548. }
  549. return
  550. }
  551. if !ctx.Repo.CanWrite(models.UnitTypeIssues) {
  552. ctx.Error(http.StatusForbidden, "", "Not repo writer")
  553. return
  554. }
  555. var deadlineUnix timeutil.TimeStamp
  556. var deadline time.Time
  557. if form.Deadline != nil && !form.Deadline.IsZero() {
  558. deadline = time.Date(form.Deadline.Year(), form.Deadline.Month(), form.Deadline.Day(),
  559. 23, 59, 59, 0, form.Deadline.Location())
  560. deadlineUnix = timeutil.TimeStamp(deadline.Unix())
  561. }
  562. if err := models.UpdateIssueDeadline(issue, deadlineUnix, ctx.User); err != nil {
  563. ctx.Error(http.StatusInternalServerError, "UpdateIssueDeadline", err)
  564. return
  565. }
  566. ctx.JSON(http.StatusCreated, api.IssueDeadline{Deadline: &deadline})
  567. }