Commit c569dc29 authored by Giannis Kopanas's avatar Giannis Kopanas Committed by Alexandros Georgantas

fix(navigation): fix navigation of editor link

parent 5a607d7d
......@@ -382,10 +382,11 @@ const unlockBookComponent = async (_, { input }, ctx) => {
const locks = await Lock.query()
.where('foreignId', id)
.andWhere('deleted', false)
await Lock.query().patchAndFetchById(locks[0].id, {
deleted: true,
})
if (locks.length > 0) {
await Lock.query().patchAndFetchById(locks[0].id, {
deleted: true,
})
}
const updatedBookComponent = await BookComponent.findById(id)
pubsub.publish(BOOK_COMPONENT_LOCK_UPDATED, {
......
......@@ -29,15 +29,15 @@ const mapper = {
getBookComponentQuery,
getWaxRulesQuery,
getUserTeamsQuery,
trackChangeSubscription,
lockChangeSubscription,
orderChangeSubscription,
updateBookComponentContentMutation,
updateBookComponentTrackChangesMutation,
lockBookComponentMutation,
unlockBookComponentMutation,
uploadFileMutation,
renameBookComponentMutation,
trackChangeSubscription,
lockChangeSubscription,
orderChangeSubscription,
}
const getUserWithColor = (teams = []) => {
......@@ -93,6 +93,7 @@ const Connected = props => {
bookComponentId={bookComponentId}
bookId={bookId}
currentUser={currentUser}
key={bookComponentId}
>
{({
bookComponent,
......@@ -118,6 +119,8 @@ const Connected = props => {
const lock = get(bookComponent, 'lock')
if (lock && lock.userId !== currentUser.id) {
editing = 'preview'
} else if (rules.canEditPreview) {
editing = 'preview'
} else if (rules.canEditFull) {
editing = 'full'
} else if (rules.canEditSelection) {
......@@ -126,6 +129,10 @@ const Connected = props => {
editing = 'review'
}
// if (lock && lock.userId === currentUser.id) {
// editing = 'preview'
// }
return (
<WaxPubsweet
bookComponent={bookComponent}
......
......@@ -47,13 +47,13 @@ const WaxHeader = ({ bookComponent }) => {
<Header>
{prevBookComponent && (
<div data-testid="previous-component">
withLink(prevBookComponent.title, createUrl(prevBookComponent))
{withLink(prevBookComponent.title, createUrl(prevBookComponent))}
</div>
)}
{header}
{nextBookComponent && (
<div data-testid="next-component">
withLink(nextBookComponent.title, createUrl(nextBookComponent))
{withLink(nextBookComponent.title, createUrl(nextBookComponent))}
</div>
)}
</Header>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment