Commit Graph

477 Commits

Author SHA1 Message Date
Brett Walker 3489dc3d72 Allow disabling group/project email notifications
- Adds UI to configure in group and project settings
- Removes notification configuration for users when
disabled at group or project level
2019-08-15 17:37:36 +00:00
Stan Hu 26107e9354 Properly save suggestions in project exports
Previously imports would fail if a merge request note included a
suggestion with an
`ActiveRecord::HasManyThroughCantAssociateThroughHasOneOrManyReflection`
exception.

This was happening because suggestions were listed as a descendant of
merge requests, but this doesn't work because suggestions are directly
associated with notes, not merge requests, and that association is lost.
Rails also disallows creating intializing a has_many association through
a different object.

We fix this by making `suggestions` a child of `notes` within a merge
request. This doesn't fix previously broken exported project exports,
but new exports will work.

Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/65880
2019-08-10 18:50:42 -07:00
Jason Colyer f4ceff6e0c Make Issue boards importable
- Added space to li definiton
- Remove milestone from import_export.yml
2019-08-05 08:28:39 -05:00
Jason Colyer 87235d009c Make issue boards importable
- Added Importable to models/list.rb
- Did unless: :importable? on board validation
- Created changelog
- Modified haml to show issue boards are importable
- Added needed spec tests
- Modified project.json to include board information
- Added relevant models to all_models
- Added relevant models to import_export
- Added relevant models to safe_model_attributes
2019-08-02 14:35:10 -05:00
Stan Hu 0d538e44af Merge branch 'optimise-import-performance' into 'master'
Optimise import performance

Closes #64924

See merge request gitlab-org/gitlab-ce!31045
2019-07-24 18:01:44 +00:00
Kamil Trzciński 8d1e97fc3b Optimise import performance
- Fix `O(n)` complexity of `append_or_update_attribute`,
  we append objects to an array and re-save project
- Remove the usage of `keys.include?` as it performs `O(n)`
  search, instead use `.has_key?`
- Remove the usage of `.keys.first` as it performs a copy
  of all keys, instead use `.first.first`
2019-07-24 16:24:28 +02:00
Luke Duncalfe d18ee3faad LFS export records repository_type data
A project can have the same `LfsObject` linked with up to three
`LfsObjectsProject` records. Each of these records would be for a
different repository, recorded in the `repository_type` property. The
different repositories at time of writing are "project", "wiki", and
"design". See https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/13894

This change exports the list of `repository_type`s as a JSON mapping of
oid => repository_types, which are imported to recreate the correct
`LfsObjectsProject` records.

https://gitlab.com/gitlab-org/gitlab-ee/issues/11090
2019-07-24 11:23:51 +00:00
Ash McKenzie 69adeb3718 Merge branch 'georgekoltsov/64377-add-better-log-msg-to-members-mapper' into 'master'
Add better error message to MembersMapper#ensure_default_member!

See merge request gitlab-org/gitlab-ce!30838
2019-07-23 11:48:33 +00:00
George Koltsov 3463c24d40 Add changelog entry 2019-07-23 09:23:50 +01:00
George Koltsov 9ef196b7a7 Set Private visibility for restricted Internal imported projects
With https://gitlab.com/gitlab-org/gitlab-ee/issues/12388 change going
live there is potential risk of breaking imports of 'Internal' projects.
This change makes sure if 'Internal' visibility level is restricted
all 'Internal' projects will be marked as 'Private'

See: https://gitlab.com/gitlab-org/gitlab-ce/issues/64311
2019-07-19 03:00:23 +00:00
George Koltsov 8e6af8c59f Add better error message MembersMapper#ensure_default_member!
More details in: https://gitlab.com/gitlab-org/gitlab-ce/issues/64377
2019-07-17 11:30:31 +01:00
Kamil Trzciński d9b9aace9f Merge branch 'remove-support-for-legacy-pipeline-triggers' into 'master'
Remove support for legacy pipeline triggers

Closes #30231

