dev: add share metadata and messages

This commit is contained in:
KernelDeimos 2024-11-20 17:01:24 -05:00
parent 9dff04f8d5
commit e6986d5216
2 changed files with 15 additions and 0 deletions

View File

@ -138,6 +138,10 @@ If this was not you, please contact support@puter.com immediately.
<p>Hi there {{rusername}},</p>
<p>You've received a share from {{susername}} on Puter.</p>
<p>Go to puter.com to check it out.</p>
{{#if message}}
<p>The following message was included:</p>
<blockquote>{{message}}</blockquote>
{{/if}}
<p>Sincerely,</p>
<p>Puter</p>
`
@ -148,6 +152,10 @@ If this was not you, please contact support@puter.com immediately.
<p>Hi there,</p>
<p>You've received a share from {{sender_name}} on Puter:</p>
<p><a href="{{link}}">{{link}}</a></p>
{{#if message}}
<p>The following message was included:</p>
<blockquote>{{message}}</blockquote>
{{/if}}
<p>Sincerely,</p>
<p>Puter</p>
`

View File

@ -539,12 +539,15 @@ module.exports = new Sequence([
}
}
const metadata = a.get('req').body.metadata || {};
svc_notification.notify(UsernameNotifSelector(username), {
source: 'sharing',
icon: 'shared.svg',
title: 'Files were shared with you!',
template: 'file-shared-with-you',
fields: {
metadata,
username: actor.type.user.username,
files,
},
@ -564,6 +567,7 @@ module.exports = new Sequence([
// link: // TODO: create a link to the shared file
susername: actor.type.user.username,
rusername: username,
message: metadata.message,
});
result.recipients[recipient_item.i] =
@ -583,10 +587,12 @@ module.exports = new Sequence([
const email = recipient_item.value;
// data that gets stored in the `data` column of the share
const metadata = a.get('req').body.metadata || {};
const data = {
$: 'internal:share',
$v: 'v0.0.0',
permissions: [],
metadata,
};
for ( const share_item of shares_work.list() ) {
@ -616,6 +622,7 @@ module.exports = new Sequence([
await svc_email.send_email({ email }, 'share_by_email', {
link: email_link,
sender_name: actor.type.user.username,
message: metadata.message,
});
}
},