on master help sign in
Pass sender's name along when mailing invites
fb24632Fang
src/lib/inviteMail.js+2−2
@@ -30,8 +30,8 @@ async function hasReceived(recipient) {
30 return res.hasReceived;
30 return res.hasReceived;
31}
31}
32
32
33−function sendMail(recipient, ticket, tx) {
33+function sendMail(recipient, ticket, sender, tx) {
34− return sendRequest('/send-ticket', { recipient, ticket, tx });
34+ return sendRequest('/send-ticket', { recipient, ticket, sender, tx });
35}
35}
36
36
37export { hasReceived, sendMail };
37export { hasReceived, sendMail };
src/lib/useMailer.js+2−2
@@ -40,13 +40,13 @@ export default function useMailer(emails) {
40
40
41 // prefix to avoid clobbering sendMail import
41 // prefix to avoid clobbering sendMail import
42 // also throws if return value is false
42 // also throws if return value is false
43− const _sendMail = useCallback(async (email, ticket, rawTx) => {
43+ const _sendMail = useCallback(async (email, ticket, sender, rawTx) => {
44 if (STUB_MAILER) {
44 if (STUB_MAILER) {
45 console.log(`${email} - ${ticket}`);
45 console.log(`${email} - ${ticket}`);
46 return true;
46 return true;
47 }
47 }
48
48
49− return await sendMail(email, ticket, rawTx);
49+ return await sendMail(email, ticket, sender, rawTx);
50 }, []);
50 }, []);
51
51
52 return { ...hasReceivedCache, sendMail: _sendMail };
52 return { ...hasReceivedCache, sendMail: _sendMail };
src/views/Invite/InviteEmail.js+2
@@ -1,5 +1,6 @@
1import React, { useCallback, useEffect, useMemo, useState } from 'react';
1import React, { useCallback, useEffect, useMemo, useState } from 'react';
2import cn from 'classnames';
2import cn from 'classnames';
3+import * as ob from 'urbit-ob';
3import * as azimuth from 'azimuth-js';
4import * as azimuth from 'azimuth-js';
4import {
5import {
5 Grid,
6 Grid,
@@ -340,6 +341,7 @@ export default function InviteEmail() {
340 const success = await sendMail(
341 const success = await sendMail(
341 invite.email,
342 invite.email,
342 invite.ticket,
343 invite.ticket,
344+ ob.patp(point),
343 invite.rawTx
345 invite.rawTx
344 );
346 );
345 if (!success) throw new Error('Failed to send mail');
347 if (!success) throw new Error('Failed to send mail');