Skip to content
This repository has been archived by the owner on Mar 13, 2024. It is now read-only.

[ICU-648] Fix download tooltip #692

Merged
merged 4 commits into from
Feb 6, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
removed unnecessary props and add constant for max filename length
  • Loading branch information
saturninoabril committed Feb 6, 2018
commit 92cd8e0181008d74e2c8fadf55163987f0e1a73e
12 changes: 1 addition & 11 deletions components/file_attachment/filename_overlay.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,7 @@ export default class FilenameOverlay extends React.PureComponent {
/**
* Optional class like for icon
*/
iconClass: PropTypes.string,

/**
* File name
*/
filename: PropTypes.string,

/**
* File URL
*/
fileURL: PropTypes.string
iconClass: PropTypes.string
};

onAttachmentClick = (e) => {
Expand Down
1 change: 1 addition & 0 deletions utils/constants.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -540,6 +540,7 @@ export const Constants = {
},
MAX_DISPLAY_FILES: 5,
MAX_UPLOAD_FILES: 5,
MAX_FILENAME_LENGTH: 35,
THUMBNAIL_WIDTH: 128,
THUMBNAIL_HEIGHT: 100,
PROFILE_WIDTH: 128,
Expand Down
5 changes: 3 additions & 2 deletions utils/file_utils.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.

import Constants from 'utils/constants.jsx';
import * as UserAgent from 'utils/user_agent';

export function canUploadFiles() {
Expand All @@ -25,8 +26,8 @@ export function canDownloadFiles() {

export function trimFilename(filename) {
let trimmedFilename = filename;
if (filename.length > 35) {
trimmedFilename = filename.substring(0, Math.min(35, filename.length)) + '...';
if (filename.length > Constants.MAX_FILENAME_LENGTH) {
trimmedFilename = filename.substring(0, Math.min(Constants.MAX_FILENAME_LENGTH, filename.length)) + '...';
}

return trimmedFilename;
Expand Down