Commit Graph
157 Commits
Author SHA1 Message Date
zeripathandLauris BH 319c92163f Branches not at ref commit ID should not be listed as Merged (#9614) (#9639)
Once a branch has been merged if the commit ID no longer equals that of
the pulls ref commit id don't offer to delete the branch on the pull screen
and don't list it as merged on branches.

Fix #9201

When looking at the pull page we should also get the commits from the refs/pulls/x/head

Fix #9158
2020-01-08 03:06:53 +02:00
zeripathandGitHub 3497efac4a Add Close() method to gogitRepository (#8901) (#8956)
Backport #8901 

In investigating #7947 it has become clear that the storage component of go-git repositories needs closing.

This PR adds this Close function and adds the Close functions as necessary.

In TransferOwnership the ctx.Repo.GitRepo is closed if it is open to help prevent the risk of multiple open files.

Fixes #7947
2019-11-13 13:54:04 +00:00
Lunny Xiaoandzeripath 22cea96c18 Fix bug on pull requests when transfer head repository (#8564) (#8569)
* fix bug on pull requests when transfer head repository

* add migration and fix lint

* fix tests and add a cache check on LoadBaseRepo
2019-10-19 08:29:35 +01:00
guillep2kandAntoine GIRARD cd13f273d1 Transaction-aware retry create issue to cope with duplicate keys (#8307)
* Revert #7898

* Transaction-aware retry create issue to cope with duplicate keys

* Restore INSERT ... WHERE usage

* Rearrange code for clarity

* Fix error return in newIssue()

* Fix error message
2019-10-03 00:28:30 +02:00
Elias NorbergandLunny Xiao 49547ea158 Show correct commit status in PR list (#8316)
* Use correct index when fetching commit status

Signed-off-by: Elias Norberg <[email protected]>

* Compare against base repo to avoid mismatch when merging from fork

Signed-off-by: Elias Norberg <[email protected]>
2019-09-30 09:07:43 +08:00
Lunny XiaoandGitHub eb11ca6847 Extract actions on new pull request from models to pulls service and move code.gitea.io/gitea/modules/pull to code.gitea.io/gitea/services/pull (#8218)
* extract actions on new pull request from models to pulls service

* improve code

* move code.gitea.io/gitea/modules/pull to code.gitea.io/gitea/services/pull

* fix fmt

* Rename pulls.go to pull.go
2019-09-27 08:22:36 +08:00
Lunny XiaoandLauris BH 04ca7f0047 Refuse merge until all required status checks success (#7481)
* refuse merge until ci successfully

* deny merge request when required status checkes not succeed on merge Post and API

* add database migration for added columns on protected_branch

* fix migration

* fix protected branch check bug

* fix protected branch settings

* remove duplicated code on check pull request's required commit statuses pass

* remove unused codes

* fix migration

* add newline for template file

* fix go mod

* rename function name and some other fixes

* fix template

* fix bug pull view

* remove go1.12 wrong dependencies

* add administrator bypass when protected branch status check enabled

* fix bug

* improve the codes
2019-09-18 08:39:45 +03:00
Tamal Sahaandtechknowlogick 171b359877 Use gitea forked macaron (#7933)
Signed-off-by: Tamal Saha <[email protected]>
2019-08-23 12:40:29 -04:00
Mura Liandtechknowlogick 3ac45e3cb5 Fix pull creation with empty changes (#7920)
* Logs the stderr of git-apply
* Add an integration test
* Skip testPatch when patch is empty
2019-08-20 13:43:00 -04: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
quantonganhandLauris BH ff85a6331e only return head: null if source branch was deleted (#6705)
* only return head: null if source branch was deleted

* add URL into GetPullRequest

* TestPullRequest_APIFormat

* log error if it is not Err(Branch)NotExist
2019-07-08 10:32:46 +03:00
zeripathandLunny Xiao 3563650bdb #6946 Run hooks on merge/edit and cope with protected branches (#6961)
* Fix #6946 by checking PullRequest ID on pushing

* Ensure we have the owner name, the pr attributes and the the issue

* Fix TestSearchRepo by waiting till indexing is done

* Update integrations/repo_search_test.go

* changes as per @mrsdizzie

* missing comma

* Spelling mistake

* Fix full pushing environment
2019-07-01 09:18:13 +08:00
Mario LubenkaandLunny Xiao 7c0f2b9843 Show Pull Request button or status of latest PR in branch list (#6990)
* Show Pull Request button or status of latest PR in branch list

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

* Do not show pull request button on deleted branches

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

* Do not show commit divergence on deleted branches

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

* Use XORMs Get instead of limit

* Links pull request ID and use smaller labels for displaying the pull request status

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

* Handle error when getting latest pull request

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

* Indent template

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

* Check error when loading issue

Signed-off-by: Mario Lubenka <[email protected]>
2019-06-27 22:15:30 +08:00
Lunny Xiaoandtechknowlogick edc94c7041 Monitor all git commands; move blame to git package and replace git as a variable (#6864)
* monitor all git commands; move blame to git package and replace git as a variable

* use git command but not other commands

* fix build

* move exec.Command to git.NewCommand

* fix fmt

* remove unrelated changes

* remove unrelated changes

* refactor IsEmpty and add tests

* fix tests

* fix tests

* fix tests

* fix tests

* remove gitLogger

* fix fmt

* fix isEmpty

* fix lint

* fix tests
2019-06-26 14:15:26 -04:00
zeripathandGitHub baefea311f Fix #732: Add LFS objects to base repository on merging (#7082)
On merge we walk the merge history and ensure that all lfs objects pointed to in
the history are added to the base repository. This switches from relying on having git-lfs installed on the server, (and in fact .gitattributes being correctly installed.)
2019-06-22 18:35:34 +01:00
Lunny Xiaoandzeripath 0323122fd7 fix duplicated file on pull request conflicted files (#7211) 2019-06-15 15:22:26 +01:00
kolaenteandtechknowlogick f9ec2f89f2 Add golangci (#6418) 2019-06-12 15:41:28 -04:00
Mario Lubenkaandtechknowlogick 1608f63e39 Fixes diff on merged pull requests (#7171) 2019-06-11 19:32:08 -04:00
Mario Lubenkaandtechknowlogick 311ce2d1d0 Compare branches, commits and tags with each other (#6991)
* Supports tags when comparing commits or branches

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

* Hide headline when only comparing and don't load unused data

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

* Merges compare logics to allow comparing branches, commits and tags with eachother

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

* Display branch or tag instead of commit when used for comparing

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

* Show pull request form after click on button

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

* Transfers relevant pull.go changes from master to compare.go

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

* Fixes error when comparing forks against a commit or tag

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

* Removes console.log from JavaScript file

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

* Show icon next to commit reference when comparing branch or tag

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

* Updates css file

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

* Fixes import order

* Renames template variable

* Update routers/repo/compare.go

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

* Update from master

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

* Allow short-shas in compare

* Renames prInfo to compareInfo

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

* Check PR permissions only if compare is pull request

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

* Adjusts comment

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

* Use compareInfo instead of prInfo
2019-06-07 16:29:29 -04:00
Mura Liandtechknowlogick 0b785481d7 Use modules/git for git commands (#6775) 2019-05-13 01:06:47 -04:00
zeripathandtechknowlogick ce8de35334 Remove local clones & make hooks run on merge/edit/upload (#6672)
* Add options to git.Clone to make it more capable

* Begin the process of removing the local copy and tidy up

* Remove Wiki LocalCopy Checkouts

* Remove the last LocalRepo helpers

* Remove WithTemporaryFile

* Enable push-hooks for these routes

* Ensure tests cope with hooks

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

* Remove Repository.LocalCopyPath()

* Move temporary repo to use the standard temporary path

* Fix the tests

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

* Remove LocalWikiPath

* Fix missing remove

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

* Use AppURL for Oauth user link (#6894)

* Use AppURL for Oauth user link

Fix #6843

* Update oauth.go

* Update oauth.go

* internal/ssh: ignore env command totally (#6825)

* ssh: ignore env command totally

* Remove commented code 

Needed fix described in issue #6889

* Escape the commit message on issues update and title in telegram hook (#6901)

* update sdk to latest (#6903)

* improve description of branch protection (fix #6886) (#6906)

The branch protection description text were not quite accurate.

* Fix logging documentation (#6904)

* ENABLE_MACARON_REDIRECT should be REDIRECT_MACARON_LOG

* Allow DISABLE_ROUTER_LOG to be set in the [log] section

* [skip ci] Updated translations via Crowdin

* Move sdk structs to modules/structs (#6905)

* move sdk structs to moduels/structs

* fix tests

* fix fmt

* fix swagger

* fix vendor
2019-05-11 11:29:17 -04: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
Lunny XiaoandGitHub 4c34bc111c fix pulls broken when fork repository deleted (#6754)
* fix pulls broken when fork repository deleted

* fix lint
2019-04-26 11:03:39 +08:00
Filip NavaraandLunny Xiao 2af67f6044 Improve listing performance by using go-git (#6478)
* Use go-git for tree reading and commit info lookup.

Signed-off-by: Filip Navara <[email protected]>

* Use TreeEntry.IsRegular() instead of ObjectType that was removed.

Signed-off-by: Filip Navara <[email protected]>

* Use the treePath to optimize commit info search.

Signed-off-by: Filip Navara <[email protected]>

* Extract the latest commit at treePath along with the other commits.

Signed-off-by: Filip Navara <[email protected]>

* Fix listing commit info for a directory that was created in one commit and never modified after.

Signed-off-by: Filip Navara <[email protected]>

* Avoid nearly all external 'git' invocations when doing directory listing (.editorconfig code path is still hit).

Signed-off-by: Filip Navara <[email protected]>

* Use go-git for reading blobs.

Signed-off-by: Filip Navara <[email protected]>

* Make SHA1 type alias for plumbing.Hash in go-git.

Signed-off-by: Filip Navara <[email protected]>

* Make Signature type alias for object.Signature in go-git.

Signed-off-by: Filip Navara <[email protected]>

* Fix GetCommitsInfo for repository with only one commit.

Signed-off-by: Filip Navara <[email protected]>

* Fix PGP signature verification.

Signed-off-by: Filip Navara <[email protected]>

* Fix issues with walking commit graph across merges.

Signed-off-by: Filip Navara <[email protected]>

* Fix typo in condition.

Signed-off-by: Filip Navara <[email protected]>

* Speed up loading branch list by keeping the repository reference (and thus all the loaded packfile indexes).

Signed-off-by: Filip Navara <[email protected]>

* Fix lising submodules.

Signed-off-by: Filip Navara <[email protected]>

* Fix build

Signed-off-by: Filip Navara <[email protected]>

* Add back commit cache because of name-rev

Signed-off-by: Filip Navara <[email protected]>

* Fix tests

Signed-off-by: Filip Navara <[email protected]>

* Fix code style

* Fix spelling

* Address PR feedback

Signed-off-by: Filip Navara <[email protected]>

* Update vendor module list

Signed-off-by: Filip Navara <[email protected]>

* Fix getting trees by commit id

Signed-off-by: Filip Navara <[email protected]>

* Fix remaining unit test failures

* Fix GetTreeBySHA

* Avoid running `git name-rev` if not necessary

Signed-off-by: Filip Navara <[email protected]>

* Move Branch code to git module

* Clean up GPG signature verification and fix it for tagged commits

* Address PR feedback (import formatting, copyright headers)

* Make blob lookup by SHA working

* Update tests to use public API

* Allow getting content from any type of object through the blob interface

* Change test to actually expect the object content that is in the GIT repository

* Change one more test to actually expect the object content that is in the GIT repository

* Add comments
2019-04-19 20:17:27 +08:00
Elias Norbergandtechknowlogick bf5af87eef Show last commit status in pull request lists (#6465) 2019-04-02 15:54:29 -04:00
zeripathandGitHub 704da08fdc Better logging (#6038) (#6095)
* Panic don't fatal on create new logger

Fixes #5854

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

* partial broken

* Update the logging infrastrcture

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

* Reset the skip levels for Fatal and Error

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

* broken ncsa

* More log.Error fixes

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

* Remove nal

* set log-levels to lowercase

* Make console_test test all levels

* switch to lowercased levels

* OK now working

* Fix vetting issues

* Fix lint

* Fix tests

* change default logging to match current gitea

* Improve log testing

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

* reset error skip levels to 0

* Update documentation and access logger configuration

* Redirect the router log back to gitea if redirect macaron log but also allow setting the log level - i.e. TRACE

* Fix broken level caching

* Refactor the router log

* Add Router logger

* Add colorizing options

* Adjust router colors

* Only create logger if they will be used

* update app.ini.sample

* rename Attribute ColorAttribute

* Change from white to green for function

* Set fatal/error levels

* Restore initial trace logger

* Fix Trace arguments in modules/auth/auth.go

* Properly handle XORMLogger

* Improve admin/config page

* fix fmt

* Add auto-compression of old logs

* Update error log levels

* Remove the unnecessary skip argument from Error, Fatal and Critical

* Add stacktrace support

* Fix tests

* Remove x/sync from vendors?

* Add stderr option to console logger

* Use filepath.ToSlash to protect against Windows in tests

* Remove prefixed underscores from names in colors.go

* Remove not implemented database logger

This was removed from Gogs on 4 Mar 2016 but left in the configuration
since then.

* Ensure that log paths are relative to ROOT_PATH

* use path.Join

* rename jsonConfig to logConfig

* Rename "config" to "jsonConfig" to make it clearer

* Requested changes

* Requested changes: XormLogger

* Try to color the windows terminal

If successful default to colorizing the console logs

* fixup

* Colorize initially too

* update vendor

* Colorize logs on default and remove if this is not a colorizing logger

* Fix documentation

* fix test

* Use go-isatty to detect if on windows we are on msys or cygwin

* Fix spelling mistake

* Add missing vendors

* More changes

* Rationalise the ANSI writer protection

* Adjust colors on advice from @0x5c

* Make Flags a comma separated list

* Move to use the windows constant for ENABLE_VIRTUAL_TERMINAL_PROCESSING

* Ensure matching is done on the non-colored message - to simpify EXPRESSION
2019-04-02 08:48:31 +01:00
Lunny XiaoandGitHub d578b71d61 move code.gitea.io/git to code.gitea.io/gitea/modules/git (#6364)
* move code.gitea.io/git to code.gitea.io/gitea/modules/git

* fix imports

* fix fmt

* fix misspell

* remove wrong tests data

* fix unit tests

* fix tests

* fix tests

* fix tests

* fix tests

* fix tests

* enable Debug to trace the failure tests

* fix tests

* fix tests

* fix tests

* fix tests

* fix tests

* comment commit count tests since git clone depth is 50

* fix tests

* update from code.gitea.io/git

* revert change to makefile
2019-03-27 17:33:00 +08:00
Lunny Xiaoandtechknowlogick bf4badad1d Pull request conflict files detection (#5951)
* add conflict detection

* test pull request conflict files

* fix detection files number

* fix comments
2019-02-05 06:54:49 -05:00
yasuokavandtechknowlogick d663930023 fix delete correct temp directory (#5839) 2019-01-25 02:54:09 -05:00
Mura LiandLauris BH ec31ee1c1c Make sure .git/info is created before generating .git/info/sparse-che… (#5825)
* Make sure .git/info is created before generating .git/info/sparse-checkout

* fix permissions
2019-01-24 09:43:37 +02:00
Mura LiandLauris BH 6ad834e236 Optimize pulls merging (#4921)
* Optimize pulls merging

By utilizing `git clone -s --no-checkout` rather than cloning the whole
repo.

* Use sparse-checkout to speedup pulls merge

* Use bytes.Buffer instead of strings.Builder for backward compatibility

* Fix empty diff-tree output for repos with only the initial commit

* Fix missing argument for the format string

* Rework diff-tree-list generation

* Remove logging code

* File list for sparse-checkout must be prefix with /

Otherwise, they would match all files with the same name under
subdirectories.

* Update onto the rebased head

* Use referecen repo to avoid fetching objects
2019-01-23 12:26:32 +02:00
Lunny XiaoandGitHub 82e08a3364 Refactor notification for indexer (#5111)
* notification for indexer

* use NullNotifier as parent struct
2019-01-17 22:23:22 +08:00
zeripathandtechknowlogick 6868378673 Ensure that sessions are passed into queries that could use the database to prevent deadlocks (#5718)
* Fixed deadlock in CreateComment

* Fix possible deadlock in UpdateIssueDeadline from createDeadlineComment

* Ensure that calls to IsTimeTracker enabled are called within session

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

* Ensure that calls to reactionList are also called within session

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

* Ensure all calls in NewPullRequest with the session are called within the session

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

* Deal with potential deadlocks in repo

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

* Ensure that isStaring is checked within our transaction

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

* Fix mistake in isOrganizationMember

Sorry.
2019-01-13 21:29:58 -05:00
Lunny XiaoandLauris BH beab2df122 Refactor mail notification (#5110)
* mail notification implement interface

* fix file comment year

* use NullNotifier as parent struct of notifiers
2019-01-13 16:42:55 +02:00
JulianandLauris BH 4a685f8b87 Add rebase with merge commit merge style (#3844) (#4052)
Signed-off-by: Julian Tölle <[email protected]>
2018-12-27 12:27:08 +02:00
Jonas Franzandtechknowlogick e726e4b828 Add base repo nil check (#5555)
Signed-off-by: Jonas Franz <[email protected]>
2018-12-17 12:35:21 -05:00
Lunny Xiaoandtechknowlogick b3b7598ec6 Improve performance of dashboard (#4977) 2018-12-13 10:55:43 -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 eabbddcd98 Restrict permission check on repositories and fix some problems (#5314)
* fix units permission problems

* fix some bugs and merge LoadUnits to repoAssignment

* refactor permission struct and add some copyright heads

* remove unused codes

* fix routes units check

* improve permission check

* add unit tests for permission

* fix typo

* fix tests

* fix some routes

* fix api permission check

* improve permission check

* fix some permission check

* fix tests

* fix tests

* improve some permission check

* fix some permission check

* refactor AccessLevel

* fix bug

* fix tests

* fix tests

* fix tests

* fix AccessLevel

* rename CanAccess

* fix tests

* fix comment

* fix bug

* add missing unit for test repos

* fix bug

* rename some functions

* fix routes check
2018-11-28 19:26:14 +08:00
Julien TantandLauris BH 7781e8cef2 Disable merging a WIP Pull request (#4529)
* prevent pull request to be merged when PR is a WIP

* add tests

* add helper to prepend WIP: in PR title

* move default wip prefixes into settings

* use configurable WIP prefixes in javascript and default to first one in templates

* add documentation

* add unit test on pull model

Signed-off-by: Julien Tant <[email protected]>
2018-08-13 22:04:39 +03: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
Lunny XiaoandGitHub 6bdc556b7f Fix some webhooks bugs (#3981)
* fix some webhooks bugs

* update vendor

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

* fix test

* fix clearlabels

* fix pullrequest webhook bug fix #3492

* update release webhook description

* remove unused code

* fix push webhook in pull request

* small changes
2018-05-21 10:28:29 +08:00
kolaenteandLauris BH 95f2e2b57b Multiple assignees (#3705) 2018-05-09 19:29:04 +03:00
kolaenteandLauris BH 1a97030017 Issue due date (#3794)
* Started adding deadline to ui

* Implemented basic issue due date managing

* Improved UI for due date managing

* Added at least write access to the repo in order to modify issue due dates

* Ui improvements

* Added issue comments creation when adding/modifying/removing a due date

* Show due date in issue list

* Added api support for issue due dates

* Fixed lint suggestions

* Added deadline to sdk

* Updated css

* Added support for adding/modifiying deadlines for pull requests via api

* Fixed comments not created when updating or removing a deadline

* update sdk (will do properly once go-gitea/go-sdk#103 is merged)

* enhanced updateIssueDeadline

* Removed unnessecary Issue.DeadlineString

* UI improvements

* Small improvments to comment creation
+ ui & validation improvements

* Check if an issue is overdue is now a seperate function

* Updated go-sdk with govendor as it was merged

* Simplified isOverdue method

* removed unessecary deadline to 0 set

* Update swagger definitions

* Added missing return

* Added an explanary comment

* Improved updateIssueDeadline method so it'll only update `deadline_unix`

* Small changes and improvements
* no need to explicitly load the issue when updating a deadline, just use whats already there
* small optimisations

* Added check if a deadline was modified before updating it

* Moved comment creating logic into its own function

* Code cleanup for creating deadline comment

* locale improvement

* When modifying a deadline, the old deadline is saved with the comment

* small improvments to xorm session handling when updating an issue deadline
+ style nitpicks

* style nitpicks

* Moved checking for if the user has write acces to middleware
2018-05-01 22:05:28 +03:00
Chri-sandLauris BH 9350ba7947 Add protected branch whitelists for merging (#3689)
* Add database migrations for merge whitelist

* Add merge whitelist settings for protected branches

* Add checks for merge whitelists
2018-03-25 13:01:32 +03:00
Chri-sandLunny Xiao a2a49c93c7 Added checks for protected branches in pull requests (#3544)
* Added checks for protected branches in pull requests

Signed-off-by: Christian Wulff <[email protected]>

* Moved check for protected branch into new function CheckUserAllowedToMerge

Signed-off-by: Christian Wulff <[email protected]>

* Removed merge conflict lines from last commit

Signed-off-by: Christian Wulff <[email protected]>

* Explicit check for error type in ViewIssue

Signed-off-by: Christian Wulff <[email protected]>
2018-03-13 11:46:14 +08:00
Ethan KoenigandLauris BH 46c7fe371d Fix PR merge error (#3421) 2018-01-29 12:18:20 +02:00
Sandro SantilliandLauris BH 05ab747054 Force-push to base repo's ref/pull/#/head (#3393)
* Force-push to base repo's ref/pull/#/head

Fixes force-pushing to pull request branches, otherwise failing with:

[...gitea/models/pull.go:1022 AddTestPullRequestTask()] [E] PushToBaseRepo: Push: exit status 1 - To /path/to/gitea-repositories/org/repo.git
 ! [rejected]        issue-fix -> refs/pull/20/head (non-fast-forward)

* format
2018-01-19 08:53:45 +02:00
Lauris BHandGitHub ca306985d3 Change how merged PR commit info are prepared (#3368)
* Change how merged PR commits and diff are made

* Update code.gitea.io/git dependency

* Fix typo

* Remove unneeded local variable
2018-01-19 08:18:51 +02:00
Lauris BHandKim "BKC" Carlbäcker be1330ec89 Remove hardcoded paths to fix randomly failing tests (#3347)
* Remove hardcoded paths to fix randomly failing tests

* Use correct function for merge path
2018-01-11 00:46:59 +01:00