Thanks to visit codestin.com
Credit goes to github.com

Skip to content
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
53 changes: 42 additions & 11 deletions frappe/desk/doctype/event/event.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,14 @@
"event_category",
"event_type",
"color",
"send_reminder",
"repeat_this_event",
"location",
"column_break_4",
"starts_on",
"ends_on",
"status",
"sender",
"attending",
"all_day",
"sync_with_google_calendar",
"add_video_conferencing",
Expand All @@ -43,14 +44,18 @@
"sunday",
"section_break_8",
"description",
"participants",
"participants_tab",
"event_participants",
"links_tab",
"section_break_jlqd",
"reference_doctype",
"column_break_pjkw",
"reference_docname",
"section_break_qemp",
"links"
"links",
"notifications_tab",
"send_reminder",
"notifications"
],
"fields": [
{
Expand Down Expand Up @@ -210,12 +215,6 @@
"print_width": "300px",
"width": "300px"
},
{
"fieldname": "participants",
"fieldtype": "Section Break",
"label": "Participants",
"oldfieldtype": "Section Break"
},
{
"fieldname": "event_participants",
"fieldtype": "Table",
Expand Down Expand Up @@ -327,14 +326,46 @@
{
"fieldname": "section_break_qemp",
"fieldtype": "Section Break"
},
{
"fieldname": "notifications_tab",
"fieldtype": "Tab Break",
"label": "Notifications"
},
{
"fieldname": "notifications",
"fieldtype": "Table",
"label": "Notifications",
"options": "Event Notifications"
},
{
"fieldname": "location",
"fieldtype": "Data",
"label": "Location"
},
{
"fieldname": "participants_tab",
"fieldtype": "Tab Break",
"label": "Participants"
},
{
"fieldname": "links_tab",
"fieldtype": "Tab Break",
"label": "Links"
},
{
"fieldname": "attending",
"fieldtype": "Select",
"label": "Attending",
"options": "\nYes\nNo\nMaybe"
}
],
"grid_page_length": 50,
"icon": "fa fa-calendar",
"idx": 1,
"links": [],
"modified": "2025-08-12 13:37:36.319985",
"modified_by": "Administrator",
"modified": "2025-10-07 08:53:24.732646",
"modified_by": "[email protected]",
"module": "Desk",
"name": "Event",
"naming_rule": "Expression (old style)",
Expand Down
34 changes: 32 additions & 2 deletions frappe/desk/doctype/event/event.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,13 @@ class Event(Document):

if TYPE_CHECKING:
from frappe.core.doctype.dynamic_link.dynamic_link import DynamicLink
from frappe.desk.doctype.event_notifications.event_notifications import EventNotifications
from frappe.desk.doctype.event_participants.event_participants import EventParticipants
from frappe.types import DF

add_video_conferencing: DF.Check
all_day: DF.Check
attending: DF.Literal["", "Yes", "No", "Maybe"]
color: DF.Color | None
description: DF.TextEditor | None
ends_on: DF.Datetime | None
Expand All @@ -68,9 +70,11 @@ class Event(Document):
google_calendar: DF.Link | None
google_calendar_event_id: DF.Data | None
google_calendar_id: DF.Data | None
google_meet_link: DF.Data | None
google_meet_link: DF.SmallText | None
links: DF.Table[DynamicLink]
location: DF.Data | None
monday: DF.Check
notifications: DF.Table[EventNotifications]
pulled_from_google_calendar: DF.Check
reference_docname: DF.DynamicLink | None
reference_doctype: DF.Link | None
Expand Down Expand Up @@ -210,6 +214,23 @@ def set_participants_email(self):
)


@frappe.whitelist()
def update_attending_status(event_name, attendee, status):
event_doc = frappe.get_doc("Event", event_name)

if event_doc.owner == attendee == frappe.session.user:
frappe.db.set_value("Event", event_name, "attending", status)
return

for participant in event_doc.event_participants:
if participant.email == attendee:
frappe.db.set_value("Event Participants", participant.name, "attending", status)
return

if not has_permission(event_doc, user=attendee):
frappe.throw(_("You are not allowed to update the status of this event."))


