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

2.x add ability to prevent sending notifications with users that did not have email verified #3999

Closed
wants to merge 4 commits into from
Closed
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
2 changes: 1 addition & 1 deletion extensions/akismet/src/Akismet.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ protected function sendRequest(string $type): ResponseInterface
$client = new Client();

return $client->request('POST', "$this->apiUrl/$type", [
'headers' => [
'headers' => [
'User-Agent' => "Flarum/$this->flarumVersion | Akismet/$this->extensionVersion",
],
'form_params' => $this->params,
Expand Down
1 change: 1 addition & 0 deletions extensions/flags/src/AddCanFlagAttribute.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ protected function checkFlagOwnPostSetting(User $actor, Post $post): bool
// If $actor is the post author, check to see if the setting is enabled
return (bool) $this->settings->get('flarum-flags.can_flag_own');
}

// $actor is not the post author
return true;
}
Expand Down
6 changes: 3 additions & 3 deletions extensions/flags/src/Api/Serializer/FlagSerializer.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ protected function getDefaultAttributes($flag)
}

return [
'type' => $flag->type,
'reason' => $flag->reason,
'type' => $flag->type,
'reason' => $flag->reason,
'reasonDetail' => $flag->reason_detail,
'createdAt' => $this->formatDate($flag->created_at),
'createdAt' => $this->formatDate($flag->created_at),
];
}

Expand Down
26 changes: 13 additions & 13 deletions extensions/tags/src/Api/Serializer/TagSerializer.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,19 +47,19 @@ protected function getDefaultAttributes($tag)
}

$attributes = [
'name' => $tag->name,
'description' => $tag->description,
'slug' => $this->slugManager->forResource(Tag::class)->toSlug($tag),
'color' => $tag->color,
'backgroundUrl' => $tag->background_path,
'backgroundMode' => $tag->background_mode,
'icon' => $tag->icon,
'discussionCount' => (int) $tag->discussion_count,
'position' => $tag->position === null ? null : (int) $tag->position,
'defaultSort' => $tag->default_sort,
'isChild' => (bool) $tag->parent_id,
'isHidden' => (bool) $tag->is_hidden,
'lastPostedAt' => $this->formatDate($tag->last_posted_at),
'name' => $tag->name,
'description' => $tag->description,
'slug' => $this->slugManager->forResource(Tag::class)->toSlug($tag),
'color' => $tag->color,
'backgroundUrl' => $tag->background_path,
'backgroundMode' => $tag->background_mode,
'icon' => $tag->icon,
'discussionCount' => (int) $tag->discussion_count,
'position' => $tag->position === null ? null : (int) $tag->position,
'defaultSort' => $tag->default_sort,
'isChild' => (bool) $tag->parent_id,
'isHidden' => (bool) $tag->is_hidden,
'lastPostedAt' => $this->formatDate($tag->last_posted_at),
'canStartDiscussion' => $this->actor->can('startDiscussion', $tag),
'canAddToDiscussion' => $this->actor->can('addToDiscussion', $tag)
];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ protected function tags()
['id' => 11, 'name' => 'Secondary Restricted', 'slug' => 'secondary-restricted', 'position' => null, 'parent_id' => null, 'is_restricted' => true],
['id' => 12, 'name' => 'Primary Restricted 2', 'slug' => 'primary-2-restricted', 'position' => 100, 'parent_id' => null, 'is_restricted' => true],
['id' => 13, 'name' => 'Primary Restricted 2 Child 1', 'slug' => 'primary-2-restricted-child-1', 'position' => 101, 'parent_id' => 12],
['id' => 14, 'name' => 'Primary Restricted 3', 'slug' => 'primary-3-restricted', 'position' => 102, 'parent_id' =>null, 'is_restricted' => true],
['id' => 14, 'name' => 'Primary Restricted 3', 'slug' => 'primary-3-restricted', 'position' => 102, 'parent_id' => null, 'is_restricted' => true],
];
}
}
2 changes: 1 addition & 1 deletion framework/core/js/dist/admin.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion framework/core/js/dist/admin.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion framework/core/js/src/admin/components/StatusWidget.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export default class StatusWidget extends DashboardWidget {
[
<span>
<strong>{app.translator.trans('core.admin.dashboard.status.headers.scheduler-status')}</strong>{' '}
<LinkButton href="https://discuss.flarum.org/d/24118" external={true} target="_blank" icon="fas fa-info-circle" />
<LinkButton href="https://docs.flarum.org/scheduler" external={true} target="_blank" icon="fas fa-info-circle" />
</span>,
<br />,
app.data.schedulerStatus,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ protected function getDefaultAttributes($discussion)

return [
'title' => $discussion->title,
'slug' => $this->slugManager->forResource(Discussion::class)->toSlug($discussion),
'slug' => $this->slugManager->forResource(Discussion::class)->toSlug($discussion),
];
}

Expand Down
4 changes: 2 additions & 2 deletions framework/core/src/Api/Serializer/BasicPostSerializer.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ protected function getDefaultAttributes($post)
}

