Browse Source

if a user has a linked twitter account, give them attribution

master
Carl Chenet 3 years ago
parent
commit
3f6646d87b
2 changed files with 12 additions and 2 deletions
  1. +4
    -0
      app/controllers/stories_controller.rb
  2. +8
    -2
      script/post_to_twitter

+ 4
- 0
app/controllers/stories_controller.rb View File

@@ -163,6 +163,10 @@ class StoriesController < ApplicationController
"apple-touch-icon-144.png",
}

if @story.user.twitter_username.present?
@meta_tags["twitter:creator"] = "@" + @story.user.twitter_username
end

load_user_votes

render :action => "show"


+ 8
- 2
script/post_to_twitter View File

@@ -25,12 +25,18 @@ Time.now - 1.days).order(:id).each_with_index do |s,x|
tags += ' #' + tagging.tag.tag
end

tco_status = "\n" +
via = ""
if s.user.twitter_username.present?
via = "\n" + (s.user_is_author? ? "by" : "via") +
" @#{s.user.twitter_username}"
end

tco_status = via + "\n" +
(s.url.present?? ("X" * Twitter::TCO_LEN) + "\n" : "") +
("X" * Twitter::TCO_LEN) +
tags

status = "\n" +
status = via + "\n" +
(s.url.present?? s.url + "\n" : "") +
s.short_id_url +
tags


Loading…
Cancel
Save