Skip to content

Commit

Permalink
Merge branch '6.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
dtdesign committed Nov 20, 2023
2 parents 40163d7 + 3859b5e commit fb97af0
Show file tree
Hide file tree
Showing 118 changed files with 445 additions and 207 deletions.
Binary file modified com.woltlab.wcf/files_pre_check.tar
Binary file not shown.
2 changes: 1 addition & 1 deletion com.woltlab.wcf/mediaProvider.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ https?://vimeo\.com/groups/[^/]+/videos/(?P<ID>\d+)/?(?P<hash>(?(?<=/)[a-zA-Z0-9
<title>Spotify</title>
<regex><![CDATA[https?://play.spotify.com/(.*/|)(?<TYPE>[a-zA-Z]+)/(?<ID>[0-9a-zA-Z]+)
https?://open.spotify.com/(.*/|)(?<TYPE>[a-zA-Z]+)/(?<ID>[0-9a-zA-Z]+)]]></regex>
<html><![CDATA[<iframe style="border-radius:12px" src="https://open.spotify.com/embed/{$TYPE}/{$ID}" width="400" height="152" frameBorder="0" allowfullscreen="" allow="autoplay; clipboard-write; encrypted-media; fullscreen; picture-in-picture" loading="lazy"></iframe>]]></html>
<html><![CDATA[<iframe style="border-radius:12px;max-width:100%;" src="https://open.spotify.com/embed/{$TYPE}/{$ID}" width="400" height="152" frameBorder="0" allowfullscreen="" allow="autoplay; clipboard-write; encrypted-media; fullscreen; picture-in-picture" loading="lazy"></iframe>]]></html>
</provider>
<provider name="twitch">
<title>Twitch</title>
Expand Down
9 changes: 5 additions & 4 deletions com.woltlab.wcf/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
<instructions type="update" fromversion="5.5.*">
<!--
tar cvf com.woltlab.wcf/files_pre_check.tar -C wcfsetup/install/files/ \
acp/update_com.woltlab.wcf_6.0_articleOrphans.php \
acp/update_com.woltlab.wcf_6.0_checkSystemRequirements.php \
acp/update_com.woltlab.wcf_6.0_checkCache.php \
acp/update_com.woltlab.wcf_6.0_checkAttachmentStorage.php \
Expand Down Expand Up @@ -82,6 +83,9 @@ tar cvf com.woltlab.wcf/files_pre_check.tar -C wcfsetup/install/files/ \
<!-- Set up an empty bootstrap file if its does not exist. -->
<instruction type="script" run="standalone">acp/update_com.woltlab.wcf_6.0_initBootstrap.php</instruction>

<!-- Run before the new code, because some plugins are triggered that would be incompatible. -->
<instruction type="script" run="standalone">acp/update_com.woltlab.wcf_6.0_articleOrphans.php</instruction>

<!-- Deploy new application code. -->
<instruction type="file" />
<instruction type="acpTemplate" />
Expand All @@ -94,11 +98,8 @@ tar cvf com.woltlab.wcf/files_pre_check.tar -C wcfsetup/install/files/ \
<!-- Run before the database migrations, because the data is gone otherwise. -->
<instruction type="script" run="standalone">acp/update_com.woltlab.wcf_6.0_landingPage.php</instruction>

<!-- Run before the database migrations, because otherwise the migration fails. -->
<instruction type="script" run="standalone">acp/update_com.woltlab.wcf_6.0_articleOrphans.php</instruction>

<!-- Migrate the database as early as possible. -->
<instruction type="database" run="standalone">acp/database/update_com.woltlab.wcf_6.0_reaction_fk_step1.php</instruction>
<instruction type="script" run="standalone">acp/update_com.woltlab.wcf_6.0_reaction_fk_step1.php</instruction>
<instruction type="database" run="standalone">acp/database/update_com.woltlab.wcf_6.0_reaction_fk_step2.php</instruction>

<instruction type="database" run="standalone">acp/database/update_com.woltlab.wcf_6.0.php</instruction>
Expand Down
2 changes: 1 addition & 1 deletion com.woltlab.wcf/templates/article.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@
{event name='beforeArticleContent'}

<div class="section articleContent" {@$__wcf->getReactionHandler()->getDataAttributes('com.woltlab.wcf.likeableArticle', $article->articleID)}>
<div class="section htmlContent">
<div class="section htmlContent" itemprop="description articleBody">
{if MODULE_WCF_AD}
{@$__wcf->getAdHandler()->getAds('com.woltlab.wcf.article.inArticle')}
{/if}
Expand Down
2 changes: 0 additions & 2 deletions ts/WoltLabSuite/Core/Date/Util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,13 @@ const dateFormatter = new Intl.DateTimeFormat(locale, { dateStyle: "long" });
const timeFormatter = new Intl.DateTimeFormat(locale, {
hour: "numeric",
minute: "numeric",
second: "numeric",
});
const dateTimeFormatter = new Intl.DateTimeFormat(locale, {
year: "numeric",
day: "numeric",
month: "long",
hour: "numeric",
minute: "numeric",
second: "numeric",
});

/**
Expand Down
7 changes: 6 additions & 1 deletion ts/WoltLabSuite/Core/Language/Input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ type Values = Map<LanguageId, string>;

export type InputOrTextarea = HTMLInputElement | HTMLTextAreaElement;

type CallbackEvent = "select" | "submit";
type CallbackEvent = "beforeSelect" | "select" | "submit";
type Callback = (element: InputOrTextarea) => void;

interface ElementData {
Expand Down Expand Up @@ -194,6 +194,11 @@ function select(elementId: string, languageId: number, isInit: boolean): void {
const values = _values.get(elementId)!;

if (data.languageId) {
const beforeSelect = data.callbacks.get("beforeSelect");
if (beforeSelect) {
beforeSelect(data.element);
}

values.set(data.languageId, data.element.value);
}

Expand Down
3 changes: 3 additions & 0 deletions ts/WoltLabSuite/Core/Language/Text.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,7 @@ export function init(

LanguageInput.registerCallback(elementId, "select", callbackSelect);
LanguageInput.registerCallback(elementId, "submit", callbackSubmit);

// CKEditor does not permanently mirror the contents to the <textarea>.
LanguageInput.registerCallback(elementId, "beforeSelect", callbackSubmit);
}
6 changes: 6 additions & 0 deletions ts/WoltLabSuite/Core/Ui/Color/Picker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,12 @@ class UiColorPicker implements DialogCallbackObject {
*/
protected submitDialog(): void {
const color = this.getColor(ColorSource.RGBA);
const hasNanValue = Object.values(color).some((value) => Number.isNaN(value));
if (hasNanValue) {
// Prevent the submission of invalid color values.
return;
}

const colorString = ColorUtil.rgbaToString(color);

this.oldColor!.style.backgroundColor = colorString;
Expand Down
24 changes: 21 additions & 3 deletions ts/WoltLabSuite/Core/Ui/Dialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,27 @@ const UiDialog = {
{ passive: false },
);

const observer = new MutationObserver((mutations) => {
const currentValue = _container.getAttribute("aria-hidden");

for (const mutation of mutations) {
if (mutation.oldValue === currentValue) {
continue;
}

if (currentValue === "false") {
adoptPageOverlayContainer(_container);
} else {
releasePageOverlayContainer(_container);
}
}
});
observer.observe(_container, {
attributes: true,
attributeFilter: ["aria-hidden"],
attributeOldValue: true,
});

document.getElementById("content")!.appendChild(_container);

_keyupListener = (event: KeyboardEvent): boolean => {
Expand Down Expand Up @@ -286,8 +307,6 @@ const UiDialog = {
}, 200);
}

adoptPageOverlayContainer(_container);

return data;
},

Expand Down Expand Up @@ -816,7 +835,6 @@ const UiDialog = {
}
}

