Compare commits

..

4 Commits

Author SHA1 Message Date
Nikhil Kothari
d752e015ad
Merge pull request #2320 from frappe/develop
fix: do not show administrator and blur issue on Safari
2026-10-19 19:01:42 +05:30
Nikhil Kothari
3767c8e0f5
Merge pull request #2317 from frappe/develop
Merging develop into main
2026-10-19 13:07:52 +05:30
Nikhil Kothari
ae4202052f
Merging develop into main (#2307)
* fix: keep a sheet open when it opens as another closes (#2303)

history.back() is async. When one sheet closed and another opened in the
same tap (composer actions -> poll form), the new sheet could push its
history entry before the old sheet's back finished. The back then popped
the new entry and the new sheet closed at once. Android Firefox finishes
the back late enough to hit this every time.

A closing sheet now records its pending back, and an opening sheet waits
for it before pushing.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

* fix: show push settings from boot without asking older sites

* chore(deps): fix dependabot alerts and require Node 22.12+

- firebase 10.9.0 -> 12.19.0: clears the protobufjs, websocket-driver,
  undici and busboy alerts. The messaging APIs Raven uses are unchanged.
- vitest 3 -> 4.1.11: clears the tinypool alert.
- Refresh yarn.lock within existing ranges for the other vulnerable
  packages (tiptap, prosemirror-view, react-router, vite, axios, turbo
  and others).
- engines.node >=22.12.0 in the root package.json. Frappe Cloud checks
  it against the bench's Node version before a build. Vite 8 already
  needs 20.19+ or 22.12+.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Aditya Patil <patiladitya781@gmail.com>
Co-authored-by: Aditya Patil <46787266+TITANiumRox@users.noreply.github.com>
2026-10-15 23:00:38 +05:30
Nikhil Kothari
92448c1f7b
Merging develop into main (#2302)
* fix: parse dates cleanly to prevent Safari crash (#2267)

* feat: implement native app API and OAuth support (#2266)

* feat: implement native app API and OAuth support

* chore: split redirect URL

Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>

---------

Co-authored-by: Nikhil Kothari <nik.kothari22@live.com>
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>

* fix: change to subtle button

* fix: button in leave channel modal

* fix: build a lean boot for the native app

* fix: optimize bootinfo version retrieval and run only raven's boot hooks

* fix: pre-commit

* fix: overflow of long ahh status in PWA

* fix: add onOpenAutoFocus handler to DrawerContent for better keyboard management

* fix: keep composer keyboard open for the send options sheet

* fix: EmbedFrame border radius

* ci: publish prebuilt assets for Pilot

* fix: close sheets on back instead of leaving the page

* fix: show custom emoji in last message in DMs (#2276)

* fix: show custom emoji in last message in DMs

* fix: enhance custom emoji handling in messages and previews

* fix: show custom emojis with any name in DM previews

* fix: show known custom emoji shortcodes as emojis everywhere

* fix: use teaser text in message link preview and pinned messages

* fix: emojis inside spoiler tags

* fix: handle quotes in emoji shortcodes

* fix: neutralize literal backticks

* fix: match adjacent custom emoji shortcodes

* fix: let a shortcode be typed as inline code

Converting :name: right after an unclosed backtick deleted the opening
backtick, so `:name:` could never be typed as a code span. The swap now
skips a shortcode preceded by an unclosed backtick, leaving the text for
the code input rule to close; code text is already exempt everywhere.
An emoji picked from the popup still drops the dangling backtick, since
inline code cannot close across the emoji.

---------

Co-authored-by: Nikhil Kothari <nik.kothari22@live.com>

* fix: multiple UI fixes (#2298)

* fix: repair the server test suite on develop

* fix: keep mention read state when a message is edited

* fix: do not preview soft-404 pages

frappe.io answers unpublished blog URLs with HTTP 200 and its error
page, og tags included, so the fetcher built a "Page Not Found" card.
parse_open_graph now fails the fetch when the page's title is exactly a
known not-found title. The failure stays retryable: a post published
later under the same URL previews on a future share.

* fix(ui): reduce blurfade for files and links in channel settings tab

* feat: switch workspaces with cmd+alt+up/down

* fix: make polls inert in thread list rows

* fix: show the server's error when saving admin settings fails

* fix: align Later list rows with the page gutter on mobile

* fix: show a media teaser for image-only messages in notifications

* fix: size the notification media teaser like rich quotes

The rich branch's .tiptap root overrides the quote container's xs/gray
styling, so the plain "📷 Photo" fallback rendered smaller and dimmer
than text quotes. The fallback now carries the same reading tier.

* fix: match the profile skeleton to the real page layout

* fix: sr-only print dialog descriptions and combobox titles

* feat: join and leave workspaces from the mobile workspaces drawer (#2283)

* feat: join and leave workspaces from the mobile workspaces drawer

* fix: forget the remembered channel when leaving its workspace

* feat: allow reordering workspaces on mobile

---------

Co-authored-by: Nikhil Kothari <nik.kothari22@live.com>

* fix: look up a channel missing from the list before showing a DM as not found (#2282)

* fix: look up a channel missing from the list before showing a DM as not found

* fix: show a retryable error, not "not found", when the DM lookup fails

* fix: also ensure channel existence for groups
fix: skeleton sizing

---------

Co-authored-by: Nikhil Kothari <nik.kothari22@live.com>

* fix: delete admin members using controller when user is deleted (#2299)

* fix: refetch the open channel after background when its window is deep or was jumped to (#2281)

* fix: refetch the open channel after background when its window is deep or was jumped to

* fix: catch up a claimed window instead of replacing it

* fix: bound the deep-window catch-up to what the window can hold

The catch-up merge trims the oldest rows past the window cap, and in a
deep window those are the rows being read — losing them yanked the
scroll. The request is now capped to the window's headroom, and a full
window skips the catch-up; when more arrived than fits, the page
detaches the window and "jump to present" takes over. Adds loader tests
for the replace, catch-up, headroom and full-window cases, and updates
the performance notes.

* fix: refresh the open channel's whole window after a connection break
A window deeper than 70 messages, or one reached by a jump, got no
refresh on resume: new messages, reactions, edits and deletes from the
gap were all missed until the channel was reopened. Tapping a
notification for the open channel did not reopen it, so that could be
a long wait.
The quiet refresh now refetches the window's own span, from its oldest
message up and capped at the window limit, through a new
include_from_message flag on get_newer_messages. The messages being
read are always in the response, so nothing is dropped and the scroll
never moves, at any depth; every loaded message comes back in its
current state, so changes to existing messages land too, and a message
that does not come back is removed. Unchanged messages keep their
objects. This replaces the depth guard and the newer-only catch-up.

* fix: harden the window refresh against reactions, deletes and mid-flight changes

---------

Co-authored-by: Nikhil Kothari <nik.kothari22@live.com>

* feat(push): setup Raven Cloud via Frappe Cloud (#2291)

* refactor(notification): split site registration from its permission check

register_site_on_raven_cloud still allows only a System Manager, and now calls register_site, which does the registration. Frappe Cloud push setup runs it from a background job, for whichever user started that job.

* feat(push): set up Raven Cloud push automatically on Frappe Cloud

Today an owner must create Raven Cloud keys and paste them into Raven Settings before push works. On Frappe Cloud, Raven now does it by itself: Frappe Cloud puts the relay URL in the site config, Raven gets a short-lived team token from Frappe Cloud, exchanges it at Raven Cloud for the team's keys, saves them and registers the site. It runs when Raven is installed and when the site setup completes, so push works from the first message, both on a new trial and when Raven is installed later. A page load retries a failed attempt at most once an hour and registers the site again when its address changes. A 401 or 403 from Raven Cloud gets the keys again, so key rotation needs no manual step. Keys an owner entered stay, and self-hosted sites keep their manual setup.

* fix(push): finish background setup on first login

* style(push): match pinned Raven formatter

* refactor(push): register with Raven Cloud in one exchange per hostname

Setup fetched keys, then registered the site in a second call, and kept a
separate path to refresh refused keys. Raven Cloud now takes the site's
hostname in the exchange and returns the keys and push settings together, so
setup is one call and a refresh is the same call.

- A failed attempt waits an hour per hostname, so a renamed site registers at once.
- A key that Raven Cloud refuses is fetched again at most once an hour.
- The attempt is recorded last, because saving a default clears the cache.
- A queue outage no longer fails the /raven page.
- A site without a relay URL queues nothing on install.

* fix(push): stop checking for push settings after a minute

While Frappe Cloud setup was pending, every open tab checked for the push
settings every 5 seconds until the page reloaded, also when setup kept failing.
Setup usually finishes in seconds, so the page now stops after a minute, and a
later page load retries.

* feat(push): let a System Manager retry Frappe Cloud push setup

When automatic setup failed before it saved anything, the Register button was
hidden, and on a set-up site it re-registered with the saved keys only. On
Frappe Cloud, the button now shows while setup is pending and runs the full
setup at once, so it also fixes missing or refused keys and shows any error.

* feat(settings): open cloud settings from the rail (#2290)

* feat(settings): open cloud settings from the rail

* chore: simplify billing

---------

Co-authored-by: Nikhil Kothari <nik.kothari22@live.com>

* fix: pass marketplace semgrep checks (#2301)

Render dynamic agent instructions with Frappe's sandboxed renderer
instead of a raw Jinja template. Mark the admin-only render_template
calls and the link-preview commit as reviewed with nosemgrep, and pass
str(e) to the translated OpenAI error.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Aditya Patil <46787266+TITANiumRox@users.noreply.github.com>
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Co-authored-by: Aditya Patil <patiladitya781@gmail.com>
Co-authored-by: prathameshkurunkar7 <prathamesh.kurunkar@thecommit.company>
Co-authored-by: Prathamesh Kurunkar <59260326+prathameshkurunkar7@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-13 14:36:32 +05:30
3 changed files with 24 additions and 123 deletions

View File

@ -6,28 +6,6 @@ from raven.utils import get_channel_members as get_channel_members_util
from raven.utils import get_workspace_members
def build_member_entry(user_obj, channel_member) -> dict | None:
"""One member's row for the member list, or None when there's no matching
Raven User record (e.g. a workspace member whose Raven User record was
removed). The caller must skip a None entry instead of indexing into it —
a workspace can list a member with no Raven User doc, and that one bad
row must never crash the whole list."""
if user_obj is None:
return None
return {
"name": user_obj.name,
"full_name": user_obj.full_name,
"user_image": user_obj.user_image,
"first_name": user_obj.first_name,
"type": user_obj.type,
"availability_status": user_obj.availability_status,
"is_admin": channel_member.get("is_admin", 0),
"allow_notifications": channel_member.get("allow_notifications", 1),
"channel_member_name": channel_member.get("name", None),
}
@frappe.whitelist(methods=["GET"])
def get_channel_members(channel_id: str):
# Check if the user has permission to view the channel
@ -55,17 +33,34 @@ def get_channel_members(channel_id: str):
channel_member = channel_members.get(workspace_member, {})
user_obj = next((u for u in all_users if u.name == workspace_member), None)
entry = build_member_entry(user_obj, channel_member)
if entry:
member_object[entry["name"]] = entry
member_object[user_obj.name] = {
"name": user_obj.name,
"full_name": user_obj.full_name,
"user_image": user_obj.user_image,
"first_name": user_obj.first_name,
"type": user_obj.type,
"availability_status": user_obj.availability_status,
"is_admin": channel_member.get("is_admin", 0),
"allow_notifications": channel_member.get("allow_notifications", 1),
"channel_member_name": channel_member.get("name", None),
}
else:
for member in channel_members:
channel_member = channel_members[member]
user_obj = next((u for u in all_users if u.name == member), None)
entry = build_member_entry(user_obj, channel_member)
if entry:
member_object[entry["name"]] = entry
if user_obj:
member_object[user_obj.name] = {
"name": user_obj.name,
"full_name": user_obj.full_name,
"user_image": user_obj.user_image,
"first_name": user_obj.first_name,
"type": user_obj.type,
"availability_status": user_obj.availability_status,
"is_admin": channel_member.is_admin,
"allow_notifications": channel_member.allow_notifications,
"channel_member_name": channel_member.name,
}
return member_object

View File

@ -343,7 +343,7 @@
"index_web_pages_for_search": 1,
"issingle": 1,
"links": [],
"modified": "2026-10-20 14:12:54.000000",
"modified": "2026-10-17 12:00:00.000000",
"modified_by": "Administrator",
"module": "Raven",
"name": "Raven Settings",

View File

@ -1,94 +0,0 @@
import frappe
from frappe.tests import IntegrationTestCase
from raven.api.chat import build_member_entry, get_channel_members
EXTRA_TEST_RECORD_DEPENDENCIES = ["User", "Raven User"]
class TestBuildMemberEntry(IntegrationTestCase):
"""Pure-function checks for the row builder `get_channel_members` relies on."""
def test_none_user_obj_returns_none(self):
# No matching Raven User record for this member — the caller must be able
# to skip it instead of indexing into None.
self.assertIsNone(build_member_entry(None, {}))
def test_matching_user_obj_returns_entry(self):
user_obj = frappe._dict(
name="test1@example.com",
full_name="Test One",
user_image=None,
first_name="Test",
type="User",
availability_status="Available",
)
entry = build_member_entry(user_obj, {"is_admin": 1, "name": "RCM-1"})
self.assertEqual(entry["name"], "test1@example.com")
self.assertEqual(entry["is_admin"], 1)
self.assertEqual(entry["channel_member_name"], "RCM-1")
def test_missing_channel_member_fields_default(self):
# The Open-channel branch passes `{}` when there's no explicit Raven
# Channel Member row (every workspace member is implicitly a member).
user_obj = frappe._dict(
name="test1@example.com",
full_name="Test One",
user_image=None,
first_name="Test",
type="User",
availability_status="Available",
)
entry = build_member_entry(user_obj, {})
self.assertEqual(entry["is_admin"], 0)
self.assertEqual(entry["allow_notifications"], 1)
self.assertIsNone(entry["channel_member_name"])
class TestOpenChannelMembers(IntegrationTestCase):
"""
Regression test: a workspace member whose Raven User record is gone (e.g. a
direct cleanup / data fix that skipped RavenUser.on_trash's own cascade) must
be skipped from the Open channel's member list, not crash the whole request.
"""
def setUp(self):
frappe.set_user("Administrator")
frappe.get_doc("User", "test1@example.com").add_roles("Raven User")
self.workspace = frappe.get_doc(
{
"doctype": "Raven Workspace",
"workspace_name": "Chat Members Test Workspace",
"type": "Private",
}
).insert()
self.channel = frappe.get_doc(
{
"doctype": "Raven Channel",
"channel_name": "chat-members-open-test",
"type": "Open",
"workspace": self.workspace.name,
}
).insert()
def tearDown(self):
frappe.set_user("Administrator")
frappe.db.delete("Raven Channel Member", {"channel_id": self.channel.name})
frappe.db.delete("Raven Workspace Member", {"workspace": self.workspace.name})
self.channel.delete()
self.workspace.delete()
def test_open_channel_skips_member_with_no_raven_user_record(self):
user = "test1@example.com"
frappe.get_doc(
{"doctype": "Raven Workspace Member", "workspace": self.workspace.name, "user": user}
).insert(ignore_permissions=True)
# Simulate the broken state directly: a raw delete bypasses RavenUser.on_trash,
# so the Workspace Member row survives with no matching Raven User doc.
frappe.db.delete("Raven User", {"user": user})
frappe.cache().delete_value(f"raven:workspace_members:{self.workspace.name}")
members = get_channel_members(self.channel.name)
self.assertNotIn(user, members)