From 5302490d609259cda814781f196ce9f08bfc3ef5 Mon Sep 17 00:00:00 2001 From: xxq250 Date: Tue, 4 Apr 2023 14:37:09 +0800 Subject: [PATCH 1/4] =?UTF-8?q?fixed=20bot=E5=AE=89=E8=A3=85=E4=BB=93?= =?UTF-8?q?=E5=BA=93=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/installations_controller.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/controllers/installations_controller.rb b/app/controllers/installations_controller.rb index f7bf4f0d..74d66ce7 100644 --- a/app/controllers/installations_controller.rb +++ b/app/controllers/installations_controller.rb @@ -16,7 +16,8 @@ class InstallationsController < ApplicationController end def repositories - @install_bots = BotInstall.where(:installer_id => current_user.id) + bot = Bot.find_by(uid: current_user.id) + @install_bots = BotInstall.where(:installer_id => bot.owner_id) end def update_secret From 1b183811dd2d801b22152aa4563b05517d0d8fe8 Mon Sep 17 00:00:00 2001 From: xxq250 Date: Tue, 4 Apr 2023 14:39:51 +0800 Subject: [PATCH 2/4] =?UTF-8?q?fixed=20bot=E5=AE=89=E8=A3=85=E4=BB=93?= =?UTF-8?q?=E5=BA=93=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/installations_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/installations_controller.rb b/app/controllers/installations_controller.rb index 74d66ce7..a0817402 100644 --- a/app/controllers/installations_controller.rb +++ b/app/controllers/installations_controller.rb @@ -17,7 +17,7 @@ class InstallationsController < ApplicationController def repositories bot = Bot.find_by(uid: current_user.id) - @install_bots = BotInstall.where(:installer_id => bot.owner_id) + @install_bots = BotInstall.where(bot_id: bot.id).where(:installer_id => bot.owner_id) end def update_secret From 1d2ea48812aee74b75076a65b5847b69880ac48a Mon Sep 17 00:00:00 2001 From: xxq250 Date: Tue, 4 Apr 2023 15:30:28 +0800 Subject: [PATCH 3/4] =?UTF-8?q?fixed=20bot=E5=AE=89=E8=A3=85=E4=BB=93?= =?UTF-8?q?=E5=BA=93=E5=88=97=E8=A1=A8=EF=BC=8C=E4=B8=8Egithub=E5=B7=AE?= =?UTF-8?q?=E5=BC=82=EF=BC=8C=E6=89=80=E4=BB=A5=E5=8F=96=E5=AE=89=E8=A3=85?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E5=92=8Cbot=E5=AF=B9=E5=BA=94=E6=89=80?= =?UTF-8?q?=E6=9C=89=E7=9A=84=E4=BB=93=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/installations_controller.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/controllers/installations_controller.rb b/app/controllers/installations_controller.rb index a0817402..a8791627 100644 --- a/app/controllers/installations_controller.rb +++ b/app/controllers/installations_controller.rb @@ -16,8 +16,10 @@ class InstallationsController < ApplicationController end def repositories + # 与github差异,所以取安装用户和bot对应所有的仓库 + install_bot = BotInstall.find params[:id] bot = Bot.find_by(uid: current_user.id) - @install_bots = BotInstall.where(bot_id: bot.id).where(:installer_id => bot.owner_id) + @install_bots = BotInstall.where(bot_id: bot.id).where(:installer_id => install_bot.installer_id) end def update_secret From c2cda6a4a29337102bdf4d2f27117b3975b2121b Mon Sep 17 00:00:00 2001 From: xxq250 Date: Tue, 4 Apr 2023 15:30:39 +0800 Subject: [PATCH 4/4] =?UTF-8?q?fixed=20bot=E5=AE=89=E8=A3=85=E4=BB=93?= =?UTF-8?q?=E5=BA=93=E5=88=97=E8=A1=A8=EF=BC=8C=E4=B8=8Egithub=E5=B7=AE?= =?UTF-8?q?=E5=BC=82=EF=BC=8C=E6=89=80=E4=BB=A5=E5=8F=96=E5=AE=89=E8=A3=85?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E5=92=8Cbot=E5=AF=B9=E5=BA=94=E6=89=80?= =?UTF-8?q?=E6=9C=89=E7=9A=84=E4=BB=93=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/routes.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/routes.rb b/config/routes.rb index dea64f21..d9990c52 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1080,7 +1080,7 @@ Rails.application.routes.draw do end resources :installations, only: [] do - get :repositories, on: :collection + get :repositories, on: :member end root 'main#index'