Commit Graph
38 Commits
Author SHA1 Message Date
zeripathandGitHub 9d07facdeb Ensure review dismissal only dismisses the correct review (#15477)
Fix #15472

Signed-off-by: Andrew Thornton [email protected]
2021-04-15 11:03:11 +01:00
Bo-Yi WuandGitHub 167b0f46ef chore(models): rewrite code format. (#14754)
* chore: rewrite format.

* chore: update format

Signed-off-by: Bo-Yi Wu <[email protected]>

* chore: update format

Signed-off-by: Bo-Yi Wu <[email protected]>

* chore: Adjacent parameters with the same type should be grouped together

* chore: update format.
2021-03-14 19:52:12 +01:00
ac701637b4 Add dismiss review feature (#12674)
* Add dismiss review feature

refs:
    https://github.blog/2016-10-12-dismissing-reviews-on-pull-requests/
    https://developer.github.com/v3/pulls/reviews/#dismiss-a-review-for-a-pull-request

* change modal ui and error message

* Add unDismissReview api

Signed-off-by: a1012112796 <[email protected]>
Co-authored-by: zeripath <[email protected]>
Co-authored-by: 6543 <[email protected]>
2021-02-11 18:32:25 +01:00
b9850375fc Add review request api (#11355)
* Add review request api

* add : POST /repos/{owner}/{repo}/pulls/{index}/requested_reviewers
* Remove : DELET /repos/{owner}/{repo}/pulls/{index}/requested_reviewers
* fix some request review bug
* block delet request review by models/DeleteReview()

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

* make fmt

* fix bug

* fix test code

* fix typo

* Apply suggestion from code review @jonasfranz

* fix swagger ref

* fix typo

Co-authored-by: Lauris BH <[email protected]>

* fix comment

* Change response message

* chang response so some simplfy

* Add ErrIllLegalReviewRequest
fix some nits

* make fmt

* Apply suggestions from code review

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

* * Add team support
* fix test
* fix an known bug

* fix nit

* fix test

* Apply suggestions from code review

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

* update get api and add test

Co-authored-by: Lauris BH <[email protected]>
Co-authored-by: silverwind <[email protected]>
Co-authored-by: zeripath <[email protected]>
2020-10-20 14:18:25 -04:00
赵智超andGitHub 97980146c5 Show original author's reviews on pull summary box (#13127)
follow #12039, show original author's reviews by other way.
fix #11705.

Signed-off-by: a1012112796 <[email protected]>
2020-10-14 13:11:11 +01:00
8be3e439c2 Add team support for review request (#12039)
Add team support for review request

Block #11355

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

Co-authored-by: Lauris BH <[email protected]>
Co-authored-by: Andrew Thornton <[email protected]>
2020-10-12 20:55:13 +01:00
0e24af6951 Update Octicons to v10 (#12240)
* Update Octicons to v10

Besides a few renames, these icons are no longer present in v10 that we've
used, so had to change:

file-symlink-directory -> file-submodule
internal-repo -> repo
repo-force-push -> repo-push
repo-template-private -> repo-template

Fixes: https://github.com/go-gitea/gitea/issues/11889
Ref: https://github.com/primer/octicons/releases/tag/v10.0.0

* add custom sliders svg for removed octicon-settings

* apply suggestion

* fix triangles and use play on admin dashboard

* add custom mirror svg

* add missing build files

* unify custom svgs

* move to octicon-repo-clone to gitea-mirror

* use octicon-x on conflicts

* tweak timeline icons

* tweak comment buttons

* update settings icon to octicons v1

* switch to octicon-mirror and octicon-tools

* replace two wiki buttons with octicons

* remove whitespace in svg sources

* Fix filepath basename on Windows for SVG bindata (#12241)

* move octicons to devDependencies

* move back to dependencies

* move svgo to devDependencies again

Co-authored-by: Cirno the Strongest <[email protected]>
Co-authored-by: techknowlogick <[email protected]>
2020-07-17 18:15:12 +03:00
c97494a4f4 API: Add pull review endpoints (#11224)
* API: Added pull review read only endpoints

* Update Structs, move Conversion, Refactor

* refactor

* lint & co

* fix lint + refactor

* add new Review state, rm unessesary, refacotr loadAttributes, convert patch to diff

* add DeletePullReview

* add paggination

* draft1: Create & submit review

* fix lint

* fix lint

* impruve test

* DONT use GhostUser for loadReviewer

* expose comments_count of a PullReview

* infent GetCodeCommentsCount()

* fixes

* fix+impruve

* some nits

* Handle Ghosts 👻

* add TEST for GET apis

* complete TESTS

* add HTMLURL to PullReview responce

* code format as per @lafriks

* update swagger definition

* Update routers/api/v1/repo/pull_review.go

Co-authored-by: David Svantesson <[email protected]>

* add comments

Co-authored-by: Thomas Berger <[email protected]>
Co-authored-by: David Svantesson <[email protected]>
2020-05-02 03:20:51 +03:00
zeripathandGitHub 4974b7c120 Fix spelling mistake with Rewiew (#11262)
Signed-off-by: Andrew Thornton <[email protected]>
2020-04-30 21:24:08 +01:00
6543andGitHub 77171abcad Prevent xorm nil insert in Review.Comments (#11150) 2020-04-20 04:04:08 +01:00
1b86f174ce Add a way to mark Conversation (code comment) resolved (#11037)
* 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]>
2020-04-18 10:50:25 -03:00
cc07b9ca37 Fix CreateComment for SQLite and JS click event on Request Review (#11040)
* fix some bug about Request review

* fix ``CreateComment`` wrong using ,it will not work when use Sqlite
* fix wrong js click event code , it will send wrong data when it has
many choices

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

* Apply suggestions from code review

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

* add getReviewerByIssueIDAndUserID
fix wrong conditions check in initIssueComments after #10972

* call CI again

Co-authored-by: Lauris BH <[email protected]>
Co-authored-by: techknowlogick <[email protected]>
Co-authored-by: guillep2k <[email protected]>
2020-04-11 01:44:50 -03:00
ef89e75d0e add request review from specific reviewers feature in pull request (#10756)
* add request review feature in pull request

add a way to notify specific reviewers to review like github , by add  or delet a  special type
review . The acton is  is similar to Assign ,  so many code reuse the function and items of
Assignee, but the meaning and result is different.

The Permission style is is similar to github, that only writer can add a review request from Reviewers,
but the poster can recall and remove a review request after a reviwer has revied even if he don't have
Write Premission. only manager , the poster and reviewer of a request review can remove it.

The reviewers can be requested to review contain all readers for private repo , for public, contain
all writers and watchers.

The offical Review Request will block merge if Reject can block it.

an other change: add ui otify for Assignees.

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

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

* new change

* add placeholder string

* do some changes follow #10238 to add review requests num on lists also
change icon for review requests to eye

Co-authored-by: Lauris BH <[email protected]>
2020-04-06 19:33:34 +03:00
f685edf510 Change review status icons on PR view style to Github style (#10737)
* change the icon of ApproveReview pr from "eye" to "check" like github
* change the icon of RejectReview pr from "x" to "request-change" like github
* add "-" after "{{" which need to be one line (TODO: may be not change all)

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

Co-authored-by: Lunny Xiao <[email protected]>
Co-authored-by: John Olheiser <[email protected]>
Co-authored-by: guillep2k <[email protected]>
2020-04-03 02:12:42 -03:00
Lunny XiaoandLauris BH f6067a8465 Migrate reviews when migrating repository from github (#9463)
* fix typo

* Migrate reviews when migrating repository from github

* fix lint

* Added test and migration when external user login

* fix test

* fix commented state

* Some improvements

* fix bug when get pull request and ref original author on code comments

* Fix migrated line; Added comment for review

* Don't load all pull requests attributes

* Fix typo

* wrong change copy head

* fix tests

* fix reactions

* Fix test

* fix fmt

* fix review comment reactions
2020-01-23 19:28:15 +02:00
David Svantessonandzeripath 25531c71a7 Mark PR reviews as stale at push and allow to dismiss stale approvals (#9532)
Fix #5997.

If a push causes the patch/diff of a PR towards target branch to change, all existing reviews for the PR will be set and shown as stale.
New branch protection option to dismiss stale approvals are added.
To show that a review is not based on the latest PR changes, an hourglass is shown
2020-01-09 01:47:45 +00:00
0c07f1de5b Provide Default messages for merges (#9393)
Co-Authored-By: guillep2k <[email protected]>
2019-12-30 18:34:11 -05:00
Lunny XiaoandGitHub 43ada65571 remove unused method and rename createcommentWithNoAction (#9367) 2019-12-16 11:54:24 +08:00
David Svantessonandtechknowlogick bac4b78e09 Branch protection: Possibility to not use whitelist but allow anyone with write access (#9055)
* Possibility to not use whitelist but allow anyone with write access

* fix existing test

* rename migration function

* Try to give a better name for migration step

* Clear settings if higher level setting is not set

* Move official reviews to db instead of counting approvals each time

* migration

* fix

* fix migration

* fix migration

* Remove NOT NULL from EnableWhitelist as migration isn't possible

* Fix migration, reviews are connected to issues.

* Fix SQL query issues in GetReviewersByPullID.

* Simplify function GetReviewersByIssueID

* Handle reviewers that has been deleted

* Ensure reviews for test is in a well defined order

* Only clear and set official reviews when it is an approve or reject.
2019-12-03 20:08:56 -05:00
David Svantessonandtechknowlogick 1aa7e27dd0 Change review content column to type text in db (#9229) 2019-12-02 13:32:40 -05:00
Lunny Xiaoandtechknowlogick 2011a5b818 Extract createComment (#9125)
* Extract createComment

* fix lint

* fix lint
2019-11-30 21:44:39 -05:00
guillep2kandtechknowlogick d779deef6e Fix show single review comments in the PR page (#9143) 2019-11-24 00:46:16 -05:00
guillep2kandzeripath 9930d47be2 Add review comments to mail notifications (#8996) 2019-11-15 12:59:21 +00:00
John Olheiserandzeripath 4b5ebb93e4 New review approvals shouldn't require a message (#8991)
* New approvals don't require content

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

* Fix edge-bug

Signed-off-by: jolheiser <[email protected]>
2019-11-14 20:58:01 +00:00
Lunny XiaoandGitHub dad67cae54 Refactor pull request review (#8954)
* refactor submit review

* remove unnecessary code

* remove unused comment

* fix lint

* remove duplicated actions

* remove duplicated actions

* fix typo

* fix comment content
2019-11-14 10:57:36 +08:00
Lunny XiaoandLauris BH 12170d26a7 Split sendCreateCommentAction as two parts, one for update comment related informations, another for actions (#8784)
* Split sendCreateCommentAction as two parts, one for update comment related informations, another for actions

* fix lint
2019-11-06 15:39:29 +02:00
Lunny XiaoandAntoine GIRARD d151503d34 Upgrade xorm to v0.8.0 (#8536) 2019-10-17 11:26:49 +02:00
Lunny XiaoandGitHub 85202d4784 Display ui time with customize time location (#7792)
* display ui time with customize time location

* fix lint

* rename UILocation to DefaultUILocation

* move time related functions to modules/timeutil

* fix tests

* fix tests

* fix build

* fix swagger
2019-08-15 22:46:21 +08:00
Lunny XiaoandGitHub c021890930 move CreateReview to moduels/pull (#7841) 2019-08-14 23:32:19 +08:00
Lunny XiaoandLauris BH aa7c34cf86 Fix error log when loading issues caused by a xorm bug (#7271)
* fix error log when loading issues caused by a xorm bug

* upgrade packages

* fix fmt

* fix Consistency

* fix tests
2019-06-23 18:22:43 +03:00
Lunny XiaoandGitHub 34eee25bd4 Move sdk structs to modules/structs (#6905)
* move sdk structs to moduels/structs

* fix tests

* fix fmt

* fix swagger

* fix vendor
2019-05-11 18:21:34 +08:00
Lanre Adelowoandtechknowlogick 945804f800 Webhook for Pull Request approval/rejection (#5027) 2018-12-27 13:04:30 -05:00
Jonas FranzandLunny Xiao 9681c83734 Approvals at Branch Protection (#5350)
* Add branch protection for approvals

Signed-off-by: Jonas Franz <[email protected]>

* Add required approvals

Signed-off-by: Jonas Franz <[email protected]>

* Add missing comments and fmt

Signed-off-by: Jonas Franz <[email protected]>

* Add type = approval and group by reviewer_id to review

* Prevent users from adding negative review limits

* Add migration for approval whitelists

Signed-off-by: Jonas Franz <[email protected]>
2018-12-11 19:28:37 +08:00
Lunny XiaoandGitHub 284b0e12cb fix code review on mssql (#5502) 2018-12-11 09:09:46 +08:00
kolaenteandLauris BH 0dcf31ae49 Show review summary in pull requests (#5132) 2018-11-22 15:17:36 +02:00
Oleg KovalovandLunny Xiao fef0410b92 Make switch more clear (#5119) 2018-10-19 21:36:41 +08:00
Lunny XiaoandGitHub ea619b39b2 Add notification interface and refactor UI notifications (#5085)
* add notification interface and refactor UI notifications

* add missing methods on notification interface and notifiy only issue status really changed

* implement NotifyPullRequestReview for ui notification
2018-10-18 19:23:05 +08:00
Lauris BHandJonas Franz 6e64f9db8e Pull request review/approval and comment on code (#3748)
* Initial ui components for pull request review

* Add Review
Add IssueComment types

Signed-off-by: Jonas Franz <[email protected]>

(cherry picked from commit 2b4daab)
Signed-off-by: Jonas Franz <[email protected]>

* Replace ReviewComment with Content

Signed-off-by: Jonas Franz <[email protected]>

* Add load functions
Add ReviewID to findComments

Signed-off-by: Jonas Franz <[email protected]>

* Add create review comment implementation
Add migration for review
Other small changes

Signed-off-by: Jonas Franz <[email protected]>

* Simplified create and find functions for review

Signed-off-by: Jonas Franz <[email protected]>

* Moved "Pending" to first position

Signed-off-by: Jonas Franz <[email protected]>

* Add GetCurrentReview to simplify fetching current review

Signed-off-by: Jonas Franz <[email protected]>

* Preview for listing comments

Signed-off-by: Jonas Franz <[email protected]>

* Move new comment form to its own file

Signed-off-by: Jonas Franz <[email protected]>

* Implement Review form
Show Review comments on comment stream

Signed-off-by: Jonas Franz <[email protected]>

* Add support for single comments
Showing buttons in context

Signed-off-by: Jonas Franz <[email protected]>

* Add pending tag to pending review comments

Signed-off-by: Jonas Franz <[email protected]>

* Add unit tests for Review

Signed-off-by: Jonas Franz <[email protected]>

* Fetch all review ids at once
Add unit tests

Signed-off-by: Jonas Franz <[email protected]>

* gofmt

Signed-off-by: Jonas Franz <[email protected]>

* Improved comment rendering in "Files" view by adding Comments to DiffLine

Signed-off-by: Jonas Franz <[email protected]>

* Add support for invalidating comments

Signed-off-by: Jonas Franz <[email protected]>

* Switched back to code.gitea.io/git

Signed-off-by: Jonas Franz <[email protected]>

* Moved review migration from v64 to v65

Signed-off-by: Jonas Franz <[email protected]>

* Rebuild css

Signed-off-by: Jonas Franz <[email protected]>

* gofmt

Signed-off-by: Jonas Franz <[email protected]>

* Improve translations

Signed-off-by: Jonas Franz <[email protected]>

* Fix unit tests by updating fixtures and updating outdated test

Signed-off-by: Jonas Franz <[email protected]>

* Comments will be shown at the right place now

Signed-off-by: Jonas Franz <[email protected]>

* Add support for deleting CodeComments

Signed-off-by: Jonas Franz <[email protected]>

* Fix problems caused by files in subdirectories

Signed-off-by: Jonas Franz <[email protected]>

* Add support for showing code comments of reviews in conversation

Signed-off-by: Jonas Franz <[email protected]>

* Add support for "Show/Hide outdated"

Signed-off-by: Jonas Franz <[email protected]>

* Update code.gitea.io/git

Signed-off-by: Jonas Franz <[email protected]>

* Add support for new webhooks

Signed-off-by: Jonas Franz <[email protected]>

* Update comparison

Signed-off-by: Jonas Franz <[email protected]>

* Resolve conflicts

Signed-off-by: Jonas Franz <[email protected]>

* Minor UI improvements

* update code.gitea.io/git

* Fix ui bug reported by @lunny causing wrong position of add button
Add functionality to "Cancel" button
Add scale effects to add button
Hide "Cancel" button for existing comments

Signed-off-by: Jonas Franz <[email protected]>

* Prepare solving conflicts

Signed-off-by: Jonas Franz <[email protected]>

* Show add button only if no comments already exist for the line

Signed-off-by: Jonas Franz <[email protected]>

* Add missing vendor files

Signed-off-by: Jonas Franz <[email protected]>

* Check if reviewer is nil

Signed-off-by: Jonas Franz <[email protected]>

* Show forms only to users who are logged in

Signed-off-by: Jonas Franz <[email protected]>

* Revert "Show forms only to users who are logged in"

This reverts commit c083682

Signed-off-by: Jonas Franz <[email protected]>

* Save patch in comment
Render patch for code comments

Signed-off-by: Jonas Franz <[email protected]>

* Add link to comment in code

Signed-off-by: Jonas Franz <[email protected]>

* Add reply form to comment list
Show forms only to signed in users

Signed-off-by: Jonas Franz <[email protected]>

* Add 'Reply' as translatable
Add CODE_COMMENT_LINES setting

Signed-off-by: Jonas Franz <[email protected]>

* gofmt

Signed-off-by: Jonas Franz <[email protected]>

* Fix problems introduced by checking for singed in user

Signed-off-by: Jonas Franz <[email protected]>

* Add v70

Signed-off-by: Jonas Franz <[email protected]>

* Update generated stylesheet

Signed-off-by: Jonas Franz <[email protected]>

* Fix preview
Beginn with new review comment patch system

Signed-off-by: Jonas Franz <[email protected]>

* Add new algo to generate diff for line range
Remove old algo used for cutting big diffs (it was very buggy)

* Add documentation and example for CutDiffAroundLine

* Fix example of CutDiffAroundLine

* Fix some comment UI rendering bugs

* Add code comment edit mode

* Send notifications / actions to users until review gets published
Fix diff generation bug
Fix wrong hashtag

* Fix vet errors

* Send notifications also for single comments

* Fix some notification bugs, fix link

* Fix: add comment icon is only shown on code lines

* Add lint comment

* Add unit tests for git diff

* Add more error messages

* Regenerated css

Signed-off-by: Jonas Franz <[email protected]>

* fmt

Signed-off-by: Jonas Franz <[email protected]>

* Regenerated CSS with latest less version

Signed-off-by: Jonas Franz <[email protected]>

* Fix test by updating comment type to new ID

Signed-off-by: Jonas Franz <[email protected]>

* Introducing CodeComments as type for map[string]map[int64][]*Comment
Other minor code improvements

Signed-off-by: Jonas Franz <[email protected]>

* Fix data-tab issues

Signed-off-by: Jonas Franz <[email protected]>

* Remove unnecessary change

Signed-off-by: Jonas Franz <[email protected]>

* refactored checkForInvalidation

Signed-off-by: Jonas Franz <[email protected]>

* Append comments instead of setting

Signed-off-by: Jonas Franz <[email protected]>

* Use HeadRepo instead of BaseRepo

Signed-off-by: Jonas Franz <[email protected]>

* Update migration

Signed-off-by: Jonas Franz <[email protected]>

* Regenerated CSS

Signed-off-by: Jonas Franz <[email protected]>

* Add copyright

Signed-off-by: Jonas Franz <[email protected]>

* Update index.css

Signed-off-by: Jonas Franz <[email protected]>
2018-08-06 06:43:21 +02:00