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

remove link from removed mention? #7

Open
azeemh opened this issue Jun 28, 2021 · 0 comments
Open

remove link from removed mention? #7

azeemh opened this issue Jun 28, 2021 · 0 comments

Comments

@azeemh
Copy link

azeemh commented Jun 28, 2021

edit : first i want to say thank you to the developer. i wrote this message when up late last night.
the gem works fairly well. it does mentions and removes them from the db. i just need to be able to skip unauthorized mentions and remove the link format from a removed mention -- anything that ran .unmention()

using live in production on zedtopia and would like to support this gem development team in the future if we make revenue.

how do i remove the link from an unauthorized mention?

ideas act as mentioners
profiles act as mentionees

in my routes i have

get '/untagidea/:id', to: 'ideas#untag'

I added a method untag to ideas to untag when clicking a link to the aforementioned route:

@idea.unmention(current_user.profile)

however the link still appears on the idea.

i also am using this with a before callback method, m.add_before_callback Proc.new { |idea, profile| profile.mentions_allowed?(current_user) } which i found out works to stop the other user from getting notifications or getting mentions joins in the tables, however the mention handle is still being converted to an element with a link instead of staying an @ tag or being skipped.

I was thinking maybe i just have to unmention afterwards, but the unmention doesn't remove the tag either. (I have a snippet in my view that works as well)
<% if @idea.mentions?(current_user.profile) %> <a href="/untagidea/<%= @idea.id %>">Untag me</a> <% end %>

So after clicking untag me, the link Untag Me doesn't show anymore because @idea.mentions?(current_user) correctly returns false, however the handle is still tagged.

How can i make it so that when a user clicks untag me the handle does not get tagged?
And how can I make sure excluded handles of profiles, that the before callbackmethod was supposed to filter out, are not also being formatted and made into tagged link format?

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

No branches or pull requests

1 participant