File tree Expand file tree Collapse file tree 1 file changed +10
-10
lines changed
app/code/Magento/Newsletter/Model Expand file tree Collapse file tree 1 file changed +10
-10
lines changed Original file line number Diff line number Diff line change @@ -393,12 +393,14 @@ public function randomSequence($length = 32)
393393 */
394394 public function subscribe ($ email )
395395 {
396- $ sendInformationEmail = false ;
397396 $ this ->loadByEmail ($ email );
398397
398+ if ($ this ->getId () && $ this ->getStatus () == self ::STATUS_SUBSCRIBED ) {
399+ return $ this ->getStatus ();
400+ }
401+
399402 if (!$ this ->getId ()) {
400403 $ this ->setSubscriberConfirmCode ($ this ->randomSequence ());
401- $ sendInformationEmail = true ;
402404 }
403405
404406 $ isConfirmNeed = $ this ->_scopeConfig ->getValue (
@@ -446,14 +448,12 @@ public function subscribe($email)
446448 try {
447449 /* Save model before sending out email */
448450 $ this ->save ();
449- if ($ sendInformationEmail ) {
450- if ($ isConfirmNeed === true
451- && $ isOwnSubscribes === false
452- ) {
453- $ this ->sendConfirmationRequestEmail ();
454- } else {
455- $ this ->sendConfirmationSuccessEmail ();
456- }
451+ if ($ isConfirmNeed === true
452+ && $ isOwnSubscribes === false
453+ ) {
454+ $ this ->sendConfirmationRequestEmail ();
455+ } else {
456+ $ this ->sendConfirmationSuccessEmail ();
457457 }
458458 return $ this ->getStatus ();
459459 } catch (\Exception $ e ) {
You can’t perform that action at this time.
0 commit comments