MCPcopy Index your code
hub / github.com/diffgram/diffgram / email

Method email

walrus/methods/action/workflowexecutor.py:346–400  ·  view source on GitHub ↗

(self)

Source from the content-addressed store, hash-verified

344
345 # WIP WIP WIP
346 def email(self):
347 """
348
349
350 """
351
352 # Use Action specs
353 # ie action.email_send_to
354
355 # TODO what we want to send / put here...
356
357 # Back two layers?
358 # This feels pretty awkward!!! Also how we
359 # want to construct this dynamically...
360 logger.debug('[ActionFlow {}] Running Email Action'.format(self.workflow.id))
361 subject = "Diffgram Event"
362
363 if self.previous_action_event:
364 if self.previous_action_event.kind == "condition":
365 count = self.previous_previous_action_event.count
366 label = self.previous_previous_action_event.action.count_label_file.label
367
368 subject = str(count) + " " + \
369 str(label.name) + " (s)"
370
371 # TODO store url as more generic thing with flow event...
372
373 url = "{}project/".format(settings.URL_BASE) + str(self.action.project.project_string_id) + \
374 "/flow/" + str(self.workflow.id) + "/event/" + str(self.flow_event.id)
375
376 # Create Email Notification
377 notification = Notification.new(
378 session=self.session,
379 channel_type='email',
380 add_to_session=True,
381 flush_session=True,
382 type=self.trigger_event.type,
383 task_id=self.trigger_event.task_id,
384 job_id=self.trigger_event.job_id,
385 input_id=self.trigger_event.input_id,
386 member_created=self.trigger_event.member_created
387 )
388
389 if self.workflow.time_window and hasattr(self.trigger_event, 'aggregation_window_start_time') and \
390 self.trigger_event.aggregation_window_start_time:
391 notification.send_email(session=self.session,
392 email=self.action.email_send_to,
393 start_time=self.trigger_event.aggregation_window_start_time)
394
395 else:
396 notification.send_email(session=self.session,
397 email=self.action.email_send_to,
398 start_time=None)
399
400 self.action_event.email_was_sent_to = self.action.email_send_to
401
402 def webhook(self):
403 """

Callers

nothing calls this directly

Calls 2

send_emailMethod · 0.80
newMethod · 0.45

Tested by

no test coverage detected