We call build_message_send_dict from check_message instead of
do_send_messages.
This is a prep commit for adding a new setting for handling
wildcard mentions in large streams.
We extract the loop for building message dict in
do_send_messages in a separate function named
build_message_send_dict.
This is a prep commit for moving the code for building
of message dict in check_message.
There is a bug where we send event for even
those messages which do not have embedded links
as we are using single set 'links_for_embed' to
check whether we have to send event for
embedded links or not.
This commit fixes the bug by adding 'links_for_embed'
in message dict itself and send the event only
if that message has embedded links.
There is a bug in invite flow, where the button text resets
to incorrect text after the invitation process is completed.
This bug is because we are using $().button("reset") to
reset the button text, but the data-reset-text attribute of
button is not changed when toggling between multi-use link
invite and email invites.
This bug can be fixed by setting data-reset-text attribute
in a way similar to the way we set data-loading-text attribute
on toggling between multiuse and normal invites.
But according to the bootstrap docs,"reset" method was removed
in v4.0 (https://getbootstrap.com/docs/4.0/migration/#buttons).
Though we are not using Bootstrap v4.0 as of now, but it is
good to remove such methods as it will help in future when we
would upgrade to later bootstrap versions.
So instead of fixing this by above mentioned patch, we are
fixing this by removing "reset" method and instead using simple
jquery to reset the text and enable the button after the invite
process is completed.
As explained in the previous commit, yamole preprocessed allOf with an
algorithm that is not standards compliant. We replicate that
algorithm, but importantly, we only use it for our own code and not
for building the openapi_core RequestValidator.
This improves the time taken by OpenAPISpec().check_reload() from
1.69s to 0.53s, nearly all of which is inside
openapi_core.create_spec.
Closes#10484. Significantly improves #16068.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
yamole preprocesses our schema by naïvely merging all the objects in
an allOf array together, but this fails to capture the meaning of
allOf according to the OpenAPI specification. allOf is supposed to be
a strict logical intersection of each subschema interpreted
independently. It does not combine their properties maps before
interpreting additionalProperties. So according to the old definition
of JsonSuccess, every response is invalid:
allOf:
- additionalProperties: false
properties:
result:
type: string
- required:
- result
- msg
properties:
msg:
type: string
because the first subschema disallowed msg and the second subschema
required msg.
To fix this, whenever we use allOf for schema “inheritence”, the base
schema must not specify additionalProperties, and the child schema
must explicitly list all properties recursively inherited from the
base schema in any subschema that uses additionalProperties.
Fixes#16109.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit introduces the UI model for the 'view in playground' feature.
The option is a 1-click UX if only one playground link has been configured
for the programming language in the code block. If multiple such playgounds
have been configured, we display a popover with the different playground
options.
The actual code extraction logic occurs here and we set the target href
combining the url_prefix and the extracted code for both these scenarios.
Fixes: #11618
In case of previews, we tweak the positioning a bit more
to the right.
The previous styling also had the focus-within action
which isn't needed here as hovering over the codeblock
is enough to display both the icons.
The Pygments language used is extracted from the data-attribute attached
to the outer `div` element. This option is displayed if the playground
mapping for that language can be found.
The UI model which does the actual code extraction and displaying the
popover is done in a future commit.
This is being hardcoded just for the prototype, post which we should add
support for realm admins to configure their own choices. The structure
here is similar to what we eventually want in the configuration API.
In c563cdba61 we imported the generated
pygments data from outside `/shared` folder. This had a couple of
problems:
* Using `require` was the wrong way to do the import in ES6 modules.
* Since we get the data from outside `/shared`, clients like
zulip-mobile would not receive it - this case had to be handeled.
Here, we fix the above problems by receiving the data when initializing
through fenced_code.initialize, and when the pygments data structure is
empty (for zulip-mobile) we fallback to the old header structure without
the data-code-language tag.
Also, this commit does a small refactor to improve the way we fetch
canonicalized_alias from pygments_data.
Tests amended.
In this commit I attempt to make the docs for
writing `test_events` a little more oriented
toward telling the developer that they need to
write a test in `test_events`; in other words,
the tone is a bit more of how-to-do-it vs.
explaining the innards.
So I now start with a concrete example.
Then much of the copy related to `verify_action`
is the same as before this commit, but I rework
it a bit to be a bit more step-by-step, and I refer
back to the concrete example.
Finally, I explain the schema checking step, which
is all new copy, although for that, I mostly
instruct the developer to read event_schema.py
itself.
This commit removes the unnecessary comment which was added in
9454683108, when we were using message.get() for keys which
were also passed as args in do_send_messages, but there are no
such keys in the current code.
This commit removes the unnecessary line of code to get
rendered_content from message dict sent by check_message
when it actually does not inlcude 'rendered_content' key.
This line was added in 9454683108, but now we do not send
rendered_content in the message dict as we render the message
in do_send_messages itself.
This adds back Chrome 72, Chrome 70, Firefox 68, Opera 68, Safari
12.1, and Samsung 9.2. Firefox 68 is still Debian stable’s default
browser. This probably has no practical effects with IE 11 still
listed.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
Chrome breakpoints and stack traces work fine with the eval-* options;
all that breaks is that stacktrace-gps can’t extract the source
snippets from the source map with eval-*.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
As of commit 1cdab5ae61 we use the
octopus image through Webpack, so the prefetch needs to be from the
same Webpack URL for it to do any good. We don’t want to waste more
bandwidth on this [AWESOME CRITICAL FEATURE] than we have to.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
The failures saying incorrect password were caused due to
change in focus. Some actual code of ours calls focus on
the modal when opened but puppeteer was starting to type
before this occurs due to which the test was only able
to enter a part of string.
This was happening with change full name too but less
frequently as it's a relatively shorter string.
As a fix, we wait till the focus is on the modal and then
start typing.
The Formatting button that opens our Markdown help popover previously
had an "A" as its icon (the Font Awesome icon for font). This commit
changes the link to spell out "Help" to make it more discoverable.
Now that they are tab accessible, we should order them by importance.
Previously the order was:
1. Add emoji
2. Formatting
3. Attach files
4. Add video call
5. Preview
6. Drafts
This commit changes the order to:
1. Attach files
2. Preview
3. Add video call
4. Add emoji
5. Drafts
6. Formatting
The "Add emoji" button is moved back because emojis can be more
conveniently entered using the typeahead triggered with ":" or the
emoticon conversions.
A later commit alters `authenticate` of EmailAuthBackend to
add a store `needs_to_change_password` variable to session
which is useful to insist users on changing their weak password.
The tests start failing with that change because client.login()
runs `authenticate` without a `request` object. So, this commit
sends a request object with `request.session=self.client.session`
to self.client.login() in tests wherever needed.