From 91966192e1de191673356beb3a4ef0e3e9f5075a Mon Sep 17 00:00:00 2001 From: Jasder <2053003901@@qq.com> Date: Wed, 9 Sep 2020 10:33:49 +0800 Subject: [PATCH 1/4] =?UTF-8?q?FIX=20=E5=A4=84=E7=90=86gitea=E7=89=88?= =?UTF-8?q?=E6=9C=AC=E5=BA=93=E4=B8=AD=E8=8E=B7=E5=8F=96=E5=AD=90=E7=9B=AE?= =?UTF-8?q?=E5=BD=95404=E6=97=B6=E7=9A=84=E5=AE=B9=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/repositories_controller.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index 9d1c98e37..3776cade4 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -40,8 +40,10 @@ class RepositoriesController < ApplicationController file_path_uri = URI.parse(URI.encode(params[:filepath].to_s.strip)) interactor = Repositories::EntriesInteractor.call(@project.owner, @project.identifier, file_path_uri, ref: @ref) if interactor.success? - @sub_entries = interactor.result - @sub_entries = [] << @sub_entries unless @sub_entries.is_a? Array + result = interactor.result + return @sub_entries = [] if result[:status] == -1 + + @sub_entries = [] << result unless result.is_a? Array @sub_entries = @sub_entries.sort_by{ |hash| hash['type'] } else render_error(interactor.error) From bb98dad64c9b6f53e1c6e9e862c26e48d972be9a Mon Sep 17 00:00:00 2001 From: Jasder <2053003901@@qq.com> Date: Fri, 11 Sep 2020 22:40:32 +0800 Subject: [PATCH 2/4] FIX educoder auto register --- app/controllers/oauth/educoder_controller.rb | 2 +- app/views/oauth/register.html.erb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/oauth/educoder_controller.rb b/app/controllers/oauth/educoder_controller.rb index f27b8b6d3..8ed537d6c 100644 --- a/app/controllers/oauth/educoder_controller.rb +++ b/app/controllers/oauth/educoder_controller.rb @@ -25,7 +25,7 @@ class Oauth::EducoderController < Oauth::BaseController redirect_to callback_url else - redirect_to oauth_register_path(login: login, callback_url: callback_url) + redirect_to oauth_register_path(login: login, mail: mail, callback_url: callback_url) end end rescue WechatOauth::Error => ex diff --git a/app/views/oauth/register.html.erb b/app/views/oauth/register.html.erb index 59a3d4857..96778fa06 100644 --- a/app/views/oauth/register.html.erb +++ b/app/views/oauth/register.html.erb @@ -11,7 +11,7 @@
邮箱: - <%= text_field_tag :mail, '', placeholder: '请输入绑定邮箱', maxlength: 40, id: 'email' %> + <%= text_field_tag :mail, params[:mail], placeholder: '请输入绑定邮箱', maxlength: 40, id: 'email' %>

From b785105730b63aba7d8e2cc8f788954b15f483d9 Mon Sep 17 00:00:00 2001 From: Jasder <2053003901@@qq.com> Date: Fri, 11 Sep 2020 23:04:16 +0800 Subject: [PATCH 3/4] FIX get sub entries bug --- app/controllers/repositories_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index 3776cade4..7a6b7991a 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -41,7 +41,7 @@ class RepositoriesController < ApplicationController interactor = Repositories::EntriesInteractor.call(@project.owner, @project.identifier, file_path_uri, ref: @ref) if interactor.success? result = interactor.result - return @sub_entries = [] if result[:status] == -1 + return @sub_entries = [] if result.is_a?(Hash) && result[:status] == -1 @sub_entries = [] << result unless result.is_a? Array @sub_entries = @sub_entries.sort_by{ |hash| hash['type'] } From e7ff26faa52006b0ccd148d1608110f72c616d04 Mon Sep 17 00:00:00 2001 From: Jasder <2053003901@@qq.com> Date: Fri, 11 Sep 2020 23:20:18 +0800 Subject: [PATCH 4/4] FIX code bug --- app/controllers/repositories_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index 7a6b7991a..566881ffd 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -43,7 +43,7 @@ class RepositoriesController < ApplicationController result = interactor.result return @sub_entries = [] if result.is_a?(Hash) && result[:status] == -1 - @sub_entries = [] << result unless result.is_a? Array + @sub_entries = result.is_a?(Array) ? result : [result] @sub_entries = @sub_entries.sort_by{ |hash| hash['type'] } else render_error(interactor.error)