[Calendar] Introduce permissions for editing events
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import server from "/@server/server.js"
|
||||
import server from "/calendar/@server/calendar.js"
|
||||
import calendarUtil from "../calendarUtil.js"
|
||||
import "./EventForm.js"
|
||||
import "../../components/BottomSheet.js"
|
||||
@@ -39,10 +39,11 @@ class EventDetails extends Shadow {
|
||||
render() {
|
||||
this.editSheet = BottomSheet(100) // separate sheet for the edit form, layered above this one
|
||||
|
||||
const isOwner = this.event?.creator_id === global.profile?.id;
|
||||
// Editing is currently owner-only: this flag gates the mobile Edit/Delete actions.
|
||||
const canEdit = global.currentNetwork.permissions.includes("events.edit")
|
||||
|
||||
VStack(() => {
|
||||
this.renderHeader(isOwner)
|
||||
this.renderHeader(canEdit)
|
||||
|
||||
// ── Error toast ───────────────────────────────────────
|
||||
VStack(() => {
|
||||
@@ -276,11 +277,12 @@ class EventDetails extends Shadow {
|
||||
.height(100, pct)
|
||||
}
|
||||
|
||||
renderHeader(isOwner) {
|
||||
renderHeader(canEdit) {
|
||||
VStack(() => {
|
||||
HStack(() => {
|
||||
BackButton(false, true, () => $("bottomsheet-").toggle())
|
||||
if (isOwner) {
|
||||
// Non-owners never see the controls that open the edit sheet or delete flow.
|
||||
if (canEdit) {
|
||||
HStack(() => {
|
||||
// ── Delete button ─────────────────────────────────
|
||||
button("Delete")
|
||||
|
||||
Reference in New Issue
Block a user