-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Issue due date #3794
Issue due date #3794
Changes from 47 commits
406cd5a
859cd47
02415f7
bfef995
74c9e07
aeb3db9
211b2ed
82d7bf0
13a12c3
c1ada01
6663012
f4baf19
06d9649
3bf2227
60bbb23
192f31e
f766101
a1b79fe
e659699
bdec65a
38e1180
51d3e4f
5c93fe0
7292c30
6fb31d6
3ae5b7a
0b18607
2efba88
d8ba5ab
674d2ed
b8760ba
c88a59d
7c0e537
30a2c70
bf2d849
30dbda4
b9f193a
3c8216f
fb7463f
1c47d90
81c93d6
d02d09c
253d48f
c17c95b
d7f4798
f35fec0
1412580
fe68965
65e841d
311dc73
8d3fff2
3f570d4
a7a9529
d49dd2f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -47,9 +47,10 @@ type Issue struct { | |
Ref string | ||
|
||
DeadlineUnix util.TimeStamp `xorm:"INDEX"` | ||
CreatedUnix util.TimeStamp `xorm:"INDEX created"` | ||
UpdatedUnix util.TimeStamp `xorm:"INDEX updated"` | ||
ClosedUnix util.TimeStamp `xorm:"INDEX"` | ||
|
||
CreatedUnix util.TimeStamp `xorm:"INDEX created"` | ||
UpdatedUnix util.TimeStamp `xorm:"INDEX updated"` | ||
ClosedUnix util.TimeStamp `xorm:"INDEX"` | ||
|
||
Attachments []*Attachment `xorm:"-"` | ||
Comments []*Comment `xorm:"-"` | ||
|
@@ -79,6 +80,11 @@ func (issue *Issue) loadTotalTimes(e Engine) (err error) { | |
return nil | ||
} | ||
|
||
// IsOverdue checks if the issue is overdue | ||
func (issue *Issue) IsOverdue() bool { | ||
return util.TimeStampNow() >= issue.DeadlineUnix | ||
} | ||
|
||
func (issue *Issue) loadRepo(e Engine) (err error) { | ||
if issue.Repo == nil { | ||
issue.Repo, err = getRepositoryByID(e, issue.RepoID) | ||
|
@@ -348,6 +354,9 @@ func (issue *Issue) APIFormat() *api.Issue { | |
apiIssue.PullRequest.Merged = issue.PullRequest.MergedUnix.AsTimePtr() | ||
} | ||
} | ||
if issue.DeadlineUnix != 0 { | ||
apiIssue.Deadline = issue.DeadlineUnix.AsTimePtr() | ||
} | ||
|
||
return apiIssue | ||
} | ||
|
@@ -1522,3 +1531,30 @@ func updateIssue(e Engine, issue *Issue) error { | |
func UpdateIssue(issue *Issue) error { | ||
return updateIssue(x, issue) | ||
} | ||
|
||
// UpdateIssueDeadline updates an issue deadline and adds comments. Setting a deadline to 0 means deleting it. | ||
func UpdateIssueDeadline(issue *Issue, deadlineUnix util.TimeStamp, doer *User) (err error) { | ||
|
||
// if the deadline hasn't changed do nothing | ||
if issue.DeadlineUnix == deadlineUnix { | ||
return nil | ||
} | ||
|
||
sess := x.NewSession() | ||
defer sess.Close() | ||
if err := sess.Begin(); err != nil { | ||
return err | ||
} | ||
|
||
// Update the deadline | ||
if err = updateIssueCols(sess, &Issue{ID: issue.ID, DeadlineUnix: deadlineUnix}, "deadline_unix"); err != nil { | ||
return err | ||
} | ||
|
||
// Make the comment | ||
if _, err = createDeadlineComment(sess, doer, issue, deadlineUnix); err != nil { | ||
return fmt.Errorf("createRemovedDueDateComment: %v", err) | ||
} | ||
|
||
return sess.Commit() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If you want transaction, you have to call
If not, this is not needed and you can just There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure, I'll add that. |
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -736,8 +736,22 @@ issues.add_time_minutes = Minutes | |
issues.add_time_sum_to_small = No time was entered. | ||
issues.cancel_tracking = Cancel | ||
issues.cancel_tracking_history = `cancelled time tracking %s` | ||
issues.time_spent_total = Total Time Spent | ||
issues.time_spent_from_all_authors = `Total Time Spent: %s` | ||
|
||
issues.due_date = Due date | ||
issues.invalid_due_date_format = "Due date format is invalid, must be 'yyyy-mm-dd'." | ||
issues.error_modifying_due_date = "An error occured while modifying the due date." | ||
issues.error_removing_due_date = "An error occured while remvoing the due date." | ||
issues.due_date_form = "Due date, format yyyy-mm-dd" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think that
could be confusing for users from non-english countries (like Germany) because modern browsers use for the UI the local date format (in Germany: dd.mm.yyyy) and as value There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, but that value is used as a placeholder for the input. If the browser supports Some screenshots with an empty input: The format doesnt really seem to be an issue here. Also, currently the date is not localized anywhere, so if we'd start doing that here we should do it everywhere which is totally out of scope for this pr. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If the placeholder isn't shown at all it could be removed to reduce translation effort. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is shown when the browser doesn't support the |
||
issues.due_date_form_add = "Add due date" | ||
issues.due_date_form_update = "Update due date" | ||
issues.due_date_form_remove = "Remove due date" | ||
issues.due_date_not_writer = "You need to have at least write access to this repository in order to update the due date for this issue." | ||
issues.due_date_not_set = "No due date set." | ||
issues.due_date_added = "added the due date %s %s" | ||
issues.due_date_modified = "modified the due date to %s from %s %s" | ||
issues.due_date_remove = "removed the due date %s %s" | ||
issues.due_date_overdue = "Overdue" | ||
|
||
pulls.desc = Enable merge requests and code reviews. | ||
pulls.new = New Pull Request | ||
|
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1544,6 +1544,9 @@ | |
margin-top: -5px; | ||
margin-right: 5px; | ||
} | ||
.overdue{ | ||
color: red; | ||
} | ||
} | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now, do we really need this session? What you want to achieve here?
From xorm readme:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I need that session to create the comment.