summaryrefslogtreecommitdiff
path: root/app/models
Commit message (Collapse)AuthorAgeFilesLines
* Remove Project#publicishZeger-Jan van de Weg2016-03-131-6/+0
|
* External UsersZeger-Jan van de Weg2016-03-132-17/+29
| | | | | The user has the rights of a public user execpt it can never create a project, group, or team. Also it cant view internal projects.
* Merge branch 'projects-finder-ee-compatible' into 'master' Dmitriy Zaporozhets2016-03-121-6/+3
|\ | | | | | | | | | | | | | | | | Removed User#project_relations This is to make things more compatible with EE so merging is easier. cc @dzaporozhets See merge request !3192
| * Removed User#project_relationsprojects-finder-ee-compatibleYorick Peterse2016-03-121-6/+3
| | | | | | | | | | | | | | | | GitLab EE adds an extra relation that selects a "project_id" column instead of an "id" column, making it very hard for this method to be re-used in EE. Since using User#authorized_groups in ProjectsFinder#all_groups apparently has no performance impact we can just use it and keep everything compatible with EE.
* | Merge branch 'rs-disallow-blank-line-code' into 'master' Douwe Maan2016-03-121-1/+6
|\ \ | |/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | Disallow blank (non-null) values for a Note's `line_code` attribute It's unclear how these blank values got added, but GitLab.com had a few: ``` irb(main):002:0> Note.where("line_code IS NOT NULL AND line_code = ''").count => 439 ``` We've added a migration to convert any existing records to use a NULL value when blank, and updated Note to set blank values to nil before validation. See merge request !3118
| * Disallow blank (non-null) values for a Note's `line_code` attributers-disallow-blank-line-codeRobert Speicher2016-03-111-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | It's unclear how these blank values got added, but GitLab.com had a few: ``` irb(main):002:0> Note.where("line_code IS NOT NULL AND line_code = ''").count => 439 ``` We've added a migration to convert any existing records to use a NULL value when blank, and updated Note to set blank values to nil before validation.
* | Merge branch 'fix/token-timing-attack' into 'master' Douwe Maan2016-03-122-3/+3
|\ \ | |/ |/| | | | | | | | | | | | | fix token issue - timing attack Updates token comparisons to use a secure version instead of `==` Fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/13617 See merge request !3062
| * add SHA256 to secure_comparefix/token-timing-attackJames Lopez2016-03-082-3/+3
| |
| * Merge branch 'master' of gitlab.com:gitlab-org/gitlab-ce into ↵James Lopez2016-03-0817-208/+250
| |\ | | | | | | | | | fix/token-timing-attack
| * | fix token issue - timing attackJames Lopez2016-03-022-3/+3
| | |
* | | Use a UNION in MergeRequest.in_projectsYorick Peterse2016-03-111-1/+18
| | | | | | | | | | | | | | | | | | | | | | | | The OR condition for source_project_id/target_project_id leads to a query plan that performs rather poorly on PostgreSQL due to the use of sub-queries. Because Rails offers no easy alternative for this particular problem we're forced to using a UNION for both conditions. The resulting query performs much faster than just using an OR.
* | | Make Namespace.search case-insensitiveYorick Peterse2016-03-111-1/+11
| | | | | | | | | | | | | | | This ensures searching namespaces works exactly the same as searching for any other resource.
* | | Removed arel_table receiver from search methodsYorick Peterse2016-03-116-6/+6
| | | | | | | | | | | | | | | We can just use "arel_table" in these cases instead of "SomeClass.arel_table".
* | | Clean up ProjectsFinder for getting user projectsYorick Peterse2016-03-111-3/+6
| | | | | | | | | | | | | | | We don't need the extra layer of nesting of UNION queries here (as User#authorized_projects already returns a UNION'd query).
* | | Use ILIKE/LIKE for searching milestonesYorick Peterse2016-03-111-2/+11
| | |
* | | Use ILIKE/LIKE for Issuable.search and full_searchYorick Peterse2016-03-111-2/+19
| | |
* | | Use ILIKE/LIKE for searching CI runnersYorick Peterse2016-03-111-3/+17
| | |
* | | Use ILIKE/LIKE for searching groupsYorick Peterse2016-03-111-1/+11
| | |
* | | Use ILIKE/LIKE for searching usersYorick Peterse2016-03-111-1/+15
| | |
* | | Use ILIKE/LIKE for searching notesYorick Peterse2016-03-111-1/+11
| | |
* | | Use ILIKE/LIKE for searching snippetsYorick Peterse2016-03-111-2/+22
| | | | | | | | | | | | | | | | | | Previously this used a regular LIKE which is case-sensitive on PostgreSQL. This ensures that for both PostgreSQL and MySQL the searching is case-insensitive similar to searching for projects.
* | | Use ILIKE in Project.search_by_titleYorick Peterse2016-03-111-1/+4
| | | | | | | | | | | | | | | | | | Similar to the changes made to Project.search the method Project.search_by_title now also uses Arel so it can automatically use ILIKE/LIKE instead of the lower() function.
* | | Use ILIKE/LIKE + UNION in Project.searchYorick Peterse2016-03-111-6/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This chance is broken up in two steps: 1. Use ILIKE on PostgreSQL and LIKE on MySQL, instead of using "WHERE lower(x) LIKE lower(y)" as ILIKE is significantly faster than using lower(). In many cases the use of lower() will force a slow sequence scan. 2. Instead of using 1 query that searches both projects and namespaces using a JOIN we're using 2 separate queries that are UNION'd together. Using a JOIN would force a slow sequence scan, using a UNION avoids this. This method now uses Arel as Arel automatically uses ILIKE on PostgreSQL and LIKE on MySQL, removing the need to handle this manually.
* | | Merge branch 'master' of https://gitlab.com/gitlab-org/gitlab-ce into ↵Jacob Vosmaer2016-03-103-3/+9
|\ \ \ | | | | | | | | | | | | expiring-lock
| * | | Optimize Project#ci_service(s)optimize-project-ci-servicesYorick Peterse2016-03-101-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The method Project#ci_services would load all services into memory (including _all_ their columns) and then use Enumerable#select to reduce the list. Project#ci_service in turn would further reduce this list down to just 1 Service instance. Instead of doing all this in Ruby we can just offload the work to the database, reducing the amount of time spent in these methods. These changes reduce the time of the first call to Project#ci_services from around 240 ms to around 10 ms, though the final timings will vary based on database load. Because Project#ci_service is memoized there's no further overhead introduced by using a database query. Fixes gitlab-org/gitlab-ce#14186
| * | | Merge branch 'fix-git-push-service-specs' into 'master' Robert Speicher2016-03-091-0/+5
| |\ \ \ | | | | | | | | | | | | | | | | | | | | Fixed the GitPushService specs See merge request !3139
| | * | | Handle permissions for ExternalIssue instancesfix-git-push-service-specsYorick Peterse2016-03-091-0/+5
| | | | | | | | | | | | | | | | | | | | This fixes the remainder of the GitPushService specs.
| * | | | Merge branch 'fix-todos' into 'master' Douglas Barbosa Alexandre2016-03-091-0/+1
| |\ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix error 500 in Todos Closes #14095 Closes #14075 Closes #14109 Closes #14151 See merge request !3141
| | * | | | Destroy all related todos when removing a projectDouglas Barbosa Alexandre2016-03-091-0/+1
| | |/ / /
| * | | | Merge branch 'commit-limits' into 'master' Jacob Vosmaer2016-03-091-1/+1
| |\ \ \ \ | | |/ / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit limits Prevent timeouts when creating/viewing Merge Requests with many commits. Also, reduce the number of commits shown in the UI from 500 to 100. Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/14031 This MR avoids Unicorn timeouts in some places and takes 4.5 seconds off load times in others, when manually testing with a 4500-commit compare/MR in the linux repo. It does not limit the number of Commit objects instantiated in memory, just the amount of HTML generated. It seems that having 4500 commits objects is not a problem in itself. If it ever becomes one we could do something for Commit objects like we did for Diff (introduce a CommitCollection or something). See merge request !3095
| | * | | Show at most 100 commits in the web UIJacob Vosmaer2016-03-041-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | When rendering 1 commit takes over 5ms (on my laptop: around 9ms), it saves seconds in rendering time to show 100 instead of 500 commits.
* | | | | Move method to UserJacob Vosmaer2016-03-101-0/+7
|/ / / /
* | | | Merge branch 'rs-snippets-dont-expire' into 'master' Dmitriy Zaporozhets2016-03-093-11/+0
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove `Snippet#expires_at` This was removed from the interface in https://github.com/gitlabhq/gitlabhq/pull/6027 but its implementation lingered around for two years. See merge request !3103
| * | | | Remove `Snippet#expires_at`rs-snippets-dont-expireRobert Speicher2016-03-053-11/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This was removed from the interface in https://github.com/gitlabhq/gitlabhq/pull/6027 but its implementation lingered around for two years.
* | | | | Call after_create_branch in Repository#add_branchbranch-tag-count-methodsYorick Peterse2016-03-081-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | This ensures the right caches are flushed when adding a branch via the UI, instead of only flushing this one random cache.
* | | | | Call the right hooks in Repository#add_tagYorick Peterse2016-03-081-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | This ensures Repository#add_tag calls Repository#before_push_tag instead of just 1 random cache expiration method.
* | | | | Call the right hooks when removing branchesYorick Peterse2016-03-081-2/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This ensures that Repository#rm_branch calls before_remove_branch/after_remove_branch instead of just 1 random cache expiration method.
* | | | | Cache & flush tag/branch countsYorick Peterse2016-03-081-3/+30
| |_|_|/ |/| | | | | | | | | | | | | | | | | | | | | | | The methods used for this are Repository#tag_count and Repository#branch_count which cache their output in Redis as well as memoizing it in an instance variable. Both methods have a corresponding methods/hooks to flush the caches at the right time.
* | | | Merge branch 'master' into 'master' Yorick Peterse2016-03-081-0/+6
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | adds language names to projects list [image attached] See merge request !3000
| * | | | moves the main_language update logic to git push servicetiagonbotelho2016-03-071-8/+0
| | | | |
| * | | | removes automatic setting of main_language to project for it to set a main ↵tiagonbotelho2016-03-071-10/+0
| | | | | | | | | | | | | | | | | | | | language you have now to make a commit to the project
| * | | | fixes typotiagonbotelho2016-03-071-1/+1
| | | | |
| * | | | removes redundant selftiagonbotelho2016-03-071-1/+1
| | | | |
| * | | | adds tests and fixes some broken code to main language mrtiagonbotelho2016-03-071-3/+3
| | | | |
| * | | | adds swp and swo to gitignore and improves migration for project main_languagetiagonbotelho2016-03-073-6/+18
| | | | |
| * | | | removes unused methods that I forgottiagonbotelho2016-03-072-16/+0
| | | | |
| * | | | implements project languages saving them onto the databasetiagonbotelho2016-03-072-0/+12
| | | | |
| * | | | moves method to repository modeltiagonbotelho2016-03-072-7/+13
| | | | |
| * | | | changes if ! to unless and now asks for language instead of languagestiagonbotelho2016-03-071-3/+4
| | | | |
| * | | | adds cache to languages listtiagonbotelho2016-03-071-4/+4
| | | | |