@dhyasama/totem-models 6.25.1 → 6.26.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/Organization.js +4 -4
- package/lib/Person.js +3 -3
- package/package.json +1 -1
- package/test/Organization.js +9 -0
- package/test/Person.js +9 -0
package/lib/Organization.js
CHANGED
|
@@ -1430,10 +1430,10 @@ module.exports = function(mongoose, config) {
|
|
|
1430
1430
|
self
|
|
1431
1431
|
.find({ $or:
|
|
1432
1432
|
[
|
|
1433
|
-
{ 'social.facebook': new RegExp('facebook.com/' + username, 'i') },
|
|
1434
|
-
{ 'social.linkedin': new RegExp('linkedin.com/company/' + username, 'i') },
|
|
1435
|
-
{ 'social.twitter': new RegExp('twitter.com/' + username, 'i') },
|
|
1436
|
-
{ 'crunchbase.url': new RegExp('crunchbase.com/organization/' + username, 'i') }
|
|
1433
|
+
{ 'social.facebook': new RegExp('facebook.com/' + username + '$', 'i') },
|
|
1434
|
+
{ 'social.linkedin': new RegExp('linkedin.com/company/' + username + '$', 'i') },
|
|
1435
|
+
{ 'social.twitter': new RegExp('twitter.com/' + username + '$', 'i') },
|
|
1436
|
+
{ 'crunchbase.url': new RegExp('crunchbase.com/organization/' + username + '$', 'i') }
|
|
1437
1437
|
],
|
|
1438
1438
|
'deleted': { $ne: true }
|
|
1439
1439
|
})
|
package/lib/Person.js
CHANGED
|
@@ -721,9 +721,9 @@ module.exports = function(mongoose, config) {
|
|
|
721
721
|
self
|
|
722
722
|
.find({ $or:
|
|
723
723
|
[
|
|
724
|
-
{ 'social.facebook': new RegExp('facebook.com/' + username, 'i') },
|
|
725
|
-
{ 'social.linkedin': new RegExp('linkedin.com/in/' + username, 'i') },
|
|
726
|
-
{ 'social.twitter': new RegExp('twitter.com/' + username, 'i') }
|
|
724
|
+
{ 'social.facebook': new RegExp('facebook.com/' + username + '$', 'i') },
|
|
725
|
+
{ 'social.linkedin': new RegExp('linkedin.com/in/' + username + '$', 'i') },
|
|
726
|
+
{ 'social.twitter': new RegExp('twitter.com/' + username + '$', 'i') }
|
|
727
727
|
],
|
|
728
728
|
'deleted': { $ne: true }
|
|
729
729
|
})
|
package/package.json
CHANGED
package/test/Organization.js
CHANGED
|
@@ -934,6 +934,15 @@ describe('Organization', function() {
|
|
|
934
934
|
});
|
|
935
935
|
});
|
|
936
936
|
|
|
937
|
+
it('will not match partial username', function (done) {
|
|
938
|
+
Organization.findBySocial('http://twitter.com/abcdef', function (err, result) {
|
|
939
|
+
should.not.exist(err);
|
|
940
|
+
should.exist(result);
|
|
941
|
+
result.length.should.equal(0);
|
|
942
|
+
return done();
|
|
943
|
+
});
|
|
944
|
+
});
|
|
945
|
+
|
|
937
946
|
it('finds orgs by twitter with https and no www', function (done) {
|
|
938
947
|
Organization.findBySocial('https://twitter.com/abc', function (err, result) {
|
|
939
948
|
should.not.exist(err);
|
package/test/Person.js
CHANGED
|
@@ -690,6 +690,15 @@ describe('Person', function() {
|
|
|
690
690
|
});
|
|
691
691
|
});
|
|
692
692
|
|
|
693
|
+
it('will not match on partial username', function (done) {
|
|
694
|
+
Person.findBySocial('http://facebook.com/slipperypeterpumpkin', function (err, result) {
|
|
695
|
+
should.not.exist(err);
|
|
696
|
+
should.exist(result);
|
|
697
|
+
result.length.should.equal(0);
|
|
698
|
+
return done();
|
|
699
|
+
});
|
|
700
|
+
});
|
|
701
|
+
|
|
693
702
|
it('finds person by facebook with https and no www', function (done) {
|
|
694
703
|
Person.findBySocial('https://facebook.com/slipperypete', function (err, result) {
|
|
695
704
|
should.not.exist(err);
|