Skip to content

Commit

Permalink
v2.0.17
Browse files Browse the repository at this point in the history
  • Loading branch information
kjmartens committed Mar 13, 2019
1 parent b7a0e77 commit b3e6f75
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 8 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Solspace Calendar Changelog

## 2.0.17 - 2019-03-13
### Fixed
- Fixed a bug where the Share button token feature was not working on disabled events for logged out users.
- Fixed a bug where the CP Month/Week/Day views were not correctly adjusting exclude dates when dragging and dropping events to different days.

## 2.0.16 - 2019-02-26
### Changed
- Improved Calendar for better compatibility with other third party plugins such as Smart Maps.
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "solspace/craft3-calendar",
"description": "The most powerful event management plugin for Craft.",
"version": "2.0.16",
"version": "2.0.17",
"type": "craft-plugin",
"authors": [
{
Expand Down
6 changes: 3 additions & 3 deletions src/Controllers/EventsApiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,12 +116,12 @@ public function actionModifyDate(): Response

$exceptions = $this->getExceptionsService()->getExceptionsForEventId($event->id);
foreach ($exceptions as $exception) {
$date = new \DateTime();
$date = new Carbon('today', DateHelper::UTC);
$date->setTimestamp($exception->date->getTimestamp());
$date->add($daysInterval);
$date->setTime(0, 0, 0);
$date->setTime(0, 0);

$this->getExceptionsService()->saveException($event, $date);
$this->getExceptionsService()->saveException($event, $date, $exception->id);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/Controllers/EventsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class EventsController extends BaseController
const EVENT_FIELD_NAME = 'calendarEvent';
const EVENT_PREVIEW_EVENT = 'previewEvent';

protected $allowAnonymous = ['save-event'];
protected $allowAnonymous = ['save-event', 'view-shared-event'];

/**
* @return Response
Expand Down
15 changes: 12 additions & 3 deletions src/Services/ExceptionsService.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public function saveExceptions(Event $event, array $exceptions)
$exceptionDate,
DateHelper::UTC
)
->setTime(0, 0, 0);
->setTime(0, 0, 0);

$exceptionRecord->save();
}
Expand All @@ -111,10 +111,19 @@ public function saveExceptions(Event $event, array $exceptions)
/**
* @param Event $event
* @param \DateTime $date
* @param int|null $id
*/
public function saveException(Event $event, \DateTime $date)
public function saveException(Event $event, \DateTime $date, int $id = null)
{
$exceptionRecord = new ExceptionRecord();
$exceptionRecord = null;
if ($id) {
$exceptionRecord = ExceptionRecord::findOne(['id' => $id]);
}

if (!$exceptionRecord) {
$exceptionRecord = new ExceptionRecord();
}

$exceptionRecord->eventId = $event->id;
$exceptionRecord->date = $date;

Expand Down

0 comments on commit b3e6f75

Please sign in to comment.