fix prettier linting (#7809)

This commit is contained in:
Joffrey JAFFEUX 2019-06-26 15:26:02 +02:00 committed by GitHub
parent dfde59f631
commit 56b76f31dc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 76 additions and 51 deletions

View File

@ -13,8 +13,9 @@ import { setTransientHeader } from "discourse/lib/ajax";
import { userPath } from "discourse/lib/url";
import { iconNode } from "discourse-common/lib/icon-library";
export const DefaultNotificationItem =
createWidget("default-notification-item", {
export const DefaultNotificationItem = createWidget(
"default-notification-item",
{
tagName: "li",
buildClasses(attrs) {
@ -82,7 +83,10 @@ export const DefaultNotificationItem =
const username = formatUsername(data.display_username);
const description = this.description(data);
return I18n.t(`notifications.${notificationName}`, { description, username });
return I18n.t(`notifications.${notificationName}`, {
description,
username
});
},
icon(notificationName) {
@ -152,4 +156,5 @@ export const DefaultNotificationItem =
}
});
}
});
}
);

View File

@ -1,11 +1,18 @@
import { createWidgetFrom } from "discourse/widgets/widget";
import { DefaultNotificationItem } from "discourse/widgets/default-notification-item";
createWidgetFrom(DefaultNotificationItem, "group-message-summary-notification-item", {
text(notificationName, data) {
const count = data.inbox_count;
const group_name = data.group_name;
createWidgetFrom(
DefaultNotificationItem,
"group-message-summary-notification-item",
{
text(notificationName, data) {
const count = data.inbox_count;
const group_name = data.group_name;
return I18n.t("notifications.group_message_summary", { count, group_name });
return I18n.t("notifications.group_message_summary", {
count,
group_name
});
}
}
});
);

View File

@ -2,8 +2,12 @@ import { createWidgetFrom } from "discourse/widgets/widget";
import { DefaultNotificationItem } from "discourse/widgets/default-notification-item";
import { userPath } from "discourse/lib/url";
createWidgetFrom(DefaultNotificationItem, "invitee-accepted-notification-item", {
url(data) {
return userPath(data.display_username);
},
});
createWidgetFrom(
DefaultNotificationItem,
"invitee-accepted-notification-item",
{
url(data) {
return userPath(data.display_username);
}
}
);

View File

@ -3,23 +3,29 @@ import { DefaultNotificationItem } from "discourse/widgets/default-notification-
import { escapeExpression } from "discourse/lib/utilities";
import { userPath } from "discourse/lib/url";
createWidgetFrom(DefaultNotificationItem, "liked-consolidated-notification-item", {
url(data) {
return userPath(
`${this.attrs.username ||
this.currentUser
.username}/notifications/likes-received?acting_username=${
data.display_username
}`
);
},
createWidgetFrom(
DefaultNotificationItem,
"liked-consolidated-notification-item",
{
url(data) {
return userPath(
`${this.attrs.username ||
this.currentUser
.username}/notifications/likes-received?acting_username=${
data.display_username
}`
);
},
description(data) {
const description =
I18n.t("notifications.liked_consolidated_description", {
count: parseInt(data.count)
});
description(data) {
const description = I18n.t(
"notifications.liked_consolidated_description",
{
count: parseInt(data.count)
}
);
return Ember.isEmpty(description) ? "" : escapeExpression(description);
return Ember.isEmpty(description) ? "" : escapeExpression(description);
}
}
});
);

View File

@ -12,15 +12,16 @@ createWidget("large-notification-item", {
},
html(attrs) {
const notificationName =
this.site.notificationLookup[attrs.notification_type];
const notificationName = this.site.notificationLookup[
attrs.notification_type
];
return [
this.attach(
`${notificationName.dasherize()}-notification-item`,
attrs,
{},
{ fallbackWidgetName: 'default-notification-item' },
{ fallbackWidgetName: "default-notification-item" }
),
h("span.time", dateNode(attrs.created_at))
];

View File

@ -88,21 +88,18 @@ export default createWidget("user-notifications", {
if (state.loading) {
result.push(h("div.spinner-container", h("div.spinner")));
} else if (state.notifications.length) {
const notificationItems =
state.notifications.map(notificationAttrs => {
const notificationItems = state.notifications.map(notificationAttrs => {
const notificationName = this.site.notificationLookup[
notificationAttrs.notification_type
];
const notificationName =
this.site.notificationLookup[notificationAttrs.notification_type];
return (
this.attach(
`${notificationName.dasherize()}-notification-item`,
notificationAttrs,
{},
{ fallbackWidgetName: 'default-notification-item' }
)
);
});
return this.attach(
`${notificationName.dasherize()}-notification-item`,
notificationAttrs,
{},
{ fallbackWidgetName: "default-notification-item" }
);
});
result.push(h("hr"));

View File

@ -229,7 +229,11 @@ export default class Widget {
result.dirtyKeys = this.dirtyKeys;
return result;
} else {
throw new Error(`Couldn't find ${widgetName} or fallback ${otherOpts.fallbackWidgetName}`);
throw new Error(
`Couldn't find ${widgetName} or fallback ${
otherOpts.fallbackWidgetName
}`
);
}
}
@ -382,7 +386,8 @@ export default class Widget {
let contents = this.html(attrs, state);
if (this.name) {
const beforeContents = applyDecorators(this, "before", attrs, state) || [];
const beforeContents =
applyDecorators(this, "before", attrs, state) || [];
const afterContents = applyDecorators(this, "after", attrs, state) || [];
contents = beforeContents.concat(contents).concat(afterContents);
}