このコミットが含まれているのは:
@@ -1,4 +1,5 @@
|
||||
class Locale < ApplicationRecord
|
||||
before_save :lock_tag_creation!, if: :will_generate_tag_names?
|
||||
after_save :generate_tag_names!, if: :needs_tag_names?
|
||||
|
||||
belongs_to :language, foreign_key: :language_code, primary_key: :code
|
||||
@@ -10,6 +11,14 @@ class Locale < ApplicationRecord
|
||||
|
||||
private
|
||||
|
||||
def will_generate_tag_names?
|
||||
deprecated_at.nil? && (will_save_change_to_code? || will_save_change_to_deprecated_at?)
|
||||
end
|
||||
|
||||
def lock_tag_creation!
|
||||
SharedResourceIdAllocator.lock_space!(Tag, 'tags')
|
||||
end
|
||||
|
||||
def needs_tag_names?
|
||||
deprecated_at.nil? && (saved_change_to_code? || saved_change_to_deprecated_at?)
|
||||
end
|
||||
|
||||
@@ -259,7 +259,8 @@ class Tag < ApplicationRecord
|
||||
name = name.to_s.strip
|
||||
|
||||
ApplicationRecord.transaction do
|
||||
tn = TagName.find_by(language_code:, name:)
|
||||
SharedResourceIdAllocator.lock_space!(Tag, 'tags')
|
||||
tn = TagName.lock.find_by(language_code:, name:)
|
||||
next tn.tag if tn
|
||||
|
||||
tag = Tag.create!(category:)
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする