summaryrefslogtreecommitdiffstats
path: root/webapp/utils
diff options
context:
space:
mode:
Diffstat (limited to 'webapp/utils')
-rw-r--r--webapp/utils/constants.jsx14
-rw-r--r--webapp/utils/post_utils.jsx32
-rw-r--r--webapp/utils/utils.jsx28
3 files changed, 46 insertions, 28 deletions
diff --git a/webapp/utils/constants.jsx b/webapp/utils/constants.jsx
index 0e2ae07ea..f1af112a9 100644
--- a/webapp/utils/constants.jsx
+++ b/webapp/utils/constants.jsx
@@ -161,6 +161,14 @@ export default {
EPHEMERAL_MESSAGE: 'ephemeral_message'
},
+ ScrollTypes: {
+ FREE: 1,
+ BOTTOM: 2,
+ SIDEBBAR_OPEN: 3,
+ NEW_MESSAGE: 4,
+ POST: 5
+ },
+
//SPECIAL_MENTIONS: ['all', 'channel'],
SPECIAL_MENTIONS: ['channel'],
CHARACTER_LIMIT: 4000,
@@ -204,6 +212,9 @@ export default {
WEB_VIDEO_HEIGHT: 480,
MOBILE_VIDEO_WIDTH: 480,
MOBILE_VIDEO_HEIGHT: 360,
+ MOBILE_SCREEN_WIDTH: 768,
+ SCROLL_DELAY: 2000,
+ SCROLL_PAGE_FRACTION: 3,
DEFAULT_CHANNEL: 'town-square',
DEFAULT_CHANNEL_UI_NAME: 'Town Square',
OFFTOPIC_CHANNEL: 'off-topic',
@@ -738,5 +749,6 @@ export default {
DEFAULT_WEBHOOK_LOGO: logoWebhook,
MHPNS: 'https://push.mattermost.com',
MTPNS: 'http://push-test.mattermost.com',
- BOT_NAME: 'BOT'
+ BOT_NAME: 'BOT',
+ POST_COLLAPSE_TIMEOUT: 1000 * 60 * 5 // five minutes
};
diff --git a/webapp/utils/post_utils.jsx b/webapp/utils/post_utils.jsx
new file mode 100644
index 000000000..f5111d72d
--- /dev/null
+++ b/webapp/utils/post_utils.jsx
@@ -0,0 +1,32 @@
+// Copyright (c) 2016 Mattermost, Inc. All Rights Reserved.
+// See License.txt for license information.
+
+import Client from 'utils/web_client.jsx';
+
+import Constants from 'utils/constants.jsx';
+
+export function isSystemMessage(post) {
+ return post.type && (post.type.lastIndexOf(Constants.SYSTEM_MESSAGE_PREFIX) === 0);
+}
+
+export function isComment(post) {
+ if ('root_id' in post) {
+ return post.root_id !== '' && post.root_id != null;
+ }
+ return false;
+}
+
+export function getProfilePicSrcForPost(post, timestamp) {
+ let src = Client.getUsersRoute() + '/' + post.user_id + '/image?time=' + timestamp;
+ if (post.props && post.props.from_webhook && global.window.mm_config.EnablePostIconOverride === 'true') {
+ if (post.props.override_icon_url) {
+ src = post.props.override_icon_url;
+ } else {
+ src = Constants.DEFAULT_WEBHOOK_LOGO;
+ }
+ } else if (isSystemMessage(post)) {
+ src = Constants.SYSTEM_MESSAGE_PROFILE_IMAGE;
+ }
+
+ return src;
+}
diff --git a/webapp/utils/utils.jsx b/webapp/utils/utils.jsx
index 978f231df..9b0e370bf 100644
--- a/webapp/utils/utils.jsx
+++ b/webapp/utils/utils.jsx
@@ -909,14 +909,7 @@ export function isValidUsername(name) {
}
export function isMobile() {
- return window.innerWidth <= 768;
-}
-
-export function isComment(post) {
- if ('root_id' in post) {
- return post.root_id !== '' && post.root_id != null;
- }
- return false;
+ return window.innerWidth <= Constants.MOBILE_SCREEN_WIDTH;
}
export function getDirectTeammate(channelId) {
@@ -1315,10 +1308,6 @@ export function isFeatureEnabled(feature) {
return PreferenceStore.getBool(Constants.Preferences.CATEGORY_ADVANCED_SETTINGS, Constants.FeatureTogglePrefix + feature.label);
}
-export function isSystemMessage(post) {
- return post.type && (post.type.lastIndexOf(Constants.SYSTEM_MESSAGE_PREFIX) === 0);
-}
-
export function fillArray(value, length) {
const arr = [];
@@ -1379,18 +1368,3 @@ export function localizeMessage(id, defaultMessage) {
export function mod(a, b) {
return ((a % b) + b) % b;
}
-
-export function getProfilePicSrcForPost(post, timestamp) {
- let src = Client.getUsersRoute() + '/' + post.user_id + '/image?time=' + timestamp;
- if (post.props && post.props.from_webhook && global.window.mm_config.EnablePostIconOverride === 'true') {
- if (post.props.override_icon_url) {
- src = post.props.override_icon_url;
- } else {
- src = Constants.DEFAULT_WEBHOOK_LOGO;
- }
- } else if (isSystemMessage(post)) {
- src = Constants.SYSTEM_MESSAGE_PROFILE_IMAGE;
- }
-
- return src;
-}