Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Demo: Checking CI testing. #32839

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file added api/resend-email-invite
Empty file.
6 changes: 6 additions & 0 deletions api_docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ format used by the Zulip server that they are interacting with.

## Changes in Zulip 10.0

**Feature level 333**

* [`PATCH /users`](/api/update-user): Added `send_account_modification_notifications`
function in `do_change_full_name` which notify the user when an admin changes
their full name.

**Feature level 332**

* [`POST /register`](/api/register-queue): Added
Expand Down
9 changes: 9 additions & 0 deletions help/configure-automated-notices.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,15 @@ You will be notified if someone [subscribes you to a
channel](/help/add-or-remove-users-from-a-channel#add-users-to-a-channel), or
changes your [group](/help/user-groups) membership.


## Notices about user account details changes

{!admin-only.md!}

When an administrator [modifies](/help/change-a-users-name) something about a user's account, it would notify
them that a change was made. We have a Notification Bot that send a private message
to the user informing them about the change.

### New user announcements

{!admin-only.md!}
Expand Down
2 changes: 1 addition & 1 deletion version.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
# new level means in api_docs/changelog.md, as well as "**Changes**"
# entries in the endpoint's documentation in `zulip.yaml`.

API_FEATURE_LEVEL = 332 # Last bumped for data deletion of deactivated realms.
API_FEATURE_LEVEL = 333 # Last bumped for stream_ids and include_realm_default_subscriptions.

# Bump the minor PROVISION_VERSION to indicate that folks should provision
# only when going from an old version of the code to a newer version. Bump
Expand Down
30 changes: 29 additions & 1 deletion zerver/actions/user_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

from confirmation.models import Confirmation, create_confirmation_link
from confirmation.settings import STATUS_REVOKED
from zerver.actions.message_send import internal_send_private_message
from zerver.actions.presence import do_update_user_presence
from zerver.lib.avatar import avatar_url
from zerver.lib.cache import (
Expand All @@ -18,6 +19,7 @@
)
from zerver.lib.create_user import get_display_email_address
from zerver.lib.i18n import get_language_name
from zerver.lib.mention import silent_mention_syntax_for_user
from zerver.lib.queue import queue_event_on_commit
from zerver.lib.send_email import FromAddress, clear_scheduled_emails, send_email
from zerver.lib.timezone import canonicalize_timezone
Expand All @@ -42,7 +44,7 @@
)
from zerver.models.clients import get_client
from zerver.models.realm_audit_logs import AuditLogEventType
from zerver.models.users import bot_owner_user_ids, get_user_profile_by_id
from zerver.models.users import bot_owner_user_ids, get_system_bot, get_user_profile_by_id
from zerver.tornado.django_api import send_event_on_commit


Expand Down Expand Up @@ -247,6 +249,9 @@ def do_change_full_name(
dict(type="realm_bot", op="update", bot=payload),
bot_owner_user_ids(user_profile),
)
send_account_modification_notifications(
user_profile, "full name", acting_user, old_name, full_name
)


def check_change_full_name(
Expand Down Expand Up @@ -607,3 +612,26 @@ def do_change_user_setting(
force_send_update=True,
)
)


def send_account_modification_notifications(
user_profile: UserProfile,
property: str,
acting_user: UserProfile | None,
old_value: str | list[int] | None,
new_value: str | list[int] | None,
) -> None:
if user_profile.is_bot or acting_user == user_profile:
return

realm = user_profile.realm
sender = get_system_bot(settings.NOTIFICATION_BOT, realm.id)
if acting_user is not None:
detailed_message = f"{silent_mention_syntax_for_user(acting_user)} has updated your `{property}`.\n\n- **Old `{property}`:** {old_value}\n- **New `{property}`:** {new_value}"
else:
detailed_message = f"The following updates have been made to your account.\n\n- **Old `{property}`:** {old_value}\n- **New `{property}`:** {new_value}"
internal_send_private_message(
sender,
user_profile,
detailed_message,
)
Loading