FEATURE: Send notification when member was accepted to group. (#7503)

This commit is contained in:
Bianca Nenciu
2019-05-27 17:28:41 +03:00
committed by GitHub
parent 6bd082feab
commit 42c82d544e
9 changed files with 40 additions and 14 deletions

View File

@@ -35,7 +35,8 @@ const REPLACEMENTS = {
"notification.topic_reminder": "far-clock",
"notification.watching_first_post": "far-dot-circle",
"notification.group_message_summary": "group",
"notification.post_approved": "check"
"notification.post_approved": "check",
"notification.group_invite": "user-plus"
};
// TODO: use lib/svg_sprite/fa4-renames.json here

View File

@@ -0,0 +1,3 @@
<% Notification.types.each do |key, value| %>
export const <%= key.upcase %>_TYPE = <%= value %>;
<% end %>

View File

@@ -10,13 +10,15 @@ import {
formatUsername
} from "discourse/lib/utilities";
import { setTransientHeader } from "discourse/lib/ajax";
import { userPath } from "discourse/lib/url";
import { groupPath, userPath } from "discourse/lib/url";
import { iconNode } from "discourse-common/lib/icon-library";
const LIKED_TYPE = 5;
const INVITED_TYPE = 8;
const GROUP_SUMMARY_TYPE = 16;
export const LIKED_CONSOLIDATED_TYPE = 19;
import {
LIKED_TYPE,
INVITED_TYPE,
GROUP_SUMMARY_TYPE,
LIKED_CONSOLIDATED_TYPE,
GROUP_INVITE_TYPE
} from "discourse/components/concerns/notification-types";
createWidget("notification-item", {
tagName: "li",
@@ -72,6 +74,10 @@ createWidget("notification-item", {
);
}
if (attrs.notification_type === GROUP_INVITE_TYPE) {
return groupPath(data.group_name);
}
if (data.group_id) {
return userPath(data.username + "/messages/group/" + data.group_name);
}
@@ -114,8 +120,11 @@ createWidget("notification-item", {
if (notificationType === GROUP_SUMMARY_TYPE) {
const count = data.inbox_count;
const group_name = data.group_name;
return I18n.t(scope, { count, group_name });
const groupName = data.group_name;
return I18n.t(scope, { count, group_name: groupName });
} else if (notificationType === GROUP_INVITE_TYPE) {
const groupName = data.group_name;
return I18n.t(scope, { group_name: groupName });
}
const username = formatUsername(data.display_username);