Added UI to unshare a view-only character with yourself
This commit is contained in:
@@ -21,7 +21,7 @@
|
||||
<v-icon>more_vert</v-icon>
|
||||
</v-btn>
|
||||
</template>
|
||||
<v-list>
|
||||
<v-list v-if="editPermission">
|
||||
<v-list-tile @click="deleteCharacter">
|
||||
<v-list-tile-title>
|
||||
<v-icon>delete</v-icon> Delete
|
||||
@@ -38,6 +38,13 @@
|
||||
</v-list-tile-title>
|
||||
</v-list-tile>
|
||||
</v-list>
|
||||
<v-list v-else>
|
||||
<v-list-tile @click="unshareWithMe">
|
||||
<v-list-tile-title>
|
||||
<v-icon>delete</v-icon> Unshare with me
|
||||
</v-list-tile-title>
|
||||
</v-list-tile>
|
||||
</v-list>
|
||||
</v-menu>
|
||||
</v-toolbar-items>
|
||||
</template>
|
||||
@@ -49,11 +56,18 @@ import isDarkColor from '/imports/ui/utility/isDarkColor.js';
|
||||
import { mapMutations } from 'vuex';
|
||||
import { theme } from '/imports/ui/theme.js';
|
||||
import { recomputeCreature } from '/imports/api/creature/computation/recomputeCreature.js';
|
||||
import { assertEditPermission } from '/imports/api/creature/creaturePermissions.js';
|
||||
import { updateUserSharePermissions } from '/imports/api/sharing/sharing.js';
|
||||
|
||||
export default {
|
||||
data(){return {
|
||||
theme,
|
||||
}},
|
||||
computed: {
|
||||
creatureId(){
|
||||
return this.$route.params.id;
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
...mapMutations([
|
||||
'toggleDrawer',
|
||||
@@ -103,12 +117,23 @@ export default {
|
||||
}
|
||||
});
|
||||
},
|
||||
isDarkColor,
|
||||
},
|
||||
computed: {
|
||||
creatureId(){
|
||||
return this.$route.params.id;
|
||||
unshareWithMe(){
|
||||
updateUserSharePermissions.call({
|
||||
docRef: {
|
||||
collection: 'creatures',
|
||||
id: this.creatureId,
|
||||
},
|
||||
userId: Meteor.userId(),
|
||||
role: 'none',
|
||||
}, (error) => {
|
||||
if (error) {
|
||||
console.error(error);
|
||||
} else {
|
||||
this.$router.push('/characterList');
|
||||
}
|
||||
});
|
||||
},
|
||||
isDarkColor,
|
||||
},
|
||||
meteor: {
|
||||
$subscribe: {
|
||||
@@ -119,6 +144,14 @@ export default {
|
||||
creature(){
|
||||
return Creatures.findOne(this.creatureId) || {};
|
||||
},
|
||||
editPermission(){
|
||||
try {
|
||||
assertEditPermission(this.creature, Meteor.userId());
|
||||
return true;
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user