Skip to content

Commit eb386af

Browse files
committed
Option do not dispatch event if not required
1 parent 016f486 commit eb386af

7 files changed

Lines changed: 14 additions & 9 deletions

File tree

‎lhc_web/design/defaulttheme/js/js_static/a07851a85849880a5fd11dd78f238b28.js‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎lhc_web/design/defaulttheme/js/js_static/a07851a85849880a5fd11dd78f238b28.js.map‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎lhc_web/design/defaulttheme/js/react/build/all.js‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎lhc_web/design/defaulttheme/js/react/build/all.js.map‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎lhc_web/design/defaulttheme/js/react/src/components/builder/NodeTriggerActionCommand.js‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,9 @@ class NodeTriggerActionCommand extends Component {
248248
<label>File attributes. One per line in format <code>attribute_name||attribute value</code>. Supported attributes: <code>caption</code>, <code>caption_ocr</code></label>
249249
<textarea rows="4" className="form-control form-control-sm" placeholder={"caption||File caption\ncaption_ocr||Text recognized in the file"} onChange={(e) => this.onchangeAttr({'path':['payload_arg'],'value':e.target.value})} defaultValue={this.props.action.getIn(['content','payload_arg'])} ></textarea>
250250
</div>
251+
<div className="form-group">
252+
<label><input type="checkbox" onChange={(e) => this.onchangeAttr({'path' : ['do_not_dispatch'], 'value' :e.target.checked})} defaultChecked={this.props.action.getIn(['content','do_not_dispatch'])} /> Do not dispatch file modification event (file.main_attr_updated).</label>
253+
</div>
251254
</div>}
252255

253256
{this.props.action.getIn(['content','command']) == 'messageaggregation' &&

‎lhc_web/doc/CHANGELOG.txt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
✨ Add file captions/OCR attributes, file bot actions, file webhooks and login history filters
44

55
- 🗄️ Add caption and caption_ocr columns to lh_chat_file and lhc_mailconv_file tables via update_362.sql, install scripts, structure.json, db.dbml and POS definitions
6-
- 🤖 Add fileattribute bot command to set caption/caption_ocr on chat and mail files (new attribute||value line format with legacy fallback), block setting primary key via setchatattribute
6+
- 🤖 Add fileattribute bot command to set caption/caption_ocr on chat and mail files (new attribute||value line format with legacy fallback), block setting primary key via setchatattribute, add "do not dispatch modification event" option so file.main_attr_updated/mail.file.main_attr_updated is not fired
77
- 🔗 Dispatch file.mail_import.file_store and file.uploadfile.file_store events, move file.storescreenshot.store dispatch after transaction commit so bot workflows act on fully saved files
88
- 🐝 Support chat_file context in bot conditions, REST API actions (file_ent chat/mail), and bot worker fetching mail/chat files with fallback chat resolution
99
- 🌐 Add file.uploadfile.after_save and file.mail_import.file_store to webhooks debug dispatch and allow file classes in reflection allow-list

‎lhc_web/lib/core/lhgenericbot/actionTypes/lhgenericbotactioncommand.php‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -688,10 +688,12 @@ public static function process($chat, $action, $trigger, $params)
688688

689689
$db->commit();
690690

691-
erLhcoreClassChatEventDispatcher::getInstance()->dispatch($file instanceof erLhcoreClassModelMailconvFile ? 'mail.file.main_attr_updated' : 'file.main_attr_updated', array(
692-
'chat_file' => $file,
693-
'file_type' => $file instanceof erLhcoreClassModelMailconvFile ? 'mail' : 'chat'
694-
));
691+
if (!isset($action['content']['do_not_dispatch']) || $action['content']['do_not_dispatch'] != true) {
692+
erLhcoreClassChatEventDispatcher::getInstance()->dispatch($file instanceof erLhcoreClassModelMailconvFile ? 'mail.file.main_attr_updated' : 'file.main_attr_updated', array(
693+
'chat_file' => $file,
694+
'file_type' => $file instanceof erLhcoreClassModelMailconvFile ? 'mail' : 'chat'
695+
));
696+
}
695697

696698
} catch (Exception $e) {
697699
$db->rollback();

0 commit comments

Comments
 (0)