-
Notifications
You must be signed in to change notification settings - Fork 3
feat(api): Send a global notification regarding the policy update #1222
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
Open
dati18
wants to merge
7
commits into
main
Choose a base branch
from
dat/policy-noti
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
53a12ed
feat(api): Send a global notification regarding the policy update
dati18 2eaf423
Add test class
dati18 4e205a6
Add SendPolicyAnnouncementJob job class
dati18 6681bb6
Adjust email styling
dati18 49598fb
minor fix
dati18 55e1c84
fix formatting
dati18 45c86af
fix email content
dati18 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| <?php | ||
|
|
||
| namespace App\Jobs; | ||
|
|
||
| use App\Notifications\PolicyAnnouncementNotification; | ||
| use App\User; | ||
| use Illuminate\Support\Facades\Notification; | ||
|
|
||
| class SendPolicyAnnouncementJob extends Job { | ||
| public function handle() { | ||
| $users = User::query()->whereNotNull('email')->get(); | ||
|
|
||
| Notification::send($users, new PolicyAnnouncementNotification()); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| <?php | ||
|
|
||
| namespace App\Notifications; | ||
|
|
||
| use Illuminate\Notifications\Messages\MailMessage; | ||
| use Illuminate\Notifications\Notification; | ||
| use Illuminate\Support\Facades\Lang; | ||
| use Illuminate\Support\HtmlString; | ||
|
|
||
| class PolicyAnnouncementNotification extends Notification { | ||
| /** | ||
| * Get the notification's delivery channels. | ||
| * | ||
| * @param mixed $notifiable | ||
| * @return array<int, string> | ||
| */ | ||
| public function via($notifiable): array { | ||
| return ['mail']; | ||
| } | ||
|
|
||
| /** | ||
| * Build the mail representation of the notification. | ||
| * | ||
| * @param mixed $notifiable | ||
| */ | ||
| public function toMail($notifiable): MailMessage { | ||
| return (new MailMessage()) | ||
| ->from('noreply@wikibase.cloud', 'Wikibase Cloud') | ||
| ->subject(Lang::get('Please review and accept the updated Terms of Use and new Hosting Policy')) | ||
| ->greeting(Lang::get('Dear Wikibase Cloud user,')) | ||
| ->line(new HtmlString(Lang::get('We\'ve made two updates to the agreements that help run and maintain Wikibase Cloud. Please review and accept them if you agree. You can do it by logging in to the <a href="https://www.wikibase.cloud/">website</a>.'))) | ||
| ->line('') | ||
| ->line(new HtmlString(Lang::get('What are we talking about and why is that important?'))) | ||
| ->line('') | ||
| ->line(new HtmlString(Lang::get('<p><strong>1. Updated Terms of Use</strong></p>'))) | ||
| ->line(new HtmlString(Lang::get('In order to comply with the European Union\'s Digital Services Act (DSA) and to build more transparency on how Wikibase Cloud works, we\'ve revised our <a href="https://www.wikibase.cloud/terms-of-use">Terms of Use</a>. The main additions are a clear way to report illegal content, an explanation of how we handle content moderation, and a complaints-and-appeals process. These changes don\'t affect how you build or run your Wikibases.'))) | ||
| ->line('') | ||
| ->line(new HtmlString(Lang::get('<p><strong>2. New Hosting Policy</strong></p>'))) | ||
| ->line(new HtmlString(Lang::get('We\'re introducing a <a href="https://www.wikibase.cloud/hosting-policy">Hosting Policy</a> for the first time. As a mission-driven non-profit, Wikimedia Deutschland wants Wikibase Cloud to be used purposefully and in line with our mission, that is: hosting open knowledge that serves the public and strengthens the wider Wikibase Ecosystem. The policy indicates driving factors for what the platform is for as well as the kinds of projects it\'s here to support, and lastly the basic expectations for Wikibases hosted on it.'))) | ||
| ->line('') | ||
| ->line(new HtmlString(Lang::get('For now, we ask you to read through the documents when you log in next, and decide whether you agree with them. We want to add that we can no longer maintain your Wikibase in case you do not agree with these changes.'))) | ||
| ->line('') | ||
| ->line(Lang::get('Please note that nothing changes for your Wikibase today.')) | ||
| ->line('') | ||
| ->line(new HtmlString(Lang::get('<p><strong>One thing to know for later</strong></p>'))) | ||
| ->line(Lang::get('Starting at the end of September, the Hosting Policy introduces a temporary-by-default model. To keep your Wikibase online long-term, you\'ll submit it for a short review, and you\'ll have 3 months to do so. We\'ll explain exactly how later - no Wikibase will be affected without clear notice.')) | ||
| ->line('') | ||
| ->line(new HtmlString(Lang::get('We\'d encourage you to read the <a href="https://www.wikibase.cloud/hosting-policy">Hosting Policy</a> now and consider whether your Wikibase fits what Wikibase Cloud is for. If it\'s a good fit, the review will be straightforward. If it isn\'t, it\'s better to know early - you\'ll have time to export your data and find a new home for it by the end of the year.'))) | ||
| ->line('') | ||
| ->line(new HtmlString(Lang::get('Feel free to <a href="https://www.wikibase.cloud/contact">contact us</a> if any of the above needs clarification on your end.'))) | ||
| ->line('') | ||
| ->line(Lang::get('Thanks for embarking on this journey with us!')) | ||
| ->line(''); | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| <?php | ||
|
|
||
| namespace Tests\Jobs; | ||
|
|
||
| use App\Jobs\SendPolicyAnnouncementJob; | ||
| use App\Notifications\PolicyAnnouncementNotification; | ||
| use App\User; | ||
| use Illuminate\Foundation\Testing\RefreshDatabase; | ||
| use Illuminate\Support\Facades\Notification; | ||
| use Tests\TestCase; | ||
|
|
||
| class SendPolicyAnnouncementJobTest extends TestCase { | ||
| use RefreshDatabase; | ||
|
|
||
| public function testThePolicyAnnouncementEmailToAllUsers() { | ||
| Notification::fake(); | ||
|
|
||
| for ($i = 0; $i < 10; $i++) { | ||
| User::factory()->create(); | ||
| } | ||
|
|
||
| $users = User::all(); | ||
|
|
||
| $job = new SendPolicyAnnouncementJob(); | ||
| $job->handle(); | ||
|
|
||
| Notification::assertSentTo($users, PolicyAnnouncementNotification::class); | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.