2018-05-12 00:01:24 +08:00
|
|
|
import Cursor from '/imports/ui/components/cursor/service';
|
2021-09-07 04:51:42 +08:00
|
|
|
import Users from '/imports/ui/local-collections/users-collection/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;
|
2020-08-20 00:22:43 +08:00
|
|
|
const user = Users.findOne({ userId }, { 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,
|
|
|
|
};
|