Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix column exdate to delete more than 16 recurrence event entries. Display info after delete event entry. #495

Merged
merged 2 commits into from
Jul 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions controllers/EntryController.php
Original file line number Diff line number Diff line change
Expand Up @@ -544,10 +544,20 @@ public function actionDelete($id)
throw new HttpException('403', Yii::t('CalendarModule.base', "You don't have permission to delete this event!"));
}

$calendarEntry->delete();
if (!$calendarEntry->delete()) {
return Yii::$app->request->isAjax
? $this->asJson([
'success' => false,
'message' => Yii::t('CalendarModule.base', 'Event could not be deleted!'),
])
: $this->redirect(Url::toEntry($calendarEntry));
}

return Yii::$app->request->isAjax
? $this->asJson(['success' => true])
? $this->asJson([
'success' => true,
'message' => Yii::t('CalendarModule.base', 'Event has been be deleted!'),
])
: $this->redirect(Url::toCalendar($this->contentContainer));
}

Expand Down
3 changes: 3 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
Changelog
=========

1.6.2 (Unreleased)
--------------------
- Enh #495: Fix column `exdate` to delete more than 16 recurrence event entries

1.6.1 (July 3, 2024)
--------------------
Expand Down
27 changes: 27 additions & 0 deletions migrations/m240716_075328_fix_exdate.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

use humhub\components\Migration;

/**
* Class m240716_075328_fix_exdate
*/
class m240716_075328_fix_exdate extends Migration
{
/**
* {@inheritdoc}
*/
public function safeUp()
{
$this->alterColumn('calendar_entry', 'exdate', $this->text()->null());
}

/**
* {@inheritdoc}
*/
public function safeDown()
{
echo "m240716_075328_fix_exdate cannot be reverted.\n";

return false;
}
}
2 changes: 1 addition & 1 deletion module.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"name": "Calendar",
"description": "Create one-time or recurring events, invite and manage attendees, and keep track of all your events with the Calendar module.",
"keywords": ["calendar"],
"version": "1.6.1",
"version": "1.6.2",
"humhub": {
"minVersion": "1.16.1"
},
Expand Down
13 changes: 11 additions & 2 deletions resources/js/humhub.calendar.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ humhub.module('calendar', function (module, require, $) {
var Content = require('content').Content;
var event = require('event');
var StreamEntry = require('stream').StreamEntry;
var status = require('ui.status');

var Calendar = Widget.extend();
var Form = Widget.extend();
Expand Down Expand Up @@ -325,10 +326,18 @@ humhub.module('calendar', function (module, require, $) {
streamEntry.loader();
modal.confirm().then(function (confirm) {
if (confirm) {
client.post(evt).then(function () {
modal.global.close();
client.post(evt).then(function (response) {
if (response.success) {
status.success(response.message);
modal.global.close();
} else if (response.message) {
status.error(response.message);
}
}).catch(function (e) {
module.log.error(e, true);
if (e.message) {
status.error(e.message);
}
});
} else {
var streamEntry = Widget.closest(evt.$trigger);
Expand Down
2 changes: 1 addition & 1 deletion resources/js/humhub.calendar.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading