Method for returning issues readable by a user
The method Ability.issues_readable_by_user takes a list of users and an optional user and returns an Array of issues readable by said user. This method in turn is used by Banzai::ReferenceParser::IssueParser#nodes_visible_to_user so this method no longer needs to get all the available abilities just to check if a user has the "read_issue" ability. To test this I benchmarked an issue with 222 comments on my development environment. Using these changes the time spent in nodes_visible_to_user was reduced from around 120 ms to around 40 ms.
显示
- CHANGELOG 1 个添加, 0 个删除CHANGELOG
- app/models/ability.rb 10 个添加, 0 个删除app/models/ability.rb
- app/models/issue.rb 28 个添加, 0 个删除app/models/issue.rb
- lib/banzai/reference_parser/issue_parser.rb 4 个添加, 3 个删除lib/banzai/reference_parser/issue_parser.rb
- spec/lib/banzai/reference_parser/issue_parser_spec.rb 6 个添加, 6 个删除spec/lib/banzai/reference_parser/issue_parser_spec.rb
- spec/models/ability_spec.rb 48 个添加, 0 个删除spec/models/ability_spec.rb
- spec/models/concerns/mentionable_spec.rb 5 个添加, 1 个删除spec/models/concerns/mentionable_spec.rb
- spec/models/issue_spec.rb 253 个添加, 0 个删除spec/models/issue_spec.rb
加载中
想要评论请 注册 或 登录