Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
coopwire-hypothesis
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
孙灵跃 Leon Sun
coopwire-hypothesis
Commits
a432922f
Commit
a432922f
authored
Dec 15, 2023
by
Robert Knight
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove page_numbers feature flag
This is now enabled for everyone.
parent
8e1232ee
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
29 deletions
+18
-29
AnnotationHeader.tsx
src/sidebar/components/Annotation/AnnotationHeader.tsx
+2
-3
AnnotationHeader-test.js
...debar/components/Annotation/test/AnnotationHeader-test.js
+16
-26
No files found.
src/sidebar/components/Annotation/AnnotationHeader.tsx
View file @
a432922f
...
@@ -55,7 +55,6 @@ function AnnotationHeader({
...
@@ -55,7 +55,6 @@ function AnnotationHeader({
const
defaultAuthority
=
store
.
defaultAuthority
();
const
defaultAuthority
=
store
.
defaultAuthority
();
const
displayNamesEnabled
=
store
.
isFeatureEnabled
(
'client_display_names'
);
const
displayNamesEnabled
=
store
.
isFeatureEnabled
(
'client_display_names'
);
const
userURL
=
store
.
getLink
(
'user'
,
{
user
:
annotation
.
user
});
const
userURL
=
store
.
getLink
(
'user'
,
{
user
:
annotation
.
user
});
const
pageNumbersEnabled
=
store
.
isFeatureEnabled
(
'page_numbers'
);
const
authorName
=
useMemo
(
const
authorName
=
useMemo
(
()
=>
()
=>
...
@@ -107,10 +106,10 @@ function AnnotationHeader({
...
@@ -107,10 +106,10 @@ function AnnotationHeader({
// contexts where it is the same for all cards and is shown elsewhere in the
// contexts where it is the same for all cards and is shown elsewhere in the
// UI (eg. the top bar). This is to reduce visual clutter.
// UI (eg. the top bar). This is to reduce visual clutter.
let
group
;
let
group
;
if
(
!
pageNumbersEnabled
||
store
.
route
()
!==
'sidebar'
)
{
if
(
store
.
route
()
!==
'sidebar'
)
{
group
=
store
.
getGroup
(
annotation
.
group
);
group
=
store
.
getGroup
(
annotation
.
group
);
}
}
const
pageNumber
=
pageNumbersEnabled
?
getPageLabel
(
annotation
)
:
undefined
;
const
pageNumber
=
getPageLabel
(
annotation
)
;
return
(
return
(
<
header
>
<
header
>
...
...
src/sidebar/components/Annotation/test/AnnotationHeader-test.js
View file @
a432922f
...
@@ -36,7 +36,6 @@ describe('AnnotationHeader', () => {
...
@@ -36,7 +36,6 @@ describe('AnnotationHeader', () => {
beforeEach
(()
=>
{
beforeEach
(()
=>
{
activeFeatures
=
{
activeFeatures
=
{
client_display_names
:
true
,
client_display_names
:
true
,
page_numbers
:
false
,
};
};
fakeAnnotationAuthorLink
=
sinon
fakeAnnotationAuthorLink
=
sinon
...
@@ -331,14 +330,23 @@ describe('AnnotationHeader', () => {
...
@@ -331,14 +330,23 @@ describe('AnnotationHeader', () => {
});
});
});
});
describe
(
'Annotation share info'
,
()
=>
{
describe
(
'Annotation group info'
,
()
=>
{
it
(
'should render annotation share/group information if group is available'
,
()
=>
{
[
{
route
:
'sidebar'
,
groupVisible
:
false
},
{
route
:
'notebook'
,
groupVisible
:
true
},
].
forEach
(({
route
,
groupVisible
})
=>
{
it
(
'should render group if not in sidebar'
,
()
=>
{
fakeStore
.
route
.
returns
(
route
);
const
wrapper
=
createAnnotationHeader
();
const
wrapper
=
createAnnotationHeader
();
assert
.
equal
(
assert
.
isTrue
(
wrapper
.
find
(
'AnnotationShareInfo'
).
exists
());
wrapper
.
find
(
'AnnotationShareInfo'
).
exists
(),
groupVisible
,
);
});
});
});
it
(
'should not render annotation share/group information if group is unavailable'
,
()
=>
{
it
(
'should not render group if unavailable'
,
()
=>
{
fakeStore
.
route
.
returns
(
'notebook'
);
fakeStore
.
getGroup
.
returns
(
undefined
);
fakeStore
.
getGroup
.
returns
(
undefined
);
const
wrapper
=
createAnnotationHeader
();
const
wrapper
=
createAnnotationHeader
();
...
@@ -452,10 +460,8 @@ describe('AnnotationHeader', () => {
...
@@ -452,10 +460,8 @@ describe('AnnotationHeader', () => {
});
});
});
});
context
(
'when page_numbers feature is enabled
'
,
()
=>
{
describe
(
'page numbers
'
,
()
=>
{
beforeEach
(()
=>
{
beforeEach
(()
=>
{
activeFeatures
.
page_numbers
=
true
;
// Un-mock the `pageLabel` function.
// Un-mock the `pageLabel` function.
$imports
.
$restore
({
$imports
.
$restore
({
'../../helpers/annotation-metadata'
:
true
,
'../../helpers/annotation-metadata'
:
true
,
...
@@ -480,22 +486,6 @@ describe('AnnotationHeader', () => {
...
@@ -480,22 +486,6 @@ describe('AnnotationHeader', () => {
assert
.
isTrue
(
pageNumber
.
exists
());
assert
.
isTrue
(
pageNumber
.
exists
());
assert
.
equal
(
pageNumber
.
text
(),
'p. 11'
);
assert
.
equal
(
pageNumber
.
text
(),
'p. 11'
);
});
});
it
(
'should hide group name in sidebar'
,
()
=>
{
fakeStore
.
route
.
returns
(
'sidebar'
);
const
wrapper
=
createAnnotationHeader
({
annotation
:
fixtures
.
defaultAnnotation
(),
});
assert
.
isFalse
(
wrapper
.
exists
(
'AnnotationShareInfo'
));
});
it
(
'should still show group name outside the sidebar'
,
()
=>
{
fakeStore
.
route
.
returns
(
'annotation'
);
const
wrapper
=
createAnnotationHeader
({
annotation
:
fixtures
.
defaultAnnotation
(),
});
assert
.
isTrue
(
wrapper
.
exists
(
'AnnotationShareInfo'
));
});
});
});
it
(
it
(
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment