FIX: Don't seed flags if ids don't exist

This can happen if you use the `replace_flags` plugin API to remove
a flag.
This commit is contained in:
Robin Ward 2018-10-25 15:36:24 -04:00
parent 306d77b54f
commit c2c99c7c39
1 changed files with 35 additions and 25 deletions

View File

@ -13,37 +13,47 @@ PostActionType.seed do |s|
s.position = 2
end
PostActionType.seed do |s|
s.id = PostActionType.types[:off_topic]
s.name_key = 'off_topic'
s.is_flag = true
s.position = 3
if PostActionType.types[:off_topic]
PostActionType.seed do |s|
s.id = PostActionType.types[:off_topic]
s.name_key = 'off_topic'
s.is_flag = true
s.position = 3
end
end
PostActionType.seed do |s|
s.id = PostActionType.types[:inappropriate]
s.name_key = 'inappropriate'
s.is_flag = true
s.position = 4
if PostActionType.types[:inappropriate]
PostActionType.seed do |s|
s.id = PostActionType.types[:inappropriate]
s.name_key = 'inappropriate'
s.is_flag = true
s.position = 4
end
end
PostActionType.seed do |s|
s.id = PostActionType.types[:spam]
s.name_key = 'spam'
s.is_flag = true
s.position = 6
if PostActionType.types[:spam]
PostActionType.seed do |s|
s.id = PostActionType.types[:spam]
s.name_key = 'spam'
s.is_flag = true
s.position = 6
end
end
PostActionType.seed do |s|
s.id = PostActionType.types[:notify_user]
s.name_key = 'notify_user'
s.is_flag = true
s.position = 7
if PostActionType.types[:notify_user]
PostActionType.seed do |s|
s.id = PostActionType.types[:notify_user]
s.name_key = 'notify_user'
s.is_flag = true
s.position = 7
end
end
PostActionType.seed do |s|
s.id = PostActionType.types[:notify_moderators]
s.name_key = 'notify_moderators'
s.is_flag = true
s.position = 8
if PostActionType.types[:notify_moderators]
PostActionType.seed do |s|
s.id = PostActionType.types[:notify_moderators]
s.name_key = 'notify_moderators'
s.is_flag = true
s.position = 8
end
end