Skip to content
This repository has been archived by the owner on Jan 17, 2023. It is now read-only.

Commit

Permalink
Fix #3493, send unauth'd /shots to /#tour
Browse files Browse the repository at this point in the history
This lets a user who accesses Screenshots from the Library, but has never authenticated or used Screenshots, get redirected to an onboarding tour.

Also sends non-57 users to the normal onboarding without UITour
  • Loading branch information
ianb committed Sep 14, 2017
1 parent 74ac3f3 commit d964a60
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
14 changes: 9 additions & 5 deletions server/src/pages/homepage/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,15 @@ document.addEventListener("addon-present", () => {
if (location.hash === "#hello") {
document.dispatchEvent(new CustomEvent("request-onboarding"));
} else if (location.hash === "#tour") {
try {
Mozilla.UITour.showHighlight("screenshots");
} catch (e) {
console.warn("Attempted to start #tour on non-Firefox version or unsupported version");
throw e;
if (typeof Mozilla === "undefined" || (Mozilla && Mozilla.UITour === undefined)) {
document.dispatchEvent(new CustomEvent("request-onboarding"));
} else {
try {
Mozilla.UITour.showHighlight("screenshots");
} catch (e) {
console.warn("Attempted to start #tour on non-Firefox version or unsupported version");
throw e;
}
}
}
});
Expand Down
2 changes: 1 addition & 1 deletion server/src/pages/shotindex/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ exports.launch = function(m) {
}
let authTimeout = setTimeout(() => {
// eslint-disable-next-line no-global-assign
location = location.origin;
location = location.origin + "/#tour";
}, FIVE_SECONDS);
window.wantsauth.addAuthDataListener((data) => {
if (location.search.indexOf("reloaded") > -1) {
Expand Down

0 comments on commit d964a60

Please sign in to comment.