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 s.position = 2
end end
PostActionType.seed do |s| if PostActionType.types[:off_topic]
s.id = PostActionType.types[:off_topic] PostActionType.seed do |s|
s.name_key = 'off_topic' s.id = PostActionType.types[:off_topic]
s.is_flag = true s.name_key = 'off_topic'
s.position = 3 s.is_flag = true
s.position = 3
end
end end
PostActionType.seed do |s| if PostActionType.types[:inappropriate]
s.id = PostActionType.types[:inappropriate] PostActionType.seed do |s|
s.name_key = 'inappropriate' s.id = PostActionType.types[:inappropriate]
s.is_flag = true s.name_key = 'inappropriate'
s.position = 4 s.is_flag = true
s.position = 4
end
end end
PostActionType.seed do |s| if PostActionType.types[:spam]
s.id = PostActionType.types[:spam] PostActionType.seed do |s|
s.name_key = 'spam' s.id = PostActionType.types[:spam]
s.is_flag = true s.name_key = 'spam'
s.position = 6 s.is_flag = true
s.position = 6
end
end end
PostActionType.seed do |s| if PostActionType.types[:notify_user]
s.id = PostActionType.types[:notify_user] PostActionType.seed do |s|
s.name_key = 'notify_user' s.id = PostActionType.types[:notify_user]
s.is_flag = true s.name_key = 'notify_user'
s.position = 7 s.is_flag = true
s.position = 7
end
end end
PostActionType.seed do |s| if PostActionType.types[:notify_moderators]
s.id = PostActionType.types[:notify_moderators] PostActionType.seed do |s|
s.name_key = 'notify_moderators' s.id = PostActionType.types[:notify_moderators]
s.is_flag = true s.name_key = 'notify_moderators'
s.position = 8 s.is_flag = true
s.position = 8
end
end end