File tree Expand file tree Collapse file tree 3 files changed +23
-15
lines changed
Expand file tree Collapse file tree 3 files changed +23
-15
lines changed Original file line number Diff line number Diff line change @@ -43,8 +43,8 @@ extension ObjectPermissions {
4343 let isTemplate = details. isTemplate
4444 let isObjectType = details. isObjectType
4545
46- let caEditRelations = !isLocked && !isArchive && participantCanEdit && !isVersionMode
47- let canEdit = caEditRelations && !details. resolvedLayoutValue. isFileOrMedia
46+ let canEditRelations = !isLocked && !isArchive && participantCanEdit && !isVersionMode
47+ let canEdit = canEditRelations && !details. resolvedLayoutValue. isFileOrMedia
4848 let canApplyUneditableActions = participantCanEdit && !isArchive
4949
5050 let specificTypes = !details. resolvedLayoutValue. isList && !details. resolvedLayoutValue. isParticipant && !isObjectType
@@ -73,8 +73,8 @@ extension ObjectPermissions {
7373 self . canChangeIcon = details. resolvedLayoutValue. haveIcon && canEdit
7474 self . canChangeCover = details. resolvedLayoutValue. haveCover && canEdit && !isObjectType
7575 self . canChangeLayout = details. resolvedLayoutValue. isEditorLayout && canEdit // && !objectRestrictions.contains(.layoutChange)
76- self . canEditDetails = !objectRestrictions. contains ( . details)
77- self . canEditRelationValues = caEditRelations && canEditDetails
76+ self . canEditDetails = !objectRestrictions. contains ( . details) && participantCanEdit
77+ self . canEditRelationValues = canEditRelations && canEditDetails
7878 self . canEditPropertiesList = canEditRelationValues && !objectRestrictions. contains ( . relations)
7979 self . canShare = !isTemplate && !isObjectType
8080 self . canPublish = canShare && specificTypes && !isArchive
Original file line number Diff line number Diff line change @@ -36,20 +36,24 @@ struct ObjectTypeTemplatePickerView: View {
3636 . foregroundColor ( Color . Text. secondary)
3737
3838 Spacer ( )
39-
40- Button ( action: {
41- model. onAddTemplateTap ( )
42- } , label: {
43- IconView ( asset: . X24. plus) . frame ( width: 24 , height: 24 )
44- } )
39+
40+ if model. canEdit {
41+ Button ( action: {
42+ model. onAddTemplateTap ( )
43+ } , label: {
44+ IconView ( asset: . X24. plus) . frame ( width: 24 , height: 24 )
45+ } )
46+ }
4547 }
4648
4749 HStack {
48- Button {
49- model. onEditTap ( )
50- } label: {
51- AnytypeText ( model. isEditing ? Loc . done : Loc . edit, style: . previewTitle1Regular)
52- . foregroundColor ( Color . Text. secondary)
50+ if model. canEdit {
51+ Button {
52+ model. onEditTap ( )
53+ } label: {
54+ AnytypeText ( model. isEditing ? Loc . done : Loc . edit, style: . previewTitle1Regular)
55+ . foregroundColor ( Color . Text. secondary)
56+ }
5357 }
5458 Spacer ( )
5559 }
Original file line number Diff line number Diff line change @@ -10,6 +10,10 @@ final class ObjectTypeTemplatePickerViewModel: ObservableObject {
1010 @Published var templatesCount = 0
1111 @Published var toastBarData : ToastBarData ?
1212 @Published var isEditing = false
13+
14+ var canEdit : Bool {
15+ document. permissions. canEditDetails
16+ }
1317
1418 private var output : ( any EditorSetModuleOutput ) ?
1519 private let document : any BaseDocumentProtocol
You can’t perform that action at this time.
0 commit comments