Skip to content

Commit

Permalink
Merge pull request #1595 from tryzealot/hotfix/upload-app
Browse files Browse the repository at this point in the history
Minor bugfix
  • Loading branch information
icyleaf authored Jul 23, 2024
2 parents 2392236 + ed681a5 commit 80d517a
Show file tree
Hide file tree
Showing 9 changed files with 14 additions and 8 deletions.
5 changes: 2 additions & 3 deletions app/controllers/api/apps/upload_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ def create
private

def create_or_update_release
raise AppInfo::UnknownFormatError, t('releases.messages.errors.require_parsable') unless @app_parser

ActiveRecord::Base.transaction do
new_record? ? create_new_app_build : create_build_from_exist_app
end
Expand All @@ -52,7 +50,8 @@ def create_build_from_exist_app
release = @channel.releases.build
authorize release

if @channel.device_type == 'ios' || @channel.device_type == 'android'
if @channel.bundle_id != '*' && @app_parser &&
(@channel.device_type == 'ios' || @channel.device_type == 'android')
message = t('releases.messages.errors.bundle_id_not_matched', got: @app_parser.bundle_id,
expect: @channel.bundle_id)
raise TypeError, message unless @channel.bundle_id_matched? @app_parser.bundle_id
Expand Down
6 changes: 6 additions & 0 deletions app/controllers/users/omniauth_callbacks_controller.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# frozen_string_literal: true

class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController
before_action :disable_registrations_mode unless Setting.registrations_mode

User.oauth_providers.each do |provider_name|
define_method(provider_name) do
omniauth_callback(provider_name)
Expand Down Expand Up @@ -50,4 +52,8 @@ def goback_path
omni_params = request.env['omniauth.params']
omni_params&['back'].presence || request.env['HTTP_REFERER'] || root_path
end

def disable_registrations_mode
redirect_to user_session_path, alert: t('devise.omniauth_callbacks.disabled')
end
end
2 changes: 1 addition & 1 deletion app/javascript/controllers/release_download_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ export default class extends Controller {
let textNode = this.installLimitedTarget.getElementsByClassName("text")[0]
let brNode = document.createElement("br")
textNode.appendChild(brNode)
if (isiOS) {
if (isiOS()) {
textNode.appendChild(document.createTextNode(this.openSafariValue))
} else {
textNode.appendChild(document.createTextNode(this.openBrowerValue))
Expand Down
2 changes: 1 addition & 1 deletion app/views/devise/shared/_links.html.slim
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
- if devise_mapping.omniauthable?
- if devise_mapping.omniauthable? && Setting.registrations_mode
.social-auth-links.mb-3
- resource_class.oauth_providers.each do |provider|
- unless provider == :ldap
Expand Down
2 changes: 1 addition & 1 deletion app/views/releases/body/_new_release_callout.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
= t('releases.show.not_latest_release')
p
= raw t('releases.show.released_new_version', \
version: latest_release.release_version ? "#{latest_release.release_version} #{latest_release.build_version ? " (#{latest_release.build_version})" : ''}" : latest_release.version, \
version: latest_release.release_version.present? ? "#{latest_release.release_version} #{latest_release.build_version ? " (#{latest_release.build_version})" : ''}" : latest_release.version, \
time: time_ago_in_words(latest_release.created_at), \
link: link_to(t('releases.show.view_latest_version'), friendly_channel_release_path(latest_release.channel, latest_release)))
2 changes: 2 additions & 0 deletions config/locales/devise/devise.views.en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ en:
danger_zone: Danger Zone
cancel_my_account: Delete account
unhappy: Do you really want to delete your account?
omniauth_callbacks:
disabled: Registration mode is closed. Please contact the administrator.
1 change: 1 addition & 0 deletions config/locales/devise/devise.views.zh-CN.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ zh-CN:
message: 由于多次登录失败,您的帐户已被锁定。
subject: 帐户解锁信息
omniauth_callbacks:
disabled: 系统关闭了注册功能,请联系管理员。
failure: 由于 %{reason},无法从%{kind}获得授权。
success: 成功地从%{kind}获得授权。
passwords:
Expand Down
1 change: 0 additions & 1 deletion config/locales/zealot/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,6 @@ en:
not_found_really: Not found this build.
invalid_password: Invalid password
bundle_id_not_matched: 'Bundle id or package name not matched between release %{got} and rule %{expect}'
require_parsable: Upload file can not parsable, ensure the uploaded file is in a supported format.
debug_files:
title: Debug files
index:
Expand Down
1 change: 0 additions & 1 deletion config/locales/zealot/zh-CN.yml
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,6 @@ zh-CN:
not_found_really: 您访问的应用版本真的不存在
invalid_password: 密码错误,请重新输入
bundle_id_not_matched: '应用的包名 %{got} 和约束的包名 %{expect} 无法匹配'
require_parsable: 应用无法正常解析,确保上传文件是支持的格式
debug_files:
title: 调试文件
index:
Expand Down

0 comments on commit 80d517a

Please sign in to comment.