Commit 364db383 authored by Jan Provaznik's avatar Jan Provaznik Committed by Mayra Cabrera

Renamed from_username to outgoing_name

* hopefully this makes field name little bit clearer
parent 7b265704
---
title: Added migration which adds service desk username column
merge_request: 21733
author:
type: added
# frozen_string_literal: true
class AddServiceDeskUsername < ActiveRecord::Migration[5.2]
DOWNTIME = false
def change
add_column :service_desk_settings, :outgoing_name, :string, limit: 255
end
end
......@@ -3663,6 +3663,7 @@ ActiveRecord::Schema.define(version: 2019_12_17_160632) do
create_table "service_desk_settings", primary_key: "project_id", id: :bigint, default: nil, force: :cascade do |t|
t.string "issue_template_key", limit: 255
t.string "outgoing_name", limit: 255
end
create_table "services", id: :serial, force: :cascade do |t|
......
......@@ -6,6 +6,7 @@ class ServiceDeskSetting < ApplicationRecord
belongs_to :project
validates :project_id, presence: true
validate :valid_issue_template
validates :outgoing_name, length: { maximum: 255 }, allow_blank: true
def self.update_template_key_for(project:, issue_template_key:)
return unless issue_template_key
......
......@@ -5,6 +5,7 @@ require 'spec_helper'
describe ServiceDeskSetting do
describe 'validations' do
it { is_expected.to validate_presence_of(:project_id) }
it { is_expected.to validate_length_of(:outgoing_name).is_at_most(255) }
end
describe 'associations' do
......
......@@ -220,6 +220,8 @@ excluded_attributes:
- :encrypted_token
- :encrypted_token_iv
- :enabled
service_desk_setting:
- :outgoing_name
methods:
notes:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment