Skip to content

Commit

Permalink
Address review
Browse files Browse the repository at this point in the history
Signed-off-by: Florian Hotze <[email protected]>
  • Loading branch information
florian-h05 committed Dec 23, 2024
1 parent c2ccfc0 commit bb2c72b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
</f7-block-footer>
<f7-list class="profile-list">
<f7-list-item radio v-for="profileType in profileTypes" class="profile-item"
:checked="(!currentProfileType && profileType.uid === 'system:default' && !itemTypeIsNotChannelType(channel, currentItem)) || (currentProfileType && profileType.uid === currentProfileType.uid)"
:checked="(!currentProfileType && profileType.uid === 'system:default' && itemTypeIsChannelType(currentItem, channel)) || (currentProfileType && profileType.uid === currentProfileType.uid)"
:disabled="!compatibleProfileTypes.includes(profileType)"
:class="{ 'profile-disabled': !compatibleProfileTypes.includes(profileType) }"
@change="onProfileTypeChange(profileType.uid)"
Expand Down Expand Up @@ -295,7 +295,7 @@ export default {
return
}
}
if (this.itemTypeIsNotChannelType(this.channel, this.currentItem) && (!this.currentProfileType || !this.compatibleProfileTypes.includes(this.currentProfileType))) {
if (!this.itemTypeIsChannelType(this.currentItem, this.channel) && (!this.currentProfileType || !this.compatibleProfileTypes.includes(this.currentProfileType))) {
this.$f7.dialog.alert('Please configure a valid profile')
return
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
export default {
methods: {
/**
* Check whether the type of the given Item does not match the type of the given channel.
* @param {object} channel
* Check whether the type of the given Item does match the type of the given channel.
* @param {object} item
* @param {object} channel
* @return {boolean}
*/
itemTypeIsNotChannelType (channel, item) {
if (!channel || !channel.itemType) return false
if (!item || !item.type) return false
itemTypeIsChannelType (item, channel) {
if (!channel || !channel.itemType) return true
if (!item || !item.type) return true
if (channel.itemType.startsWith('Number')) {
return !item.type.startsWith('Number')
return item.type.startsWith('Number')
}
return channel.itemType !== item.type
return channel.itemType === item.type
},
/**
* Check whether the given profileType is compatible with the given Item for the given channel.
Expand All @@ -23,7 +23,7 @@ export default {
* @return {boolean}
*/
isProfileTypeCompatible (channel, profileType, item) {
if (this.itemTypeIsNotChannelType(channel, item) && (profileType.uid === 'system:default' || profileType.uid === 'system:follow')) return false
if (!this.itemTypeIsChannelType(item, channel) && (profileType.uid === 'system:default' || profileType.uid === 'system:follow')) return false
if (!profileType.supportedItemTypes || profileType.supportedItemTypes.length === 0) return true
return profileType.supportedItemTypes.includes(item.type.split(':', 1)[0])
}
Expand Down

0 comments on commit bb2c72b

Please sign in to comment.