Fixed some small email channel config bugs. Improved wording.
This commit is contained in:
parent
a0c0760e04
commit
8c8788b0cc
8 changed files with 65 additions and 39 deletions
|
@ -238,32 +238,35 @@ class App.ChannelEmailAccountOverview extends App.Controller
|
||||||
# load assets
|
# load assets
|
||||||
App.Collection.loadAssets(data.assets)
|
App.Collection.loadAssets(data.assets)
|
||||||
|
|
||||||
@render(accounts_fixed: data.accounts_fixed)
|
@render(data)
|
||||||
)
|
)
|
||||||
|
|
||||||
render: (params = {}) =>
|
render: (data = {}) =>
|
||||||
|
|
||||||
# get channels
|
# get channels
|
||||||
channels = App.Channel.search( filter: { area: 'Email::Account' } )
|
account_channels = []
|
||||||
for channel in channels
|
for channel_id in data.account_channel_ids
|
||||||
|
account_channels.push App.Channel.fullLocal(channel_id)
|
||||||
|
|
||||||
|
for channel in account_channels
|
||||||
email_addresses = App.EmailAddress.search( filter: { channel_id: channel.id } )
|
email_addresses = App.EmailAddress.search( filter: { channel_id: channel.id } )
|
||||||
channel.email_addresses = email_addresses
|
channel.email_addresses = email_addresses
|
||||||
|
|
||||||
# get all unlinked email addresses
|
# get all unlinked email addresses
|
||||||
email_addresses_all = App.EmailAddress.all()
|
not_used_email_addresses = []
|
||||||
email_addresses_not_used = []
|
for email_address_id in data.not_used_email_address_ids
|
||||||
for email_address in email_addresses_all
|
not_used_email_addresses.push App.EmailAddress.find(email_address_id)
|
||||||
if !email_address.channel_id || email_address.channel_id is ''
|
|
||||||
email_addresses_not_used.push email_address
|
|
||||||
|
|
||||||
# get channels
|
# get channels
|
||||||
channel = App.Channel.search( filter: { area: 'Email::Notification', active: true } )[0]
|
notification_channels = []
|
||||||
|
for channel_id in data.notification_channel_ids
|
||||||
|
notification_channels.push App.Channel.find(channel_id)
|
||||||
|
|
||||||
@html App.view('channel/email_account_overview')(
|
@html App.view('channel/email_account_overview')(
|
||||||
channels: channels
|
account_channels: account_channels
|
||||||
email_addresses_not_used: email_addresses_not_used
|
not_used_email_addresses: not_used_email_addresses
|
||||||
channel: channel
|
notification_channels: notification_channels
|
||||||
accounts_fixed: params.accounts_fixed
|
accounts_fixed: data.accounts_fixed
|
||||||
)
|
)
|
||||||
|
|
||||||
wizard: (e) =>
|
wizard: (e) =>
|
||||||
|
|
|
@ -556,7 +556,8 @@ class App.Model extends Spine.Model
|
||||||
item = App[ attribute.relation ]._fillUp(item, classNames.concat(@className))
|
item = App[ attribute.relation ]._fillUp(item, classNames.concat(@className))
|
||||||
data[ withoutId ] = item
|
data[ withoutId ] = item
|
||||||
else
|
else
|
||||||
console.log("ERROR, cant find #{ attribute.name } App.#{ attribute.relation }.find(#{ data[attribute.name] }) for '#{ data.constructor.className }' #{ data.displayName() }")
|
if !attribute.do_not_log
|
||||||
|
console.log("ERROR, cant find #{ attribute.name } App.#{ attribute.relation }.find(#{ data[attribute.name] }) for '#{ data.constructor.className }' #{ data.displayName() }")
|
||||||
data
|
data
|
||||||
|
|
||||||
###
|
###
|
||||||
|
|
|
@ -14,7 +14,7 @@ class App.EmailAddress extends App.Model
|
||||||
@configure_attributes = [
|
@configure_attributes = [
|
||||||
{ name: 'realname', display: 'Realname', tag: 'input', type: 'text', limit: 250, null: false },
|
{ name: 'realname', display: 'Realname', tag: 'input', type: 'text', limit: 250, null: false },
|
||||||
{ name: 'email', display: 'Email', tag: 'input', type: 'email', limit: 250, null: false },
|
{ name: 'email', display: 'Email', tag: 'input', type: 'email', limit: 250, null: false },
|
||||||
{ name: 'channel_id', display: 'Channel', tag: 'select', multiple: false, null: true, relation: 'Channel', nulloption: true, filter: @filterChannel },
|
{ name: 'channel_id', display: 'Channel', tag: 'select', multiple: false, null: true, relation: 'Channel', nulloption: true, filter: @filterChannel, do_not_log: true },
|
||||||
{ name: 'note', display: 'Note', tag: 'textarea', note: 'Notes are visible to agents only, never to customers.', limit: 250, null: true },
|
{ name: 'note', display: 'Note', tag: 'textarea', note: 'Notes are visible to agents only, never to customers.', limit: 250, null: true },
|
||||||
{ name: 'updated_at', display: 'Updated', tag: 'datetime', readonly: 1 },
|
{ name: 'updated_at', display: 'Updated', tag: 'datetime', readonly: 1 },
|
||||||
{ name: 'active', display: 'Active', tag: 'active', readonly: 1 },
|
{ name: 'active', display: 'Active', tag: 'active', readonly: 1 },
|
||||||
|
|
|
@ -8,8 +8,8 @@ class App.Group extends App.Model
|
||||||
{ name: 'assignment_timeout', display: 'Assignment Timeout', tag: 'input', note: 'Assignment timeout in minutes if assigned agent is not working on it. Ticket will be shown as unassigend.', type: 'text', limit: 100, null: true },
|
{ name: 'assignment_timeout', display: 'Assignment Timeout', tag: 'input', note: 'Assignment timeout in minutes if assigned agent is not working on it. Ticket will be shown as unassigend.', type: 'text', limit: 100, null: true },
|
||||||
{ name: 'follow_up_possible', display: 'Follow up possible',tag: 'select', default: 'yes', options: { yes: 'yes', reject: 'reject follow up/do not reopen Ticket', 'new_ticket': 'do not reopen Ticket but create new Ticket' }, null: false, note: 'Follow up for closed ticket possible or not.' },
|
{ name: 'follow_up_possible', display: 'Follow up possible',tag: 'select', default: 'yes', options: { yes: 'yes', reject: 'reject follow up/do not reopen Ticket', 'new_ticket': 'do not reopen Ticket but create new Ticket' }, null: false, note: 'Follow up for closed ticket possible or not.' },
|
||||||
{ name: 'follow_up_assignment', display: 'Assign Follow Ups', tag: 'select', default: 'yes', options: { true: 'yes', false: 'no' }, 'null': false, note: 'Assign follow up to latest agent again.' },
|
{ name: 'follow_up_assignment', display: 'Assign Follow Ups', tag: 'select', default: 'yes', options: { true: 'yes', false: 'no' }, 'null': false, note: 'Assign follow up to latest agent again.' },
|
||||||
{ name: 'email_address_id', display: 'Email', tag: 'select', multiple: false, null: true, relation: 'EmailAddress', nulloption: true },
|
{ name: 'email_address_id', display: 'Email', tag: 'select', multiple: false, null: true, relation: 'EmailAddress', nulloption: true, do_not_log: true },
|
||||||
{ name: 'signature_id', display: 'Signature', tag: 'select', multiple: false, null: true, relation: 'Signature', nulloption: true },
|
{ name: 'signature_id', display: 'Signature', tag: 'select', multiple: false, null: true, relation: 'Signature', nulloption: true, do_not_log: true },
|
||||||
{ name: 'note', display: 'Note', tag: 'textarea', note: 'Notes are visible to agents only, never to customers.', limit: 250, null: true },
|
{ name: 'note', display: 'Note', tag: 'textarea', note: 'Notes are visible to agents only, never to customers.', limit: 250, null: true },
|
||||||
{ name: 'updated_at', display: 'Updated', tag: 'datetime', readonly: 1 },
|
{ name: 'updated_at', display: 'Updated', tag: 'datetime', readonly: 1 },
|
||||||
{ name: 'active', display: 'Active', tag: 'active', default: true },
|
{ name: 'active', display: 'Active', tag: 'active', default: true },
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<h1><%- @T('Email Accounts') %></h1>
|
<h1><%- @T('Email Accounts') %></h1>
|
||||||
|
|
||||||
<% if @accounts_fixed: %>
|
<% if !_.isEmpty(@accounts_fixed): %>
|
||||||
<h2><%- @T('Fixed email addresses') %></h2>
|
<h2><%- @T('Fixed email addresses') %></h2>
|
||||||
<ul>
|
<ul>
|
||||||
<% for email_address in @accounts_fixed: %>
|
<% for email_address in @accounts_fixed: %>
|
||||||
|
@ -9,16 +9,16 @@
|
||||||
</ul>
|
</ul>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<% if !_.isEmpty(@email_addresses_not_used): %>
|
<% if !_.isEmpty(@not_used_email_addresses): %>
|
||||||
<h2><%- @T('Not linked email addresses') %></h2>
|
<h2><%- @T('Not linked email addresses') %></h2>
|
||||||
<ul>
|
<ul>
|
||||||
<% for email_address in @email_addresses_not_used: %>
|
<% for email_address in @not_used_email_addresses: %>
|
||||||
<li data-id="<%= email_address.id %>"><a href="" data-type="email-address-edit"><%= email_address.email %></a>
|
<li data-id="<%= email_address.id %>"><a href="" data-type="email-address-edit"><%= email_address.email %></a>
|
||||||
<% end %>
|
<% end %>
|
||||||
</ul>
|
</ul>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<% if _.isEmpty(@channels): %>
|
<% if _.isEmpty(@account_channels): %>
|
||||||
<p><%- @T('You have no configured account right now.') %></p>
|
<p><%- @T('You have no configured account right now.') %></p>
|
||||||
<% else: %>
|
<% else: %>
|
||||||
<table class="table table-hover user-list">
|
<table class="table table-hover user-list">
|
||||||
|
@ -31,7 +31,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<% for channel in @channels: %>
|
<% for channel in @account_channels: %>
|
||||||
<tr data-id="<%- channel.id %>">
|
<tr data-id="<%- channel.id %>">
|
||||||
<td class="<% if channel.status_in is 'ok': %>success<% else if channel.status_in is 'error': %>danger<% else: %>warning<% end %>">
|
<td class="<% if channel.status_in is 'ok': %>success<% else if channel.status_in is 'error': %>danger<% else: %>warning<% end %>">
|
||||||
<%- @T('State') %>: <%- @T(channel.status_in || 'unknown') %><br>
|
<%- @T('State') %>: <%- @T(channel.status_in || 'unknown') %><br>
|
||||||
|
@ -82,7 +82,7 @@
|
||||||
|
|
||||||
<a data-type="new" class="btn btn--success"><%- @T('New') %></a>
|
<a data-type="new" class="btn btn--success"><%- @T('New') %></a>
|
||||||
|
|
||||||
<% if @channel && !App.Config.get('system_online_service'): %>
|
<% if !_.isEmpty(@notification_channels) && !App.Config.get('system_online_service'): %>
|
||||||
<h1><%- @T('Notification Account') %></h1>
|
<h1><%- @T('Notification Account') %></h1>
|
||||||
|
|
||||||
<table class="table table-hover user-list">
|
<table class="table table-hover user-list">
|
||||||
|
@ -92,25 +92,26 @@
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr data-id="<%- @channel.id %>">
|
<% for channel in @notification_channels: %>
|
||||||
<td class="<% if @channel.status_out is 'ok': %>success<% else if @channel.status_out is 'error': %>danger<% else: %>warning<% end %>">
|
<tr data-id="<%- channel.id %>">
|
||||||
<%- @T('State') %>: <%- @T(@channel.status_out || 'unknown') %><br>
|
<td class="<% if channel.status_out is 'ok': %>success<% else if channel.status_out is 'error': %>danger<% else: %>warning<% end %>">
|
||||||
|
<%- @T('State') %>: <%- @T(channel.status_out || 'unknown') %><br>
|
||||||
<a href="#" data-type="edit-notification-outbound">
|
<a href="#" data-type="edit-notification-outbound">
|
||||||
<% if @channel.options.outbound && @channel.options.outbound.options: %>
|
<% if channel.options.outbound && channel.options.outbound.options: %>
|
||||||
<%= @channel.options.outbound.options.user %><br>
|
<%= channel.options.outbound.options.user %><br>
|
||||||
<%= @channel.options.outbound.options.host %>
|
<%= channel.options.outbound.options.host %>
|
||||||
<% end %>
|
<% end %>
|
||||||
(<%= @channel.options.outbound.adapter %>)</a>
|
(<%= channel.options.outbound.adapter %>)</a>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<% if @channel.status_in is 'error': %>
|
<% if channel.status_in is 'error': %>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="1"><%= @channel.last_log_in %></td>
|
<td colspan="1"><%= channel.last_log_in %></td>
|
||||||
</tr>
|
</tr>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% if @channel.status_out is 'error': %>
|
<% if channel.status_out is 'error': %>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="1"><%= @channel.last_log_out %></td>
|
<td colspan="1"><%= channel.last_log_out %></td>
|
||||||
</tr>
|
</tr>
|
||||||
<% end %>
|
<% end %>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|
|
@ -217,6 +217,10 @@ curl http://localhost/api/v1/channels.json -v -u #{login}:#{password} -H "Conten
|
||||||
def email_index
|
def email_index
|
||||||
return if deny_if_not_role(Z_ROLENAME_ADMIN)
|
return if deny_if_not_role(Z_ROLENAME_ADMIN)
|
||||||
system_online_service = Setting.get('system_online_service')
|
system_online_service = Setting.get('system_online_service')
|
||||||
|
account_channel_ids = []
|
||||||
|
notification_channel_ids = []
|
||||||
|
email_address_ids = []
|
||||||
|
not_used_email_address_ids = []
|
||||||
accounts_fixed = []
|
accounts_fixed = []
|
||||||
assets = {}
|
assets = {}
|
||||||
Channel.all.each {|channel|
|
Channel.all.each {|channel|
|
||||||
|
@ -227,15 +231,29 @@ curl http://localhost/api/v1/channels.json -v -u #{login}:#{password} -H "Conten
|
||||||
}
|
}
|
||||||
next
|
next
|
||||||
end
|
end
|
||||||
assets = channel.assets(assets)
|
if channel.area == 'Email::Account'
|
||||||
|
account_channel_ids.push channel.id
|
||||||
|
assets = channel.assets(assets)
|
||||||
|
elsif channel.area == 'Email::Notification' && channel.active
|
||||||
|
notification_channel_ids.push channel.id
|
||||||
|
assets = channel.assets(assets)
|
||||||
|
end
|
||||||
}
|
}
|
||||||
EmailAddress.all.each {|email_address|
|
EmailAddress.all.each {|email_address|
|
||||||
next if system_online_service && email_address.preferences && email_address.preferences['online_service_disable']
|
next if system_online_service && email_address.preferences && email_address.preferences['online_service_disable']
|
||||||
|
email_address_ids.push email_address.id
|
||||||
assets = email_address.assets(assets)
|
assets = email_address.assets(assets)
|
||||||
|
if !email_address.channel_id || !email_address.active || !Channel.find_by(id: email_address.channel_id)
|
||||||
|
not_used_email_address_ids.push email_address.id
|
||||||
|
end
|
||||||
}
|
}
|
||||||
render json: {
|
render json: {
|
||||||
accounts_fixed: accounts_fixed,
|
accounts_fixed: accounts_fixed,
|
||||||
assets: assets,
|
assets: assets,
|
||||||
|
account_channel_ids: account_channel_ids,
|
||||||
|
notification_channel_ids: notification_channel_ids,
|
||||||
|
email_address_ids: email_address_ids,
|
||||||
|
not_used_email_address_ids: not_used_email_address_ids,
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -11,9 +11,10 @@ class AddSettingOnlineService2 < ActiveRecord::Migration
|
||||||
}
|
}
|
||||||
Channel.where(area: 'Email::Account').each {|channel|
|
Channel.where(area: 'Email::Account').each {|channel|
|
||||||
next if !channel.options
|
next if !channel.options
|
||||||
next if !channel.options[:options]
|
next if !channel.options[:inbound][:options]
|
||||||
next if !channel.options[:options][:host]
|
next if !channel.options[:inbound][:options][:host]
|
||||||
next if channel.options[:options][:host] !~ /zammad/i
|
next if channel.options[:inbound][:options][:host] !~ /zammad/i
|
||||||
|
channel.preferences = {}
|
||||||
channel.preferences[:online_service_disable] = true
|
channel.preferences[:online_service_disable] = true
|
||||||
channel.save
|
channel.save
|
||||||
}
|
}
|
||||||
|
|
|
@ -1757,6 +1757,7 @@ Channel.create_if_not_exists(
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
group_id: 1,
|
group_id: 1,
|
||||||
|
preferences: { online_service_disable: true },
|
||||||
active: false,
|
active: false,
|
||||||
)
|
)
|
||||||
Channel.create_if_not_exists(
|
Channel.create_if_not_exists(
|
||||||
|
@ -1766,6 +1767,7 @@ Channel.create_if_not_exists(
|
||||||
adapter: 'sendmail',
|
adapter: 'sendmail',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
preferences: { online_service_disable: true },
|
||||||
active: true,
|
active: true,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue