Commit 71bf843a authored by Robert Lyon's avatar Robert Lyon Committed by Gerrit Code Review

Merge "Make private comments update m.viewtime (Bug 1499100)"

parents d1bfcdad e9127873
......@@ -245,14 +245,13 @@ class ArtefactTypeComment extends ArtefactType {
update_record('artefact_comment_comment', $data, 'artefact');
}
if (!$this->get('private')) {
if ($this->get('onview')) {
set_field('view', 'mtime', db_format_timestamp(time()), 'id', $this->get('onview'));
}
else if ($this->get('onartefact')) {
execute_sql("UPDATE {view} SET mtime = ? WHERE id IN (SELECT va.view FROM {view_artefact} va WHERE va.artefact = ?)", array(db_format_timestamp(time()), $this->get('onartefact')));
}
if ($this->get('onview')) {
set_field('view', 'mtime', db_format_timestamp(time()), 'id', $this->get('onview'));
}
else if ($this->get('onartefact')) {
execute_sql("UPDATE {view} SET mtime = ? WHERE id IN (SELECT va.view FROM {view_artefact} va WHERE va.artefact = ?)", array(db_format_timestamp(time()), $this->get('onartefact')));
}
db_commit();
$this->dirty = false;
}
......
......@@ -8,6 +8,7 @@ Background:
Given the following "pages" exist:
| title | description | ownertype | ownername |
| page1 | page1 | user | pageowner |
| page2 | page2 | user | pageowner |
Scenario: Public comment by page owner, public reply by third party
Given I log in as "pageowner" with password "password"
......@@ -22,3 +23,33 @@ Scenario: Public comment by page owner, public reply by third party
And I delete the "Comment 2" row
Then I should see "Comment 1"
And I should not see "Comment 2"
Scenario: Comments update the page's mtime
Given I log in as "pageowner" with password "password"
# Set New Views to only show me the most recently updated page
And I follow "Edit dashboard"
And I configure the block "Latest changes I can view"
And I set the field "Maximum number of results to show" to "1"
And I press "Save"
# Public comment updates page last updated
And I go to portfolio page "page1"
And I follow "Add comment"
And I fill in "Public comment" in WYSIWYG editor "add_feedback_form_message_ifr"
And I wait "1" seconds
And I press "Comment"
And I follow "Dashboard"
Then I should see "page1" in the ".bt-newviews" element
And I should not see "page2" in the ".bt-newviews" element
# Private comment updates page last updated
And I go to portfolio page "page2"
And I follow "Add comment"
And I fill in "Private comment" in WYSIWYG editor "add_feedback_form_message_ifr"
And I uncheck "Make public"
And I wait "1" seconds
And I press "Comment"
And I follow "Dashboard"
Then I should see "page2" in the ".bt-newviews" element
And I should not see "page1" in the ".bt-newviews" element
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment