forked from zammad/zammad
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Maintenance: Renamed confusing fields in EmailAddresses table
The EmailAddress model is used to store email addresses used by the system. It was using realname: field as a name while the rest of the system uses name: for, well, naming objects. This commit renames email_addresses.realname to email_addresses.name for the sake of consistency.
- Loading branch information
Showing
30 changed files
with
75 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,7 @@ class EmailAddressesController < ApplicationController | |
Example: | ||
{ | ||
"id":1, | ||
"realname":"some realname", | ||
"name":"some realname", | ||
"email":"[email protected]", | ||
"updated_at":"2012-09-14T17:51:53Z", | ||
"created_at":"2012-09-14T17:51:53Z", | ||
|
@@ -30,12 +30,12 @@ class EmailAddressesController < ApplicationController | |
[ | ||
{ | ||
"id": 1, | ||
"realname":"some realname1", | ||
"name":"some realname1", | ||
... | ||
}, | ||
{ | ||
"id": 2, | ||
"realname":"some realname2", | ||
"name":"some realname2", | ||
... | ||
} | ||
] | ||
|
@@ -77,7 +77,7 @@ def show | |
Payload: | ||
{ | ||
"realname":"some realname", | ||
"name":"some realname", | ||
"email":"[email protected]", | ||
"note": "", | ||
"active":true, | ||
|
@@ -86,7 +86,7 @@ def show | |
Response: | ||
{ | ||
"id": 1, | ||
"realname":"some realname", | ||
"name":"some realname", | ||
"email":"[email protected]", | ||
... | ||
} | ||
|
@@ -107,7 +107,7 @@ def create | |
Payload: | ||
{ | ||
"realname":"some realname", | ||
"name":"some realname", | ||
"email":"[email protected]", | ||
"note": "", | ||
"active":true, | ||
|
@@ -116,7 +116,7 @@ def create | |
Response: | ||
{ | ||
"id": 1, | ||
"realname":"some realname", | ||
"name":"some realname", | ||
"email":"[email protected]", | ||
... | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -103,7 +103,7 @@ | |
{ | ||
"id": 1, | ||
"channel_id": 3, | ||
"realname": "Some Realname", | ||
"name": "Some Realname", | ||
"email": "[email protected]" | ||
} | ||
], | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Copyright (C) 2012-2023 Zammad Foundation, https://zammad-foundation.org/ | ||
|
||
class RenameEmailRealname < ActiveRecord::Migration[6.1] | ||
def change | ||
# return if it's a new setup | ||
return if !Setting.exists?(name: 'system_init_done') | ||
|
||
rename_column :email_addresses, :realname, :name | ||
|
||
EmailAddress.reset_column_information | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -129,7 +129,7 @@ | |
EmailAddresses: [ | ||
{ | ||
channel_id: channel.id, | ||
realname: 'John Doe', | ||
name: 'John Doe', | ||
email: '[email protected]', | ||
} | ||
], | ||
|
@@ -141,7 +141,7 @@ | |
it 'creates an email address with the given attributes' do | ||
expect { described_class.setup } | ||
.to change(EmailAddress, :count) | ||
.and change { EmailAddress.last&.realname }.to('John Doe') | ||
.and change { EmailAddress.last&.name }.to('John Doe') | ||
.and change { EmailAddress.last&.email }.to('[email protected]') | ||
.and change { EmailAddress.last&.channel }.to(channel) | ||
end | ||
|
@@ -154,7 +154,7 @@ | |
{ | ||
id: email_address.id, | ||
channel_id: new_channel.id, | ||
realname: 'John Doe', | ||
name: 'John Doe', | ||
email: '[email protected]', | ||
} | ||
], | ||
|
@@ -167,7 +167,7 @@ | |
it 'updates the specified email address with the given attributes' do | ||
expect { described_class.setup } | ||
.to not_change(EmailAddress, :count) | ||
.and change { email_address.reload.realname }.to('John Doe') | ||
.and change { email_address.reload.name }.to('John Doe') | ||
.and change { email_address.reload.email }.to('[email protected]') | ||
.and change { email_address.reload.channel }.to(new_channel) | ||
end | ||
|
Oops, something went wrong.