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
daabddd8
Unverified
Commit
daabddd8
authored
Nov 30, 2018
by
Robert Knight
Committed by
GitHub
Nov 30, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #823 from hypothesis/hide-share-in-tutorial
Hide non-applicable tutorial steps for third party users
parents
c11835ec
b3037373
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
54 additions
and
4 deletions
+54
-4
sidebar-tutorial.js
src/sidebar/components/sidebar-tutorial.js
+18
-0
sidebar-tutorial-test.js
src/sidebar/components/test/sidebar-tutorial-test.js
+34
-2
sidebar-tutorial.html
src/sidebar/templates/sidebar-tutorial.html
+2
-2
No files found.
src/sidebar/components/sidebar-tutorial.js
View file @
daabddd8
'use strict'
;
'use strict'
;
const
sessionUtil
=
require
(
'../util/session-util'
);
const
sessionUtil
=
require
(
'../util/session-util'
);
const
isThirdPartyService
=
require
(
'../util/is-third-party-service'
);
// @ngInject
// @ngInject
function
SidebarTutorialController
(
session
,
settings
)
{
function
SidebarTutorialController
(
session
,
settings
)
{
// Compute once since this doesn't change after the app starts.
const
isThirdPartyService_
=
isThirdPartyService
(
settings
);
this
.
isThemeClean
=
settings
.
theme
===
'clean'
;
this
.
isThemeClean
=
settings
.
theme
===
'clean'
;
this
.
showSidebarTutorial
=
function
()
{
this
.
showSidebarTutorial
=
function
()
{
...
@@ -13,6 +17,20 @@ function SidebarTutorialController(session, settings) {
...
@@ -13,6 +17,20 @@ function SidebarTutorialController(session, settings) {
this
.
dismiss
=
function
()
{
this
.
dismiss
=
function
()
{
session
.
dismissSidebarTutorial
();
session
.
dismissSidebarTutorial
();
};
};
this
.
canCreatePrivateGroup
=
()
=>
{
// Private group creation in the client is limited to first party users.
// In future we may extend this to third party users, but still disable
// private group creation in certain contexts (eg. the LMS app).
return
!
isThirdPartyService_
;
};
this
.
canSharePage
=
()
=>
{
// The "Share document" icon in the toolbar is limited to first party users.
// In future we may extend this to third party users, but still disable it
// in certain contexts (eg. the LMS app).
return
!
isThirdPartyService_
;
};
}
}
/**
/**
...
...
src/sidebar/components/test/sidebar-tutorial-test.js
View file @
daabddd8
...
@@ -2,9 +2,17 @@
...
@@ -2,9 +2,17 @@
const
Controller
=
require
(
'../sidebar-tutorial'
).
controller
;
const
Controller
=
require
(
'../sidebar-tutorial'
).
controller
;
describe
(
'SidebarTutorialController'
,
function
()
{
describe
(
'sidebar/components/sidebar-tutorial'
,
function
()
{
const
defaultSession
=
{
state
:
{
preferences
:
{}}};
const
firstPartySettings
=
{};
const
thirdPartySettings
=
{
services
:
[{
authority
:
'publisher.org'
,
}],
};
describe
(
'showSidebarTutorial'
,
function
()
{
describe
(
'#showSidebarTutorial'
,
function
()
{
const
settings
=
{};
const
settings
=
{};
it
(
'returns true if show_sidebar_tutorial is true'
,
function
()
{
it
(
'returns true if show_sidebar_tutorial is true'
,
function
()
{
...
@@ -46,4 +54,28 @@ describe('SidebarTutorialController', function () {
...
@@ -46,4 +54,28 @@ describe('SidebarTutorialController', function () {
assert
.
equal
(
result
,
false
);
assert
.
equal
(
result
,
false
);
});
});
});
});
describe
(
'#canSharePage'
,
()
=>
{
it
(
'is true for first party users'
,
()
=>
{
const
controller
=
new
Controller
(
defaultSession
,
firstPartySettings
);
assert
.
isTrue
(
controller
.
canSharePage
());
});
it
(
'is false for third party users'
,
()
=>
{
const
controller
=
new
Controller
(
defaultSession
,
thirdPartySettings
);
assert
.
isFalse
(
controller
.
canSharePage
());
});
});
describe
(
'#canCreatePrivateGroup'
,
()
=>
{
it
(
'is true for first party users'
,
()
=>
{
const
controller
=
new
Controller
(
defaultSession
,
firstPartySettings
);
assert
.
isTrue
(
controller
.
canSharePage
());
});
it
(
'is false for third party users'
,
()
=>
{
const
controller
=
new
Controller
(
defaultSession
,
thirdPartySettings
);
assert
.
isFalse
(
controller
.
canSharePage
());
});
});
});
});
src/sidebar/templates/sidebar-tutorial.html
View file @
daabddd8
...
@@ -27,13 +27,13 @@
...
@@ -27,13 +27,13 @@
<i
class=
"h-icon-annotation-reply"
></i>
<strong>
Reply
</strong>
link.
<i
class=
"h-icon-annotation-reply"
></i>
<strong>
Reply
</strong>
link.
</p>
</p>
</li>
</li>
<li
class=
"sidebar-tutorial__list-item"
>
<li
class=
"sidebar-tutorial__list-item"
ng-if=
"vm.canSharePage()"
>
<p
class=
"sidebar-tutorial__list-item-content"
>
<p
class=
"sidebar-tutorial__list-item-content"
>
To share an annotated page, click the
To share an annotated page, click the
<i
class=
"h-icon-annotation-share"
></i>
button at the top.
<i
class=
"h-icon-annotation-share"
></i>
button at the top.
</p>
</p>
</li>
</li>
<li
class=
"sidebar-tutorial__list-item"
>
<li
class=
"sidebar-tutorial__list-item"
ng-if=
"vm.canCreatePrivateGroup()"
>
<p
class=
"sidebar-tutorial__list-item-content"
>
<p
class=
"sidebar-tutorial__list-item-content"
>
To create a private group, select
<strong>
Public
</strong>
,
To create a private group, select
<strong>
Public
</strong>
,
open the dropdown, click
<strong>
+
New
group
</strong>
.
open the dropdown, click
<strong>
+
New
group
</strong>
.
...
...
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