This commit adds an 'transaction.atomic' decorator to the
'add_subscriptions_backend' view thus making the db operations
within the view atomic and helps to avoid race between events sent.
In tests where we make POST requests to this view, we have
wrapped the API calls with a transaction.atomic() context
manager. It helps us with NOT rolling back the entire test
transaction due to error responses.
In 'test_subs' we were making POST request to add
subscrption using 'self.api_post'.
This commit updates the code to use the test helper
function 'common_subscribe_to_streams' instead.
This prep commit will also help us to avoid adding
'transaction.atomic' context manager to these API calls
individually in the case of error response in the next commit.
In 30d15d58fb, we made the
change to redirect to the newly created stream interleaved
view instead of "stream events" topic of that stream.
The comment related to it was not updated accordingly.
This commit updates the comment.
This commit separates the checking of whether the cursor is
at markdown link marker into its own function, which will be
used in #29136 to decide whether to format pasted urls or not.
This commit changes the width of tabs in stream and
group settings to be set as per the text inside it
with the previous width being set as minimum width
to avoid tabs being too small.
Fixes#30672.
This commit changes the width of tabs in bots panel
to be set as per the text inside it with the previous
width being set as minimum width to avoid tabs being
too small.
This commit updates the dropdown menu width to be set such that
the menu is wide enough to have options in a single line.
This change is only for group-based setting dropdowns in
organization, stream and group settigs.
Fixes#30673.
We now do not restrict the width of dropdown widget buttons
so that the width can be increased when the font size increases
and also if the option selected is long due to langauge.
We have similar behavior for the select element except that
the width of select element is set according to the longest
option while for dropdown widgets the button width is set
as per the current selected value.
This change is only for group-based setting dropdowns in
organization, stream and group settigs.
This commit hides invalid terms, since we don't want to be suggesting
invalid options to the user. We had already hidden invalid has and is
in the past, but this will also hide things like invalid channels or
user suggestions.
In the future it would be helpful to do two followups:
(1) Update the text for invalid is and has in search_description.hbs
since it looks a bit strange (though not introduced here). This
only shows up if you typed an invalid is/has and then start
typing a term beside it, so it's not very likely to happen.
(2) Don't auto-highlight the first typeahead result when there are
no valid suggestions for the last text term. This seems hard
to implement, so I'm leaving that out for now.
This supports adding users to DM pills by simply typing
a user's name in the text input directly after a complete
dm pill. It only works for DM pills at the end of search
input.
Clicking the X button removes a user from its user pill
container, and if that user was the last user left in the
container, then the whole container is also removed.
When the user has selected e.g. "dm:" from the typeahead, we want
to keep this as text, and let them type the search term in full
before it's pill-ified.
Most search suggestions are determined using the "last" search
input term, and the "rest" of the terms. Previously the "last"
term was whatever was at the end of the search query, and we
didn't differentiate between a completed term or an in-progress
term.
Now that there are search pills, we can differentiate between
completed and in-progress search terms, which clarifies some of
the search suggestion logic, and which we'll need to support
group pills and adding users to existing group pills.
Previously, search pill overflow was broken (sticking out of the
search box to the right) and now the search bar extends vertically to
allow pills to wrap when there are too many pills for one line.
There's still a bug when opening the search bar where the input
isn't selected. But I'm not worrying too much about that because
that text is about to be replaced with pills.
This is needed for us to support "search for..."
(i.e. operand = "search") terms being displayed
as text instead of search pills, once we convert
search to search pills.
This is useful for complicated typeaheads that have custom logic
for setting their element's contents after an item is selected.
Specifically, we're adding this to support a feature of search
pills, where selecting "Direct messages with" will add the text
"dm:" in the search bar and then trigger a lookup, and in
contrast selecting "Search for foo" will add "foo" in the search
bar and *not* trigger a lookup. In both cases, we won't want
to set the input element's text to the empty string, and we'll
want custom control over which situations to hide after select.
These two options make that possible.
See #26803 for more context on when this was introduced for
search pills, and this conversation on CZO for the conversation
that led to this decision:
https://chat.zulip.org/#narrow/stream/6-frontend/topic/search.20pills/near/1726228
- Make more succinct; don't over-describe UI the user can't see yet.
- Remove links (there are help links in view descriptions now).
- Explain where topics come from.
At widths under 400px, buttons in the popover were running off the edge,
which is fixed by removing the dividers between them.
For the new info density, buttons in the original row, even despite
removing the dividers, were still not fitting, so their width has been
slightly reduced.