diff --git a/jam-ui/src/components/profile/JKProfileAvatarUpload.js b/jam-ui/src/components/profile/JKProfileAvatarUpload.js
new file mode 100644
index 000000000..650e934d9
--- /dev/null
+++ b/jam-ui/src/components/profile/JKProfileAvatarUpload.js
@@ -0,0 +1,58 @@
+import React, { useEffect } from 'react'
+import * as filestack from 'filestack-js';
+import { Button } from 'reactstrap';
+import { useTranslation } from 'react-i18next';
+import JKModalDialog from '../common/JKModalDialog';
+import JKProfileAvatar from './JKProfileAvatar';
+import { useAuth } from '../../context/UserAuth';
+import { getUserDetails } from '../../helpers/rest';
+
+const JKProfileAvatarUpload = ({show, toggle}) => {
+ const { t } = useTranslation('profile');
+ const { currentUser } = useAuth();
+
+ useEffect(() => {
+ if(currentUser) {
+ console.log(currentUser.photo_url);
+ getUserDetails(currentUser.id).then(response => {
+ console.log('_userDetails', response);
+ });
+ }
+ }, [currentUser]);
+
+ const openFilePicker = () => {
+ const client = filestack.init(window.gon.fp_apikey);
+ client.picker({
+ accept: 'image/*',
+ maxFiles: 1,
+ onFileUploadFinished: (response) => {
+ console.log(response);
+ }
+ }).open();
+ }
+ return (
+
+
+
+
+
+
+
+
+
+
+
+
+ )
+}
+
+export default JKProfileAvatarUpload
\ No newline at end of file
diff --git a/jam-ui/src/components/sessions/JKLobbyUserList.js b/jam-ui/src/components/sessions/JKLobbyUserList.js
index 12fe50067..6e34f4325 100644
--- a/jam-ui/src/components/sessions/JKLobbyUserList.js
+++ b/jam-ui/src/components/sessions/JKLobbyUserList.js
@@ -3,38 +3,35 @@ import { Table } from 'reactstrap';
import { useTranslation } from 'react-i18next';
import JKLobbyUser from './JKLobbyUser';
import { isIterableArray } from '../../helpers/utils';
-import Loader from '../common/Loader';
-function JKLobbyUserList({ loadingStatus, onlineMusicians, selectedUsers, setSelectedUsers }) {
+function JKLobbyUserList({ onlineMusicians, selectedUsers, setSelectedUsers }) {
const { t } = useTranslation('sessions');
return (
<>
- {loadingStatus === 'loading' && onlineMusicians.length === 0 ? (
-
- ) : (
-
-
+
+
+
+ |
+ {t('lobby.users.header.musician', { ns: 'sessions' })}
+ |
+
+ {t('lobby.users.header.actions', { ns: 'sessions' })}
+ |
+
+
+
+ {isIterableArray(onlineMusicians) ? (
+ onlineMusicians.map(musician => (
+
+ ))
+ ) : (
- |
- {t('lobby.users.header.musician', { ns: 'sessions' })}
- |
-
- {t('lobby.users.header.actions', { ns: 'sessions' })}
- |
+ {t('lobby.users.not_found')} |
-
-
- {isIterableArray(onlineMusicians) ? (
- onlineMusicians.map(musician => )
- ) : (
-
- | {t('lobby.users.not_found')} |
-
- )}
-
-
- )}
+ )}
+
+
>
);
}
diff --git a/jam-ui/src/helpers/rest.js b/jam-ui/src/helpers/rest.js
index 925c0bbe6..7e3536bc6 100644
--- a/jam-ui/src/helpers/rest.js
+++ b/jam-ui/src/helpers/rest.js
@@ -24,6 +24,15 @@ export const getPersonById = id => {
);
};
+export const getUserDetails = options => {
+ const { id, ...rest } = options;
+ return new Promise((resolve, reject) =>
+ apiFetch(`/users/${id}?${new URLSearchParams(rest)}`)
+ .then(response => resolve(response))
+ .catch(error => reject(error))
+ );
+}
+
export const getPeople = ({ data, offset, limit } = {}) => {
return new Promise((resolve, reject) => {
apiFetch(`/filter?offset=${offset}&limit=${limit}`, {
diff --git a/jam-ui/src/store/features/onlineMusiciansSlice.js b/jam-ui/src/store/features/onlineMusiciansSlice.js
index b7647ae3a..e242c4504 100644
--- a/jam-ui/src/store/features/onlineMusiciansSlice.js
+++ b/jam-ui/src/store/features/onlineMusiciansSlice.js
@@ -36,6 +36,12 @@ export const onlineMusiciansSlice = createSlice({
console.log('fetchOnlineMusicians.fulfilled', action.payload)
state.status = 'succeeded'
state.musicians = action.payload
+ // if (action.payload && action.payload.length > 0) {
+ // const difference = state.musicians.filter((element) => !action.payload.includes(element));
+ // if (difference.length > 0) {
+ // state.musicians = action.payload
+ // }
+ // }
})
.addCase(fetchOnlineMusicians.rejected, (state, action) => {
state.status = 'failed'
diff --git a/ruby/lib/jam_ruby/models/user.rb b/ruby/lib/jam_ruby/models/user.rb
index c909df269..d003f62d2 100644
--- a/ruby/lib/jam_ruby/models/user.rb
+++ b/ruby/lib/jam_ruby/models/user.rb
@@ -317,18 +317,22 @@ module JamRuby
#the users that have opened the lobby page but now in a different tab or window or
#the users that have been active in the last 15 minutes
query = User.joins(:app_interactions).where("
- (app_interactions.client = 'browser' AND app_interactions.action_at > ? AND app_interactions.screen = 'lobby' AND app_interactions.action = 'page:enter' AND app_interactions.user_id <> ?)
- OR (app_interactions.client = 'browser' AND app_interactions.action_at > ? AND app_interactions.screen = 'lobby' AND app_interactions.action = 'page:exit' AND app_interactions.user_id = ? AND users.accept_desktop_notifications = ?)
- OR (users.last_jam_updated_at IS NOT NULL AND users.last_jam_updated_at > ? AND users.id <> ?)",
- 10.minutes.ago,
+ (app_interactions.client = 'browser' AND app_interactions.action_at > ? AND app_interactions.screen = 'session:lobby' AND app_interactions.action = 'page:enter' AND app_interactions.user_id <> ?)
+ OR (app_interactions.client = 'browser' AND app_interactions.action_at > ? AND app_interactions.screen = 'session:lobby' AND app_interactions.action = 'page:exit' AND app_interactions.user_id <> ? AND users.accept_desktop_notifications = ?)
+ OR (users.last_jam_updated_at IS NOT NULL AND users.last_jam_updated_at > ? AND users.id <> ? AND users.accept_desktop_notifications = ?)
+ ",
+ 5.minutes.ago,
current_user.id,
- 10.minutes.ago,
+ 5.minutes.ago,
current_user.id,
true,
- 10.minutes.ago,
- current_user.id
+ 5.minutes.ago,
+ current_user.id,
+ true
)
+ #
+
#the users that are currently not in a music session
live_music_sessions = ActiveMusicSession
if live_music_sessions.count > 0