Commit Graph

284 Commits

Author SHA1 Message Date
Anders Kaseorg db0b33842c templates: Replace templates.render with require calls.
This removes an unnecessary layer of indirection and allows webpack to
catch filename mistakes.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-07-12 21:11:14 -07:00
Yashashvi Dave d7ee2aced1 models: Add `external_account` in custom profile field types.
Add new custom profile field type, External account.
External account field links user's social media
profile with account. e.g. GitHub, Twitter, etc.

Fixes part of #12302
2019-07-09 17:21:54 -07:00
Tim Abbott f5b1081c93 popovers: Fix name for stream_popover.hide_streamlist_sidebar().
The previous name was super confusing; this function is analogous to
hide_userlist_sidebar() and should be named appropriately for that role.
2019-07-09 16:57:10 -07:00
Tim Abbott 01bc4674e3 popovers: Fix closing of the left sidebar with "more topics".
This was another case of incorrect logic due to treating the sidebars
as popovers for the purposes of .hide_all().

Fixes #12274.
2019-07-09 16:54:39 -07:00
Anders Kaseorg 23cd064c86 webpack: Elide node_modules when importing JS modules.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-06-26 16:49:32 -07:00
Puneeth Chaganti a14d2a5f45 user_info: Extract function get_custom_profile_field_data. 2019-06-26 16:15:08 -07:00
Thomas Ip 0253ef12c6 popovers: Encode brackets in URI to avoid conflict with markdown links.
This fixes an issue where one could end up with a `(` in the markdown
syntax for a link after copy-pasting this, which doesn't work in
markdown.

Fixes #12579.
2019-06-16 15:18:33 -07:00
Vaibhav f366c50913 user_info: Add bot owner to the user info popover.
This includes all the changes on the frontend side to include the
bot owner in the popover. Includes the bot owner name as a link which
opens the full profile of the bot owner.

For bots without any owner (such as Notification Bot or Welcome Bot)
in place of bot owner name, 'System Bot' appears for cross realm bots
and 'Bot' for in-realm bots.

Fixes #10844.
2019-05-30 15:45:56 -07:00
Pragati Agrawal cdc50090b6 popovers: Hide email under hidden email-address-visibility cases.
In email hidden case (that is when `email_address_visibilty` is set to
everyone), for "non admins", this commit hides emails from:
- user popover
- custom profile popover
In email hidden case, for admins, email is shown in both user popovers and
custom profile popovers.
2019-05-20 15:56:21 -07:00
Anders Kaseorg 01613e71fb ui: Replace set_up_scrollbar with data-simplebar attribute.
With perfectScrollbar, we needed to call a function from JavaScript to
enable a scrollbar on a new element, but simplebar has a much simpler
default API one can do by using data-simplebar attributes in the HTML.

So we can delete all the scrollbar creation/deletion code.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-05-19 18:06:38 -07:00
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