2018-05-12 00:01:24 +08:00
|
|
|
import Cursor from '/imports/ui/components/cursor/service';
|
2017-10-12 10:00:28 +08:00
|
|
|
import Users from '/imports/api/users';
|
2017-05-05 05:10:49 +08:00
|
|
|
|
2017-08-15 08:15:11 +08:00
|
|
|
const getCurrentCursor = (cursorId) => {
|
|
|
|
const cursor = Cursor.findOne({ _id: cursorId });
|
|
|
|
if (cursor) {
|
|
|
|
const { userId } = cursor;
|
2019-08-30 00:26:07 +08:00
|
|
|
const user = Users.findOne({ userId, connectionStatus: 'online' }, { fields: { name: 1 } });
|
2017-08-15 08:15:11 +08:00
|
|
|
if (user) {
|
2017-08-17 10:24:59 +08:00
|
|
|
cursor.userName = user.name;
|
2017-08-15 08:15:11 +08:00
|
|
|
return cursor;
|
|
|
|
}
|
2017-07-29 08:29:40 +08:00
|
|
|
}
|
|
|
|
return false;
|
|
|
|
};
|
2017-05-05 05:10:49 +08:00
|
|
|
|
|
|
|
export default {
|
|
|
|
getCurrentCursor,
|
|
|
|
};
|