renaming package external to livechat

pull/802/head
Diego Sampaio 10 years ago
parent 39c6ba6670
commit 7d7be62247
  1. 2
      .meteor/packages
  2. 1
      .meteor/versions
  3. 4
      .travis.yml
  4. 10
      build.sh
  5. 2
      packages/rocketchat-external/app/client/lib/chatMessages.coffee
  6. 2
      packages/rocketchat-external/app/client/methods/sendMessageExternal.coffee
  7. 2
      packages/rocketchat-external/app/client/routes/router.coffee
  8. 6
      packages/rocketchat-external/app/client/startup/visitor.coffee
  9. 4
      packages/rocketchat-external/app/client/stylesheets/main.less
  10. 2
      packages/rocketchat-external/app/client/views/room.html
  11. 6
      packages/rocketchat-external/livechat.coffee
  12. 4
      packages/rocketchat-external/methods.coffee
  13. 16
      packages/rocketchat-external/package.js
  14. 4
      packages/rocketchat-external/plugin/build-external.js
  15. 14
      packages/rocketchat-external/plugin/build.sh
  16. 4
      packages/rocketchat-external/rocket-external.js
  17. 26
      packages/rocketchat-lib/server/sendMessage.coffee
  18. 15
      server/methods/createDirectMessage.coffee

@ -42,7 +42,7 @@ rocketchat:slashcommands-join
rocketchat:slashcommands-leave
rocketchat:statistics
rocketchat:webrtc
#rocketchat:external
rocketchat:livechat
#rocketchat:hubot
#rocketchat:irc

@ -104,6 +104,7 @@ rocketchat:autolinker@0.0.1
rocketchat:colors@0.0.1
rocketchat:custom-oauth@1.0.0
rocketchat:emojione@0.0.1
rocketchat:livechat@0.0.1
rocketchat:favico@0.0.1
rocketchat:file@0.0.1
rocketchat:gitlab@0.0.1

@ -7,6 +7,6 @@ before_install:
- "curl https://install.meteor.com | /bin/sh"
script:
- meteor add rocketchat:external
- meteor add rocketchat:livechat
- meteor add rocketchat:hubot
- meteor build --server demo.rocket.chat ./
- meteor build --server demo.rocket.chat ./

@ -1,10 +0,0 @@
#!/bin/bash
source ./build-info.sh
export METEOR_SETTINGS=$(cat settings.json)
meteor add rocketchat:external
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

@ -87,7 +87,7 @@ class @ChatMessages
else
#Run to allow local encryption
# Meteor.call 'onClientBeforeSendMessage', {}
Meteor.call 'sendMessageExternal', msgObject, (error, result) ->
Meteor.call 'sendMessageLivechat', msgObject, (error, result) ->
if error
ChatMessage.update msgObject._id, { $set: { error: true } }
showError error.reason

@ -1,5 +1,5 @@
Meteor.methods
sendMessageExternal: (message) ->
sendMessageLivechat: (message) ->
if s.trim(message.msg) isnt ''
message.ts = new Date(Date.now() + TimeSync.serverOffset())

