Improve Discourse links
This commit is contained in:
1 parent
e7006fb69f
commit
81a6b9b98a
6 files changed
+11
-14
No files matched your search
@@ -41,8 +41,6 @@ export default class NotificationsItemComponent extends Component {
|
||||
<template>
|
||||
<a
|
||||
href={{@item.href}}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
title={{this.tooltip}}
|
||||
aria-label={{this.tooltip}}
|
||||
data-status={{@item.status}}
|
||||
|
||||
@@ -45,7 +45,7 @@ function labelForUrl(url) {
|
||||
|
||||
function hrefForIntegration(integration) {
|
||||
if (integration.type === 'discourse' && integration.url) {
|
||||
return `${integration.url}/notifications`;
|
||||
return `${integration.url}`;
|
||||
}
|
||||
return integration.url ?? null;
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ module('Integration | Component | notifications', function (hooks) {
|
||||
id: 'discourse-abc',
|
||||
type: 'discourse',
|
||||
label: 'forum.example.com',
|
||||
href: 'https://forum.example.com/notifications',
|
||||
href: 'https://forum.example.com',
|
||||
status: 'ready',
|
||||
unreadCount: 3,
|
||||
},
|
||||
|
||||
@@ -11,14 +11,14 @@ module('Integration | Component | notifications/group', function (hooks) {
|
||||
{
|
||||
id: 'discourse-abc',
|
||||
label: 'forum.example.com',
|
||||
href: 'https://forum.example.com/notifications',
|
||||
href: 'https://forum.example.com',
|
||||
status: 'ready',
|
||||
unreadCount: 2,
|
||||
},
|
||||
{
|
||||
id: 'discourse-def',
|
||||
label: 'meta.example.com',
|
||||
href: 'https://meta.example.com/notifications',
|
||||
href: 'https://meta.example.com',
|
||||
status: 'ready',
|
||||
unreadCount: 0,
|
||||
},
|
||||
|
||||
@@ -11,7 +11,7 @@ module('Integration | Component | notifications/item', function (hooks) {
|
||||
id: 'discourse-abc',
|
||||
type: 'discourse',
|
||||
label: 'forum.example.com',
|
||||
href: 'https://forum.example.com/notifications',
|
||||
href: 'https://forum.example.com',
|
||||
status: 'ready',
|
||||
unreadCount: 3,
|
||||
});
|
||||
@@ -20,9 +20,8 @@ module('Integration | Component | notifications/item', function (hooks) {
|
||||
|
||||
assert
|
||||
.dom('a')
|
||||
.hasAttribute('href', 'https://forum.example.com/notifications');
|
||||
assert.dom('a').hasAttribute('target', '_blank');
|
||||
assert.dom('a').hasAttribute('rel', 'noopener noreferrer');
|
||||
.hasAttribute('href', 'https://forum.example.com');
|
||||
assert.dom('a').doesNotHaveAttribute('target', '_blank');
|
||||
assert.dom('a').hasAttribute('title', 'forum.example.com');
|
||||
assert.dom('a').hasAttribute('aria-label', 'forum.example.com');
|
||||
assert.dom('[data-test-notifications-count]').hasText('3');
|
||||
@@ -33,7 +32,7 @@ module('Integration | Component | notifications/item', function (hooks) {
|
||||
test('it hides the count when there are no unread notifications', async function (assert) {
|
||||
this.set('item', {
|
||||
label: 'forum.example.com',
|
||||
href: 'https://forum.example.com/notifications',
|
||||
href: 'https://forum.example.com',
|
||||
status: 'ready',
|
||||
unreadCount: 0,
|
||||
});
|
||||
@@ -48,7 +47,7 @@ module('Integration | Component | notifications/item', function (hooks) {
|
||||
test('it shows a loading placeholder before the first fetch', async function (assert) {
|
||||
this.set('item', {
|
||||
label: 'forum.example.com',
|
||||
href: 'https://forum.example.com/notifications',
|
||||
href: 'https://forum.example.com',
|
||||
status: 'loading',
|
||||
unreadCount: 0,
|
||||
});
|
||||
@@ -61,7 +60,7 @@ module('Integration | Component | notifications/item', function (hooks) {
|
||||
test('it explains an unreachable source in the tooltip', async function (assert) {
|
||||
this.set('item', {
|
||||
label: 'forum.example.com',
|
||||
href: 'https://forum.example.com/notifications',
|
||||
href: 'https://forum.example.com',
|
||||
status: 'error',
|
||||
errorType: 'unreachable',
|
||||
error: 'Notifications blocked — enable CORS on the forum or open it',
|
||||
|
||||
@@ -59,7 +59,7 @@ module('Unit | Service | notifications', function (hooks) {
|
||||
|
||||
const [item] = groups[0].items;
|
||||
assert.strictEqual(item.label, 'forum.example.com');
|
||||
assert.strictEqual(item.href, 'https://forum.example.com/notifications');
|
||||
assert.strictEqual(item.href, 'https://forum.example.com');
|
||||
assert.strictEqual(item.status, 'loading');
|
||||
|
||||
service.stopPolling();
|
||||
|
||||
Reference in new issue
Block a user