Commit Graph
146 Commits
Author SHA1 Message Date
9d99f6ab19 Refactor renders (#15175)
* Refactor renders

* Some performance optimization

* Fix comment

* Transform reader

* Fix csv test

* Fix test

* Fix tests

* Improve optimaziation

* Fix test

* Fix test

* Detect file encoding with reader

* Improve optimaziation

* reduce memory usage

* improve code

* fix build

* Fix test

* Fix for go1.15

* Fix render

* Fix comment

* Fix lint

* Fix test

* Don't use NormalEOF when unnecessary

* revert change on util.go

* Apply suggestions from code review

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

* rename function

* Take NormalEOF back

Co-authored-by: zeripath <[email protected]>
2021-04-19 18:25:08 -04: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
f0e15250b9 Migrate to use jsoniter instead of encoding/json (#14841)
* Migrate to use jsoniter

* fix tests

* update gitea.com/go-chi/binding

Signed-off-by: Andrew Thornton <[email protected]>
Co-authored-by: 6543 <[email protected]>
2021-03-01 22:08:10 +01:00
d38ae597e1 Add UI to delete tracked times (#14100)
Co-authored-by: 6543 <[email protected]>
2021-02-19 12:52:11 +02: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
Lunny XiaoandGitHub c0c59a4c99 Improve the comment on comment type (#14609) 2021-02-10 04:57:30 +01:00
a0e424da85 Enhance Ghost comment mitigation Settings (#14392)
* refactor models.DeleteComment and delete related reactions too

* use deleteComment for UserDeleteWithCommentsMaxDays in DeleteUser

* nits

* Use time.Duration as other time settings have

* docs

* Resolve Fixme & fix potential deadlock

* Disabled by Default

* Update Config Value Description

* switch args

* Update models/issue_comment.go

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

Co-authored-by: zeripath <[email protected]>
2021-01-21 21:56:19 -05:00
bcb7f35221 Do not reload page after adding comments in Pull Request reviews (#13877)
Fixed #8861 
* use ajax on PR review page

* handle review comments

* extract duplicate code

FetchCodeCommentsByLine was initially more or less copied from fetchCodeCommentsByReview. Now they both use a common findCodeComments function instead

* use the Engine that was passed into the method

Co-authored-by: 6543 <[email protected]>
Co-authored-by: Lunny Xiao <[email protected]>
Co-authored-by: Lauris BH <[email protected]>
2021-01-08 23:49:55 +02:00
6543andGitHub a19447aed1 migrate from com.* to alternatives (#14103)
* remove github.com/unknwon/com from models

* dont use "com.ToStr()"

* replace "com.ToStr" with "fmt.Sprint" where its easy to do

* more refactor

* fix test

* just "proxy" Copy func for now

* as per @lunny
2020-12-25 11:59:32 +02:00
b091c994b5 Comments on review should have the same sha (#13448)
* When replying to an outdated comment it should not appear on the files page

This happened because the comment took the latest commitID as its base instead of the
reviewID that it was replying to.

There was also no way of creating an already outdated comment - and a
reply to a review on an outdated line should be outdated.

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

* fix test

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

* Fix broken migration

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

* fix mssql

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

* Create temporary table because ... well MSSQL ...

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

* Create temporary table because ... well MSSQL ...

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

* Create temporary table because ... well MSSQL ...

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

* fix mssql

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

* move session within the batch

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

* regen the sqlcmd each time round the loop

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

* as per @lunny

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

Co-authored-by: techknowlogick <[email protected]>
Co-authored-by: Lunny Xiao <[email protected]>
2020-11-09 01:15:09 -05:00
Lunny XiaoandGitHub 35cc82abbf Revert "Replies to outdated code comments should also be outdated (#13217)" (#13439)
This reverts commit 3cab3bee57.
2020-11-06 09:04:21 +02:00
3cab3bee57 Replies to outdated code comments should also be outdated (#13217)
* When replying to an outdated comment it should not appear on the files page

This happened because the comment took the latest commitID as its base instead of the
reviewID that it was replying to.

There was also no way of creating an already outdated comment - and a
reply to a review on an outdated line should be outdated.

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

* fix test

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

Co-authored-by: techknowlogick <[email protected]>
2020-11-04 17:55:15 -05:00
06268dcf53 Fix reactions on code comments (#13390)
Co-authored-by: Lunny Xiao <[email protected]>
2020-11-02 10:56:02 +02:00
c40df54e28 Group Label Changed Comments in timeline (#13304)
* Create function to group label comments

* Combine multiple label additions into one

* Group removed and added labels in the same comment

* Fix indentation on comments.tmpl

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

Co-authored-by: zeripath <[email protected]>
2020-10-25 17:49:48 -04:00
d453533beb [Refactor] Move APIFormat functions into convert package (#12856)
* USER APIFormat -> ToUser

* Migrate more and mark APIFormat deprecated

* models.Comment APIFormat() -> convert.ToComment

* models.Release APIFormat() -> convert.ToRelease

* models.Attachments APIFormat() -> convert.ToReleaseAttachments

* models.CommitStatus APIFormat() -> convert.ToCommitStatus

* finish migration to convert.ToUser

* Move Test

* Imprufe Test

* fix test

Co-authored-by: techknowlogick <[email protected]>
2020-10-17 00:23:08 -04: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
+3 4027c5dd7c Kanban board (#8346)
Co-authored-by: 6543 <[email protected]>
Co-authored-by: jaqra <[email protected]>
Co-authored-by: Kerry <[email protected]>
Co-authored-by: Jaqra <[email protected]>
Co-authored-by: Kyle Evans <[email protected]>
Co-authored-by: Tsakiridis Ilias <[email protected]>
Co-authored-by: Ilias Tsakiridis <[email protected]>
Co-authored-by: Lunny Xiao <[email protected]>
Co-authored-by: silverwind <[email protected]>
Co-authored-by: zeripath <[email protected]>
Co-authored-by: techknowlogick <[email protected]>
2020-08-16 23:07:38 -04:00
ae20de7771 fix bug about can't skip commits base on base branch (#11555)
* fix bug about can't skip commits base on base branch

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

* Update modules/git/commit.go

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

* Update models/issue_comment.go

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

* fix lint

Co-authored-by: Lauris BH <[email protected]>
2020-06-24 20:40:52 +01:00
zeripathandGitHub 654a970644 Fix commenting on non-utf8 encoded files (#11916)
* Add comment on non-unicode line to force fail

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

* Just quote/unquote patch

Signed-off-by: Andrew Thornton <[email protected]>
2020-06-18 10:07:09 -04:00
zeripathandGitHub 48648d1d86 Invalidate comments when file is shortened (#11882)
* Invalidate comments when file is shortened

Fix #10686

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

* handle 1 line

Signed-off-by: Andrew Thornton <[email protected]>
2020-06-14 16:55:20 +03:00
Cirno the StrongestandGitHub 31df012968 Properly handle and return empty string for dangling commits in GetBranchName (#11587) 2020-05-23 20:49:48 +01:00
0903b1ac8c Add push commits history comment on PR time-line (#11167)
* Add push commits history comment on PR time-line
* Add notify by email and ui of this comment type also

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

* Add migrations for IsForcePush
* fix wrong force-push judgement
* Apply suggestions from code review
* Remove commit number check
* add own notify fun
* fix some typo

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

* fix lint

* fix style again, I forgot something before

* Change email notify way

* fix api

* add number check if It's force-push

* Add repo commit link fuction
remove unnecessary check
skip show push commits comment which not have commits alive

* Update issue_comment.go

* Apply suggestions from code review

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

* Apply suggestions from code review

* fix ui view

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

* fix height

* remove unnecessary style define

* simplify GetBranchName

* Apply suggestions from code review

* save commit ids and isForce push by json
* simplify GetBranchName

* fix bug

Co-authored-by: guillep2k <[email protected]>
Co-authored-by: mrsdizzie <[email protected]>
Co-authored-by: Lauris BH <[email protected]>
Co-authored-by: silverwind <[email protected]>
2020-05-20 09:47:24 -03: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
281029529b ui: Add MergePull comment type instead of close for merge PR (#11058)
Signed-off-by: a1012112796 <[email protected]>

Co-authored-by: Lauris BH <[email protected]>
2020-04-14 09:06:23 +08: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
6543andGitHub e57ac841de Fix potential bugs (#10513)
* use e if it is an option
* potential nil so check err first
* check err first
* m == nil already checked
2020-02-27 20:10:27 -03:00
1f01f53c53 API add/generalize pagination (#9452)
* paginate results

* fixed deadlock

* prevented breaking change

* updated swagger

* go fmt

* fixed find topic

* go mod tidy

* go mod vendor with go1.13.5

* fixed repo find topics

* fixed unit test

* added Limit method to Engine struct; use engine variable when provided; fixed gitignore

* use ItemsPerPage for default pagesize; fix GetWatchers, getOrgUsersByOrgID and GetStargazers; fix GetAllCommits headers; reverted some changed behaviors

* set Page value on Home route

* improved memory allocations

* fixed response headers

* removed logfiles

* fixed import order

* import order

* improved swagger

* added function to get models.ListOptions from context

* removed pagesize diff on unit test

* fixed imports

* removed unnecessary struct field

* fixed go fmt

* scoped PR

* code improvements

* code improvements

* go mod tidy

* fixed import order

* fixed commit statuses session

* fixed files headers

* fixed headers; added pagination for notifications

* go mod tidy

* go fmt

* removed Private from user search options; added setting.UI.IssuePagingNum as default valeu on repo's issues list

* Apply suggestions from code review

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

* fixed build error

* CI.restart()

* fixed merge conflicts resolve

* fixed conflicts resolve

* improved FindTrackedTimesOptions.ToOptions() method

* added backwards compatibility on ListReleases request; fixed issue tracked time ToSession

* fixed build error; fixed swagger template

* fixed swagger template

* fixed ListReleases backwards compatibility

* added page to user search route

Co-authored-by: techknowlogick <[email protected]>
Co-authored-by: 6543 <[email protected]>
Co-authored-by: zeripath <[email protected]>
2020-01-24 14:00:29 -05:00
Lunny XiaoandAntoine GIRARD 2b3e931cde Migrate reactions when migrating repository from github (#9599)
* Migrate reactions when migrating repository from github

* fix missed sleep

* fix tests

* update reactions when external user binding

* Fix test

* fix tests

* change the copy head

* fix test

* fix migrator add/delete reaction
2020-01-15 12:14:07 +01:00
6543andAntoine GIRARD 44de66bf50 [API] add endpoint to check notifications [Extend #9488] (#9595)
* introduce GET /notifications/new

* add TEST

* use Sprintf instead of path.Join

* Error more verbose

* return number of notifications if unreaded exist

* 200 http status for available notifications
2020-01-14 16:37:19 +01:00
0b3aaa6196 [API] Add "before" query to ListIssueComments and ListRepoIssue… (#9685)
* add "before" query to ListIssueComments and ListRepoIssueComments

* Add TEST

Co-authored-by: Lunny Xiao <[email protected]>
Co-authored-by: Antoine GIRARD <[email protected]>
2020-01-13 17:02:24 +01:00
6543andzeripath 6baa5d7588 [API] Add notification endpoint (#9488)
* [API] Add notification endpoints

 * add func GetNotifications(opts FindNotificationOptions)
 * add func (n *Notification) APIFormat()
 * add func (nl NotificationList) APIFormat()
 * add func (n *Notification) APIURL()
 * add func (nl NotificationList) APIFormat()
 * add LoadAttributes functions (loadRepo, loadIssue, loadComment, loadUser)
 * add func (c *Comment) APIURL()
 * add func (issue *Issue) GetLastComment()
 * add endpoint GET /notifications
 * add endpoint PUT /notifications
 * add endpoint GET /repos/{owner}/{repo}/notifications
 * add endpoint PUT /repos/{owner}/{repo}/notifications
 * add endpoint GET /notifications/threads/{id}
 * add endpoint PATCH /notifications/threads/{id}

* Add TEST

* code format

* code format
2020-01-09 11:56:32 +00:00
6543andzeripath f2d03cda96 [API] Extend times API (#9200)
Extensively extend the times API.

close #8833; close #8513; close #8559
2019-12-27 20:30:58 +00:00
Mario LubenkaandLunny Xiao 61db834904 Change target branch for pull request (#6488)
* Adds functionality to change target branch of created pull requests

Signed-off-by: Mario Lubenka <[email protected]>

* Use const instead of var in JavaScript additions

Signed-off-by: Mario Lubenka <[email protected]>

* Check if branches are equal and if PR already exists before changing target branch

Signed-off-by: Mario Lubenka <[email protected]>

* Make sure to check all commits

Signed-off-by: Mario Lubenka <[email protected]>

* Print error messages for user as error flash message

Signed-off-by: Mario Lubenka <[email protected]>

* Disallow changing target branch of closed or merged pull requests

Signed-off-by: Mario Lubenka <[email protected]>

* Resolve conflicts after merge of upstream/master

Signed-off-by: Mario Lubenka <[email protected]>

* Change order of branch select fields

Signed-off-by: Mario Lubenka <[email protected]>

* Removes duplicate check

Signed-off-by: Mario Lubenka <[email protected]>

* Use ctx.Tr for translations

Signed-off-by: Mario Lubenka <[email protected]>

* Recompile JS

Signed-off-by: Mario Lubenka <[email protected]>

* Use correct translation namespace

Signed-off-by: Mario Lubenka <[email protected]>

* Remove redundant if condition

Signed-off-by: Mario Lubenka <[email protected]>

* Moves most change branch logic into pull service

Signed-off-by: Mario Lubenka <[email protected]>

* Completes comment

Signed-off-by: Mario Lubenka <[email protected]>

* Add Ref to ChangesPayload for logging changed target branches
instead of creating a new struct

Signed-off-by: Mario Lubenka <[email protected]>

* Revert changes to go.mod

Signed-off-by: Mario Lubenka <[email protected]>

* Directly use createComment method

Signed-off-by: Mario Lubenka <[email protected]>

* Return 404 if pull request is not found. Move written check up

Signed-off-by: Mario Lubenka <[email protected]>

* Remove variable declaration

Signed-off-by: Mario Lubenka <[email protected]>

* Return client errors on change pull request target errors

Signed-off-by: Mario Lubenka <[email protected]>

* Return error in commit.HasPreviousCommit

Signed-off-by: Mario Lubenka <[email protected]>

* Adds blank line

Signed-off-by: Mario Lubenka <[email protected]>

* Test patch before persisting new target branch

Signed-off-by: Mario Lubenka <[email protected]>

* Update patch before testing (not working)

Signed-off-by: Mario Lubenka <[email protected]>

* Removes patch calls when changeing pull request target

Signed-off-by: Mario Lubenka <[email protected]>

* Removes unneeded check for base name

Signed-off-by: Mario Lubenka <[email protected]>

* Moves ChangeTargetBranch completely to pull service. Update patch status.

Signed-off-by: Mario Lubenka <[email protected]>

* Set webhook mode after errors were validated

Signed-off-by: Mario Lubenka <[email protected]>

* Update PR in one transaction

Signed-off-by: Mario Lubenka <[email protected]>

* Move logic for check if head is equal with branch to pull model

Signed-off-by: Mario Lubenka <[email protected]>

* Adds missing comment and simplify return

Signed-off-by: Mario Lubenka <[email protected]>

* Adjust CreateComment method call

Signed-off-by: Mario Lubenka <[email protected]>
2019-12-16 14:20:25 +08:00
Lunny XiaoandGitHub 43ada65571 remove unused method and rename createcommentWithNoAction (#9367) 2019-12-16 11:54:24 +08:00
Lunny Xiaoandtechknowlogick 67b316a954 Refactor comment (#9330)
* Refactor comment

* fix test

* improve code
2019-12-15 16:57:34 -05:00
Antoine GIRARDandzeripath c3d31e5534 refactor(models/attachement): use getAttachmentsByUUIDs (#9317) 2019-12-11 00:01:52 +00:00
Lunny XiaoandLauris BH 6e81eafdd6 Remove unused comment actions (#9222)
* Remove unused comment actions

* improve code
2019-12-02 16:43:39 +02:00
Lunny Xiaoandtechknowlogick 2011a5b818 Extract createComment (#9125)
* Extract createComment

* fix lint

* fix lint
2019-11-30 21:44:39 -05:00
guillep2kandLauris BH 2c2b9718e6 Avoid re-issuing redundant cross-references. (#8734)
* Avoid re-issuing redundant cross-references.

* Remove unused func; fix lint

* Simplify code as suggested by @laftriks

* Update test
2019-11-19 01:43:03 +02:00
Lunny Xiaoandzeripath e0e4473172 extract some inline functions related with create comment (#8931) 2019-11-15 18:18:09 +00:00
guillep2kandzeripath 9930d47be2 Add review comments to mail notifications (#8996) 2019-11-15 12:59:21 +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
succcubbusandtechknowlogick a2bd8fe8dc mark review comment as invalidated when file is deleted (#8751) 2019-10-31 13:59:36 -04:00
Lunny XiaoandAntoine GIRARD d151503d34 Upgrade xorm to v0.8.0 (#8536) 2019-10-17 11:26:49 +02:00
Wenxuan ZhaoandLunny Xiao cf42cb0ae6 Allow externalID to be UUID (#8551)
Signed-off-by: Wenxuan Zhao <[email protected]>
2019-10-17 10:06:28 +08:00
blueworrybearandzeripath 8c909820a9 Enable Uploading/Removing Attachments When Editing an Issue/Comment (#8426) 2019-10-15 13:19:32 +01:00
Lunny XiaoandLauris BH e3e44a59d0 Update migrated repositories' issues/comments/prs poster id if user has a github external user saved (#7751)
* update migrated issues/comments when login as github

* add get userid when migrating or login with github oauth2

* fix lint

* add migrations for repository service type

* fix build

* remove unnecessary dependencies on migrations

* add cron task to update migrations poster ids and fix posterid when migrating

* fix lint

* fix lint

* improve code

* fix lint

* improve code

* replace releases publish id to actual author id

* fix import

* fix bug

* fix lint

* fix rawdata definition

* fix some bugs

* fix error message
2019-10-14 09:10:42 +03:00
guillep2kandzeripath 15809d81f7 Rewrite reference processing code in preparation for opening/closing from comment references (#8261)
* Add a markdown stripper for mentions and xrefs

* Improve comments

* Small code simplification

* Move reference code to modules/references

* Fix typo

* Make MarkdownStripper return [][]byte

* Implement preliminary keywords parsing

* Add FIXME comment

* Fix comment

* make fmt

* Fix permissions check

* Fix text assumptions

* Fix imports

* Fix lint, fmt

* Fix unused import

* Add missing export comment

* Bypass revive on implemented interface

* Move mdstripper into its own package

* Support alphanumeric patterns

* Refactor FindAllMentions

* Move mentions test to references

* Parse mentions from reference package

* Refactor code to implement renderizable references

* Fix typo

* Move patterns and tests to the references package

* Fix nil reference

* Preliminary rendering attempt of closing keywords

* Normalize names, comments, general tidy-up

* Add CSS style for action keywords

* Fix permission for admin and owner

* Fix golangci-lint

* Fix golangci-lint
2019-10-13 23:29:10 +01:00
Lunny Xiaoandtechknowlogick 061388379a Move create issue comment to comments package (#8212)
* move create issue comment to comments package

* extract actions on update/delete comment from models to comment service

* fix lint

* fix lint
2019-09-24 13:39:50 -04:00