Skip to content
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

Fix for calling mention_link_filter with only one argument #230

Merged
merged 1 commit into from
Oct 27, 2015
Merged

Fix for calling mention_link_filter with only one argument #230

merged 1 commit into from
Oct 27, 2015

Conversation

benbalter
Copy link
Contributor

Currently, the 4th argument for HTML::Pipeline::MentionFilter#mention_link_filter, username_pattern, is required, even though args 2 and 3 are optional.

I believe this is a regression introduced in #157.

I copied the default argument format of mentioned_logins_in to default the final argument to UsernamePattern and added a test (the mention_link_filter had no tests previously AFAIK).

Before:

> filter = HTML::Pipeline::MentionFilter.new nil
=> #<HTML::Pipeline::MentionFilter:0x007fc70aa759d0 @doc=nil, @html=nil, @context={}, @result={}>
> filter.mention_link_filter "@hubot"
ArgumentError: wrong number of arguments (1 for 2..4)
    from /usr/local/opt/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/html-pipeline-2.2.1/lib/html/pipeline/@mention_filter.rb:106:in `mention_link_filter'

After

> filter = HTML::Pipeline::MentionFilter.new nil
=> #<HTML::Pipeline::MentionFilter:0x007fc76b019688 @doc=nil, @html=nil, @context={}, @result={}>
> filter.mention_link_filter "@hubot"
=> "<a href='/hubot' class='user-mention'>@hubot</a>"

/cc @brittballard

@benbalter benbalter changed the title Fix for calling mention_link_filter with only one arg Fix for calling mention_link_filter with only one argument Oct 27, 2015
@jch
Copy link
Contributor

jch commented Oct 27, 2015

@benbalter nice catch, thanks!

jch added a commit that referenced this pull request Oct 27, 2015
Fix for calling mention_link_filter with only one argument
@jch jch merged commit ee354f8 into gjtorikian:master Oct 27, 2015
@benbalter benbalter deleted the mention-link-filter-arg-fix branch October 27, 2015 16:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants