diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2016-12-01 11:59:00 +0100 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2016-12-01 17:31:49 +0100 |
commit | 2791226c6b59db62b76bf4f5c4f4f945e9760eaa (patch) | |
tree | 5bcae0445e0839cced0c246093259db3e083f116 /app/serializers | |
parent | 57b1976976c2631299e20465e5633652d2753a6f (diff) | |
download | gitlab-ce-2791226c6b59db62b76bf4f5c4f4f945e9760eaa.tar.gz |
Remove support from incremental pipeline updates
Diffstat (limited to 'app/serializers')
-rw-r--r-- | app/serializers/pipeline_entity.rb | 38 | ||||
-rw-r--r-- | app/serializers/pipeline_serializer.rb | 5 |
2 files changed, 7 insertions, 36 deletions
diff --git a/app/serializers/pipeline_entity.rb b/app/serializers/pipeline_entity.rb index 08346b4ed77..cf99e628d5f 100644 --- a/app/serializers/pipeline_entity.rb +++ b/app/serializers/pipeline_entity.rb @@ -2,7 +2,7 @@ class PipelineEntity < Grape::Entity include RequestAwareEntity expose :id - expose :user, if: proc { created_exposure? }, using: UserEntity + expose :user, using: UserEntity expose :url do |pipeline| namespace_project_pipeline_path( @@ -11,7 +11,7 @@ class PipelineEntity < Grape::Entity pipeline) end - expose :details, if: proc { updated_exposure? } do + expose :details do expose :status expose :duration expose :finished_at @@ -20,7 +20,7 @@ class PipelineEntity < Grape::Entity expose :manual_actions, using: PipelineActionEntity end - expose :flags, if: proc { created_exposure? } do + expose :flags do expose :latest?, as: :latest expose :triggered?, as: :triggered @@ -33,7 +33,7 @@ class PipelineEntity < Grape::Entity end end - expose :ref, if: proc { updated_exposure? } do + expose :ref do expose :name do |pipeline| pipeline.ref end @@ -48,16 +48,16 @@ class PipelineEntity < Grape::Entity expose :tag? end - expose :commit, if: proc { created_exposure? }, using: CommitEntity + expose :commit, using: CommitEntity - expose :retry_url, if: proc { updated_exposure? } do |pipeline| + expose :retry_url do |pipeline| can?(request.user, :update_pipeline, pipeline.project) && pipeline.retryable? && retry_namespace_project_pipeline_path(pipeline.project.namespace, pipeline.project, pipeline.id) end - expose :cancel_url, if: proc { updated_exposure? } do |pipeline| + expose :cancel_url do |pipeline| can?(request.user, :update_pipeline, pipeline.project) && pipeline.cancelable? && cancel_namespace_project_pipeline_path(pipeline.project.namespace, @@ -65,28 +65,4 @@ class PipelineEntity < Grape::Entity end expose :created_at, :updated_at - - def created_exposure? - !incremental? || created? - end - - def updated_exposure? - !incremental? || updated? - end - - def incremental? - options[:incremental] && last_updated - end - - def last_updated - options.fetch(:last_updated) - end - - def updated? - @object.updated_at > last_updated - end - - def created? - @object.created_at > last_updated - end end diff --git a/app/serializers/pipeline_serializer.rb b/app/serializers/pipeline_serializer.rb index 8d3182d9766..f7abbec7d45 100644 --- a/app/serializers/pipeline_serializer.rb +++ b/app/serializers/pipeline_serializer.rb @@ -1,8 +1,3 @@ class PipelineSerializer < BaseSerializer entity PipelineEntity - - def incremental(resource, last_updated) - represent(resource, incremental: true, - last_updated: last_updated) - end end |