on master help sign in
Pass sender's name along when mailing invites
commitfb24632f08df229b2b7cd094efd4bf4238814a10 authorFang <git@fang.io> dateFri 26 Jul 2019, 00:18 (7 years ago) parente1a6594
3 files changed+6−4
src/lib/inviteMail.js+2−2 src/lib/useMailer.js+2−2 src/views/Invite/InviteEmail.js+2
src/lib/inviteMail.js+2−2
@@ -30,8 +30,8 @@ async function hasReceived(recipient) {
3030 return res.hasReceived;
3131}
3232
33−function sendMail(recipient, ticket, tx) {
34− return sendRequest('/send-ticket', { recipient, ticket, tx });
33+function sendMail(recipient, ticket, sender, tx) {
34+ return sendRequest('/send-ticket', { recipient, ticket, sender, tx });
3535}
3636
3737export { hasReceived, sendMail };
src/lib/useMailer.js+2−2
@@ -40,13 +40,13 @@ export default function useMailer(emails) {
4040
4141 // prefix to avoid clobbering sendMail import
4242 // also throws if return value is false
43− const _sendMail = useCallback(async (email, ticket, rawTx) => {
43+ const _sendMail = useCallback(async (email, ticket, sender, rawTx) => {
4444 if (STUB_MAILER) {
4545 console.log(`${email} - ${ticket}`);
4646 return true;
4747 }
4848
49− return await sendMail(email, ticket, rawTx);
49+ return await sendMail(email, ticket, sender, rawTx);
5050 }, []);
5151
5252 return { ...hasReceivedCache, sendMail: _sendMail };
src/views/Invite/InviteEmail.js+2
@@ -1,5 +1,6 @@
11import React, { useCallback, useEffect, useMemo, useState } from 'react';
22import cn from 'classnames';
3+import * as ob from 'urbit-ob';
34import * as azimuth from 'azimuth-js';
45import {
56 Grid,
@@ -340,6 +341,7 @@ export default function InviteEmail() {
340341 const success = await sendMail(
341342 invite.email,
342343 invite.ticket,
344+ ob.patp(point),
343345 invite.rawTx
344346 );
345347 if (!success) throw new Error('Failed to send mail');