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

Add a way to mark Conversation (code comment) resolved #11037

Merged
merged 18 commits into from
Apr 18, 2020

Conversation

a1012112796
Copy link
Member

@a1012112796 a1012112796 commented Apr 10, 2020

mark Conversation is a way to mark a Conversation is stale or be solved. when it's marked as stale, will be hided like stale. all Pull Request writer , Offical Reviewers and poster can add or remove Conversation resolved mark.

view:
jf4


jf2


jf1

mark Conversation is a way to mark a Conversation is stale
or be solved. when it's marked as stale, will be hided like
stale. all Pull Request writer , Offical Reviewers and poster
can add or remove Conversation resolved mark.

Signed-off-by: a1012112796 <[email protected]>
@lafriks
Copy link
Member

lafriks commented Apr 10, 2020

Field should probably be named not Assignee but something like ResolvedBy

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Apr 10, 2020
@lunny lunny added the type/feature Completely new functionality. Can only be merged if feature freeze is not active. label Apr 10, 2020
models/review.go Outdated Show resolved Hide resolved
@6543
Copy link
Member

6543 commented Apr 11, 2020

pleace resolve conflicts and dont use Asignee

models/issue_comment.go Outdated Show resolved Hide resolved
@codecov-io
Copy link

codecov-io commented Apr 12, 2020

Codecov Report

Merging #11037 into master will decrease coverage by 0.06%.
The diff coverage is 6.77%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #11037      +/-   ##
==========================================
- Coverage   43.53%   43.46%   -0.07%     
==========================================
  Files         599      600       +1     
  Lines       84825    84943     +118     
==========================================
- Hits        36927    36920       -7     
- Misses      43351    43468     +117     
- Partials     4547     4555       +8     
Impacted Files Coverage Δ
models/migrations/migrations.go 3.50% <ø> (ø)
models/migrations/v138.go 0.00% <0.00%> (ø)
routers/repo/issue.go 35.56% <0.00%> (-0.19%) ⬇️
routers/repo/pull_review.go 0.00% <0.00%> (ø)
models/review.go 29.64% <5.00%> (-2.57%) ⬇️
routers/repo/pull.go 34.24% <20.00%> (-0.08%) ⬇️
models/issue_comment.go 46.11% <25.00%> (-0.58%) ⬇️
routers/routes/routes.go 86.59% <100.00%> (+0.01%) ⬆️
services/pull/check.go 50.00% <0.00%> (-5.49%) ⬇️
services/pull/patch.go 62.93% <0.00%> (-2.80%) ⬇️
... and 11 more

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 38d5f88...1ae80d1. Read the comment docs.

routers/repo/pull_review.go Show resolved Hide resolved
Add permission check in UpdateResolveConversation
@6543
Copy link
Member

6543 commented Apr 12, 2020

Thanks you can resolve my comments - I'll look into this pr later :)

models/issue_comment.go Outdated Show resolved Hide resolved
models/review.go Outdated Show resolved Hide resolved
routers/repo/pull_review.go Show resolved Hide resolved
routers/repo/pull_review.go Outdated Show resolved Hide resolved
routers/repo/pull_review.go Show resolved Hide resolved
routers/repo/pull_review.go Outdated Show resolved Hide resolved
@guillep2k guillep2k added this to the 1.12.0 milestone Apr 13, 2020
@guillep2k
Copy link
Member

A migration needs to be added for creating the "ResolveDoerID" column. See the following files for examples:

models/migrations/migrations.go
models/migrations/v135.go

@6543

This comment has been minimized.

@guillep2k
Copy link
Member

@6543 probably your test setup has data from other PRs that are not included here. This PR doesn't change any repo units.

@6543
Copy link
Member

6543 commented Apr 13, 2020

O kanban hit me, had no time to look at trace yesterday - I'll try on new test enviroment

Copy link
Member

@6543 6543 left a comment

Choose a reason for hiding this comment

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

I'm OK with this - only @guillep2k imprufements are missing
so I wont block.

@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Apr 13, 2020
a1012112796 and others added 2 commits April 14, 2020 15:58
* change return error for permisson check
* add default message for deleted user
* get issue message from comment
* add migration for ``ResolveDoerID`` column

another  change:
* block mark pending review as resolved because it's not necessary

Co-authored-by: guillep2k <[email protected]>
@lunny
Copy link
Member

lunny commented Apr 14, 2020

Could we change the color of the new button ?

图片

for _, comment := range comments {
if err := comment.LoadResolveDoer(); err != nil {
Copy link
Member

Choose a reason for hiding this comment

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

When the user deleted, but the comment should be still loaded.

Copy link
Member Author

@a1012112796 a1012112796 Apr 14, 2020

Choose a reason for hiding this comment

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

yes, But It willn't be error if user is deleted now, it will load an default user to replace it, but the name to show will be not right , that's the thing what I think now. maybe shold save user name instead of user id, then it willn't be a problem , do you think so ? Thanks

Copy link
Member

Choose a reason for hiding this comment

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

@lunny If understand what you mean, that's taken care of in LoadResolveDoer:

c.ResolveDoer, err = getUserByID(x, c.ResolveDoerID)
if err != nil {
if IsErrUserNotExist(err) {
c.ResolveDoerID = -1
c.ResolveDoer = NewGhostUser()
err = nil
}
}

return false, err
}

permResult = perm.CanAccess(AccessModeWrite, UnitTypePullRequests)
Copy link
Member

Choose a reason for hiding this comment

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

We should check if this PR's base branch is protected. If it's protected, we should check if it's official review, otherwise we should check if it's the writer of the pull request unit.

Copy link
Member Author

Choose a reason for hiding this comment

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

Hello, I think I also have done what you say, because IsOfficialReviewer will check them by step. then I'd like to do more easy check more earlly to lower average time cost , so I first check whether doer is poster of PR, if not ,then check if doer have write permission of pull request, at last check if doer is offical reviewer by IsOfficialReviewer. do ypu think so? Thanks.

gitea/models/review.go

Lines 185 to 205 in cc07b9c

// IsOfficialReviewer check if reviewer can make official reviews in issue (counts towards required approvals)
func IsOfficialReviewer(issue *Issue, reviewer *User) (bool, error) {
return isOfficialReviewer(x, issue, reviewer)
}
func isOfficialReviewer(e Engine, issue *Issue, reviewer *User) (bool, error) {
pr, err := getPullRequestByIssueID(e, issue.ID)
if err != nil {
return false, err
}
if err = pr.loadProtectedBranch(e); err != nil {
return false, err
}
if pr.ProtectedBranch == nil {
return false, nil
}
return pr.ProtectedBranch.isUserOfficialReviewer(e, reviewer)
}

Copy link
Member

@6543 6543 left a comment

Choose a reason for hiding this comment

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

just some docs issue

models/migrations/migrations.go Outdated Show resolved Hide resolved
models/migrations/migrations.go Outdated Show resolved Hide resolved
@a1012112796
Copy link
Member Author

Could we change the color of the new button ?

图片

which color do you think is more better to use in here? Thanks

@6543
Copy link
Member

6543 commented Apr 14, 2020

@a1012112796 can you resolve merge conflicts :)

@guillep2k
Copy link
Member

which color do you think is more better to use in here? Thanks

Something less outstanding, perhaps half color saturation? (#89DD9B)

image

Or gray/whiteish, black text, similar to GH?

Copy link
Member

@guillep2k guillep2k left a comment

Choose a reason for hiding this comment

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

Looks good to me. Just a couple of nits.

models/issue_comment.go Outdated Show resolved Hide resolved
models/review.go Outdated Show resolved Hide resolved
models/review.go Outdated Show resolved Hide resolved
@GiteaBot GiteaBot 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 Apr 16, 2020
a1012112796 and others added 2 commits April 16, 2020 15:27
* remove unusefull code

Co-authored-by: guillep2k <[email protected]>
@guillep2k
Copy link
Member

@lunny this requires your review.

@guillep2k
Copy link
Member

ping lg-tm

@guillep2k guillep2k merged commit 1b86f17 into go-gitea:master Apr 18, 2020
ydelafollye pushed a commit to ydelafollye/gitea that referenced this pull request Jul 31, 2020
* Add a way to mark Conversation (code comment) resolved

mark Conversation is a way to mark a Conversation is stale
or be solved. when it's marked as stale, will be hided like
stale. all Pull Request writer , Offical Reviewers and poster
can add or remove Conversation resolved mark.

Signed-off-by: a1012112796 <[email protected]>

* fix lint

* Apply suggestions from code review

* Add ResolveDoer
* fix ui

Co-Authored-By: Lauris BH <[email protected]>
Co-Authored-By: 6543 <[email protected]>

* change IsResolved to an function
Add permission check in UpdateResolveConversation

* Apply suggestions from code review

* change return error for permisson check
* add default message for deleted user
* get issue message from comment
* add migration for ``ResolveDoerID`` column

another  change:
* block mark pending review as resolved because it's not necessary

Co-authored-by: guillep2k <[email protected]>

* change button color

* resolve button size

* fix code style

* remove unusefull code

Co-authored-by: guillep2k <[email protected]>

Co-authored-by: Lauris BH <[email protected]>
Co-authored-by: 6543 <[email protected]>
Co-authored-by: guillep2k <[email protected]>
@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
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. type/feature Completely new functionality. Can only be merged if feature freeze is not active.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants