Skip to content

Commit

Permalink
Update from upstream repo CachetHQ/Cachet (#1)
Browse files Browse the repository at this point in the history
* New translations cachet.php (Portuguese)

* New translations cachet.php (Polish)

* New translations cachet.php (Romanian)

* New translations cachet.php (Japanese)

* New translations cachet.php (Korean)

* New translations cachet.php (Norwegian)

* New translations forms.php (Norwegian)

* New translations cachet.php (Persian)

* New translations cachet.php (Russian)

* New translations cachet.php (Ukrainian)

* New translations cachet.php (Vietnamese)

* New translations cachet.php (Zulu)

* New translations forms.php (Zulu)

* New translations cachet.php (Estonian)

* New translations cachet.php (Spanish)

* New translations cachet.php (Swedish)

* New translations cachet.php (Thai)

* New translations cachet.php (Turkish)

* New translations cachet.php (Chinese Traditional)

* New translations cachet.php (Czech)

* New translations cachet.php (Danish)

* New translations cachet.php (Dutch)

* New translations forms.php (Dutch)

* New translations forms.php (Chinese Simplified)

* New translations cachet.php (Arabic)

* New translations cachet.php (Albanian)

* New translations cachet.php (Catalan)

* New translations cachet.php (Chinese Simplified)

* New translations cachet.php (Hebrew)

* New translations cachet.php (Hungarian)

* New translations cachet.php (Indonesian)

* New translations cachet.php (Italian)

* New translations cachet.php (Greek)

* New translations cachet.php (English)

* New translations cachet.php (Finnish)

* New translations cachet.php (French)

* New translations cachet.php (German)

* Fix configuring postgres leads to wrong database driver key

* Add warning when setting up localhost with mysql driver

* Explicitly set the port number when not using traditional ports

* Add support for empty values in the persistEnv method

* [Security] Bump url-parse from 1.4.1 to 1.4.4

Bumps [url-parse](https://github.com/unshiftio/url-parse) from 1.4.1 to 1.4.4. **This update includes security fixes.**
- [Release notes](https://github.com/unshiftio/url-parse/releases)
- [Commits](unshiftio/url-parse@1.4.1...1.4.4)

Signed-off-by: dependabot[bot] <[email protected]>

* Use PHP Debugger(phpdbg) for PHPUnit to speed up CI

* Improve database performance by removing duplicated queries

* StyleCI

* Eager load user on the incident page not to query twice

* Eager load group on the dashboard/components page not to query twice

* Improve database performance by removing duplicated queries

* StyleCI

* Resolve cachethq#3269

* Resolve cachethq#3288
If Binput::get('enabled') is not defined this will return NULL which resulted in a false.
Updated tests

* New translations cachet.php (Swedish)

* New translations dashboard.php (Swedish)

* Apply fixes from StyleCI

* Update deps

* Drop support for RSS & Atom feeds.

* Update Blade files

* Don't expose current mail password

* Rebuilt composer.lock

* Bump laravolt/avatar from 1.8.1 to 2.1.0

Bumps [laravolt/avatar](https://github.com/laravolt/avatar) from 1.8.1 to 2.1.0.
- [Release notes](https://github.com/laravolt/avatar/releases)
- [Changelog](https://github.com/laravolt/avatar/blob/master/CHANGELOG.md)
- [Commits](laravolt/avatar@1.8.1...2.1.0)

Signed-off-by: dependabot[bot] <[email protected]>

* Bump laravel-mix-purgecss from 2.2.0 to 3.0.0

Bumps [laravel-mix-purgecss](https://github.com/spatie/laravel-mix-purgecss) from 2.2.0 to 3.0.0.
- [Release notes](https://github.com/spatie/laravel-mix-purgecss/releases)
- [Changelog](https://github.com/spatie/laravel-mix-purgecss/blob/master/CHANGELOG.md)
- [Commits](spatie/laravel-mix-purgecss@2.2.0...3.0.0)

Signed-off-by: dependabot[bot] <[email protected]>

* Upgraded JS deps and rebuilt assets

* GitHub now supports transferring an issue

* Remove unused $config property

* Apply fixes from StyleCI

* Upgraded to Laravel 5.7

* Deal with settings read/write errors properly

* Apply fixes from StyleCI

* Commit new vendor files

* Apply fixes from StyleCI

* Fixed up vendor views

* Updated doctrine and emoji packages

* Set the mail username optional in setup

During the setup process email informations were asked:
  - Driver
  - Host
  - Username
  - Password

In some situations the username is not useful because the Cachet's
host may be configured to forward email to a server.

The problem is the username was required, so we had to set a username
and then update the .env file to remove it.

To fix this problem, the mail username has been set to optional in
the setup. So if someone needs a username it still can use this field,
and otherwise people can let it empty.

See: cachethq#3244

* Let the mail_username required except for sendmail

During the setup the "mail_username" was required and it was then
undone, so using the sendmail driver we can let the username empty.

It would be bad to let the username optional for every drivers, because
in some configurations, like SMTP, the username is required for the SMTP
server so if the user let it empty its mail configuration will be bad.

The mail_username is now optional only if the mail driver is sendmail.

See: cachethq#3244

* Apply fixes from StyleCI

* Upgraded dependencies following XSS vulnerability discovery

* Use safer markdown defaults

* [Security] Bump twig/twig from 1.36.0 to 2.6.0

Bumps [twig/twig](https://github.com/twigphp/Twig) from 1.36.0 to 2.6.0. **This update includes security fixes.**
- [Release notes](https://github.com/twigphp/Twig/releases)
- [Changelog](https://github.com/twigphp/Twig/blob/2.x/CHANGELOG)
- [Commits](twigphp/Twig@v1.36.0...v2.6.0)

Signed-off-by: dependabot[bot] <[email protected]>

* New translations forms.php (Dutch)

* New translations cachet.php (German)

* New translations pagination.php (German)

* Apply fixes from StyleCI

* Bump doctrine/dbal from 2.9.1 to 2.9.2

Bumps [doctrine/dbal](https://github.com/doctrine/dbal) from 2.9.1 to 2.9.2.
- [Release notes](https://github.com/doctrine/dbal/releases)
- [Commits](doctrine/dbal@v2.9.1...v2.9.2)

Signed-off-by: dependabot[bot] <[email protected]>

* Bump laravel-mix and laravel-mix-purgecss

Bumps [laravel-mix](https://github.com/JeffreyWay/laravel-mix) and [laravel-mix-purgecss](https://github.com/spatie/laravel-mix-purgecss). These dependencies needed to be updated together.

Updates `laravel-mix` from 2.1.14 to 4.0.12
- [Release notes](https://github.com/JeffreyWay/laravel-mix/releases)
- [Commits](laravel-mix/laravel-mix@v2.1.14...v4.0.12)

Updates `laravel-mix-purgecss` from 3.0.0 to 4.0.0
- [Release notes](https://github.com/spatie/laravel-mix-purgecss/releases)
- [Changelog](https://github.com/spatie/laravel-mix-purgecss/blob/master/CHANGELOG.md)
- [Commits](spatie/laravel-mix-purgecss@3.0.0...4.0.0)

Signed-off-by: dependabot[bot] <[email protected]>

* Bump LICENSE year

* New translations validation.php (Dutch)

* Link to Exascale sponsor

* Extra dependencies were required

* Revert "Bump laravel-mix and laravel-mix-purgecss"

* Remove Gulp and update requirements lists

* Use Twig namespaces

* Move overview up

* Add documentation

* Improve database performance by removing duplicated queries

* Typo in phpdoc

* Revert "Typo in phpdoc"

This reverts commit af94758.

* Typo in phpdoc

* Bump symfony/dom-crawler from 4.2.1 to 4.2.2

Bumps [symfony/dom-crawler](https://github.com/symfony/dom-crawler) from 4.2.1 to 4.2.2.
- [Release notes](https://github.com/symfony/dom-crawler/releases)
- [Changelog](https://github.com/symfony/dom-crawler/blob/master/CHANGELOG.md)
- [Commits](symfony/dom-crawler@v4.2.1...v4.2.2)

Signed-off-by: dependabot[bot] <[email protected]>

* Bump aws/aws-sdk-php from 3.82.3 to 3.82.6

Bumps [aws/aws-sdk-php](https://github.com/aws/aws-sdk-php) from 3.82.3 to 3.82.6.
- [Release notes](https://github.com/aws/aws-sdk-php/releases)
- [Changelog](https://github.com/aws/aws-sdk-php/blob/master/CHANGELOG.md)
- [Commits](aws/aws-sdk-php@3.82.3...3.82.6)

Signed-off-by: dependabot[bot] <[email protected]>

* New translations forms.php (Dutch)

* New translations dashboard.php (Dutch)

* New translations validation.php (Dutch)

* New translations cachet.php (Dutch)

* Bump fideloper/proxy from 4.0.0 to 4.1.0

Bumps [fideloper/proxy](https://github.com/fideloper/TrustedProxy) from 4.0.0 to 4.1.0.
- [Release notes](https://github.com/fideloper/TrustedProxy/releases)
- [Commits](fideloper/TrustedProxy@4.0.0...4.1.0)

Signed-off-by: dependabot[bot] <[email protected]>

* [Security] Bump twig/twig from 2.6.0 to 2.6.2

Bumps [twig/twig](https://github.com/twigphp/Twig) from 2.6.0 to 2.6.2. **This update includes security fixes.**
- [Release notes](https://github.com/twigphp/Twig/releases)
- [Changelog](https://github.com/twigphp/Twig/blob/2.x/CHANGELOG)
- [Commits](twigphp/Twig@v2.6.0...v2.6.2)

Signed-off-by: dependabot[bot] <[email protected]>

* Bump aws/aws-sdk-php from 3.82.6 to 3.86.2

Bumps [aws/aws-sdk-php](https://github.com/aws/aws-sdk-php) from 3.82.6 to 3.86.2.
- [Release notes](https://github.com/aws/aws-sdk-php/releases)
- [Changelog](https://github.com/aws/aws-sdk-php/blob/master/CHANGELOG.md)
- [Commits](aws/aws-sdk-php@3.82.6...3.86.2)

Signed-off-by: dependabot[bot] <[email protected]>

* Bump laravel/framework from 5.7.19 to 5.7.21

Bumps [laravel/framework](https://github.com/laravel/framework) from 5.7.19 to 5.7.21.
- [Release notes](https://github.com/laravel/framework/releases)
- [Changelog](https://github.com/laravel/framework/blob/5.7/CHANGELOG-5.7.md)
- [Commits](laravel/framework@v5.7.19...v5.7.21)

Signed-off-by: dependabot[bot] <[email protected]>

* New translations cachet.php (German)

* New translations dashboard.php (German)

* New translations forms.php (German)

* New translations notifications.php (German)

* Remove duplicate order statement. Fixes cachethq#3418

* Remove string about HTTP(s). Fixes cachethq#3421

* Fixes CORS headers. Closes cachethq#3413

* Apply fixes from StyleCI

* Update deps

* Compile assets

* Fix importing of node_modules CSS

* Compile assets

* Fully remove the Strengthify integration

* Compile assets

* New translations cachet.php (Mongolian)

* New translations dashboard.php (Mongolian)

* New translations forms.php (Mongolian)

* New translations pagination.php (Mongolian)

* New translations setup.php (Mongolian)

* New translations validation.php (Mongolian)

* New translations notifications.php (Mongolian)

* New translations cachet.php (Slovenian)

* New translations dashboard.php (Slovenian)

* New translations forms.php (Slovenian)

* New translations pagination.php (Slovenian)

* New translations setup.php (Slovenian)

* New translations validation.php (Slovenian)

* New translations notifications.php (Slovenian)

* Fix other duplicate order by statements

* Apply fixes from StyleCI

* Fix HTML encoding for Google Fonts

* Update blog feed

Fixes cachethq#3441

* Bump sortablejs from 1.7.0 to 1.8.1

Bumps [sortablejs](https://github.com/SortableJS/Sortable) from 1.7.0 to 1.8.1.
- [Release notes](https://github.com/SortableJS/Sortable/releases)
- [Commits](SortableJS/Sortable@1.7.0...1.8.1)

Signed-off-by: dependabot[bot] <[email protected]>

* Bump vue and vue-template-compiler

Bumps [vue](https://github.com/vuejs/vue) and [vue-template-compiler](https://github.com/vuejs/vue). These dependencies needed to be updated together.

Updates `vue` from 2.5.21 to 2.5.22
- [Release notes](https://github.com/vuejs/vue/releases)
- [Commits](vuejs/vue@v2.5.21...v2.5.22)

Updates `vue-template-compiler` from 2.5.21 to 2.5.22
- [Release notes](https://github.com/vuejs/vue/releases)
- [Commits](vuejs/vue@v2.5.21...v2.5.22)

Signed-off-by: dependabot[bot] <[email protected]>

* Do not use arr_* or str_* helpers

* Add missing Arr import

* Fix setup username validation

* Add user on cachet install command

* Get a fresh configuration

* Use class notation

* Apply fixes from StyleCI

* Don't prompt for tag files [Fix cachethq#3453]

* Substitute :name by incident name on slack title

Slack title for created incident has ':name', which is being substituted by incident name.

* We no longer need the dev symfony requirements

* Bump phpunit/phpunit from 7.5.3 to 7.5.4

Bumps [phpunit/phpunit](https://github.com/sebastianbergmann/phpunit) from 7.5.3 to 7.5.4.
- [Release notes](https://github.com/sebastianbergmann/phpunit/releases)
- [Changelog](https://github.com/sebastianbergmann/phpunit/blob/master/ChangeLog-7.5.md)
- [Commits](sebastianbergmann/phpunit@7.5.3...7.5.4)

Signed-off-by: dependabot[bot] <[email protected]>

* Change to appropriate tags to hide and select/unselect components in group

* Drop dependency on alt-three throttle (cachethq#3469)

I've just pulled in the subset of the features we were actually using.

* Bump laravel/framework from 5.7.25 to 5.7.26

Bumps [laravel/framework](https://github.com/laravel/framework) from 5.7.25 to 5.7.26.
- [Release notes](https://github.com/laravel/framework/releases)
- [Changelog](https://github.com/laravel/framework/blob/5.7/CHANGELOG-5.7.md)
- [Commits](laravel/framework@v5.7.25...v5.7.26)

Signed-off-by: dependabot[bot] <[email protected]>

* Bump graham-campbell/binput from 6.0.0 to 6.1.0

Bumps [graham-campbell/binput](https://github.com/GrahamCampbell/Laravel-Binput) from 6.0.0 to 6.1.0.
- [Release notes](https://github.com/GrahamCampbell/Laravel-Binput/releases)
- [Changelog](https://github.com/GrahamCampbell/Laravel-Binput/blob/master/CHANGELOG.md)
- [Commits](GrahamCampbell/Laravel-Binput@v6.0.0...v6.1.0)

Signed-off-by: dependabot[bot] <[email protected]>

* Bump graham-campbell/markdown from 10.2.0 to 10.3.0

Bumps [graham-campbell/markdown](https://github.com/GrahamCampbell/Laravel-Markdown) from 10.2.0 to 10.3.0.
- [Release notes](https://github.com/GrahamCampbell/Laravel-Markdown/releases)
- [Changelog](https://github.com/GrahamCampbell/Laravel-Markdown/blob/master/CHANGELOG.md)
- [Commits](GrahamCampbell/Laravel-Markdown@v10.2.0...v10.3.0)

Signed-off-by: dependabot[bot] <[email protected]>

* Bump graham-campbell/testbench-core from 3.0.0 to 3.0.2

Bumps [graham-campbell/testbench-core](https://github.com/GrahamCampbell/Laravel-TestBench-Core) from 3.0.0 to 3.0.2.
- [Release notes](https://github.com/GrahamCampbell/Laravel-TestBench-Core/releases)
- [Changelog](https://github.com/GrahamCampbell/Laravel-TestBench-Core/blob/master/CHANGELOG.md)
- [Commits](GrahamCampbell/Laravel-TestBench-Core@v3.0.0...v3.0.2)

Signed-off-by: dependabot[bot] <[email protected]>

* Re-enable middleware. Fixes cachethq#3472

* Move meta relation into trait

* Remove badly added components class

* Improve count call

* More UX and UI fixes

* Compile assets

* [Security] Bump bootstrap-sass from 3.4.0 to 3.4.1

Bumps [bootstrap-sass](https://github.com/twbs/bootstrap-sass) from 3.4.0 to 3.4.1. **This update includes security fixes.**
- [Release notes](https://github.com/twbs/bootstrap-sass/releases)
- [Changelog](https://github.com/twbs/bootstrap-sass/blob/master/CHANGELOG.md)
- [Commits](twbs/bootstrap-sass@v3.4.0...v3.4.1)

Signed-off-by: dependabot[bot] <[email protected]>

* Bump mockery/mockery from 1.2.1 to 1.2.2

Bumps [mockery/mockery](https://github.com/mockery/mockery) from 1.2.1 to 1.2.2.
- [Release notes](https://github.com/mockery/mockery/releases)
- [Changelog](https://github.com/mockery/mockery/blob/master/CHANGELOG.md)
- [Commits](mockery/mockery@1.2.1...1.2.2)

Signed-off-by: dependabot[bot] <[email protected]>

* Bump laravolt/avatar from 2.1.0 to 2.2.0

Bumps [laravolt/avatar](https://github.com/laravolt/avatar) from 2.1.0 to 2.2.0.
- [Release notes](https://github.com/laravolt/avatar/releases)
- [Changelog](https://github.com/laravolt/avatar/blob/master/CHANGELOG.md)
- [Commits](laravolt/avatar@2.1.0...2.2.0)

Signed-off-by: dependabot[bot] <[email protected]>

* Bump phpunit/phpunit from 7.5.4 to 7.5.6

Bumps [phpunit/phpunit](https://github.com/sebastianbergmann/phpunit) from 7.5.4 to 7.5.6.
- [Release notes](https://github.com/sebastianbergmann/phpunit/releases)
- [Changelog](https://github.com/sebastianbergmann/phpunit/blob/master/ChangeLog-7.5.md)
- [Commits](sebastianbergmann/phpunit@7.5.4...7.5.6)

Signed-off-by: dependabot[bot] <[email protected]>

* Bump aws/aws-sdk-php from 3.87.8 to 3.87.17

Bumps [aws/aws-sdk-php](https://github.com/aws/aws-sdk-php) from 3.87.8 to 3.87.17.
- [Release notes](https://github.com/aws/aws-sdk-php/releases)
- [Changelog](https://github.com/aws/aws-sdk-php/blob/master/CHANGELOG.md)
- [Commits](aws/aws-sdk-php@3.87.8...3.87.17)

Signed-off-by: dependabot[bot] <[email protected]>

* Correctly retrieve the value

* Remove duplicate CSS properties

Remove unused parameter

* Bump barryvdh/laravel-cors from 0.11.2 to 0.11.3

Bumps [barryvdh/laravel-cors](https://github.com/barryvdh/laravel-cors) from 0.11.2 to 0.11.3.
- [Release notes](https://github.com/barryvdh/laravel-cors/releases)
- [Changelog](https://github.com/barryvdh/laravel-cors/blob/master/changelog.md)
- [Commits](fruitcake/laravel-cors@v0.11.2...v0.11.3)

Signed-off-by: dependabot[bot] <[email protected]>

* Bump barryvdh/laravel-debugbar from 3.2.2 to 3.2.3

Bumps [barryvdh/laravel-debugbar](https://github.com/barryvdh/laravel-debugbar) from 3.2.2 to 3.2.3.
- [Release notes](https://github.com/barryvdh/laravel-debugbar/releases)
- [Changelog](https://github.com/barryvdh/laravel-debugbar/blob/master/changelog.md)
- [Commits](barryvdh/laravel-debugbar@v3.2.2...v3.2.3)

Signed-off-by: dependabot[bot] <[email protected]>

* Make pgsql schema configurable via environment variable

* Bump graham-campbell/exceptions from 11.1.0 to 11.2.0

Bumps [graham-campbell/exceptions](https://github.com/GrahamCampbell/Laravel-Exceptions) from 11.1.0 to 11.2.0.
- [Release notes](https://github.com/GrahamCampbell/Laravel-Exceptions/releases)
- [Changelog](https://github.com/GrahamCampbell/Laravel-Exceptions/blob/master/CHANGELOG.md)
- [Commits](GrahamCampbell/Laravel-Exceptions@v11.1.0...v11.2.0)

Signed-off-by: dependabot[bot] <[email protected]>

* Bump aws/aws-sdk-php from 3.87.17 to 3.89.1

Bumps [aws/aws-sdk-php](https://github.com/aws/aws-sdk-php) from 3.87.17 to 3.89.1.
- [Release notes](https://github.com/aws/aws-sdk-php/releases)
- [Changelog](https://github.com/aws/aws-sdk-php/blob/master/CHANGELOG.md)
- [Commits](aws/aws-sdk-php@3.87.17...3.89.1)

Signed-off-by: dependabot[bot] <[email protected]>

* Bump laravel/framework from 5.7.26 to 5.7.28

Bumps [laravel/framework](https://github.com/laravel/framework) from 5.7.26 to 5.7.28.
- [Release notes](https://github.com/laravel/framework/releases)
- [Changelog](https://github.com/laravel/framework/blob/5.8/CHANGELOG-5.7.md)
- [Commits](laravel/framework@v5.7.26...v5.7.28)

Signed-off-by: dependabot[bot] <[email protected]>
  • Loading branch information
backstroke-bot authored and zhenyulin committed Mar 12, 2019
1 parent 93a4594 commit 7c53d01
Show file tree
Hide file tree
Showing 198 changed files with 7,009 additions and 5,130 deletions.
12 changes: 0 additions & 12 deletions .github/move.yml

This file was deleted.

17 changes: 12 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ branches:

before_install:
- cp .env.example .env
- phpenv config-rm xdebug.ini || true

install:
- travis_retry composer install --no-interaction --no-suggest
Expand All @@ -18,21 +17,29 @@ jobs:
include:
- stage: Security check
script:
- phpenv config-rm xdebug.ini || true
- wget https://get.sensiolabs.org/security-checker.phar
- php security-checker.phar security:check ./composer.lock
php: 7.1
- stage: Unit tests
script: vendor/bin/phpunit
script:
- phpenv config-rm xdebug.ini || true
- vendor/bin/phpunit
php: 7.1
- stage: Unit tests
script: vendor/bin/phpunit
script:
- phpenv config-rm xdebug.ini || true
- vendor/bin/phpunit
php: 7.2
- stage: Unit tests
script: vendor/bin/phpunit
script:
- phpenv config-rm xdebug.ini || true
- vendor/bin/phpunit
php: 7.3
- stage: Code coverage
script:
- vendor/bin/phpunit --coverage-clover build/logs/clover.xml
- phpenv config-rm xdebug.ini || true
- phpdbg -qrr vendor/bin/phpunit --coverage-text --coverage-clover build/logs/clover.xml
- if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then wget https://scrutinizer-ci.com/ocular.phar; fi
- if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then php ocular.phar code-coverage:upload --format=php-clover build/logs/clover.xml; fi
php: 7.1
5 changes: 3 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ Of course bug reports, feature requests and [documentation](https://docs.cacheth

As Cachet gains new features, the design and ideas that were once a perfect fit need updating and in some cases designing from scratch. This is where you come in! Fancy giving Cachet a lick of paint? Sweet!

You'll need to install Node.js, Bower and Gulp.
You'll need to install Node.js with NPM or Yarn.

To get started you can do the following:

Expand All @@ -81,7 +81,8 @@ Built using [Laravel](https://laravel.com).
We use these extra dependencies to develop Cachet:

- Node.js
- Gulp
- NPM or Yarn
- Composer
- Git

Once cloned to your local machine, you'll need some demo data! Run `php artisan cachet:seed` to get the demo installation ready for action.
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2015-2018 Alt Three Services Limited.
Copyright (c) 2015-2019 Alt Three Services Limited.
All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@

Cachet is a beautiful and powerful open source status page system.

## Community

You can now [join our Slack community!](http://cachethq-slack.herokuapp.com)

## Overview

- List your service components
Expand All @@ -26,6 +22,10 @@ You can now [join our Slack community!](http://cachethq-slack.herokuapp.com)
- Subscriber notifications via email
- Two factor authentication

## Community

You can now [join our Slack community!](http://cachethq-slack.herokuapp.com)

## Requirements

- PHP 7.1 or later
Expand All @@ -47,7 +47,7 @@ Here are some useful quick links:

To test out the demo, you may login to the [Dashboard](https://dev.cachethq.io/dashboard) with the following:

- **Username:** `test` or `test@test.com`
- **Username:** `test` or `test@example.com`
- **Password:** `test123`

> The demo resets every 30 minutes.
Expand All @@ -72,4 +72,4 @@ A professional **installation service** is offered by Alt Three Services Limited

Thank you to the following for [sponsoring](https://patreon.com/jbrooksuk) Cachet.

![Exascale](/docs/images/sponsorships/exascale.jpg)
[![Exascale](/docs/images/sponsorships/exascale.jpg)](https://www.exascale.co.uk/)
2 changes: 1 addition & 1 deletion app/Bus/Commands/Component/CreateComponentCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ final class CreateComponentCommand
*/
public $rules = [
'name' => 'required|string',
'description' => 'required|string',
'description' => 'nullable|string',
'status' => 'required|int|min:0|max:4',
'link' => 'nullable|url',
'order' => 'nullable|int',
Expand Down
2 changes: 1 addition & 1 deletion app/Bus/Commands/Incident/CreateIncidentCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ final class CreateIncidentCommand
*
* @return void
*/
public function __construct($name, $status, $message, $visible, $component_id, $component_status, $notify, $stickied, $occurred_at, $template, array $template_vars = [], $meta = [])
public function __construct($name, $status, $message, $visible, $component_id, $component_status, $notify, $stickied, $occurred_at, $template, array $template_vars = [], array $meta = [])
{
$this->name = $name;
$this->status = $status;
Expand Down
12 changes: 11 additions & 1 deletion app/Bus/Commands/Incident/UpdateIncidentCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,13 @@ final class UpdateIncidentCommand
*/
public $template_vars;

/**
* Meta key/value pairs.
*
* @var array
*/
public $meta = [];

/**
* The validation rules.
*
Expand All @@ -122,6 +129,7 @@ final class UpdateIncidentCommand
'stickied' => 'nullable|bool',
'occurred_at' => 'nullable|string',
'template' => 'nullable|string',
'meta' => 'nullable|array',
];

/**
Expand All @@ -139,10 +147,11 @@ final class UpdateIncidentCommand
* @param string|null $occurred_at
* @param string|null $template
* @param array $template_vars
* @param array $meta
*
* @return void
*/
public function __construct(Incident $incident, $name, $status, $message, $visible, $component_id, $component_status, $notify, $stickied, $occurred_at, $template, array $template_vars = [])
public function __construct(Incident $incident, $name, $status, $message, $visible, $component_id, $component_status, $notify, $stickied, $occurred_at, $template, array $template_vars = [], array $meta = [])
{
$this->incident = $incident;
$this->name = $name;
Expand All @@ -156,5 +165,6 @@ public function __construct(Incident $incident, $name, $status, $message, $visib
$this->occurred_at = $occurred_at;
$this->template = $template;
$this->template_vars = $template_vars;
$this->meta = $meta;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,16 @@
use CachetHQ\Cachet\Bus\Commands\Incident\CreateIncidentCommand;
use CachetHQ\Cachet\Bus\Events\Incident\IncidentWasCreatedEvent;
use CachetHQ\Cachet\Bus\Exceptions\Incident\InvalidIncidentTimestampException;
use CachetHQ\Cachet\Bus\Handlers\Traits\StoresMeta;
use CachetHQ\Cachet\Models\Component;
use CachetHQ\Cachet\Models\Incident;
use CachetHQ\Cachet\Models\IncidentTemplate;
use CachetHQ\Cachet\Models\Meta;
use CachetHQ\Cachet\Services\Dates\DateFactory;
use Carbon\Carbon;
use Illuminate\Contracts\Auth\Guard;
use Twig_Environment;
use Twig_Loader_Array;
use Twig\Environment as Twig_Environment;
use Twig\Loader\ArrayLoader as Twig_Loader_Array;

/**
* This is the create incident command handler.
Expand All @@ -32,6 +33,8 @@
*/
class CreateIncidentCommandHandler
{
use StoresMeta;

/**
* The authentication guard instance.
*
Expand Down Expand Up @@ -104,14 +107,7 @@ public function handle(CreateIncidentCommand $command)

// Store any meta?
if ($meta = $command->meta) {
foreach ($meta as $key => $value) {
Meta::create([
'key' => $key,
'value' => $value,
'meta_type' => 'incidents',
'meta_id' => $incident->id,
]);
}
$this->storeMeta($command->meta, 'incidents', $incident->id);
}

// Update the component.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,14 @@
use CachetHQ\Cachet\Bus\Commands\Incident\UpdateIncidentCommand;
use CachetHQ\Cachet\Bus\Events\Incident\IncidentWasUpdatedEvent;
use CachetHQ\Cachet\Bus\Exceptions\Incident\InvalidIncidentTimestampException;
use CachetHQ\Cachet\Bus\Handlers\Traits\StoresMeta;
use CachetHQ\Cachet\Models\Component;
use CachetHQ\Cachet\Models\Incident;
use CachetHQ\Cachet\Models\IncidentTemplate;
use CachetHQ\Cachet\Services\Dates\DateFactory;
use Illuminate\Contracts\Auth\Guard;
use Twig_Environment;
use Twig_Loader_Array;
use Twig\Environment as Twig_Environment;
use Twig\Loader\ArrayLoader as Twig_Loader_Array;

/**
* This is the update incident command handler.
Expand All @@ -30,6 +31,8 @@
*/
class UpdateIncidentCommandHandler
{
use StoresMeta;

/**
* The authentication guard instance.
*
Expand Down Expand Up @@ -86,6 +89,11 @@ public function handle(UpdateIncidentCommand $command)
// Rather than making lots of updates, just fill and save.
$incident->save();

// Store any meta?
if ($meta = $command->meta) {
$this->storeMeta($command->meta, 'incidents', $incident->id);
}

// Update the component.
if ($component = Component::find($command->component_id)) {
execute(new UpdateComponentCommand(
Expand Down
81 changes: 81 additions & 0 deletions app/Bus/Handlers/Traits/StoresMeta.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
<?php

/*
* This file is part of Cachet.
*
* (c) Alt Three Services Limited
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace CachetHQ\Cachet\Bus\Handlers\Traits;

use CachetHQ\Cachet\Models\Meta;

trait StoresMeta
{
/**
* Stores all Meta values of a model.
*
* @param array $metaData
* @param string $metaType
* @param string|int $metaId
* @param string $metaModel
*
* @return void
*/
public function storeMeta($metaData, $metaType, $metaId, $metaModel = Meta::class)
{
// Validation required instead of type hinting because it could be passed as false or NULL
if (!is_array($metaData)) {
return;
}

foreach ($metaData as $key => $value) {
$modelInstance = call_user_func(
[$metaModel, 'firstOrNew'],
[
'key' => $key,
'meta_type' => $metaType,
'meta_id' => $metaId,
]
);

$value = $this->removeEmptyValues($value);
if (!empty($value)) {
$modelInstance->setAttribute('value', $value);
$modelInstance->save();
continue;
}

// The value is empty, remove the row
if ($modelInstance->exists) {
$modelInstance->delete();
}
}
}

/**
* Determine if a Value is empty.
*
* @param mixed $values
*
* @return array|mixed
*/
protected function removeEmptyValues($values)
{
if (!is_array($values)) {
return empty($values) ? null : $values;
}

foreach ($values as $key => $value) {
if (!empty($value)) {
continue;
}
unset($values[$key]);
}

return $values;
}
}
2 changes: 1 addition & 1 deletion app/Composers/ComponentsComposer.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public function __construct(Guard $guard)
public function compose(View $view)
{
$componentGroups = $this->getVisibleGroupedComponents();
$ungroupedComponents = Component::ungrouped()->get();
$ungroupedComponents = Component::ungrouped()->orderBy('status', 'desc')->get();

$view->withComponentGroups($componentGroups)
->withUngroupedComponents($ungroupedComponents);
Expand Down
Loading

0 comments on commit 7c53d01

Please sign in to comment.