Skip to content

Commit 24228b4

Browse files
authored
Merge pull request #610 from topcoder-platform/develop
v1.7
2 parents 9d4ee97 + a939945 commit 24228b4

19 files changed

+1535
-72
lines changed

Dockerfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,13 @@ ARG ENV
66
ARG BRANCH
77
ARG TIDEWAYS_ENV
88

9+
# TIDEWAYS DAEMON
910
ENV TIDEWAYS_SERVICE web
1011
ENV TIDEWAYS_ENVIRONMENT=$TIDEWAYS_ENV
1112
ENV TIDEWAYS_DAEMON_EXTRA="--env=$TIDEWAYS_ENVIRONMENT --debug"
13+
14+
# VANILLA
15+
ENV VANILLA_ENV=$ENV
1216
ENV WEB_DOCUMENT_ROOT /vanillapp
1317

1418
RUN echo "Tideways Daemon for '$TIDEWAYS_ENV' env"

config/vanilla/bootstrap.before.php

Lines changed: 42 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ function dateUpdated($row, $wrap = null) {
305305

306306
if ($dateUpdated) {
307307
$updateUser = Gdn::userModel()->getID($updateUserID);
308-
$dateUpdatedFormatted = Gdn::getContainer()->get(DateTimeFormatter::class)->formatDate($dateUpdated, false, DateTimeFormatter::FORCE_FULL_FORMAT);
308+
$dateUpdatedFormatted = formatDateCustom($dateUpdated, false);
309309
if ($updateUser && $insertUserID != $updateUserID) {
310310
$title = sprintf(t('Edited %s by %s.'), $dateUpdatedFormatted, val('Name', $updateUser));
311311
$link = userAnchor($updateUser);
@@ -339,7 +339,6 @@ function watchIcon($hasWatched = false, $title='') {
339339
if($hasWatched) {
340340
$icon = <<<EOT
341341
<svg width="21px" height="14px" viewBox="0 0 21 14" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
342-
<title>$title</title>
343342
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
344343
<g id="02-Challenge-Forums" transform="translate(-1261.000000, -328.000000)" fill="#0AB88A" fill-rule="nonzero">
345344
<path d="M1271.08333,328 C1266.5,328 1262.58583,330.850833 1261,334.875 C1262.58583,338.899167 1266.5,341.75 1271.08333,341.75 C1275.66667,341.75 1279.58083,338.899167 1281.16667,334.875 C1279.58083,330.850833 1275.66667,328 1271.08333,328 Z M1271.08333,339.458333 C1268.55333,339.458333 1266.5,337.405 1266.5,334.875 C1266.5,332.345 1268.55333,330.291667 1271.08333,330.291667 C1273.61333,330.291667 1275.66667,332.345 1275.66667,334.875 C1275.66667,337.405 1273.61333,339.458333 1271.08333,339.458333 Z M1271.08333,332.125 C1269.56167,332.125 1268.33333,333.353333 1268.33333,334.875 C1268.33333,336.396667 1269.56167,337.625 1271.08333,337.625 C1272.605,337.625 1273.83333,336.396667 1273.83333,334.875 C1273.83333,333.353333 1272.605,332.125 1271.08333,332.125 Z" id="Shape"></path>
@@ -350,7 +349,6 @@ function watchIcon($hasWatched = false, $title='') {
350349
} else {
351350
$icon = <<<EOT
352351
<svg width="22px" height="22px" viewBox="0 0 22 22" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
353-
<title>$title</title>
354352
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
355353
<g id="02-Challenge-Forums" transform="translate(-1260.000000, -594.000000)">
356354
<g id="watch-icon" transform="translate(1260.000000, 594.000000)">
@@ -375,7 +373,7 @@ function watchIcon($hasWatched = false, $title='') {
375373
* @param int $categoryID
376374
* @return string
377375
*/
378-
function watchButton($category) {
376+
function watchButton($category, $isHijackButton = true) {
379377
$output = ' ';
380378
$userID = Gdn::session()->UserID;
381379
if(is_numeric($category)) {
@@ -388,13 +386,17 @@ function watchButton($category) {
388386
$categoryID= val('CategoryID', $category);
389387
$hasWatched = $categoryModel->hasWatched($categoryID, $userID);
390388

391-
$text = $hasWatched ? t('Stop watching the category') : t('Watch the category');
392-
$icon = watchIcon($hasWatched, $text);
393-
$output .= anchor(
394-
$icon,
389+
$text = $hasWatched ? t('Stop watching forum') : t('Watch forum');
390+
$icon = '<span class="tooltiptext">'.$text.'</span>'. watchIcon($hasWatched);
391+
$cssClasses = 'watchButton ' . ($hasWatched ? ' isWatching tooltip': 'tooltip');
392+
if($isHijackButton) {
393+
$cssClasses = 'Hijack '.$cssClasses;
394+
}
395+
396+
$output .= anchor($icon,
395397
$hasWatched ? "/category/watched/{$categoryID}/" . Gdn::session()->transientKey() : "/category/watch/{$categoryID}/" . Gdn::session()->transientKey(),
396-
'Hijack watchButton' . ($hasWatched ? ' isWatching' : ''),
397-
['title' => $text, 'aria-pressed' => $hasWatched ? 'true' : 'false', 'role' => 'button', 'tabindex' => '0']
398+
$cssClasses,
399+
[ 'aria-pressed' => $hasWatched ? 'true' : 'false', 'role' => 'button', 'tabindex' => '0']
398400
);
399401
}
400402
return $output;
@@ -460,9 +462,9 @@ function updateRolePermissions($roleType, $roles) {
460462
* @param string $label Text for the label to attach to the cont
461463
* @return string
462464
*/
463-
function sortsDropDown($baseUrl, array $filters = [], $extraClasses = '', $default = null, $defaultUrl = null, $label = 'Sort') {
465+
function sortsDropDown($preferenceKey, $baseUrl, array $filters = [], $extraClasses = '', $default = null, $defaultUrl = null, $label = 'Sort') {
464466
$links = [];
465-
$active = Gdn::session()->getPreference('CategorySort', null);
467+
$active = Gdn::session()->getPreference($preferenceKey, null);
466468
// Translate filters into links.
467469
foreach ($filters as $filter) {
468470
// Make sure we have the bare minimum: a label and a URL parameter.
@@ -550,7 +552,7 @@ function categorySorts($extraClasses = '') {
550552
$defaultUrl = $baseUrl;
551553
}
552554

553-
return sortsDropDown(
555+
return sortsDropDown('CategorySort',
554556
$baseUrl,
555557
$filters,
556558
$extraClasses,
@@ -577,15 +579,22 @@ function discussionSorts($extraClasses = '') {
577579
$transientKey = Gdn::session()->transientKey();
578580
$filters = [
579581
[
580-
'name' => t('New'),
582+
'name' => t('Most recent'),
581583
'param' => 'sort',
582584
'value' => 'new',
583585
'extra' => ['TransientKey' => $transientKey, 'save' => 1]
584586
],
587+
585588
[
586-
'name' => t('Old'),
589+
'name' => t('Highest views'),
587590
'param' => 'sort',
588-
'value' => 'old',
591+
'value' => 'views',
592+
'extra' => ['TransientKey' => $transientKey, 'save' => 1]
593+
],
594+
[
595+
'name' => t('Highest responses'),
596+
'param' => 'sort',
597+
'value' => 'comments',
589598
'extra' => ['TransientKey' => $transientKey, 'save' => 1]
590599
]
591600
];
@@ -598,7 +607,7 @@ function discussionSorts($extraClasses = '') {
598607
$defaultUrl = $baseUrl;
599608
}
600609

601-
return sortsDropDown(
610+
return sortsDropDown('DiscussionSort',
602611
$baseUrl,
603612
$filters,
604613
$extraClasses,
@@ -978,4 +987,19 @@ function discussionUrl($discussion, $page = '', $withDomain = true) {
978987

979988
return url($result, $withDomain);
980989
}
981-
}
990+
}
991+
992+
if (!function_exists('formatDateCustom')) {
993+
function formatDateCustom($timestamp, $showDayOfWeek=true) {
994+
$dateFormat = $showDayOfWeek? '%a, %b %e, %Y': '%b %e, %Y';
995+
$dateFormatted = Gdn::getContainer()->get(DateTimeFormatter::class)->formatDate($timestamp, false, $dateFormat);
996+
$timeFormatted = Gdn::getContainer()->get(DateTimeFormatter::class)->formatDate($timestamp, false, '%I:%M %p');
997+
return sprintf('%1$s at %2$s', $dateFormatted, $timeFormatted);
998+
}
999+
}
1000+
if (!function_exists('authorProfileStats')) {
1001+
function authorProfileStats($user) {
1002+
$totalCount = ($user->CountDiscussions?$user->CountDiscussions : 0) + ($user->CountComments?$user->CountComments:0);
1003+
return '<span class="MItem AuthorProfileStats AuthorProfileStats_'.$user->UserID.'">'.sprintf('%1s posts', $totalCount).'</span>';
1004+
}
1005+
}

config/vanilla/config.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,13 @@
4242
// Feature
4343
$Configuration['Feature']['NewFlyouts']['Enabled'] = true;
4444

45+
// Unfurl
46+
$Configuration['Garden']['Title'] = 'Topcoder Forums';
47+
$Configuration['Garden']['ShareImage'] = '/themes/topcoder/design/images/topcoder-image.png';
48+
4549
// Garden
4650
$Configuration['Garden']['SignIn']['Popup'] = false;
4751
$Configuration['Garden']['EditContentTimeout'] = -1;
48-
$Configuration['Garden']['Title'] = 'Vanilla';
4952
$Configuration['Garden']['Cookie']['Salt'] = 'rLpGSLgZD1AGdJ4n';
5053
$Configuration['Garden']['Cookie']['Domain'] = '';
5154
$Configuration['Garden']['Registration']['ConfirmEmail'] = true;
@@ -81,7 +84,7 @@
8184
$Configuration['Plugins']['GettingStarted']['Dashboard'] = '1';
8285
$Configuration['Plugins']['GettingStarted']['Plugins'] = '1';
8386

84-
87+
$Configuration['Plugins']['Topcoder']['NDA_UUID'] = getenv('VANILLA_ENV') == 'prod'?'c41e90e5-4d0e-4811-bd09-38ff72674490':'e5811a7b-43d1-407a-a064-69e5015b4900';
8588
$Configuration['Plugins']['Topcoder']['BaseApiURL'] = getenv('TOPCODER_PLUGIN_BASE_API_URL');
8689
$Configuration['Plugins']['Topcoder']['MemberApiURI'] = getenv('TOPCODER_PLUGIN_MEMBER_API_URI');
8790
$Configuration['Plugins']['Topcoder']['RoleApiURI'] = getenv('TOPCODER_PLUGIN_ROLE_API_URI');
@@ -209,4 +212,7 @@
209212
$Configuration['Garden']['FavIcon']='/themes/topcoder/design/images/favicon.png';
210213

211214
// This flag moves executing of ActivityModel queue to the scheduler
212-
$Configuration['Feature']['deferredNotifications']['Enabled'] = true;
215+
$Configuration['Feature']['deferredNotifications']['Enabled'] = true;
216+
217+
//If we allow users to dismiss discussions, skip ones this user dismissed
218+
$Configuration['Vanilla']['Discussions']['Dismiss']=0;

0 commit comments

Comments
 (0)