Skip to content

Commit

Permalink
Small changes
Browse files Browse the repository at this point in the history
  • Loading branch information
luciajanikova committed Oct 1, 2024
1 parent a42bbd1 commit db253a7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion app/models/govbox/message.rb
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ def self.migrate_tags_from_draft(message, tags_to_migrate)
tags_to_migrate[:objects].each do |object_data|
object = message.objects.find_by(uuid: object_data[:uuid])
object_data[:tags].each do |object_tag_id|
object.assign_tag(Tag.find(object_tag_id))
object&.assign_tag(Tag.find(object_tag_id))
end
end

Expand Down
9 changes: 4 additions & 5 deletions app/models/message_draft.rb
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,10 @@ def submit
def tags_to_migrate_to_message
migration_list = {}

migration_list[:objects] = objects.map do |object|
{
uuid: object.uuid,
tags: object.tags.signed.map(&:id)
} if object.tags.signed.any?
migration_list[:objects] = objects.map do |object| {
uuid: object.uuid,
tags: object.tags.signed.map(&:id)
} if object.tags.signed.any?
end.compact
migration_list[:message] = tags.simple.or(tags.signed).map(&:id)
migration_list[:thread] = (thread.tags.simple + thread.tags.signed).map(&:id)
Expand Down

0 comments on commit db253a7

Please sign in to comment.