Commit Graph

216 Commits

Author SHA1 Message Date
Yashashvi Dave 6e65235a6d zerver/lib/events.py: Add FIELD_TYPE_CHOICES_DICT to page_params.
This commit add FIELD_TYPE_CHOICES_DICT to page_params and replace
FIELD_TYPE_CHOICES.

FIELD_TYPE_CHOICES_DICT includes all field types with keyword, id
and display name. Using this field-type-dict, we can access field
type information by it's keyword, and remove all static use of
field-type'a name or id in frontend.
This commit also modifies functions in js where this page_params
field-types is used.
2018-08-21 11:37:51 -07:00
Yashashvi Dave 1cfe7f6494 user popover: Fix user-type-field not showing in user popover.
User type custom field are not showing in user profile popover.
Because we weren't passing proper argument to func to get data.
2018-08-08 14:59:17 -07:00
Yashashvi Dave f8d4578be1 user popover: Fix choice field shows index of selected choice instead value.
Choice type of custom field, displays index of selected choice by user
instead of value of choice.
Fix this by parsing choice-type custom field to get field value before
rendering user popover template.

Fixes #10239
2018-08-08 14:59:17 -07:00
Joshua Pan 3a74df17de hash_util: Remove unnecessary parameter is_absolute_url.
is_absolute_url was always true. Removed the conditional also.
2018-08-04 17:56:02 -07:00
Steve Howell c8898e1dc8 refactor: Move by_conversation_and_time_uri to hash_util.
This removes the 100% coverage on hash_util, but we are
pretty careful about not messing with this code.
2018-08-04 09:32:27 -07:00
Steve Howell ffca07ffdd refactor: Move by_sender_uri to hash_util. 2018-08-04 09:32:27 -07:00
Steve Howell fc62e554ce refactor: Move pm_with_uri to hash_util. 2018-08-04 09:32:27 -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
Yashashvi Dave e7a172293f user popover: Display name of user instead of id in user-type-custom field. 2018-07-01 02:05:00 -07:00
Shubham Padia 5f9cdf9b08 popovers: Enable keyboard navigation on user profile menu.
Fixes #9318.
Calls popovers.user_info_popover_handle_keyboard in process_hotkey.js.
Makes popovers.message_info_popped public.
2018-06-13 05:57:14 -04:00
Shubham Padia 5481dd11bc popovers: Focus on first menu item when user profile opened by hotkey.
Adds focus_user_info_popover_item to popovers.js. When menus are
opened by hotkeys, first menu item is focused to enable further
keyboard navigation.
2018-06-13 05:57:14 -04:00
Shubham Padia 4516a72676 popovers: Add get_user_info_popover_items.
Gets menu items for the user profile popover. To be used to add
keyboard navigation to user_profile_menu.
2018-06-13 05:57:14 -04:00
Shubham Padia 68d58b92cc popovers: Refactor functions using get_action_menu_menu_items.
actions_menu_handle_keyboard now only gets the action menu items
and passes them to the newly added popover_items_handle_keyboard.
popover_items_handle_keyboard takes the key and menu items as its
parameters. The function can be used when handling keyboard input
like user profile popover. Similar refactor has been carried out in
focus_first_action_popover_item. This refactor is a part of adding
the missing support of keyboard navigation to user profile popover.
2018-06-13 05:57:14 -04:00
Shubham Dhama 80a2d5bc59 eslint: Enable `conditionalAssign` config of no-trailing-spaces rule. 2018-06-11 07:51:24 -04:00
Shubham Dhama dcb6254a4e eslint: Enable `no-extra-parens` rule.
Following sub-configuration is disabled:
                "nestedBinaryExpressions": false,
