Skip to content

Commit b4b874f

Browse files
committed
Filter user annotations by host, to show only those created on this instance of the app.
1 parent 66e59e1 commit b4b874f

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

web.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -113,15 +113,15 @@ app.get('/api', function (req, res) {
113113
// Search annotations
114114
app.get('/api/search', tokenOK, function (req, res) {
115115
var query;
116-
117-
console.log("req.query.context: " + req.query.context);
116+
var re = new RegExp(req.query.host, 'i');
118117

119118
switch (req.query.context) {
120119
case 'document':
121120
query = AnnotationModel.find({'uri': req.query.uri });
122121
break;
123122
case 'dashboard':
124-
query = AnnotationModel.find({'user': req.query.user });
123+
query = AnnotationModel.find({'user': req.query.user});
124+
query.where('uri').regex(re);
125125
break;
126126
}
127127

@@ -140,7 +140,7 @@ app.get('/api/search', tokenOK, function (req, res) {
140140
case 'admin':
141141
break;
142142
}
143-
143+
144144
//console.log("this: " + this.);
145145

146146
if (req.query.sidebar || req.query.context == "dashboard") {

0 commit comments

Comments
 (0)