See merge request gitlab-org/gitlab-ce!30133
2019-07-16 12:16:12 +00:00
Fabio Pitino c2396ce036 Do not import legacy triggers from project JSON 2019-07-15 15:05:22 +02:00
Fabio Pitino 2397f171a3 Ensure ImportExport maintains trigger ownership 2019-07-15 15:05:22 +02:00
George Koltsov ec51240685 Add commit_id to AttributeCleaner::ALLOWED_REFERENCES 2019-07-15 10:30:39 +01:00
Mayra Cabrera 0ab89d8e36 Add a rubocop for Rails.logger
Suggests to use a JSON structured log instead

Related to https://gitlab.com/gitlab-org/gitlab-ce/issues/54102
2019-07-10 19:26:47 +00:00
Nick Thomas 381468d0cc
Allow asynchronous rebase operations to be monitored
This MR introduces tracking of the `rebase_jid` for merge requests. As
with `merge_ongoing?`, `rebase_in_progress?` will now return true if a
rebase is proceeding in sidekiq.

After one release, we should remove the Gitaly-based lookup of rebases.
It is much better to track this kind of thing via the database.
2019-07-04 08:50:55 +01:00
Yorick Peterse 8469f59d78
Backport the EE schema and migrations to CE
This backports all EE schema changes to CE, including EE migrations,
ensuring both use the same schema.

== Updated tests

A spec related to ghost and support bot users had to be modified to make
it pass. The spec in question assumes that the "support_bot" column
exists when defining the spec. In the single codebase setup this is not
the case, as the column is backported in a later migration. Any attempt
to use a different schema version or use of "around" blocks to
conditionally disable specs won't help, as reverting the backport
migration would also drop the "support_bot" column. Removing the
"support_bot" tests entirely appears to be the only solution.

We also need to update some foreign key tests now that we have
backported the EE columns. Fortunately, these changes are very minor.

== Backporting migrations

This commit moves EE specific migrations (except those for the Geo
tracking database) and related files to CE, and also removes any traces
of the ee/db directory.

Some migrations had to be modified or removed, as they no longer work
with the schema being backported. These migrations were all quite old,
so we opted for removing them where modifying them would take too much
time and effort.

Some old migrations were modified in EE, while also existing in CE. In
these cases we took the EE code, and in one case removed them entirely.
It's not worth spending time trying to merge these changes somehow as we
plan to remove old migrations around the release of 12.0, see
https://gitlab.com/gitlab-org/gitlab-ce/issues/59177 for more details.
2019-06-17 17:09:05 +02:00
Shinya Maeda c5c41ae065 Ignore legacy artifact columns in Project Import/Export
Ignore some columns
2019-06-11 18:39:29 +07:00
Robert Speicher a2c767b9f8
Merge branch 'master' of dev.gitlab.org:gitlab/gitlabhq 2019-06-03 10:04:57 -07:00
Robert Speicher 2b13462ac4 Merge branch 'security-58856-persistent-xss-in-note-objects' into 'master'
Persistent XSS in note objects CE

See merge request gitlab/gitlabhq!3075
2019-06-03 17:01:10 +00:00
Liam McAndrew 5ddb32f382 Fix order dependency with user params during imports 2019-05-28 10:31:51 +00:00
James Lopez 30d915110f Fix issue importing members with owner access 2019-05-23 13:10:38 +00:00
Stan Hu 5c8cd42bbd Fix invalid visibility string comparison in project import
This resolves an "ArgumentError: comparison of String with 0 failed"
issue where the visibility_level is stored as a string in the project
import data because the value comes directly from the Web form. This
problem happened upon creating a project from a template or restoring a
project.

