2018-05-12 00:01:24 +08:00
|
|
|
import Cursor from '/imports/ui/components/cursor/service';
|
2021-10-20 04:35:39 +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;
|
2022-05-12 05:58:16 +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,
|
|
|
|
};
|