Skip to content

Commit

Permalink
Merge pull request #1709 from ushahidi/develop
Browse files Browse the repository at this point in the history
Merge Develop to Feat/Gmail Data Source
  • Loading branch information
webong committed Sep 10, 2021
2 parents 6616a96 + b63fb30 commit b06e620
Show file tree
Hide file tree
Showing 27 changed files with 229 additions and 149 deletions.
39 changes: 27 additions & 12 deletions .github/workflows/test-and-ship.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,28 +67,43 @@ jobs:
steps:
- uses: actions/checkout@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ECR_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_ECR_SECRET_ACCESS_KEY }}
aws-region: eu-west-1

- name: Get ECR password
id: get-ecr-password
run: echo "::set-output name=password::$(aws ecr get-login-password)"
- name: Login to AWS Container Registry
uses: docker/login-action@v1
with:
registry: 513259414768.dkr.ecr.eu-west-1.amazonaws.com

- name: Docker meta
id: meta
uses: docker/metadata-action@v3
with:
images: |
513259414768.dkr.ecr.eu-west-1.amazonaws.com/platform-client
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=sha
- name: Build and push to Amazon ECR
uses: docker/build-push-action@v1
uses: docker/build-push-action@v2
with:
registry: 513259414768.dkr.ecr.eu-west-1.amazonaws.com
repository: platform-client
username: AWS
password: ${{ steps.get-ecr-password.outputs.password }}
always_pull: true
tag_with_sha: true
tag_with_ref: true
pull: true
push: ${{ github.event_name != 'pull_request' }}
labels: ${{ steps.meta.outputs.labels }}
tags: ${{ steps.meta.outputs.tags }}
cache-from: type=gha
cache-to: type=gha,mode=max