$attributes = [
'number' => (int) $post->number,
'createdAt' => $this->formatDate($post->created_at),
'number' => (int) $post->number,
'createdAt' => $this->formatDate($post->created_at),
'contentType' => $post->type
];

Expand Down
6 changes: 3 additions & 3 deletions framework/core/src/Api/Serializer/BasicUserSerializer.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ protected function getDefaultAttributes($user)
}

return [
'username' => $user->username,
'username' => $user->username,
'displayName' => $user->display_name,
'avatarUrl' => $user->avatar_url,
'slug' => $this->slugManager->forResource(User::class)->toSlug($user)
'avatarUrl' => $user->avatar_url,
'slug' => $this->slugManager->forResource(User::class)->toSlug($user)
];
}

Expand Down
14 changes: 7 additions & 7 deletions framework/core/src/Api/Serializer/CurrentUserSerializer.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ protected function getDefaultAttributes($user)
$attributes = parent::getDefaultAttributes($user);

$attributes += [
'isEmailConfirmed' => (bool) $user->is_email_confirmed,
'email' => $user->email,
'markedAllAsReadAt' => $this->formatDate($user->marked_all_as_read_at),
'unreadNotificationCount' => (int) $user->getUnreadNotificationCount(),
'newNotificationCount' => (int) $user->getNewNotificationCount(),
'preferences' => (array) $user->preferences,
'isAdmin' => $user->isAdmin(),
'isEmailConfirmed' => (bool) $user->is_email_confirmed,
'email' => $user->email,
'markedAllAsReadAt' => $this->formatDate($user->marked_all_as_read_at),
'unreadNotificationCount' => (int) $user->getUnreadNotificationCount(),
'newNotificationCount' => (int) $user->getNewNotificationCount(),
'preferences' => (array) $user->preferences,
'isAdmin' => $user->isAdmin(),
];

return $attributes;
Expand Down
18 changes: 9 additions & 9 deletions framework/core/src/Api/Serializer/DiscussionSerializer.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ class DiscussionSerializer extends BasicDiscussionSerializer
protected function getDefaultAttributes($discussion)
{
$attributes = parent::getDefaultAttributes($discussion) + [
'commentCount' => (int) $discussion->comment_count,
'participantCount' => (int) $discussion->participant_count,
'createdAt' => $this->formatDate($discussion->created_at),
'lastPostedAt' => $this->formatDate($discussion->last_posted_at),
'lastPostNumber' => (int) $discussion->last_post_number,
'canReply' => $this->actor->can('reply', $discussion),
'canRename' => $this->actor->can('rename', $discussion),
'canDelete' => $this->actor->can('delete', $discussion),
'canHide' => $this->actor->can('hide', $discussion)
'commentCount' => (int) $discussion->comment_count,
'participantCount' => (int) $discussion->participant_count,
'createdAt' => $this->formatDate($discussion->created_at),
'lastPostedAt' => $this->formatDate($discussion->last_posted_at),
'lastPostNumber' => (int) $discussion->last_post_number,
'canReply' => $this->actor->can('reply', $discussion),
'canRename' => $this->actor->can('rename', $discussion),
'canDelete' => $this->actor->can('delete', $discussion),
'canHide' => $this->actor->can('hide', $discussion)
];

if ($discussion->hidden_at) {
Expand Down
2 changes: 1 addition & 1 deletion framework/core/src/Api/Serializer/ForumSerializer.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ protected function getDefaultAttributes($model): array
'headerHtml' => $this->settings->get('custom_header'),
'footerHtml' => $this->settings->get('custom_footer'),
'allowSignUp' => (bool) $this->settings->get('allow_sign_up'),
'defaultRoute' => $this->settings->get('default_route'),
'defaultRoute' => $this->settings->get('default_route'),
'canViewForum' => $this->actor->can('viewForum'),
'canStartDiscussion' => $this->actor->can('startDiscussion'),
'canSearchUsers' => $this->actor->can('searchUsers'),
Expand Down
8 changes: 4 additions & 4 deletions framework/core/src/Api/Serializer/GroupSerializer.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ protected function getDefaultAttributes($group)

return [
'nameSingular' => $this->translateGroupName($group->name_singular),
'namePlural' => $this->translateGroupName($group->name_plural),
'color' => $group->color,
'icon' => $group->icon,
'isHidden' => $group->is_hidden
'namePlural' => $this->translateGroupName($group->name_plural),
'color' => $group->color,
'icon' => $group->icon,
'isHidden' => $group->is_hidden
];
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ protected function getDefaultAttributes($notification)

return [
'contentType' => $notification->type,
'content' => $notification->data,
'createdAt' => $this->formatDate($notification->created_at),
'isRead' => (bool) $notification->read_at
'content' => $notification->data,
'createdAt' => $this->formatDate($notification->created_at),
'isRead' => (bool) $notification->read_at
];
}

Expand Down
4 changes: 2 additions & 2 deletions framework/core/src/Api/Serializer/PostSerializer.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ protected function getDefaultAttributes($post)
}

