internlm/SWE-Fixer-Train-110K huggingface dataset:
Repository: zulip/zulip

Issue:
Setting status text revokes "away"
Setting a status text while being "unavailable" revokes the away status. 
https://chat.zulip.org/#narrow/stream/9-issues/topic/Setting.20status.20text.20revokes.20away/near/1100185


Discussion:
@abhijeetbodas2001 You might still want to look at this, as I believe the solution from @ligmitz might not get to the heart of the bug here.

Resolving patch:
diff --git a/zerver/lib/actions.py b/zerver/lib/actions.py
--- a/zerver/lib/actions.py
+++ b/zerver/lib/actions.py
@@ -4183,7 +4183,9 @@ def do_update_user_status(user_profile: UserProfile,
                           away: Optional[bool],
                           status_text: Optional[str],
                           client_id: int) -> None:
-    if away:
+    if away is None:
+        status = None
+    elif away:
         status = UserStatus.AWAY
     else:
         status = UserStatus.NORMAL


Test patch:
diff --git a/zerver/tests/test_user_status.py b/zerver/tests/test_user_status.py
--- a/zerver/tests/test_user_status.py
+++ b/zerver/tests/test_user_status.py
@@ -230,3 +230,40 @@ def test_endpoints(self) -> None:
             get_user_info_dict(realm_id=realm_id),
             {},
         )
+
+        # Turn on "away" status again.
+        payload = dict(away=orjson.dumps(True).decode())
+
+        event_info = EventInfo()
+        with capture_event(event_info):
+            result = self.client_post('/json/users/me/status', payload)
+        self.assert_json_success(result)
+
+        self.assertEqual(
+            event_info.payload,
+            dict(type='user_status', user_id=hamlet.id, away=True),
+        )
+
+        away_user_ids = get_away_user_ids(realm_id=realm_id)
+        self.assertEqual(away_user_ids, {hamlet.id})
+
+        # And set status text while away.
+        payload = dict(status_text='   at the beach  ')
+
+        event_info = EventInfo()
+        with capture_event(event_info):
+            result = self.client_post('/json/users/me/status', payload)
+        self.assert_json_success(result)
+
+        self.assertEqual(
+            event_info.payload,
+            dict(type='user_status', user_id=hamlet.id, status_text='at the beach'),
+        )
+
+        self.assertEqual(
+            user_info(hamlet),
+            dict(status_text='at the beach', away=True),
+        )
+
+        away_user_ids = get_away_user_ids(realm_id=realm_id)
+        self.assertEqual(away_user_ids, {hamlet.id})
Repository: zulip/zulip

Issue:
Incorrect rendering of YouTube Titles
I tried sending some youtube videos with setting: Show previews of linked website - checked, but the **extracted** YouTube title is not as expected for most of the videos, it is `YouTube - YouTube` while it should be `YouTube - [Title of the YouTube video]`. Also **extracted** description is `Share your videos with friends, family and the world` for every video sent.
https://chat.zulip.org/#narrow/stream/3-backend/topic/Markdown.20Youtube.20Title


Discussion:
Hello @zulip/server-markdown members, this issue was labeled with the "area: markdown" label, so you may want to check it out!

<!-- areaLabelAddition -->
Hi! @akshatdalton can I try this as my first issue ?

@imajit 
Yeah you can try to give this a shot but I am still not sure about the behaviour of the headers.
More context in [CZO](https://chat.zulip.org/#narrow/stream/3-backend/topic/Markdown.20Youtube.20Title).
Hey @imajit, are you still working on this issue? If not, I would like to work on this 

Resolving patch:
diff --git a/zerver/lib/url_preview/preview.py b/zerver/lib/url_preview/preview.py
--- a/zerver/lib/url_preview/preview.py
+++ b/zerver/lib/url_preview/preview.py
@@ -27,9 +27,8 @@
 
 # Use Chrome User-Agent, since some sites refuse to work on old browsers
 ZULIP_URL_PREVIEW_USER_AGENT = (
-    'Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ZulipURLPreview/{version}; '
-    '+{external_host}) Chrome/81.0.4044.113 Safari/537.36'
-).format(version=ZULIP_VERSION, external_host=settings.EXTERNAL_HOST)
+    'Mozilla/5.0 (compatible; ZulipURLPreview/{version}; +{external_host})'
+).format(version=ZULIP_VERSION, external_host=settings.ROOT_DOMAIN_URI)
 
 # FIXME: This header and timeout are not used by pyoembed, when trying to autodiscover!
 HEADERS = {'User-Agent': ZULIP_URL_PREVIEW_USER_AGENT}


