diff options
Diffstat (limited to 'app/assets/javascripts/contribution_events/components')
6 files changed, 67 insertions, 3 deletions
diff --git a/app/assets/javascripts/contribution_events/components/contribution_event/contribution_event_created.vue b/app/assets/javascripts/contribution_events/components/contribution_event/contribution_event_created.vue index 7915cd6679d..fe9b2f81f85 100644 --- a/app/assets/javascripts/contribution_events/components/contribution_event/contribution_event_created.vue +++ b/app/assets/javascripts/contribution_events/components/contribution_event/contribution_event_created.vue @@ -24,7 +24,7 @@ export default { return this.event.resource_parent; }, message() { - if (!this.target) { + if (!this.target.type) { return EVENT_CREATED_I18N[this.resourceParent.type] || EVENT_CREATED_I18N[TYPE_FALLBACK]; } diff --git a/app/assets/javascripts/contribution_events/components/contribution_event/contribution_event_destroyed.vue b/app/assets/javascripts/contribution_events/components/contribution_event/contribution_event_destroyed.vue new file mode 100644 index 00000000000..11b6affb944 --- /dev/null +++ b/app/assets/javascripts/contribution_events/components/contribution_event/contribution_event_destroyed.vue @@ -0,0 +1,28 @@ +<script> +import { EVENT_DESTROYED_I18N, EVENT_DESTROYED_ICONS } from '../../constants'; +import { getValueByEventTarget } from '../../utils'; +import ContributionEventBase from './contribution_event_base.vue'; + +export default { + name: 'ContributionEventDestroyed', + components: { ContributionEventBase }, + props: { + event: { + type: Object, + required: true, + }, + }, + computed: { + message() { + return getValueByEventTarget(EVENT_DESTROYED_I18N, this.event); + }, + iconName() { + return getValueByEventTarget(EVENT_DESTROYED_ICONS, this.event); + }, + }, +}; +</script> + +<template> + <contribution-event-base :event="event" :message="message" :icon-name="iconName" /> +</template> diff --git a/app/assets/javascripts/contribution_events/components/contribution_event/contribution_event_pushed.vue b/app/assets/javascripts/contribution_events/components/contribution_event/contribution_event_pushed.vue index 557f2912f17..a2516f37c92 100644 --- a/app/assets/javascripts/contribution_events/components/contribution_event/contribution_event_pushed.vue +++ b/app/assets/javascripts/contribution_events/components/contribution_event/contribution_event_pushed.vue @@ -53,7 +53,8 @@ export default { message() { if (this.ref.is_new) { return this.$options.i18n.new[this.ref.type]; - } else if (this.ref.is_removed) { + } + if (this.ref.is_removed) { return this.$options.i18n.removed[this.ref.type]; } diff --git a/app/assets/javascripts/contribution_events/components/contribution_event/contribution_event_updated.vue b/app/assets/javascripts/contribution_events/components/contribution_event/contribution_event_updated.vue new file mode 100644 index 00000000000..e795e611ee5 --- /dev/null +++ b/app/assets/javascripts/contribution_events/components/contribution_event/contribution_event_updated.vue @@ -0,0 +1,25 @@ +<script> +import { EVENT_UPDATED_I18N } from '../../constants'; +import { getValueByEventTarget } from '../../utils'; +import ContributionEventBase from './contribution_event_base.vue'; + +export default { + name: 'ContributionEventUpdated', + components: { ContributionEventBase }, + props: { + event: { + type: Object, + required: true, + }, + }, + computed: { + message() { + return getValueByEventTarget(EVENT_UPDATED_I18N, this.event); + }, + }, +}; +</script> + +<template> + <contribution-event-base :event="event" :message="message" icon-name="pencil" /> +</template> diff --git a/app/assets/javascripts/contribution_events/components/contribution_events.vue b/app/assets/javascripts/contribution_events/components/contribution_events.vue index 8b42d77675f..f3116717783 100644 --- a/app/assets/javascripts/contribution_events/components/contribution_events.vue +++ b/app/assets/javascripts/contribution_events/components/contribution_events.vue @@ -12,6 +12,8 @@ import { EVENT_TYPE_CLOSED, EVENT_TYPE_REOPENED, EVENT_TYPE_COMMENTED, + EVENT_TYPE_UPDATED, + EVENT_TYPE_DESTROYED, } from '../constants'; import ContributionEventApproved from './contribution_event/contribution_event_approved.vue'; import ContributionEventExpired from './contribution_event/contribution_event_expired.vue'; @@ -24,6 +26,8 @@ import ContributionEventCreated from './contribution_event/contribution_event_cr import ContributionEventClosed from './contribution_event/contribution_event_closed.vue'; import ContributionEventReopened from './contribution_event/contribution_event_reopened.vue'; import ContributionEventCommented from './contribution_event/contribution_event_commented.vue'; +import ContributionEventUpdated from './contribution_event/contribution_event_updated.vue'; +import ContributionEventDestroyed from './contribution_event/contribution_event_destroyed.vue'; export default { props: { @@ -151,6 +155,12 @@ export default { case EVENT_TYPE_COMMENTED: return ContributionEventCommented; + case EVENT_TYPE_UPDATED: + return ContributionEventUpdated; + + case EVENT_TYPE_DESTROYED: + return ContributionEventDestroyed; + default: return EmptyComponent; } diff --git a/app/assets/javascripts/contribution_events/components/target_link.vue b/app/assets/javascripts/contribution_events/components/target_link.vue index a14574ed826..86fddbb063e 100644 --- a/app/assets/javascripts/contribution_events/components/target_link.vue +++ b/app/assets/javascripts/contribution_events/components/target_link.vue @@ -27,5 +27,5 @@ export default { </script> <template> - <gl-link v-if="target" v-bind="targetLinkAttributes">{{ targetLinkText }}</gl-link> + <gl-link v-if="target.type" v-bind="targetLinkAttributes">{{ targetLinkText }}</gl-link> </template> |