JILS-45: Add support for moved issues



Issue Information

Issue Type: New Feature
 
Priority: Major
Status: Closed

Reported By:
Ben Tasker
Assigned To:
Ben Tasker
Project: Jira Issue Listing Script (JILS)
Resolution: Done (2016-04-29 14:45:24)
Affects Version: 0.1, 0.01b,
Target version: 0.1, 0.01b,

Created: 2016-04-29 12:38:34
Time Spent Working
Estimated:
 
120 minutes
Remaining:
  
48 minutes
Logged:
  
72 minutes


Description
Currently if an issue is moved from a non-public project into a public one, any self-references it contains will result in a 404. Similarly any references to it from other public issues will also 404 (though "Links" will automatically update).

To work around this, I want to introduce support for JIRAs moved issues functionality - that is, generate a page for that issue (regardless of whether it's parent project is public) which redirects the user to the new issue.

The original issue key as well as the ID of the new issue can be obtained from the table moved_issue_key
mysql> describe moved_issue_key;
+---------------+---------------+------+-----+---------+-------+
| Field         | Type          | Null | Key | Default | Extra |
+---------------+---------------+------+-----+---------+-------+
| ID            | decimal(18,0) | NO   | PRI | NULL    |       |
| OLD_ISSUE_KEY | varchar(255)  | YES  | UNI | NULL    |       |
| ISSUE_ID      | decimal(18,0) | YES  |     | NULL    |       |
+---------------+---------------+------+-----+---------+-------+


We're going to want to limit result sets to only retrieve matches where the new project is accessible by the user.

A page should be generated (under browse) which details that the page has been moved and attempts a JS redirect to the new page (providing a link for those who don't have JS enabled).

Also need to look at whether there's a good way to indicate to Google that the page has moved (can't send a 301/302 as it'll break sites created with a mirror script).


Toggle State Changes

Activity


I've marked this affecting both versions 0.1 and 0.01b - I want this functionality active sooner rather than later, and I suspect 0.1 is a little way off release, so want to backport the changes into 0.01b
btasker changed status from 'Open' to 'In Progress'
Need to tab project filters on the end, but the SQL to generate a list of all moved issues (with information about their destination) is
SELECT a.OLD_ISSUE_KEY, b.pname, b.pkey, ji.issuenum FROM `moved_issue_key` AS a 
LEFT JOIN jiraissue AS ji ON a.ISSUE_ID = ji.ID 
LEFT JOIN project AS b on ji.PROJECT = b.ID 
I've started implementing the changes on 0.01b first as I think it'll be easier to move the changes forward to 0.1 than backwards (given the changes in file structure etc).

Commit 8072935 introduces an index page for all moved issues (required for the wget mirror to work)

Repo: Jira-Issue-Listing
Commit: 80729352308cec2e379c9fb2c189831ce67d3f5e
Author: Ben Tasker <github@<Domain Hidden>>

Date: Fri Apr 29 13:09:06 2016 +0100
Commit Message: Created movedissues page for JILS-45



Added (+)
-------
movedissues.php


Modified (-)(+)
-------
index.php
utils.class.php




Webhook User-Agent

GitHub-Hookshot/cd33156


View Commit

Commit f25ccf4 adds a link to the movedissues index to the home page. It's hidden using CSS, but as wget doesn't take "display" into account, the linked page (and by extension, the relevant movedissue pages) are included in any mirror that's run.

Will look at merging the changes into v0.1 shortly
btasker changed status from 'In Progress' to 'Open'
btasker changed timespent from '0 minutes' to '49 minutes'

Repo: Jira-Issue-Listing
Commit: 8386050f6e8b9fc9a4be50465a2aea0dbc368eff
Author: Ben Tasker <github@<Domain Hidden>>

Date: Fri Apr 29 13:14:33 2016 +0100
Commit Message: Implemented check for moved issue. See JILS-45



Modified (-)(+)
-------
issue_page.php




Webhook User-Agent

GitHub-Hookshot/cd33156


View Commit


Repo: Jira-Issue-Listing
Commit: f25ccf430b90904507d166ffb4e5e6697f32b6da
Author: Ben Tasker <github@<Domain Hidden>>

Date: Fri Apr 29 13:33:05 2016 +0100
Commit Message: Created page for movedissues. JILS-45



Added (+)
-------
movedissue.php


Modified (-)(+)
-------
issue_page.php
projects.php
static/core.css




Webhook User-Agent

GitHub-Hookshot/cd33156


View Commit

Thinking about it, wget's URL rewriting isn't going to update the JS redirect, so need to make sure that path is relative.
btasker changed status from 'Open' to 'In Progress'
Have updated qs2sef to take an optional argument preventing pre-pending of a path. Tested for impact on all other URLs and looks good.

Moving onto merging the changes into V0.1
btasker changed status from 'In Progress' to 'Open'
btasker changed timespent from '49 minutes' to '62 minutes'

Repo: Jira-Issue-Listing
Commit: b6b5bf1e85e2ad68913f29910bc4bb9934986747
Author: Ben Tasker <github@<Domain Hidden>>

Date: Fri Apr 29 13:55:52 2016 +0100
Commit Message: Adjusted redirect URL to be relative. See JILS-45



Modified (-)(+)
-------
movedissue.php
utils.class.php




Webhook User-Agent

GitHub-Hookshot/cd33156


View Commit

Commit be5b8e4 implements the same functionality in 0.1. Now need to look at adding support to the JSON templates

Repo: Jira-Issue-Listing
Commit: be5b8e43e18610fc9f8efa168d96d676c8a86296
Author: Ben Tasker <github@<Domain Hidden>>

Date: Fri Apr 29 14:15:13 2016 +0100
Commit Message: Added support for moved issues. See JILS-45



Added (+)
-------
templates/html/movedissue.php
templates/html/movedissues.php


Modified (-)(+)
-------
index.php
queries/issue_page.php
static/core.css
templates/html/projects.php
utils.class.php




Webhook User-Agent

GitHub-Hookshot/cd33156


View Commit


Repo: Jira-Issue-Listing
Commit: efc1df03c771e350242e98a655cb9faa85ea72b6
Author: Ben Tasker <github@<Domain Hidden>>

Date: Fri Apr 29 14:26:37 2016 +0100
Commit Message: Added moved issue support to JSON. JILS-45



Added (+)
-------
templates/json/movedissue.php


Modified (-)(+)
-------
index.php




Webhook User-Agent

GitHub-Hookshot/cd33156


View Commit

Support has been added to the JSON format. If an issue has been moved it'll be returned with a class of "MovedIssue":
{"Key":"VEHPI-37","Class":"MovedIssue","Description":"Issue VEHPI-37 has moved to RPB-4","LastModified":null,"NewLocation":{"href":"\/browse\/RPB-4.json","type":"application\/json","alternate":[{"type":"text\/html","href":"\/browse\/RPB-4.html"}]},"self":{"href":"\/browse\/VEHPI-37.json","type":"application\/json","alternate":[{"type":"text\/html","href":"\/browse\/VEHPI-37.html"}]}}
Going to look at generating an ETag and using a fixed last modified date so that revalidation can be used (if, for some weird reason, the old issue key ever gets re-used, the date will update anyway as we'll find the issue when searching jiraissue).

Repo: Jira-Issue-Listing
Commit: c3ed8cbac20050ae1ea04ad37a62b752670652aa
Author: Ben Tasker <github@<Domain Hidden>>

Date: Fri Apr 29 14:36:15 2016 +0100
Commit Message: Implemented revalidation for moved-issues. See JILS-45



Modified (-)(+)
-------
queries/issue_page.php
templates/json/movedissue.php




Webhook User-Agent

GitHub-Hookshot/cd33156


View Commit

ETag/Last-modified has been implemented in 0.1.

Will backport that change into 0.01b, though to avoid merge headaches later, I've created a new branch 0.01b-backports for any future backports to be applied to
btasker changed timespent from '62 minutes' to '70 minutes'

Repo: Jira-Issue-Listing
Commit: e0296413754bc3f99863c631810345e0ef084b9b
Author: Ben Tasker <github@<Domain Hidden>>

Date: Fri Apr 29 14:42:03 2016 +0100
Commit Message: Backported movedissue Etag/Last-mod (c3ed8cb) to 0.01b. See JILS-45



Modified (-)(+)
-------
issue_page.php




Webhook User-Agent

GitHub-Hookshot/cd33156


View Commit

It was a relatively simple backport, all tested and working.

Marking this issue as complete as there's not really anything extra to do for it. Although JILS-44 is creating plaintext representations of Issues, it relies on there being a rel="alternate" in the HTML page. I don't see a vast amount of value in adding that to the moved issue page just to display a text file which can't do any more than say "This issue has moved to x"
btasker changed timespent from '70 minutes' to '72 minutes'
btasker changed status from 'Open' to 'Resolved'
btasker added 'Done' to resolution
btasker changed status from 'Resolved' to 'Closed'

Work log


Ben Tasker
Permalink
2016-04-29 13:35:09

Time Spent: 49 minutes
Log Entry: Implementing in 0.01b

Ben Tasker
Permalink
2016-04-29 13:57:19

Time Spent: 13 minutes
Log Entry: Adjusting redirect path to be relative & testing

Ben Tasker
Permalink
2016-04-29 14:38:16

Time Spent: 8 minutes
Log Entry: Implementing revalidation support for moved issues

Ben Tasker
Permalink
2016-04-29 14:45:15

Time Spent: 2 minutes
Log Entry: Backporting Etag/LM to 0.01b and testing