Skip to content

Commit

Permalink
fix: Fix Click to contributions item from achievement drawer - MEED-7826
Browse files Browse the repository at this point in the history
 - Meeds-io/MIPs#154

Prior to this change, no option possible to see the contribution from reward admin page when open contribution drawer detail.
  • Loading branch information
AzmiTouil committed Nov 20, 2024
1 parent 72d0813 commit 5d380da
Showing 1 changed file with 22 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ export default {
hour: 'numeric',
minute: 'numeric',
},
actionValueExtensions: {},
extensionApp: 'engagementCenterActions',
actionValueExtensionType: 'user-actions',
}),
computed: {
isManualType() {
Expand Down Expand Up @@ -93,8 +96,7 @@ export default {
return this.realization?.objectType;
},
actionValueExtension() {
return this.actionEventName
&& this.$root.actionValueExtensions && Object.values(this.$root.actionValueExtensions)
return this.actionEventName && Object.values(this.actionValueExtensions)
.sort((ext1, ext2) => (ext1.rank || 0) - (ext2.rank || 0))
.find(extension => extension?.match?.(this.actionEventName))
|| null;
Expand All @@ -113,13 +115,18 @@ export default {
},
},
created() {
this.$root.$on('rule-actions-updated', this.refreshExtensions);
this.refreshExtensions();
Promise.resolve(this.retrieveRealizationLink())
.finally(() => {
if (!this.realizationLink) {
this.realizationLink = this.realization?.link || this.realization?.url;
}
});
},
beforeDestroy() {
this.$root.$off('rule-actions-updated', this.refreshExtensions);
},
methods: {
retrieveRealizationLink() {
if (this.isManualType) {
Expand All @@ -130,6 +137,19 @@ export default {
this.realizationLink = this.realization.objectId;
}
},
refreshExtensions() {
if (this.$root.actionValueExtensions && Object.keys(this.$root.actionValueExtensions).length) {
this.actionValueExtensions = this.$root.actionValueExtensions;
} else {
this.$utils.includeExtensions('engagementCenterActions');
const extensions = extensionRegistry.loadExtensions(this.extensionApp, this.actionValueExtensionType);
extensions.forEach(extension => {
if (extension.type && extension.options && (!this.actionValueExtensions[extension.type] || this.actionValueExtensions[extension.type] !== extension.options)) {
this.$set(this.actionValueExtensions, extension.type, extension.options);
}
});
}
},
}
};
</script>

0 comments on commit 5d380da

Please sign in to comment.