2018-06-11 07:51:24 -04:00
Yashashvi Dave b9b923aab6 user profile: Display local date format in user profile.
Display local date format in date type of inputs in user profile
popover, i.e. joined_date, date-type-custom-field.
2018-06-06 15:06:26 -07:00
Shubham Dhama cc03f9fb8f eslint: Enable space-infix-ops rule.
More about rule at  https://eslint.org/docs/rules/space-infix-ops
2018-06-05 00:47:35 +05:30
Yashashvi Dave 40029a0753 user profile: Improve format of date type of custom fields in popover.
In user profile popover, date type of custom fields values are
not showing in correct format as "date_joined" value.
Fix this using moment.js to render date type of fields
in correct format.
2018-05-27 23:01:22 -07:00
Aditya Bansal e41d32a15a reminders: Add various design improvements for the UI/reminder msg. 2018-05-21 09:07:37 -07:00
Aditya Bansal 81a677e02b reminders: Refactor relevant code to live in a separate reminder.js. 2018-05-21 09:03:31 -07:00
Vishnu Ks 10832f1e8d popover: Show last seen time in user profile. 2018-05-17 07:49:35 -07:00
Vishnu Ks 1e92810972 popover: Tag user timezone for translation. 2018-05-17 07:49:35 -07:00
Vishnu Ks 9c751f038c popover: Show date joined in user profile. 2018-05-17 07:49:35 -07: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
YJDave 6bef44a9fa org setting: Add time limits for message deleting.
Add realm setting to set time limit for message deleitng.
Set default value of message_content_delete_limit_seconds
to 600 seconds(10 min).

Thanks to Shubham Dhama for rebasing and reworking this.  Some final
edits also done by Tim Abbott.

Fixes #7344.
2018-04-27 19:22:28 -07:00
Tim Abbott 3e49850d6b popovers: Fix broken node test.
This seems to have been introduced when rebasing
7533796ea9.
2018-04-23 17:29:15 -07:00
Vishnu Ks 7533796ea9 popover: Add an option to show user profile.
Fixes #8880
2018-04-23 16:56:24 -07:00
Tim Abbott e4c50ff4fd narrow: Remove unnecessary select_first_unread option.
We consistently either pass a `then_select_id` into narrow.activate,
or were using the select_first_unread option.  Now, we just compute
select_first_unread based on the value of then_select_id.
2018-04-22 21:33:33 -07:00
Priyank f5acbcb4c8 clipboard: Update clipboard to v2.0.0 to avoid variable name conflict.
It turns out, now we have a new standard way to access clipboard by
`Clipboard` method and currently this conflict with the constructor
exported by clipboard package. The new update v2.0.0 was released to address
this issue. The new version just exports the constructor as `ClipboardJS`.

Ref: https://developer.mozilla.org/en-US/docs/Web/API/Clipboard
Ref: https://github.com/zenorocha/clipboard.js/issues/468
2018-04-05 15:09:00 -07:00
Marco Burstein 6279a9ef09 message view: Hide "view source" and "quote" for deleted messages.
Fix #8839.
2018-03-27 16:43:24 -07:00
Tim Abbott 4ae1418831 popovers: Rename confusing my_email to user_popover_email. 2018-03-12 12:24:50 -07:00
Priyank Patel 29c6d23043 user profiles: Add copy-to-clipboard btn for long emails.
Implements copy to clipboard btn that shows up if email is too long.
Making it easier for user to copy long emails.
2018-03-12 12:06:40 -07:00
Aditya Bansal 06cabc1e8a popovers: Fix issue with user-info-popover in legacy mention messages.
We fallback to using data-user-email attrib for mention messages
from the times when we use to expose user emails to frontend.
This is only required for cases where we are dealing with anything
that isn't rendered dynamically (like the messages that were already
sent and stored long time ago). Hopefully we won't be needing this
kind of fallback logic in more places so I am putting off efforts
to try to extract fallback logic for common use. Also this is like
this because it will probably be tricky to extract out a common
fallback logic in this case because of different situations involved.

Fixes: #8588.
2018-03-06 06:41:17 -08:00
Tim Abbott 0147826042 user_groups: Convert members to a dict in frontend. 2018-03-04 09:45:31 -08:00
Shubham Dhama d6a38901ae compose: Fix clearing of existing text on replying from popovers.
compose_action.respond_to_message and compose_action.start starts new
compose box so we should check whether we are already composing
or not. So, behavior, when we are composing, is that the user we want
to mention is added to the same compose-text without the changing stream
and topic name.
2018-03-01 08:00:42 -08:00
Shubham Dhama dcac002213 compose: Use insert_syntax_and_focus to insert text in compose textarea.
Use compose_ui.insert_syntax_and_focus() when we need to insert text
inline-ly followed by the focus to compose textarea because it does
this job more smartly(it take cares of spaces).
2018-03-01 08:00:42 -08:00
Shubham Dhama c995c1a36a popovers: Fix two click handler attached to (rightbar) user_popovers.
No need to have separate click handler for user_popovers and
message_info_popovers as the same user-id can be extracted similarly
from the target of both the click events.

Another refactor, `sender_info_popover` was confusing as it doesn't
fix into the context of rightbar user popovers so changed it to
`info_popover_actions` since that section of popovers contains popover
actions.
2018-03-01 08:00:42 -08:00
Shubham Dhama b17d4e193c popovers: Show hotkey reminder for sender info popovers only.
Hotkey reminders in user popovers( i.e. `@` and `R`) should be present
only for sender info popovers, hence for user-mention and user-presence
popovers it will show no such reminders.

Fixes: #8313.
2018-02-21 13:06:22 -08:00
Shubham Dhama 1192111ce2 group popovers: Refactor setting up scrollbar.
Using a wheelspeed of 0.68 is fine as used throughtout Zulip.
2018-02-18 20:20:51 -08:00
ryan dea7d1d1b6 profile menu: Show profile-edit option when a user clicks on self-profile.
This removes some options when a user clicks on their own profile, and
replaces them with an option to edit their own profile settings.

Front end test adjusted because it was testing an option that does not
appear if a user clicks on their own profile.

Fixes #5075.
2018-02-16 16:59:45 -08:00
Eric Eslinger 786bda674c popovers: Add a popover for group mentions.
This adds a click handler to `.user-group-mention` which works in a
fashion that is quite similar to `.user-mention`. It generates and
displays a popover.

The popover has a list of members, their online status (if they are
not bots) or their bot status if they are bots (it's not clear whether
ultimately bots should be able to be members of usergroups, but I'm
able to add one, so I thought it would be worth supporting).

The popover's `UL` element has max-height and overflow-y atttributes
so large groups will grow a scrollbar.

Fixes #8300.
2018-02-16 13:37:02 -08:00
Eric Eslinger bc21344dc6 popovers: Fix memory leak with old popovers.
This change resets the list_of_popovers array to a new empty array after
hide_all has been called. Prior behavior kept it around, and it kept
pointers to orphaned DOM nodes.

Fixes #8416.
2018-02-16 13:33:06 -08:00
Vishnu Ks a46e21ee3e bankruptcy: Add UI widget to mark all messages as read.
This is the natural analog of the similar streams UI feature.

Fixes #7585.
2018-02-15 18:01:03 -08:00
Shubham Dhama c8d038a239 popovers: Fix user-mention popover errors of `@all` mention.
`@all` and `@everyone` mentions don't have specific popover, so
constraint added to prevent console errors.
2018-02-05 10:34:47 -08:00
Balaji2198 f49d9d016f hotkeys: Add '>' as a hotkey for quote and reply to message.
Tweaked by tabbott to fix a few minor issues.

Fixes #8146.
2018-02-02 17:37:53 -08:00
Aditya Bansal 0ec50d8cc8 reminders: Hide message menu reminder's option behind features_flag. 2018-01-24 03:33:40 +05:30
Aditya Bansal 1324d2e3c0 reminders: Make shortcuts to setup reminder in message feed work. 2018-01-19 11:33:11 -05:00
Aditya Bansal 7d8d7f7f9b reminders: Add alert message for set reminder success or failure. 2018-01-19 11:33:11 -05:00
Aditya Bansal 0f71a7ecca reminders: Add UI for setting up reminders for messages in the feed. 2018-01-19 11:33:11 -05:00
Steve Howell d5d11ff181 Disable message menu for locally echoed messages.
Wait until the server acks a message before we enable
the message popover menu.  This prevents a whole class
of bugs related to re-drawing the message and changing
the message id, and it also makes room for a little
spinner in the future.

Users with decent internet connections will generally
get server responses before they can click on the
chevron or hit esc/i, anyway.
2017-12-26 09:01:21 -05:00