-
Notifications
You must be signed in to change notification settings - Fork 509
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AO3-5901 Limit number of pseuds on profile and sidebar #4554
Merged
Merged
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
bbe527d
AO3-5901 Define a profile scope for profile and sidebar display
neuroalien 9022766
AO3-5901 Limit number of pseuds shown in the user sidebar
neuroalien 0d371d4
AO3-5901 Limit number of pseuds shown on the user's profile
neuroalien f6ae2d3
AO3-5901 Introduce a profile presenter
neuroalien da7753f
AO3-5901 Get rid of deprecation messages
neuroalien f6a19b2
AO3-5901 Always show the currently selected pseud
neuroalien 578d816
AO3-5901 pseud cukes
cesy 541422f
AO3-5901 Remove profile request spec
neuroalien fbc8dce
AO3-5901 Expand cuke with user page scenarios
neuroalien 2de63dc
AO3-5901 Different text for profile pseud link
neuroalien d5f362f
AO3-5901 Newly surfaced Hydra barkings
neuroalien 4c12959
Merge branch 'AO3-5901-pseuds-profile-sidebar' of https://github.com/…
sarken 42bcdb4
Fixes from cesy's commit cf8568d0e422f0782cd5e23cf0b0b200b419287b whi…
sarken d02afe3
Dynamically load pseuds on profile page from commit 9e68b3e
sarken 854a62e
Test fixes for dynamic pseud list on profile
sarken fd372c4
Merge branch 'master' into AO3-5901
neuroalien f4ccd58
AO3-5901 Use verified double
neuroalien File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,13 @@ | ||
class ProfilePresenter < SimpleDelegator | ||
def created_at | ||
user.created_at.to_date | ||
end | ||
|
||
def date_of_birth | ||
super if user.preference.try(:date_of_birth_visible) | ||
end | ||
|
||
def email | ||
user.email if user.preference.try(:email_visible) | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
$j("#more_pseuds_connector").remove(); | ||
$j("#more_pseuds").replaceWith("<%= j print_pseud_list(@user, @pseuds, first: false) %>") |
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 |
---|---|---|
|
@@ -112,6 +112,9 @@ Scenario: Changing email address and viewing | |
And the email should not contain "translation missing" | ||
When I change my preferences to display my email address | ||
Then I should see "My email address: [email protected]" | ||
When I log out | ||
And I go to editname's profile page | ||
Then I should see "My email address: [email protected]" | ||
|
||
Scenario: Changing email address after requesting password reset | ||
|
||
|
@@ -153,6 +156,9 @@ Scenario: Entering date of birth and displaying | |
When I change my preferences to display my date of birth | ||
Then I should see "My birthday: 1980-11-30" | ||
And 0 emails should be delivered | ||
When I log out | ||
And I go to editname's profile page | ||
Then I should see "My birthday: 1980-11-30" | ||
|
||
Scenario: Change password - mistake in typing old password | ||
|
||
|
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 |
---|---|---|
@@ -1,20 +1,32 @@ | ||
require 'spec_helper' | ||
|
||
describe ProfileController do | ||
describe 'show' do | ||
it 'should be an error for a non existent user' do | ||
describe "show" do | ||
let(:user) { create(:user) } | ||
|
||
it "redirects and shows an error message for a non existent user" do | ||
get :show, params: { user_id: 999_999_999_999 } | ||
|
||
expect(response).to redirect_to(root_path) | ||
expect(flash[:error]).to eq "Sorry, there's no user by that name." | ||
end | ||
|
||
it 'should create a new profile if one does not exist' do | ||
@user = FactoryBot.create(:user) | ||
@user.profile.destroy | ||
@user.reload | ||
get :show, params: { user_id: @user } | ||
expect(@user.profile).to be | ||
it "creates a new profile if one does not exist" do | ||
user.profile.destroy | ||
user.reload | ||
|
||
get :show, params: { user_id: user } | ||
|
||
expect(user.profile).not_to be_nil | ||
end | ||
|
||
it "uses the profile presenter for the profile" do | ||
profile_presenter = instance_double(ProfilePresenter) | ||
allow(ProfilePresenter).to receive(:new).and_return(profile_presenter) | ||
|
||
get :show, params: { user_id: user } | ||
|
||
expect(assigns(:profile)).to eq(profile_presenter) | ||
end | ||
end | ||
end |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Based on recent other PRs regarding misspelled usernames (#4312 + #4376), I think this should use
find_by!
so it results in a 404 error instead of redirecting when the user is nonexistent.