public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Alex Legler" <a3li@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/glsamaker:master commit in: app/models/, app/views/glsa/, app/controllers/
Date: Sat, 26 Feb 2011 10:55:18 +0000 (UTC)	[thread overview]
Message-ID: <62941528b5651c7020117804b266af1cf6c25100.a3li@gentoo> (raw)

commit:     62941528b5651c7020117804b266af1cf6c25100
Author:     Alex Legler <alex <AT> a3li <DOT> li>
AuthorDate: Sat Feb 26 10:54:30 2011 +0000
Commit:     Alex Legler <a3li <AT> gentoo <DOT> org>
CommitDate: Sat Feb 26 10:54:30 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/glsamaker.git;a=commit;h=62941528

Allow to import references at creation of the draft

---
 app/controllers/glsa_controller.rb  |    2 +-
 app/models/glsa.rb                  |   11 ++++++++++-
 app/views/glsa/new-request.html.erb |    8 ++++++++
 3 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/app/controllers/glsa_controller.rb b/app/controllers/glsa_controller.rb
index dcddebc..f5d3e11 100644
--- a/app/controllers/glsa_controller.rb
+++ b/app/controllers/glsa_controller.rb
@@ -52,7 +52,7 @@ class GlsaController < ApplicationController
   def create
     if params[:what] == "request"
       begin
-        glsa = Glsa.new_request(params[:title], params[:bugs], params[:comment], params[:access], current_user)
+        glsa = Glsa.new_request(params[:title], params[:bugs], params[:comment], params[:access], (params[:import_references].to_i == 1), current_user)
         
         Glsamaker::Mail.request_notification(glsa, current_user)
         

diff --git a/app/models/glsa.rb b/app/models/glsa.rb
index 814a1e3..764ef72 100644
--- a/app/models/glsa.rb
+++ b/app/models/glsa.rb
@@ -136,7 +136,7 @@ class Glsa < ActiveRecord::Base
   end
 
   # Files a new GLSA request
-  def self.new_request(title, bugs, comment, access, user)
+  def self.new_request(title, bugs, comment, access, import_references, user)
     glsa = Glsa.new
     glsa.requester = user
     glsa.glsa_id = Digest::MD5.hexdigest(title + Time.now.to_s)[0...9]
@@ -184,6 +184,15 @@ class Glsa < ActiveRecord::Base
       end
     end
 
+    if import_references
+      logger.debug { "importing references" }
+      refs = []
+      glsa.related_cves.each do |cve|
+        refs << {:title => cve.cve_id, :url => cve.url}
+      end
+      glsa.add_references refs
+    end
+
     glsa
   end
 

diff --git a/app/views/glsa/new-request.html.erb b/app/views/glsa/new-request.html.erb
index 4f1062f..bd6df24 100644
--- a/app/views/glsa/new-request.html.erb
+++ b/app/views/glsa/new-request.html.erb
@@ -31,6 +31,14 @@
   <p><textarea name="comment" id="comment" class="nice" rows="4"><%= h params[:comment] %></textarea></p>
 </div>
 <br />
+<div class="box w40em">
+  <h2 style="margin-top: 0;"><img src="/images/icons/reference.png" alt="reference" /> References</h2>
+  <p>
+    <input type="checkbox" name="import_references" id="import_references" value="1" checked="checked" />
+    <label for="import_references">Import all references from linked bugs</label>
+  </p>
+</div>
+<br />
 <%- if current_user.access >= 1 -%>
 <div class="box w40em">
   <h2 style="margin-top: 0;"><img src="/images/icons/permission.png" alt="permission" /> Permissions</h2>



                 reply	other threads:[~2011-02-26 10:55 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=62941528b5651c7020117804b266af1cf6c25100.a3li@gentoo \
    --to=a3li@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox