Skip to content

Commit

Permalink
changed the error message
Browse files Browse the repository at this point in the history
  • Loading branch information
SidharthBansal committed May 27, 2018
1 parent c7778d6 commit a47b35c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
10 changes: 8 additions & 2 deletions app/controllers/user_tags_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,14 @@ def create

unless exist
user_tag = user.user_tags.build(value: name)
if ["oauth-facebook", "oauth-github", "oauth-google", "oauth-twitter"].include? tagname.split(':')[0]
@output[:errors] << "Only Oauth can create such tags"
if tagname.split(':')[0] == "oauth-facebook"
@output[:errors] << "This tag is used for associating a Facebook account. <a href='https://publiclab.org/wiki/oauth'>Click here to read more </a>"
elsif tagname.split(':')[0] == "oauth-github"
@output[:errors] << "This tag is used for associating a Github account. <a href='https://publiclab.org/wiki/oauth'>Click here to read more </a>"
elsif tagname.split(':')[0] == "oauth-google"
@output[:errors] << "This tag is used for associating a Google account. <a href='https://publiclab.org/wiki/oauth'>Click here to read more </a>"
elsif tagname.split(':')[0] == "oauth-twitter"
@output[:errors] << "This tag is used for associating a Twitter account. <a href='https://publiclab.org/wiki/oauth'>Click here to read more </a>"
elsif user_tag.save
@output[:saved] << [name, user_tag.id]
else
Expand Down
10 changes: 8 additions & 2 deletions app/models/node.rb
Original file line number Diff line number Diff line change
Expand Up @@ -851,8 +851,14 @@ def can_tag(tagname, user, errors = false)
errors ? I18n.t('node.only_admins_can_lock') : false
elsif tagname.split(':')[0] == 'redirect' && Node.where(slug: tagname.split(':')[1]).length <= 0
errors ? I18n.t('node.page_does_not_exist') : false
elsif ["oauth-facebook", "oauth-github", "oauth-google", "oauth-twitter"].include? tagname.split(':')[0]
errors ? "Only Oauth can create such tags" : false
elsif tagname.split(':')[0] == "oauth-facebook"
errors ? "This tag is used for associating a Facebook account. <a href='https://publiclab.org/wiki/oauth'>Click here to read more </a>" : false
elsif tagname.split(':')[0] == "oauth-github"
errors ? "This tag is used for associating a Github account. <a href='https://publiclab.org/wiki/oauth'>Click here to read more </a>" : false
elsif tagname.split(':')[0] == "oauth-google"
errors ? "This tag is used for associating a Google account. <a href='https://publiclab.org/wiki/oauth'>Click here to read more </a>" : false
elsif tagname.split(':')[0] == "oauth-twitter"
errors ? "This tag is used for associating a Twitter account. <a href='https://publiclab.org/wiki/oauth'>Click here to read more </a>" : false
else
true
end
Expand Down

0 comments on commit a47b35c

Please sign in to comment.