Add from account to notifications api#10796
Merged
Gargron merged 6 commits intomastodon:masterfrom May 21, 2019
pwoolcoc:add-from-account-to-notifications-api
Merged
Add from account to notifications api#10796Gargron merged 6 commits intomastodon:masterfrom pwoolcoc:add-from-account-to-notifications-api
Gargron merged 6 commits intomastodon:masterfrom
pwoolcoc:add-from-account-to-notifications-api
Conversation
added 4 commits
May 20, 2019 05:32
this adds the ability to filter notifications by the account they originated from
Gargron
requested changes
May 20, 2019
Member
Gargron
left a comment
There was a problem hiding this comment.
I like the idea, just need some details changed
* use account id instead of user@domain * name the param `account_id` instead of `from_account`
Gargron
requested changes
May 21, 2019
| scope :browserable, ->(exclude_types = [], account_id = nil) { | ||
| types = TYPE_CLASS_MAP.values - activity_types_from_types(exclude_types + [:follow_request]) | ||
| where(activity_type: types) | ||
| return where(activity_type: types) if account_id.nil? |
Member
There was a problem hiding this comment.
This is a lambda, not a method, so the return keyword acts differently here. I suggest just an if/else block. Or you can change the scope to a class-level method:
class << self
def browserable(exclude_types = [], account_id = nil)
types = TYPE_CLASS_MAP.values - activity_types_from_types(exclude_types + [:follow_request])
return where(activity_type: types) if account_id.nil?
where(activity_type: types, from_account_id: account_id)
end
end
Contributor
Author
There was a problem hiding this comment.
done, though I thought return acted differently in procs not lambdas
Gargron
approved these changes
May 21, 2019
SnDer
pushed a commit
to quey-org/docs
that referenced
this pull request
Jul 3, 2019
This PR is dependent on another PR getting merged: mastodon/mastodon#10796 . If that PR is not accepted, this can also be closed
hiyuki2578
pushed a commit
to ProjectMyosotis/mastodon
that referenced
this pull request
Oct 2, 2019
* Add `from_account` to notifications API this adds the ability to filter notifications by the account they originated from * passing a non-existent user should cause none to be returned * Fix codeclimate warnings * fix more codeclimate warnings * make requested changes: * use account id instead of user@domain * name the param `account_id` instead of `from_account` * Don't use `return` in a lambda
hiyuki2578
pushed a commit
to ProjectMyosotis/mastodon
that referenced
this pull request
Oct 2, 2019
* Add `from_account` to notifications API this adds the ability to filter notifications by the account they originated from * passing a non-existent user should cause none to be returned * Fix codeclimate warnings * fix more codeclimate warnings * make requested changes: * use account id instead of user@domain * name the param `account_id` instead of `from_account` * Don't use `return` in a lambda
Gargron
pushed a commit
to mastodon/documentation
that referenced
this pull request
Jan 5, 2020
This PR is dependent on another PR getting merged: mastodon/mastodon#10796 . If that PR is not accepted, this can also be closed
messenjahofchrist
pushed a commit
to Origin-Creative/mastodon
that referenced
this pull request
Jul 30, 2021
* Add `from_account` to notifications API this adds the ability to filter notifications by the account they originated from * passing a non-existent user should cause none to be returned * Fix codeclimate warnings * fix more codeclimate warnings * make requested changes: * use account id instead of user@domain * name the param `account_id` instead of `from_account` * Don't use `return` in a lambda
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This adds the ability to filter notifications by the account they originated from. Currently there is no UI for this, it only adds the ability to the API.