From 009df5bad5f55c7e4c698f9dab8420d00a7ae71e Mon Sep 17 00:00:00 2001 From: JoramWilander Date: Mon, 22 Jun 2015 08:35:24 -0400 Subject: fixes mm-1318 only allow 5 files to be uploaded at a time --- web/react/utils/constants.jsx | 1 + 1 file changed, 1 insertion(+) (limited to 'web/react/utils') diff --git a/web/react/utils/constants.jsx b/web/react/utils/constants.jsx index deb07409b..6d129106b 100644 --- a/web/react/utils/constants.jsx +++ b/web/react/utils/constants.jsx @@ -45,6 +45,7 @@ module.exports = { PATCH_TYPES: ['patch'], ICON_FROM_TYPE: {'audio': 'audio', 'video': 'video', 'spreadsheet': 'ppt', 'pdf': 'pdf', 'code': 'code' , 'word': 'word' , 'excel': 'excel' , 'patch': 'patch', 'other': 'generic'}, MAX_DISPLAY_FILES: 5, + MAX_UPLOAD_FILES: 5, MAX_FILE_SIZE: 50000000, // 50 MB DEFAULT_CHANNEL: 'town-square', POST_CHUNK_SIZE: 60, -- cgit v1.2.3-1-g7c22 From 72d54e427c035162260f47b0b79864e6193861e9 Mon Sep 17 00:00:00 2001 From: JoramWilander Date: Mon, 29 Jun 2015 10:31:56 -0400 Subject: add intro text specific to off-topic channel --- web/react/utils/constants.jsx | 1 + 1 file changed, 1 insertion(+) (limited to 'web/react/utils') diff --git a/web/react/utils/constants.jsx b/web/react/utils/constants.jsx index e5f42c8a0..a5124afe2 100644 --- a/web/react/utils/constants.jsx +++ b/web/react/utils/constants.jsx @@ -51,6 +51,7 @@ module.exports = { MAX_UPLOAD_FILES: 5, MAX_FILE_SIZE: 50000000, // 50 MB DEFAULT_CHANNEL: 'town-square', + OFFTOPIC_CHANNEL: 'off-topic', POST_CHUNK_SIZE: 60, RESERVED_DOMAINS: [ "www", -- cgit v1.2.3-1-g7c22 From 2d3ef0b0510e4c0be49cb6025e312fcb932789fd Mon Sep 17 00:00:00 2001 From: JoramWilander Date: Mon, 29 Jun 2015 15:20:49 -0400 Subject: @all and @channel now auto-complete --- web/react/utils/constants.jsx | 1 + 1 file changed, 1 insertion(+) (limited to 'web/react/utils') diff --git a/web/react/utils/constants.jsx b/web/react/utils/constants.jsx index e5f42c8a0..f3f3399d9 100644 --- a/web/react/utils/constants.jsx +++ b/web/react/utils/constants.jsx @@ -36,6 +36,7 @@ module.exports = { SERVER_ACTION: null, VIEW_ACTION: null }), + SPECIAL_MENTIONS: ['all', 'channel'], CHARACTER_LIMIT: 4000, IMAGE_TYPES: ['jpg', 'gif', 'bmp', 'png'], AUDIO_TYPES: ['mp3', 'wav', 'wma', 'm4a', 'flac', 'aac'], -- cgit v1.2.3-1-g7c22 From f030476ff5f438b96d7282c37ad7a42ffc61ae85 Mon Sep 17 00:00:00 2001 From: JoramWilander Date: Tue, 30 Jun 2015 09:06:10 -0400 Subject: @all and @channel now highlight like other mentions --- web/react/utils/utils.jsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'web/react/utils') diff --git a/web/react/utils/utils.jsx b/web/react/utils/utils.jsx index 75c583c8f..d50a044bc 100644 --- a/web/react/utils/utils.jsx +++ b/web/react/utils/utils.jsx @@ -421,10 +421,13 @@ module.exports.textToJsx = function(text, options) { highlightSearchClass = " search-highlight"; } - if (explicitMention && UserStore.getProfileByUsername(explicitMention[1])) { + if (explicitMention && + (UserStore.getProfileByUsername(explicitMention[1]) || + Constants.SPECIAL_MENTIONS.indexOf(explicitMention[1]) !== -1)) + { var name = explicitMention[1]; // do both a non-case sensitive and case senstive check - var mClass = (name.toLowerCase() in implicitKeywords || name in implicitKeywords) ? mentionClass : ""; + var mClass = (('@'+name.toLowerCase()) in implicitKeywords || ('@'+name) in implicitKeywords) ? mentionClass : ""; var suffix = word.match(puncEndRegex); var prefix = word.match(puncStartRegex); -- cgit v1.2.3-1-g7c22 From bcc31b714b19ff3817c96c801028e23ace8cc55b Mon Sep 17 00:00:00 2001 From: nickago Date: Tue, 30 Jun 2015 11:56:55 -0700 Subject: Added the ability to have hashtags with dashes in them --- web/react/utils/utils.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'web/react/utils') diff --git a/web/react/utils/utils.jsx b/web/react/utils/utils.jsx index d50a044bc..175fc2922 100644 --- a/web/react/utils/utils.jsx +++ b/web/react/utils/utils.jsx @@ -395,8 +395,8 @@ module.exports.textToJsx = function(text, options) { var inner = []; - // Function specific regexes - var hashRegex = /^href="#[^"]+"|(#[A-Za-z]+[A-Za-z0-9_]*[A-Za-z0-9])$/g; + // Function specific regex + var hashRegex = /^href="#[^"]+"|(#[A-Za-z]+[A-Za-z0-9_\-]*[A-Za-z0-9])$/g; var implicitKeywords = {}; var keywordArray = UserStore.getCurrentMentionKeys(); -- cgit v1.2.3-1-g7c22 From ae77db2145684e6d6db2b120c248279b55c5e407 Mon Sep 17 00:00:00 2001 From: Reed Garmsen Date: Tue, 30 Jun 2015 12:30:11 -0700 Subject: Changed keyword logic to use arrays rather than maps to remove highlighting of js object properties like constructor and __proto__ --- web/react/utils/utils.jsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'web/react/utils') diff --git a/web/react/utils/utils.jsx b/web/react/utils/utils.jsx index d50a044bc..84bcc284d 100644 --- a/web/react/utils/utils.jsx +++ b/web/react/utils/utils.jsx @@ -398,10 +398,10 @@ module.exports.textToJsx = function(text, options) { // Function specific regexes var hashRegex = /^href="#[^"]+"|(#[A-Za-z]+[A-Za-z0-9_]*[A-Za-z0-9])$/g; - var implicitKeywords = {}; + var implicitKeywords = []; var keywordArray = UserStore.getCurrentMentionKeys(); for (var i = 0; i < keywordArray.length; i++) { - implicitKeywords[keywordArray[i]] = true; + implicitKeywords[i] = keywordArray[i]; } var lines = text.split("\n"); @@ -427,7 +427,7 @@ module.exports.textToJsx = function(text, options) { { var name = explicitMention[1]; // do both a non-case sensitive and case senstive check - var mClass = (('@'+name.toLowerCase()) in implicitKeywords || ('@'+name) in implicitKeywords) ? mentionClass : ""; + var mClass = implicitKeywords.indexOf('@'+name.toLowerCase()) !== -1 || implicitKeywords.indexOf('@'+name) !== -1 ? mentionClass : ""; var suffix = word.match(puncEndRegex); var prefix = word.match(puncStartRegex); @@ -449,7 +449,7 @@ module.exports.textToJsx = function(text, options) { } else if (trimWord.match(hashRegex)) { var suffix = word.match(puncEndRegex); var prefix = word.match(puncStartRegex); - var mClass = trimWord in implicitKeywords || trimWord.toLowerCase() in implicitKeywords ? mentionClass : ""; + var mClass = implicitKeywords.indexOf(trimWord) !== -1 || implicitKeywords.indexOf(trimWord.toLowerCase()) !== -1 ? mentionClass : ""; if (searchTerm === trimWord.substring(1).toLowerCase() || searchTerm === trimWord.toLowerCase()) { highlightSearchClass = " search-highlight"; @@ -457,7 +457,7 @@ module.exports.textToJsx = function(text, options) { inner.push({prefix}{trimWord}{suffix} ); - } else if (trimWord in implicitKeywords || trimWord.toLowerCase() in implicitKeywords) { + } else if (implicitKeywords.indexOf(trimWord) !== -1 || implicitKeywords.indexOf(trimWord.toLowerCase()) !== -1) { var suffix = word.match(puncEndRegex); var prefix = word.match(puncStartRegex); -- cgit v1.2.3-1-g7c22 From 71d0a9472f22e34c24bcdd61ce14748f5ca7ae43 Mon Sep 17 00:00:00 2001 From: Reed Garmsen Date: Tue, 30 Jun 2015 15:00:57 -0700 Subject: Removed unnecessary loop copying --- web/react/utils/utils.jsx | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'web/react/utils') diff --git a/web/react/utils/utils.jsx b/web/react/utils/utils.jsx index 84bcc284d..08b83d084 100644 --- a/web/react/utils/utils.jsx +++ b/web/react/utils/utils.jsx @@ -398,11 +398,7 @@ module.exports.textToJsx = function(text, options) { // Function specific regexes var hashRegex = /^href="#[^"]+"|(#[A-Za-z]+[A-Za-z0-9_]*[A-Za-z0-9])$/g; - var implicitKeywords = []; - var keywordArray = UserStore.getCurrentMentionKeys(); - for (var i = 0; i < keywordArray.length; i++) { - implicitKeywords[i] = keywordArray[i]; - } + var implicitKeywords = UserStore.getCurrentMentionKeys(); var lines = text.split("\n"); var urlMatcher = new LinkifyIt(); -- cgit v1.2.3-1-g7c22 From fd310e382a2cc1a9779ef28dee7fea9476bb425f Mon Sep 17 00:00:00 2001 From: nickago Date: Wed, 1 Jul 2015 12:41:36 -0700 Subject: Finally fixed the git weirdness --- web/react/utils/utils.jsx | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'web/react/utils') diff --git a/web/react/utils/utils.jsx b/web/react/utils/utils.jsx index 70a47742f..530166f04 100644 --- a/web/react/utils/utils.jsx +++ b/web/react/utils/utils.jsx @@ -2,6 +2,7 @@ // See License.txt for license information. var AppDispatcher = require('../dispatcher/app_dispatcher.jsx'); +var ChannelStore = require('../stores/channel_store.jsx') var UserStore = require('../stores/user_store.jsx'); var Constants = require('../utils/constants.jsx'); var ActionTypes = Constants.ActionTypes; @@ -726,6 +727,23 @@ module.exports.isComment = function(post) { return false; } +module.exports.getDirectTeammate = function(channel_id) { + var userIds = ChannelStore.get(channel_id).name.split('__'); + + if(userIds.length != 2) { + return; + } + + var curUser = UserStore.getCurrentId(); + + for(var idx in userIds) { + if(userIds[idx] === curUser) + delete userIds[idx]; + } + + return UserStore.getProfile(userIds[0]) +} + Image.prototype.load = function(url, progressCallback) { var thisImg = this; var xmlHTTP = new XMLHttpRequest(); -- cgit v1.2.3-1-g7c22 From 7b6fe252f18b12107af105f9348da28f2f0d4a0c Mon Sep 17 00:00:00 2001 From: JoramWilander Date: Thu, 2 Jul 2015 09:32:31 -0400 Subject: fix getDirectTeammate so that if teammate is the second id it doesn't return null --- web/react/utils/utils.jsx | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) (limited to 'web/react/utils') diff --git a/web/react/utils/utils.jsx b/web/react/utils/utils.jsx index 530166f04..13cb0ff53 100644 --- a/web/react/utils/utils.jsx +++ b/web/react/utils/utils.jsx @@ -728,20 +728,22 @@ module.exports.isComment = function(post) { } module.exports.getDirectTeammate = function(channel_id) { - var userIds = ChannelStore.get(channel_id).name.split('__'); + var userIds = ChannelStore.get(channel_id).name.split('__'); + var curUserId = UserStore.getCurrentId(); + var teammate = {}; - if(userIds.length != 2) { - return; - } - - var curUser = UserStore.getCurrentId(); + if(userIds.length != 2 || userIds.indexOf(curUserId) === -1) { + return teammate; + } - for(var idx in userIds) { - if(userIds[idx] === curUser) - delete userIds[idx]; - } + for (var idx = 0; idx < userIds.length; idx++) { + if(userIds[idx] !== curUserId) { + teammate = UserStore.getProfile(userIds[idx]); + break; + } + } - return UserStore.getProfile(userIds[0]) + return teammate; } Image.prototype.load = function(url, progressCallback) { -- cgit v1.2.3-1-g7c22 From 18629d8184a985d9fe9f9bf892952044b1e5d57f Mon Sep 17 00:00:00 2001 From: JoramWilander Date: Thu, 2 Jul 2015 09:34:57 -0400 Subject: make loop simpler --- web/react/utils/utils.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'web/react/utils') diff --git a/web/react/utils/utils.jsx b/web/react/utils/utils.jsx index 13cb0ff53..f8a7d6450 100644 --- a/web/react/utils/utils.jsx +++ b/web/react/utils/utils.jsx @@ -736,7 +736,7 @@ module.exports.getDirectTeammate = function(channel_id) { return teammate; } - for (var idx = 0; idx < userIds.length; idx++) { + for (var idx in userIds) { if(userIds[idx] !== curUserId) { teammate = UserStore.getProfile(userIds[idx]); break; -- cgit v1.2.3-1-g7c22