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

Issue content should not be updated when closing with comment #2833

Merged
merged 3 commits into from
Nov 3, 2017

Conversation

lafriks
Copy link
Member

@lafriks lafriks commented Nov 2, 2017

Fixes #2551

@lafriks lafriks added this to the 1.3.0 milestone Nov 2, 2017
@lafriks lafriks force-pushed the fix/issue_comment_close branch 2 times, most recently from 5b71fe4 to 5508747 Compare November 3, 2017 00:58
Copy link
Member

@ethantkoenig ethantkoenig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple nits

@@ -107,7 +107,7 @@ func TestNoLoginViewIssue(t *testing.T) {
MakeRequest(t, req, http.StatusOK)
}

func testNewIssue(t *testing.T, session *TestSession, user, repo, title string) {
func testNewIssue(t *testing.T, session *TestSession, user, repo, title, content string) string {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: from the signature, it's not obvious what the function returns. Could we add a brief comment specifying that the created issue's URL is returned?

return issueURL
}

func testIssueAddComment(t *testing.T, session *TestSession, issueURL, content, status string) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: it's not obvious what values are valid for status (without looking through other parts of the codebase), and if I see something like testIssueAddComment(t, sess, url, "hello", "close") in a test, it's not obvious that this will close the issue, in addition to making a comment.

Could we instead do:

func testIssueAddComment(t, session, issueURL, content) {
	testIssueAndCommentWithStatus(t,session,issueURL,content,"")
}

func testIssueAddClosingComment(t, session, issueURL, content) {
	testIssueAndCommentWithStatus(t,session,issueURL,content,"close")
}

// helper function
func testIssueAddCommentWithStatus(t, session, issueURL, content, status) {
	...
}

I think this will make it easier for future tests to reuse these helpers, and will make tests more readable.

@ethantkoenig
Copy link
Member

LGTM

@tboerger tboerger added the lgtm/need 1 This PR needs approval from one additional maintainer to be merged. label Nov 3, 2017
@lunny
Copy link
Member

lunny commented Nov 3, 2017

But CI failed.

@ethantkoenig
Copy link
Member

@lunny I'm guessing the CI failure will be fixed by #2835.

@codecov-io
Copy link

codecov-io commented Nov 3, 2017

Codecov Report

Merging #2833 into master will not change coverage.
The diff coverage is 16.66%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #2833   +/-   ##
=======================================
  Coverage   26.85%   26.85%           
=======================================
  Files          89       89           
  Lines       17607    17607           
=======================================
  Hits         4728     4728           
  Misses      12193    12193           
  Partials      686      686
Impacted Files Coverage Δ
models/mail.go 0% <0%> (ø) ⬆️
models/issue_mail.go 5.97% <25%> (ø) ⬆️
models/issue_comment.go 30.6% <40%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8798cf4...a9b4dd5. Read the comment docs.

@lunny
Copy link
Member

lunny commented Nov 3, 2017

@ethantkoenig no. I think it's not that issue.

@lunny
Copy link
Member

lunny commented Nov 3, 2017

LGTM

@tboerger tboerger added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Nov 3, 2017
@lunny lunny merged commit 2406094 into go-gitea:master Nov 3, 2017
@lafriks lafriks deleted the fix/issue_comment_close branch November 3, 2017 09:58
@go-gitea go-gitea locked and limited conversation to collaborators Nov 23, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. type/bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

"Comment and close" replaces first issue comment with last comment
5 participants