diff --git a/.ruby-version b/.ruby-version
new file mode 100644
index 000000000..005119baa
--- /dev/null
+++ b/.ruby-version
@@ -0,0 +1 @@
+2.4.1
diff --git a/jam-ui/cypress/e2e/friends/friends-page.cy.js b/jam-ui/cypress/e2e/friends/friends-page.cy.js
index 31c5dfebe..deb9e06da 100644
--- a/jam-ui/cypress/e2e/friends/friends-page.cy.js
+++ b/jam-ui/cypress/e2e/friends/friends-page.cy.js
@@ -448,6 +448,31 @@ describe('Friends page with data', () => {
});
});
+ describe('coming from email links', () => {
+ it.only("opens details sidebar", () => {
+ cy.visit('/friends?open=details&id=1');
+ showSidePanelContent();
+ });
+
+ it.only("opens chat window", () => {
+ cy.visit('/friends?open=message&id=1');
+ cy.get('[data-testid=textMessageModal]')
+ .should('be.visible')
+ cy.contains('Send Message to Test User1').should('exist');
+ });
+
+ it.only("sends friend request", () => {
+ cy.intercept('GET', /\S+\/profile\S+/, { fixture: 'person' });
+ cy.intercept('POST', /\S+\/friend_requests/, { statusCode: 201, body: { ok: true } });
+ cy.visit('/friends?open=connect&id=1');
+ cy.get('[data-testid=profileSidePanel]')
+ .find('[data-testid=connect]')
+ .should('be.disabled');
+ cy.contains('Success! Your friend request has been sent to Test User1.');
+ });
+
+ })
+
describe('filter', () => {
const fillFilterForm = () => {
//cy.get('[data-testid=btnUpdateSearch]').click();
@@ -582,4 +607,6 @@ describe('Friends page with data', () => {
});
});
+
+
});
diff --git a/jam-ui/cypress/e2e/home/unsubscribe.cy.js b/jam-ui/cypress/e2e/home/unsubscribe.cy.js
new file mode 100644
index 000000000..b73f108d2
--- /dev/null
+++ b/jam-ui/cypress/e2e/home/unsubscribe.cy.js
@@ -0,0 +1,23 @@
+///
+
+describe('Unsubscribe from email link', () => {
+ beforeEach(() =>{
+ cy.intercept('POST', /\S+\/unsubscribe_user_match\/\S+/, { statusCode: 200, body: { ok: true } });
+ })
+
+ it("redirect to home page if tok is not provided", () => {
+ cy.visit('/unsubscribe');
+ cy.location('pathname').should('eq', '/');
+ });
+
+ it.only("show unsubscribed message", () => {
+ cy.visit('/unsubscribe?tok=123');
+ cy.location('search')
+ .should('equal', '?tok=123')
+ .then((s) => new URLSearchParams(s))
+ .invoke('get', 'tok')
+ .should('equal', '123')
+ cy.contains("successfully unsubscribed")
+ });
+
+})
\ No newline at end of file
diff --git a/jam-ui/src/components/page/JKUnsubscribe.js b/jam-ui/src/components/page/JKUnsubscribe.js
index 41e15b353..66174abbf 100644
--- a/jam-ui/src/components/page/JKUnsubscribe.js
+++ b/jam-ui/src/components/page/JKUnsubscribe.js
@@ -1,19 +1,64 @@
-import React from 'react';
-import { Card, CardBody } from 'reactstrap';
-import FalconCardHeader from '../common/FalconCardHeader';
+import React, { useEffect, useState } from 'react';
+import { Card, CardBody, CardText, CardTitle } from 'reactstrap';
import { useTranslation } from "react-i18next";
+import { useBrowserQuery } from '../../context/BrowserQuery';
+import { useHistory } from "react-router-dom";
+
+
+const unsubscribeFromNewUsersWeeklyEmail = (token) => {
+
+ const baseUrl = process.env.REACT_APP_LEGACY_BASE_URL
+
+ return new Promise((resolve, reject) => {
+ fetch(`${baseUrl}/unsubscribe_user_match/${token}`,
+ { method: 'POST' }
+ ).then(response => {
+ if (response.ok) {
+ resolve(response);
+ } else {
+ reject(response)
+ }
+ })
+ })
+}
function JKUnsubscribe() {
const {t} = useTranslation()
+ const queryObj = useBrowserQuery();
+ const history = useHistory()
+ const [success, setSuccess] = useState(false)
+
+ useEffect(() => {
+ const token = queryObj.get('tok')
+ if(token){
+ unsubscribeFromNewUsersWeeklyEmail(token)
+ .then((resp) => {
+ if(resp.ok){
+ setSuccess(true)
+ }
+ })
+ .catch(error => console.error(error))
+ }else{
+ history.push('/')
+ }
+ }, [])
return (
-
-
-
- Unsubscribe from weekly email
-
-
-
+
+
+
+
+ Unsubscribe From Weekly Email
+
+ {
+ success?
+ 'You have successfully unsubscribed from weekly emails on newly joined musicians having low internet latency to you.' :
+ 'Unsubscribing...'
+ }
+
+
+
+
)
}
diff --git a/jam-ui/src/helpers/rest.js b/jam-ui/src/helpers/rest.js
index 92f9517e1..b57282d6b 100644
--- a/jam-ui/src/helpers/rest.js
+++ b/jam-ui/src/helpers/rest.js
@@ -153,4 +153,4 @@ export const getLatencyToUsers = (currentUserId, participantIds) => {
.then(response => resolve(response))
.catch(error => reject(error))
})
-}
\ No newline at end of file
+}
diff --git a/ruby/lib/jam_ruby/app/views/jam_ruby/user_mailer/new_musicians_match.text.erb b/ruby/lib/jam_ruby/app/views/jam_ruby/user_mailer/new_musicians_match.text.erb
index 2d06f81dd..32aef7781 100644
--- a/ruby/lib/jam_ruby/app/views/jam_ruby/user_mailer/new_musicians_match.text.erb
+++ b/ruby/lib/jam_ruby/app/views/jam_ruby/user_mailer/new_musicians_match.text.erb
@@ -1 +1,29 @@
-EMAIL BODY HERE: <%#= @musicians_data.inspect -%>
\ No newline at end of file
+<% if !@user.anonymous? %>
+Hi <%= @user.first_name %>,
+<% end %>
+
+The following musicians have joined JamKazam within the last week and have low internet latency to you that will support enjoyable sessions. If you'd like to make more musical connections, we encourage you to use the links below to send these new users a welcome message and perhaps arrange a session to play together.
+
+<%
+ @musicians_data.each do | data | -%>
+ <%
+ musicians = data[:musicians]
+ latencies = data[:latencies]
+ musicians.each do |musician|
+ latency = latencies.find{|l| l[:user_id] == musician.id }
+ -%>
+ <%= musician.first_name %> <%= musician.last_name %>
+ Latency To You: <%= latency_info(latency) %>
+ Last Active On: <%= musician.last_active_timestamp %> ago
+ <% musician.musician_instruments.each do |mi| -%>
+ <%= mi.description %> <%= @instrument_proficiencies[mi.proficiency_level.to_s.to_sym] %>
+ <% end -%>
+ View Profile: <%= APP_CONFIG.spa_origin -%>/friends?id=<%= musician.id %>&open=details
+ Send Message: <%= APP_CONFIG.spa_origin -%>/friends?id=<%= musician.id %>&open=message
+ Send Friend Request: <%= APP_CONFIG.spa_origin -%>/friends?id=<%= musician.id %>&open=connect
+ <% end -%>
+ <% end -%>
+
+ To find great musical matches across the entire JamKazam commiunity and make new connections, use the link below to access our musician search feature. This let you filter JamKazammers by latency, instruments, skill level, genre interests, last active day and more.
+
+ Search JamKazam Musicians: <%= APP_CONFIG.spa_origin -%>/friends
\ No newline at end of file
diff --git a/ruby/lib/jam_ruby/app/views/layouts/user_mailer_beta.html.erb b/ruby/lib/jam_ruby/app/views/layouts/user_mailer_beta.html.erb
index f41a043c8..f226c6b54 100644
--- a/ruby/lib/jam_ruby/app/views/layouts/user_mailer_beta.html.erb
+++ b/ruby/lib/jam_ruby/app/views/layouts/user_mailer_beta.html.erb
@@ -33,6 +33,6 @@
You are receiving this email because you created a JamKazam account with the email address <%= @user.email -%>
- Unsubscribe from this weekly new musician notification
+ Unsubscribe from this weekly new musician notification