@frappe.whitelist()
def delete_communication(event, reference_doctype, reference_docname):
if isinstance(event, str):
Expand Down Expand Up @@ -238,13 +259,22 @@ def get_permission_query_conditions(user):
query = f"""(`tabEvent`.`event_type`='Public' or `tabEvent`.`owner`={frappe.db.escape(user)})"""
if shared_events := frappe.share.get_shared("Event", user=user):
query += f" or `tabEvent`.`name` in ({', '.join([frappe.db.escape(e) for e in shared_events])})"

query += f" or exists (select 'x' from `tabEvent Participants` ep where ep.parent=`tabEvent`.name and ep.email={frappe.db.escape(user)})"

return query


def has_permission(doc, user):
def has_permission(doc, ptype=None, user=None):
if doc.event_type == "Public" or doc.owner == user:
return True

for participant in doc.event_participants:
if participant.email == user:
if ptype in ["write", "create", "delete"]:
return False
return True

return False


Expand Down
Empty file.
57 changes: 57 additions & 0 deletions frappe/desk/doctype/event_notifications/event_notifications.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{
"actions": [],
"allow_rename": 1,
"creation": "2025-10-01 14:19:43.271468",
"doctype": "DocType",
"editable_grid": 1,
"engine": "InnoDB",
"field_order": [
"type",
"before",
"interval",
"time"
],
"fields": [
{
"default": "Notification",
"fieldname": "type",
"fieldtype": "Select",
"in_list_view": 1,
"label": "Type",
"options": "Notification\nEmail"
},
{
"fieldname": "before",
"fieldtype": "Int",
"in_list_view": 1,
"label": "Before"
},
{
"fieldname": "interval",
"fieldtype": "Select",
"in_list_view": 1,
"label": "Interval"
},
{
"fieldname": "time",
"fieldtype": "Time",
"in_list_view": 1,
"label": "Time"
}
],
"grid_page_length": 50,
"index_web_pages_for_search": 1,
"istable": 1,
"links": [],
"modified": "2025-10-01 14:26:21.526868",
"modified_by": "Administrator",
"module": "Desk",
"name": "Event Notifications",
"owner": "Administrator",
"permissions": [],
"row_format": "Dynamic",
"rows_threshold_for_grid_search": 20,
"sort_field": "creation",
"sort_order": "DESC",
"states": []
}
26 changes: 26 additions & 0 deletions frappe/desk/doctype/event_notifications/event_notifications.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Copyright (c) 2025, Frappe Technologies and contributors
# For license information, please see license.txt

# import frappe
from frappe.model.document import Document


class EventNotifications(Document):
# begin: auto-generated types
# This code is auto-generated. Do not modify anything in this block.

from typing import TYPE_CHECKING

if TYPE_CHECKING:
from frappe.types import DF

before: DF.Int
interval: DF.Literal[None]
parent: DF.Data
parentfield: DF.Data
parenttype: DF.Data
time: DF.Time | None
type: DF.Literal["Notification", "Email"]
# end: auto-generated types

pass
17 changes: 13 additions & 4 deletions frappe/desk/doctype/event_participants/event_participants.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"field_order": [
"reference_doctype",
"reference_docname",
"email"
"email",
"attending"
],
"fields": [
{
Expand All @@ -31,19 +32,27 @@
"fieldtype": "Data",
"label": "Email",
"options": "Email"
},
{
"fieldname": "attending",
"fieldtype": "Select",
"in_list_view": 1,
"label": "Attending",
"options": "\nYes\nNo\nMaybe"
}
],
"istable": 1,
"links": [],
"modified": "2024-03-23 16:03:25.717745",
"modified_by": "Administrator",
"modified": "2025-10-06 15:03:36.186683",
"modified_by": "[email protected]",
"module": "Desk",
"name": "Event Participants",
"owner": "Administrator",
"permissions": [],
"quick_entry": 1,
"row_format": "Dynamic",
"sort_field": "creation",
"sort_order": "DESC",
"states": [],
"track_changes": 1
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ class EventParticipants(Document):
if TYPE_CHECKING:
from frappe.types import DF

attending: DF.Literal["", "Yes", "No", "Maybe"]
email: DF.Data | None
parent: DF.Data
parentfield: DF.Data
Expand Down
Loading