Commit Graph

424 Commits

Author SHA1 Message Date
Hemanth V. Alluri c192327a37 settings_account: Fix small typo in initialize_custom_user_type_fields. 2019-04-25 15:56:44 -07:00
Nikhil-Vats 38be5ea743 message_edit_history: Add UI for seeing topic edits.
Users can previously see only message content edits, this will enable
them to see topic edits too in the same section, fixes #3731.

Fixes #3731.
2019-03-25 15:10:47 -07:00
Anders Kaseorg bd50c6a152 resize: Don’t hide popovers on mobile resize.
Or on the scroll triggered by that resize.

Then we don’t need a kludge that skips the resize handler in
situations where it might hide popovers.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2019-03-15 09:52:08 -07:00
Steve Howell 725bdcc384 user popover: Pop user menu closer to avatar.
If you click on the avatar, we now show the menu
right next to the avatar.  The current behavior
is particularly funny for long names.  (I confirmed
this with Rishi.)
2019-03-08 15:24:01 -08:00
Steve Howell fb750a2656 bug fix: Fix hovers for /me messages.
This fixes several bugs with /me messages:

    * We no longer hover name if you're over
      the message.

    * We now launch the user popup if you
      click on the name.

    * Even if you click on the avatar, we
      launch the user popup to the right
      of the name.  (I think this is odd,
      but it's consistent with how we
      do it for normal messages.)

The underlying problem here is that you have
two possible organizations.

From a logical standpoint, the image and
name go together (and both launch the user menu):

    img Alice | says hi

From a physical perspective, the main message
is "Alice says hi" and it's aligned differently
from the image:

    img | Alice says hi

Our HTML reflects the latter.

HTML doesn't allow overlapping diffs, of course,
so you have to pick your poison.
2019-03-08 15:24:01 -08:00
Steve Howell b00c54ff1c popovers: Remove broken code with 'u" key.
The code that was removed here wasn't doing what it
was intending to do, and we really just want to pop
up the user menu above the currently selected message.
2019-03-08 15:24:01 -08:00
ruchit2801 9f7e90f68b left sidebar: Add an "unstar all messages" option.
In this commit, I've added a feature to unstar all the starred
messages.  This is useful, e.g., for folks who are using starred
messages to keep track of things they should come back when next at
their desktop.

The event flow is the standard one for a feature with a confirmation modal:

(1) User clicks on unstar all messages.

(2) We display a confirmation modal; if the user confirms, we send a
request to the backend to clear all starred messages.

(3) The events system sends that UI update back to us, removing the
stars from the UI.

Fixes #11401.
2019-03-07 20:52:00 -08:00
Steve Howell 9aa7ebadd7 me messages: Turn off collapse feature.
This is totally broken on master.  If you "collapse" a /me
message, it adds the "More..." link without actually
hiding any content.

I have another branch related to collapse/condense that
will make this easier to resurrect.
2019-03-07 11:32:09 -08:00
Steve Howell 0a848e412f buddy list: Use user-list-arrow class.
Using a more specific class avoids confusion related
to the .arrow class, which is not only a popover concept,
but also a Zulip concept in the left sidebar.
2019-03-04 15:35:40 -08:00
vinitS101 2dddf8d8b9 refactor: Move user_last_seen_time_status() to buddy_data.
This is a pure data function, so it shouldn't be in popovers.js file

(Steve Howell added test coverage here, and tabbott removed an
accidental functional change.)
2019-03-01 15:32:14 -08:00
varunvaruns9 6725d921ac popovers: Fix toggling of user popover.
Fix the logic for closing user popover on clicking
the chevron again in the buddy list.

Fixes: #11690.
2019-02-28 14:45:16 -08:00
Wyatt Hoodes 5231b27dea popovers: Add a clear status option in user popover.
Accomplished by adding a function to clear the status message with
an empty string. The html is then updated to reflect changes without a
refresh.

Currently, it's a small hassle to clear a status message.  This option
makes things a bit easier.

Fixes #11630.
2019-02-26 14:40:17 -08:00
Steve Howell 1adcaad04a refactor: Simplify logic for circles.
We now have a function get_user_circle_class
that returns one of these values:

    "user_circle_green"
    "user_circle_orange"
    "user_circle_empty"

And we put that in the templates.

And then CSS renders the circle of the appropriate
color.

The unit tests now explicitly capture whether
we are rendering the correct kind of circle.
2019-02-18 14:22:37 -08:00
Steve Howell 57aabc2a24 away: Use correct user circle in user group popup.
When you click on a user group mention, you see
the list of people with green/orange/empty circles
next to them.  We now correctly reflect away status.
2019-02-17 06:43:36 -08:00
Tim Abbott 4e53110350 message_list: Fix handling of deleted user groups.
You can now render message lists containing them and click on them
without throwing an exception.
2019-02-15 14:54:25 -08:00
Steve Howell 19a434a289 user popover: Fix cropping/positioning.
We use the `fix_positions` options every time
we launch a user popover, whether it is from
the message pane avatar or the buddy list
chevron.

For the message pane case, we can eliminate
some complexity related to trying to put
the menu above or below the avatar.  We now
always suggest "right", and if there are
constraints due to being close to the edge
of the screen, the fix_positions code
will take care of it.
2019-02-14 16:34:29 -08:00
Steve Howell 66c6423001 popovers: Restructure hardcoded "top" for user popover.
The patch to bootstrap will make the position smarter, but we still
want to preserve the 100px default vertical offset we chose for visual
reasons.

Tweaked by tabbott to preserve the visual design.
2019-02-14 16:34:15 -08:00
Steve Howell 5442b38a20 popovers: Rename template to `no_arrow_popover`.
The `user_info_popover` template is a generic
way to make a popover without the arrow effect,
and we'll want to reuse it for other popovers.
2019-02-14 16:16:04 -08:00
Abhinav Singh 849c296f90 popovers: Fix 'w' hotkey in narrow windows.
In small screen sizes, when the user presses shortcut `w` to search
for another user, the hide_all function calls in the search code path
would hide the right sidebar, immediately after opening it, making the
hotkey basically unusable.

We fix this by extracting a separate hide method that hides all true
popovers, but not the user list sidebar.

Fixes #11463.
2019-02-08 08:42:34 -08:00
Steve Howell 9ce5d51bdc user status: Fix tiny green dot in user popover.
We now compute the class that drives the tiny
green/orange/empty dot in the user popover using
the same logic as the buddy list.

This was broken in the early implementation of
set/clear-away, but it was never released.

Fixes #11413
2019-02-01 15:23:35 -08:00
Steve Howell ab8b50453b user status: Show status in user info popovers. 2019-02-01 15:23:35 -08:00
Steve Howell a964977960 user status: Add ability to edit status text. 2019-01-29 10:27:49 -08:00
Aditya Bansal b2fa7a2293 popovers: Add a require for confirmDate plugin. 2019-01-14 12:11:27 -08:00
Steve Howell cb691694d1 status: Add user menu options to set/revoke away status. 2019-01-02 09:23:20 -08:00
Hemanth V. Alluri e3aed0f7bc custom profile fields: Markdown rendering for custom profile field values.
This makes it possible it include our standard markdown formatting in
one's custom profile fields, allowing for links, emphasis, emoji, etc.

Fixes #10131.
2019-01-01 21:06:21 -08:00
Hemanth V. Alluri 28d344b4b5 custom profile fields: Pass value as part of a dictionary.
While we're at it, we remove the JSON parsing that was part of the
user field code path, since this function isn't responsible for
rendering user fields.
2019-01-01 21:05:28 -08:00
Steve Howell 1ad30c6858 subject -> topic: Sweep "message.subject" in frontend.
These were the last remaining files.  After this, only
util.js has a non-email-related use of "subject".
2019-01-01 20:49:38 -08:00
Cynthia Lin 053c4a2250 popovers: Add guest avatar marker to user profile popover. 2018-12-30 11:07:00 -08:00
Cynthia Lin 4d97909764 popovers: Add guest avatar marker to user info popover. 2018-12-30 11:07:00 -08:00
Steve Howell 3fc8597119 popovers: Avoid passing message to actions popover template.
We instead get the specific fields from message
that we use.  This is particularly helpful
for subject -> topic migration; we no longer
have to account for "subject" fields in
client-side templates.
2018-12-29 14:19:18 -08:00
Hemanth V. Alluri b928bb3b26 static: Replace an if-else block in popovers.js with a switch statement. 2018-12-29 11:24:10 -08:00
Tim Abbott bdb3da4504 eslint: Add key-spacing linter rule.
Apparently, we didn't have one of these, and thus had a moderate
number of generally very old violations in the codebase.  Fix this and
clear the ones that exist..
2018-12-18 10:41:06 -08:00
Steve Howell f18ce4f923 muting: Use stream_id in markup for action menus. 2018-12-14 16:05:37 -08:00
Steve Howell bf6f5e7bc5 muting: Pass stream_id to muting_ui.mute and unmute.
We temporarily allow settings_muting to have
incomplete line coverage--we will fix this soon.
2018-12-14 16:02:48 -08:00
Steve Howell a8718c9051 muting: Use stream_id for internal data structures.
This fixes the most core data structures inside of
muting.js.  We still use stream names for incoming
data to set_muted_topics and outgoing data from
get_muted_topics.

This will make us more resilient to stream name changes.
Before, if you were logged on when a stream rename
occured, topics that were muted under that stream would
appear to be unmuted.  (You could fix it with a reload,
but it can be jarring to have a bunch of unread messages
appear in your feed suddenly.)

Fixes #11033
2018-12-14 15:58:35 -08:00
Yashashvi Dave 28c38a44c8 static/js/popover: Use predefine func to append user pills in field.
This commit remove repetitive code to append user pills in
custom field of user profile popover. And call already defined
function there.
2018-11-28 16:22:35 -08:00
Yashashvi Dave a394778cde statis/js/popover.js: Remove unused arg from `show_user_profile` func.
Remove unused argument `element` from function `show_user_profile`.
2018-11-16 09:52:05 -08:00
Yashashvi Dave 89eebad14f user profile: Add user type/role in user profile popover.
Add user type/role in user's detail profile popover.

Fixes part of #10754
2018-11-12 15:13:44 -08:00
Yashashvi Dave 54dd7f0a43 user info popover: Add user type/role in user information popover.
Add user role-- "Administrator", "Member", "Bot" or "Guest"
under 'Local time' in user information popover.

Fixes part of #10754
2018-11-12 15:13:44 -08:00
Yashashvi Dave 614624d232 static/js/popover.js: Extract `render_user_info_popover`. 2018-11-12 15:13:43 -08:00
Tim Abbott 67fa755158 popovers: Remove now-unused narrowed argument to user info popover.
This stopped being used in bbfd33185c.
2018-11-12 15:10:19 -08:00
Tim Abbott 5a9f00dae4 popovers: Sort arguments for user info popover.
This makes it easier to see how the two duplicate implementations differ.
2018-11-12 15:09:09 -08:00
Tim Abbott 4c8f439ece popovers: Standardize calculation of show_user_profile. 2018-11-12 14:59:39 -08:00
Tim Abbott 96284bd336 popovers: Use attributes of user object more consistently.
This is a preparatory refactoring to make it easy to see what's
different as we deduplicate this logic.
2018-11-12 14:59:38 -08:00
Tim Abbott 08529507c8 popovers: Sort arguments to user info popover rendering.
This is a first step towards deduplicating this logic.
2018-11-12 14:59:23 -08:00
Marco Burstein 05b486182d compose: Create the mobile compose popover.
When a user clicks the compose `+` button, create a popover at the
bottom right of the screen including buttons for opening a new stream
message or a new private message.
2018-10-31 16:47:48 -07:00
Cynthia Lin c0edcf6fe4 user profiles: Remove empty space under profiles with no set fields.
Fixes #10652.
2018-10-14 09:37:18 -07:00
Rohitt Vashishtha f857111920 popovers.js: Use people.get_mention_syntax. 2018-10-13 16:42:50 -07:00
Cynthia Lin 6d0aa68591 custom profile fields: Add and restyle default user profile fields.
Refactor selectors to utilize SCSS features.

Fixes some issues in #10545.
2018-10-04 17:02:09 -07:00
Steve Howell 412dbde2e0 minor: Close buddy list when replying with mention.
If you use the "Reply mentioning user" option from
the buddy list popover menu, we now hide the buddy
list if you're in a narrow screen.
2018-09-08 12:14:22 -04:00
Cynthia Lin e92ec362ca popovers: Show line breaks in Long type fields in user profile popovers. 2018-08-27 17:38:15 -07:00
Yashashvi Dave 9a09513b4d user settings: Add link to user profile popover.
Add button to view current user's profile popover
from user settings page.
2018-08-27 17:26:07 -07:00
Yashashvi Dave 4049a08b88 user popover: Display text as link for URL custom field.
In user profile popover, for URL type custom field
display text as link in popover, so user can easily
click on link directly.
2018-08-27 17:26:07 -07:00
Yashashvi Dave 4f9ca03c13 user profile popover: Display user pills in custom user field.
Display user pills instead of user names in custom user field
on user profile popover.
2018-08-21 12:10:35 -07:00
Yashashvi Dave 92782e2f89 static/js/popovers.js: Modify structure of user popover template data.
Modify structure of template data used to render
`user_profile_modal.handlebars`.

This is preparatory commit to display user pills in user profile
popover instead of user names in user type custom fields.
2018-08-21 11:42:59 -07:00
Yashashvi Dave 9e9bb18244 user profile popover: Use long local date format in custom-date-field.
Use long local date format `MMMM DD, YYYY` instead of short `MM/DD/YY`
in custom profile date field.
2018-08-21 11:42:59 -07:00
Yashashvi Dave 6622f995b0 user profile popover: Rename user last seen.
Rename "Last seen just now" to "Just now",
and "Unknown" to "More than 2 weeks ago"
in user profile popover.
2018-08-21 11:42:59 -07:00
Yashashvi Dave 1e27cb18eb user profile popover: Hide popover when user clicks on edit-profile-btn. 2018-08-21 11:42:59 -07:00
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
Steve Howell 94da59ff81 local echo: Don't show collapse/uncollapse items.
Trying to collapse a locally echoed message is a rare
thing to do, and it was buggy before this due to races
between the server acking the original message and the
user flipping the collapsed flag.

We now calculate `should_display_collapse` and
`should_display_uncollapse` in the JS code and simplify
the template by eliminating all the inline if/else
logic.

(Note that we are about to disable the message menu
altogether for locally echoed messages, so this change
is partly future-proofing for when we put the menu
back for more innocuous commands.)
2017-12-26 09:01:21 -05:00
Brock Whittaker 20f3b0f599 popovers: Apply email overflow changes to ".message-info-popover".
This applies the same overflow changes to “.message-info-popover” by
imposing a max width on the popover (so it doesn’t increase in width
when it gets larger) and adding the tooltip on hover.
2017-12-13 14:20:18 -06:00
cPhost 97c3d5fce3 user profiles: add tooltip for too long email. 2017-12-13 14:20:18 -06:00
Tommy Ip 6e22847548 refactor: new message content -> compose textarea. 2017-11-28 12:53:40 -08:00
Rohitt Vashishtha be56a99734 popover: Populate compose_box with popover user's email.
Replaces use of compose.respond_to_message with compose.start, manually
populating the email field with the popovered user's email.

Fixes #7526.
2017-11-26 22:59:37 -08:00
Cynthia Lin 7d2672cfcd popovers: Include expanded mobile sidebars as active popovers. 2017-11-14 11:12:13 -08:00
Cynthia Lin 1bcc07f7dd popovers: Add bot icon to user profile popovers for bots.
Fixes #7176.
2017-11-10 11:18:43 -08:00
Garvit 8084f2dc55 Add: Profile picture popover on clicking mentions in chats.
Fixes #6380
2017-11-09 12:21:16 -08:00
YJDave de67bf81fd org settings: Allow users to delete their message.
Fixes #7049.
2017-11-09 10:20:34 -08:00
derAnfaenger 19bc55aa45 Fix various typos.
The typos and their corrections were found with the
aid of https://github.com/lucasdemarchi/codespell.
2017-11-09 16:26:38 +01:00
Steve Howell c291c74e45 minor: Make comment more accurate in popover error condition. 2017-11-07 09:51:10 -08:00
Steve Howell df03e30d68 popovers: Fix is-active checks for popovers.
We were incorrectly reporting active bots as non-active in
popovers, and we had no test coverage for cross-realm bots.

We also rename the function to is_active_user_for_popover,
since the old name, realm_user_is_active_human_or_bot, suggested
the wrong semantics for cross-realm bots.

Last but not least, we only do a blueslip warning if a user id
is not found.  When lookups fail, we are pretty confident that
the user is not active, so an error is overkill.  We can change
that as part of issue #7120.

Fixes #7153
2017-10-26 13:56:32 -07:00
Tim Abbott 11eba1173c popovers: Don't show bots as deactivated in user popovers.
Apparently this is a bug that slipped in when we started showing
normal users as deactivated in the user popovers: all bot users were
treated that way as well.

We'll want to do #7153 as a follow-up to get things fully working how
we want them.
2017-10-24 15:59:51 -07:00
Vishnu Ks 534141ed07 popover: Pass value of is_active to userlist popover.
This was forgotten in 4f088292ee,
breaking the right sidebar user popover.
2017-10-19 10:58:35 -07:00
Tim Abbott 2bc14d256f lint: Ban two spaces after comma in JS code.
We exclude the frontend tests, mostly because the lint rule isn't that
precise, and the test code has some sample user input that's a bit
funny.
2017-10-18 10:22:18 -07:00
Brock Whittaker 4f088292ee popovers: Hide user email and PM feature for deactivated users.
This hides the emails of deactivated users from the popovers along
with the link to send a PM to them.
2017-10-18 00:06:12 -07:00
Steve Howell dea1888022 Fix muting_ui.persist_and_rerender() bug.
We were calling muting_ui.persist_and_rerender(), but
that function no longer exists.  Now we use the simpler
API.
2017-10-17 17:41:21 -07:00
Steve Howell 8593c25f45 refactor: Simplify user_last_seen_time_status().
We are about to stop supporting the presence status of "unknown."
Part of this fix is to stop checking for that status.

The implication of this change is that when we go
to display the time a user was last online, we now
mostly just look to see if presence.last_active_date
is undefined.  We were wary of that approach before, but it
is probably the most sane approach here.

I updated the comment abover this section to reflect
our philosophy going forward.

BTW the timestamp is kind of buried in the UI for now, as you have to
open the popover and then hover over the circular presence
indicator.
2017-10-12 10:42:06 -07:00
Tim Abbott 327db90a3d Fix fetching of medium-size user avatars.
In the refactoring in 31d3b1ecc0 that
fixed live-updating of the medium-size avatar data, we started just
fetching the normal-size avatar, not the medium-size avatar.  We fix
this by changing this code path to pass in the user object and
construct the URL using that.

While we're at it, we switch to using the user ID, not the email, to
construct these avatar URLs.
2017-09-30 08:57:25 -07:00
Tim Abbott 376cab8ba4 popover: Rename show_message_info_popover.
It's really a user info popover.
2017-09-30 08:57:25 -07:00
Tim Abbott ddb1a03a5b popovers: Pass user into show_message_info_popover.
This makes the interface cleaner, which is helpful preparation for
being able to make clicking on mentions show the user's profile as
well.
2017-09-30 08:57:24 -07:00
Tim Abbott e0087cab69 popovers: Remove unnecessary call to timerender.
This calls hasn't been actually used since 2013.
2017-09-30 08:57:24 -07:00
Tim Abbott 3c7e470cfb popovers: Refactor showmessage_info_popover.
We now rely on getting the sender object from people.js, rather than
hackishly trying to handle the case that it doesn't exist.
2017-09-30 08:57:24 -07:00
Tim Abbott 16b47a86e4 popovers: Refactor show_sender_info variable names.
We're going to use the original variable names for other things soon.
2017-09-30 08:57:24 -07:00
Tim Abbott 18fd5e1a3b user popover: Remove unnecessary historical argument.
We stopped using this some time ago.
2017-09-30 08:57:24 -07:00
Tim Abbott d56aa83e31 popovers: Clean up name fetching for presence user info.
Previously, we relied on fetching the name of the user from the data
attributes on the individual elements, when we can get a more reliably
up-to-date value from the people.js data structure we're fetching
anyway.
2017-09-30 08:57:24 -07:00
Rhea Parekh 31d3b1ecc0 user settings: Update user popover on updating avatar.
Previously, we were incorrectly not using the latest data available on
the frontend to compute the URL for the larger avatar image.

