Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automation rule content matching and thread renaming action v1 #445

Merged
merged 11 commits into from
Aug 5, 2024

Conversation

stage-rl
Copy link
Collaborator

No description provided.

@stage-rl stage-rl requested a review from jsuchal June 27, 2024 21:12
@stage-rl
Copy link
Collaborator Author

Este je tam nejaka chyba v testoch, to zatial pls ignoruj, fixnem

@stage-rl
Copy link
Collaborator Author

stage-rl commented Jul 1, 2024

@jsuchal za mna hotovo, pozri pls

else
thing
end
new_value = value.gsub("${title}", object.title)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tato notacia ide odkial? Som skor za handlebars styl {{title}}

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK

@@ -0,0 +1,34 @@
# frozen_string_literal: true

module ContentMatchingOperations
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Imho mixiny davaju zmysel ked to pojde do viacerych tried, toto mi pride, ze cela tato logika by mala byt v action samotnej.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Zaviedol som to prave preto, ze to ide do dvoch tried - message_object a nested_message_object. Mam to teda stahovat do action?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No praveze mne pride ze by to malo byt len v action a prinajlepsom message_object alebo nested_message_object budu mat nejaku malu metodu ktora bude vytahovat obsah pre toto. nedava mi zmysel uplne rovnake metody tlacit do dvoch tried, to smrdi.

boxes:
sync_all_requested: "Sťahovanie nových správ bolo spustené."
message_created: "Nová správa"
"Automation::ContainsCondition": "obsahuje"
"Automation::AttachmentContentCondition": "obsahuje"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tie conditions by mali byt nazvate tak, ze vieme co sa bude diat. Cize skor Automation::AttachmentContentContainsCondition

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mozno by som tu dal príloha obsahuje ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Premenovane na Automation::AttachmentContentContainsCondition

Aj ja som najprv isiel, ze priloha obsahuje, ale kvoli GUI a jeho skladaniu treba takto:

attachment_contains

test/models/automation/attachment_test.rb Show resolved Hide resolved
Comment on lines 21 to 27
pdf.pages.each do |page|
if (last_page_text + " " + page.text).gsub("\n", " ").match?(value)
io.close
return true
end

last_page_text = page.text
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tejto logike uplne nerozumiem. jednak toto bude nachylne na whitespace a diakritiku a dvak preco matchujeme len predchadzajucu page a tu nasledujucu? Co ak je text cez 3 strany? (protipriklad)

Copy link
Collaborator Author

@stage-rl stage-rl Jul 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tiez sa mi to velmi nepaci, ale skor teda daj pls nejaky tip, ako na to. Kedze som nic lepsie nevymyslel. Mam hladat nejake riesenia s ignorovanim whitespace a diakritiky?

Co sa tyka 3 stran, tak to by som povazoval za taky extrem, ze to asi neriesime. Zatialco rozseknutie hladaneho textu na 2 strany asi moze celkom bezne nastat.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ja by som to asi cele hodil do jedneho stringu a matchoval tam.

six:
automation_rule: five
type: Automation::ChangeMessageThreadTitleAction
value: "New title - ${title}"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, rozumiem tomu teda tak, ze do tohto ${title} sa vlastne vklada nazov vlakna a mozem si nastavit na urovni akcie, ze ako sa to premenuje. Asi good enough na teraz.

(Ako nejake rozsirenie si viem predstavit, ze budes matchovat regexp a vytiahnes z neho nieco co tu vlozis.)

@@ -20,8 +20,12 @@
<p class="flex-grow-0 flex-shrink-0 text-base text-left text-gray-500">
<% @automation_rule.actions.each_with_index do |action, index| %>
<span class="flex-grow-0 flex-shrink-0 text-base text-left text-gray-500"><%= t action.type %></span>
<span class="flex-grow-0 flex-shrink-0 text-base font-medium text-left text-gray-500"><%= action.action_object.name %></span>
<%if index < @automation_rule.actions.length - 1%><%= ', '%><% end %>
<% if action.type == 'Automation::AddMessageThreadTagAction' %>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

detto

@stage-rl stage-rl requested a review from jsuchal July 23, 2024 20:32
@@ -22,13 +22,18 @@ class Action < ApplicationRecord
def tag_list
automation_rule.tenant.tags.pluck(:name, :id)
end

def object_based?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Toto sa robit tak, ze tu metodu implementujes v actions a tam vratis true alebo false.

Comment on lines 120 to 123
pdf.pages.each do |page|
pdf_string += page.text
last_page_text = page.text
end
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tu by som to cele nacital. pdf_string = pdf.pages.map(&:text).join(' ')

Copy link
Member

@jsuchal jsuchal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@celuchmarek medzicasom stihol nejake veci co ti koliduju porobit, skus spravit merge/rebase voci main.

@jsuchal
Copy link
Member

jsuchal commented Jul 29, 2024

@celuchmarek ty si sa nedavno chytal actions, vies kuknut ci tu nevidis nieco podozrive? Za mna to uz vyzera celkom ok.

@stage-rl
Copy link
Collaborator Author

Este tam je nejaky problem na frontende. Ale @celuchmarek samozrejme mozes pozriet, snad to uz bude lahky fix.

@celuchmarek
Copy link
Member

Tie veci, čo sa dotýkajú mojich zmien, vyzerajú podľa mňa ok.

@stage-rl stage-rl requested a review from jsuchal August 4, 2024 19:12
@jsuchal jsuchal merged commit 90cafb2 into main Aug 5, 2024
3 checks passed
@jsuchal jsuchal deleted the GO-370/attachment_search_rule branch August 5, 2024 08:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants