Add command to filter by tag

This commit is contained in:
Jorge Manrubia
2025-05-07 16:07:21 +02:00
parent b8daaa193a
commit 50da28c0be
3 changed files with 40 additions and 0 deletions
+7
View File
@@ -23,6 +23,8 @@ class Command::Parser
Command::Assign.new(assignee_ids: assignees_from(command_arguments).collect(&:id), card_ids: cards.ids)
when "/close"
Command::Close.new(card_ids: cards.ids, reason: command_arguments.join(" "))
when /^#/
Command::FilterByTag.new(tag_id: tag_from(string).id, params: filter.as_params)
when /^@/
Command::GoToUser.new(user_id: assignee_from(command_name)&.id)
else
@@ -44,6 +46,11 @@ class Command::Parser
User.all.find { |user| user.mentionable_handles.include?(string_without_at) }
end
def tag_from(string)
title = string.gsub(/^#/, "")
Tag.find_or_create_by!(title: title)
end
def parse_free_string(string)
if cards = multiple_cards_from(string)
Command::FilterCards.new(card_ids: cards.ids, params: filter.as_params)