From f23f02cb80cfd88caf718a0764b870f04294a429 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cxxq250=E2=80=9D?= <“xxq250@qq.com”> Date: Wed, 23 Nov 2022 17:07:54 +0800 Subject: [PATCH 01/11] =?UTF-8?q?fixed=20=E5=A2=9E=E5=8A=A0emoji=E8=A1=A8?= =?UTF-8?q?=E6=83=85=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../20221123023450_update_user_nick_name.rb | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 db/migrate/20221123023450_update_user_nick_name.rb diff --git a/db/migrate/20221123023450_update_user_nick_name.rb b/db/migrate/20221123023450_update_user_nick_name.rb new file mode 100644 index 000000000..0910b7397 --- /dev/null +++ b/db/migrate/20221123023450_update_user_nick_name.rb @@ -0,0 +1,21 @@ +class UpdateUserNickName < ActiveRecord::Migration[5.2] + def change + execute("ALTER TABLE `users` MODIFY `nickname` VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;") + execute("ALTER TABLE `open_users` MODIFY `extra` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;") + + execute("ALTER TABLE `issues` MODIFY `subject` VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;") + execute("ALTER TABLE `issues` MODIFY `description` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;") + + execute("ALTER TABLE `projects` MODIFY `description` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;") + execute("ALTER TABLE `project_details` MODIFY `content` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;") + + execute("ALTER TABLE `journals` MODIFY `notes` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;") + execute("ALTER TABLE `journal_details` MODIFY `old_value` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;") + execute("ALTER TABLE `journal_details` MODIFY `value` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;") + + execute("ALTER TABLE `claims` MODIFY `note` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;") + + execute("ALTER TABLE `commit_logs` MODIFY `message` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;") + + end +end From 1c71eab72ea4de8c5b39bc409437e7e5e5080b06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cxxq250=E2=80=9D?= <“xxq250@qq.com”> Date: Wed, 23 Nov 2022 17:07:54 +0800 Subject: [PATCH 02/11] =?UTF-8?q?fixed=20=E5=A2=9E=E5=8A=A0emoji=E8=A1=A8?= =?UTF-8?q?=E6=83=85=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../20221123023450_update_user_nick_name.rb | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 db/migrate/20221123023450_update_user_nick_name.rb diff --git a/db/migrate/20221123023450_update_user_nick_name.rb b/db/migrate/20221123023450_update_user_nick_name.rb new file mode 100644 index 000000000..0910b7397 --- /dev/null +++ b/db/migrate/20221123023450_update_user_nick_name.rb @@ -0,0 +1,21 @@ +class UpdateUserNickName < ActiveRecord::Migration[5.2] + def change + execute("ALTER TABLE `users` MODIFY `nickname` VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;") + execute("ALTER TABLE `open_users` MODIFY `extra` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;") + + execute("ALTER TABLE `issues` MODIFY `subject` VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;") + execute("ALTER TABLE `issues` MODIFY `description` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;") + + execute("ALTER TABLE `projects` MODIFY `description` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;") + execute("ALTER TABLE `project_details` MODIFY `content` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;") + + execute("ALTER TABLE `journals` MODIFY `notes` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;") + execute("ALTER TABLE `journal_details` MODIFY `old_value` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;") + execute("ALTER TABLE `journal_details` MODIFY `value` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;") + + execute("ALTER TABLE `claims` MODIFY `note` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;") + + execute("ALTER TABLE `commit_logs` MODIFY `message` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;") + + end +end From a6923bf7ed3c5ce2fa54ee9811a344b046848989 Mon Sep 17 00:00:00 2001 From: yystopf Date: Wed, 23 Nov 2022 17:44:37 +0800 Subject: [PATCH 03/11] =?UTF-8?q?=E6=96=B0=E5=A2=9E=EF=BC=9Aget=5Fuser=5Fi?= =?UTF-8?q?nfo=E7=94=B5=E8=AF=9D=E5=8F=B7=E7=A0=81=E5=B1=95=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/get_user_info.json.jbuilder | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/users/get_user_info.json.jbuilder b/app/views/users/get_user_info.json.jbuilder index 611a09d50..b20bc2e16 100644 --- a/app/views/users/get_user_info.json.jbuilder +++ b/app/views/users/get_user_info.json.jbuilder @@ -10,7 +10,7 @@ json.is_teacher @user.user_extension&.teacher? json.user_identity @user.identity json.tidding_count 0 json.user_phone_binded @user.phone.present? -# json.phone @user.phone +json.phone @user.phone # json.email @user.mail json.profile_completed @user.profile_is_completed? json.professional_certification @user.professional_certification From 8f8dab10c3e39e908e33149cce50060a4cb94e66 Mon Sep 17 00:00:00 2001 From: xxq250 Date: Wed, 23 Nov 2022 17:58:51 +0800 Subject: [PATCH 04/11] =?UTF-8?q?fixed=20=E5=A2=9E=E5=8A=A0emoji=E8=A1=A8?= =?UTF-8?q?=E6=83=85=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/user.rb | 3 ++- db/migrate/20221123023450_update_user_nick_name.rb | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/app/models/user.rb b/app/models/user.rb index 62eeb77ee..fc0911d03 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -190,7 +190,8 @@ class User < Owner :show_email, :show_location, :show_department, :super_description, :show_super_description, :technical_title, :province, :city, :custom_department, to: :user_extension, allow_nil: true - before_save :update_hashed_password, :set_lastname + # before_save :update_hashed_password, :set_lastname + before_save :update_hashed_password after_save :reset_cache_data after_create do SyncTrustieJob.perform_later("user", 1) if allow_sync_to_trustie? diff --git a/db/migrate/20221123023450_update_user_nick_name.rb b/db/migrate/20221123023450_update_user_nick_name.rb index 0910b7397..0759f9291 100644 --- a/db/migrate/20221123023450_update_user_nick_name.rb +++ b/db/migrate/20221123023450_update_user_nick_name.rb @@ -17,5 +17,7 @@ class UpdateUserNickName < ActiveRecord::Migration[5.2] execute("ALTER TABLE `commit_logs` MODIFY `message` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;") + execute("ALTER TABLE `user_extensions` MODIFY `description` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;") + end end From fd2b20ed871b764a6f5c8cb2a9b3ad5a0c39a56f Mon Sep 17 00:00:00 2001 From: xxq250 Date: Thu, 24 Nov 2022 11:09:58 +0800 Subject: [PATCH 05/11] =?UTF-8?q?=E4=B8=AA=E4=BA=BA=E8=B5=84=E6=96=99?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=89=8B=E6=9C=BA=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/api/v1/users_controller.rb | 9 +++++ app/controllers/application_controller.rb | 2 +- .../api/v1/users/update_phone_service.rb | 35 +++++++++++++++++++ app/services/sms/ucloud_service.rb | 20 +++++++++-- config/routes/api.rb | 1 + 5 files changed, 63 insertions(+), 4 deletions(-) create mode 100644 app/services/api/v1/users/update_phone_service.rb diff --git a/app/controllers/api/v1/users_controller.rb b/app/controllers/api/v1/users_controller.rb index 3c6bec6a6..6baed66f6 100644 --- a/app/controllers/api/v1/users_controller.rb +++ b/app/controllers/api/v1/users_controller.rb @@ -78,4 +78,13 @@ class Api::V1::UsersController < Api::V1::BaseController return render_error('更改邮箱失败!') end end + + def update_phone + @result_object = Api::V1::Users::UpdatePhoneService.call(@observe_user, params) + if @result_object + return render_ok + else + return render_error('更改手机号失败!') + end + end end \ No newline at end of file diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 3cbc08c3c..8a5bb654e 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -105,7 +105,7 @@ class ApplicationController < ActionController::Base sigle_para = {phone: value} # status = Gitlink::Sms.send(mobile: value, code: code) # tip_exception(-2, code_msg(status)) if status != 0 - status = Sms::UcloudService.call(value, code) + status = Sms::UcloudService.call(value, code, send_type) tip_exception(-2, ucloud_code_msg(status)) if status != 0 when 8, 3, 5 # 邮箱类型的发送 diff --git a/app/services/api/v1/users/update_phone_service.rb b/app/services/api/v1/users/update_phone_service.rb new file mode 100644 index 000000000..b6f96df9d --- /dev/null +++ b/app/services/api/v1/users/update_phone_service.rb @@ -0,0 +1,35 @@ +class Api::V1::Users::UpdatePhoneService < ApplicationService + include ActiveModel::Model + + attr_reader :user, :password, :phone, :code, :verify_code + + validates :password, :code, presence: true + validates :phone, presence: true, format: { with: CustomRegexp::PHONE } + + def initialize(user, params) + @user = user + @password = params[:password] + @phone = params[:phone] + @code = params[:code] + @verify_code = VerificationCode.where(phone: @phone, code: @code, code_type: 4).last + end + + def call + raise Error, errors.full_messages.join(",") unless valid? + raise Error, "密码不正确." unless @user.check_password?(@password) + exist_owner = Owner.find_by(phone: @phone) + raise Error, "手机号已被使用." if exist_owner + is_debug = @code == "123123" && EduSetting.get("code_debug") # 万能验证码,用于测试 # TODO 万能验证码,用于测试 + raise Error, "验证码不正确." if @verify_code&.code != @code && !is_debug + raise Error, "验证码已失效." if !@verify_code&.effective? && !is_debug + + begin + ActiveRecord::Base.transaction do + @user.update_attributes!({phone: @phone}) + end + return true + rescue + raise Error, "服务器错误,请联系系统管理员!" + end + end +end \ No newline at end of file diff --git a/app/services/sms/ucloud_service.rb b/app/services/sms/ucloud_service.rb index 4f1005c6b..9edf746a1 100644 --- a/app/services/sms/ucloud_service.rb +++ b/app/services/sms/ucloud_service.rb @@ -1,9 +1,10 @@ class Sms::UcloudService < ApplicationService - attr_reader :phone, :code + attr_reader :phone, :code, :send_type - def initialize(phone, code) + def initialize(phone, code, send_type) @phone = phone @code = code + @send_type = send_type end def call @@ -14,7 +15,7 @@ class Sms::UcloudService < ApplicationService sign_params = { "Action" => "SendUSMSMessage", "ProjectId" => project_id, - "TemplateId" => "UTA221114S2MGTY", + "TemplateId" => get_template_id(@send_type), "PublicKey" => public_key, "PhoneNumbers.0" => @phone, "TemplateParams.0" => "#{@code}", @@ -95,4 +96,17 @@ class Sms::UcloudService < ApplicationService end end + + # 1:注册手机验证码 2:找回密码手机验证码 4:绑定手机 9:验证手机号有效 + def get_template_id(send_type) + case send_type + when 1, 2, 9 + "UTA221114S2MGTY" + when 4 + "UTA22112486FXLZ" + else + "UTA221114S2MGTY" + end + end + end diff --git a/config/routes/api.rb b/config/routes/api.rb index 1c55d59d9..64014e404 100644 --- a/config/routes/api.rb +++ b/config/routes/api.rb @@ -9,6 +9,7 @@ defaults format: :json do post :check_email post :check_email_verify_code patch :update_email + patch :update_phone end end scope module: :users do From 4e244bed3ab8013bc583e52ab9165097515cfaef Mon Sep 17 00:00:00 2001 From: xxq250 Date: Thu, 24 Nov 2022 14:28:49 +0800 Subject: [PATCH 06/11] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=89=8B=E6=9C=BA?= =?UTF-8?q?=E9=AA=8C=E8=AF=81=E7=A0=81=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/api/v1/users_controller.rb | 15 +++++++++++++++ app/controllers/application_controller.rb | 3 +-- config/routes/api.rb | 1 + 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/app/controllers/api/v1/users_controller.rb b/app/controllers/api/v1/users_controller.rb index 6baed66f6..11446533c 100644 --- a/app/controllers/api/v1/users_controller.rb +++ b/app/controllers/api/v1/users_controller.rb @@ -70,6 +70,21 @@ class Api::V1::UsersController < Api::V1::BaseController render_ok end + def check_phone_verify_code + code = strip(params[:code]) + phone = strip(params[:phone]) + code_type = params[:code_type] + + return tip_exception(-2, "手机号格式有误") unless mail =~ CustomRegexp::PHONE + + verifi_code = VerificationCode.where(phone: phone, code: code, code_type: code_type).last + return render_ok if code == "123123" && EduSetting.get("code_debug") # 万能验证码,用于测试 # TODO 万能验证码,用于测试 + + return tip_exception(-6, "验证码不正确") if verifi_code&.code != code + return tip_exception(-6, "验证码已失效") if !verifi_code&.effective? + render_ok + end + def update_email @result_object = Api::V1::Users::UpdateEmailService.call(@observe_user, params, current_user.gitea_token) if @result_object diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 8a5bb654e..b88849f56 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -79,8 +79,7 @@ class ApplicationController < ActionController::Base # 判断用户的邮箱或者手机是否可用 # params[:type] 1: 注册;2:忘记密码;3:绑定 def check_mail_and_phone_valid login, type - unless login =~ /^[a-zA-Z0-9]+([._\\]*[a-zA-Z0-9])*@([a-z0-9]+[-a-z0-9]*[a-z0-9]+.){1,63}[a-z0-9]+$/ || login =~ /^1\d{10}$/ || - login =~ /^[a-zA-Z0-9]+([._\\]*[a-zA-Z0-9])$/ + unless login =~ /^[a-zA-Z0-9]+([._\\]*[a-zA-Z0-9])*@([a-z0-9]+[-a-z0-9]*[a-z0-9]+.){1,63}[a-z0-9]+$/ || login =~ /^1\d{10}$/ tip_exception(-2, "请输入正确的手机号或邮箱") end diff --git a/config/routes/api.rb b/config/routes/api.rb index 64014e404..9a9e5a62f 100644 --- a/config/routes/api.rb +++ b/config/routes/api.rb @@ -8,6 +8,7 @@ defaults format: :json do post :check_password post :check_email post :check_email_verify_code + post :check_phone_verify_code patch :update_email patch :update_phone end From 5da6330f5736b27a2bd430d221b653744a8c5647 Mon Sep 17 00:00:00 2001 From: xxq250 Date: Thu, 24 Nov 2022 14:30:10 +0800 Subject: [PATCH 07/11] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=89=8B=E6=9C=BA?= =?UTF-8?q?=E9=AA=8C=E8=AF=81=E7=A0=81=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/api/v1/users_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/api/v1/users_controller.rb b/app/controllers/api/v1/users_controller.rb index 11446533c..3a750b519 100644 --- a/app/controllers/api/v1/users_controller.rb +++ b/app/controllers/api/v1/users_controller.rb @@ -75,7 +75,7 @@ class Api::V1::UsersController < Api::V1::BaseController phone = strip(params[:phone]) code_type = params[:code_type] - return tip_exception(-2, "手机号格式有误") unless mail =~ CustomRegexp::PHONE + return tip_exception(-2, "手机号格式有误") unless phone =~ CustomRegexp::PHONE verifi_code = VerificationCode.where(phone: phone, code: code, code_type: code_type).last return render_ok if code == "123123" && EduSetting.get("code_debug") # 万能验证码,用于测试 # TODO 万能验证码,用于测试 From b68ab63eba89b1ed253bb6e4f0ffa819881776d8 Mon Sep 17 00:00:00 2001 From: xxq250 Date: Thu, 24 Nov 2022 17:41:18 +0800 Subject: [PATCH 08/11] =?UTF-8?q?fixed=20=E9=AA=8C=E8=AF=81=E7=A0=81?= =?UTF-8?q?=E6=A0=A1=E9=AA=8C=E5=8C=B9=E9=85=8D=E8=A7=84=E5=88=99=E4=BF=AE?= =?UTF-8?q?=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/services/api/v1/users/update_email_service.rb | 2 +- app/services/api/v1/users/update_phone_service.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/services/api/v1/users/update_email_service.rb b/app/services/api/v1/users/update_email_service.rb index d17f101fd..bd1b5723c 100644 --- a/app/services/api/v1/users/update_email_service.rb +++ b/app/services/api/v1/users/update_email_service.rb @@ -14,7 +14,7 @@ class Api::V1::Users::UpdateEmailService < ApplicationService @mail = params[:email] @old_mail = user.mail @code = params[:code] - @verify_code = VerificationCode.where(email: @mail, code: @code, code_type: 10).last + @verify_code = VerificationCode.where(email: @mail, code_type: 10).last end def call diff --git a/app/services/api/v1/users/update_phone_service.rb b/app/services/api/v1/users/update_phone_service.rb index b6f96df9d..e41178e3d 100644 --- a/app/services/api/v1/users/update_phone_service.rb +++ b/app/services/api/v1/users/update_phone_service.rb @@ -11,7 +11,7 @@ class Api::V1::Users::UpdatePhoneService < ApplicationService @password = params[:password] @phone = params[:phone] @code = params[:code] - @verify_code = VerificationCode.where(phone: @phone, code: @code, code_type: 4).last + @verify_code = VerificationCode.where(phone: @phone, code_type: 4).last end def call From 7f47cd8d4646e8ba78cc5c83f0355588967029cc Mon Sep 17 00:00:00 2001 From: xxq250 Date: Fri, 25 Nov 2022 14:09:26 +0800 Subject: [PATCH 09/11] =?UTF-8?q?fixed=20=E5=A2=9E=E5=8A=A0emoji=E8=A1=A8?= =?UTF-8?q?=E6=83=85=E6=94=AF=E6=8C=81=E8=A1=A8=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...0221124111351_update_pull_request_utf_name.rb | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 db/migrate/20221124111351_update_pull_request_utf_name.rb diff --git a/db/migrate/20221124111351_update_pull_request_utf_name.rb b/db/migrate/20221124111351_update_pull_request_utf_name.rb new file mode 100644 index 000000000..5d5b7f581 --- /dev/null +++ b/db/migrate/20221124111351_update_pull_request_utf_name.rb @@ -0,0 +1,16 @@ +class UpdatePullRequestUtfName < ActiveRecord::Migration[5.2] + def change + execute("ALTER TABLE `projects` MODIFY `name` VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;") + execute("ALTER TABLE `pull_requests` MODIFY `title` VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;") + execute("ALTER TABLE `pull_requests` MODIFY `body` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;") + execute("ALTER TABLE `organization_extensions` MODIFY `description` VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;") + execute("ALTER TABLE `version_releases` MODIFY `name` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;") + execute("ALTER TABLE `version_releases` MODIFY `body` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;") + execute("ALTER TABLE `version_releases` MODIFY `tag_name` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;") + execute("ALTER TABLE `versions` MODIFY `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;") + execute("ALTER TABLE `versions` MODIFY `description` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;") + execute("ALTER TABLE `issue_tags` MODIFY `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;") + execute("ALTER TABLE `issue_tags` MODIFY `description` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;") + execute("ALTER TABLE `projects_activity` MODIFY `project_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;") + end +end From ee5d95940483f4d43fad8ec5bf7af98ddef6936a Mon Sep 17 00:00:00 2001 From: xxq250 Date: Fri, 25 Nov 2022 14:15:47 +0800 Subject: [PATCH 10/11] =?UTF-8?q?fixed=20=E5=A2=9E=E5=8A=A0emoji=E8=A1=A8?= =?UTF-8?q?=E6=83=85=E6=94=AF=E6=8C=81=E8=A1=A8=E5=AD=97=E6=AE=B5=EF=BC=8C?= =?UTF-8?q?=E9=95=BF=E5=BA=A6=E9=99=90=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- db/migrate/20221124111351_update_pull_request_utf_name.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/db/migrate/20221124111351_update_pull_request_utf_name.rb b/db/migrate/20221124111351_update_pull_request_utf_name.rb index 5d5b7f581..9b5d94e93 100644 --- a/db/migrate/20221124111351_update_pull_request_utf_name.rb +++ b/db/migrate/20221124111351_update_pull_request_utf_name.rb @@ -1,6 +1,6 @@ class UpdatePullRequestUtfName < ActiveRecord::Migration[5.2] def change - execute("ALTER TABLE `projects` MODIFY `name` VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;") + execute("ALTER TABLE `projects` MODIFY `name` VARCHAR(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;") execute("ALTER TABLE `pull_requests` MODIFY `title` VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;") execute("ALTER TABLE `pull_requests` MODIFY `body` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;") execute("ALTER TABLE `organization_extensions` MODIFY `description` VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;") @@ -9,7 +9,7 @@ class UpdatePullRequestUtfName < ActiveRecord::Migration[5.2] execute("ALTER TABLE `version_releases` MODIFY `tag_name` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;") execute("ALTER TABLE `versions` MODIFY `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;") execute("ALTER TABLE `versions` MODIFY `description` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;") - execute("ALTER TABLE `issue_tags` MODIFY `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;") + execute("ALTER TABLE `issue_tags` MODIFY `name` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;") execute("ALTER TABLE `issue_tags` MODIFY `description` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;") execute("ALTER TABLE `projects_activity` MODIFY `project_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;") end From 35cf298f5d18a53daca8df99f6bde0d3f7c8be5a Mon Sep 17 00:00:00 2001 From: xxq250 Date: Fri, 25 Nov 2022 14:19:05 +0800 Subject: [PATCH 11/11] =?UTF-8?q?fixed=20=E5=A2=9E=E5=8A=A0emoji=E8=A1=A8?= =?UTF-8?q?=E6=83=85=E6=94=AF=E6=8C=81=E8=A1=A8=E5=AD=97=E6=AE=B5=EF=BC=8C?= =?UTF-8?q?=E9=95=BF=E5=BA=A6=E9=99=90=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- db/migrate/20221124111351_update_pull_request_utf_name.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/db/migrate/20221124111351_update_pull_request_utf_name.rb b/db/migrate/20221124111351_update_pull_request_utf_name.rb index 9b5d94e93..6d0fd2fec 100644 --- a/db/migrate/20221124111351_update_pull_request_utf_name.rb +++ b/db/migrate/20221124111351_update_pull_request_utf_name.rb @@ -1,6 +1,6 @@ class UpdatePullRequestUtfName < ActiveRecord::Migration[5.2] def change - execute("ALTER TABLE `projects` MODIFY `name` VARCHAR(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;") + execute("ALTER TABLE `projects` MODIFY `name` VARCHAR(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;") execute("ALTER TABLE `pull_requests` MODIFY `title` VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;") execute("ALTER TABLE `pull_requests` MODIFY `body` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;") execute("ALTER TABLE `organization_extensions` MODIFY `description` VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;") @@ -9,7 +9,7 @@ class UpdatePullRequestUtfName < ActiveRecord::Migration[5.2] execute("ALTER TABLE `version_releases` MODIFY `tag_name` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;") execute("ALTER TABLE `versions` MODIFY `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;") execute("ALTER TABLE `versions` MODIFY `description` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;") - execute("ALTER TABLE `issue_tags` MODIFY `name` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;") + execute("ALTER TABLE `issue_tags` MODIFY `name` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;") execute("ALTER TABLE `issue_tags` MODIFY `description` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;") execute("ALTER TABLE `projects_activity` MODIFY `project_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;") end