- name: Logout from Amazon ECR
if: always()
run: docker logout ${{ steps.login-ecr.outputs.registry }}
run: docker logout ${{ steps.login-ecr.outputs.registry }}
114 changes: 87 additions & 27 deletions app/common/controllers/intercom.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ function (
$scope.stopIntercom = stopIntercom;

activate();

function activate() {
$rootScope.$on('event:authentication:login:succeeded', function () {
$scope.startIntercom();
Expand All @@ -34,41 +35,100 @@ function (
$scope.startIntercom();
}
}
// This gets the app-id,used to be in index.html
function getAppId() {
if (typeof window.intercomSettings !== 'undefined' &&
typeof(window.intercomSettings.app_id) !== 'undefined') {
return window.intercomSettings.app_id
} else if (typeof window.analytics !== 'undefined' &&
typeof window.analytics._integrations !== 'undefined' &&
typeof analytics._integrations.Intercom !== 'undefined' &&
typeof analytics._integrations.Intercom.options !== 'undefined' &&
typeof analytics._integrations.Intercom.options.appId !== 'undefined') {
return analytics._integrations.Intercom.options.appId;
} else {
return '';
}
}

// Loads the intercom-script when needed
function loadIntercomScript (intercomOptions) {
return new Promise((resolve, reject) => {
// With inspiration from https://github.com/calibreapp/react-live-chat-loader, adjusted for AngularJs
var w = $window;
var ic = w.Intercom;
// Checking if Intercom is already loaded
if (typeof ic === 'function') {
ic('reattach_activator');
//eslint-disable-next-line no-undef
ic('update', intercomOptions);

} else {
// If not loaded, we add it
var d = document;
var i = function() {
i.c(arguments);
}
i.q = [];
i.c = function(args) {
i.q.push(args);
}
w.Intercom = i;
//eslint-disable-next-line no-inner-declarations
function l() {
var s = d.createElement('script');
s.type = 'text/javascript';
s.async = true;
s.src = `https://widget.intercom.io/widget/${getAppId()}`;
var x = d.getElementsByTagName('script')[0];
x.parentNode.insertBefore(s, x);
$window.Intercom('boot', intercomOptions);
}
l();
}
resolve();
}, err => {
reject(err);
});
}

function startIntercom() {
if ($window.ushahidi.intercomAppId !== '') {
$q.all([
ConfigEndpoint.get({ id: 'site' }).$promise,
UserEndpoint.getFresh({id: 'me'}).$promise
]).then(function (results) {
var site = results[0];
var user = results[1];
var domain = $location.host();
if ($window.ushahidi.intercomAppId !== '') {
// First we get all the user-info needed
$q.all([
ConfigEndpoint.get({ id: 'site' }).$promise,
UserEndpoint.getFresh({id: 'me'}).$promise
]).then(function (results) {
var site = results[0];
var user = results[1];
var domain = $location.host();

$window.Intercom('boot', {
app_id: $window.ushahidi.intercomAppId,
custom_launcher_selector: '#intercom_custom_launcher',
hide_default_launcher: true,
email: user.email,
created_at: user.created,
user_id: domain + '_' + user.id,
'deployment_url': domain,
'realname' : user.realname,
'last_login': user.last_login,
'role': user.role,
company: {
name: site.name,
id: domain,
created_at: 0, // Faking this because we don't have this data
plan: site.tier
let intercomOptions = {
app_id: $window.ushahidi.intercomAppId,
custom_launcher_selector: '#intercom_custom_launcher',
email: user.email,
created_at: user.created,
user_id: domain + '_' + user.id,
'deployment_url': domain,
'realname' : user.realname,
'last_login': user.last_login,
'role': user.role,
company: {
name: site.name,
id: domain,
created_at: 0, // Faking this because we don't have this data
plan: site.tier
}
}
// Then we load the intercom-script
loadIntercomScript(intercomOptions)
});
});
}
}
}

function stopIntercom() {
if ($window.ushahidi.intercomAppId !== '') {
// Checking if Intercom was loaded before stopping it
if ($window.ushahidi.intercomAppId !== '' && typeof $window.Intercom === 'function') {
$window.Intercom('shutdown');
}
}
Expand Down
4 changes: 4 additions & 0 deletions app/common/locales/ar.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@
},
"donate": "Donate",
"donation": "Donation",
"disable_monetization": "Disable Monetization",
"enable_monetization": "Enable Monetization",
"enable_monetization_error": "Fill in required fields above before enabling monetization.",
"enable_monetization_info": "Monetization is currently disabled.",
"intercom": {
"intercom": "نظام الإتصال الداخلي",
"description": "قم بتواصل مع موظفين اوشاهيدي لدردشة الدعم"
Expand Down
4 changes: 4 additions & 0 deletions app/common/locales/bg-BG.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@
},
"donate": "Donate",
"donation": "Donation",
"disable_monetization": "Disable Monetization",
"enable_monetization": "Enable Monetization",
"enable_monetization_error": "Fill in required fields above before enabling monetization.",
"enable_monetization_info": "Monetization is currently disabled.",
"intercom": {
"intercom": "Intercom",
"description": "Свържи се с екипа на Ushahidi за поддържка през чат"
Expand Down
4 changes: 4 additions & 0 deletions app/common/locales/cs.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@
},
"donate": "Darujte",
"donation": "Dary",
"disable_monetization": "Zakázat zpeněžení",
"enable_monetization": "Povolit zpeněžení",
"enable_monetization_error": "Před povolením zpeněžení vyplňte výše uvedená povinná pole.",
"enable_monetization_info": "Monetizace je v současné době vypnutá.",
"intercom": {
"intercom": "Intercom",
"description": "Kontaktovat pracovníky Ushahidi pro podporu chatu"
Expand Down
4 changes: 4 additions & 0 deletions app/common/locales/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@
},
"donate": "Donate",
"donation": "Donation",
"disable_monetization": "Disable Monetization",
"enable_monetization": "Enable Monetization",
"enable_monetization_error": "Fill in required fields above before enabling monetization.",
"enable_monetization_info": "Monetization is currently disabled.",
"intercom": {
"intercom": "Intercom",
"description": "Contact Ushahidi staff for chat support"
Expand Down
4 changes: 4 additions & 0 deletions app/common/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@
},
"donate": "Donate",
"donation": "Donation",
"disable_monetization": "Disable Monetization",
"enable_monetization": "Enable Monetization",
"enable_monetization_error": "Fill in required fields above before enabling monetization.",
"enable_monetization_info": "Monetization is currently disabled.",
"intercom": {
"intercom" : "Intercom",
"description" : "Contact Ushahidi staff for chat support"
Expand Down
4 changes: 4 additions & 0 deletions app/common/locales/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@
},
"donate": "Donar",
"donation": "Donación",
"disable_monetization": "Disable Monetization",
"enable_monetization": "Enable Monetization",
"enable_monetization_error": "Fill in required fields above before enabling monetization.",
"enable_monetization_info": "Monetization is currently disabled.",
"intercom": {
"intercom": "Interfono",
"description": "Contacte con el personal de Ushahidi para asistencia por mensajería instantánea"
Expand Down
4 changes: 4 additions & 0 deletions app/common/locales/fa-IR.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@
},
"donate": "Donate",
"donation": "Donation",
"disable_monetization": "Disable Monetization",
"enable_monetization": "Enable Monetization",
"enable_monetization_error": "Fill in required fields above before enabling monetization.",
"enable_monetization_info": "Monetization is currently disabled.",
"intercom": {
"intercom": "ارتباط داخلی",
"description": "تماس با کارمندان Ushahidi برای پشتیبانی از طریق چت"
Expand Down
4 changes: 4 additions & 0 deletions app/common/locales/fr-FR.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@
},
"donate": "Donate",
"donation": "Donation",
"disable_monetization": "Disable Monetization",
"enable_monetization": "Enable Monetization",
"enable_monetization_error": "Fill in required fields above before enabling monetization.",
"enable_monetization_info": "Monetization is currently disabled.",
"intercom": {
"intercom": "Intercom",
"description": "Contacter l'assistance Ushahidi via le chat"
Expand Down
4 changes: 4 additions & 0 deletions app/common/locales/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@
},
"donate": "Donate",
"donation": "Donation",
"disable_monetization": "Disable Monetization",
"enable_monetization": "Enable Monetization",
"enable_monetization_error": "Fill in required fields above before enabling monetization.",
"enable_monetization_info": "Monetization is currently disabled.",
"intercom": {
"intercom": "Intercom",
"description": "Contact Ushahidi staff for chat support"
Expand Down
4 changes: 4 additions & 0 deletions app/common/locales/hr.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@
},
"donate": "Donate",
"donation": "Donation",
"disable_monetization": "Disable Monetization",
"enable_monetization": "Enable Monetization",
"enable_monetization_error": "Fill in required fields above before enabling monetization.",
"enable_monetization_info": "Monetization is currently disabled.",
"intercom": {
"intercom": "Intercom",
"description": "Kontaktiraj Ushahidi tim kroz chat podršku"
Expand Down
4 changes: 4 additions & 0 deletions app/common/locales/hu.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@
},
"donate": "Donate",
"donation": "Donation",
"disable_monetization": "Disable Monetization",
"enable_monetization": "Enable Monetization",
"enable_monetization_error": "Fill in required fields above before enabling monetization.",
"enable_monetization_info": "Monetization is currently disabled.",
"intercom": {
"intercom": "Intercom",
"description": "Lépj kapcsolatba az Ushahidi csapatával, hogy csetes támogatást kaphass"
Expand Down
4 changes: 4 additions & 0 deletions app/common/locales/hy.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@
},
"donate": "Նվիրաբերել",
"donation": "Նվիրաբերություն",
"disable_monetization": "Disable Monetization",
"enable_monetization": "Enable Monetization",
"enable_monetization_error": "Fill in required fields above before enabling monetization.",
"enable_monetization_info": "Monetization is currently disabled.",
"intercom": {
"intercom": "Intercom",
"description": "Կապ հաստատել «Ushahidi»-ի անձնակազմի հետ չատով օգնություն ստանալու համար"
Expand Down
4 changes: 4 additions & 0 deletions app/common/locales/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@
},
"donate": "Donate",
"donation": "Donation",
"disable_monetization": "Disable Monetization",
"enable_monetization": "Enable Monetization",
"enable_monetization_error": "Fill in required fields above before enabling monetization.",
"enable_monetization_info": "Monetization is currently disabled.",
"intercom": {
"intercom": "Intercom",
"description": "チャットのサポートについては、ウシャヒディのスタッフにお問い合わせください。"
Expand Down
4 changes: 4 additions & 0 deletions app/common/locales/nl.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@
},
"donate": "Donate",
"donation": "Donation",
"disable_monetization": "Disable Monetization",
"enable_monetization": "Enable Monetization",
"enable_monetization_error": "Fill in required fields above before enabling monetization.",
"enable_monetization_info": "Monetization is currently disabled.",
"intercom": {
"intercom": "Intercom",
"description": "Neem contact op met een Ushahidi medewerker voor ondersteuning"
Expand Down
4 changes: 4 additions & 0 deletions app/common/locales/pt-BR.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@
},
"donate": "Donate",
"donation": "Donation",
"disable_monetization": "Disable Monetization",
"enable_monetization": "Enable Monetization",
"enable_monetization_error": "Fill in required fields above before enabling monetization.",
"enable_monetization_info": "Monetization is currently disabled.",
"intercom": {
"intercom": "Intercom",
"description": "Contact Ushahidi staff for chat support"
Expand Down
4 changes: 4 additions & 0 deletions app/common/locales/zh-TW.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@
},
"donate": "Donate",
"donation": "Donation",
"disable_monetization": "Disable Monetization",
"enable_monetization": "Enable Monetization",
"enable_monetization_error": "Fill in required fields above before enabling monetization.",
"enable_monetization_info": "Monetization is currently disabled.",
"intercom": {
"intercom": "Intercom線上客服",
"description": "聯絡 Ushahidi 公司來取得線上聊天功能"
Expand Down
Loading

0 comments on commit b06e620

Please sign in to comment.