forked from mastodon/mastodon
-
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.
Fix notifications in UI, added new API for fetching account relations…
…hips
- Loading branch information
Showing
11 changed files
with
91 additions
and
17 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,15 @@ | ||
export const NOTIFICATION_DISMISS = 'NOTIFICATION_DISMISS'; | ||
export const NOTIFICATION_CLEAR = 'NOTIFICATION_CLEAR'; | ||
|
||
export function dismissNotification(notification) { | ||
return { | ||
type: NOTIFICATION_DISMISS, | ||
notification: notification | ||
}; | ||
}; | ||
|
||
export function clearNotifications() { | ||
return { | ||
type: NOTIFICATION_CLEAR | ||
}; | ||
}; |
24 changes: 12 additions & 12 deletions
24
app/assets/javascripts/components/features/ui/containers/notifications_container.jsx
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 was deleted.
Oops, something went wrong.
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 @@ | ||
collection @accounts | ||
attribute :id | ||
node(:following) { |account| @following[account.id] || false } | ||
node(:followed_by) { |account| @followed_by[account.id] || false } | ||
node(:blocking) { |account| @blocking[account.id] || 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -71,4 +71,46 @@ | |
expect(user.account.following?(other_account)).to be false | ||
end | ||
end | ||
|
||
describe 'GET #relationships' do | ||
let(:simon) { Fabricate(:user, email: '[email protected]', account: Fabricate(:account, username: 'simon')).account } | ||
let(:lewis) { Fabricate(:user, email: '[email protected]', account: Fabricate(:account, username: 'lewis')).account } | ||
|
||
before do | ||
user.account.follow!(simon) | ||
lewis.follow!(user.account) | ||
end | ||
|
||
context 'provided only one ID' do | ||
before do | ||
get :relationships, params: { id: simon.id } | ||
end | ||
|
||
it 'returns http success' do | ||
expect(response).to have_http_status(:success) | ||
end | ||
|
||
it 'returns JSON with correct data' do | ||
json = body_as_json | ||
|
||
expect(json).to be_a Enumerable | ||
expect(json.first[:following]).to be true | ||
expect(json.first[:followed_by]).to be false | ||
end | ||
end | ||
|
||
context 'provided multiple IDs' do | ||
before do | ||
get :relationships, params: { id: [simon.id, lewis.id] } | ||
end | ||
|
||
it 'returns http success' do | ||
expect(response).to have_http_status(:success) | ||
end | ||
|
||
xit 'returns JSON with correct data' do | ||
# todo | ||
end | ||
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