aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--db/schema.sql1
-rw-r--r--perllib/Page.pm8
-rwxr-xr-xweb/confirm.cgi2
-rwxr-xr-xweb/contact.cgi8
-rwxr-xr-xweb/questionnaire.cgi4
5 files changed, 12 insertions, 11 deletions
diff --git a/db/schema.sql b/db/schema.sql
index f27d3dce7..53d188244 100644
--- a/db/schema.sql
+++ b/db/schema.sql
@@ -227,6 +227,7 @@ create table comment (
email text not null,
website text,
created timestamp not null default ms_current_timestamp(),
+ confirmed timestamp,
text text not null, -- as entered by comment author
photo bytea,
state text not null check (
diff --git a/perllib/Page.pm b/perllib/Page.pm
index e569bd6d5..fcf11f7f7 100644
--- a/perllib/Page.pm
+++ b/perllib/Page.pm
@@ -853,10 +853,10 @@ sub display_problem_updates($$) {
my ($id, $q) = @_;
my $cobrand = get_cobrand($q);
my $updates = select_all(
- "select id, name, extract(epoch from created) as created, text,
+ "select id, name, extract(epoch from confirmed) as confirmed, text,
mark_fixed, mark_open, (photo is not null) as has_photo, cobrand
from comment where problem_id = ? and state='confirmed'
- order by created", $id);
+ order by confirmed", $id);
my $out = '';
if (@$updates) {
$out .= '<div id="updates">';
@@ -864,9 +864,9 @@ sub display_problem_updates($$) {
foreach my $row (@$updates) {
$out .= "<div><div class=\"problem-update\"><p><a name=\"update_$row->{id}\"></a><em>";
if ($row->{name}) {
- $out .= sprintf(_('Posted by %s at %s'), ent($row->{name}), prettify_epoch($q, $row->{created}));
+ $out .= sprintf(_('Posted by %s at %s'), ent($row->{name}), prettify_epoch($q, $row->{confirmed}));
} else {
- $out .= sprintf(_('Posted anonymously at %s'), prettify_epoch($q, $row->{created}));
+ $out .= sprintf(_('Posted anonymously at %s'), prettify_epoch($q, $row->{confirmed}));
}
$out .= Cobrand::extra_update_meta_text($cobrand, $row);
$out .= ', ' . _('marked as fixed') if ($row->{mark_fixed});
diff --git a/web/confirm.cgi b/web/confirm.cgi
index c9447d982..8e51a4555 100755
--- a/web/confirm.cgi
+++ b/web/confirm.cgi
@@ -73,7 +73,7 @@ sub confirm_update {
dbh()->do("update comment set state='hidden' where id=?", {}, $id);
return $q->p('Sorry, there has been an error confirming your update.');
} else {
- dbh()->do("update comment set state='confirmed' where id=? and state='unconfirmed'", {}, $id);
+ dbh()->do("update comment set state='confirmed', confirmed=ms_current_timestamp() where id=? and state='unconfirmed'", {}, $id);
}
my $creator_fixed = 0;
diff --git a/web/contact.cgi b/web/contact.cgi
index 891bd6abf..bb4ed4913 100755
--- a/web/contact.cgi
+++ b/web/contact.cgi
@@ -179,11 +179,11 @@ sub contact_page {
Port => mySociety::Config::get('BCI_DB_PORT', undef)
);
my $p = dbh()->selectrow_hashref(
- 'select title,detail,name,anonymous,extract(epoch from created) as created
+ 'select title,detail,name,anonymous,extract(epoch from confirmed) as confirmed
from problem where id=?', {}, $id);
if ($update_id) {
my $u = dbh()->selectrow_hashref(
- 'select comment.text, comment.name, problem.title, extract(epoch from comment.created) as created
+ 'select comment.text, comment.name, problem.title, extract(epoch from comment.confirmed) as confirmed
from comment, problem where comment.id=?
and comment.problem_id = problem.id
and comment.problem_id=?', {}, $update_id ,$id);
@@ -193,7 +193,7 @@ sub contact_page {
$intro .= $q->p(_('You are reporting the following update for being abusive, containing personal information, or similar:'));
$item_title = ent($u->{title});
$item_meta = $q->em( 'Update below added ', ($u->{name} eq '') ? 'anonymously' : "by " . ent($u->{name}),
- ' at ' . Page::prettify_epoch($q, $u->{created}));
+ ' at ' . Page::prettify_epoch($q, $u->{confirmed}));
$item_body = ent($u->{text});
$hidden_vals .= '<input type="hidden" name="update_id" value="' . $update_id . '">';
}
@@ -206,7 +206,7 @@ sub contact_page {
$item_meta = $q->em(
'Reported ',
($p->{anonymous}) ? 'anonymously' : "by " . ent($p->{name}),
- ' at ' . Page::prettify_epoch($q, $p->{created}));
+ ' at ' . Page::prettify_epoch($q, $p->{confirmed}));
$item_body = ent($p->{detail});
}
}
diff --git a/web/questionnaire.cgi b/web/questionnaire.cgi
index 60a4be188..f7b7df0e1 100755
--- a/web/questionnaire.cgi
+++ b/web/questionnaire.cgi
@@ -142,8 +142,8 @@ sub submit_questionnaire {
my $name = $problem->{anonymous} ? undef : $problem->{name};
my $update = $input{update} ? $input{update} : _('Questionnaire filled in by problem reporter');
Utils::workaround_pg_bytea("insert into comment
- (problem_id, name, email, website, text, state, mark_fixed, mark_open, photo, lang, cobrand, cobrand_data)
- values (?, ?, ?, '', ?, 'confirmed', ?, ?, ?, ?, ?, ?)", 7,
+ (problem_id, name, email, website, text, state, mark_fixed, mark_open, photo, lang, cobrand, cobrand_data, confirmed)
+ values (?, ?, ?, '', ?, 'confirmed', ?, ?, ?, ?, ?, ?, ms_current_timestamp())", 7,
$problem->{id}, $name, $problem->{email}, $update,
$new_state eq 'fixed' ? 't' : 'f', $new_state eq 'confirmed' ? 't' : 'f',
$image, $mySociety::Locale::lang, $cobrand, $cobrand_data