From 1839d48893ca278a71208d40c17f3ed4d009233a Mon Sep 17 00:00:00 2001 From: f Date: Sat, 29 Apr 2023 18:10:28 -0300 Subject: [PATCH 1/6] fix: permitir el atributo start #13321 --- app/models/metadata_template.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/metadata_template.rb b/app/models/metadata_template.rb index 5de54be1..b324e71c 100644 --- a/app/models/metadata_template.rb +++ b/app/models/metadata_template.rb @@ -202,7 +202,7 @@ MetadataTemplate = Struct.new(:site, :document, :name, :label, :type, def allowed_attributes @allowed_attributes ||= %w[style href src alt controls data-align data-multimedia data-multimedia-inner id - name].freeze + name start].freeze end def allowed_tags From 1be1977c343a6d6b6a9a379d9414872db9830f8b Mon Sep 17 00:00:00 2001 From: jazzari Date: Wed, 23 Aug 2023 14:13:25 -0300 Subject: [PATCH 2/6] fix: fix minima design's link to demostration site #14131 --- db/seeds/designs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/seeds/designs.yml b/db/seeds/designs.yml index a04c99c1..46f1cd0d 100644 --- a/db/seeds/designs.yml +++ b/db/seeds/designs.yml @@ -18,7 +18,7 @@ - name_en: 'Minima' name_es: 'Mínima' gem: 'sutty-minima' - url: 'https://0xacab.org/sutty/jekyll/minima' + url: 'https://minima.sutty.nl/' description_en: "Sutty Minima is based on [Minima](https://jekyll.github.io/minima/), a blog-focused theme for Jekyll." description_es: 'Sutty Mínima es una plantilla para blogs basada en [Mínima](https://jekyll.github.io/minima/).' license: 'https://0xacab.org/sutty/jekyll/minima/-/blob/master/LICENSE.txt' From 7793c5f96d63bad20243b6eb3bb0d8bc79e92e6d Mon Sep 17 00:00:00 2001 From: f Date: Fri, 22 Sep 2023 13:03:28 -0300 Subject: [PATCH 3/6] =?UTF-8?q?fix:=20no=20enviar=20el=20env=20en=20la=20n?= =?UTF-8?q?otificaci=C3=B3n?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/api/v1/webhooks_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/api/v1/webhooks_controller.rb b/app/controllers/api/v1/webhooks_controller.rb index 1730034e..36e6a6d1 100644 --- a/app/controllers/api/v1/webhooks_controller.rb +++ b/app/controllers/api/v1/webhooks_controller.rb @@ -68,7 +68,7 @@ module Api # respuesta de error a plataformas def platforms_answer(exception) - ExceptionNotifier.notify_exception(exception, env: request.env, data: { headers: request.headers.to_h }) + ExceptionNotifier.notify_exception(exception, data: { headers: request.headers.to_h } head :forbidden end From bfd31d051fb002e303ddcd0f253b1e2a7aa50f49 Mon Sep 17 00:00:00 2001 From: f Date: Mon, 25 Sep 2023 14:15:32 -0300 Subject: [PATCH 4/6] =?UTF-8?q?fix:=20lanzar=20una=20excepci=C3=B3n=20cont?= =?UTF-8?q?undente?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/initializers/core_extensions.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/initializers/core_extensions.rb b/config/initializers/core_extensions.rb index 2e9ed7e1..d6039e16 100644 --- a/config/initializers/core_extensions.rb +++ b/config/initializers/core_extensions.rb @@ -93,8 +93,8 @@ module Jekyll unless spec I18n.with_locale(locale) do - raise ArgumentError, I18n.t('activerecord.errors.models.site.attributes.design_id.missing_gem', theme: name) - rescue ArgumentError => e + raise Jekyll::Errors::InvalidThemeName, I18n.t('activerecord.errors.models.site.attributes.design_id.missing_gem', theme: name) + rescue Jekyll::Errors::InvalidThemeName => e ExceptionNotifier.notify_exception(e, data: { theme: name, site: File.basename(site.source) }) raise end From 9ec0dc87a9426a3a101416e5044b40d8e274f08e Mon Sep 17 00:00:00 2001 From: f Date: Tue, 31 Oct 2023 13:53:45 -0300 Subject: [PATCH 5/6] fix: hacer un merge cuando hay cambios #14533 --- app/jobs/git_pull_job.rb | 6 +++++- app/models/site/repository.rb | 9 +++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/app/jobs/git_pull_job.rb b/app/jobs/git_pull_job.rb index dc4a285c..c7063650 100644 --- a/app/jobs/git_pull_job.rb +++ b/app/jobs/git_pull_job.rb @@ -8,6 +8,10 @@ class GitPullJob < ApplicationJob # @param :message [String] # @return [nil] def perform(site, usuarie, message) - site.repository.merge(usuarie, message) if site.repository.fetch&.positive? + site.repository.fetch + + return if site.repository.up_to_date? + + site.repository.merge(usuarie, message) end end \ No newline at end of file diff --git a/app/models/site/repository.rb b/app/models/site/repository.rb index acbf6553..17ee0792 100644 --- a/app/models/site/repository.rb +++ b/app/models/site/repository.rb @@ -111,10 +111,11 @@ class Site walker.each.to_a end - # Hay commits sin aplicar? - def needs_pull? - fetch - !commits.empty? + # Detecta si hay que hacer un pull o no + # + # @return [Boolean] + def up_to_date? + rugged.merge_analysis(remote_head_commit).include?(:up_to_date) end # Guarda los cambios en git From f00d6c6d45425dd2c98c7df5ce1cc2444bd8b20a Mon Sep 17 00:00:00 2001 From: f Date: Tue, 31 Oct 2023 13:54:19 -0300 Subject: [PATCH 6/6] feat: hacer fast forward si no hay cambios locales #14533 --- app/jobs/git_pull_job.rb | 27 +++++++++++++++++---------- app/models/site/repository.rb | 32 ++++++++++++++++++++++++++++---- 2 files changed, 45 insertions(+), 14 deletions(-) diff --git a/app/jobs/git_pull_job.rb b/app/jobs/git_pull_job.rb index c7063650..77f75ba9 100644 --- a/app/jobs/git_pull_job.rb +++ b/app/jobs/git_pull_job.rb @@ -1,17 +1,24 @@ # frozen_string_literal: true -# Permite traer los cambios desde webhooks - +# Permite traer los cambios desde el repositorio remoto class GitPullJob < ApplicationJob - # @param :site [Site] - # @param :usuarie [Usuarie] - # @param :message [String] - # @return [nil] - def perform(site, usuarie, message) - site.repository.fetch + # @param :site [Site] + # @param :usuarie [Usuarie] + # @param :message [String] + # @return [nil] + def perform(site, usuarie, message) + site.repository.fetch - return if site.repository.up_to_date? + return if site.repository.up_to_date? + if site.repository.fast_forward? + site.repository.fast_forward! + else site.repository.merge(usuarie, message) end -end \ No newline at end of file + + git_lfs_checkout + + nil + end +end diff --git a/app/models/site/repository.rb b/app/models/site/repository.rb index 17ee0792..e77aded9 100644 --- a/app/models/site/repository.rb +++ b/app/models/site/repository.rb @@ -75,13 +75,18 @@ class Site # Forzamos el checkout para mover el HEAD al último commit y # escribir los cambios rugged.checkout 'HEAD', strategy: :force - - git_sh("git", "lfs", "fetch", "origin", default_branch) - # reemplaza los pointers por los archivos correspondientes - git_sh("git", "lfs", "checkout") + commit end + # Trae todos los archivos desde LFS + # + # @return [Boolean] + def git_lfs_checkout + git_sh('git', 'lfs', 'fetch', 'origin', default_branch) + git_sh('git', 'lfs', 'checkout') + end + # El último commit # # @return [Rugged::Commit] @@ -118,6 +123,25 @@ class Site rugged.merge_analysis(remote_head_commit).include?(:up_to_date) end + # Detecta si es posible adelantar la historia local a la remota o + # necesitamos un merge + # + # @return [Boolean] + def fast_forward? + rugged.merge_analysis(remote_head_commit).include?(:fastforward) + end + + # Mueve la historia local a la remota + # + # @see {https://stackoverflow.com/a/27077322} + # @return [nil] + def fast_forward! + rugged.checkout_tree(remote_head_commit) + rugged.references.update(rugged.head.resolve, remote_head_commit.oid) + + nil + end + # Guarda los cambios en git # # @param :add [Array] Archivos a agregar