1
1
mirror of https://github.com/go-gitea/gitea.git synced 2024-11-20 02:24:22 +01:00
gitea/web_src/js/features
zeripath 3c4388f668
Re-fix #12095 again (#12138)
Unfortunately some of the suggested changes to #12095 introduced
bugs which due to caching behaviour of sharedworkers were not caught
on simple tests.

These are as follows:

* Changing from simple for loop to use includes here:

```js
  register(port) {
    if (!this.clients.includes(port)) return;

    this.clients.push(port);

    port.postMessage({
      type: 'status',
      message: `registered to ${this.url}`,
    });
  }
```

The additional `!` prevents any clients from being added and should
read:

```js
    if (this.clients.includes(port)) return;
```

* Dropping the use of jQuery `$(...)` selection and using DOM
`querySelector` here:

```js
async function receiveUpdateCount(event) {
  try {
    const data = JSON.parse(event.data);

    const notificationCount = document.querySelector('.notification_count');
    if (data.Count > 0) {
      notificationCount.classList.remove('hidden');
    } else {
      notificationCount.classList.add('hidden');
    }

    notificationCount.text() = `${data.Count}`;
    await updateNotificationTable();
  } catch (error) {
    console.error(error, event);
  }
}
```

Requires that `notificationCount.text()` be changed to use `textContent`
instead.

Signed-off-by: Andrew Thornton <art27@cantab.net>
2020-07-05 01:04:00 +03:00
..
clipboard.js
codeeditor.js rework eslint config (#11615) 2020-06-09 17:31:15 -04:00
contextpopup.js
dropzone.js
emoji.js Support unicode emojis and remove emojify.js (#11032) 2020-04-28 15:05:39 -03:00
eventsource.sharedworker.js Re-fix #12095 again (#12138) 2020-07-05 01:04:00 +03:00
gitgraph.js
notification.js
serviceworker.js
tablesort.js [UI] Sortable Tables Header By Click (#7980) 2020-06-24 23:23:05 +01:00
tribute.js Move tributejs to npm/webpack (#11497) 2020-05-20 22:00:43 -04:00
userheatmap.js