Skip to content

Commit

Permalink
Added slack username and removed irc nickname from user profile
Browse files Browse the repository at this point in the history
Signed-off-by: Rajesh Paul <rajesh.paul@progress.com>
  • Loading branch information
RajeshPaul38 committed Aug 23, 2021
1 parent 822284e commit 269e0ee
Show file tree
Hide file tree
Showing 10 changed files with 25 additions and 15 deletions.
2 changes: 1 addition & 1 deletion src/supermarket/app/controllers/profile_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def user_params
:last_name,
:company,
:twitter_username,
:irc_nickname,
:slack_username,
:jira_username,
email_preferences_attributes: [
:_destroy,
Expand Down
2 changes: 1 addition & 1 deletion src/supermarket/app/views/api/v1/users/show.json.jbuilder
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ json.name @user.name
json.company @user.company
json.github Array(@github_usernames)
json.twitter @user.twitter_username
json.irc @user.irc_nickname
json.slack @user.slack_username
json.cookbooks do
json.set! :owns do
@owned_cookbooks.each do |cookbook|
Expand Down
6 changes: 3 additions & 3 deletions src/supermarket/app/views/profile/edit.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@
<%= f.label :twitter_username, "Twitter Username" %>
<%= f.text_field :twitter_username, placeholder: 'Twitter Username', title: 'twitter username' %>
</div>
<div class="ircnickname-field">
<%= f.label :irc_nickname, "IRC Nickname" %>
<%= f.text_field :irc_nickname, placeholder: 'IRC Nickname', title: 'irc nickname' %>
<div class="slackusername-field">
<%= f.label :slack_username, "Slack Username" %>
<%= f.text_field :slack_username, placeholder: 'Slack Userkname', title: 'slack username' %>
</div>
</fieldset>
<fieldset>
Expand Down
6 changes: 3 additions & 3 deletions src/supermarket/app/views/users/_sidebar.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@
</li>
<% end %>
<% if @user.irc_nickname.present? %>
<li class="has-tip" title="<%= posessivize(@user.name) %> IRC Nickname">
<i class="fa fa-comment"></i> <%= @user.irc_nickname %>
<% if @user.slack_username.present? %>
<li class="has-tip" title="<%= posessivize(@user.name) %> Slack Nickname">
<i class="fa fa-comment"></i> <%= @user.slack_username %>
</li>
<% end %>

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class AddSlackColumnsToUsers < ActiveRecord::Migration[6.1]
def change
add_column :users, :slack_username, :string
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class RemoveIrcColumnsFromUsers < ActiveRecord::Migration[6.1]
def change
remove_column :users, :irc_nickname
end
end
4 changes: 2 additions & 2 deletions src/supermarket/spec/api/user_show_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
last_name: "McNanny",
company: "Fanny Pack",
twitter_username: "fanny",
irc_nickname: "fanny",
slack_username: "fanny",
chef_account: create(
:account,
provider: "chef_oauth2",
Expand All @@ -25,7 +25,7 @@
"name" => "Fanny McNanny",
"company" => "Fanny Pack",
"twitter" => "fanny",
"irc" => "fanny",
"slack" => "fanny",
"github" => ["fanny"],
"cookbooks" => {
"owns" => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"last_name" => "Smith",
"company" => "Acme",
"twitter_username" => "bobbo",
"irc_nickname" => "bobbo",
"slack_username" => "bobbo",
"jira_username" => "bobbo",
"email_preferences_attributes" => {
"0" => {
Expand Down
2 changes: 1 addition & 1 deletion src/supermarket/spec/features/edit_profile_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
manage_profile

within ".edit_user" do
fill_in "user_irc_nickname", with: "eddardstark"
fill_in "user_slack_username", with: "eddardstark"
fill_in "user_company", with: "Winterfell"
fill_in "user_twitter_username", with: "eddardstark"
submit_form
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
company: "FannyInternational",
twitter_username: "fannyfannyfanny",
email: "fanny@fanny.com",
irc_nickname: "fannyfunnyfanny"
slack_username: "fannyfunnyfanny"
)
end

Expand Down Expand Up @@ -92,8 +92,8 @@
end

it "displays the user's irc handle" do
irc = json_body["irc"]
expect(irc).to eql(user.irc_nickname)
slack = json_body["slack"]
expect(slack).to eql(user.slack_username)
end

it "displays the cookbooks the user owns" do
Expand Down

0 comments on commit 269e0ee

Please sign in to comment.