Skip to content

Commit 5b957b8

Browse files
committed
Merge branch 'develop'
2 parents f063f0b + 3b05555 commit 5b957b8

File tree

181 files changed

+8066
-91
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

181 files changed

+8066
-91
lines changed

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ builddeploy_steps: &builddeploy_steps
2929
- run: *install_dependency
3030
- run: *install_deploysuite
3131
#- restore_cache: *restore_cache_settings_for_build
32-
- run: ./build.sh ${APPNAME} ${CI_DEPLOY_TOKEN}
32+
- run: ./build.sh ${APPNAME} ${CI_DEPLOY_TOKEN} ${LOGICAL_ENV}
3333
#- save_cache: *save_cache_settings
3434
- deploy:
3535
name: Running MasterScript.

Dockerfile

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ FROM webdevops/php-apache
22

33
ARG CI_DEPLOY_TOKEN
44
ARG VANILLA_VERSION=3.3
5+
ARG ENV
6+
57
ENV WEB_DOCUMENT_ROOT /vanillapp
68

79
# Get the latest release of Vanilla Forums
@@ -14,6 +16,12 @@ RUN chmod -R 777 /vanillapp
1416
RUN rm -R /vanillapp/plugins/stubcontent
1517
# Clone the forum-plugins repository
1618
RUN git clone https://github.com/topcoder-platform/forums-plugins.git /tmp/forums-plugins
19+
20+
# Remove SqlPlugin from PROD env
21+
RUN if [ "$ENV" = "prod" ]; \
22+
then rm -R /tmp/forums-plugins/DebugPlugin; \
23+
fi
24+
1725
# Copy the Filestack plugin
1826
RUN git clone https://${CI_DEPLOY_TOKEN}@github.com/topcoder-platform/forums-filestack-plugin /tmp/forums-plugins/Filestack
1927

@@ -45,4 +53,4 @@ COPY ./vanilla/. /vanillapp/.
4553
RUN chown application:application /vanillapp/conf/config.php
4654
RUN chmod ug=rwx,o=rx /vanillapp/conf/config.php
4755
# Clone the forum-theme repository
48-
RUN git clone 'https://github.com/topcoder-platform/forums-theme.git' /vanillapp/themes/topcoder-theme
56+
RUN git clone 'https://github.com/topcoder-platform/forums-theme.git' /vanillapp/themes/topcoder

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,7 @@ installation.These variables are mandatory.
2929
## Setup Vanilla Forums
3030

3131
Go to [Setup Vanilla Forums](./docs/SetupVanillaForums.md) to complete installation.
32+
33+
## Build Vanilla Forums
34+
35+
Go to [Build Vanilla Forums](./docs/BuildVanillaForums.md) to install dependencies and build assets.

build.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
set -eo pipefail
33
APP_NAME=$1
44
CI_DEPLOY_TOKEN=$2
5+
ENV=$3
56
UPDATE_CACHE=""
67
echo "" > vanilla.env
7-
CI_DEPLOY_TOKEN=$CI_DEPLOY_TOKEN docker-compose -f docker-compose.yml build $APP_NAME
8+
ENV=$ENV CI_DEPLOY_TOKEN=$CI_DEPLOY_TOKEN docker-compose -f docker-compose.yml build $APP_NAME
89
#docker create --name app $APP_NAME:latest

config/vanilla/bootstrap.before.php

Lines changed: 61 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -263,8 +263,8 @@ function _formatStringCallback($match, $setArgs = false) {
263263
// Manually build instead of using userAnchor() because of special 'You' case.
264264
if(function_exists('topcoderRatingCssClass') &&
265265
function_exists('topcoderRoleCssStyles')) {
266-
$ratingCssClass = topcoderRatingCssClass($user->Name);
267-
$roleCssClass = topcoderRoleCssStyles($user->Name);
266+
$ratingCssClass = topcoderRatingCssClass($user);
267+
$roleCssClass = topcoderRoleCssStyles($user);
268268
$topcoderStyles =$ratingCssClass.' '.$roleCssClass;
269269
$result = anchor(htmlspecialchars($name), userUrl($user), $topcoderStyles);
270270
} else {
@@ -362,13 +362,15 @@ function watchButton($categoryID) {
362362
/**
363363
* Check group permission for the current user
364364
* @param $groupID
365-
* @param null $permission null - any permission for a group
365+
* @param null $category
366+
* @param null $permissionCategoryID
367+
* @param null $permission null - any permission for a group
366368
* @param bool $fullMatch
367369
* @return bool return true if user has a permission
368370
*/
369-
function checkGroupPermission($groupID,$permission = null, $fullMatch = true) {
371+
function checkGroupPermission($groupID, $category = null , $permissionCategoryID = null , $permission = null, $fullMatch = true) {
370372
$groupModel = new GroupModel();
371-
return $groupModel->checkPermission(Gdn::session()->UserID,$groupID, $permission, $fullMatch);
373+
return $groupModel->checkPermission(Gdn::session()->UserID,$groupID, $category,$permissionCategoryID , $permission, $fullMatch);
372374
}
373375
}
374376

@@ -744,3 +746,57 @@ function filtersDropDown($baseUrl, array $filters = [], $extraClasses = '', $def
744746
return $output;
745747
}
746748
}
749+
750+
if (!function_exists('filterCountString')) {
751+
/**
752+
* This function was moved from 'vanilla/applications/vanilla/views/modules/discussionfilter.php'
753+
* @param $count
754+
* @param string $url
755+
* @param array $options
756+
* @return string
757+
*/
758+
function filterCountString($count, $url = '', $options = []) {
759+
$count = countString($count, $url, $options);
760+
return $count != '' ? '<span class="Aside">'.$count.'</span>' : '';
761+
}
762+
}
763+
764+
if (!function_exists('myBookmarksMenuItem')) {
765+
/**
766+
*
767+
*
768+
* @param $CountBookmarks
769+
* @return string
770+
*/
771+
function myBookmarksMenuItem($CountBookmarks) {
772+
if (!Gdn::session()->isValid()) {
773+
return '';
774+
}
775+
$Bookmarked = t('My Bookmarks');
776+
$Bookmarked .= FilterCountString($CountBookmarks, '/discussions/UserBookmarkCount');
777+
$cssClass = 'MyBookmarks';
778+
$cssClass .= Gdn::controller()->RequestMethod == 'bookmarked' ? ' Active' : '';
779+
$cssClass .= $CountBookmarks == 0 && Gdn::controller()->RequestMethod != 'bookmarked' ? ' hidden': '';
780+
return sprintf('<li id="MyBookmarks" class="%s">%s</li>', $cssClass, anchor(sprite('SpBookmarks').$Bookmarked, '/discussions/bookmarked'));
781+
}
782+
}
783+
784+
if (!function_exists('myDraftsMenuItem')) {
785+
/**
786+
*
787+
*
788+
* @param $CountDrafts
789+
* @return string
790+
*/
791+
function myDraftsMenuItem($CountDrafts) {
792+
if (!Gdn::session()->isValid()) {
793+
return '';
794+
}
795+
$Drafts = t('My Drafts');
796+
$Drafts .= FilterCountString($CountDrafts, '/drafts');
797+
$cssClass = 'MyDrafts';
798+
$cssClass .= Gdn::controller()->ControllerName == 'draftscontroller' ? ' Active' : '';
799+
$cssClass .= $CountDrafts == 0 ? ' hidden': '';
800+
return sprintf('<li id="MyDrafts" class="%s">%s</li>', $cssClass, anchor(sprite('SpMyDrafts').$Drafts, '/drafts'));
801+
}
802+
}

config/vanilla/config.php

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@
88
$Configuration['Database']['Password'] = getenv('MYSQL_ROOT_PASSWORD');
99

1010
// Cache
11-
$Configuration['Cache']['Enabled'] = getenv('CACHE_ENABLED');
11+
$Configuration['Cache']['Enabled'] = strtolower(getenv('CACHE_ENABLED')) === "true";
1212
$Configuration['Cache']['Method'] = getenv('CACHE_METHOD');
13+
$Configuration['Cache']['Memcached']['Store']=[getenv('MEMCACHED_SERVER')];
1314

1415
// Conversations
1516
$Configuration['Conversations']['Version'] = '3.0';
@@ -56,14 +57,14 @@
5657
$Configuration['Garden']['Email']['SmtpPort'] = getenv('MAIL_SMTP_PORT');
5758
$Configuration['Garden']['Email']['SmtpSecurity'] = getenv('MAIL_SMTP_SECURITY');
5859
$Configuration['Garden']['UpdateToken'] = '105e786dc643fd20143d3c137b593af168560c13';
59-
$Configuration['Garden']['InputFormatter'] = 'Markdown';
60+
$Configuration['Garden']['InputFormatter'] = 'Rich';
6061
$Configuration['Garden']['Version'] = 'Undefined';
6162
$Configuration['Garden']['CanProcessImages'] = true;
62-
$Configuration['Garden']['Theme'] = 'topcoder-theme';
63-
$Configuration['Garden']['MobileTheme'] = 'topcoder-theme';
63+
$Configuration['Garden']['Theme'] = 'topcoder';
64+
$Configuration['Garden']['MobileTheme'] = 'topcoder';
6465
$Configuration['Garden']['Profile']['EditPhotos'] = false;
6566
$Configuration['Garden']['SystemUserID'] = '1';
66-
$Configuration['Garden']['MobileInputFormatter'] = 'Markdown';
67+
$Configuration['Garden']['MobileInputFormatter'] = 'Rich';
6768
$Configuration['Garden']['AllowFileUploads'] = true;
6869
$Configuration['Garden']['EditContentTimeout'] = -1;
6970
$Configuration['Garden']['Profile']['EditPhotos'] = false;
@@ -144,8 +145,6 @@
144145
$Configuration['Vanilla']['EnableCategoryFollowing'] = true;
145146
$Configuration['Vanilla']['Version'] = '3.0';
146147

147-
// memcached
148-
$Configuration['memcached']['Store'] = getenv('MEMCACHED_SERVER');
149148

150149
// Initial setup config
151150

@@ -181,4 +180,12 @@
181180
$Configuration['Vanilla']['Activity']['SpamLock'] = '120';
182181
$Configuration['Vanilla']['ActivityComment']['SpamCount'] = '5';
183182
$Configuration['Vanilla']['ActivityComment']['SpamTime'] = '60';
184-
$Configuration['Vanilla']['ActivityComment']['SpamLock'] = '120';
183+
$Configuration['Vanilla']['ActivityComment']['SpamLock'] = '120';
184+
185+
// Posting Settings:
186+
// Should users be automatically pushed to the last comment they read in a discussion?
187+
$Configuration['Vanilla']['Comments']['AutoOffset'] = false;
188+
// Maximum number of characters allowed in a comment
189+
$Configuration['Vanilla']['Comment']['MaxLength'] = 16000;
190+
// Minimum comment length to discourage short comments
191+
$Configuration['Vanilla']['Comment']['MinLength'] = 2;

docker-compose.dev.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,10 @@ services:
1212
command: --default-authentication-plugin=mysql_native_password
1313
vanilla-forums:
1414
links:
15-
- mysql-local
15+
- mysql-local
16+
- memcached-local
17+
memcached-local:
18+
image: memcached:1.5
19+
container_name: memcached-local
20+
ports:
21+
- "11211:11211"

docker-compose.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ services:
88
build:
99
context: .
1010
args:
11+
- ENV
1112
- VANILLA_VERSION=3.3
1213
- CI_DEPLOY_TOKEN
1314
ports:

docs/BuildVanillaForums.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# Build Vanilla Forums
2+
3+
Vanilla Forums has pre-built frontend assets (js, css and addons assets).
4+
5+
The full source code of Vanilla Forums is available as a Git repository:
6+
7+
https://github.com/vanilla/vanilla/tree/Vanilla_3.3.
8+
9+
## Requirements
10+
11+
- Node.js “>=8.0.0 <12.0.0”
12+
- PHP 7.2 - 7.4 (as of Vanilla 3.3)
13+
- Yarn
14+
- Composer
15+
16+
## Installing yarn
17+
18+
Install yarn:
19+
20+
`npm install -g yarn`
21+
22+
## Installing composer
23+
24+
Install composer:
25+
26+
`php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"`
27+
28+
`php -r "if (hash_file('sha384', 'composer-setup.php') === '756890a4488ce9024fc62c56153228907f1545c228516cbf63f885e036d37e9a59d27d63f46af1d4d07ee0f76181c7d3') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"`
29+
30+
`php composer-setup.php`
31+
32+
`php -r "unlink('composer-setup.php');"`
33+
34+
35+
## Building Frontend assets
36+
37+
1.Clone or download a repo. Go to the root folder:
38+
cd `Vanilla_3.3`
39+
40+
2.The 'forum' repo overrides Vanilla files.
41+
Copy 'forums/vanilla' to `Vanilla_3.3`.
42+
43+
3.Run the command to install dependencies and build:
44+
`composer install or php composer.phar install`
45+
46+
You should see output
47+
48+
![./images/build.png](./images/build.png)
49+
50+
51+
4.Copy all files from the 'dist' folder to 'forums/vanilla/dist' (the 'forums' repo).
52+
53+
Notes:
54+
The first time you run this, it may take a while. Subsequent runs should be faster, but if you are constantly
55+
updating the javascript or CSS or addons or themes, it's recommended to use the developer build.
56+
57+
`yarn build:dev`

docs/images/build.png

103 KB
Loading

0 commit comments

Comments
 (0)