forked from ushahidi/tenfour
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit d8e5c8d
Showing
536 changed files
with
62,510 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
Rollcall 1.0.0 (Public Beta Launch release) - 19/04/2018 | ||
------------------------------------- | ||
|
||
### Features | ||
|
||
* Rename rollcall endpoint to checkin (https://github.com/ushahidi/tenfour/issues/853) | ||
* Backend TenFour rebrand (https://github.com/ushahidi/tenfour/issues/931) | ||
* Upgrade Laravel (https://github.com/ushahidi/tenfour/issues/899) | ||
* Namespace check-in API under org/:id (https://github.com/ushahidi/tenfour/issues/458) | ||
* No reply options on no answers (https://github.com/ushahidi/tenfour/issues/849) | ||
* Skip CSV duplicates (https://github.com/ushahidi/tenfour/issues/758) | ||
|
||
### Bug Fixes | ||
* test messages need to be more human (https://github.com/ushahidi/tenfour/issues/1028) | ||
* address field not editable (https://github.com/ushahidi/tenfour/issues/824) | ||
* prevent excel from mangling phone numbers in sample CSV (https://github.com/ushahidi/tenfour/issues/1012) | ||
* (s3) add bucket for storing private data (https://github.com/ushahidi/tenfour/issues/103) | ||
* unable to re-set my password (https://github.com/ushahidi/tenfour/issues/984) | ||
* remove yes/no bubbles (https://github.com/ushahidi/tenfour/issues/978) | ||
* TenFour logo broken in emails (https://github.com/ushahidi/tenfour/issues/864) | ||
|
||
|
||
TenFour 1.0.0 (Beta Soft Launch release) - 14/11/2017 | ||
------------------------------------- | ||
|
||
### Features | ||
|
||
* Monitor Message Sending (https://github.com/ushahidi/tenfour/issues/607) | ||
* Invite all users to be a User on CSV Import(https://github.com/ushahidi/tenfour/issues/778) | ||
* Command to Add/Remove ushahidi support user to a organization (https://github.com/ushahidi/tenfour/issues/814) | ||
* Integrate with Analytics (https://github.com/ushahidi/tenfour/issues/72) | ||
* Groups API (https://github.com/ushahidi/tenfour/issues/31) | ||
* Import CSV Job Queue (https://github.com/ushahidi/tenfour/issues/733) | ||
* Virtual number rotation (https://github.com/ushahidi/tenfour/issues/702) | ||
* Notifications for Bounce complaints (https://github.com/ushahidi/tenfour/issues/738) | ||
|
||
### Bug Fixes | ||
* Bug with URL shortener (https://github.com/ushahidi/tenfour/issues/497) | ||
* Fix email templating (https://github.com/ushahidi/tenfour/issues/694) | ||
* Small fixes for CVS import UX improvements (https://github.com/ushahidi/tenfour/issues/762) | ||
* Configure Gateway for UK, Hungary (https://github.com/ushahidi/tenfour/issues/718) | ||
* Tweak Oauth2 refresh tokens config (https://github.com/ushahidi/tenfour/issues/660) | ||
* Throttle Limit (https://github.com/ushahidi/tenfour/issues/769) | ||
* Queue rework (https://github.com/ushahidi/tenfour/issues/812) | ||
|
||
|
||
|
||
TenFour 1.0.0 (Bug Disco release) - 17/08/2017 | ||
------------------------------------- | ||
|
||
### Features | ||
|
||
* Payments system (https://github.com/ushahidi/tenfour/issues/659) | ||
* CSV import of people + contacts(https://github.com/ushahidi/tenfour/issues/92) | ||
* Message credit system (https://github.com/ushahidi/tenfour/issues/23) | ||
* Onboarding a new organization (https://github.com/ushahidi/tenfour/issues/199) | ||
* Unsubscribe from check-ins via email (https://github.com/ushahidi/tenfour/issues/262) | ||
* Default country code setting (https://github.com/ushahidi/tenfour/issues/348) | ||
* Segment Analytics Integration (https://github.com/ushahidi/tenfour/issues/693) | ||
* Select all / Select none when composing check-in (https://github.com/ushahidi/tenfour/issues/629) | ||
|
||
### Bug Fixes | ||
* Less dense check-ins for members (https://github.com/ushahidi/tenfour/issues/497) | ||
* Better formatting of check-in dates (https://github.com/ushahidi/tenfour/issues/681) | ||
* Phone contacts disabled when settings not set (https://github.com/ushahidi/tenfour/issues/712) | ||
* TenFour recommended actions are inverted (https://github.com/ushahidi/tenfour/issues/718) | ||
* Error when verifying new email address during organization setup (https://github.com/ushahidi/tenfour/issues/647) | ||
* Error handling and better messaging (https://github.com/ushahidi/tenfour/issues/530) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
FROM ushahidi/php-fpm-nginx:php-7.2 | ||
|
||
WORKDIR /var/www | ||
|
||
COPY composer.json composer.lock ./ | ||
RUN composer install --no-interaction --no-autoloader --no-scripts | ||
|
||
COPY ./ /var/www/ | ||
RUN chown -R www-data:www-data storage/app storage/clockwork storage/framework storage/logs | ||
|
||
COPY docker/run.run.sh /run.run.sh | ||
RUN $DOCKERCES_MANAGE_UTIL add /run.run.sh | ||
|
||
ENV VHOST_ROOT=/var/www \ | ||
VHOST_INDEX=server.php |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
--- | ||
ip: "192.168.10.10" | ||
memory: 512 | ||
cpus: 1 | ||
hostname: tenfour | ||
name: tenfour | ||
provider: virtualbox | ||
|
||
authorize: ~/.ssh/id_rsa.pub | ||
|
||
keys: | ||
- ~/.ssh/id_rsa | ||
|
||
folders: | ||
- map: "./" | ||
to: "/home/vagrant/tenfour" | ||
|
||
sites: | ||
- map: tenfour.local | ||
to: "/home/vagrant/tenfour/public" | ||
|
||
databases: | ||
- tenfour | ||
|
||
variables: | ||
- key: APP_ENV | ||
value: local | ||
|
||
# blackfire: | ||
# - id: foo | ||
# token: bar | ||
# client-id: foo | ||
# client-token: bar | ||
|
||
# ports: | ||
# - send: 93000 | ||
# to: 9300 | ||
# - send: 7777 | ||
# to: 777 | ||
# protocol: udp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
## TenFour API | ||
|
||
[Get started](docs/getting_started.md) | ||
|
||
## Official Documentation | ||
|
||
[Docs](docs) | ||
|
||
## Contributing | ||
|
||
TODO | ||
|
||
### License | ||
|
||
AGPL |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
require 'json' | ||
require 'yaml' | ||
|
||
VAGRANTFILE_API_VERSION ||= "2" | ||
confDir = $confDir ||= File.expand_path("vendor/laravel/homestead", File.dirname(__FILE__)) | ||
|
||
homesteadYamlPath = "Homestead.yaml" | ||
homesteadJsonPath = "Homestead.json" | ||
afterScriptPath = "after.sh" | ||
aliasesPath = "aliases" | ||
|
||
require File.expand_path(confDir + '/scripts/homestead.rb') | ||
|
||
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| | ||
if File.exists? aliasesPath then | ||
config.vm.provision "file", source: aliasesPath, destination: "~/.bash_aliases" | ||
end | ||
|
||
if File.exists? homesteadYamlPath then | ||
Homestead.configure(config, YAML::load(File.read(homesteadYamlPath))) | ||
elsif File.exists? homesteadJsonPath then | ||
Homestead.configure(config, JSON.parse(File.read(homesteadJsonPath))) | ||
end | ||
|
||
if File.exists? afterScriptPath then | ||
config.vm.provision "shell", path: afterScriptPath | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
<?php | ||
|
||
namespace TenFour\Auth; | ||
|
||
use Illuminate\Support\Str; | ||
use Illuminate\Auth\EloquentUserProvider as IlluminateUserProvider; | ||
|
||
class EloquentUserProvider extends IlluminateUserProvider | ||
{ | ||
/** | ||
* Retrieve a user by the given credentials. | ||
* | ||
* @param array $credentials | ||
* @return \Illuminate\Contracts\Auth\Authenticatable|null | ||
*/ | ||
public function retrieveByCredentials(array $credentials) | ||
{ | ||
if (empty($credentials)) { | ||
return; | ||
} | ||
|
||
// First we will add each credential element to the query as a where clause. | ||
// Then we can execute the query and, if we found a user, return it in a | ||
// Eloquent User "model" that will be utilized by the Guard instances. | ||
$query = $this->createModel()->newQuery(); | ||
|
||
// Check username against all contacts | ||
$query->join('contacts', 'users.id', '=', 'contacts.user_id'); | ||
if ($credentials['username']) { | ||
$credentials['contacts.contact'] = $credentials['username']; | ||
unset($credentials['username']); | ||
} | ||
|
||
// Check subdomain | ||
if ($credentials['subdomain']) { | ||
$query->join('organizations', 'organizations.id', '=', 'contacts.organization_id'); | ||
} | ||
|
||
foreach ($credentials as $key => $value) { | ||
if (! Str::contains($key, 'password')) { | ||
$query->where($key, $value); | ||
} | ||
} | ||
|
||
// Narrow to user details and contact address | ||
$query->select('users.*', 'contacts.contact'); | ||
|
||
// @todo Maybe just set this in the model? | ||
$query->with('organization'); | ||
|
||
return $query->first(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
|
||
namespace TenFour\Channels; | ||
|
||
use TenFour\Messaging\MailService; | ||
|
||
use Illuminate\Notifications\Notifiable; | ||
use Illuminate\Notifications\Notification; | ||
use Log; | ||
|
||
class CheckInMail | ||
{ | ||
/** | ||
* Send the given notification. | ||
* | ||
* @param mixed $notifiable | ||
* @param \Illuminate\Notifications\Notification $notification | ||
* @return void | ||
*/ | ||
public function send($contact, Notification $notification) | ||
{ | ||
$message_service = new MailService; | ||
|
||
$checkInMail = $notification->toMail($contact); | ||
|
||
$message_service->send( | ||
$contact->contact, | ||
$checkInMail, | ||
[ | ||
'check_in_id' => $notification->check_in['id'], | ||
'type' => 'check_in' | ||
] | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
<?php | ||
|
||
namespace TenFour\Channels; | ||
|
||
use TenFour\Messaging\SMSService; | ||
use TenFour\Notifications\CheckInFollowUp; | ||
|
||
use Illuminate\Notifications\Notifiable; | ||
use Illuminate\Notifications\Notification; | ||
|
||
use Log; | ||
use App; | ||
|
||
define('SMS_BYTECOUNT', 140); | ||
define('DELAY_AFTER_FOLLOWUP', 120); | ||
define('DELAY_URL_SMS', 60); | ||
|
||
class CheckInSMS | ||
{ | ||
/** | ||
* Send the given notification. | ||
* | ||
* @param mixed $notifiable | ||
* @param \Illuminate\Notifications\Notification $notification | ||
* @return void | ||
*/ | ||
public function send($contact, Notification $notification) | ||
{ | ||
$this->message_service = new SMSService(); | ||
|
||
$sms = $notification->toSMS($contact); | ||
|
||
$delay = 0; | ||
|
||
if (isset($sms['_last_unreplied_check_in_id'])) { | ||
$contact->notify(new CheckInFollowUp( | ||
$sms['_last_unreplied_check_in_id'], | ||
$notification->organization, | ||
$sms['from'])); | ||
$delay = DELAY_AFTER_FOLLOWUP; | ||
} | ||
|
||
$to = App::make('TenFour\Messaging\PhoneNumberAdapter'); | ||
$to->setRawNumber($contact->contact); | ||
$sms['keyword'] = $this->message_service->getKeyword($to); | ||
$oneway = $this->message_service->isOneWay($to);; | ||
|
||
// TODO add delays to allow SMS messages the time to be received in order #1414 | ||
|
||
if ($this->isURLOnSMSBoundary($oneway?'sms.checkin_oneway':'sms.checkin', $sms)) { | ||
// send sms without check-in url | ||
$check_in_url = $sms['check_in_url']; | ||
unset($sms['check_in_url']); | ||
$this->sendCheckInSMS($sms['from'], $to, $sms['msg'], $sms, $oneway, $delay); | ||
// send check-in url | ||
$this->sendCheckInURLSMS($sms['from'], $to, $check_in_url, $sms, $oneway, $delay+DELAY_URL_SMS); | ||
} else { | ||
// send together | ||
$this->sendCheckInSMS($sms['from'], $to, $sms['msg'], $sms, $oneway, $delay); | ||
} | ||
} | ||
|
||
public function isURLOnSMSBoundary($view, $data, $url_param = 'check_in_url') { | ||
$len_with_url = mb_strlen(view($view, $data)); | ||
$count_with_url = floor($len_with_url / SMS_BYTECOUNT); | ||
|
||
unset($data[$url_param]); | ||
$len_without_url = mb_strlen(view($view, $data)); | ||
$count_without_url = floor($len_without_url / SMS_BYTECOUNT); | ||
|
||
return $count_with_url !== $count_without_url; | ||
} | ||
|
||
private function sendCheckInSMS($from, $to, $msg, $params, $oneway, $delay) { | ||
$params['sms_type'] = 'check_in'; | ||
$this->message_service->setView($oneway?'sms.checkin_oneway':'sms.checkin'); | ||
$this->message_service->send($to, $msg, $params, null, $from, $delay); | ||
} | ||
|
||
private function sendCheckInURLSMS($from, $to, $check_in_url, $params, $oneway, $delay) { | ||
$params['sms_type'] = 'check_in_url'; | ||
$this->message_service->setView($oneway?'sms.checkin_oneway_url':'sms.checkin_url'); | ||
$this->message_service->send($to, $check_in_url, $params, null, $from, $delay); | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
|
||
namespace TenFour\Channels; | ||
|
||
use TenFour\Messaging\FCMService; | ||
|
||
use Illuminate\Notifications\Notification; | ||
|
||
class FCM | ||
{ | ||
/** | ||
* Send the given notification. | ||
* | ||
* @param mixed $notifiable | ||
* @param \Illuminate\Notifications\Notification $notification | ||
* @return void | ||
*/ | ||
public function send($notifiable, Notification $notification) | ||
{ | ||
$params = $notification->toFCM($notifiable); | ||
|
||
$to = $notifiable->deviceTokens()->pluck('token')->toArray(); | ||
|
||
(new FCMService())->send($to, isset($params['msg'])?$params['msg']:'', $params, $params['subject']); | ||
} | ||
} |
Oops, something went wrong.