$attributes += [
'canEdit' => $canEdit,
'canEdit' => $canEdit,
'canDelete' => $this->actor->can('delete', $post),
'canHide' => $this->actor->can('hide', $post)
'canHide' => $this->actor->can('hide', $post)
];

return $attributes;
Expand Down
14 changes: 7 additions & 7 deletions framework/core/src/Api/Serializer/UserSerializer.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ protected function getDefaultAttributes($user)
$attributes = parent::getDefaultAttributes($user);

$attributes += [
'joinTime' => $this->formatDate($user->joined_at),
'discussionCount' => (int) $user->discussion_count,
'commentCount' => (int) $user->comment_count,
'canEdit' => $this->actor->can('edit', $user),
'joinTime' => $this->formatDate($user->joined_at),
'discussionCount' => (int) $user->discussion_count,
'commentCount' => (int) $user->comment_count,
'canEdit' => $this->actor->can('edit', $user),
'canEditCredentials' => $this->actor->can('editCredentials', $user),
'canEditGroups' => $this->actor->can('editGroups', $user),
'canDelete' => $this->actor->can('delete', $user),
'canEditGroups' => $this->actor->can('editGroups', $user),
'canDelete' => $this->actor->can('delete', $user),
];

if ($user->getPreference('discloseOnline') || $this->actor->can('viewLastSeenAt', $user)) {
Expand All @@ -38,7 +38,7 @@ protected function getDefaultAttributes($user)
if ($attributes['canEditCredentials'] || $this->actor->id === $user->id) {
$attributes += [
'isEmailConfirmed' => (bool) $user->is_email_confirmed,
'email' => $user->email
'email' => $user->email
];
}

Expand Down
16 changes: 8 additions & 8 deletions framework/core/src/Extension/Extension.php
Original file line number Diff line number Diff line change
Expand Up @@ -510,15 +510,15 @@ public function migrate(Migrator $migrator, $direction = 'up')
public function toArray()
{
return (array) array_merge([
'id' => $this->getId(),
'version' => $this->getVersion(),
'path' => $this->getPath(),
'icon' => $this->getIcon(),
'hasAssets' => $this->hasAssets(),
'hasMigrations' => $this->hasMigrations(),
'id' => $this->getId(),
'version' => $this->getVersion(),
'path' => $this->getPath(),
'icon' => $this->getIcon(),
'hasAssets' => $this->hasAssets(),
'hasMigrations' => $this->hasMigrations(),
'extensionDependencyIds' => $this->getExtensionDependencyIds(),
'optionalDependencyIds' => $this->getOptionalDependencyIds(),
'links' => $this->getLinks(),
'optionalDependencyIds' => $this->getOptionalDependencyIds(),
'links' => $this->getLinks(),
], $this->composerJson);
}

Expand Down
8 changes: 4 additions & 4 deletions framework/core/src/Filesystem/FilesystemServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,14 @@ public function register()
return [
'flarum-assets' => function (Paths $paths, UrlGenerator $url) {
return [
'root' => "$paths->public/assets",
'url' => $url->to('forum')->path('assets')
'root' => "$paths->public/assets",
'url' => $url->to('forum')->path('assets')
];
},
'flarum-avatars' => function (Paths $paths, UrlGenerator $url) {
return [
'root' => "$paths->public/assets/avatars",
'url' => $url->to('forum')->path('assets/avatars')
'root' => "$paths->public/assets/avatars",
'url' => $url->to('forum')->path('assets/avatars')
];
},
];
Expand Down
32 changes: 16 additions & 16 deletions framework/core/src/Foundation/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -336,22 +336,22 @@ protected function fireAppCallbacks(array $callbacks)
public function registerCoreContainerAliases()
{
$aliases = [
'app' => [\Illuminate\Contracts\Container\Container::class, \Illuminate\Contracts\Foundation\Application::class, \Psr\Container\ContainerInterface::class],
'blade.compiler' => [\Illuminate\View\Compilers\BladeCompiler::class],
'cache' => [\Illuminate\Cache\CacheManager::class, \Illuminate\Contracts\Cache\Factory::class],
'cache.store' => [\Illuminate\Cache\Repository::class, \Illuminate\Contracts\Cache\Repository::class],
'config' => [\Illuminate\Config\Repository::class, \Illuminate\Contracts\Config\Repository::class],
'db' => [\Illuminate\Database\DatabaseManager::class],
'db.connection' => [\Illuminate\Database\Connection::class, \Illuminate\Database\ConnectionInterface::class],
'events' => [\Illuminate\Events\Dispatcher::class, \Illuminate\Contracts\Events\Dispatcher::class],
'files' => [\Illuminate\Filesystem\Filesystem::class],
'filesystem' => [\Illuminate\Filesystem\FilesystemManager::class, \Illuminate\Contracts\Filesystem\Factory::class],
'filesystem.disk' => [\Illuminate\Contracts\Filesystem\Filesystem::class],
'filesystem.cloud' => [\Illuminate\Contracts\Filesystem\Cloud::class],
'hash' => [\Illuminate\Contracts\Hashing\Hasher::class],
'mailer' => [\Illuminate\Mail\Mailer::class, \Illuminate\Contracts\Mail\Mailer::class, \Illuminate\Contracts\Mail\MailQueue::class],
'validator' => [\Illuminate\Validation\Factory::class, \Illuminate\Contracts\Validation\Factory::class],
'view' => [\Illuminate\View\Factory::class, \Illuminate\Contracts\View\Factory::class],
'app' => [\Illuminate\Contracts\Container\Container::class, \Illuminate\Contracts\Foundation\Application::class, \Psr\Container\ContainerInterface::class],
'blade.compiler' => [\Illuminate\View\Compilers\BladeCompiler::class],
'cache' => [\Illuminate\Cache\CacheManager::class, \Illuminate\Contracts\Cache\Factory::class],
'cache.store' => [\Illuminate\Cache\Repository::class, \Illuminate\Contracts\Cache\Repository::class],
'config' => [\Illuminate\Config\Repository::class, \Illuminate\Contracts\Config\Repository::class],
'db' => [\Illuminate\Database\DatabaseManager::class],
'db.connection' => [\Illuminate\Database\Connection::class, \Illuminate\Database\ConnectionInterface::class],
'events' => [\Illuminate\Events\Dispatcher::class, \Illuminate\Contracts\Events\Dispatcher::class],
'files' => [\Illuminate\Filesystem\Filesystem::class],
'filesystem' => [\Illuminate\Filesystem\FilesystemManager::class, \Illuminate\Contracts\Filesystem\Factory::class],
'filesystem.disk' => [\Illuminate\Contracts\Filesystem\Filesystem::class],
'filesystem.cloud' => [\Illuminate\Contracts\Filesystem\Cloud::class],
'hash' => [\Illuminate\Contracts\Hashing\Hasher::class],
'mailer' => [\Illuminate\Mail\Mailer::class, \Illuminate\Contracts\Mail\Mailer::class, \Illuminate\Contracts\Mail\MailQueue::class],
'validator' => [\Illuminate\Validation\Factory::class, \Illuminate\Contracts\Validation\Factory::class],
'view' => [\Illuminate\View\Factory::class, \Illuminate\Contracts\View\Factory::class],
];

foreach ($aliases as $key => $aliases) {
Expand Down
6 changes: 3 additions & 3 deletions framework/core/src/Frontend/FrontendServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,19 +136,19 @@ function (Container $container) {

$this->container->singleton('flarum.less.config', function (Container $container) {
return [
'config-primary-color' => [
'config-primary-color' => [
'key' => 'theme_primary_color',
],
'config-secondary-color' => [
'key' => 'theme_secondary_color',
],
'config-dark-mode' => [
'config-dark-mode' => [
'key' => 'theme_dark_mode',
'callback' => function ($value) {
return $value ? 'true' : 'false';
},
],
'config-colored-header' => [
'config-colored-header' => [
'key' => 'theme_colored_header',
'callback' => function ($value) {
return $value ? 'true' : 'false';
Expand Down
20 changes: 10 additions & 10 deletions framework/core/src/Install/DatabaseConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,17 @@ public function __construct($driver, $host, $port, $database, $username, $passwo
public function toArray()
{
return [
'driver' => $this->driver,
'host' => $this->host,
'port' => $this->port,
'database' => $this->database,
'username' => $this->username,
'password' => $this->password,
'charset' => 'utf8mb4',
'driver' => $this->driver,
'host' => $this->host,
'port' => $this->port,
'database' => $this->database,
'username' => $this->username,
'password' => $this->password,
'charset' => 'utf8mb4',
'collation' => 'utf8mb4_unicode_ci',
'prefix' => $this->prefix,
'strict' => false,
'engine' => 'InnoDB',
'prefix' => $this->prefix,
'strict' => false,
'engine' => 'InnoDB',
'prefix_indexes' => true
];
}
Expand Down
Loading
Loading