Annotation "feedback" Javascript breaks on clean-urls and sites in subdirectories

Bug #1431668 reported by Aaron Wells on 2015-03-13
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mahara
High
Aaron Wells

Bug Description

In artefact/annotation/js/annotation.js, in the function "connectAnnotationFeedbackLinks()", there's a check for "window.location.pathname == '/view/view.php'", meant to make sure that the link only gets activated via Javascript when you're viewing a page.

However, this breaks in two scenarios:

1. If the Mahara site is in a subdirectory. For instance, my own test site sits at the URL http://vegas.wgtn.cat-it.co.nz/mahara/, so my pathname is '/mahara/view/view.php'

2. Clean URLs. If a site has Clean URLs turned on, then the URL to a page will be something like "https://mahara.org/user/aaronw/files-for-sharing", in which case the pathname is '/user/aaronw/files-for-sharing'.

So relying on the suffix of the URL to determine if we're on the right page to run that JS, is not going to work.

What we should probably do instead, is that when the block is being rendered on a page where that link should be Javascriptified, then we should add some inline JS that invokes the connectAnnotationFeedbackLinks() method.

Aaron Wells (u-aaronw) on 2015-03-13
Changed in mahara:
status: New → Confirmed
importance: Undecided → High
assignee: nobody → Ghada El-Zoghbi (ghada-z)
milestone: none → 15.04.0
tags: added: annotations cleanurls smartevidence
Aaron Wells (u-aaronw) on 2015-03-13
Changed in mahara:
assignee: Ghada El-Zoghbi (ghada-z) → Aaron Wells (u-aaronw)
tags: added: regression
Aaron Wells (u-aaronw) on 2015-03-13
Changed in mahara:
status: Confirmed → In Progress

Reviewed: https://reviews.mahara.org/4401
Committed: http://gitorious.org/mahara/mahara/commit/797df58ed1cde960194c225be7649c3e2f110442
Submitter: Robert Lyon (<email address hidden>)
Branch: master

commit 797df58ed1cde960194c225be7649c3e2f110442
Author: Aaron Wells <email address hidden>
Date: Fri Mar 13 16:57:35 2015 +1300

Annotation feedback JS shouldn't rely on window's URL path.

Bug 1431668: This logic doesn't work for sites that are using
cleanURLs, and sites in subdirectories. And anyway, the
annotation.js file only gets loaded on pages where the block
is in "view" mode, so the logic isn't even needed.

Change-Id: I3c2a6505bd95331ab376cde6d5784e3c7e8cd6e2

Robert Lyon (robertl-9) on 2015-03-18
Changed in mahara:
status: In Progress → Fix Committed
Robert Lyon (robertl-9) on 2015-04-17
Changed in mahara:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers