Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-11-28 09:10:35 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-11-28 09:10:35 +0300
commit787981be19177a149a901e873f199331ecb873d4 (patch)
tree163ab57eb1883827dd76a029fabb98a4d7b620c1 /app/models
parent583699499eb9f56c83563045fdd83f7ae896c082 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models')
-rw-r--r--app/models/merge_request_diff.rb23
-rw-r--r--app/models/namespace.rb4
2 files changed, 27 insertions, 0 deletions
diff --git a/app/models/merge_request_diff.rb b/app/models/merge_request_diff.rb
index 98a9ccc2040..08c56131d78 100644
--- a/app/models/merge_request_diff.rb
+++ b/app/models/merge_request_diff.rb
@@ -414,6 +414,29 @@ class MergeRequestDiff < ApplicationRecord
end
end
+ def paginated_diffs(page, per_page)
+ fetching_repository_diffs({}) do |comparison|
+ reorder_diff_files!
+
+ collection = Gitlab::Diff::FileCollection::PaginatedMergeRequestDiff.new(
+ self,
+ page,
+ per_page
+ )
+
+ if comparison
+ comparison.diffs(
+ paths: collection.diff_paths,
+ page: collection.current_page,
+ per_page: collection.limit_value,
+ count: collection.total_count
+ )
+ else
+ collection
+ end
+ end
+ end
+
def diffs(diff_options = nil)
fetching_repository_diffs(diff_options) do |comparison|
# It should fetch the repository when diffs are cleaned by the system.
diff --git a/app/models/namespace.rb b/app/models/namespace.rb
index 51c39ad4ec3..47fd39e8b96 100644
--- a/app/models/namespace.rb
+++ b/app/models/namespace.rb
@@ -507,6 +507,10 @@ class Namespace < ApplicationRecord
root? && actual_plan.paid?
end
+ def prevent_delete?
+ paid?
+ end
+
def actual_limits
# We default to PlanLimits.new otherwise a lot of specs would fail
# On production each plan should already have associated limits record