@ -1,4 +1,4 @@
FlowRouter.route '/external',
FlowRouter.route '/livechat',
name: 'index'
triggersEnter: [

@ -1,7 +1,7 @@
@visitorId = new ReactiveVar null
Meteor.startup ->
if not localStorage.getItem('rocketChatExternal')?
localStorage.setItem('rocketChatExternal', Random.id())
if not localStorage.getItem('rocketChatLivechat')?
localStorage.setItem('rocketChatLivechat', Random.id())
visitorId.set localStorage.getItem('rocketChatExternal')
visitorId.set localStorage.getItem('rocketChatLivechat')

@ -40,7 +40,7 @@ input:focus {
box-shadow: 0 0 0;
}
.external-room {
.livechat-room {
position: fixed;
top: 0;
bottom: 0;
@ -321,7 +321,7 @@ input:focus {
}
@media all and(max-height: 200px) {
.external-room {
.livechat-room {
.title {
height: 100%;
}

@ -1,5 +1,5 @@
<template name="room">
<div class="external-room">
<div class="livechat-room">
<div class="title">
<h1>Rocket.Chat</h1>
</div>

@ -1,7 +1,7 @@
WebApp = Package.webapp.WebApp
Autoupdate = Package.autoupdate.Autoupdate
WebApp.connectHandlers.use '/external/', (req, res, next) ->
WebApp.connectHandlers.use '/livechat/', (req, res, next) ->
res.setHeader 'content-type', 'html'
head = Assets.getText('public/head.html')
@ -9,7 +9,7 @@ WebApp.connectHandlers.use '/external/', (req, res, next) ->
html = """
<html>
<head>
<link rel="stylesheet" type="text/css" class="__meteor-css__" href="/packages/rocketchat_external/public/external.css?_dc=#{Autoupdate.autoupdateVersion}">
<link rel="stylesheet" type="text/css" class="__meteor-css__" href="/packages/rocketchat_livechat/public/livechat.css?_dc=#{Autoupdate.autoupdateVersion}">
<script type="text/javascript">
__meteor_runtime_config__ = {
"meteorRelease": "METEOR@1.1.0.2",
@ -20,7 +20,7 @@ WebApp.connectHandlers.use '/external/', (req, res, next) ->
"autoupdateVersionCordova": "#{Autoupdate.autoupdateVersionCordova}"
};
</script>
<script type="text/javascript" src="/packages/rocketchat_external/public/external.js?_dc=#{Autoupdate.autoupdateVersion}"></script>
<script type="text/javascript" src="/packages/rocketchat_livechat/public/livechat.js?_dc=#{Autoupdate.autoupdateVersion}"></script>
#{head}
</head>

@ -32,8 +32,8 @@ Meteor.methods
pass: pass
}
sendMessageExternal: (message) ->
console.log 'sendMessageExternal ->',arguments
sendMessageLivechat: (message) ->
console.log 'sendMessageLivechat ->',arguments
check message.rid, String
check message.token, String

@ -1,14 +1,14 @@
Package.describe({
name: 'rocketchat:external',
name: 'rocketchat:livechat',
version: '0.0.1',
summary: 'External for Rocket.Chat'
summary: 'Livechat plugin for Rocket.Chat'
});
Package.registerBuildPlugin({
name: "builExternal",
name: "builLivechat",
use: [],
sources: [
'plugin/build-external.js'
'plugin/build-livechat.js'
],
npmDependencies: {
"shelljs": "0.5.1"
@ -20,12 +20,12 @@ Package.onUse(function(api) {
api.use(['coffeescript', 'webapp', 'autoupdate'], 'server');
api.addFiles('external.coffee', 'server');
api.addFiles('livechat.coffee', 'server');
api.addFiles('methods.coffee', 'server');
api.addFiles('publications.coffee', 'server');
api.addFiles('rocket-external.js', 'client', {isAsset: true});
api.addFiles('public/external.css', 'client', {isAsset: true});
api.addFiles('public/external.js', 'client', {isAsset: true});
api.addFiles('rocket-livechat.js', 'client', {isAsset: true});
api.addFiles('public/livechat.css', 'client', {isAsset: true});
api.addFiles('public/livechat.js', 'client', {isAsset: true});
api.addFiles('public/head.html', 'server', {isAsset: true});
});

@ -3,7 +3,7 @@ var path = Npm.require('path');
var shell = Npm.require('shelljs');
var curPath = path.resolve('.')
var packagePath = path.join(path.resolve('.'), 'packages', 'rocketchat-external');
var packagePath = path.join(path.resolve('.'), 'packages', 'rocketchat-livechat');
var pluginPath = path.join(packagePath, 'plugin');
shell.exec('sh '+pluginPath+'/build.sh');
shell.exec('sh '+pluginPath+'/build.sh');

@ -1,16 +1,16 @@
cd packages/rocketchat-external/app
cd packages/rocketchat-livechat/app
meteor build .meteor/build/ --directory
mkdir -p ../public
rm -f ../public/external.css
rm -f ../public/external.js
rm -f ../public/livechat.css
rm -f ../public/livechat.js
rm -f ../public/head.html
cp .meteor/build/bundle/programs/web.browser/*.css ../public/external.css
cp .meteor/build/bundle/programs/web.browser/*.js ../public/external.js
cp .meteor/build/bundle/programs/web.browser/*.css ../public/livechat.css
cp .meteor/build/bundle/programs/web.browser/*.js ../public/livechat.js
cp .meteor/build/bundle/programs/web.browser/head.html ../public/head.html
# echo "body {background-color: red;}" > external.css
# echo "body {background-color: red;}" > livechat.css
rm -rf .meteor/build/
rm -rf .meteor/build/

@ -4,9 +4,9 @@
// var h = d.getElementsByTagName(s)[0],
// j = d.createElement(s);
// j.async = true;
// j.src = 'rocket-external.js';
// j.src = 'rocket-livechat.js';
// h.parentNode.insertBefore(j, h);
// })(window, document, 'script', 'initRocket', 'http://localhost:5000/external');
// })(window, document, 'script', 'initRocket', 'http://localhost:5000/livechat');
// </script>
;(function(w) {

@ -53,6 +53,32 @@ RocketChat.sendMessage = (user, message, room, options) ->
Meteor.defer ->
if not room.t? or room.t is 'd'
otherUser = null
if room.usernames[0]
room.usernames.some (username) ->
if username isnt user.username
otherUser = username
return true
to = Meteor.users.findOne { username: otherUser }, { fields: { _id: 1, username: 1 } }
# Make user the target user has a subcription to this room
ChatSubscription.upsert
rid: message.rid
$and: [{'u._id': to._id}]
,
$setOnInsert:
name: me.username
t: 'd'
open: false
alert: false
unread: 0
u:
_id: to._id
username: to.username
###
Update the other subscriptions
###

@ -49,21 +49,6 @@ Meteor.methods
_id: me._id
username: me.username
# Make user the target user has a subcription to this room
ChatSubscription.upsert
rid: rid
$and: [{'u._id': to._id}]
,
$setOnInsert:
name: me.username
t: 'd'
open: false
alert: false
unread: 0
u:
_id: to._id
username: to.username
return {
rid: rid
}

Loading…
Cancel
Save