mirror of
https://github.com/lingble/chatwoot.git
synced 2025-11-02 03:57:52 +00:00
chore: Add a redirect link to the conversation in success toast message (#3711)
When creating a conversation from the contacts tab now we can go directly to the conversation by clicking the link in the success message Co-authored-by: Pranav Raj S <pranav@chatwoot.com>
This commit is contained in:
@@ -4,6 +4,11 @@
|
||||
<div class="ui-snackbar-text">
|
||||
{{ message }}
|
||||
</div>
|
||||
<div v-if="action" class="ui-snackbar-action">
|
||||
<router-link v-if="action.type == 'link'" :to="action.to">
|
||||
{{ action.message }}
|
||||
</router-link>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -12,6 +17,10 @@
|
||||
export default {
|
||||
props: {
|
||||
message: { type: String, default: '' },
|
||||
action: {
|
||||
type: Object,
|
||||
default: () => {},
|
||||
},
|
||||
showButton: Boolean,
|
||||
duration: {
|
||||
type: [String, Number],
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
v-for="snackMessage in snackMessages"
|
||||
:key="snackMessage.key"
|
||||
:message="snackMessage.message"
|
||||
:action="snackMessage.action"
|
||||
/>
|
||||
</transition-group>
|
||||
</template>
|
||||
@@ -35,8 +36,12 @@ export default {
|
||||
bus.$off('newToastMessage', this.onNewToastMessage);
|
||||
},
|
||||
methods: {
|
||||
onNewToastMessage(message) {
|
||||
this.snackMessages.push({ key: new Date().getTime(), message });
|
||||
onNewToastMessage(message, action) {
|
||||
this.snackMessages.push({
|
||||
key: new Date().getTime(),
|
||||
message,
|
||||
action,
|
||||
});
|
||||
window.setTimeout(() => {
|
||||
this.snackMessages.splice(0, 1);
|
||||
}, this.duration);
|
||||
|
||||
@@ -84,7 +84,8 @@ describe('MoveActions', () => {
|
||||
|
||||
expect(window.bus.$emit).toBeCalledWith(
|
||||
'newToastMessage',
|
||||
'This conversation is muted for 6 hours'
|
||||
'This conversation is muted for 6 hours',
|
||||
undefined
|
||||
);
|
||||
});
|
||||
});
|
||||
@@ -109,7 +110,8 @@ describe('MoveActions', () => {
|
||||
|
||||
expect(window.bus.$emit).toBeCalledWith(
|
||||
'newToastMessage',
|
||||
'This conversation is unmuted'
|
||||
'This conversation is unmuted',
|
||||
undefined
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user