<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[13690] sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events: Translate: Sync "Translation Events" from GitHub</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { white-space: pre-line; overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="http://meta.trac.wordpress.org/changeset/13690">13690</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"http://meta.trac.wordpress.org/changeset/13690","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>amieiro</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2024-05-10 12:42:51 +0000 (Fri, 10 May 2024)</dd>
</dl>
<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>Translate: Sync "Translation Events" from GitHub</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginswporggptranslationeventsREADMEmd">sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/README.md</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginswporggptranslationeventsassetscsstranslationeventscss">sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/assets/css/translation-events.css</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginswporggptranslationeventsautoloadphp">sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/autoload.php</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginswporggptranslationeventsincludesattendeeattendeerepositoryphp">sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/includes/attendee/attendee-repository.php</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginswporggptranslationeventsincludeseventeventrepositoryphp">sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/includes/event/event-repository.php</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginswporggptranslationeventsincludesurlsphp">sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/includes/urls.php</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginswporggptranslationeventstemplateseventsattendeesphp">sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/templates/events-attendees.php</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginswporggptranslationeventswporggptranslationeventsphp">sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/wporg-gp-translation-events.php</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginswporggptranslationeventsincludesroutesattendeeremovephp">sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/includes/routes/attendee/remove.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginswporggptranslationeventsREADMEmd"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/README.md</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/README.md 2024-05-10 04:19:03 UTC (rev 13689)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/README.md 2024-05-10 12:42:51 UTC (rev 13690)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,5 +1,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> # wporg-gp-translation-events
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+Here we are implementing Translation Events, as discussed in our Polyglots Make P2 Post: [Translation Events Prototype](https://make.wordpress.org/polyglots/2024/02/28/translation-events-prototype/).
+
</ins><span class="cx" style="display: block; padding: 0 10px"> ## Development environment
</span><span class="cx" style="display: block; padding: 0 10px"> First follow [instructions to install `wp-env`](https://developer.wordpress.org/block-editor/reference-guides/packages/packages-env/#prerequisites).
</span><span class="cx" style="display: block; padding: 0 10px">
</span></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginswporggptranslationeventsassetscsstranslationeventscss"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/assets/css/translation-events.css</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/assets/css/translation-events.css 2024-05-10 04:19:03 UTC (rev 13689)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/assets/css/translation-events.css 2024-05-10 12:42:51 UTC (rev 13690)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -52,10 +52,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> .event-details-stats table {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- margin: 1rem;
-}
-
-.event-details-stats table {
</del><span class="cx" style="display: block; padding: 0 10px"> width: 100%;
</span><span class="cx" style="display: block; padding: 0 10px"> table-layout: fixed;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -64,6 +60,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> .event-details-stats table td {
</span><span class="cx" style="display: block; padding: 0 10px"> padding: 1em;
</span><span class="cx" style="display: block; padding: 0 10px"> text-align: center;
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ vertical-align: middle;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> .event-details-stats table td:first-child {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -244,6 +241,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> .event-page-wrapper {
</span><span class="cx" style="display: block; padding: 0 10px"> margin: 0 auto;
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ padding: 1em 0;
</ins><span class="cx" style="display: block; padding: 0 10px"> width: 80%;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -256,7 +254,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> input[type="submit"].convert-to-host {
</span><span class="cx" style="display: block; padding: 0 10px"> text-align: center;
</span><span class="cx" style="display: block; padding: 0 10px"> display: inline;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- margin-top: 1em;
</del><span class="cx" style="display: block; padding: 0 10px"> font-weight: bold;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -384,7 +381,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> ul.event-attendees-filter {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- padding-left: 1rem;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ margin-left: 0;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> ul.event-attendees-filter li {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -424,6 +421,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> #quick-add {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ margin-top: -1em;
</ins><span class="cx" style="display: block; padding: 0 10px"> padding: 0 .5em;
</span><span class="cx" style="display: block; padding: 0 10px"> border-left: #d9d8d8 thin solid;
</span><span class="cx" style="display: block; padding: 0 10px"> border-bottom: #d9d8d8 thin solid;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -431,6 +429,19 @@
</span><span class="cx" style="display: block; padding: 0 10px"> overflow: auto;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+a.remove-attendee.button {
+ background-color: var(--gp-color-btn-danger-bg);
+ color: var(--gp-color-btn-danger-text);
+ border-color: var(----gp-color-btn-danger-border);
+ margin-left: .1em;
+}
+
+a.remove-attendee.button:hover {
+ background-color: var(--gp-color-btn-danger-hover-bg);
+ color: var(--gp-color-btn-danger-hover-text);
+ border-color: var(----gp-color-btn-danger-hover-border);
+}
+
</ins><span class="cx" style="display: block; padding: 0 10px"> /* show the event-details-right below instead of on the right on mobile */
</span><span class="cx" style="display: block; padding: 0 10px"> @media (max-width: 768px) {
</span><span class="cx" style="display: block; padding: 0 10px">
</span></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginswporggptranslationeventsautoloadphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/autoload.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/autoload.php 2024-05-10 04:19:03 UTC (rev 13689)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/autoload.php 2024-05-10 12:42:51 UTC (rev 13690)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -33,3 +33,5 @@
</span><span class="cx" style="display: block; padding: 0 10px"> require_once __DIR__ . '/includes/project/project-repository.php';
</span><span class="cx" style="display: block; padding: 0 10px"> require_once __DIR__ . '/includes/translation/translation-repository.php';
</span><span class="cx" style="display: block; padding: 0 10px"> require_once __DIR__ . '/includes/event-text-snippet.php';
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+require_once __DIR__ . '/includes/routes/attendee/list.php';
+require_once __DIR__ . '/includes/routes/attendee/remove.php';
</ins></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginswporggptranslationeventsincludesattendeeattendeerepositoryphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/includes/attendee/attendee-repository.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/includes/attendee/attendee-repository.php 2024-05-10 04:19:03 UTC (rev 13689)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/includes/attendee/attendee-repository.php 2024-05-10 12:42:51 UTC (rev 13690)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -66,6 +66,19 @@
</span><span class="cx" style="display: block; padding: 0 10px"> '%d',
</span><span class="cx" style="display: block; padding: 0 10px"> ),
</span><span class="cx" style="display: block; padding: 0 10px"> );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ $wpdb->delete(
+ "{$gp_table_prefix}event_actions",
+ array(
+ 'event_id' => $event_id,
+ 'user_id' => $user_id,
+ ),
+ array(
+ '%d',
+ '%d',
+ ),
+ );
+
</ins><span class="cx" style="display: block; padding: 0 10px"> // phpcs:enable
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginswporggptranslationeventsincludeseventeventrepositoryphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/includes/event/event-repository.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/includes/event/event-repository.php 2024-05-10 04:19:03 UTC (rev 13689)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/includes/event/event-repository.php 2024-05-10 12:42:51 UTC (rev 13690)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -130,7 +130,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> try {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $meta = $this->get_event_meta( $id );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $meta = $this->get_event_meta( $id );
+ if ( ! $meta ) {
+ return null;
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> $event = new Event(
</span><span class="cx" style="display: block; padding: 0 10px"> intval( $post->post_author ),
</span><span class="cx" style="display: block; padding: 0 10px"> $meta['start'],
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -501,10 +504,14 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * @throws Exception
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- private function get_event_meta( int $event_id ): array {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ private function get_event_meta( int $event_id ): ?array {
</ins><span class="cx" style="display: block; padding: 0 10px"> $meta = get_post_meta( $event_id );
</span><span class="cx" style="display: block; padding: 0 10px"> $utc = new DateTimeZone( 'UTC' );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( ! isset( $meta['_event_start'][0], $meta['_event_end'][0], $meta['_event_timezone'][0] ) ) {
+ return null;
+ }
+
</ins><span class="cx" style="display: block; padding: 0 10px"> return array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'start' => new Event_Start_Date( $meta['_event_start'][0], $utc ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'end' => new Event_End_Date( $meta['_event_end'][0], $utc ),
</span></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginswporggptranslationeventsincludesroutesattendeeremovephp"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/includes/routes/attendee/remove.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/includes/routes/attendee/remove.php (rev 0)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/includes/routes/attendee/remove.php 2024-05-10 12:42:51 UTC (rev 13690)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,61 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<?php
+
+namespace Wporg\TranslationEvents\Routes\Attendee;
+
+use Wporg\TranslationEvents\Attendee\Attendee;
+use Wporg\TranslationEvents\Attendee\Attendee_Repository;
+use Wporg\TranslationEvents\Event\Event_Repository_Interface;
+use Wporg\TranslationEvents\Routes\Route;
+use Wporg\TranslationEvents\Translation_Events;
+use Wporg\TranslationEvents\Urls;
+
+/**
+ * Remove an attendee from an event.
+ */
+class Remove_Attendee_Route extends Route {
+ private Event_Repository_Interface $event_repository;
+ private Attendee_Repository $attendee_repository;
+
+ /**
+ * Remove_Attendee_Route constructor.
+ */
+ public function __construct() {
+ parent::__construct();
+ $this->event_repository = Translation_Events::get_event_repository();
+ $this->attendee_repository = Translation_Events::get_attendee_repository();
+ }
+
+ /**
+ * Handle the request to remove an attendee from an event.
+ *
+ * @param int $event_id The event slug.
+ * @param int $user_id The user ID.
+ * @return void
+ */
+ public function handle( int $event_id, int $user_id ): void {
+ global $wp;
+ if ( ! is_user_logged_in() ) {
+ wp_safe_redirect( wp_login_url( home_url( $wp->request ) ) );
+ exit;
+ }
+
+ $event = $this->event_repository->get_event( $event_id );
+ if ( ! $event ) {
+ $this->die_with_404();
+ }
+ if ( ! current_user_can( 'edit_translation_event_attendees', $event->id() ) ) {
+ $this->die_with_error( esc_html__( 'You do not have permission to edit this event.', 'gp-translation-events' ), 403 );
+ }
+
+ $attendee = $this->attendee_repository->get_attendee( $event->id(), $user_id );
+ if ( $attendee instanceof Attendee ) {
+ if ( ! current_user_can( 'edit_translation_event_attendees', $event->id() ) ) {
+ $this->die_with_error( esc_html__( 'You do not have permission to remove this attendee.', 'gp-translation-events' ), 400 );
+ }
+ $this->attendee_repository->remove_attendee( $event->id(), $user_id );
+ }
+
+ wp_safe_redirect( Urls::event_attendees( $event->id() ) );
+ exit;
+ }
+}
</ins><span class="cx" style="display: block; padding: 0 10px">Property changes on: sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/includes/routes/attendee/remove.php
</span><span class="cx" style="display: block; padding: 0 10px">___________________________________________________________________
</span></span></pre></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: svn:eol-style</h4></div>
<ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+native
</ins><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of property
</span><a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginswporggptranslationeventsincludesurlsphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/includes/urls.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/includes/urls.php 2024-05-10 04:19:03 UTC (rev 13689)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/includes/urls.php 2024-05-10 12:42:51 UTC (rev 13690)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -12,14 +12,21 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> public static function event_details( int $event_id ): string {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return gp_url( wp_make_link_relative( get_the_permalink( $event_id ) ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Drafts don't yet have a slug, so we need to generate a sample permalink.
+ if ( 'draft' === get_post_status( $event_id ) ) {
+ // get_sample_permalink is only available in the admin, so we need to include the file in case we are elsewhere.
+ require_once ABSPATH . '/wp-admin/includes/post.php';
+ list( $permalink, $post_name ) = get_sample_permalink( $event_id );
+ $permalink = str_replace( '%pagename%', $post_name, $permalink );
+ } else {
+ $permalink = get_permalink( $event_id );
+ }
+
+ return gp_url( wp_make_link_relative( $permalink ) );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> public static function event_details_absolute( int $event_id ): string {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- list( $permalink, $post_name ) = get_sample_permalink( $event_id );
- $permalink = str_replace( '%pagename%', $post_name, $permalink );
-
- return get_site_url() . gp_url( wp_make_link_relative( $permalink ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return site_url( self::event_details( $event_id ) );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> public static function event_translations( int $event_id, string $locale, string $status = '' ): string {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -57,4 +64,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> public static function event_attendees( int $event_id ): string {
</span><span class="cx" style="display: block; padding: 0 10px"> return self::event_details( $event_id ) . 'attendees/';
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ public static function event_remove_attendee( int $event_id, int $user_id ): string {
+ return gp_url( "/events/$event_id/attendees/remove/$user_id" );
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginswporggptranslationeventstemplateseventsattendeesphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/templates/events-attendees.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/templates/events-attendees.php 2024-05-10 04:19:03 UTC (rev 13689)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/templates/events-attendees.php 2024-05-10 12:42:51 UTC (rev 13690)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -52,6 +52,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> <?php else : ?>
</span><span class="cx" style="display: block; padding: 0 10px"> <input type="submit" class="button is-secondary convert-to-host" value="<?php echo esc_attr__( 'Make co-host', 'gp-translation-events' ); ?>"/>
</span><span class="cx" style="display: block; padding: 0 10px"> <?php endif; ?>
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ <?php if ( ! $attendee->is_host() ) : ?>
+ <a href="<?php echo esc_url( Urls::event_remove_attendee( $event->id(), $attendee->user_id() ) ); ?>" class="button remove-attendee"><?php esc_html_e( 'Remove', 'gp-translation-events' ); ?></a>
+ <?php endif; ?>
</ins><span class="cx" style="display: block; padding: 0 10px"> </form>
</span><span class="cx" style="display: block; padding: 0 10px"> </td>
</span><span class="cx" style="display: block; padding: 0 10px"> </tr>
</span></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginswporggptranslationeventswporggptranslationeventsphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/wporg-gp-translation-events.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/wporg-gp-translation-events.php 2024-05-10 04:19:03 UTC (rev 13689)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/wporg-gp-translation-events.php 2024-05-10 12:42:51 UTC (rev 13690)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -112,6 +112,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> GP::$router->add( "/events/$slug/translations/$locale", array( 'Wporg\TranslationEvents\Routes\Event\Translations_Route', 'handle' ) );
</span><span class="cx" style="display: block; padding: 0 10px"> GP::$router->add( "/events/$slug", array( 'Wporg\TranslationEvents\Routes\Event\Details_Route', 'handle' ) );
</span><span class="cx" style="display: block; padding: 0 10px"> GP::$router->add( "/events/$slug/attendees", array( 'Wporg\TranslationEvents\Routes\Attendee\List_Route', 'handle' ) );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ GP::$router->add( "/events/$id/attendees/remove/$id", array( 'Wporg\TranslationEvents\Routes\Attendee\Remove_Attendee_Route', 'handle' ) );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $stats_listener = new Stats_Listener(
</span><span class="cx" style="display: block; padding: 0 10px"> self::get_event_repository(),
</span></span></pre>
</div>
</div>
</body>
</html>