Skip to content

Commit 68c1d95

Browse files
committed
fix: some ui issues and removed unnecessary fields. gh action updated
1 parent a247527 commit 68c1d95

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+78
-2537
lines changed

.github/workflows/deploy.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@ jobs:
9797
SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }}
9898
BUILD_DIR: '${{ github.workspace }}/build/${{ env.PLUGIN_SLUG }}'
9999
SLUG: ${{ env.PLUGIN_SLUG }}
100-
ASSETS_DIR: '${{ github.workspace }}/svn-assets'
101100

102101
- name: Upload release asset
103102
if: steps.build-plugin.outputs.free_exists == 'true'

.gitignore

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
vendor/
22
assets/
33
languages/
4-
node_modules
5-
dist
4+
node_modules/
5+
dist/
66
frontend/yarn-error.log
77
frontend/coverage/*
88
frontend/src/coverage/*
@@ -17,4 +17,5 @@ eslint-cache/
1717
locale.pot
1818
.vscode/settings.json
1919
package-lock.json
20-
port
20+
port
21+
build/

backend/app/Config.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ private static function pluginPageLinks()
210210
{
211211
return [
212212
'Home' => [
213-
'title' => __('Home', 'bit-smtp'),
213+
'title' => __('Settings', 'bit-smtp'),
214214
'url' => self::get('ADMIN_URL') . 'admin.php?page=' . self::SLUG,
215215
]
216216
];

backend/app/HTTP/Services/LogService.php

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,7 @@ class LogService
1818
public function __construct()
1919
{
2020
if (\defined('DOING_CRON') && DOING_CRON) {
21-
$currentTime = time();
22-
$logDeletedAt = Config::getOption('log_deleted_at', ($currentTime - (DAY_IN_SECONDS * 30)));
23-
if ((abs($logDeletedAt - $currentTime) / DAY_IN_SECONDS) > 30) {
24-
$this->deleteOlder();
25-
}
21+
$this->maybeDeleteOlder();
2622
}
2723
}
2824

@@ -84,7 +80,6 @@ public function save($status, $details, $message = null)
8480

8581
$log->subject = Arr::get($details, 'subject', '');
8682
$log->to_addr = Arr::get($details, 'to', '');
87-
$log->from_addr = Arr::get($details, 'from', '');
8883

8984
unset($details['subject'], $details['to'], $details['from'], $details['phpmailer_exception_code']);
9085
$log->details = $details;
@@ -109,7 +104,6 @@ public function update($id, $status, $details, $message = null)
109104
// Don't need to update these fields again....
110105
$log->subject = Arr::get($details, 'subject', '');
111106
$log->to_addr = Arr::get($details, 'to', '');
112-
$log->from_addr = Arr::get($details, 'from', '');
113107
114108
unset($details['subject'], $details['to'], $details['from'], $details['phpmailer_exception_code']);
115109
$log->details = $details;
@@ -124,6 +118,15 @@ public function delete(array $ids)
124118
return Connection::prop('last_error') ? false : true;
125119
}
126120

121+
public function maybeDeleteOlder()
122+
{
123+
$currentTime = time();
124+
$logDeletedAt = Config::getOption('log_deleted_at', ($currentTime - (DAY_IN_SECONDS * 30)));
125+
if ((abs($logDeletedAt - $currentTime) / DAY_IN_SECONDS) > 30) {
126+
$this->deleteOlder();
127+
}
128+
}
129+
127130
public function deleteOlder()
128131
{
129132
$logRetention = Config::getOption('log_retention', 30);
@@ -161,7 +164,7 @@ public function updateRetention($days)
161164
*/
162165
public function isEnabled()
163166
{
164-
return (bool) Config::getOption('logging_enabled', false);
167+
return (bool) Config::getOption('logging_enabled', true);
165168
}
166169

167170
/**
@@ -189,6 +192,12 @@ public function bulkInsert(array $logs)
189192
return false;
190193
}
191194

195+
/**
196+
* This is fallback to delete older log. as we only invoke deleteOlder in cron,
197+
* site may not have working cron.
198+
*/
199+
$this->maybeDeleteOlder();
200+
192201
$records = [];
193202
foreach ($logs as $log) {
194203
if (!isset($log['status']) || !isset($log['data'])) {
@@ -209,7 +218,6 @@ public function bulkInsert(array $logs)
209218

210219
$record['subject'] = Arr::get($details, 'subject', '');
211220
$record['to_addr'] = wp_json_encode(Arr::get($details, 'to', []));
212-
$record['from_addr'] = Arr::get($details, 'from', '');
213221

214222
unset(
215223
$details['subject'],

backend/app/Model/Log.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
* @property int $status
1111
* @property string $subject
1212
* @property array $to_addr
13-
* @property string $from_addr
1413
* @property array $details
1514
* @property array $debug_info
1615
* @property int $retry_count
@@ -27,7 +26,6 @@ class Log extends Model
2726
'status' => 'int',
2827
'subject' => 'string',
2928
'to_addr' => 'array',
30-
'from_addr' => 'string',
3129
'details' => 'array',
3230
'debug_info' => 'array',
3331
'retry_count' => 'int',

backend/app/Providers/HookProvider.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ public function __construct()
1919
$this->loadAppHooks();
2020
Hooks::addAction('rest_api_init', [$this, 'loadApi']);
2121
Hooks::addFilter(Config::VAR_PREFIX . 'telemetry_additional_data', [new TelemetryPopupController(), 'filterTrackingData']);
22+
Hooks::addFilter(Config::withPrefix('deactivate_reasons'), [$this, 'deactivateReasons']);
2223
}
2324

2425
/**
@@ -37,6 +38,15 @@ public function loadApi()
3738
}
3839
}
3940

41+
public function deactivateReasons($reasons)
42+
{
43+
if (isset($reasons[Config::withPrefix('pro')])) {
44+
unset($reasons[Config::withPrefix('pro')]);
45+
}
46+
47+
return $reasons;
48+
}
49+
4050
/**
4151
* Helps to register App hooks.
4252
*/

backend/db/Migrations/BitSmtpLogsTableMigration.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ function (Blueprint $table) {
2121
$table->tinyint('status');
2222
$table->longtext('subject');
2323
$table->varchar('to_addr', 320);
24-
$table->varchar('from_addr', 320)->nullable();
2524
$table->longtext('details')->nullable();
2625
$table->text('debug_info')->nullable();
2726
$table->tinyint('retry_count')->defaultValue(0);

bit_smtp.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22

33
/**
4-
* Plugin Name: BIT SMTP
4+
* Plugin Name: Bit SMTP
55
* Plugin URI: https://www.bitapps.pro/bit-smtp
66
* Description: Send email via SMTP using BIT SMTP plugin by Bit Apps
77
* Version: 1.2

0 commit comments

Comments
 (0)