From b5b31616da347cdcb7e055218f5d0c654475816b Mon Sep 17 00:00:00 2001
From: "J.-S. Caux" <J.S.Caux@uva.nl>
Date: Fri, 25 Mar 2016 08:43:16 +0100
Subject: [PATCH] More privacy in contributor info: email not public

---
 comments/models.py                                 |  4 ++--
 scipost/models.py                                  | 14 +++++++++++++-
 scipost/static/scipost/SciPost.css                 |  1 -
 scipost/templates/scipost/contributor_info.html    |  2 +-
 scipost/templates/scipost/personal_page.html       |  2 +-
 .../scipost/vet_registration_requests.html         |  2 +-
 6 files changed, 18 insertions(+), 7 deletions(-)

diff --git a/comments/models.py b/comments/models.py
index c2404137f..cf5c7f311 100644
--- a/comments/models.py
+++ b/comments/models.py
@@ -114,8 +114,8 @@ class Comment(models.Model):
         if self.in_reply_to:
             output += (' (in reply to <a href="#comment_id' + str(self.in_reply_to_id) + '" style="font-size: 80%">' + 
                        str(self.in_reply_to.author.user.first_name) + ' ' + 
-                       str(self.in_reply_to.author.user.last_name) + '</a> on ' + 
-                       self.in_reply_to.date_submitted.strftime("%Y-%m-%d"))
+                       str(self.in_reply_to.author.user.last_name) + ' on ' + 
+                       self.in_reply_to.date_submitted.strftime("%Y-%m-%d") + '</a>')
         output += '</h3></div>'
         return output
 
diff --git a/scipost/models.py b/scipost/models.py
index d94f99436..a688e6070 100644
--- a/scipost/models.py
+++ b/scipost/models.py
@@ -68,7 +68,7 @@ class Contributor(models.Model):
     def __str__ (self):
         return self.user.last_name + ', ' + self.user.first_name
 
-    def as_table (self):
+    def private_info_as_table (self):
         output = '<table>'
         output += '<tr><td>Title: </td><td>&nbsp;</td><td>' + title_dict[self.title] + '</td></tr>'
         output += '<tr><td>First name: </td><td>&nbsp;</td><td>' + self.user.first_name + '</td></tr>'
@@ -82,6 +82,18 @@ class Contributor(models.Model):
         output += '</table>'
         return output
 
+    def public_info_as_table (self):
+        output = '<table>'
+        output += '<tr><td>Title: </td><td>&nbsp;</td><td>' + title_dict[self.title] + '</td></tr>'
+        output += '<tr><td>First name: </td><td>&nbsp;</td><td>' + self.user.first_name + '</td></tr>'
+        output += '<tr><td>Last name: </td><td>&nbsp;</td><td>' + self.user.last_name + '</td></tr>'
+        output += '<tr><td>ORCID id: </td><td>&nbsp;</td><td>' + self.orcid_id + '</td></tr>'
+        output += '<tr><td>Country of employment: </td><td>&nbsp;</td><td>' + str(self.country_of_employment.name) + '</td></tr>'
+        output += '<tr><td>Affiliation: </td><td>&nbsp;</td><td>' + self.affiliation + '</td></tr>'
+        output += '<tr><td>Personal web page: </td><td>&nbsp;</td><td>' + self.personalwebpage + '</td></tr>'
+        output += '</table>'
+        return output
+
 AUTHORSHIP_CLAIM_STATUS = (
     (1, 'accepted'),
     (0, 'not yet vetted (pending)'),
diff --git a/scipost/static/scipost/SciPost.css b/scipost/static/scipost/SciPost.css
index 0db3e4a79..624e23a2e 100644
--- a/scipost/static/scipost/SciPost.css
+++ b/scipost/static/scipost/SciPost.css
@@ -248,7 +248,6 @@ hr.hr12 {
   padding: 3px 5px;
   background-color: #f4f4f4;
   border-radius: 4px;
-  border: 1px solid orange;
 }
 
 body {
diff --git a/scipost/templates/scipost/contributor_info.html b/scipost/templates/scipost/contributor_info.html
index f0dcdae39..51b427a46 100644
--- a/scipost/templates/scipost/contributor_info.html
+++ b/scipost/templates/scipost/contributor_info.html
@@ -25,7 +25,7 @@
   </div>
   <div class="row">
     <div class="col-6">
-      {{ contributor.as_table|safe }}
+      {{ contributor.public_info_as_table|safe }}
     </div>
   </div>
 </section>
diff --git a/scipost/templates/scipost/personal_page.html b/scipost/templates/scipost/personal_page.html
index cfdc5c6b8..0336551ff 100644
--- a/scipost/templates/scipost/personal_page.html
+++ b/scipost/templates/scipost/personal_page.html
@@ -31,7 +31,7 @@
   <div class="row">
     <div class="col-6">
       <h3>Your personal details</h3>
-      {{ contributor.as_table|safe }}
+      {{ contributor.private_info_as_table|safe }}
     </div>
     <div class="col-6">
       <h3>Update your personal data or password</h3>
diff --git a/scipost/templates/scipost/vet_registration_requests.html b/scipost/templates/scipost/vet_registration_requests.html
index 0e93596b5..fed3f55fc 100644
--- a/scipost/templates/scipost/vet_registration_requests.html
+++ b/scipost/templates/scipost/vet_registration_requests.html
@@ -60,7 +60,7 @@ $( document ).ready(function() {
   <hr>
   <div class="flex-container">
     <div class="flex-whitebox">
-      {{ contributor_to_vet.as_table|safe }}
+      {{ contributor_to_vet.private_info_as_table|safe }}
     </div>
     <div class="flex-whitebox">
       <form action="{% url 'scipost:vet_registration_request_ack' contributor_id=contributor_to_vet.id %}" method="post">
-- 
GitLab