releasePageOverlayContainer(_container);
UiScreen.pageOverlayClose();

if (_activeDialog === null) {
Expand Down
3 changes: 2 additions & 1 deletion ts/WoltLabSuite/Core/Ui/Page/Header/Menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,12 +135,13 @@ function setup(): void {
function setupOverflow(): void {
_firstElement.addEventListener("transitionend", rebuildVisibility);

window.addEventListener("resize", () => {
const observer = new ResizeObserver(() => {
_firstElement.style.setProperty("margin-left", "0px", "");
_marginLeft = 0;

rebuildVisibility();
});
observer.observe(_menu);

enable();
}
Expand Down
1 change: 0 additions & 1 deletion ts/WoltLabSuite/WebComponent/fa-brand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
const root = this.getRoot();

const slot = document.createElement("slot");
slot.name = "svg";
root.append(slot);

this.setAttribute("aria-hidden", "true");
Expand Down
10 changes: 8 additions & 2 deletions ts/WoltLabSuite/WebComponent/woltlab-core-date-time.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,18 +76,21 @@
minute: "2-digit",
timeZone,
}),
// Example: 6 hours ago
Hours: new Intl.RelativeTimeFormat(locale),
// Example: 16 minutes ago
Minutes: new Intl.RelativeTimeFormat(locale),
// Example: today
TodayOrYesterday: new Intl.RelativeTimeFormat(locale, { numeric: "auto" }),
};
} as const;

const TimePeriod = {
OneMinute: 60,
OneHour: 3_600,
OneDay: 86_400,
TwelveHours: 3_600 * 12,
SixDays: 86_400 * 6,
};
} as const;

class WoltlabCoreDateTimeElement extends HTMLElement {
#date?: Date;
Expand Down Expand Up @@ -162,6 +165,9 @@
} else if (difference < TimePeriod.OneHour) {
const minutes = Math.trunc(difference / TimePeriod.OneMinute);
value = DateFormatter.Minutes.format(minutes * -1, "minute");
} else if (difference < TimePeriod.TwelveHours) {
const hours = Math.trunc(difference / TimePeriod.OneHour);
value = DateFormatter.Hours.format(hours * -1, "hour");
} else if (difference < TimePeriod.SixDays) {
const dateParts = DateFormatter.DayOfWeekAndTime.formatToParts(date);
const weekdayFirst = dateParts[0].type === "weekday";
Expand Down

This file was deleted.

2 changes: 1 addition & 1 deletion wcfsetup/install/files/acp/templates/aclPermissions.tpl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<script data-relocate="true" src="{@$__wcf->getPath()}js/WCF.ACL.js"></script>
<script data-relocate="true" src="{@$__wcf->getPath()}js/WCF.ACL.js?v={LAST_UPDATE_TIME}"></script>
<script data-relocate="true">
$(function() {
WCF.Language.addObject({
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<section class="section">
<h2 class="sectionTitle">{lang}wcf.acp.package.update.paidUpgrade{/lang}</h2>

<p>{lang packageName=$packageName}wcf.acp.package.update.paidUpgrade.description{/lang}</p>
</section>
<div class="formSubmit">
<a href="https://pluginstore.woltlab.com/file/{$pluginStoreFileID}" target="_blank" class="button buttonPrimary">{lang}wcf.acp.package.update.purchaseRequired.button.purchase{/lang}</a>
<button style="display: none">{* dummy button for compatibility with the JS module *}</button>
</div>
6 changes: 3 additions & 3 deletions wcfsetup/install/files/acp/templates/trophyAdd.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@
<dt>{lang}wcf.acp.trophy.badge.iconName{/lang}</dt>
<dd>
<span class="jsTrophyIconName">{$iconName}</span>
<button type="button" class="button small">{icon name='magnifying-glass'}</a>
<button type="button" class="button small">{icon name='magnifying-glass'}</button>
</dd>
</dl>

Expand All @@ -245,7 +245,7 @@
<span id="iconColorValue" class="colorBoxValue jsColorPicker" data-store="iconColorValue"></span>
<input type="hidden" id="iconColorValue">
</span>
<button type="button" class="button small jsButtonIconColorPicker">{icon name='paintbrush'}</a>
<button type="button" class="button small jsButtonIconColorPicker">{icon name='paintbrush'}</button>
</dd>
</dl>

Expand All @@ -256,7 +256,7 @@
<span id="badgeColorValue" class="colorBoxValue jsColorPicker" data-store="badgeColorValue"></span>
<input type="hidden" id="badgeColorValue">
</span>
<button type="button" id="test" class="button small jsButtonBadgeColorPicker">{icon name='paintbrush'}</a>
<button type="button" id="test" class="button small jsButtonBadgeColorPicker">{icon name='paintbrush'}</button>
</dd>
</dl>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?php

namespace wcf\acp;

/**
* Remove extraneous foreign keys on `wcf1_like.reactionTypeID` that use generic
* `*_ibfk` names
*
* @author Alexander Ebert
* @copyright 2001-2023 WoltLab GmbH
* @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
*/

use wcf\system\WCF;

$databaseEditor = WCF::getDB()->getEditor();
$tableName = 'wcf' . WCF_N . '_like';
foreach ($databaseEditor->getForeignKeys($tableName) as $foreignKey => $columnData) {
if ($columnData['columns'] !== ['reactionTypeID']) {
continue;
}

if ($columnData['referencedColumns'] !== ['reactionTypeID']) {
continue;
}

if ($columnData['referencedTable'] !== 'wcf' . WCF_N . '_reaction_type') {
continue;
}

$databaseEditor->dropForeignKey($tableName, $foreignKey);

$sql = "DELETE FROM wcf1_package_installation_sql_log
WHERE sqlTable = ?
AND sqlIndex = ?";
$statement = WCF::getDB()->prepare($sql);
$statement->execute([
$tableName,
$foreignKey,
]);
}

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit fb97af0

Please sign in to comment.