浏览代码

fix: share only emails email_confirmed recipients

KernelDeimos 5 月之前
父节点
当前提交
2336a62b4f
共有 1 个文件被更改,包括 10 次插入8 次删除
  1. 10 8
      src/backend/src/structured/sequence/share.js

+ 10 - 8
src/backend/src/structured/sequence/share.js

@@ -194,14 +194,16 @@ module.exports = new Sequence([
             // Working on notifications
             // Email should have a link to a shared file, right?
             //   .. how do I make those URLs? (gui feature)
-            await svc_email.send_email({
-                email: recipient_item.user.email,
-            }, 'share_by_username', {
-                // link: // TODO: create a link to the shared file
-                susername: actor.type.user.username,
-                rusername: username,
-                message: metadata.message,
-            });
+            if ( recipient_item.user.email && recipient_item.user.email_confirmed ) {
+                await svc_email.send_email({
+                    email: recipient_item.user.email,
+                }, 'share_by_username', {
+                    // link: // TODO: create a link to the shared file
+                    susername: actor.type.user.username,
+                    rusername: username,
+                    message: metadata.message,
+                });
+            }
             
             result.recipients[recipient_item.i] =
                 { $: 'api:status-report', status: 'success' };