Skip to content

Commit

Permalink
feat(Events): add support for online events
Browse files Browse the repository at this point in the history
  • Loading branch information
snitin315 committed Mar 11, 2021
1 parent bed4cd1 commit 6e092ba
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 14 deletions.
42 changes: 35 additions & 7 deletions server/graphql/schemaV1.graphql
Expand Up @@ -113,7 +113,11 @@ type Collective implements CollectiveInterface {
Defines if a collective is pledged
"""
isPledged: Boolean
data: JSON @deprecated(reason: "2020-10-08: This field is not provided anymore and will return an empty object")

"""
Data related to events like privateInstructions
"""
data: JSON
githubContributors: JSON!
slug: String
path: String
Expand Down Expand Up @@ -461,7 +465,11 @@ interface CollectiveInterface {
Defines if a collective is pledged
"""
isPledged: Boolean
data: JSON @deprecated(reason: "2020-10-08: This field is not provided anymore and will return an empty object")

"""
Data related to events like privateInstructions
"""
data: JSON
githubContributors: JSON!
slug: String
path: String
Expand Down Expand Up @@ -1083,7 +1091,11 @@ type Event implements CollectiveInterface {
Defines if a collective is pledged
"""
isPledged: Boolean
data: JSON @deprecated(reason: "2020-10-08: This field is not provided anymore and will return an empty object")

"""
Data related to events like privateInstructions
"""
data: JSON
githubContributors: JSON!
slug: String
path: String
Expand Down Expand Up @@ -1450,7 +1462,11 @@ type Fund implements CollectiveInterface {
Defines if a collective is pledged
"""
isPledged: Boolean
data: JSON @deprecated(reason: "2020-10-08: This field is not provided anymore and will return an empty object")

"""
Data related to events like privateInstructions
"""
data: JSON
githubContributors: JSON!
slug: String
path: String
Expand Down Expand Up @@ -2477,7 +2493,11 @@ type Organization implements CollectiveInterface {
Defines if a collective is pledged
"""
isPledged: Boolean
data: JSON @deprecated(reason: "2020-10-08: This field is not provided anymore and will return an empty object")

"""
Data related to events like privateInstructions
"""
data: JSON
githubContributors: JSON!
slug: String
path: String
Expand Down Expand Up @@ -2855,7 +2875,11 @@ type Project implements CollectiveInterface {
Defines if a collective is pledged
"""
isPledged: Boolean
data: JSON @deprecated(reason: "2020-10-08: This field is not provided anymore and will return an empty object")

"""
Data related to events like privateInstructions
"""
data: JSON
githubContributors: JSON!
slug: String
path: String
Expand Down Expand Up @@ -3704,7 +3728,11 @@ type User implements CollectiveInterface {
Defines if a collective is pledged
"""
isPledged: Boolean
data: JSON @deprecated(reason: "2020-10-08: This field is not provided anymore and will return an empty object")

"""
Data related to events like privateInstructions
"""
data: JSON
githubContributors: JSON!
slug: String
path: String
Expand Down
12 changes: 8 additions & 4 deletions server/graphql/v1/CollectiveInterface.js
Expand Up @@ -650,7 +650,7 @@ export const CollectiveInterfaceType = new GraphQLInterfaceType({
},
data: {
type: GraphQLJSON,
deprecationReason: '2020-10-08: This field is not provided anymore and will return an empty object',
description: 'Data related to events like privateInstructions',
},
githubContributors: { type: new GraphQLNonNull(GraphQLJSON) },
slug: { type: GraphQLString },
Expand Down Expand Up @@ -1102,9 +1102,13 @@ const CollectiveFields = () => {
},
data: {
type: GraphQLJSON,
deprecationReason: '2020-10-08: This field is not provided anymore and will return an empty object',
resolve() {
return {};
description: 'Data related to events like privateInstructions',
resolve(collective, _, req) {
if (collective.type === types.EVENT && req.remoteUser.isAdminOfCollective(collective)) {
return collective.data;
} else {
return {};
}
},
},
githubContributors: {
Expand Down
2 changes: 1 addition & 1 deletion server/graphql/v1/mutations/collectives.js
Expand Up @@ -291,7 +291,7 @@ export function editCollective(_, args, req) {
}

const newCollectiveData = {
...omit(args.collective, ['location', 'type', 'ParentCollectiveId', 'data']),
...omit(args.collective, ['location', 'type', 'ParentCollectiveId']),
LastEditedByUserId: req.remoteUser.id,
};

Expand Down
2 changes: 1 addition & 1 deletion server/lib/notifications.js
Expand Up @@ -152,8 +152,8 @@ async function notifyUserId(UserId, activity, options = {}) {
}
}
}

activity.data.event = event.info;
activity.data.isOffline = activity.data.event.locationName !== 'Online';
activity.data.collective = parentCollective.info;
options.from = `${parentCollective.name} <no-reply@${parentCollective.slug}.opencollective.com>`;
}
Expand Down
15 changes: 14 additions & 1 deletion templates/emails/ticket.confirmed.hbs
Expand Up @@ -13,7 +13,20 @@ Subject: {{ order.quantity }} {{pluralize "ticket" n=order.quantity}} confirmed

<p>This confirms your {{ order.quantity }} {{pluralize "ticket" n=order.quantity}}{{#if order.totalAmount}} for a total of {{currency order.totalAmount currency=order.currency}}{{/if}}. </p>

<p>We are excited that you'll be joining us at <a href="{{config.host.website}}/{{collective.slug}}/events/{{event.slug}}">{{ event.name }}</a> on {{ moment event.startsAt timezone=event.timezone format="MMMM Do YYYY" }} at {{ moment event.startsAt timezone=event.timezone format="h:mma" }} at {{ event.locationName }} ({{event.address}}).</p>
<p>We are excited that you'll be joining us at <a href="{{config.host.website}}/{{collective.slug}}/events/{{event.slug}}">{{ event.name }}</a> on {{ moment event.startsAt timezone=event.timezone format="MMMM Do YYYY" }} at {{ moment event.startsAt timezone=event.timezone format="h:mma" }}
{{#if isOffline }}
at {{ event.locationName }} ({{event.address}}).
{{else}}
on {{event.address}}.
{{/if}}
</p>

{{#if event.data.eventInfo.privateInstructions}}
<h2>Private Instructions</h2>
<p>
{{event.data.eventInfo.privateInstructions}}
</p>
{{/if}}

{{#if transactionPdf}}
<h2>📎 Attachments</h2>
Expand Down

0 comments on commit 6e092ba

Please sign in to comment.