Compare commits

..

5 Commits

Author SHA1 Message Date
Tim Abbott
6262c81375 templates: Tweak demo-owner-update-email-field-hint text. 2025-10-21 18:02:36 -07:00
Lauryn Menard
476ee37bf3 demo-orgs: Add email address visibility update to add email modal.
Adds a field to update the demo organization owner's email address
visibility setting when they are adding an email to their account.
2025-10-21 18:00:48 -07:00
Lauryn Menard
ef2c2fe885 demo-orgs: Make note about name field a hint in add email modal.
Moves the note about possibly updating the name field from the top
of the modal to instead be a hint/subtitle under the field on the
form.
2025-10-21 18:00:48 -07:00
Alex Vandiver
a925671179 corporate: Add canonical URLs. 2025-10-21 14:25:16 -07:00
Aneesh Hegde
f778c853ea webhooks_gitea: Add tests and fixture for correct actor on PR close.
Previously, closing a pull request by someone other than its creator could result in Zulip notifications attributing the action to the wrong user.

This change adds a focused test and a fixture capturing the case where the webhook sender differs from pull_request.user, ensuring the correct actor is mentioned for pull_request close events.

Follow-up to #36184.
2025-10-21 13:23:31 -07:00
6 changed files with 515 additions and 2 deletions

View File

@@ -297,6 +297,7 @@ def team_view(request: HttpRequest) -> HttpResponse:
"page_type": "team",
"contributors": data["contributors"],
},
"REL_CANONICAL_LINK": f"https://zulip.com{request.path}",
"date": data["date"],
},
)
@@ -310,6 +311,7 @@ def landing_view(request: HttpRequest, template_name: str) -> HttpResponse:
"billing_base_url": "",
"tier_cloud_standard": str(CustomerPlan.TIER_CLOUD_STANDARD),
"tier_cloud_plus": str(CustomerPlan.TIER_CLOUD_PLUS),
"REL_CANONICAL_LINK": f"https://zulip.com{request.path}",
}
)
@@ -318,7 +320,9 @@ def landing_view(request: HttpRequest, template_name: str) -> HttpResponse:
@add_google_analytics
def hello_view(request: HttpRequest) -> HttpResponse:
return TemplateResponse(request, "corporate/hello.html", latest_info_context())
context = latest_info_context()
context["REL_CANONICAL_LINK"] = "https://zulip.com/"
return TemplateResponse(request, "corporate/hello.html", context)
@add_google_analytics
@@ -381,6 +385,7 @@ def communities_view(request: HttpRequest) -> HttpResponse:
request,
"corporate/communities.html",
context={
"REL_CANONICAL_LINK": f"https://zulip.com{request.path}",
"eligible_realms": eligible_realms,
"org_types": org_types,
},

View File

@@ -23,6 +23,7 @@ import {page_params} from "./page_params.ts";
import * as people from "./people.ts";
import * as settings_bots from "./settings_bots.ts";
import * as settings_components from "./settings_components.ts";
import * as settings_config from "./settings_config.ts";
import * as settings_data from "./settings_data.ts";
import * as settings_org from "./settings_org.ts";
import * as settings_ui from "./settings_ui.ts";
@@ -640,6 +641,7 @@ export function set_up(): void {
const data = {
email: $<HTMLInputElement>("input#demo_organization_add_email").val(),
full_name: $("#demo_organization_update_full_name").val(),
email_address_visibility: $("#demo_owner_email_address_visibility").val(),
};
const opts = {
@@ -678,6 +680,9 @@ export function set_up(): void {
e.stopPropagation();
function demo_organization_add_email_post_render(): void {
// Set email address visibility to current user setting.
$("#demo_owner_email_address_visibility").val(user_settings.email_address_visibility);
// Disable submit button if either input is an empty string.
const $add_email_element = $<HTMLInputElement>("input#demo_organization_add_email");
const $add_name_element = $<HTMLInputElement>(
@@ -708,6 +713,8 @@ export function set_up(): void {
html_body: render_demo_organization_add_email_modal({
delivery_email: current_user.delivery_email,
full_name: current_user.full_name,
email_address_visibility_values:
settings_config.email_address_visibility_values,
}),
html_submit_button: $t_html({defaultMessage: "Add"}),
loading_spinner: true,

View File

@@ -397,6 +397,10 @@
opacity: 0.7;
}
#demo-owner-update-email-field-hint {
opacity: 0.7;
}
#sender_channel_email_address_widget {
width: 12.875em; /* 206px at 16px/em */
}

View File

@@ -1,11 +1,24 @@
<form id="demo_organization_add_email_form">
<p>{{t "If you haven't updated your name, you may want to do so before inviting other users to join." }}</p>
<div class="input-group">
<label for="demo_organization_add_email" class="modal-field-label">{{t "Email" }}</label>
<input id="demo_organization_add_email" type="text" name="email" class="modal_text_input" value="{{delivery_email}}" autocomplete="off" spellcheck="false" autofocus="autofocus"/>
</div>
<div class="input-group">
<label for="demo_owner_email_address_visibility" class="modal-field-label">
{{t "Who can access your email address"}}
{{> help_link_widget link="/help/configure-email-visibility" }}
</label>
<select id="demo_owner_email_address_visibility" name="demo_owner_email_address_visibility" class="modal_select bootstrap-focus-style">
{{#each email_address_visibility_values}}
<option value="{{this.code}}">{{this.description}}</option>
{{/each}}
</select>
</div>
<div class="input-group">
<label for="demo_organization_update_full_name" class="modal-field-label">{{t "Name" }}</label>
<p id="demo-owner-update-email-field-hint">
{{t "If you haven't updated your name, consider doing so before inviting other users to join."}}
</p>
<input id="demo_organization_update_full_name" name="full_name" type="text" class="modal_text_input" value="{{full_name}}" maxlength="60" />
</div>
</form>

View File

@@ -0,0 +1,479 @@
{
"action": "closed",
"number": 1,
"pull_request": {
"id": 126085,
"url": "https://gitea.com/Aneesh-Hegde/test-repo/pulls/1",
"number": 1,
"user": {
"id": 116733,
"login": "Celebi",
"login_name": "",
"source_id": 0,
"full_name": "",
"email": "celebi_datatransfer@noreply.gitea.com",
"avatar_url": "https://seccdn.libravatar.org/avatar/7acebc2b09409dc06796dc2cbd80c08a?d=identicon",
"html_url": "https://gitea.com/Celebi",
"language": "",
"is_admin": false,
"last_login": "0001-01-01T00:00:00Z",
"created": "2025-03-29T17:56:48Z",
"restricted": false,
"active": false,
"prohibit_login": false,
"location": "",
"website": "",
"description": "",
"visibility": "public",
"followers_count": 0,
"following_count": 0,
"starred_repos_count": 0,
"username": "Celebi"
},
"title": "PR closed",
"body": "",
"labels": [],
"milestone": null,
"assignee": null,
"assignees": [],
"requested_reviewers": [],
"requested_reviewers_teams": [],
"state": "closed",
"draft": true,
"is_locked": false,
"comments": 10,
"additions": 3,
"deletions": 1,
"changed_files": 3,
"html_url": "https://gitea.com/Aneesh-Hegde/test-repo/pulls/1",
"diff_url": "https://gitea.com/Aneesh-Hegde/test-repo/pulls/1.diff",
"patch_url": "https://gitea.com/Aneesh-Hegde/test-repo/pulls/1.patch",
"mergeable": false,
"merged": false,
"merged_at": null,
"merge_commit_sha": null,
"merged_by": null,
"allow_maintainer_edit": false,
"base": {
"label": "main",
"ref": "main",
"sha": "aef25c08146a31ac1d9941edd8c306132194978f",
"repo_id": 95379,
"repo": {
"id": 95379,
"owner": {
"id": 116728,
"login": "Aneesh-Hegde",
"login_name": "",
"source_id": 0,
"full_name": "CELEBI",
"email": "aneesh-hegde@noreply.gitea.com",
"avatar_url": "https://seccdn.libravatar.org/avatar/3629fd95adff086774218f58a8d33c7c?d=identicon",
"html_url": "https://gitea.com/Aneesh-Hegde",
"language": "",
"is_admin": false,
"last_login": "0001-01-01T00:00:00Z",
"created": "2025-03-29T17:41:12Z",
"restricted": false,
"active": false,
"prohibit_login": false,
"location": "",
"website": "",
"description": "",
"visibility": "public",
"followers_count": 0,
"following_count": 0,
"starred_repos_count": 0,
"username": "Aneesh-Hegde"
},
"name": "test",
"full_name": "Aneesh-Hegde/test-repo",
"description": "",
"empty": false,
"private": false,
"fork": false,
"template": false,
"mirror": false,
"size": 30,
"language": "",
"languages_url": "https://gitea.com/api/v1/repos/Aneesh-Hegde/test-repo/languages",
"html_url": "https://gitea.com/Aneesh-Hegde/test-repo",
"url": "https://gitea.com/api/v1/repos/Aneesh-Hegde/test-repo",
"link": "",
"ssh_url": "git@gitea.com:Aneesh-Hegde/test-repo.git",
"clone_url": "https://gitea.com/Aneesh-Hegde/test-repo.git",
"original_url": "",
"website": "",
"stars_count": 0,
"forks_count": 1,
"watchers_count": 1,
"open_issues_count": 1,
"open_pr_counter": 2,
"release_counter": 1,
"default_branch": "main",
"archived": false,
"created_at": "2025-03-29T18:00:25Z",
"updated_at": "2025-10-02T11:23:27Z",
"archived_at": "1970-01-01T00:00:00Z",
"permissions": {
"admin": false,
"push": true,
"pull": true
},
"has_code": false,
"has_issues": true,
"internal_tracker": {
"enable_time_tracker": true,
"allow_only_contributors_to_track_time": true,
"enable_issue_dependencies": true
},
"has_wiki": true,
"has_pull_requests": true,
"has_projects": true,
"projects_mode": "all",
"has_releases": true,
"has_packages": false,
"has_actions": true,
"ignore_whitespace_conflicts": false,
"allow_merge_commits": true,
"allow_rebase": true,
"allow_rebase_explicit": true,
"allow_squash_merge": true,
"allow_fast_forward_only_merge": true,
"allow_rebase_update": true,
"allow_manual_merge": false,
"autodetect_manual_merge": false,
"default_delete_branch_after_merge": false,
"default_merge_style": "merge",
"default_allow_maintainer_edit": false,
"avatar_url": "",
"internal": false,
"mirror_interval": "",
"object_format_name": "sha1",
"mirror_updated": "0001-01-01T00:00:00Z",
"topics": [],
"licenses": []
}
},
"head": {
"label": "main",
"ref": "main",
"sha": "cabcb9513308844c015a6b3dd804c5618875b447",
"repo_id": 95380,
"repo": {
"id": 95380,
"owner": {
"id": 116733,
"login": "Celebi",
"login_name": "",
"source_id": 0,
"full_name": "",
"email": "celebi_datatransfer@noreply.gitea.com",
"avatar_url": "https://seccdn.libravatar.org/avatar/7acebc2b09409dc06796dc2cbd80c08a?d=identicon",
"html_url": "https://gitea.com/Celebi",
"language": "",
"is_admin": false,
"last_login": "0001-01-01T00:00:00Z",
"created": "2025-03-29T17:56:48Z",
"restricted": false,
"active": false,
"prohibit_login": false,
"location": "",
"website": "",
"description": "",
"visibility": "public",
"followers_count": 0,
"following_count": 0,
"starred_repos_count": 0,
"username": "Celebi"
},
"name": "test",
"full_name": "Celebi/test-repo",
"description": "",
"empty": false,
"private": false,
"fork": true,
"template": false,
"parent": {
"id": 95379,
"owner": {
"id": 116728,
"login": "Aneesh-Hegde",
"login_name": "",
"source_id": 0,
"full_name": "CELEBI",
"email": "aneesh-hegde@noreply.gitea.com",
"avatar_url": "https://seccdn.libravatar.org/avatar/3629fd95adff086774218f58a8d33c7c?d=identicon",
"html_url": "https://gitea.com/Aneesh-Hegde",
"language": "",
"is_admin": false,
"last_login": "0001-01-01T00:00:00Z",
"created": "2025-03-29T17:41:12Z",
"restricted": false,
"active": false,
"prohibit_login": false,
"location": "",
"website": "",
"description": "",
"visibility": "public",
"followers_count": 0,
"following_count": 0,
"starred_repos_count": 0,
"username": "Aneesh-Hegde"
},
"name": "test",
"full_name": "Aneesh-Hegde/test-repo",
"description": "",
"empty": false,
"private": false,
"fork": false,
"template": false,
"mirror": false,
"size": 30,
"language": "",
"languages_url": "https://gitea.com/api/v1/repos/Aneesh-Hegde/test-repo/languages",
"html_url": "https://gitea.com/Aneesh-Hegde/test-repo",
"url": "https://gitea.com/api/v1/repos/Aneesh-Hegde/test-repo",
"link": "",
"ssh_url": "git@gitea.com:Aneesh-Hegde/test-repo.git",
"clone_url": "https://gitea.com/Aneesh-Hegde/test-repo.git",
"original_url": "",
"website": "",
"stars_count": 0,
"forks_count": 1,
"watchers_count": 1,
"open_issues_count": 1,
"open_pr_counter": 1,
"release_counter": 1,
"default_branch": "main",
"archived": false,
"created_at": "2025-03-29T18:00:25Z",
"updated_at": "2025-10-02T11:23:27Z",
"archived_at": "1970-01-01T00:00:00Z",
"permissions": {
"admin": false,
"push": false,
"pull": true
},
"has_code": false,
"has_issues": true,
"internal_tracker": {
"enable_time_tracker": true,
"allow_only_contributors_to_track_time": true,
"enable_issue_dependencies": true
},
"has_wiki": true,
"has_pull_requests": true,
"has_projects": true,
"projects_mode": "all",
"has_releases": true,
"has_packages": false,
"has_actions": true,
"ignore_whitespace_conflicts": false,
"allow_merge_commits": true,
"allow_rebase": true,
"allow_rebase_explicit": true,
"allow_squash_merge": true,
"allow_fast_forward_only_merge": true,
"allow_rebase_update": true,
"allow_manual_merge": false,
"autodetect_manual_merge": false,
"default_delete_branch_after_merge": false,
"default_merge_style": "merge",
"default_allow_maintainer_edit": false,
"avatar_url": "",
"internal": false,
"mirror_interval": "",
"object_format_name": "sha1",
"mirror_updated": "0001-01-01T00:00:00Z",
"topics": [],
"licenses": []
},
"mirror": false,
"size": 30,
"language": "",
"languages_url": "https://gitea.com/api/v1/repos/Celebi/test-repo/languages",
"html_url": "https://gitea.com/Celebi/test-repo",
"url": "https://gitea.com/api/v1/repos/Celebi/test-repo",
"link": "",
"ssh_url": "git@gitea.com:Celebi/test-repo.git",
"clone_url": "https://gitea.com/Celebi/test-repo.git",
"original_url": "",
"website": "",
"stars_count": 0,
"forks_count": 0,
"watchers_count": 1,
"open_issues_count": 0,
"open_pr_counter": 0,
"release_counter": 0,
"default_branch": "main",
"archived": false,
"created_at": "2025-03-29T18:04:25Z",
"updated_at": "2025-03-31T10:07:23Z",
"archived_at": "1970-01-01T00:00:00Z",
"permissions": {
"admin": false,
"push": false,
"pull": true
},
"has_code": false,
"has_issues": false,
"has_wiki": false,
"has_pull_requests": true,
"has_projects": false,
"projects_mode": "all",
"has_releases": false,
"has_packages": false,
"has_actions": false,
"ignore_whitespace_conflicts": false,
"allow_merge_commits": true,
"allow_rebase": true,
"allow_rebase_explicit": true,
"allow_squash_merge": true,
"allow_fast_forward_only_merge": true,
"allow_rebase_update": true,
"allow_manual_merge": false,
"autodetect_manual_merge": false,
"default_delete_branch_after_merge": false,
"default_merge_style": "merge",
"default_allow_maintainer_edit": false,
"avatar_url": "",
"internal": false,
"mirror_interval": "",
"object_format_name": "sha1",
"mirror_updated": "0001-01-01T00:00:00Z",
"topics": [],
"licenses": []
}
},
"merge_base": "3d1aa2535f5433f56e252fee2311039c3afb0cb6",
"due_date": null,
"created_at": "2025-03-29T18:04:51Z",
"updated_at": "2025-10-10T19:45:22Z",
"closed_at": "2025-10-10T19:45:22Z",
"pin_order": 0
},
"requested_reviewer": null,
"repository": {
"id": 95379,
"owner": {
"id": 116728,
"login": "Aneesh-Hegde",
"login_name": "",
"source_id": 0,
"full_name": "CELEBI",
"email": "aneesh-hegde@noreply.gitea.com",
"avatar_url": "https://seccdn.libravatar.org/avatar/3629fd95adff086774218f58a8d33c7c?d=identicon",
"html_url": "https://gitea.com/Aneesh-Hegde",
"language": "",
"is_admin": false,
"last_login": "0001-01-01T00:00:00Z",
"created": "2025-03-29T17:41:12Z",
"restricted": false,
"active": false,
"prohibit_login": false,
"location": "",
"website": "",
"description": "",
"visibility": "public",
"followers_count": 0,
"following_count": 0,
"starred_repos_count": 0,
"username": "Aneesh-Hegde"
},
"name": "test",
"full_name": "Aneesh-Hegde/test-repo",
"description": "",
"empty": false,
"private": false,
"fork": false,
"template": false,
"mirror": false,
"size": 30,
"language": "",
"languages_url": "https://gitea.com/api/v1/repos/Aneesh-Hegde/test-repo/languages",
"html_url": "https://gitea.com/Aneesh-Hegde/test-repo",
"url": "https://gitea.com/api/v1/repos/Aneesh-Hegde/test-repo",
"link": "",
"ssh_url": "git@gitea.com:Aneesh-Hegde/test-repo.git",
"clone_url": "https://gitea.com/Aneesh-Hegde/test-repo.git",
"original_url": "",
"website": "",
"stars_count": 0,
"forks_count": 1,
"watchers_count": 1,
"open_issues_count": 1,
"open_pr_counter": 2,
"release_counter": 1,
"default_branch": "main",
"archived": false,
"created_at": "2025-03-29T18:00:25Z",
"updated_at": "2025-10-02T11:23:27Z",
"archived_at": "1970-01-01T00:00:00Z",
"permissions": {
"admin": false,
"push": false,
"pull": true
},
"has_code": false,
"has_issues": true,
"internal_tracker": {
"enable_time_tracker": true,
"allow_only_contributors_to_track_time": true,
"enable_issue_dependencies": true
},
"has_wiki": true,
"has_pull_requests": true,
"has_projects": true,
"projects_mode": "all",
"has_releases": true,
"has_packages": false,
"has_actions": true,
"ignore_whitespace_conflicts": false,
"allow_merge_commits": true,
"allow_rebase": true,
"allow_rebase_explicit": true,
"allow_squash_merge": true,
"allow_fast_forward_only_merge": true,
"allow_rebase_update": true,
"allow_manual_merge": false,
"autodetect_manual_merge": false,
"default_delete_branch_after_merge": false,
"default_merge_style": "merge",
"default_allow_maintainer_edit": false,
"avatar_url": "",
"internal": false,
"mirror_interval": "",
"object_format_name": "sha1",
"mirror_updated": "0001-01-01T00:00:00Z",
"topics": [],
"licenses": []
},
"sender": {
"id": 150382,
"login": "Aneesh-Hegde",
"login_name": "",
"source_id": 0,
"full_name": "",
"email": "Aneesh-Hegde@noreply.gitea.com",
"avatar_url": "https://seccdn.libravatar.org/avatar/466f1c45cb91f690a119741a0ffbb418?d=identicon",
"html_url": "https://gitea.com/Aneesh-Hegde",
"language": "",
"is_admin": false,
"last_login": "0001-01-01T00:00:00Z",
"created": "2025-10-10T19:39:18Z",
"restricted": false,
"active": false,
"prohibit_login": false,
"location": "",
"website": "",
"description": "",
"visibility": "public",
"followers_count": 0,
"following_count": 0,
"starred_repos_count": 0,
"username": "Aneesh-Hegde"
},
"commit_id": "",
"review": null
}

View File

@@ -51,6 +51,11 @@ class GiteaHookTests(WebhookTestCase):
expected_message = """kostekIV closed [PR #5](https://try.gitea.io/kostekIV/test/pulls/5) from `d` to `master`."""
self.check_webhook("pull_request__closed", expected_topic_name, expected_message)
def test_pull_request_closed_different_user(self) -> None:
expected_topic_name = "test / PR #126085 PR closed"
expected_message = """Aneesh-Hegde closed [PR #1](https://gitea.com/Aneesh-Hegde/test-repo/pulls/1) from `main` to `main`."""
self.check_webhook("pull_request__closed_diff_user", expected_topic_name, expected_message)
def test_pull_request_assigned(self) -> None:
expected_topic_name = "test / PR #1906 test 2"
expected_message = """kostekIV assigned kostekIV to [PR #5](https://try.gitea.io/kostekIV/test/pulls/5) from `d` to `master` (assigned to kostekIV)."""