Skip to content

Commit 8acd369

Browse files
authored
[5.3] Completely revert PR 44640 - [5.3][com_actionlogs] exclude self from mail notification (#44845)
1 parent 7916bb8 commit 8acd369

File tree

10 files changed

+23
-55
lines changed

10 files changed

+23
-55
lines changed

administrator/components/com_actionlogs/src/Model/ActionlogModel.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ protected function sendNotificationEmails($messages, $username, $context)
126126
$query = $db->getQuery(true);
127127

128128
$query
129-
->select($db->quoteName(['u.email', 'u.username', 'l.extensions', 'l.exclude_self']))
129+
->select($db->quoteName(['u.email', 'l.extensions']))
130130
->from($db->quoteName('#__users', 'u'))
131131
->where($db->quoteName('u.block') . ' = 0')
132132
->join(
@@ -142,10 +142,6 @@ protected function sendNotificationEmails($messages, $username, $context)
142142
$recipients = [];
143143

144144
foreach ($users as $user) {
145-
if ($user->username === $this->getCurrentUser()->username && $user->exclude_self) {
146-
continue;
147-
}
148-
149145
$extensions = json_decode($user->extensions, true);
150146

151147
if ($extensions && \in_array(strtok($context, '.'), $extensions)) {
Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,6 @@
1-
ALTER TABLE `#__action_logs_users` ADD COLUMN `exclude_self` tinyint NOT NULL DEFAULT 0;
1+
-- --------------------------------------------------------
2+
-- The following statement which was introduced with 5.3.0-alpha3
3+
-- has been disabled as it was reverted with 5.3.0-beta1.
4+
-- See https://github.com/joomla/joomla-cms/pull/44845 for details.
5+
--
6+
-- ALTER TABLE `#__action_logs_users` ADD COLUMN `exclude_self` tinyint NOT NULL DEFAULT 0;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ALTER TABLE `#__action_logs_users` DROP COLUMN `exclude_self` /** CAN FAIL **/;
Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,6 @@
1-
ALTER TABLE "#__action_logs_users" ADD COLUMN "exclude_self" integer DEFAULT 0 NOT NULL;
1+
-- --------------------------------------------------------
2+
-- The following statement which was introduced with 5.3.0-alpha3
3+
-- has been disabled as it was reverted with 5.3.0-beta1.
4+
-- See https://github.com/joomla/joomla-cms/pull/44845 for details.
5+
--
6+
-- ALTER TABLE "#__action_logs_users" ADD COLUMN "exclude_self" integer DEFAULT 0 NOT NULL;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ALTER TABLE "#__action_logs_users" DROP COLUMN "exclude_self" /** CAN FAIL **/;

administrator/language/en-GB/plg_system_actionlogs.ini

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ PLG_SYSTEM_ACTIONLOGS_INFO_LABEL="Information"
1010
PLG_SYSTEM_ACTIONLOGS_JOOMLA_ACTIONLOG_DISABLED="Action Log - Joomla"
1111
PLG_SYSTEM_ACTIONLOGS_JOOMLA_ACTIONLOG_DISABLED_REDIRECT="The %s plugin is disabled."
1212
PLG_SYSTEM_ACTIONLOGS_NOTIFICATIONS="Email Notifications"
13-
PLG_SYSTEM_ACTIONLOGS_NOTIFICATIONS_EXCLUDE="Exclude Self"
1413
PLG_SYSTEM_ACTIONLOGS_OPTIONS="User Actions Log Options"
1514
PLG_SYSTEM_ACTIONLOGS_XML_DESCRIPTION="Records the actions of users on the site so they can be reviewed if required."
1615
; Common content type log messages

installation/sql/mysql/extensions.sql

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -887,7 +887,6 @@ CREATE TABLE IF NOT EXISTS `#__action_logs_users` (
887887
`user_id` int UNSIGNED NOT NULL,
888888
`notify` tinyint UNSIGNED NOT NULL,
889889
`extensions` text NOT NULL,
890-
`exclude_self` tinyint UNSIGNED NOT NULL DEFAULT 0,
891890
PRIMARY KEY (`user_id`),
892891
KEY `idx_notify` (`notify`)
893892
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci;

installation/sql/postgresql/extensions.sql

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -848,7 +848,6 @@ CREATE TABLE "#__action_logs_users" (
848848
"user_id" integer NOT NULL,
849849
"notify" integer NOT NULL,
850850
"extensions" text NOT NULL,
851-
"exclude_self" integer NOT NULL DEFAULT 0,
852851
PRIMARY KEY ("user_id")
853852
);
854853

plugins/system/actionlogs/forms/actionlogs.xml

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,6 @@
2424
showon="actionlogsNotify:1"
2525
default="com_content"
2626
/>
27-
<field
28-
name="actionlogsExcludeSelf"
29-
type="radio"
30-
label="PLG_SYSTEM_ACTIONLOGS_NOTIFICATIONS_EXCLUDE"
31-
layout="joomla.form.field.radio.switcher"
32-
showon="actionlogsNotify:1"
33-
default="0"
34-
filter="integer"
35-
>
36-
<option value="0">JNO</option>
37-
<option value="1">JYES</option>
38-
</field>
3927
</fields>
4028
</fieldset>
4129
</form>

plugins/system/actionlogs/src/Extension/ActionLogs.php

Lines changed: 8 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ public function onContentPrepareData(Model\PrepareDataEvent $event): void
175175
$id = (int) $data->id;
176176

177177
$query = $db->getQuery(true)
178-
->select($db->quoteName(['notify', 'extensions', 'exclude_self']))
178+
->select($db->quoteName(['notify', 'extensions']))
179179
->from($db->quoteName('#__action_logs_users'))
180180
->where($db->quoteName('user_id') . ' = :userid')
181181
->bind(':userid', $id, ParameterType::INTEGER);
@@ -193,10 +193,9 @@ public function onContentPrepareData(Model\PrepareDataEvent $event): void
193193
// Load plugin language files.
194194
$this->loadLanguage();
195195

196-
$data->actionlogs = new \stdClass();
197-
$data->actionlogs->actionlogsNotify = $values->notify;
198-
$data->actionlogs->actionlogsExtensions = $values->extensions;
199-
$data->actionlogs->actionlogsExcludeSelf = $values->exclude_self;
196+
$data->actionlogs = new \stdClass();
197+
$data->actionlogs->actionlogsNotify = $values->notify;
198+
$data->actionlogs->actionlogsExtensions = $values->extensions;
200199

201200
if (!HTMLHelper::isRegistered('users.actionlogsNotify')) {
202201
HTMLHelper::register('users.actionlogsNotify', [__CLASS__, 'renderActionlogsNotify']);
@@ -205,10 +204,6 @@ public function onContentPrepareData(Model\PrepareDataEvent $event): void
205204
if (!HTMLHelper::isRegistered('users.actionlogsExtensions')) {
206205
HTMLHelper::register('users.actionlogsExtensions', [__CLASS__, 'renderActionlogsExtensions']);
207206
}
208-
209-
if (!HTMLHelper::isRegistered('users.actionlogsExcludeSelf')) {
210-
HTMLHelper::register('users.actionlogsExcludeSelf', [__CLASS__, 'renderActionlogsExcludeSelf']);
211-
}
212207
}
213208

214209
/**
@@ -253,10 +248,9 @@ public function onUserAfterSave(User\AfterSaveEvent $event): void
253248
// If preferences don't exist, insert.
254249
if (!$exists && $authorised && isset($user['actionlogs'])) {
255250
$notify = (int) $user['actionlogs']['actionlogsNotify'];
256-
$exclude = (int) $user['actionlogs']['actionlogsExcludeSelf'];
257-
$values = [':userid', ':notify', ':exclude'];
258-
$bind = [$userid, $notify, $exclude];
259-
$columns = ['user_id', 'notify', 'exclude_self'];
251+
$values = [':userid', ':notify'];
252+
$bind = [$userid, $notify];
253+
$columns = ['user_id', 'notify'];
260254

261255
$query->bind($values, $bind, ParameterType::INTEGER);
262256

@@ -277,11 +271,6 @@ public function onUserAfterSave(User\AfterSaveEvent $event): void
277271

278272
$query->bind(':notify', $notify, ParameterType::INTEGER);
279273

280-
$exclude = (int) $user['actionlogs']['actionlogsExcludeSelf'];
281-
$values[] = $db->quoteName('exclude_self') . ' = :exclude';
282-
283-
$query->bind(':exclude', $exclude, ParameterType::INTEGER);
284-
285274
if (isset($user['actionlogs']['actionlogsExtensions'])) {
286275
$values[] = $db->quoteName('extensions') . ' = :extension';
287276
$extension = json_encode($user['actionlogs']['actionlogsExtensions']);
@@ -355,20 +344,6 @@ public static function renderActionlogsNotify($value)
355344
return Text::_($value ? 'JYES' : 'JNO');
356345
}
357346

358-
/**
359-
* Method to render a value.
360-
*
361-
* @param integer|string $value The value (0 or 1).
362-
*
363-
* @return string The rendered value.
364-
*
365-
* @since 5.3.0
366-
*/
367-
public static function renderActionlogsExcludeSelf($value)
368-
{
369-
return Text::_($value ? 'JYES' : 'JNO');
370-
}
371-
372347
/**
373348
* Method to render a list of extensions.
374349
*
@@ -419,7 +394,7 @@ public function onExtensionAfterSave(Model\AfterSaveEvent $event): void
419394
$db = $this->getDatabase();
420395

421396
$query = $db->getQuery(true)
422-
->select($db->quoteName(['user_id', 'notify', 'extensions', 'exclude_self']))
397+
->select($db->quoteName(['user_id', 'notify', 'extensions']))
423398
->from($db->quoteName('#__action_logs_users'));
424399

425400
try {

0 commit comments

Comments
 (0)