diff --git a/app/Request.php b/app/Request.php
index 22feb06d3..3cd98d1ff 100644
--- a/app/Request.php
+++ b/app/Request.php
@@ -366,6 +366,15 @@ class Request extends BaseObject {
return $this->info()['release_type'];
}
+ public function tagSearchLink(): string {
+ return implode(' ',
+ array_map(
+ fn($tag) => "$tag",
+ $this->tagNameList()
+ )
+ );
+ }
+
public function tagNameList(): array {
return $this->info()['tag'];
}
diff --git a/sections/user/user.php b/sections/user/user.php
index fc17b65f3..4553707b7 100644
--- a/sections/user/user.php
+++ b/sections/user/user.php
@@ -51,14 +51,9 @@ if ($UserID == $Viewer->id()) {
// Don't allow any kind of previewing on other profiles
$Preview = false;
}
+$previewer = $Preview ? $userMan->findById(PARANOIA_PREVIEW_USER) : $Viewer;
+$Paranoia = $Preview ? explode(',', $_GET['paranoia']) : $User->paranoia();
-// Image proxy CTs
-$DisplayCustomTitle = !empty($User->title())
- ? preg_replace_callback('/src=("?)(http.+?)(["\s>])/',
- fn ($m) => 'src=' . $m[1] . image_cache_encode($m[2]) . $m[3], $User->title())
- : $User->title();
-
-$Paranoia = $Preview ? explode(',', $_GET['paranoia']) : $User->paranoia();
function check_paranoia_here(string $Setting): int|false {
global $Paranoia, $Class, $UserID, $Preview;
if ($Preview) {
@@ -68,6 +63,12 @@ function check_paranoia_here(string $Setting): int|false {
}
}
+// Image proxy CTs
+$DisplayCustomTitle = !empty($User->title())
+ ? preg_replace_callback('/src=("?)(http.+?)(["\s>])/',
+ fn ($m) => 'src=' . $m[1] . image_cache_encode($m[2]) . $m[3], $User->title())
+ : $User->title();
+
View::show_header($Username, ['js' => 'jquery.imagesloaded,jquery.wookmark,user,bbcode,requests,lastfm,comments,info_paster', 'css' => 'tiles']);
echo $Twig->render('user/header.twig', [
'badge_list' => (new Gazelle\User\Privilege($User))->badgeList(),
@@ -79,7 +80,7 @@ echo $Twig->render('user/header.twig', [
'latest' => $viewerBonus->otherLatest($User),
],
'friend' => new Gazelle\User\Friend($Viewer),
- 'preview_user' => $Preview ? $userMan->findById(PARANOIA_PREVIEW_USER) : $Viewer,
+ 'preview_user' => $previewer,
'user' => $User,
'userMan' => $userMan,
'viewer' => $Viewer,
@@ -223,7 +224,6 @@ if (($Override = check_paranoia_here('artistsadded'))) {
Bonus points spent: = $rank->rank('bonus') ?>
findById(PARANOIA_PREVIEW_USER) : $Viewer;
if ($User->propertyVisibleMulti($previewer, ['artistsadded', 'collagecontribs+', 'downloaded', 'requestsfilled_count', 'requestsvoted_bounty', 'torrentcomments++', 'uploaded', 'uploads+', ])) {
?>
classLevel() >= 900 ? ' title="Infinite"' : '' ?>>Overall rank: = is_null($rank->score())
@@ -482,66 +482,11 @@ if ($Viewer->permitted('users_give_donor')) {
]);
}
-// Requests
-if (!$Viewer->disableRequests() && check_paranoia_here('requestsvoted_list')) {
- $requestList = (new Gazelle\Manager\Request)->findUnfilledByUser($User, 100);
- $hide = count($requestList) > 5;
- if ($requestList) {
-?>
-
-
-
-
-
- |
- Request Name
- |
-
- Vote
- |
-
- Bounty
- |
-
- Added
- |
-
-
-
- |
- = $request->smartLink() ?>
-
- |
-
- = $request->userVotedTotal() ?>
-permitted('site_vote')) { ?>
- +
-
- |
-
- = byte_format($request->bountyTotal()) ?>
- |
-
- = time_diff($request->created()) ?>
- |
-
-
-
-
-
-disableRequests() && $User->propertyVisible($previewer, 'requestsvoted_list')) {
+ echo $Twig->render('request/user-unfilled.twig', [
+ 'list' => (new Gazelle\Manager\Request)->findUnfilledByUser($User, 100),
+ 'viewer' => $Viewer,
+ ]);
}
if ($Viewer->permitted('users_mod') || $Viewer->isStaffPMReader()) {
diff --git a/templates/macro/form.twig b/templates/macro/form.twig
index 6db5e4d12..880372050 100644
--- a/templates/macro/form.twig
+++ b/templates/macro/form.twig
@@ -6,6 +6,11 @@
{%- if flag %} disabled="disabled"{% endif -%}
{%- endmacro %}
+{# used as an additional name in an element class declaration #}
+{%- macro hidden(flag) -%}
+ {%- if flag %} hidden{% endif -%}
+{%- endmacro %}
+
{%- macro selected(flag) -%}
{%- if flag %} selected="selected"{% endif -%}
{%- endmacro %}
diff --git a/templates/request/user-unfilled.twig b/templates/request/user-unfilled.twig
new file mode 100644
index 000000000..f7e71dee1
--- /dev/null
+++ b/templates/request/user-unfilled.twig
@@ -0,0 +1,48 @@
+{% from 'macro/form.twig' import hidden %}
+{% for request in list %}
+ {% if loop.first %}
+
+
+
+
+
+ |
+ Request Name
+ |
+
+ Vote
+ |
+
+ Bounty
+ |
+
+ Added
+ |
+
+ {% endif %}
+
+ |
+ {{ request.smartLink|raw }}
+ {{ request.tagLinkList }}
+ |
+
+ {{ request.userVotedTotal }}
+ {% if viewer.permitted('site_vote') %}
+ +
+ {% endif %}
+ |
+
+ {{ request.bountyTotal|octet_size }}
+ |
+
+ {{ request.created|time_diff }}
+ |
+
+ {% if loop.last %}
+
+
+
+ {% endif %}
+{% endfor %}
diff --git a/tests/phpunit/RequestTest.php b/tests/phpunit/RequestTest.php
index e99bc5ab1..2b3ce7c60 100644
--- a/tests/phpunit/RequestTest.php
+++ b/tests/phpunit/RequestTest.php
@@ -79,6 +79,7 @@ class RequestTest extends TestCase {
$tagId = $tagMan->create('jazz', $this->userList['admin']->id());
$this->assertGreaterThan(0, $tagId, 'request-create-tag');
$this->assertEquals(1, $this->request->addTag($tagId), 'request-add-tag');
+ $this->request->addTag($tagMan->create('vaporwave', $this->userList['admin']->id()));
// FIXME: cannot be asserted earlier: this should not depend on a request having tags
$this->assertInstanceOf(Gazelle\ArtistRole\Request::class, $this->request->artistRole(), 'request-artist-role');
@@ -103,7 +104,11 @@ class RequestTest extends TestCase {
$this->assertEquals('Unitest Artists', $this->request->recordLabel(), 'request-rec-label');
$this->assertEquals(1, $this->request->categoryId(), 'request-cat-id');
$this->assertEquals('Music', $this->request->categoryName(), 'request-cat-name');
- $this->assertEquals(['jazz'], $this->request->tagNameList(), 'request-tag-list');
+ $this->assertEquals(['jazz', 'vaporwave'], $this->request->tagNameList(), 'request-tag-list');
+ $this->assertEquals(
+ 'jazz vaporwave',
+ $this->request->tagSearchLink(), 'request-tag-searchlink'
+ );
$this->assertEquals('This is a unit test description', $this->request->description(), 'request-description');
$this->assertTrue($this->request->needCue(), 'request-need-cue');
$this->assertTrue($this->request->needLog(), 'request-need-log');