We now cast the value to an integer to guard against these kinds of
failures.

Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/61692
2019-05-22 11:32:23 -07:00
Heinrich Lee Yu e938d241ea Include type to notes import / export 2019-05-17 16:45:40 +08:00
charlieablett 0aff6238f7 Change `prohibited_key` to use regexes 2019-05-01 12:15:29 +12:00
charlieablett 4b46b53082 Add `html` to sensitive words 2019-05-01 10:38:41 +12:00
charlieablett 1cbdc5326c Refactor `attribute_cleaner` for readability 2019-04-30 11:25:09 +12:00
charlieablett b240012c4f Further clarify `attribute_cleaner` 2019-04-29 21:31:16 +12:00
Reuben Pereira 4376167a04 Add ProjectMetricsDashboardSetting model and table
This new table will be used to store the external_dashboard_url which
allows users to add a link to their external dashboards (ex Grafana)
to the Metrics dashboard.
2019-04-26 17:23:26 +00:00
charlieablett 4bd331a568 Tighten up prohibited_key method 2019-04-26 09:40:00 +12:00
Charlie Ablett 8eae788fd4 Use English instead of Latin 2019-04-25 09:39:53 +12:00
Francisco Javier López 7d85448b58 Fix bug when project export to remote url fails 2019-04-24 15:34:06 +00:00
charlieablett 7e6befc05d Add disallowed fields to AttributeCleaner 2019-04-24 14:31:20 +12:00
charlieablett 0f2dff6264 Exclude fields from note import 2019-04-23 20:57:24 +12:00
Thong Kuah d119d3d1b2 Align UrlValidator to validate_url gem implementation.
Renamed UrlValidator to AddressableUrlValidator to avoid 'url:' naming collision with ActiveModel::Validations::UrlValidator in 'validates' statement.
Make use of the options attribute of the parent class ActiveModel::EachValidator.
Add more options: allow_nil, allow_blank, message.
Renamed 'protocols' option to 'schemes' to match the option naming from UrlValidator.
2019-04-11 06:29:07 +00:00
John Jarvis 69b65a6b74 Merge branch 'master' of dev.gitlab.org:gitlab/gitlabhq into jarv/dev-to-gitlab-2019-04-02 2019-04-02 10:12:32 +02:00
Oswaldo Ferreira 03e0604d5d Prepare suggestion implementation for multi-line
Adds the groundwork needed in order to persist multi-line suggestions,
while providing the parsing strategy which will be reused for the
**Preview** as well.
2019-03-27 12:26:53 -03:00
Igor Drozdov 732f892db3 Return cached languages if they've been detected before 2019-03-20 20:33:49 +03:00
Pirate Praveen c122014fd3
Update acts-as-taggable-on 5.0 -> 6.0
Signed-off-by: Rémy Coutable <remy@rymai.me>
2019-03-18 12:08:48 +01:00
Andrew Newdigate 3288e1a874 Adds the Rubocop ReturnNil cop
This style change enforces `return if ...` instead of
`return nil if ...` to save maintainers a few minor review points
2019-03-06 17:51:56 +02:00
Francisco Javier López ebf16ada85 Arbitrary file read via MergeRequestDiff 2019-03-04 18:36:34 +00:00
James Lopez c643042a49
Fix project import error on releases 2019-02-22 15:07:53 +01:00
Lin Jen-Shin ab06c9b654 Merge branch 'remove-ignored-columns' into 'master'
Remove two ignored columns

See merge request gitlab-org/gitlab-ce!25250
2019-02-15 12:47:29 +00:00
Nick Thomas 80a7aa9905
Remove further instances of st_diffs 2019-02-14 16:21:24 +00:00
James Lopez 401a3bca40
Fix import_jid error on project import 2019-02-14 09:29:42 +01:00
Nick Thomas f9e41d0d85
Allow MR diffs to be placed into an object store 2019-02-05 14:12:48 +00:00
Reuben Pereira 2079444091 DB and model changes for Sentry project selection dropdown 2019-02-04 12:12:24 +00:00
James Lopez f78545af98
Fix tree restorer visibility level 2019-01-31 16:52:49 +01:00
James Lopez 57f082d969
Fix path disclosure on Project Import 2019-01-31 16:51:16 +01:00