通过仓库id拿用户标识和仓库标识

This commit is contained in:
呱呱呱 2023-10-16 10:57:37 +08:00
parent d60ba95444
commit d19c94666a
2 changed files with 12 additions and 2 deletions

View File

@ -4,9 +4,9 @@ class ProjectsController < ApplicationController
include ProjectsHelper
include Acceleratorable
before_action :require_login, except: %i[index branches branches_slice group_type_list simple show fork_users praise_users watch_users recommend banner_recommend about menu_list verify_auth_token]
before_action :require_login, except: %i[index branches branches_slice group_type_list simple show mp_show fork_users praise_users watch_users recommend banner_recommend about menu_list verify_auth_token]
before_action :require_profile_completed, only: [:create, :migrate,:page_migrate,:verify_auth_token]
before_action :load_repository, except: %i[index group_type_list migrate page_migrate create recommend banner_recommend verify_auth_token]
before_action :load_repository, except: %i[index mp_show group_type_list migrate page_migrate create recommend banner_recommend verify_auth_token]
before_action :authorizate_user_can_edit_project!, only: %i[update]
before_action :project_public?, only: %i[fork_users praise_users watch_users]
before_action :request_limit, only: %i[index]
@ -232,6 +232,15 @@ class ProjectsController < ApplicationController
def show
end
def mp_show
@project = Project.joins(:owner).find params[:project_id]
data={
owner:@project.owner.try(:login),
identifier:@project.identifier
}
render_ok(data:data)
end
def destroy
if current_user.admin? || @project.manager?(current_user)
ActiveRecord::Base.transaction do

View File

@ -127,6 +127,7 @@ Rails.application.routes.draw do
# blockchain related routes
get 'users/blockchain/balance', to: 'users#blockchain_balance'
get 'projects/mp_show', to: 'projects#mp_show'
post 'users/blockchain/balance_project', to: 'users#blockchain_balance_one_project'
post 'users/blockchain/transfer', to: 'users#blockchain_transfer'
post 'users/blockchain/exchange', to: 'users#blockchain_exchange'