All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/1] Send email notification on publication
@ 2017-10-12 18:11 Amanda Brindle
  2017-10-12 18:12 ` [PATCH 1/1] " Amanda Brindle
  0 siblings, 1 reply; 4+ messages in thread
From: Amanda Brindle @ 2017-10-12 18:11 UTC (permalink / raw)
  To: yocto, paul.eggleton; +Cc: Amanda Brindle

The following changes since commit ad1aac4ea5d4f2b327f7bd9611aed13f7c31ff7e:

  Show note if layer branch hasn't been indexed (2017-10-04 13:49:00 +1300)

are available in the git repository at:

  git://git.yoctoproject.org/layerindex-web abrindle/email_notification_publication
  http://git.yoctoproject.org/cgit.cgi/layerindex-web/log/?h=abrindle/email_notification_publication

Amanda Brindle (1):
  Send email notification on publication

 layerindex/views.py                          | 22 +++++++++++++++++++++-
 templates/layerindex/publishemail.txt        |  7 +++++++
 templates/layerindex/publishemailsubject.txt |  1 +
 3 files changed, 29 insertions(+), 1 deletion(-)
 create mode 100644 templates/layerindex/publishemail.txt
 create mode 100644 templates/layerindex/publishemailsubject.txt

-- 
2.7.4



^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/1] Send email notification on publication
  2017-10-12 18:11 [PATCH 0/1] Send email notification on publication Amanda Brindle
@ 2017-10-12 18:12 ` Amanda Brindle
  0 siblings, 0 replies; 4+ messages in thread
From: Amanda Brindle @ 2017-10-12 18:12 UTC (permalink / raw)
  To: yocto, paul.eggleton; +Cc: Amanda Brindle

When publishing a layer, send an email notification to all of that
layer's maintainers.

Fixes [YOCTO #11208]

Signed-off-by: Amanda Brindle <amanda.r.brindle@intel.com>
---
 layerindex/views.py                          | 22 +++++++++++++++++++++-
 templates/layerindex/publishemail.txt        |  7 +++++++
 templates/layerindex/publishemailsubject.txt |  1 +
 3 files changed, 29 insertions(+), 1 deletion(-)
 create mode 100644 templates/layerindex/publishemail.txt
 create mode 100644 templates/layerindex/publishemailsubject.txt

diff --git a/layerindex/views.py b/layerindex/views.py
index bcf6671..35949dd 100644
--- a/layerindex/views.py
+++ b/layerindex/views.py
@@ -5,7 +5,7 @@
 # Licensed under the MIT license, see COPYING.MIT for details
 
 import sys
-from django.shortcuts import get_object_or_404, render
+from django.shortcuts import get_object_or_404, get_list_or_404, render
 from django.http import HttpResponse, HttpResponseRedirect, HttpResponseForbidden, Http404
 from django.core.urlresolvers import reverse, reverse_lazy, resolve
 from django.core.exceptions import PermissionDenied
@@ -261,6 +261,26 @@ def _check_url_branch(kwargs):
 def publish(request, name):
     if not (request.user.is_authenticated() and request.user.has_perm('layerindex.publish_layer')):
         raise PermissionDenied
+    from_email = settings.SUBMIT_EMAIL_FROM
+    plaintext = get_template('layerindex/publishemail.txt')
+    subjecttext = get_template('layerindex/publishemailsubject.txt')
+    e = Context({
+        'layer_name': layeritem.name,
+        'site_name': request.META['HTTP_HOST'],
+    })
+    subject = subjecttext.render(e).rstrip()
+    layeritem = get_object_or_404(LayerItem, name=name)
+    layerbranch = get_object_or_404(LayerBranch, layer=layeritem)
+    maintainers = get_list_or_404(LayerMaintainer, layerbranch=layerbranch)
+    layer_url = request.build_absolute_uri(reverse('layer_item', args=(layerbranch.branch, layeritem.name)))
+    for m in maintainers:
+        d = Context({
+            'maintainer_name': m.name,
+            'layer_name': layeritem.name,
+            'layer_url': layer_url,
+        })
+        text_content = plaintext.render(d)
+        tasks.send_email.apply_async((subject, text_content, from_email, [m.email]))
     return _statuschange(request, name, 'P')
 
 def _statuschange(request, name, newstatus):
diff --git a/templates/layerindex/publishemail.txt b/templates/layerindex/publishemail.txt
new file mode 100644
index 0000000..2500bff
--- /dev/null
+++ b/templates/layerindex/publishemail.txt
@@ -0,0 +1,7 @@
+Hi {{ maintainer_name }},
+
+You are listed as a maintainer for the new layer, {{ layer_name }}. This layer has been published. You can view it at the following URL:
+
+ {{ layer_url }}
+
+Thanks!
diff --git a/templates/layerindex/publishemailsubject.txt b/templates/layerindex/publishemailsubject.txt
new file mode 100644
index 0000000..a46eaf2
--- /dev/null
+++ b/templates/layerindex/publishemailsubject.txt
@@ -0,0 +1 @@
+{{layer_name }} was published to {{site_name}}
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 0/1] Send email notification on publication
@ 2017-10-19 21:27 Amanda Brindle
  2017-10-20 14:23 ` Leonardo Sandoval
  0 siblings, 1 reply; 4+ messages in thread
From: Amanda Brindle @ 2017-10-19 21:27 UTC (permalink / raw)
  To: yocto; +Cc: paul.eggleton, Amanda Brindle

Before, if there were multiple maintainers, this sent an individual email to each maintainer. Now, this will send one email to all maintainers. The email will also provide instructions for how the maintainer can make changes to the layer's index entry in the future.

The following changes since commit ad1aac4ea5d4f2b327f7bd9611aed13f7c31ff7e:

  Show note if layer branch hasn't been indexed (2017-10-04 13:49:00 +1300)

are available in the git repository at:

  git://git.yoctoproject.org/layerindex-web abrindle/email_notification_publication
  http://git.yoctoproject.org/cgit.cgi/layerindex-web/log/?h=abrindle/email_notification_publication

Amanda Brindle (1):
  Send email notification on publication

 layerindex/views.py                          | 45 +++++++++++++++++++++++++++-
 templates/layerindex/publishemail.txt        |  9 ++++++
 templates/layerindex/publishemailsubject.txt |  1 +
 3 files changed, 54 insertions(+), 1 deletion(-)
 create mode 100644 templates/layerindex/publishemail.txt
 create mode 100644 templates/layerindex/publishemailsubject.txt

-- 
2.7.4



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 0/1] Send email notification on publication
  2017-10-19 21:27 [PATCH 0/1] " Amanda Brindle
@ 2017-10-20 14:23 ` Leonardo Sandoval
  0 siblings, 0 replies; 4+ messages in thread
From: Leonardo Sandoval @ 2017-10-20 14:23 UTC (permalink / raw)
  To: Amanda Brindle; +Cc: yocto, paul.eggleton

On Thu, 19 Oct 2017 14:27:07 -0700
Amanda Brindle <amanda.r.brindle@intel.com> wrote:

Based on the subject, if this a v2 series?


> Before, if there were multiple maintainers, this sent an individual email to each maintainer. Now, this will send one email to all maintainers. The email will also provide instructions for how the maintainer can make changes to the layer's index entry in the future.
> 
> The following changes since commit ad1aac4ea5d4f2b327f7bd9611aed13f7c31ff7e:
> 
>   Show note if layer branch hasn't been indexed (2017-10-04 13:49:00 +1300)
> 
> are available in the git repository at:
> 
>   git://git.yoctoproject.org/layerindex-web abrindle/email_notification_publication
>   http://git.yoctoproject.org/cgit.cgi/layerindex-web/log/?h=abrindle/email_notification_publication
> 
> Amanda Brindle (1):
>   Send email notification on publication
> 
>  layerindex/views.py                          | 45 +++++++++++++++++++++++++++-
>  templates/layerindex/publishemail.txt        |  9 ++++++
>  templates/layerindex/publishemailsubject.txt |  1 +
>  3 files changed, 54 insertions(+), 1 deletion(-)
>  create mode 100644 templates/layerindex/publishemail.txt
>  create mode 100644 templates/layerindex/publishemailsubject.txt
> 
> -- 
> 2.7.4
> 
> -- 
> _______________________________________________
> yocto mailing list
> yocto@yoctoproject.org
> https://lists.yoctoproject.org/listinfo/yocto


-- 
Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com>


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-10-20 14:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-12 18:11 [PATCH 0/1] Send email notification on publication Amanda Brindle
2017-10-12 18:12 ` [PATCH 1/1] " Amanda Brindle
  -- strict thread matches above, loose matches on Subject: below --
2017-10-19 21:27 [PATCH 0/1] " Amanda Brindle
2017-10-20 14:23 ` Leonardo Sandoval

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.