Skip to content

Commit 56d556c

Browse files
committed
Merge branch 'develop'
2 parents 2e822fc + 7386a9b commit 56d556c

File tree

21 files changed

+4171
-189
lines changed

21 files changed

+4171
-189
lines changed

Dockerfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ RUN git clone https://${CI_DEPLOY_TOKEN}@github.com/topcoder-platform/forums-gro
3131
#Copy the SumoLogic plugin
3232
RUN git clone https://${CI_DEPLOY_TOKEN}@github.com/topcoder-platform/forums-sumologic-plugin /tmp/forums-plugins/Sumologic
3333

34+
#Copy the TopcoderEditor plugin
35+
RUN git clone https://${CI_DEPLOY_TOKEN}@github.com/topcoder-platform/forums-topcoder-editor-plugin /tmp/forums-plugins/TopcoderEditor
36+
3437
# Copy all plugins to the Vanilla plugins folder
3538
RUN cp -r /tmp/forums-plugins/. /vanillapp/plugins
3639

@@ -45,6 +48,8 @@ RUN composer install --working-dir /vanillapp/plugins/Topcoder
4548
RUN composer install --working-dir /vanillapp/plugins/Filestack
4649
# Install Groups dependencies
4750
RUN composer install --working-dir /vanillapp/plugins/Groups
51+
# Install TopcoderEditor dependencies
52+
RUN composer install --working-dir /vanillapp/plugins/TopcoderEditor
4853
# Copy Vanilla configuration files
4954
COPY ./config/vanilla/. /vanillapp/conf/.
5055
# Copy Topcoder Vanilla files

