aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.cypress/cypress/integration/duplicates.js27
-rw-r--r--web/js/duplicates.js9
2 files changed, 33 insertions, 3 deletions
diff --git a/.cypress/cypress/integration/duplicates.js b/.cypress/cypress/integration/duplicates.js
index 988a6a602..406b3fb67 100644
--- a/.cypress/cypress/integration/duplicates.js
+++ b/.cypress/cypress/integration/duplicates.js
@@ -50,4 +50,31 @@ describe('Duplicate tests', function() {
cy.get('#js-duplicate-reports').should('not.exist');
});
+ it('lets an inspector see duplicate reports coming from /reports', function() {
+ cy.request({
+ method: 'POST',
+ url: 'http://borsetshire.localhost:3001/auth?r=/reports',
+ form: true,
+ body: { username: 'admin@example.org', password_sign_in: 'password' }
+ });
+ cy.visit('http://borsetshire.localhost:3001/reports');
+ cy.get('[href$="/report/1"]:last').click();
+ cy.get('#report_inspect_form #state').select('Duplicate');
+ cy.get('#js-duplicate-reports li h3 a').should('have.attr', 'href', '/report/1');
+ });
+
+ it('lets an inspector see duplicate reports coming from /around', function() {
+ cy.request({
+ method: 'POST',
+ url: 'http://borsetshire.localhost:3001/auth?r=/reports',
+ form: true,
+ body: { username: 'admin@example.org', password_sign_in: 'password' }
+ });
+ cy.visit('http://borsetshire.localhost:3001/report/1');
+ cy.contains('Back to all').click();
+ cy.get('[href$="/report/1"]:last').click();
+ cy.get('#report_inspect_form #state').select('Duplicate');
+ cy.get('#js-duplicate-reports li h3 a').should('have.attr', 'href', '/report/1');
+ });
+
});
diff --git a/web/js/duplicates.js b/web/js/duplicates.js
index a8aceb9e3..ede22dc18 100644
--- a/web/js/duplicates.js
+++ b/web/js/duplicates.js
@@ -13,12 +13,14 @@
// but undefined on new report page.
var report_id = $("#report_inspect_form .js-report-id").text() || undefined;
- function refresh_duplicate_list(evt, params) {
+ function refresh_duplicate_list(evt, params, category) {
if (params && params.skip_duplicates) {
return;
}
- var category = $('select[name="category"]').val();
+ if (!category) {
+ category = $('select[name="category"]').val();
+ }
if (category === '-- Pick a category --') {
return;
}
@@ -195,7 +197,8 @@
if (!!duplicate_of) {
return;
}
- refresh_duplicate_list();
+ var category = $("#report_inspect_form [name=category]").val();
+ refresh_duplicate_list(undefined, {}, category);
}
function take_effect() {