Conflicts: .meteor/packages .meteor/versions .travis.ymlpull/1045/head
commit
6e5470a80b
@ -1,44 +1,39 @@ |
|||||||
var BUILD_INFO_PATH = '../public/buildinfo/buildinfo.txt'; |
var BUILD_INFO_PATH = '../public/buildinfo/buildinfo.txt'; |
||||||
var PACKAGES_PATH = '../.meteor/packages'; |
var PACKAGES_PATH = '../.meteor/versions'; |
||||||
var BUILD_PATH = '../../build'; |
var BUILD_PATH = '../../build'; |
||||||
var LineByLineReader = require('line-by-line'), |
var LineByLineReader = require('line-by-line'); |
||||||
mkdirp = require('mkdirp'), |
var mkdirp = require('mkdirp'); |
||||||
fs = require('fs'), |
var fs = require('fs'); |
||||||
lr = new LineByLineReader(BUILD_INFO_PATH); |
var lr = new LineByLineReader(BUILD_INFO_PATH); |
||||||
|
|
||||||
var firstline = ""; |
var firstline = ""; |
||||||
|
|
||||||
|
|
||||||
if (process.env.TRAVIS_BUILD_NUMBER) { |
if (process.env.TRAVIS_BUILD_NUMBER) { |
||||||
|
|
||||||
var transformVersion = function (firstline) { |
var transformVersion = function (firstline) { |
||||||
var versions = firstline.split("."); |
var versions = firstline.split("."); |
||||||
|
|
||||||
return versions[0] + '.' + versions[1] + '.' + process.env.TRAVIS_BUILD_NUMBER + '\n'; |
return versions[0] + '.' + versions[1] + '.' + process.env.TRAVIS_BUILD_NUMBER + '\n'; |
||||||
}; |
}; |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
lr.on('error', function (err) { |
lr.on('error', function (err) { |
||||||
// 'err' contains error object
|
// 'err' contains error object
|
||||||
}); |
}); |
||||||
|
|
||||||
lr.on('line', function (line) { |
lr.on('line', function (line) { |
||||||
if (firstline == "") |
if (firstline == "") { |
||||||
firstline = line; |
firstline = line; |
||||||
|
} |
||||||
}); |
}); |
||||||
|
|
||||||
lr.on('end', function () { |
lr.on('end', function () { |
||||||
|
var packages = fs.readFileSync(PACKAGES_PATH); |
||||||
var packages = fs.readFileSync(PACKAGES_PATH); |
var verinfo = transformVersion(firstline); |
||||||
var verinfo = transformVersion(firstline); |
var content = verinfo + packages; |
||||||
var content = verinfo + packages; |
mkdirp.sync(BUILD_PATH); |
||||||
mkdirp.sync(BUILD_PATH); |
fs.writeFileSync(BUILD_PATH + "/version.txt", verinfo); |
||||||
fs.writeFileSync(BUILD_PATH + "/version.txt", verinfo); |
fs.writeFileSync(BUILD_INFO_PATH, content); |
||||||
fs.writeFileSync(BUILD_INFO_PATH, content); |
console.log('Version is ' + verinfo); |
||||||
console.log('Version is ' + verinfo); |
|
||||||
|
|
||||||
}); |
}); |
||||||
|
|
||||||
} |
} |
||||||
|
|||||||
@ -0,0 +1,10 @@ |
|||||||
|
#!/bin/bash |
||||||
|
source ./build-info.sh |
||||||
|
export METEOR_SETTINGS=$(cat settings.json) |
||||||
|
meteor add rocketchat:livechat |
||||||
|
meteor add rocketchat:hubot |
||||||
|
meteor build --server https://demo.rocket.chat --directory /var/www/rocket.chat |
||||||
|
cd /var/www/rocket.chat/bundle/programs/server |
||||||
|
npm install |
||||||
|
cd /var/www/rocket.chat/current |
||||||
|
pm2 startOrRestart /var/www/rocket.chat/current/pm2.json |
||||||
@ -1,8 +1,15 @@ |
|||||||
#!/bin/bash |
#!/bin/bash |
||||||
cd /var/www/rocket.chat |
|
||||||
https://s3.amazonaws.com/rocketchatbuild/demo.rocket.chat-v.latest.tgz" -o rocket.chat.tgz |
ROOTPATH=/var/www/rocket.chat |
||||||
|
PM2FILE=pm2.json |
||||||
|
if [ "$1" == "development" ]; then |
||||||
|
ROOTPATH=/var/www/rocket.chat.dev |
||||||
|
PM2FILE=pm2.dev.json |
||||||
|
fi |
||||||
|
|
||||||
|
cd $ROOTPATH |
||||||
|
curl -fSL "https://s3.amazonaws.com/rocketchatbuild/demo.rocket.chat-v.latest.tgz" -o rocket.chat.tgz |
||||||
tar zxvf rocket.chat.tgz && rm rocket.chat.tgz |
tar zxvf rocket.chat.tgz && rm rocket.chat.tgz |
||||||
cd /var/www/rocket.chat/bundle/programs/server |
cd $ROOTPATH/bundle/programs/server |
||||||
npm install |
npm install |
||||||
cd /var/www/rocket.chat/current |
pm2 startOrRestart $ROOTPATH/current/$PM2FILE |
||||||
pm2 startOrRestart /var/www/rocket.chat/current/pm2.json |
|
||||||
|
|||||||
@ -1,99 +1,102 @@ |
|||||||
{ |
{ |
||||||
"dependencies": { |
"dependencies": { |
||||||
"connect": { |
"connect": { |
||||||
"version": "http://registry.npmjs.org/connect/-/connect-2.7.10.tgz", |
"version": "2.7.10", |
||||||
"dependencies": { |
"dependencies": { |
||||||
"qs": { |
"qs": { |
||||||
"version": "http://registry.npmjs.org/qs/-/qs-0.6.5.tgz" |
"version": "0.6.5" |
||||||
}, |
}, |
||||||
"formidable": { |
"formidable": { |
||||||
"version": "http://registry.npmjs.org/formidable/-/formidable-1.0.14.tgz" |
"version": "1.0.14" |
||||||
}, |
}, |
||||||
"cookie-signature": { |
"cookie-signature": { |
||||||
"version": "http://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.1.tgz" |
"version": "1.0.1" |
||||||
}, |
}, |
||||||
"buffer-crc32": { |
"buffer-crc32": { |
||||||
"version": "http://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.1.tgz" |
"version": "0.2.1" |
||||||
}, |
}, |
||||||
"cookie": { |
"cookie": { |
||||||
"version": "http://registry.npmjs.org/cookie/-/cookie-0.0.5.tgz" |
"version": "0.0.5" |
||||||
}, |
}, |
||||||
"send": { |
"send": { |
||||||
"version": "http://registry.npmjs.org/send/-/send-0.1.0.tgz", |
"version": "0.1.0", |
||||||
"dependencies": { |
"dependencies": { |
||||||
"mime": { |
"mime": { |
||||||
"version": "http://registry.npmjs.org/mime/-/mime-1.2.6.tgz" |
"version": "1.2.6" |
||||||
}, |
}, |
||||||
"range-parser": { |
"range-parser": { |
||||||
"version": "http://registry.npmjs.org/range-parser/-/range-parser-0.0.4.tgz" |
"version": "0.0.4" |
||||||
} |
} |
||||||
} |
} |
||||||
}, |
}, |
||||||
"bytes": { |
"bytes": { |
||||||
"version": "http://registry.npmjs.org/bytes/-/bytes-0.2.0.tgz" |
"version": "0.2.0" |
||||||
}, |
}, |
||||||
"fresh": { |
"fresh": { |
||||||
"version": "http://registry.npmjs.org/fresh/-/fresh-0.1.0.tgz" |
"version": "0.1.0" |
||||||
}, |
}, |
||||||
"pause": { |
"pause": { |
||||||
"version": "http://registry.npmjs.org/pause/-/pause-0.0.1.tgz" |
"version": "0.0.1" |
||||||
}, |
}, |
||||||
"debug": { |
"debug": { |
||||||
"version": "http://registry.npmjs.org/debug/-/debug-2.2.0.tgz", |
"version": "2.2.0", |
||||||
"dependencies": { |
"dependencies": { |
||||||
"ms": { |
"ms": { |
||||||
"version": "http://registry.npmjs.org/ms/-/ms-0.7.1.tgz" |
"version": "0.7.1" |
||||||
} |
} |
||||||
} |
} |
||||||
} |
} |
||||||
} |
} |
||||||
}, |
}, |
||||||
"querystring": { |
"querystring": { |
||||||
"version": "http://registry.npmjs.org/querystring/-/querystring-0.2.0.tgz" |
"version": "0.2.0" |
||||||
}, |
}, |
||||||
"xml-crypto": { |
"xml-crypto": { |
||||||
"version": "http://registry.npmjs.org/xml-crypto/-/xml-crypto-0.6.0.tgz", |
"version": "0.6.0", |
||||||
"dependencies": { |
"dependencies": { |
||||||
|
"xmldom": { |
||||||
|
"version": "0.1.19" |
||||||
|
}, |
||||||
"xpath.js": { |
"xpath.js": { |
||||||
"version": "http://registry.npmjs.org/xpath.js/-/xpath.js-1.0.6.tgz" |
"version": "1.0.6" |
||||||
} |
} |
||||||
} |
} |
||||||
}, |
}, |
||||||
"xml-encryption": { |
"xml-encryption": { |
||||||
"version": "http://registry.npmjs.org/xml-encryption/-/xml-encryption-0.7.2.tgz", |
"version": "0.7.2", |
||||||
"dependencies": { |
"dependencies": { |
||||||
"ejs": { |
"ejs": { |
||||||
"version": "http://registry.npmjs.org/ejs/-/ejs-0.8.8.tgz" |
"version": "0.8.8" |
||||||
}, |
}, |
||||||
"async": { |
"async": { |
||||||
"version": "http://registry.npmjs.org/async/-/async-0.2.10.tgz" |
"version": "0.2.10" |
||||||
}, |
}, |
||||||
"xpath": { |
"xpath": { |
||||||
"version": "http://registry.npmjs.org/xpath/-/xpath-0.0.5.tgz" |
"version": "0.0.5" |
||||||
}, |
}, |
||||||
"node-forge": { |
"node-forge": { |
||||||
"version": "http://registry.npmjs.org/node-forge/-/node-forge-0.2.24.tgz" |
"version": "0.2.24" |
||||||
} |
} |
||||||
} |
} |
||||||
}, |
}, |
||||||
"xml2js": { |
"xml2js": { |
||||||
"version": "http://registry.npmjs.org/xml2js/-/xml2js-0.2.0.tgz", |
"version": "0.2.0", |
||||||
"dependencies": { |
"dependencies": { |
||||||
"sax": { |
"sax": { |
||||||
"version": "http://registry.npmjs.org/sax/-/sax-1.1.2.tgz" |
"version": "1.1.3" |
||||||
} |
} |
||||||
} |
} |
||||||
}, |
}, |
||||||
"xmlbuilder": { |
"xmlbuilder": { |
||||||
"version": "http://registry.npmjs.org/xmlbuilder/-/xmlbuilder-2.6.4.tgz", |
"version": "2.6.4", |
||||||
"dependencies": { |
"dependencies": { |
||||||
"lodash": { |
"lodash": { |
||||||
"version": "http://registry.npmjs.org/lodash/-/lodash-3.10.1.tgz" |
"version": "3.10.1" |
||||||
} |
} |
||||||
} |
} |
||||||
}, |
}, |
||||||
"xmldom": { |
"xmldom": { |
||||||
"version": "http://registry.npmjs.org/xmldom/-/xmldom-0.1.19.tgz" |
"version": "0.1.19" |
||||||
} |
} |
||||||
} |
} |
||||||
} |
} |
||||||
|
|||||||
@ -0,0 +1,3 @@ |
|||||||
|
Meteor.startup -> |
||||||
|
console.log('startup hooked') |
||||||
|
GoogleMaps.load() |
||||||
@ -0,0 +1,18 @@ |
|||||||
|
|
||||||
|
Template.chatops_droneflight.helpers |
||||||
|
flightMapOptions: -> |
||||||
|
if GoogleMaps.loaded() |
||||||
|
console.log('helper run') |
||||||
|
return {center: new google.maps.LatLng(35.6609285,-78.8456125), zoom: 17} |
||||||
|
|
||||||
|
|
||||||
|
Template.chatops_droneflight.onCreated () -> |
||||||
|
GoogleMaps.ready 'flightMap', (map) -> |
||||||
|
console.log('ready') |
||||||
|
redicon = { path: google.maps.SymbolPath.CIRCLE, fillColor: "red", fillOpacity: 0.8, strokeColor: "gold", strokeWeight: 2, scale: 10} |
||||||
|
greenicon = {path: google.maps.SymbolPath.CIRCLE, fillColor: "green", fillOpacity: 0.8, strokeColor: "gold", strokeWeight: 2, scale: 10} |
||||||
|
|
||||||
|
marker = new google.maps.Marker({position: new google.maps.LatLng(35.661848,-78.843165), icon: redicon, map: map.instance}) |
||||||
|
marker.setLabel('1') |
||||||
|
marker2 = new google.maps.Marker({position: new google.maps.LatLng(35.660537,-78.846959), icon: greenicon, map: map.instance}) |
||||||
|
marker2.setLabel('2') |
||||||
@ -0,0 +1,19 @@ |
|||||||
|
<template name="chatops_droneflight"> |
||||||
|
<div class="control"> |
||||||
|
<div> <b>Drone 1:</b> mission <b>A3</b> waypoint <b>7</b> <span class="red">fuel 30%</span> </div> |
||||||
|
<div> <b>Drone 2:</b> mission <b>A7</b> waypoint <b>2</b> <span class="green">fuel 100%</span> </div> |
||||||
|
</div> |
||||||
|
|
||||||
|
<div class="content"> |
||||||
|
<div class="map-container"> |
||||||
|
{{> googleMap name="flightMap" options=flightMapOptions }} |
||||||
|
</div> |
||||||
|
|
||||||
|
<div class="droneFlight"> |
||||||
|
<button class='button'><span> {{_ "Return to base"}}</span></button> |
||||||
|
<button class='button'><span> {{_ "Cancel"}}</span></button> |
||||||
|
</div> |
||||||
|
|
||||||
|
</div> |
||||||
|
|
||||||
|
</template> |
||||||
@ -0,0 +1,15 @@ |
|||||||
|
|
||||||
|
.map-container { |
||||||
|
width: 670px; |
||||||
|
max-width: 100%; |
||||||
|
height: 500px; |
||||||
|
padding: 5px, 5px, 5px 5px; |
||||||
|
} |
||||||
|
|
||||||
|
.red { |
||||||
|
color: red; |
||||||
|
} |
||||||
|
|
||||||
|
.green { |
||||||
|
color: green; |
||||||
|
} |
||||||
@ -1,29 +1,29 @@ |
|||||||
{ |
{ |
||||||
"dependencies": { |
"dependencies": { |
||||||
"gm": { |
"gm": { |
||||||
"version": "http://registry.npmjs.org/gm/-/gm-1.18.1.tgz", |
"version": "1.18.1", |
||||||
"dependencies": { |
"dependencies": { |
||||||
"debug": { |
"debug": { |
||||||
"version": "http://registry.npmjs.org/debug/-/debug-2.2.0.tgz", |
"version": "2.2.0", |
||||||
"dependencies": { |
"dependencies": { |
||||||
"ms": { |
"ms": { |
||||||
"version": "http://registry.npmjs.org/ms/-/ms-0.7.1.tgz" |
"version": "0.7.1" |
||||||
} |
} |
||||||
} |
} |
||||||
}, |
}, |
||||||
"array-series": { |
"array-series": { |
||||||
"version": "http://registry.npmjs.org/array-series/-/array-series-0.1.5.tgz" |
"version": "0.1.5" |
||||||
}, |
}, |
||||||
"array-parallel": { |
"array-parallel": { |
||||||
"version": "http://registry.npmjs.org/array-parallel/-/array-parallel-0.1.3.tgz" |
"version": "0.1.3" |
||||||
} |
} |
||||||
} |
} |
||||||
}, |
}, |
||||||
"gridfs-stream": { |
"gridfs-stream": { |
||||||
"version": "http://registry.npmjs.org/gridfs-stream/-/gridfs-stream-0.5.3.tgz" |
"version": "0.5.3" |
||||||
}, |
}, |
||||||
"mkdirp": { |
"mkdirp": { |
||||||
"version": "http://registry.npmjs.org/mkdirp/-/mkdirp-0.3.5.tgz" |
"version": "0.3.5" |
||||||
} |
} |
||||||
} |
} |
||||||
} |
} |
||||||
|
|||||||
@ -1,2 +0,0 @@ |
|||||||
Meteor.startup -> |
|
||||||
Meteor.subscribe 'settings' |
|
||||||
@ -0,0 +1,13 @@ |
|||||||
|
<template name="oembedSoundcloudWidget"> |
||||||
|
{{#if parsedUrl}} |
||||||
|
<blockquote> |
||||||
|
<a href="https://www.soundcloud.com" style="color: #9e9ea6">SoundCloud</a><br/> |
||||||
|
{{#if meta.twitterAudioArtistName}} |
||||||
|
<a href="https://www.soundcloud.com/{{meta.twitterAudioArtistName}}">{{meta.twitterAudioArtistName}}</a><br/> |
||||||
|
{{/if}} |
||||||
|
<a href="{{meta.ogUrl}}">{{meta.ogTitle}}</a><br/> |
||||||
|
<p>{{meta.ogDescription}}</p> |
||||||
|
<iframe width="100%" height="150" src="{{meta.twitterPlayer}}" frameborder="0"></iframe><br/> |
||||||
|
</blockquote> |
||||||
|
{{/if}} |
||||||
|
</template> |
||||||
@ -0,0 +1,3 @@ |
|||||||
|
Template.oembedBaseWidget.onCreated () -> |
||||||
|
if this.data?.parsedUrl?.host is 'soundcloud.com' and this.data?.meta?.twitterPlayer? |
||||||
|
this.data._overrideTemplate = 'oembedSoundcloudWidget' |
||||||
@ -0,0 +1,10 @@ |
|||||||
|
RocketChat.callbacks.add 'oembed:beforeGetUrlContent', (data) -> |
||||||
|
# if data.parsedUrl is 'soundcloud.com' |
||||||
|
# Do whatever you whant in sync way |
||||||
|
# You can modify the object data.requestOptions to change how the request will be executed |
||||||
|
|
||||||
|
|
||||||
|
RocketChat.callbacks.add 'oembed:afterParseContent', (data) -> |
||||||
|
# if data.parsedUrl is 'soundcloud.com' |
||||||
|
# Do whatever you whant in sync way |
||||||
|
# You can modify the object data to change the parsed object |
||||||
@ -0,0 +1,26 @@ |
|||||||
|
Package.describe({ |
||||||
|
name: 'rocketchat:soundcloud', |
||||||
|
version: '0.0.1', |
||||||
|
summary: 'Soundcloud integration', |
||||||
|
git: '' |
||||||
|
}); |
||||||
|
|
||||||
|
Package.onUse(function(api) { |
||||||
|
api.versionsFrom('1.0'); |
||||||
|
|
||||||
|
api.use([ |
||||||
|
'rocketchat:lib', |
||||||
|
'coffeescript', |
||||||
|
'templating', |
||||||
|
'rocketchat:oembed@0.0.1' |
||||||
|
]); |
||||||
|
|
||||||
|
api.addFiles('lib/client/widget.coffee', 'client'); |
||||||
|
api.addFiles('lib/client/oembedSoundcloudWidget.html', 'client'); |
||||||
|
|
||||||
|
api.addFiles('lib/server/server.coffee', 'server'); |
||||||
|
}); |
||||||
|
|
||||||
|
Package.onTest(function(api) { |
||||||
|
|
||||||
|
}); |
||||||
@ -1,15 +0,0 @@ |
|||||||
updateTheme = -> |
|
||||||
el = $('#theme')[0] |
|
||||||
if el |
|
||||||
el.href = el.href.replace(/\?.*$/, '') + '?_dc=' + Random.id() |
|
||||||
|
|
||||||
Meteor.startup -> |
|
||||||
connected = Meteor.status().connected |
|
||||||
Tracker.autorun -> |
|
||||||
if connected is false and Meteor.status().connected is true |
|
||||||
updateTheme() |
|
||||||
|
|
||||||
connected = Meteor.status().connected |
|
||||||
|
|
||||||
RocketChat.Notifications.onAll 'theme-updated', -> |
|
||||||
updateTheme() |
|
||||||
@ -1 +1,3 @@ |
|||||||
v0.6.dev |
v0.7.dev |
||||||
|
This is an unsupported non-production development release. |
||||||
|
|
||||||
|
|||||||
@ -0,0 +1,14 @@ |
|||||||
|
Meteor.methods |
||||||
|
getRoomIdByNameOrId: (rid) -> |
||||||
|
|
||||||
|
console.log '[methods] getRoomIdByNameOrId-> '.green, 'userId:', Meteor.userId(), 'arguments:', arguments |
||||||
|
|
||||||
|
room = RocketChat.models.Rooms.findOneById rid |
||||||
|
|
||||||
|
if not room? |
||||||
|
room = RocketChat.models.Rooms.findOneByName rid |
||||||
|
|
||||||
|
if room? |
||||||
|
rid = room._id |
||||||
|
|
||||||
|
return rid |
||||||
@ -0,0 +1,52 @@ |
|||||||
|
describe 'Spotify integration', () -> |
||||||
|
describe 'Spotify id transformer', () -> |
||||||
|
it 'should transform track id to link and add it to message urls', () -> |
||||||
|
message = {'urls': [], 'msg': 'spotify:track:34AWo71Ya5gq7wpNnatwr7'} |
||||||
|
output = RocketChat.Spotify.transform message |
||||||
|
expect(output).toEqual {'urls':[{'url': 'https://open.spotify.com/track/34AWo71Ya5gq7wpNnatwr7', 'source':'spotify:track:34AWo71Ya5gq7wpNnatwr7'}], 'msg': 'spotify:track:34AWo71Ya5gq7wpNnatwr7'} |
||||||
|
|
||||||
|
it 'should transform artist id to link and add it to message urls', () -> |
||||||
|
message = {'urls': [], 'msg': 'spotify:artist:0OdUWJ0sBjDrqHygGUXeCF'} |
||||||
|
output = RocketChat.Spotify.transform message |
||||||
|
expect(output).toEqual {'urls':[{'url': 'https://open.spotify.com/artist/0OdUWJ0sBjDrqHygGUXeCF', 'source': 'spotify:artist:0OdUWJ0sBjDrqHygGUXeCF'}], 'msg': 'spotify:artist:0OdUWJ0sBjDrqHygGUXeCF'} |
||||||
|
|
||||||
|
it 'should transform album id to link and add it to message urls', () -> |
||||||
|
message = {'urls': [], 'msg': 'spotify:album:0sNOF9WDwhWunNAHPD3Baj'} |
||||||
|
output = RocketChat.Spotify.transform message |
||||||
|
expect(output).toEqual {'urls':[{'url': 'https://open.spotify.com/album/0sNOF9WDwhWunNAHPD3Baj', 'source': 'spotify:album:0sNOF9WDwhWunNAHPD3Baj'}], 'msg': 'spotify:album:0sNOF9WDwhWunNAHPD3Baj'} |
||||||
|
|
||||||
|
it 'should transform user playlist id to link and add it to message urls', () -> |
||||||
|
message = {'urls': [], 'msg': 'spotify:user:spotifybrazilian:playlist:4k7EZPI3uKMz4aRRrLVfen'} |
||||||
|
output = RocketChat.Spotify.transform message |
||||||
|
expect(output).toEqual {'urls':[{'url': 'https://open.spotify.com/user/spotifybrazilian/playlist/4k7EZPI3uKMz4aRRrLVfen', 'source': 'spotify:user:spotifybrazilian:playlist:4k7EZPI3uKMz4aRRrLVfen'}], 'msg': 'spotify:user:spotifybrazilian:playlist:4k7EZPI3uKMz4aRRrLVfen'} |
||||||
|
|
||||||
|
it 'should transform id to link even if wrapped around text', () -> |
||||||
|
message = {'urls': [], 'msg': 'a text before spotify:track:34AWo71Ya5gq7wpNnatwr7 a text after'} |
||||||
|
output = RocketChat.Spotify.transform message |
||||||
|
expect(output).toEqual {'urls':[{'url': 'https://open.spotify.com/track/34AWo71Ya5gq7wpNnatwr7', 'source':'spotify:track:34AWo71Ya5gq7wpNnatwr7'}], 'msg': 'a text before spotify:track:34AWo71Ya5gq7wpNnatwr7 a text after'} |
||||||
|
|
||||||
|
it 'should transform id to link and add it to message urls without erasing previous urls', () -> |
||||||
|
message = {'urls': [{'url': 'https://www.youtube.com/watch?v=_ze-sS61mCs'}], 'msg': 'https://www.youtube.com/watch?v=_ze-sS61mCs and spotify:track:34AWo71Ya5gq7wpNnatwr7'} |
||||||
|
output = RocketChat.Spotify.transform message |
||||||
|
expect(output).toEqual {'urls':[{'url': 'https://www.youtube.com/watch?v=_ze-sS61mCs'}, {'url': 'https://open.spotify.com/track/34AWo71Ya5gq7wpNnatwr7', 'source':'spotify:track:34AWo71Ya5gq7wpNnatwr7'}], 'msg': 'https://www.youtube.com/watch?v=_ze-sS61mCs and spotify:track:34AWo71Ya5gq7wpNnatwr7'} |
||||||
|
|
||||||
|
it 'should not apply transformation on links inside inline literal', () -> |
||||||
|
message = {'urls': [], 'msg': '`spotify:track:34AWo71Ya5gq7wpNnatwr7`'} |
||||||
|
output = RocketChat.Spotify.transform message |
||||||
|
expect(output).toEqual message |
||||||
|
|
||||||
|
it 'should not apply transformation on links inside code block', () -> |
||||||
|
message = {'urls': [], 'msg': '``` spotify:track:34AWo71Ya5gq7wpNnatwr7 ```'} |
||||||
|
output = RocketChat.Spotify.transform message |
||||||
|
expect(output).toEqual message |
||||||
|
|
||||||
|
describe 'Spotify id autolinker', () -> |
||||||
|
it 'should autolink spotify id', () -> |
||||||
|
message = RocketChat.Spotify.transform {'urls': [], 'msg': 'spotify:track:34AWo71Ya5gq7wpNnatwr7', 'html': 'spotify:track:34AWo71Ya5gq7wpNnatwr7'} |
||||||
|
output = RocketChat.Spotify.render message |
||||||
|
expect(output.html).toEqual '<a href="https://open.spotify.com/track/34AWo71Ya5gq7wpNnatwr7" target="_blank">spotify:track:34AWo71Ya5gq7wpNnatwr7</a>' |
||||||
|
|
||||||
|
it 'should autolink spotify id even if wrapped around text', () -> |
||||||
|
message = RocketChat.Spotify.transform {'urls': [], 'msg': 'a text before spotify:track:34AWo71Ya5gq7wpNnatwr7 a text after', 'html': 'a text before spotify:track:34AWo71Ya5gq7wpNnatwr7 a text after'} |
||||||
|
output = RocketChat.Spotify.render message |
||||||
|
expect(output.html).toEqual 'a text before <a href="https://open.spotify.com/track/34AWo71Ya5gq7wpNnatwr7" target="_blank">spotify:track:34AWo71Ya5gq7wpNnatwr7</a> a text after' |
||||||
Loading…
Reference in new issue