summaryrefslogtreecommitdiff
path: root/src/api/endpoints/messaging
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2017-02-22 13:08:33 +0900
committersyuilo <syuilotan@yahoo.co.jp>2017-02-22 13:08:33 +0900
commit1f88c4d40c3e6dba6da173496e444e46323d84c5 (patch)
treed1bc4b51f24c7e3c5fa89503470f7ea6d9628696 /src/api/endpoints/messaging
parentRemove unused import (diff)
downloadsharkey-1f88c4d40c3e6dba6da173496e444e46323d84c5.tar.gz
sharkey-1f88c4d40c3e6dba6da173496e444e46323d84c5.tar.bz2
sharkey-1f88c4d40c3e6dba6da173496e444e46323d84c5.zip
[Server] Some performance improvements
Diffstat (limited to 'src/api/endpoints/messaging')
-rw-r--r--src/api/endpoints/messaging/messages.js4
-rw-r--r--src/api/endpoints/messaging/messages/create.js4
2 files changed, 8 insertions, 0 deletions
diff --git a/src/api/endpoints/messaging/messages.js b/src/api/endpoints/messaging/messages.js
index 2d589faa1c..674b250567 100644
--- a/src/api/endpoints/messaging/messages.js
+++ b/src/api/endpoints/messaging/messages.js
@@ -25,6 +25,10 @@ module.exports = (params, user) =>
if (recipient !== undefined && recipient !== null) {
recipient = await User.findOne({
_id: new mongo.ObjectID(recipient)
+ }, {
+ fields: {
+ _id: true
+ }
});
if (recipient === null) {
diff --git a/src/api/endpoints/messaging/messages/create.js b/src/api/endpoints/messaging/messages/create.js
index 62ead6a64c..498883057b 100644
--- a/src/api/endpoints/messaging/messages/create.js
+++ b/src/api/endpoints/messaging/messages/create.js
@@ -33,6 +33,10 @@ module.exports = (params, user) =>
if (recipient !== undefined && recipient !== null) {
recipient = await User.findOne({
_id: new mongo.ObjectID(recipient)
+ }, {
+ fields: {
+ _id: true
+ }
});
if (recipient === null) {