Merge "Revert "Open change page on click on notification""
diff --git a/polygerrit-ui/app/utils/url-util.ts b/polygerrit-ui/app/utils/url-util.ts
index 1757373..9b1f3b9 100644
--- a/polygerrit-ui/app/utils/url-util.ts
+++ b/polygerrit-ui/app/utils/url-util.ts
@@ -11,9 +11,7 @@
 const DOCS_BASE_PATH = '/Documentation';
 
 export function getBaseUrl(): string {
-  // self because it works on both on web and in service worker, but
-  // window works only on web and not in service worker
-  return self.CANONICAL_PATH || '';
+  return window.CANONICAL_PATH || '';
 }
 
 export function prependOrigin(path: string): string {
diff --git a/polygerrit-ui/app/workers/service-worker-class.ts b/polygerrit-ui/app/workers/service-worker-class.ts
index a604321a..966b6b0 100644
--- a/polygerrit-ui/app/workers/service-worker-class.ts
+++ b/polygerrit-ui/app/workers/service-worker-class.ts
@@ -10,8 +10,6 @@
 import {filterAttentionChangesAfter} from '../utils/service-worker-util';
 import {AccountDetailInfo} from '../api/rest-api';
 import {TRIGGER_NOTIFICATION_UPDATES_MS} from '../services/service-worker-installer';
-import {GerritView} from '../services/router/router-model';
-import {generateUrl} from '../utils/router-util';
 
 export class ServiceWorker {
   constructor(private ctx: ServiceWorkerGlobalScope) {}
@@ -20,19 +18,10 @@
 
   showNotification(change: ParsedChangeInfo, account: AccountDetailInfo) {
     const body = getReason(undefined, account, change);
-    const changeUrl = generateUrl({
-      view: GerritView.CHANGE,
-      changeNum: change._number,
-      project: change.project,
-      usp: 'service-worker-notification',
-    });
-    // We are adding origin because each notification can have different origin
-    // User can have different service workers for different origins/hosts.
-    // TODO(milutin): Check if this works properly with getBaseUrl()
-    const data = {url: `${self.location.origin}${changeUrl}`};
-
+    // TODO(milutin): Implement event.action that
+    // focus on firstWindowClient and open change there.
     // TODO(milutin): Add gerrit host icon
-    this.ctx.registration.showNotification(change.subject, {body, data});
+    this.ctx.registration.showNotification(change.subject, {body});
   }
 
   async getChangesToNotify(account: AccountDetailInfo) {
diff --git a/polygerrit-ui/app/workers/service-worker.ts b/polygerrit-ui/app/workers/service-worker.ts
index ddd8f11..ca1f5dc 100644
--- a/polygerrit-ui/app/workers/service-worker.ts
+++ b/polygerrit-ui/app/workers/service-worker.ts
@@ -32,25 +32,5 @@
   }
 });
 
-// Code based on code sample from
-// https://developer.mozilla.org/en-US/docs/Web/API/Clients/openWindow
-ctx.addEventListener<'notificationclick'>('notificationclick', e => {
-  e.notification.close();
-
-  const openWindow = async () => {
-    const clientsArr = await ctx.clients.matchAll({type: 'window'});
-    try {
-      const url = e.notification.data.url;
-      let client = clientsArr.find(c => c.url === url);
-      if (!client) client = (await ctx.clients.openWindow(url)) ?? undefined;
-      await client?.focus();
-    } catch (e) {
-      console.error(`Cannot open window about notified change - ${e}`);
-    }
-  };
-
-  e.waitUntil(openWindow());
-});
-
 /** Singleton instance being referenced in `onmessage` function above. */
 const serviceWorker = new ServiceWorker(ctx);