config/vanilla/bootstrap.before.php

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -307,12 +307,16 @@ function dateUpdated($row, $wrap = null) {
307307
$dateUpdatedFormatted = Gdn::getContainer()->get(DateTimeFormatter::class)->formatDate($dateUpdated, false, DateTimeFormatter::FORCE_FULL_FORMAT);
308308
if ($updateUser) {
309309
$title = sprintf(t('Edited %s by %s.'), $dateUpdatedFormatted, val('Name', $updateUser));
310+
$link = userAnchor($updateUser);
311+
$text = sprintf(t('edited %s by %s'), $dateUpdatedFormatted, $link);
310312
} else {
311313
$title = sprintf(t('Edited %s.'), $dateUpdatedFormatted);
314+
$text = sprintf(t('edited %s'), $dateUpdatedFormatted);
312315
}
313316

314317
$result = ' <span title="'.htmlspecialchars($title).'" class="DateUpdated">'.
315-
sprintf(t('edited %s'), $dateUpdatedFormatted).'</span> ';
318+
$text.'</span> ';
319+
316320
if ($wrap) {
317321
$result = $wrap[0].$result.$wrap[1];
318322
}
@@ -360,17 +364,18 @@ function watchButton($categoryID) {
360364

361365
if (!function_exists('checkGroupPermission')) {
362366
/**
363-
* Check group permission for the current user
367+
* Check group permission for an user
368+
* @param $userID
364369
* @param $groupID
365-
* @param null $category
370+
* @param null $categoryID
366371
* @param null $permissionCategoryID
367372
* @param null $permission null - any permission for a group
368373
* @param bool $fullMatch
369374
* @return bool return true if user has a permission
370375
*/
371-
function checkGroupPermission($groupID, $category = null , $permissionCategoryID = null , $permission = null, $fullMatch = true) {
376+
function checkGroupPermission($userID,$groupID, $categoryID = null , $permissionCategoryID = null , $permission = null, $fullMatch = true) {
372377
$groupModel = new GroupModel();
373-
return $groupModel->checkPermission(Gdn::session()->UserID,$groupID, $category,$permissionCategoryID , $permission, $fullMatch);
378+
return $groupModel->checkPermission($userID,$groupID, $categoryID,$permissionCategoryID , $permission, $fullMatch);
374379
}
375380
}
376381

config/vanilla/config.php

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
$Configuration['EnabledPlugins']['GettingStarted'] = 'GettingStarted';
2626
$Configuration['EnabledPlugins']['stubcontent'] = false;
2727
$Configuration['EnabledPlugins']['Topcoder'] = true;
28+
$Configuration['EnabledPlugins']['TopcoderEditor'] = true;
2829
$Configuration['EnabledPlugins']['rich-editor'] = true;
2930
$Configuration['EnabledPlugins']['editor'] = false;
3031
$Configuration['EnabledPlugins']['emojiextender'] = true;
@@ -57,14 +58,15 @@
5758
$Configuration['Garden']['Email']['SmtpPort'] = getenv('MAIL_SMTP_PORT');
5859
$Configuration['Garden']['Email']['SmtpSecurity'] = getenv('MAIL_SMTP_SECURITY');
5960
$Configuration['Garden']['UpdateToken'] = '105e786dc643fd20143d3c137b593af168560c13';
60-
$Configuration['Garden']['InputFormatter'] = 'Rich';
61+
$Configuration['Garden']['InputFormatter'] = 'Markdown';
62+
$Configuration['Garden']['MobileInputFormatter'] = 'Markdown';
63+
$Configuration['Garden']['ForceInputFormatter'] = false;
6164
$Configuration['Garden']['Version'] = 'Undefined';
6265
$Configuration['Garden']['CanProcessImages'] = true;
6366
$Configuration['Garden']['Theme'] = 'topcoder';
6467
$Configuration['Garden']['MobileTheme'] = 'topcoder';
6568
$Configuration['Garden']['Profile']['EditPhotos'] = false;
6669
$Configuration['Garden']['SystemUserID'] = '1';
67-
$Configuration['Garden']['MobileInputFormatter'] = 'Rich';
6870
$Configuration['Garden']['AllowFileUploads'] = true;
6971
$Configuration['Garden']['EditContentTimeout'] = -1;
7072
$Configuration['Garden']['Profile']['EditPhotos'] = false;
@@ -188,4 +190,12 @@
188190
// Maximum number of characters allowed in a comment
189191
$Configuration['Vanilla']['Comment']['MaxLength'] = 16000;
190192
// Minimum comment length to discourage short comments
191-
$Configuration['Vanilla']['Comment']['MinLength'] = 2;
193+
$Configuration['Vanilla']['Comment']['MinLength'] = 2;
194+
195+
// File handling.
196+
$Configuration['Garden']['Upload']['MaxFileSize'] = '5M';
197+
$Configuration['Garden']['Upload']['AllowedFileExtensions'] = [
198+
'txt', 'jpg', 'jpeg', 'gif', 'png', 'bmp', 'tiff', 'ico', 'zip', 'gz', 'tar.gz', 'tgz', 'psd', 'ai', 'pdf', 'doc', 'xls', 'ppt', 'docx', 'xlsx', 'pptx', 'log', 'rar', '7z', 'xml', 'json'
199+
];
200+
// Allow "target='_blank'" for Markdown format;
201+
$Configuration['Garden']['Html']['BlockedAttributes']='on*, download';

vanilla/applications/dashboard/controllers/api/MediaApiController.php

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,11 @@ public function delete_byUrl(array $query) {
9595
*
9696
* @param UploadedFile $upload An object representing an uploaded file.
9797
* @param string $type The upload type (e.g. "image").
98-
* @throws Exception if there was an error encountered when saving the upload.
98+
* @param bool $doImageProcessing
9999
* @return array
100+
* @throws Exception if there was an error encountered when saving the upload.
100101
*/
101-
private function doUpload(UploadedFile $upload, $type) {
102+
private function doUpload(UploadedFile $upload, string $type, bool $doImageProcessing) {
102103
$file = $upload->getFile();
103104

104105
$media = [
@@ -109,9 +110,11 @@ private function doUpload(UploadedFile $upload, $type) {
109110
'ForeignTable' => 'embed'
110111
];
111112

112-
switch ($type) {
113-
case self::TYPE_IMAGE:
114-
[$media['ImageWidth'], $media['ImageHeight']] = $this->preprocessImage($upload);
113+
if($doImageProcessing) {
114+
switch ($type) {
115+
case self::TYPE_IMAGE:
116+
[$media['ImageWidth'], $media['ImageHeight']] = $this->preprocessImage($upload);
117+
}
115118
}
116119

117120
$ext = pathinfo(strtolower($upload->getClientFilename()), PATHINFO_EXTENSION);
@@ -385,10 +388,12 @@ public function post(array $body) {
385388
$imageExtensions = array_keys(ImageResizer::getExtType());
386389
/** @var UploadedFile $file */
387390
$file = $body['file'];
388-
$extension = pathinfo($file->getClientFilename(), PATHINFO_EXTENSION) ?? '';
391+
$extension = strtolower(pathinfo($file->getClientFilename(), PATHINFO_EXTENSION) ?? '');
389392
$type = in_array($extension, $imageExtensions) ? self::TYPE_IMAGE : self::TYPE_FILE;
390393

391-
$row = $this->doUpload($body['file'], $type);
394+
$doImageProcessing = $type === self::TYPE_IMAGE && in_array($extension, ['gif', 'jpeg', 'png', 'jpg']);
395+
396+
$row = $this->doUpload($body['file'], $type, $doImageProcessing);
392397

393398
$row = $this->normalizeOutput($row);
394399
$result = $out->validate($row);

0 commit comments

Comments
 (0)