Store file upload history on server
parent
8b6ebe39b2
commit
35b3da155d
|
|
@ -238,6 +238,22 @@ export default class RoomClient
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getFileHistory()
|
||||||
|
{
|
||||||
|
logger.debug('getFileHistory()');
|
||||||
|
|
||||||
|
return this._protoo.send('file-history', {})
|
||||||
|
.catch((error) =>
|
||||||
|
{
|
||||||
|
logger.error('getFileHistory() | failed: %o', error);
|
||||||
|
|
||||||
|
this._dispatch(requestActions.notify({
|
||||||
|
type: 'error',
|
||||||
|
text: 'Could not get file history'
|
||||||
|
}));
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
muteMic()
|
muteMic()
|
||||||
{
|
{
|
||||||
logger.debug('muteMic()');
|
logger.debug('muteMic()');
|
||||||
|
|
@ -1177,6 +1193,22 @@ export default class RoomClient
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case 'file-history-receive':
|
||||||
|
{
|
||||||
|
accept();
|
||||||
|
|
||||||
|
const files = request.data.fileHistory;
|
||||||
|
|
||||||
|
if (files.length > 0)
|
||||||
|
{
|
||||||
|
logger.debug('Got files history');
|
||||||
|
|
||||||
|
this._dispatch(stateActions.addFileHistory(files));
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
logger.error('unknown protoo method "%s"', request.method);
|
logger.error('unknown protoo method "%s"', request.method);
|
||||||
|
|
@ -1314,6 +1346,7 @@ export default class RoomClient
|
||||||
this._dispatch(stateActions.removeAllNotifications());
|
this._dispatch(stateActions.removeAllNotifications());
|
||||||
|
|
||||||
this.getChatHistory();
|
this.getChatHistory();
|
||||||
|
this.getFileHistory();
|
||||||
|
|
||||||
this._dispatch(requestActions.notify(
|
this._dispatch(requestActions.notify(
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,9 @@ const sharing = (state = [], action) =>
|
||||||
case 'ADD_FILE':
|
case 'ADD_FILE':
|
||||||
return [ ...state, action.payload ];
|
return [ ...state, action.payload ];
|
||||||
|
|
||||||
|
case 'ADD_FILE_HISTORY':
|
||||||
|
return [ ...action.payload.fileHistory, ...state ];
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -449,6 +449,14 @@ export const addFile = (payload) =>
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const addFileHistory = (fileHistory) =>
|
||||||
|
{
|
||||||
|
return {
|
||||||
|
type: 'ADD_FILE_HISTORY',
|
||||||
|
payload: { fileHistory }
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
export const setPicture = (picture) =>
|
export const setPicture = (picture) =>
|
||||||
({
|
({
|
||||||
type : 'SET_PICTURE',
|
type : 'SET_PICTURE',
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,8 @@ class Room extends EventEmitter
|
||||||
|
|
||||||
this._chatHistory = [];
|
this._chatHistory = [];
|
||||||
|
|
||||||
|
this._fileHistory = [];
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// Protoo Room instance.
|
// Protoo Room instance.
|
||||||
|
|
@ -278,6 +280,8 @@ class Room extends EventEmitter
|
||||||
|
|
||||||
const { file } = request.data;
|
const { file } = request.data;
|
||||||
|
|
||||||
|
this._fileHistory.push(file);
|
||||||
|
|
||||||
this._protooRoom.spread('file-receive', {
|
this._protooRoom.spread('file-receive', {
|
||||||
file
|
file
|
||||||
}, [ protooPeer ]);
|
}, [ protooPeer ]);
|
||||||
|
|
@ -285,6 +289,17 @@ class Room extends EventEmitter
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case 'file-history':
|
||||||
|
{
|
||||||
|
accept();
|
||||||
|
|
||||||
|
protooPeer.send('file-history-receive', {
|
||||||
|
fileHistory: this._fileHistory
|
||||||
|
});
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case 'raisehand-message':
|
case 'raisehand-message':
|
||||||
{
|
{
|
||||||
accept();
|
accept();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue