Skip to content

Commit 8c842c3

Browse files
MichaelBuessemeyerMichael Büßemeyer
andauthored
Only show locked banner if current user is in organization of the annotation (#8273)
* only show locked banner if current user is in organization of the annotation * remove debugger statements * add changelog entry --------- Co-authored-by: Michael Büßemeyer <frameworklinux+MichaelBuessemeyer@users.noreply.github.com>
1 parent 43fe639 commit 8c842c3

File tree

6 files changed

+24
-2
lines changed

6 files changed

+24
-2
lines changed

CHANGELOG.unreleased.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ For upgrade instructions, please check the [migration guide](MIGRATIONS.released
2323

2424
### Fixed
2525
- Fixed that listing datasets with the `api/datasets` route without compression failed due to missing permissions regarding public datasets. [#8249](https://github.com/scalableminds/webknossos/pull/8249)
26+
- A "Locked by anonymous user" banner is no longer shown when opening public editable annotations of other organizations. [#8273](https://github.com/scalableminds/webknossos/pull/8273)
2627
- Fixed a bug that uploading a zarr dataset with an already existing `datasource-properties.json` file failed. [#8268](https://github.com/scalableminds/webknossos/pull/8268)
2728
- Fixed the organization switching feature for datasets opened via old links. [#8257](https://github.com/scalableminds/webknossos/pull/8257)
2829
- Fixed that the frontend did not ensure a minium length for annotation layer names. Moreover, names starting with a `.` are also disallowed now. [#8244](https://github.com/scalableminds/webknossos/pull/8244)

frontend/javascripts/navbar.tsx

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,10 @@ import constants from "oxalis/constants";
6464
import { MaintenanceBanner, UpgradeVersionBanner } from "banners";
6565
import { getAntdTheme, getSystemColorTheme } from "theme";
6666
import { formatUserName } from "oxalis/model/accessors/user_accessor";
67-
import { isAnnotationOwner as isAnnotationOwnerAccessor } from "oxalis/model/accessors/annotation_accessor";
67+
import {
68+
isAnnotationFromDifferentOrganization,
69+
isAnnotationOwner as isAnnotationOwnerAccessor,
70+
} from "oxalis/model/accessors/annotation_accessor";
6871

6972
const { Header } = Layout;
7073

@@ -85,6 +88,7 @@ type StateProps = {
8588
othersMayEdit: boolean;
8689
allowUpdate: boolean;
8790
isLockedByOwner: boolean;
91+
isAnnotationFromDifferentOrganization: boolean;
8892
isAnnotationOwner: boolean;
8993
annotationOwnerName: string;
9094
blockedByUser: APIUserCompact | null | undefined;
@@ -813,6 +817,7 @@ function Navbar({
813817
allowUpdate,
814818
annotationOwnerName,
815819
isLockedByOwner,
820+
isAnnotationFromDifferentOrganization,
816821
navbarHeight,
817822
isAnnotationOwner,
818823
}: Props) {
@@ -877,7 +882,12 @@ function Navbar({
877882
menuItems.push(getTimeTrackingMenu(collapseAllNavItems));
878883
}
879884

880-
if (othersMayEdit && !allowUpdate && !isLockedByOwner) {
885+
if (
886+
othersMayEdit &&
887+
!allowUpdate &&
888+
!isLockedByOwner &&
889+
!isAnnotationFromDifferentOrganization
890+
) {
881891
trailingNavItems.push(
882892
<AnnotationLockedByUserTag
883893
key="locked-by-user-tag"
@@ -1008,6 +1018,7 @@ const mapStateToProps = (state: OxalisState): StateProps => ({
10081018
isLockedByOwner: state.tracing.isLockedByOwner,
10091019
annotationOwnerName: formatUserName(state.activeUser, state.tracing.owner),
10101020
isAnnotationOwner: isAnnotationOwnerAccessor(state),
1021+
isAnnotationFromDifferentOrganization: isAnnotationFromDifferentOrganization(state),
10111022
navbarHeight: state.uiInformation.navbarHeight,
10121023
});
10131024

frontend/javascripts/oxalis/default_state.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,7 @@ const defaultState: OxalisState = {
178178
othersMayEdit: false,
179179
blockedByUser: null,
180180
annotationLayers: [],
181+
organization: "",
181182
},
182183
save: {
183184
queue: {

frontend/javascripts/oxalis/model/accessors/annotation_accessor.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@ export function isAnnotationOwner(state: OxalisState) {
2424
return !!(activeUser && owner?.id === activeUser.id);
2525
}
2626

27+
export function isAnnotationFromDifferentOrganization(state: OxalisState) {
28+
const activeUser = state.activeUser;
29+
30+
return !!(activeUser && activeUser?.organization !== state.tracing.organization);
31+
}
32+
2733
export type SkeletonTracingStats = {
2834
treeCount: number;
2935
nodeCount: number;

frontend/javascripts/oxalis/model/reducers/reducer_helpers.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ export function convertServerAnnotationToFrontendAnnotation(annotation: APIAnnot
9595
tracingStore,
9696
owner,
9797
contributors,
98+
organization,
9899
othersMayEdit,
99100
isLockedByOwner,
100101
annotationLayers,
@@ -108,6 +109,7 @@ export function convertServerAnnotationToFrontendAnnotation(annotation: APIAnnot
108109
description,
109110
name,
110111
annotationType,
112+
organization,
111113
isLockedByOwner,
112114
tracingStore,
113115
owner,

frontend/javascripts/oxalis/store.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,7 @@ export type Annotation = {
197197
readonly tags: Array<string>;
198198
readonly description: string;
199199
readonly name: string;
200+
readonly organization: string;
200201
readonly tracingStore: APITracingStore;
201202
readonly annotationType: APIAnnotationType;
202203
readonly owner: APIUserBase | null | undefined;

0 commit comments

Comments
 (0)