-
Notifications
You must be signed in to change notification settings - Fork 4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add organizations to user profile (#5583) [deploy]
* Add organizations to user profile * Add user organization info updated at column and cache key * Remove default value for users organization_info_updated_at column * Update organization_memberships factory * Remove schema organization_info_updated_at default value Co-authored-by: rhymes <rhymesete@gmail.com>
- Loading branch information
1 parent
c91080c
commit a25446b
Showing
8 changed files
with
49 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<% if @user.organizations.present? %> | ||
<div id="sidebar-organizations" class="widget"> | ||
<div class="widget-suggested-follows-container"> | ||
<header><h4>organizations</h4></header> | ||
<div class="widget-body"> | ||
<% @user.organizations.find_each do |organization| %> | ||
<div class="widget-user-pic"> | ||
<a href="/<%= organization.slug %>"> | ||
<img src="<%= ProfileImage.new(organization).get(90) %>" alt="<%= organization.name %> profile image"> | ||
</a> | ||
</div> | ||
<% end %> | ||
</div> | ||
</div> | ||
</div> | ||
<% 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
5 changes: 5 additions & 0 deletions
5
db/migrate/20200119214529_add_organization_info_updated_at_to_users.rb
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,5 @@ | ||
class AddOrganizationInfoUpdatedAtToUsers < ActiveRecord::Migration[5.2] | ||
def change | ||
add_column :users, :organization_info_updated_at, :datetime | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,11 @@ | ||
FactoryBot.define do | ||
factory :organization_membership do | ||
user | ||
organization | ||
association :user, factory: :user, strategy: :create | ||
association :organization, factory: :organization, strategy: :create | ||
type_of_user { "member" } | ||
|
||
after(:build) do |organization_membership| | ||
organization_membership.class.skip_callback(:create, :after, :update_user_organization_info_updated_at, raise: false) | ||
end | ||
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