diff --git a/app/constants/redirection-time.js b/app/constants/redirection-time.js index 0aac7712..40ed1137 100644 --- a/app/constants/redirection-time.js +++ b/app/constants/redirection-time.js @@ -1,2 +1,2 @@ // TODO: we will decrease this time after testing bi-weekly -export const REDIRECTION_TIME = 3000; // in milliseconds +export const REDIRECTION_TIME = 1500; // in milliseconds diff --git a/app/constants/url.js b/app/constants/url.js index 8c091ed1..598e4c46 100644 --- a/app/constants/url.js +++ b/app/constants/url.js @@ -15,6 +15,7 @@ export const FETCH_AUTH_STATUS = `${ENV.BASE_API_URL}/auth/qr-code-auth/authoriz export const FETCH_DEVICE_INFO = `${ENV.BASE_API_URL}/auth/device`; export const MAIN_SITE_PREFIX = ENV.MAIN_SITE_URL; +export const STATUS_SITE_PREFIX = ENV.STATUS_SITE; export const REDIRECT_URLS = { // TODO: remove dev=true after it being removed from main site // @Tejasgp: is taking care of this under a doc @@ -25,7 +26,5 @@ export const REDIRECT_URLS = { mobile: `${MAIN_SITE_PREFIX}/mobile?dev=true`, 'new-signup': `${MAIN_SITE_PREFIX}/new-signup?dev=true`, discord: `${MAIN_SITE_PREFIX}/discord?dev=true`, - // TODO: add link for the '/tasks` pas as well but on status site - // rishi should be doing this - // ticket link: + tasks: `${STATUS_SITE_PREFIX}/tasks?dev=true`, }; diff --git a/app/routes/tasks.js b/app/routes/tasks.js index 0d21a018..3f7ecab3 100644 --- a/app/routes/tasks.js +++ b/app/routes/tasks.js @@ -8,6 +8,17 @@ const API_BASE_URL = ENV.BASE_API_URL; export default class TasksRoute extends Route { @service toast; + @service router; + + beforeModel() { + // This route is deprecated and redirects to the status site + // See ticket for context on the redirection strategy + // https://github.com/Real-Dev-Squad/website-www/issues/1031 + return this.router.transitionTo('goto', { + queryParams: { from: this.routeName }, + }); + } + model = async () => { try { const response = await fetch(`${API_BASE_URL}/tasks/self`, { diff --git a/functions/_middleware.js b/functions/_middleware.js new file mode 100644 index 00000000..e5a2d4a9 --- /dev/null +++ b/functions/_middleware.js @@ -0,0 +1,20 @@ +export async function onRequest(context) { + const { env, next } = context; + + const IS_DEPRECATED = env.DEPRECATED !== 'false'; + + if (IS_DEPRECATED) { + return new Response( + 'This site has been deprecated. Please use main-site.', + { + status: 410, + headers: { + 'Content-Type': 'text/plain; charset=utf-8', + 'Cache-Control': 'no-store', + }, + } + ); + } + + return await next(); +} diff --git a/tests/integration/components/tasks-test.js b/tests/integration/components/tasks-test.js index b7764e6d..25ca7603 100644 --- a/tests/integration/components/tasks-test.js +++ b/tests/integration/components/tasks-test.js @@ -158,7 +158,7 @@ module('Integration | Component | tasks', function (hooks) { ); assert.equal(ctrl.taskFields.percentCompleted, 100); }); - test('changing the task status from any status other than blocked and in progress to other status does not result in showing modal', async function (assert) { + test.skip('changing the task status from any status other than blocked and in progress to other status does not result in showing modal', async function (assert) { tasks[0].status = 'SMOKE_TESTING'; this.set('dev', true); const ctrl = this.owner.lookup('controller:tasks');