From b5b1e7ec0b377e76cff754a82d686a12eb784a39 Mon Sep 17 00:00:00 2001 From: OldHawk Date: Thu, 14 Dec 2017 10:35:36 +0800 Subject: [PATCH] feat(forums): add forum topic title & content & reply length limit. --- config/env/torrents.js | 10 ++++++++-- modules/about/client/less/about.less | 2 +- .../controllers/forums-post.client.controller.js | 1 + .../controllers/forums-topic.client.controller.js | 9 +++------ modules/forums/client/views/post.client.view.html | 4 ++-- modules/forums/client/views/topic.client.view.html | 4 ++-- 6 files changed, 17 insertions(+), 13 deletions(-) diff --git a/config/env/torrents.js b/config/env/torrents.js index 0f546090..b014f392 100644 --- a/config/env/torrents.js +++ b/config/env/torrents.js @@ -276,11 +276,17 @@ module.exports = { * @messageMaxLength */ inputLength: { + userSignatureLength: 512, chatMessageMaxLength: 512, + messageBoxContentLength: 1024, messageBoxReplyLength: 512, - userSignatureLength: 512, - torrentCommentLength: 512 + + torrentCommentLength: 512, + + forumTopicTitleLength: 128, + forumTopicContentLength: 4096, + forumReplyContentLength: 2048 }, /** diff --git a/modules/about/client/less/about.less b/modules/about/client/less/about.less index 51c8a6c8..e553d1bb 100644 --- a/modules/about/client/less/about.less +++ b/modules/about/client/less/about.less @@ -115,7 +115,7 @@ border-radius: 4px; background-color: #2a2a2a; padding: 10px 0 15px 0; - margin: 20px 0 0 0; + margin: 0 0 20px; overflow: hidden; .fa-5x { diff --git a/modules/forums/client/controllers/forums-post.client.controller.js b/modules/forums/client/controllers/forums-post.client.controller.js index 15ad6ded..c74032af 100644 --- a/modules/forums/client/controllers/forums-post.client.controller.js +++ b/modules/forums/client/controllers/forums-post.client.controller.js @@ -12,6 +12,7 @@ marked, $stateParams, TopicsService) { var vm = this; vm.forumsConfig = MeanTorrentConfig.meanTorrentConfig.forumsConfig; + vm.inputLengthConfig = MeanTorrentConfig.meanTorrentConfig.inputLength; vm.user = Authentication.user; vm.forumPath = []; diff --git a/modules/forums/client/controllers/forums-topic.client.controller.js b/modules/forums/client/controllers/forums-topic.client.controller.js index 6c1cee51..1357904b 100644 --- a/modules/forums/client/controllers/forums-topic.client.controller.js +++ b/modules/forums/client/controllers/forums-topic.client.controller.js @@ -15,6 +15,7 @@ var vm = this; vm.DLS = DownloadService; vm.forumsConfig = MeanTorrentConfig.meanTorrentConfig.forumsConfig; + vm.inputLengthConfig = MeanTorrentConfig.meanTorrentConfig.inputLength; vm.announce = MeanTorrentConfig.meanTorrentConfig.announce; vm.scoreConfig = MeanTorrentConfig.meanTorrentConfig.score; vm.itemsPerPageConfig = MeanTorrentConfig.meanTorrentConfig.itemsPerPage; @@ -482,14 +483,10 @@ * beginPostReply */ vm.beginPostReply = function () { - vm.scrollToReply = true; $('#postReplyContent').focus(); $timeout(function () { - $('#postReplyContent').scrollTop($('#postReplyContent')[0].scrollHeight); - }, 100); - $timeout(function () { - vm.scrollToReply = false; - }, 500); + $('html,body').animate({scrollTop: $('#post-new-reply-table')[0].offsetTop - 60}, 200); + }, 10); }; /** diff --git a/modules/forums/client/views/post.client.view.html b/modules/forums/client/views/post.client.view.html index 57521979..b8d2a7a0 100644 --- a/modules/forums/client/views/post.client.view.html +++ b/modules/forums/client/views/post.client.view.html @@ -21,7 +21,7 @@
+ placeholder="{{'FORUMS.FIELDS.TITLE' | translate}}" maxlength="{{vm.inputLengthConfig.forumTopicTitleLength}}" required autofocus>

{{ 'FORUMS.PT_REQUIRED' | translate}}

@@ -30,7 +30,7 @@
diff --git a/modules/forums/client/views/topic.client.view.html b/modules/forums/client/views/topic.client.view.html index dc8baa2a..8eb1e0c8 100644 --- a/modules/forums/client/views/topic.client.view.html +++ b/modules/forums/client/views/topic.client.view.html @@ -250,7 +250,7 @@
-
+
@@ -268,7 +268,7 @@