Commit Graph

32 Commits

Author SHA1 Message Date
Anders Kaseorg 28f3dfa284 js: Automatically convert var to let and const in most files.
This commit was originally automatically generated using `tools/lint
--only=eslint --fix`.  It was then modified by tabbott to contain only
changes to a set of files that are unlikely to result in significant
merge conflicts with any open pull request, excluding about 20 files.
His plan is to merge the remaining changes with more precise care,
potentially involving merging parts of conflicting pull requests
before running the `eslint --fix` operation.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-11-03 12:42:39 -08:00
Anders Kaseorg d17b577d0c js: Purge useless IIFEs.
With webpack, variables declared in each file are already file-local
(Global variables need to be explicitly exported), so these IIFEs are
no longer needed.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2019-10-25 13:51:21 -07:00
Cynthia Lin e5d0448505 user settings: Improve accessibility for new delete profile picture button. 2019-07-12 16:53:25 -07:00
Yashashvi Dave cc810f8951 settings: Fix width not maximum while uploading user avatar.
New user avatar width is not maximum when user upload
new image. Because wrong html element is accessed for
setting value of image src attribute.
This commit removes these code from success of ajax call,
cause we already handle this in event `user_events - avatar_url`.
2018-10-19 12:36:18 -07:00
Armaan Ahluwalia 6d255efe4c app: Prepare JS files for consumption by webpack.
This commit prepares the frontend code to be consumed by webpack.

It is a hack: In theory, modules should be declaring and importing the
modules they depend on and the globals they expose directly.

However, that requires significant per-module work, which we don't
really want to block moving our toolchain to webpack on.

So we expose the modules by setting window.varName = varName; as
needed in the js files.
2018-07-05 10:53:36 +02:00
Tim Abbott 7ab8a8e820 js: Fix a bunch of indentation issues found by eslint.
This is preparation for enabling an eslint indentation configuration.
90% of these changes are just fixes for indentation errors that have
snuck into the codebase over the years; the others are more
significant reformatting to make eslint happy (that are not otherwise
actually improvements).

The one area that we do not attempt to work on here is the
"switch/case" indentation.
2018-05-06 16:25:02 -07:00
Rhea Parekh 416f11030f user settings: Display avatar source.
This makes it easier for users to tell how Zulip ended up with an
avatar for them without them uploading one: through the Gravatar
service used across many Wordpress blogs.

Fixes #8225.
2018-03-05 09:12:59 -08:00
Shubham Dhama 995138d730 settings: Allow uploading same image as avatar after deleting.
Previous hack wasn't working but changing the value of
file input element to empty works.
For more info https://stackoverflow.com/questions/20549241.

Fixes: #8377.
2018-02-14 09:37:16 -08:00
K.Kanakhin 1cb0f8dc41 Add size limit for uploading user avatars and realm icons.
- Add settings parameter for max realm icon size.
- Add settings parameter for max user avatar size.
- Add checking file size to avatar and icon
  uploading views.
- Transfer file size limit parameter to frontend.
- Add tests.
2017-03-07 22:13:01 -08:00
Brock Whittaker b8f2685b18 Change bots actions to sidebar.
This changes the bot actions to a sidebar that resides in the settings
overlay.
2017-02-28 20:02:23 -08:00
K.Kanakhin 9ce218154e realm-icon: Move upload widget to separate file.
This makes it possible to use the upload widget in the realm icon
organization settings on frontend.
2017-02-26 12:15:41 -08:00
Tim Abbott 998dff9e50 lint: Add dangling commas in JavaScript objects. 2017-01-11 15:23:42 -08:00
Sampriti Panda 425a55e568 settings: Implement delete avatar functionality 2016-12-21 13:35:22 -08:00
Rafid Aslam 45f39be37f lint: Fix many no-unused-vars eslint rule violations.
These have been carefully audited by tabbott to ensure they are
unlikely to cause regressions.
2016-12-14 21:34:51 -08:00
Rafid Aslam 7856217a63 Migrate JS modules to CommonJS style.
Closes #1488.
2016-12-07 16:11:52 -08:00
Eklavya Sharma 5ce80eb4ba Update types of images accepted as avatars.
* Reject SVG in frontend because backend doesn't accept it.
* Add JPEG format in backend tests for avatar upload.
2016-07-26 16:36:47 +05:30
Tim Abbott 584887e588 lint: Require folding of } on same line in else if statements. 2016-06-09 14:05:34 -07:00
Tim Abbott c35781d505 lint: Require folding of } on same line as else statements. 2016-06-09 14:02:49 -07:00
Steve Howell 7cf66b5bb8 Allow users to upload avatars on the Settings page.
We were using Gravatar for user avatars, but now users can
upload their avatars directly to Zulip, and we will store
their avatar for them.  This removes the old Gravatar-related
interface and polling code.

