diff --git a/application/forms/EscalationRecipientForm.php b/application/forms/EscalationRecipientForm.php index 61e093b2d..44ea29fd4 100644 --- a/application/forms/EscalationRecipientForm.php +++ b/application/forms/EscalationRecipientForm.php @@ -71,7 +71,7 @@ protected function assembleElements(): void $this->registerElement($col); $options = ['' => sprintf(' - %s - ', $this->translate('Please choose'))]; - $options += Channel::fetchChannelTypes(Database::get()); + $options += Channel::fetchChannelNames(Database::get()); $val = $this->createElement( 'select', diff --git a/library/Notifications/Model/Channel.php b/library/Notifications/Model/Channel.php index f2e1777e5..50197e902 100644 --- a/library/Notifications/Model/Channel.php +++ b/library/Notifications/Model/Channel.php @@ -82,28 +82,17 @@ public function getIcon(): Icon } /** - * Fetch and map all the configured channel types to a key => value array + * Fetch and map all the configured channel names to a key => value array * * @param Connection $conn * - * @return array All the channel types mapped as id => type + * @return array All the channel names mapped as id => name */ - public static function fetchChannelTypes(Connection $conn): array + public static function fetchChannelNames(Connection $conn): array { $channels = []; foreach (Channel::on($conn) as $channel) { - switch ($channel->type) { - case 'rocketchat': - $name = 'Rocket.Chat'; - break; - case 'email': - $name = t('E-Mail'); - break; - default: - $name = $channel->type; - } - - $channels[$channel->id] = $name; + $channels[$channel->id] = $channel->name; } return $channels; diff --git a/library/Notifications/Web/Form/ContactForm.php b/library/Notifications/Web/Form/ContactForm.php index 1d59b42dc..f97b1dd75 100644 --- a/library/Notifications/Web/Form/ContactForm.php +++ b/library/Notifications/Web/Form/ContactForm.php @@ -80,7 +80,7 @@ protected function assemble() $this->addElement($contact); $channelOptions = ['' => sprintf(' - %s - ', $this->translate('Please choose'))]; - $channelOptions += Channel::fetchChannelTypes(Database::get()); + $channelOptions += Channel::fetchChannelNames(Database::get()); $contact->addElement( 'text',