Skip to content

Commit

Permalink
fix(spaces): keep 'isAdmin' value on space update and set it to true …
Browse files Browse the repository at this point in the history
…on space creation
  • Loading branch information
NicolasRichel committed Apr 13, 2021
1 parent 713b9e4 commit 65e3a79
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,12 @@
:key="item[keyProp]"
@click="() => selectItem(item)"
>
<TextBox :text="item[labelProp]" :maxLength="24" cutOn="end" />
<TextBox
:text="item[labelProp]"
:maxLength="30"
cutOn="end"
:tooltip="false"
/>
</div>
</transition-group>
</div>
Expand Down
10 changes: 7 additions & 3 deletions src/components/generic/text-box/TextBox.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
>
{{ displayedText }}
<div
v-if="displayedText !== text"
v-if="tooltip && displayedText !== text"
v-show="showTooltip"
class="text-box__tooltip"
:class="[
`text-box__tooltip--${tooltipPosition}`,
`text-box__tooltip--${color}`
`text-box__tooltip--${tooltipColor}`
]"
>
{{ text }}
Expand Down Expand Up @@ -41,12 +41,16 @@ export default {
type: String,
default: "..."
},
tooltip: {
type: Boolean,
default: true
},
tooltipPosition: {
type: String,
default: "bottom",
validator: value => ["top", "right", "bottom", "left"].includes(value)
},
color: {
tooltipColor: {
type: String,
default: "primary",
validator: value => ["primary", "secondary", "tertiary"].includes(value)
Expand Down
6 changes: 4 additions & 2 deletions src/state/spaces.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const loadSpaceInvitations = async space => {

const createSpace = async space => {
const newSpace = await SpaceService.createSpace(space);
state.userSpaces = [newSpace].concat(state.userSpaces);
state.userSpaces = [{ ...newSpace, isAdmin: true }].concat(state.userSpaces);
return newSpace;
};

Expand All @@ -54,7 +54,9 @@ const updateSpace = async space => {
};

const softUpdateSpace = space => {
state.userSpaces = state.userSpaces.map(s => (s.id === space.id ? space : s));
state.userSpaces = state.userSpaces.map(s =>
s.id === space.id ? { ...s, ...space } : s
);
return space;
};

Expand Down

0 comments on commit 65e3a79

Please sign in to comment.