130 lines
3.3 KiB
Markdown
130 lines
3.3 KiB
Markdown
## Code Context
|
|
|
|
**Query:** inbox management, channel provider, web widget, telegram channel, facebook channel, whatsapp channel, email channel, channelable concern, inbox member, inbox assignment
|
|
|
|
### Entry Points
|
|
|
|
- **AddChannelWebWidgetToPortals** (class) - db/migrate/20240415210313_add_channel_web_widget_to_portals.rb:1
|
|
- **RemoveImapInboxSynedAtFromChannelEmail** (class) - db/migrate/20240131040316_remove_imap_inbox_syned_at_from_channel_email.rb:1
|
|
- **Telegram** (component) - app/javascript/dashboard/routes/dashboard/settings/inbox/channels/Telegram.vue:1
|
|
|
|
### Related Symbols
|
|
|
|
- db/migrate/20240415210313_add_channel_web_widget_to_portals.rb: change:2
|
|
- db/migrate/20240131040316_remove_imap_inbox_syned_at_from_channel_email.rb: change:2
|
|
|
|
### Code
|
|
|
|
#### AddChannelWebWidgetToPortals (db/migrate/20240415210313_add_channel_web_widget_to_portals.rb:1)
|
|
|
|
```ruby
|
|
class AddChannelWebWidgetToPortals < ActiveRecord::Migration[7.0]
|
|
def change
|
|
add_column :portals, :channel_web_widget_id, :bigint
|
|
add_index :portals, :channel_web_widget_id
|
|
end
|
|
end
|
|
```
|
|
|
|
#### RemoveImapInboxSynedAtFromChannelEmail (db/migrate/20240131040316_remove_imap_inbox_syned_at_from_channel_email.rb:1)
|
|
|
|
```ruby
|
|
class RemoveImapInboxSynedAtFromChannelEmail < ActiveRecord::Migration[7.0]
|
|
def change
|
|
remove_column :channel_email, :imap_inbox_synced_at, :datetime
|
|
end
|
|
end
|
|
```
|
|
|
|
#### Telegram (app/javascript/dashboard/routes/dashboard/settings/inbox/channels/Telegram.vue:1)
|
|
|
|
```vue
|
|
<script>
|
|
import { mapGetters } from 'vuex';
|
|
import { useVuelidate } from '@vuelidate/core';
|
|
import { useAlert } from 'dashboard/composables';
|
|
import { required } from '@vuelidate/validators';
|
|
import router from '../../../../index';
|
|
import PageHeader from '../../SettingsSubPageHeader.vue';
|
|
import NextButton from 'dashboard/components-next/button/Button.vue';
|
|
|
|
export default {
|
|
components: {
|
|
PageHeader,
|
|
NextButton,
|
|
},
|
|
setup() {
|
|
return { v$: useVuelidate() };
|
|
},
|
|
data() {
|
|
return {
|
|
botToken: '',
|
|
};
|
|
},
|
|
computed: {
|
|
...mapGetters({
|
|
uiFlags: 'inboxes/getUIFlags',
|
|
}),
|
|
},
|
|
validations: {
|
|
botToken: { required },
|
|
},
|
|
methods: {
|
|
async createChannel() {
|
|
this.v$.$touch();
|
|
if (this.v$.$invalid) {
|
|
return;
|
|
}
|
|
|
|
try {
|
|
const telegramChannel = await this.$store.dispatch(
|
|
'inboxes/createChannel',
|
|
{
|
|
channel: {
|
|
type: 'telegram',
|
|
bot_token: this.botToken,
|
|
},
|
|
}
|
|
);
|
|
|
|
router.replace({
|
|
name: 'settings_inboxes_add_agents',
|
|
params: {
|
|
page: 'new',
|
|
inbox_id: telegramChannel.id,
|
|
},
|
|
});
|
|
} catch (error) {
|
|
useAlert(
|
|
error.message ||
|
|
this.$t('INBOX_MGMT.ADD.TELEGRAM_CHANNEL.API.ERROR_MESSAGE')
|
|
);
|
|
}
|
|
},
|
|
},
|
|
};
|
|
</script>
|
|
|
|
<template>
|
|
<div class="h-full w-full p-6 col-span-6">
|
|
<PageHeader
|
|
:head
|
|
// ... truncated ...
|
|
```
|
|
|
|
#### change (db/migrate/20240415210313_add_channel_web_widget_to_portals.rb:2)
|
|
|
|
```ruby
|
|
def change
|
|
add_column :portals, :channel_web_widget_id, :bigint
|
|
add_index :portals, :channel_web_widget_id
|
|
end
|
|
```
|
|
|
|
#### change (db/migrate/20240131040316_remove_imap_inbox_syned_at_from_channel_email.rb:2)
|
|
|
|
```ruby
|
|
def change
|
|
remove_column :channel_email, :imap_inbox_synced_at, :datetime
|
|
end
|
|
``` |