Test patch:
Repository: zulip/zulip

Issue:
openapi: Fix display of boolean types in examples.
Fixed boolean statements being displayed in camel case in API
documentations to match JSON format.

<!-- What's this PR for?  (Just a link to an issue is fine.) -->
Fixes #18010

**Testing plan:** <!-- How have you tested? -->
Manually tested in browser

**GIFs or screenshots:** <!-- If a UI change.  See:
  https://zulip.readthedocs.io/en/latest/tutorials/screenshot-and-gif-software.html
  -->
![boolean](https://user-images.githubusercontent.com/42570356/113869287-2a14de80-97ce-11eb-86e3-5cec5852532d.JPG)


<!-- Also be sure to make clear, coherent commits:
  https://zulip.readthedocs.io/en/latest/contributing/version-control.html
  -->



Discussion:

Resolving patch:
diff --git a/zerver/lib/markdown/api_arguments_table_generator.py b/zerver/lib/markdown/api_arguments_table_generator.py
--- a/zerver/lib/markdown/api_arguments_table_generator.py
+++ b/zerver/lib/markdown/api_arguments_table_generator.py
@@ -124,7 +124,14 @@ def render_table(self, arguments: Sequence[Mapping[str, Any]]) -> List[str]:
             # (path, querystring, form data...).  We should document this detail.
             example = ""
             if "example" in argument:
-                example = argument["example"]
+                # We use this style without explicit JSON encoding for
+                # integers, strings, and booleans.
+                # * For booleans, JSON encoding correctly corrects for Python's
+                #   str(True)="True" not matching the encoding of "true".
+                # * For strings, doing so nicely results in strings being quoted
+                #   in the documentation, improving readability.
+                # * For integers, it is a noop, since json.dumps(3) == str(3) == "3".
+                example = json.dumps(argument["example"])
             else:
                 example = json.dumps(argument["content"]["application/json"]["example"])
 
diff --git a/zerver/openapi/markdown_extension.py b/zerver/openapi/markdown_extension.py
--- a/zerver/openapi/markdown_extension.py
+++ b/zerver/openapi/markdown_extension.py
@@ -208,6 +208,7 @@ def get_openapi_param_example_value_as_string(
         # union type.  But for this logic's purpose, it's good enough
         # to just check the first parameter.
         param_type = param["schema"]["oneOf"][0]["type"]
+
     if param_type in ["object", "array"]:
         example_value = param.get("example", None)
         if not example_value:
@@ -225,7 +226,9 @@ def get_openapi_param_example_value_as_string(
     else:
         example_value = param.get("example", DEFAULT_EXAMPLE[param_type])
         if isinstance(example_value, bool):
-            example_value = str(example_value).lower()
+            # Booleans are effectively JSON-encoded, in that we pass
+            # true/false, not the Python str(True) = "True"
+            jsonify = True
         if jsonify:
             example_value = json.dumps(example_value)
         if curl_argument:


Test patch:
Repository: zulip/zulip

Issue:
Incorrect short code for mask emoji
The mask emoji (:mask:) is aliased as `:cant_talk:` in Zulip. This is incorrect for several reasons. First, this is not the recognized name by Unicode (see https://unicode.org/emoji/charts-13.1/emoji-list.html). The official name is "face with medical mask". Recognized aliases include: cold | doctor | face | face with medical mask | mask | sick. It's also not aliased this way on any other platform. GitHub, GitLab, and Gitter, for example, only use `:mask:`. Second, the alias implies that you can't talk with a mask on, which is categorically false. A person with a mask can talk and be heard just fine, as we've all become accustomed to in the last year. Third, using the alias "cant_talk" puts a stigma on wearing masks, which is not good. We need to frame as something positive as it will help us curb the spread of this virus (and others ones in the future).

Please consider dropping the alias "cant_talk" (since `:mask:` also works).


Discussion:
I looked into the code and found a reference to an article. But the [article](https://beebom.com/emoji-meanings/
) doesn't tell anything about the "cant_talk" alias. So I guess it might have been a mistake.
```
    # cant_talk from https://beebom.com/emoji-meanings/
    "1f637": {"canonical_name": "cant_talk", "aliases": ["mask"]},
```

Resolving patch:
diff --git a/tools/setup/emoji/emoji_names.py b/tools/setup/emoji/emoji_names.py
--- a/tools/setup/emoji/emoji_names.py
+++ b/tools/setup/emoji/emoji_names.py
@@ -121,8 +121,7 @@
     # queasy seemed like a natural addition
     "1f922": {"canonical_name": "nauseated", "aliases": ["queasy"]},
     "1f927": {"canonical_name": "sneezing", "aliases": []},
-    # cant_talk from https://beebom.com/emoji-meanings/
-    "1f637": {"canonical_name": "cant_talk", "aliases": ["mask"]},
+    "1f637": {"canonical_name": "mask", "aliases": []},
     # flu from https://mashable.com/2015/10/23/ios-9-1-emoji-guide/, sick from
     # https://emojipedia.org/face-with-thermometer/, face_with_thermometer so
     # it shows up in typeahead (thermometer taken by Objects/82)


Test patch:
Repository: zulip/zulip

Issue:
Avoid leaking huge amounts of disk in the yarn cache in old production servers
On chat.zulip.org, `/home/zulip/.cache` is 7GB; some other users have reported sizes more like 2.6GB.  This is large compared to the rest of a Zulip installation, and probably deserves some attention.

The main cause of this is `yarn` caching; which sadly doesn't have any feature to auto-prune its caches.
```
zulip@zulip:~/.cache/yarn$ du -shc *
1.8G    v1
1.9G    v4
962M    v5
2.5G    v6
7.0G    total
```

There are 2 things we should do to fix this, both in `scripts/lib/clean-unused-caches`:
* Remove the old directories under `~/.cache/yarn/v{1,4,5}`, since those will never be used.
* Remove and individual files under ~/.cache/yarn/v6` that have a modification time 6 months or more ago.




Discussion:
Hello @zulip/server-production, @zulip/server-tooling members, this issue was labeled with the "area: production", "area: tooling" labels, so you may want to check it out!

<!-- areaLabelAddition -->
@zulipbot claim

Resolving patch:
diff --git a/scripts/lib/clean_yarn_cache.py b/scripts/lib/clean_yarn_cache.py
new file mode 100644
--- /dev/null
+++ b/scripts/lib/clean_yarn_cache.py
@@ -0,0 +1,47 @@
+#!/usr/bin/env python3
+import argparse
+import os
+import sys
+
+ZULIP_PATH = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
+sys.path.append(ZULIP_PATH)
+
+from scripts.lib.zulip_tools import may_be_perform_purging, parse_cache_script_args
+
+YARN_CACHE_PATH = os.path.expanduser("~/.cache/yarn/")
+CURRENT_VERSION = "v6"
+
+
+def remove_unused_versions_dir(args: argparse.Namespace) -> None:
+    """Deletes cache data from obsolete Yarn versions.
+
+    Yarn does not provide an interface for removing obsolete data from
+    ~/.cache/yarn for packages that you haven't installed in years; but one
+    can always remove the cache entirely.
+    """
+    current_version_dir = os.path.join(YARN_CACHE_PATH, CURRENT_VERSION)
+    dirs_to_purge = set(
+        [
+            os.path.join(YARN_CACHE_PATH, directory)
+            for directory in os.listdir(YARN_CACHE_PATH)
+            if directory != CURRENT_VERSION
+        ]
+    )
+
+    may_be_perform_purging(
+        dirs_to_purge,
+        {current_version_dir},
+        "yarn cache",
+        args.dry_run,
+        args.verbose,
+        args.no_headings,
+    )
+
+
+def main(args: argparse.Namespace) -> None:
+    remove_unused_versions_dir(args)
+
+
+if __name__ == "__main__":
+    args = parse_cache_script_args("This script cleans redundant Zulip yarn caches.")
+    main(args)


Test patch:
Repository: zulip/zulip

Issue:
templates: Migrate settings_overlay.html to be a handlebars template
This issue is a part of #18792.  We'd like to migrate settings_overlay.html to be a handlebars template `static/templates/settings_overlay.hbs`.  This will require a bit of care with translation tags and also with the many variables that will need to be access from `page_params` when rendering the template. (Some may need to be moved from the rendering `context` in `zerver/views/home.py` to the extra `page_params` fields in `zerver/lib/home.py`, though I think the vast majority are already available in `page_params`)

@sahil839 do you want to claim this one as our settings maintainer?


Discussion:
Hello @zulip/server-refactoring members, this issue was labeled with the "area: refactoring" label, so you may want to check it out!

<!-- areaLabelAddition -->

Resolving patch:
diff --git a/zerver/views/home.py b/zerver/views/home.py
--- a/zerver/views/home.py
+++ b/zerver/views/home.py
@@ -205,11 +205,7 @@ def home_real(request: HttpRequest) -> HttpResponse:
             "user_profile": user_profile,
             "page_params": page_params,
             "csp_nonce": csp_nonce,
-            "is_owner": user_permission_info.is_realm_owner,
-            "is_admin": user_permission_info.is_realm_admin,
-            "is_guest": user_permission_info.is_guest,
             "color_scheme": user_permission_info.color_scheme,
-            "max_file_upload_size_mib": settings.MAX_FILE_UPLOAD_SIZE,
         },
     )
     patch_cache_control(response, no_cache=True, no_store=True, must_revalidate=True)


Test patch:
Repository: zulip/zulip

Issue:
Improve formatting inserted by <time> widget
At present, the `<time>` widget inserts the following formatting into the compose box, which is difficult to read at a glance:

`<time:2021-07-14T00:14:00-07:00>`

Instead, we should have the `<time>` widget insert the following formatting:

`<time:2021-07-14|00:14:00|UTC-07:00>`

Our parser should accept both the old and the new format.

See also [CZO discussion thread](https://chat.zulip.org/#narrow/stream/6-frontend/topic/.3Ctime.3E.20formatting.20in.20compose.20box).


Discussion:
@zulipbot claim

Resolving patch:
diff --git a/zerver/lib/markdown/__init__.py b/zerver/lib/markdown/__init__.py
--- a/zerver/lib/markdown/__init__.py
+++ b/zerver/lib/markdown/__init__.py
@@ -1369,7 +1369,13 @@ def handleMatch(self, match: Match[str]) -> Optional[Element]:
         time_input_string = match.group("time")
         timestamp = None
         try:
-            timestamp = dateutil.parser.parse(time_input_string, tzinfos=common_timezones)
+            # Check if the time string is of the new more-readable format.
+            if "|UTC" in time_input_string:
+                # Remove and replace the non-standard characters with the ISO ones.
+                standard_format_time = time_input_string.replace("|", "T", 1).replace("|UTC", "")
+                timestamp = dateutil.parser.parse(standard_format_time, tzinfos=common_timezones)
+            else:
+                timestamp = dateutil.parser.parse(time_input_string, tzinfos=common_timezones)
         except ValueError:
             try:
                 timestamp = datetime.datetime.fromtimestamp(float(time_input_string))


Test patch:
diff --git a/zerver/tests/fixtures/markdown_test_cases.json b/zerver/tests/fixtures/markdown_test_cases.json
--- a/zerver/tests/fixtures/markdown_test_cases.json
+++ b/zerver/tests/fixtures/markdown_test_cases.json
@@ -790,6 +790,19 @@
       "expected_output": "<p>Let's meet at <time datetime=\"2017-06-05T22:30:00Z\">1496701800</time>.</p>",
       "text_content": "Let's meet at 1496701800."
     },
+    {
+      "name": "timestamp_new_format",
+      "input": "<time:2021-08-02|14:03:00|UTC+05:30>",
+      "expected_output": "<p><time datetime=\"2021-08-02T08:33:00Z\">2021-08-02|14:03:00|UTC+05:30</time></p>",
+      "text_content": "2021-08-02|14:03:00|UTC+05:30"
+    },
+    {
+      "name": "timestamp_without_utc",
+      "input": "<time:2021-08-02|14:03:00|+05:30>",
+      "expected_output": "<p><span class=\"timestamp-error\">Invalid time format: 2021-08-02|14:03:00|+05:30</span></p>",
+      "marked_expected_output": "<p><span>2021-08-02|14:03:00|+05:30</span></p>",
+      "text_content": "Invalid time format: 2021-08-02|14:03:00|+05:30"
+    },
     {
       "name": "tex_inline",
       "input": "$$1 \\oplus 0 = 1$$",
Repository: zulip/zulip

Issue:
dark mode: Date picker styling doesn't fit dark mode
![screenshot at oct 02 16-23-58](https://user-images.githubusercontent.com/15116870/46382364-9774b100-c65f-11e8-8c3f-d40865592c77.png)

Related to #10545 in the aspect that the date picker needs better styling (could possibly be combined with this one as well).


Discussion:
Hmm, yeah.  We get the date picker from (I think) the flatpickr library.
It looks like flatpickr has its own "dark" [theme](https://flatpickr.js.org/themes/), but it doesn't seem like there's an easy way to programmatically change it since each theme comes with its own stylesheet 
Hmm, I think we definitely want to use that.  There's two possibly approaches that might work:
(1) Use fancy SCSS to have something like 
```
.night-mode { 
    include `flatpickr/dist/themes/dark.css`;
}
```
(If there's a valid SCSS way to do that) so that our toolchain can take care of making this conditional on the night-mode class.  This would be cleanest if it actually works.  

(2) Modify the JS logic in `static/js/night_mode.js` to toggle this stylesheet as well as the main thing it does with `create_stylesheet`.
The SCSS approach didn't work, so I did the JS approach you suggested:
Dark mode:
![screenshot at oct 02 20-12-59](https://user-images.githubusercontent.com/15116870/46388189-a0757a80-c67f-11e8-91f5-212d5ece2938.png)

Light mode (added green colors to fix #10545):
![screenshot at oct 02 20-13-20](https://user-images.githubusercontent.com/15116870/46388191-a0757a80-c67f-11e8-8c71-7f898ae8ff9f.png)

Does this look fine? @rishig would appreciate your feedback as well!

It fixes the dark mode problem visually, so is definitely an improvement.

I think the overall styling is not very good relative to other products' calendars nowadays, but that doesn't need to block this PR.

@synicalsyntax did we end up fixing this through a new version of #10613?  
Hello @zulip/server-settings members, this issue was labeled with the "area: settings UI" label, so you may want to check it out!

<!-- areaLabelAddition -->
I just fixed this having been misfiled in our issue tracker.
@timabbott  No idea if there was a followup to #10613

Resolving patch:
diff --git a/version.py b/version.py
--- a/version.py
+++ b/version.py
@@ -48,4 +48,4 @@
 #   historical commits sharing the same major version, in which case a
 #   minor version bump suffices.
 
-PROVISION_VERSION = "159.1"
+PROVISION_VERSION = "159.2"


Test patch:
Repository: zulip/zulip

Issue:
Indicate latest Zulip server version on ReadTheDocs installation and upgrade pages 
At present, the Zulip installation and upgrade docs don't tell you what version of Zulip you'll be installing. While the installation/upgrade script doesn't require the user to know this, it would provide helpful context for someone who wants to understand what they are about to install.

We should add a line to each of the following pages that indicates the version of Zulip server that will be installed. This information should be updated automatically when a new version is released.

Pages to change:
* https://zulip.readthedocs.io/en/stable/production/upgrade-or-modify.html
* https://zulip.readthedocs.io/en/stable/production/install.html


Discussion:
Hello @zulip/server-production members, this issue was labeled with the "area: documentation (production)" label, so you may want to check it out!

<!-- areaLabelAddition -->


Resolving patch:
diff --git a/docs/conf.py b/docs/conf.py
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -20,7 +20,7 @@
 # sys.path.insert(0, os.path.abspath('.'))
 
 sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))
-from version import ZULIP_VERSION
+from version import LATEST_RELEASE_VERSION, ZULIP_VERSION
 
 # -- General configuration ------------------------------------------------
 
@@ -36,6 +36,7 @@
 
 myst_enable_extensions = [
     "colon_fence",
+    "substitution",
 ]
 
 # Add any paths that contain templates here, relative to this directory.
@@ -105,6 +106,10 @@
 # If true, `todo` and `todoList` produce output, else they produce nothing.
 todo_include_todos = False
 
+myst_substitutions = {
+    "LATEST_RELEASE_VERSION": LATEST_RELEASE_VERSION,
+}
+
 
 # -- Options for HTML output ----------------------------------------------
 


Test patch:
Repository: zulip/zulip

Issue:
Indicate latest Zulip server version on ReadTheDocs installation and upgrade pages 
At present, the Zulip installation and upgrade docs don't tell you what version of Zulip you'll be installing. While the installation/upgrade script doesn't require the user to know this, it would provide helpful context for someone who wants to understand what they are about to install.

We should add a line to each of the following pages that indicates the version of Zulip server that will be installed. This information should be updated automatically when a new version is released.

Pages to change:
* https://zulip.readthedocs.io/en/stable/production/upgrade-or-modify.html
* https://zulip.readthedocs.io/en/stable/production/install.html


Discussion:

Resolving patch:
diff --git a/docs/conf.py b/docs/conf.py
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -20,7 +20,7 @@
 # sys.path.insert(0, os.path.abspath('.'))
 
 sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))
-from version import ZULIP_VERSION
+from version import LATEST_RELEASE_VERSION, ZULIP_VERSION
 
 # -- General configuration ------------------------------------------------
 
@@ -36,6 +36,7 @@
 
 myst_enable_extensions = [
     "colon_fence",
+    "substitution",
 ]
 
 # Add any paths that contain templates here, relative to this directory.
@@ -105,6 +106,10 @@
 # If true, `todo` and `todoList` produce output, else they produce nothing.
 todo_include_todos = False
 
+myst_substitutions = {
+    "LATEST_RELEASE_VERSION": LATEST_RELEASE_VERSION,
+}
+
 
 # -- Options for HTML output ----------------------------------------------
 


Test patch: