Unverified Commit 9ad67dc2 authored by Paul Kaplan's avatar Paul Kaplan Committed by GitHub

Merge pull request #5684 from LLK/release/2021-06-30

Develop release/2021-06-30
parents 61e66acc e719d25e
......@@ -8,7 +8,7 @@ const isCurator = state => state.studio.curator;
const isManager = state => state.studio.manager || isCreator(state);
// Action-based permissions selectors
const selectCanEditInfo = state => !selectIsMuted(state) && (selectIsAdmin(state) || isManager(state));
const selectCanEditInfo = state => !selectIsMuted(state) && (selectIsAdmin(state) || isCreator(state));
const selectCanAddProjects = state =>
!selectIsMuted(state) &&
(isManager(state) ||
......@@ -71,7 +71,9 @@ const selectCanRemoveProject = (state, creatorUsername, actorId) => {
};
// We should only show the mute errors to muted users who have any permissions related to the content
const selectShowEditMuteError = state => selectIsMuted(state) && (isManager(state) || selectIsAdmin(state));
// TODO these duplicate the behavior embedded in the non-muted parts of the selectors above, it would be good
// to extract this.
const selectShowEditMuteError = state => selectIsMuted(state) && (isCreator(state) || selectIsAdmin(state));
const selectShowProjectMuteError = state => selectIsMuted(state) &&
(selectIsAdmin(state) ||
isManager(state) ||
......
......@@ -10,6 +10,7 @@ const UserProjectsTile = ({id, title, image, inStudio, onAdd, onRemove}) => {
const [added, setAdded] = useState(inStudio);
const {errorAlert} = useContext(AlertContext);
const toggle = () => {
if (submitting) return;
setSubmitting(true);
const adding = !added; // for clarity, the current action is opposite of previous state
(adding ? onAdd(id) : onRemove(id))
......
......@@ -23,6 +23,8 @@ const errorToMessageId = error => {
}
};
const TITLE_MAX_LENGTH = 52;
const StudioTitle = ({
titleError, isFetching, isMutating, isMutedEditor, title, canEditInfo, handleUpdate
}) => {
......@@ -52,6 +54,7 @@ const StudioTitle = ({
className={classNames('inplace-textarea', fieldClassName)}
disabled={isMutating || !canEditInfo || isFetching}
defaultValue={title}
maxLength={TITLE_MAX_LENGTH}
onKeyDown={e => e.key === 'Enter' && e.target.blur()}
onBlur={e => {
if (e.target.value !== title) handleUpdate(e.target.value);
......
......@@ -89,7 +89,7 @@ describe('studio info', () => {
test.each([
['admin', true],
['curator', false],
['manager', true],
['manager', false],
['creator', true],
['logged in', false],
['unconfirmed', false],
......@@ -503,7 +503,7 @@ describe('studio mute errors', () => {
['unconfirmed', false],
['logged out', false],
// ['muted creator', true], // This one fails; not sure why
['muted manager', true],
['muted manager', false],
['muted curator', false],
['muted logged in', false]
])('%s: %s', (role, expected) => {
......
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