Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert config to ES6 #888

Merged
merged 4 commits into from
Mar 14, 2017
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
113 changes: 0 additions & 113 deletions app/script/config.coffee

This file was deleted.

138 changes: 138 additions & 0 deletions app/script/config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
/*
* Wire
* Copyright (C) 2016 Wire Swiss GmbH
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see http://www.gnu.org/licenses/.
*
*/

'use strict';

if (window.z === null) {
Copy link
Contributor

@lipis lipis Mar 14, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use == instead of === (to include undefined)

window.z = {};
}

z.config = {
BROWSER_NOTIFICATION: {
TIMEOUT: 5000,
TITLE_LENGTH: 38,
BODY_LENGTH: 80,
},

LOGGER: {
OPTIONS: {
name_length: 65,
domains: {
'app.wire.com'() {
return 0;
},
'localhost'() {
return 300;
},
'wire.ms'() {
return 300;
},
'wire-webapp-staging.wire.com'() {
return 300;
},
'zinfra.io'() {
return 300;
},
},
},
},

// number of message that will be pulled
MESSAGES_FETCH_LIMIT: 30,

// number of users displayed in people you may know
SUGGESTIONS_FETCH_LIMIT: 30,

// Accent color IDs
ACCENT_ID: {
BLUE: 1,
GREEN: 2,
YELLOW: 3,
RED: 4,
ORANGE: 5,
PINK: 6,
PURPLE: 7,
},

// Conversation size
Copy link
Contributor

@lipis lipis Mar 14, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

useless comment

MAXIMUM_CONVERSATION_SIZE: 128,

// self profile image size
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

useless comment

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comments

Copy link
Contributor Author

@ffflorian ffflorian Mar 14, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is it useless? The variable describes only a minimum profile image size, the comment explains that it is about the user's self profile image.

MINIMUM_PROFILE_IMAGE_SIZE: {
WIDTH: 320,
HEIGHT: 320,
},

// 15 megabyte image upload limit
MAXIMUM_IMAGE_FILE_SIZE: (
15 * 1024 * 1024
),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MAXIMUM_ASSET_FILE_SIZE: 15 * 1024 * 1024,

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yes


// 25 megabyte upload limit ( minus iv and padding )
MAXIMUM_ASSET_FILE_SIZE: (
25 * 1024 * 1024 - 16 - 16
),

// Maximum of parallel uploads
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

useless comment, the constant is self explanatory

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know what iv means.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, not self-explanatory. The variable describes only a maximum of any asset uploads, the comment describes that it is about parallel uploads.

MAXIMUM_ASSET_UPLOADS: 10,

// Maximum characters per message
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

useless comment, the constant is self explanatory

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, because it explains that the length is measured in characters, not in bytes or anything else.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then we have to update the constant to MAXIMUM_MESSAGE_CHARACTERS

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or something similar

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Constant renaming comes in another PR...

MAXIMUM_MESSAGE_LENGTH: 8000,

SUPPORTED_PROFILE_IMAGE_TYPES: [
'.jpg-large',
'image/jpg',
'image/jpeg',
'image/png',
'image/bmp',
],

SUPPORTED_CONVERSATION_IMAGE_TYPES: [
'.jpg-large',
'image/jpg',
'image/jpeg',
'image/png',
'image/bmp',
'image/gif',
],

LOCALYTICS_SESSION_TIMEOUT: (3 * 60 * 1000), // 3 minutes in milliseconds
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need for parenthesis


MINIMUM_USERNAME_LENGTH: 2,
MINIMUM_PASSWORD_LENGTH: 8,

// Time until phone code expires
LOGIN_CODE_EXPIRATION: (10 * 60),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need for parenthesis

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but it makes it more readable.


// measured in pixel
SCROLL_TO_LAST_MESSAGE_THRESHOLD: 100,

PROPERTIES_KEY: 'webapp',

// bigger requests will be split in chunks with a maximum size as defined
MAXIMUM_USERS_PER_REQUEST: 200,

UNSPLASH_URL: 'https://source.unsplash.com/1200x1200/?landscape',

ACCOUNT_PRODUCTION_URL: 'https://account-wire.com/',
ACCOUNT_STAGING_URL: 'https://wire-account-staging.zinfra.io/',

WEBSITE_PRODUCTION_URL: 'https://wire.com/',
WEBSITE_STAGING_URL: 'https://staging-website.zinfra.io/',
};