UBERF-6486 Lock document content (#5799)

Signed-off-by: Alexander Onnikov <Alexander.Onnikov@xored.com>
This commit is contained in:
Alexander Onnikov
2024-06-13 13:27:59 +07:00
committed by GitHub
parent bf969fb27d
commit a409cfafb3
13 changed files with 142 additions and 9 deletions
+42
View File
@@ -96,6 +96,10 @@ export class TDocument extends TAttachedDoc implements Document {
@Hidden()
content!: CollaborativeDoc
@Prop(TypeRef(core.class.Account), document.string.LockedBy)
@Hidden()
lockedBy?: Ref<Account>
@Prop(Collection(document.class.Document), document.string.ChildDocument)
children!: CollectionSize<Document>
@@ -373,6 +377,44 @@ function defineDocument (builder: Builder): void {
document.action.CopyDocumentLink
)
createAction(
builder,
{
action: document.actionImpl.LockContent,
label: document.string.Lock,
icon: document.icon.Lock,
input: 'focus',
category: document.category.Document,
target: document.class.Document,
context: {
mode: ['context', 'browser'],
application: document.app.Documents,
group: 'copy'
},
visibilityTester: document.function.CanLockDocument
},
document.action.LockContent
)
createAction(
builder,
{
action: document.actionImpl.UnlockContent,
label: document.string.Unlock,
icon: document.icon.Unlock,
input: 'focus',
category: document.category.Document,
target: document.class.Document,
context: {
mode: ['context', 'browser'],
application: document.app.Documents,
group: 'copy'
},
visibilityTester: document.function.CanUnlockDocument
},
document.action.UnlockContent
)
// Notifications
builder.mixin(document.class.Document, core.class.Class, activity.mixin.ActivityDoc, {})
+12 -3
View File
@@ -40,10 +40,18 @@ export default mergeIds(documentId, document, {
actionImpl: {
CreateChildDocument: '' as ViewAction,
CreateDocument: '' as ViewAction,
EditTeamspace: '' as ViewAction
EditTeamspace: '' as ViewAction,
LockContent: '' as ViewAction,
UnlockContent: '' as ViewAction
},
action: {
PublicLink: '' as Ref<Action<Doc, any>>
PublicLink: '' as Ref<Action<Doc, any>>,
LockContent: '' as Ref<Action<Doc, any>>,
UnlockContent: '' as Ref<Action<Doc, any>>
},
function: {
CanLockDocument: '' as Resource<(doc?: Doc | Doc[]) => Promise<boolean>>,
CanUnlockDocument: '' as Resource<(doc?: Doc | Doc[]) => Promise<boolean>>
},
viewlet: {
TeamspaceTable: '' as Ref<Viewlet>
@@ -55,6 +63,7 @@ export default mergeIds(documentId, document, {
string: {
ConfigDescription: '' as IntlString,
ParentDocument: '' as IntlString,
ChildDocument: '' as IntlString
ChildDocument: '' as IntlString,
LockedBy: '' as IntlString
}
})