This commit does not attempt to update the avatars in
messages that have already been loaded, either for the user
making the change or other users.

(imported from commit 301dc48f96f83de0136c93de57055638c79e0961)
2013-10-29 10:59:41 -04:00
Tim Abbott 5a320db3c1 Add curly braces for all javascript if statements lacking them.
(imported from commit 32c7643d1a6ecdfaf634424d217938c8a368dade)
2013-08-01 11:47:54 -04:00
Steve Howell 0ed73df475 Rename some functions related to bot avatars.
(imported from commit 6f88ee71dda263bfe7b5c15baed02aaf00d35f15)
2013-08-01 11:05:40 -04:00
Steve Howell f7ca0117e6 Allow users to upload new avatars for their bots.
(imported from commit 9d7895a658740815f454c8bba400d7cff821b7f9)
2013-08-01 11:05:40 -04:00
Steve Howell d0060f24ed Add close() method to avatar objects.
The close() method will let you release handlers, as well as
doing everything clear() does.

(imported from commit 3a67c3f2226918cee10cf43598e0408fb186408a)
2013-08-01 11:05:40 -04:00
Steve Howell d505d494c8 avatar.set_up_file_input returns object now
The set_up_file_input() function now returns an object to the user
with a clear field.  This object will grow soon.

(imported from commit 7b3761eafddb392bd2c84a1685aa8d1811028a0f)
2013-08-01 11:05:39 -04:00
Steve Howell 784cab9df2 Use jQuery on() consistently in avatar.js.
(imported from commit c14105dbaa174ef9aec4fc11a12a44f25e74a246)
2013-08-01 11:05:39 -04:00
Scott Feeney 5842d5c335 Replace $.inArray with _.indexOf
(imported from commit 6bd9c87ac98b8951411fc050e1bff83684cf8618)
2013-07-30 12:12:03 -04:00
Steve Howell 2275809103 Shorten names of internal functions in avatar.js.
Just have accept() and clear() for brevity sake.

(imported from commit 7bf9b4d89f1b7978ae7b07b5fba87b654c90e314)
2013-07-30 08:41:09 -04:00
Steve Howell 1c69b7ea46 Extract avatar.set_up_file_input.
(imported from commit c85087a4e098b1af2e4d26c97d0cb69c42d4f671)
2013-07-30 08:41:09 -04:00
Steve Howell e6609b3695 DRY up jQuery calls in avatar.js.
Extract some local variables to set up the next refactoring, where
we can parameterize the function.

(imported from commit 1c2801131c19a54713a0d5c2cc26c419412339b0)
2013-07-30 08:40:49 -04:00
Steve Howell e18b9ae3d7 Use get_file_input() to specify hidden file input for avatar uploads.
(imported from commit 898216219b36a65519439da73158da4e5996649b)
2013-07-30 08:40:49 -04:00
Steve Howell c5013c0ba1 Introduce validate_avatar function
(imported from commit 4d6d20e4b1c3b0998d0c40ca9b5c74cb7f3319e5)
2013-07-30 08:40:49 -04:00
Steve Howell 032415fcb4 Move bot avatar code to avatar.js (from settings.js).
This step of the refactoring really just moves the code.

(imported from commit 4d551c43d25723b2556448f47b6b61228e782f54)
2013-07-30 08:40:49 -04:00