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 ...@@ -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| 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 "issue_template_key", limit: 255
t.string "outgoing_name", limit: 255
end end
create_table "services", id: :serial, force: :cascade do |t| create_table "services", id: :serial, force: :cascade do |t|
......
...@@ -6,6 +6,7 @@ class ServiceDeskSetting < ApplicationRecord ...@@ -6,6 +6,7 @@ class ServiceDeskSetting < ApplicationRecord
belongs_to :project belongs_to :project
validates :project_id, presence: true validates :project_id, presence: true
validate :valid_issue_template validate :valid_issue_template
validates :outgoing_name, length: { maximum: 255 }, allow_blank: true
def self.update_template_key_for(project:, issue_template_key:) def self.update_template_key_for(project:, issue_template_key:)
return unless issue_template_key return unless issue_template_key
......
...@@ -5,6 +5,7 @@ require 'spec_helper' ...@@ -5,6 +5,7 @@ require 'spec_helper'
describe ServiceDeskSetting do describe ServiceDeskSetting do
describe 'validations' do describe 'validations' do
it { is_expected.to validate_presence_of(:project_id) } it { is_expected.to validate_presence_of(:project_id) }
it { is_expected.to validate_length_of(:outgoing_name).is_at_most(255) }
end end
describe 'associations' do describe 'associations' do
......
...@@ -220,6 +220,8 @@ excluded_attributes: ...@@ -220,6 +220,8 @@ excluded_attributes:
- :encrypted_token - :encrypted_token
- :encrypted_token_iv - :encrypted_token_iv
- :enabled - :enabled
service_desk_setting:
- :outgoing_name
methods: methods:
notes: 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