Fixes: #6702.
2017-09-28 10:03:45 -07:00
Tim Abbott e68de7ac8d user popover: Don't throw an exception for deactivated target users.
Ideally, we'd fix this at the root cause, via #4322, but this will at
least suppress the exception for now.
2017-08-27 16:41:28 -07:00
Harshit Bansal cd2f41dbb1 popovers: Extend the `compute_placement()` function.
This commit extends the `compute_placement()` function in
`popovers.js` to take into account height/width of popover as well as
positioning preference. If vertical positioning is desired and the
popover fits in either 'top/bottom' positions then we don't check for
`left/right' positions. Earlier the behavior was to prefer
'left/right'positions over 'top/bottom' positions, which resulted in
the emoji picker popping incorrectly to the left.
2017-08-27 12:27:53 -07:00
Brock Whittaker 2bb5042315 Use native `.click` event over jQuery `.click` event.
For whatever reason, the clipboard doesn’t want to work if you use a
jQuery click trigger. Perhaps because the jQuery event trigger doesn’t
create a native event at all. By doing this however, it doesn’t appear
to affect any other code but does allow for the clipboard to work again.

Fixes: #6002.
2017-08-23 12:26:50 -07:00
Brock Whittaker 4617a650c0 Compact two `row.find(".alter-copied")` statements into one. 2017-08-23 12:26:50 -07:00
Tim Abbott 3a2a396303 zephyr: Fix tracebacks opening user info popovers. 2017-08-16 16:07:27 -07:00
Jack Zhang bbe8f73c23 popovers: Reimplement compute_placement.
compute_placement utilizes the dimensions of the viewport, viewport location of
an element, and dimensions of an element to determine if a popover will fit
horizontally and/or veritically given its orientation. The default placement
is now viewport_center, which displays the popover, without an arrow, in the
fixed center of the viewport.

This should be particularly useful for hotspots on mobile or large popovers
that contain a lot of content. The property hotspot.location.popover can be
optionally set to fix the orientation of a popover (most likely to
VIEWPORT_CENTER).
2017-08-05 18:32:37 -07:00
Jack Zhang d951375d6c Move compute_placement utility from emoji_picker to popovers. 2017-07-28 16:34:15 -07:00
Brock Whittaker aa645eb72b eslint: Remove `no-new` rule.
This removes the `no-new` rule which is relatively detrimental to
code cleanliness in our codebase because third-party libraries may
utilize data structures that don't fly well with our linting rules.

This also fixes abstractions that were created due to the limitations
and impositions of this lint rule.
2017-07-27 11:31:33 -07:00
Vishnu Ks 2396619ec6 popover: User .on('load') instead of .load().
.load is deprecated since jQuery 1.8. We are currently on
jQuery 3.2.1.
2017-07-26 11:32:33 -07:00
Durga Akhil Mundroy 146dfa6f0b org-permissions: Add allow_edit_history organiztion setting.
This new setting controls whether or not users are allowed to see the
edit history in a Zulip organization.  It controls access through 2
key mechanisms:

* For long-ago edited messages, get_messages removes the edit history
  content from messages it sends to clients.

* For newly edited messages, clients are responsible for checking the
  setting and not saving the edit history data.  Since the webapp was
  the only client displaying it before this change, this just required
  some changes in message_events.js.

Significantly modified by tabbott to fix some logic bugs and add a
test.
2017-07-16 10:10:06 -07:00
Cynthia Lin a9afe43735 hotkeys: Add `u` hotkey for opening message sender profile.
Fixes #4873
2017-06-21 10:38:05 -04:00
Cory Lynch 387f37c15e popovers.js: Fix keyboard shortcuts with copying link.
Fixes #5374.
2017-06-20 06:28:25 -04:00
Cory Lynch 801e4f6f6e popovers.js: Fix chevron that persists when exiting.
Fixes #4329.
2017-06-20 06:28:25 -04:00
Vishnu Ks 9b16835c99 user_popover: Handle the case when user presence is unknown.
For bots and users who have not logged in for a long time the presence information is not known. For the these users make the presence indicator hidden.
2017-06-19 17:25:06 -04:00
hackerkid 648b2823bb Show user presence and last seen status in user popover. 2017-06-11 07:09:21 -05:00
K.Kanakhin 2434f2d96c messages: Add support for admins deleting messages.
This makes it possible for Zulip administrators to delete messages.
This is primarily intended for use in deleting early test messages,
but it can solve other problems as well.

Later we'll want to play with the permissions model for this, but for
now, the goal is just to integrate the feature.

Note that it saves the deleted messages for some time using the same
approach as Zulip's message retention policy feature.

Fixes #135.
2017-05-29 21:59:38 -07:00
Steve Howell a0fab6842c Improve error handling in get_action_menu_menu_items(). 2017-05-12 12:25:03 -07:00
Tim Abbott 40e43d8cba narrow: Remove unused by_conversation_and_time and by_id helpers.
Now that we just copy links to the clipboard, neither of these are
used.  (Actually, the narrow.by_id helper has been dead code for
years).
2017-05-09 09:59:37 -07:00
Mahim Goyal a2adcfd7fc popovers: Add direct copy to clipboard link feature.
Change the onClick function of copy link of
conversation to actually copy the link to clipboard.

Fixes: #4621.
2017-05-09 09:59:23 -07:00
Jack Zhang df817f12f4 emoji: Rename reaction-popover to emoji-popover.
The name emoji-popover should now be more appropiate, as there's no more
need to distinguish between reacting to messages and composing messages.
2017-04-30 15:15:33 -07:00
Jack Zhang a9505654da emoji: Replace the old compose emoji picker with the reactions picker.
This removes the old compose emoji picker in its entirety, changing
the few callbacks needed to launch the reactions-style emoji picker
instead and hook it up properly.

Callbacks for reactions and composing messages are distinguished by
selecting for, respectively, the .reaction and .composition classes.

Fixes #4122.
2017-04-30 15:14:42 -07:00
Jack Zhang f8b3ce7d15 emoji: Move all emoji picker logic/events into emoji_picker module.
Added emoji_picker.js to static asset pipeline.
2017-04-30 14:13:36 -07:00
Steve Howell 8eb86335b9 Extract narrow_state.js.
Despite the length of this commit, it is a very straightforward
moving of code from narrow.js -> narrow_state.js, and then
everything else is just s/narrow.foo()/narrow_state.foo()/
(with a few tiny cleanups to remove some code duplication
in certain callers).

The only new functions are simple setter/getters that
encapsulate the current_filter variable:

    narrow_state.reset_current_filter()
    narrow_state.set_current_filter()
    narrow_state.get_current_filter()

We removed narrow.predicate() as part of this, since it was dead
code.

Also, we removed the shim for narrow_state.set_compose_defaults(),
and since that was the last shim, we removed shim.js from the app.
2017-04-25 09:57:32 -07:00
Joshua Pan e075c84ca5 reaction.js: Maintain reaction_show_list.
This updates reaction_show_list whenever the popover
gets opened and whenever the search filter for reactions
gets used.
2017-04-19 06:17:15 +00:00
Tim Abbott 540bfce83f reactions: Use perfectScrollbar for emoji reactions scrollbar.
This fixed the fact that the scrollbar for this popover was super ugly
on Linux, while also ensuring that we have a consistent 6 emoji per
row in the popover (an important detail for the arrow hotkeys).
2017-04-18 22:58:11 -07:00
Tejas Kasetty d227a8e35c compose: Re-render emoji picker when realm_emoji is added/deleted.
* reset the emoji popover in case of an event
regarding update of realm_emoji.
* test-node-with-js: Add dependency - popovers module;
In dispath.js to support popovers object.
2017-04-18 12:18:52 -07:00
Tejas Kasetty b7aa81f122 compose: Render the emoji picker only once.
* Whenever the emoji picker is opened a call is made to render
  the emoji's. This rendering happend everytime the emoji picker
  was opened. Thus, resulting in duplicates of emoji's getting
  appended in the emoji picker over multiple open and close.

* This commit, is a fix to render the emoji's only once when the
  emoji picker is opened for the first time. Further calls just
  toggles the emoji picker showing the already rendered emoji's.
  This enhances the performance of Emoji picker considerably
  because there is no overhead of making a request to get the emoji's
  from the server, each time the emoji picker is opened.

* Other changes -- on closing the emoji picker, the compose box
  remains in focus.

Fixes: #4300.
See Also: #3952.
2017-04-18 12:18:52 -07:00
Steve Howell 5ba79f9c3a refactor: Move respond/reply methods to compose_actions.js.
This moves respond_to_mention() and reply_with_mention() to
compose_actions.js.  These methods are basically thin layers
on top of compose_actions.start().
2017-04-14 13:09:19 -07:00
hackerkid cd5334c827 Show local time of user in user_popover. 2017-04-14 10:38:29 -07:00
Joshua Pan 32837804d8 Extract stream_popover.topic_ops to muting_ui.js. 2017-03-25 09:42:49 -07:00
hackerkid 97bd9d5186 Fix positioning of message-info-popover. 2017-03-22 16:04:38 -07:00
hackerkid ed72ee476f Make user_popover use user_info_popover template. 2017-03-22 16:04:38 -07:00
hackerkid b2fc8d6fa2 Rename message_info_popover* templates to user_info_popover*. 2017-03-22 16:04:38 -07:00
hackerkid 23a5f56023 Add sender avatar in message popover. 2017-03-22 16:04:38 -07:00
hackerkid 32bc5893d0 Remove arrow from message info popover by providing template.
Provide custom template (user_info_popover.handlebars) to message info popover.
2017-03-22 16:04:38 -07:00
Tim Abbott ee2e6a31b1 reactions: Close popover on escape even with input focused.
This makes it much more convenient to close the emoji reactions
popover after opening it with the hotkeys.

It'd be great if we had a test suite for escape so that we could add
tests for this.

Fixes part of #4197.
2017-03-20 23:51:45 -07:00
Steve Howell 7bc2df6a91 Put popular emojis in top row of reactions. 2017-03-20 20:23:32 -07:00
Steve Howell 2296bf5859 Clean up rendering code for reaction popovers.
Instead of passing in a hash to template whose keys are a
mixture of records and strings, we now pass in an
array of records.  This also removes a spurious if condition
in the template that was a result of the janky data structure.
2017-03-20 20:23:32 -07:00
tejaskasetty 02bd5bedce Fix duplicate emoji entries in compose emoji picker.
We were incorrectly appending all the emoji into the emoji picker
every time it was opened, rather than just once.

Note by tabbott: Arguably this isn't the right fix, in that it might
be better to just render the emoji picker once at the beginning.  But
this definitely fixes the bug.

Fixes #3952.
2017-03-20 10:46:20 -07:00
Steve Howell faa9446e64 Add compose_actions.start() shim. 2017-03-18 15:52:50 -07:00
aakash-cr7 f44caaf36e Focus on the close button when viewing the edit message history.
Fixes #4035.
2017-03-15 11:43:50 -07:00
Abhishek Bhattacharya 8a408a6cbc popovers: Fix actions popover menu positioning.
The main issue is that it wasn't doing the correct comparison; the old
logic that subtracted the viewport.scrollTop() was incorrect for how
our popovers seem to work.

Partially fixes #3741.
2017-03-14 15:37:37 -07:00
Tim Abbott 5e39ccd642 js: Rename viewport.js to message_viewport.js.
This fixes the mobile web experience for Chrome on iOS.

Apparently, Chrome-on-iOS silently has a `viewport` module that
overrides and user-defined module by that name, causing all of our
code that accesses the viewport module to not work on that platform.
We fix this by renaming it.
2017-03-10 14:59:59 -08:00
Tim Abbott ce826e82c5 reactions: Fix click handler for reactions button.
This was broken when we fixed the click target for the other reactions
button place.
2017-03-09 12:18:17 -08:00
Tim Abbott 70aa443c25 stream_popover: Fix references to topic_ops.
This apparently got lost in the refactoring that extracted
stream_popover.js.
2017-03-08 23:30:44 -08:00
Umair Khan 22c1c13f38 capitalization: Fix View Source / Edit Topic. 2017-03-08 12:33:37 -08:00
Umair Khan 935cacfc86 capitalization: Fix View Source. 2017-03-08 12:33:37 -08:00
Tim Abbott ec16a3298d reactions: Expand click area for opening popover. 2017-03-06 22:26:12 -08:00
Brock Whittaker ec9bad4096 Hide the emoji icon in message when emoji is selected.
This hides the emoji icon from the shown state when users select an
emoji from the popover.
2017-03-06 22:24:21 -08:00
Steve Howell 8e2e406404 refactor: Extract stream_popover.js.
This module handles the popovers in the stream list--one for
stream actions and another for topic-specific actions.

The extraction was mostly straightforward, but I did move some
of the code related to the color picker to be more consistent
with how I organized the other click handlers.
2017-03-05 15:44:43 -08:00
Steve Howell ba49962f9a refactor: Extract stream_popover_sub().
Part of this change moved a click handler from subs.js to
popover.js.
2017-03-05 15:44:43 -08:00
Steve Howell 24631a7405 refactor: Pass in a sub to subs.toggle_pin_to_top_stream(). 2017-03-05 11:55:09 -08:00
Steve Howell 32c2dc63f1 refactor: Pass in a sub to subs.toggle_home(). 2017-03-05 11:55:09 -08:00
Kartik Maji 1a697b6e02 Add frontend to show message edit history.
Fixes #268.

Modified significantly by tabbott to:
* improve code cleanliness / repetition
* add missing translation tags
* move code into message_edit.js
* correspond with the new backend.
* not display the option for messages only topic-edited
2017-02-19 17:41:06 -08:00
aakash-cr7 b72262e8ec Add UI for seeing all muted topics in settings page.
Fixes #2322.
2017-02-17 00:10:18 -08:00
Rafid Aslam 241794c586 Change "Reply" to "Quote and reply" in message popover
Change "Reply" in message popover to "Quote and reply"
which is reply and quotes the selected message.

Fixes #3302.
2017-02-11 14:51:55 -08:00
Elliott Jin ba449d7c23 unread: Refactor to move server calls into UI layer. 2017-02-11 08:36:39 -08:00
Elliott Jin d233f617dd muting: Refactor to move side effects into UI layer. 2017-02-11 08:36:39 -08:00
Steve Howell 37509da20d Display sender's most current email in message popover menu. 2017-02-10 21:57:50 -08:00
Steve Howell 64125a76e2 Use data-user-id for message popover menu. 2017-02-07 17:37:05 -08:00
Steve Howell ae850fdeb4 Use message.sender_id to create URLs in message popover. 2017-02-07 17:37:05 -08:00
Harshit Bansal 8350866406 popovers: Rename `data-msgid` to `data-message-id`.
Rename the `data-msgid` to `data-message-id` to match the style of our
other data objects.
2017-02-06 22:30:50 -08:00
Brock Whittaker 1dd8fb7966 Display realm emojis in the emoji picker container.
This displays the realm emojis in the emoji picker container in their
own divs styled similarly to the existing .emoji divs.
2017-01-27 15:39:22 -08:00
Brock Whittaker 1a63f15382 Only run popovers.hide_all() once on scroll start.
This function throttles the function and only allows the on scroll
event to fire the popovers.hide_all() function once on scroll start
(determined as > 250ms after the last scroll event fire on .app.

This should resolve some performance issues surrounding constantly
firing queries and potentially changing the document tree.
2017-01-26 13:59:14 -08:00
Anirudh Jain 705ae523db emoji picker: Add emoji next at cursor instead of end of message.
Simplified by tabbott.

Fixes: #3155
2017-01-12 15:31:18 -08:00