Skip to content

Commit

Permalink
Merge pull request #3924 from annict/goodbye-twitter
Browse files Browse the repository at this point in the history
Goodbye Twitter
  • Loading branch information
shimbaco committed May 28, 2023
2 parents 042bd81 + 0d514b0 commit e2fd428
Show file tree
Hide file tree
Showing 60 changed files with 50 additions and 527 deletions.
2 changes: 0 additions & 2 deletions .env.development
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,4 @@ S3_ENDPOINT=https://xxxxx
S3_REGION=xxxxx
S3_SECRET_ACCESS_KEY=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
SENTRY_DSN=
TWITTER_CONSUMER_KEY=xxxxxxxxxxxxxxxxxxxxx
TWITTER_CONSUMER_SECRET=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
TZ=Asia/Tokyo
2 changes: 0 additions & 2 deletions .env.test
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,4 @@ S3_ACCESS_KEY_ID=
S3_BUCKET_NAME=
S3_SECRET_ACCESS_KEY=
SENTRY_DSN=
TWITTER_CONSUMER_KEY=twtwtwtwtwtwtwtwtwtwtw
TWITTER_CONSUMER_SECRET=secretsecretsecretsecretsecretsecret
TZ=Asia/Tokyo
1 change: 0 additions & 1 deletion .standard_todo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ ignore:
- lib/tasks/email_notification.rake
- lib/tasks/episode.rake
- lib/tasks/mal.rake
- lib/tasks/twitter.rake
- lib/tasks/work.rake
- spec/spec_helper.rb
- spec/support/devise.rb
2 changes: 0 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ gem "nokogiri"
gem "omniauth-facebook"
gem "omniauth-gumroad"
gem "omniauth-rails_csrf_protection"
gem "omniauth-twitter"
gem "pg"
gem "prelude-batch-loader", require: "prelude"
gem "propshaft"
Expand All @@ -75,7 +74,6 @@ gem "sentry-rails"
gem "shrine"
gem "slim"
gem "syoboi_calendar"
gem "twitter"
gem "view_component"
gem "virtus"
gem "wilson_score"
Expand Down
45 changes: 0 additions & 45 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,6 @@ GEM
binding_of_caller (1.0.0)
debug_inspector (>= 0.0.1)
browser (5.3.1)
buftok (0.2.0)
builder (3.2.4)
bullet (7.0.7)
activesupport (>= 3.0.0)
Expand Down Expand Up @@ -173,8 +172,6 @@ GEM
diff-lcs (1.5.0)
discord-notifier (1.0.3)
docile (1.3.5)
domain_name (0.5.20190701)
unf (>= 0.0.5, < 1.0.0)
doorkeeper (5.6.0)
railties (>= 5)
dotenv (2.8.1)
Expand Down Expand Up @@ -210,7 +207,6 @@ GEM
activemodel
enumerize (2.5.0)
activesupport (>= 3.2)
equalizer (0.0.11)
erubi (1.12.0)
factory_bot (6.2.0)
activesupport (>= 5.0.0)
Expand Down Expand Up @@ -243,9 +239,6 @@ GEM
faraday_middleware (1.0.0)
faraday (~> 1.0)
ffi (1.15.5)
ffi-compiler (1.0.1)
ffi (>= 1.0.0)
rake
get_process_mem (0.2.7)
ffi (~> 1.0)
github-markup (4.0.1)
Expand All @@ -264,18 +257,7 @@ GEM
hashie (5.0.0)
highline (2.0.3)
hiredis (0.6.3)
http (4.4.1)
addressable (~> 2.3)
http-cookie (~> 1.0)
http-form_data (~> 2.2)
http-parser (~> 1.2.0)
http-cookie (1.0.3)
domain_name (~> 0.5)
http-form_data (2.3.0)
http-parser (1.2.3)
ffi-compiler (>= 1.0, < 2.0)
http_accept_language (2.1.1)
http_parser.rb (0.6.0)
httparty (0.21.0)
mini_mime (>= 1.0.0)
multi_xml (>= 0.5.2)
Expand Down Expand Up @@ -339,8 +321,6 @@ GEM
net-pop
net-smtp
marcel (1.0.2)
memoizable (0.4.2)
thread_safe (~> 0.3, >= 0.3.1)
memory_profiler (1.0.0)
meta-tags (2.18.0)
actionpack (>= 3.2.0, < 7.1)
Expand All @@ -354,7 +334,6 @@ GEM
multi_json (1.15.0)
multi_xml (0.6.0)
multipart-post (2.2.3)
naught (1.1.0)
net-imap (0.3.4)
date
net-protocol
Expand All @@ -368,7 +347,6 @@ GEM
nokogiri (1.14.0)
mini_portile2 (~> 2.8.0)
racc (~> 1.4)
oauth (0.5.6)
oauth2 (1.4.7)
faraday (>= 0.8, < 2.0)
jwt (>= 1.0, < 3.0)
Expand All @@ -383,18 +361,12 @@ GEM
omniauth-gumroad (1.0.1)
omniauth (~> 1.0)
omniauth-oauth2 (~> 1.1)
omniauth-oauth (1.2.0)
oauth
omniauth (>= 1.0, < 3)
omniauth-oauth2 (1.7.1)
oauth2 (~> 1.4)
omniauth (>= 1.9, < 3)
omniauth-rails_csrf_protection (0.1.2)
actionpack (>= 4.2)
omniauth (>= 1.3.1)
omniauth-twitter (1.4.0)
omniauth-oauth (~> 1.1)
rack
orm_adapter (0.5.0)
parallel (1.22.1)
parser (3.1.2.1)
Expand Down Expand Up @@ -534,7 +506,6 @@ GEM
shrine (3.4.0)
content_disposition (~> 1.0)
down (~> 5.1)
simple_oauth (0.3.1)
simplecov (0.21.2)
docile (~> 1.1)
simplecov-html (~> 0.11)
Expand Down Expand Up @@ -578,22 +549,8 @@ GEM
timeout (0.3.1)
traceroute (0.8.1)
rails (>= 3.0.0)
twitter (7.0.0)
addressable (~> 2.3)
buftok (~> 0.2.0)
equalizer (~> 0.0.11)
http (~> 4.0)
http-form_data (~> 2.0)
http_parser.rb (~> 0.6.0)
memoizable (~> 0.4.0)
multipart-post (~> 2.0)
naught (~> 1.0)
simple_oauth (~> 0.3.0)
tzinfo (2.0.5)
concurrent-ruby (~> 1.0)
unf (0.1.4)
unf_ext
unf_ext (0.0.7.7)
unicode-display_width (2.3.0)
uniform_notifier (1.16.0)
unparser (0.6.5)
Expand Down Expand Up @@ -678,7 +635,6 @@ DEPENDENCIES
omniauth-facebook
omniauth-gumroad
omniauth-rails_csrf_protection
omniauth-twitter
pg
prelude-batch-loader
propshaft
Expand Down Expand Up @@ -709,7 +665,6 @@ DEPENDENCIES
syoboi_calendar
timecop
traceroute
twitter
view_component
virtus
wilson_score
Expand Down
15 changes: 1 addition & 14 deletions app/components/deprecated/forms/episode_record_form_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,24 +42,11 @@ def render
end

h.tag :div, class: "row" do
h.tag :div, class: "col" do
if current_user&.authorized_to?(:twitter, shareable: true)
h.tag :div, class: "form-check" do
h.tag :label, class: "form-check-label" do
h.html f.check_box(:share_to_twitter, class: "form-check-input", checked: current_user.share_record_to_twitter?)
h.tag :i, class: "fab fa-twitter u-text-twitter"
end
end
end
end

h.tag :div, class: "col" do
h.tag :div, class: "col-12" do
h.tag :div, class: "text-center" do
h.html f.submit((f.object.persisted? ? t("verb.update") : t("verb.track")), class: "btn btn-primary", data: {"forms--episode-record-form-target": "submitButton"})
end
end

h.tag :div, class: "col"
end
end
end
Expand Down
15 changes: 1 addition & 14 deletions app/components/deprecated/forms/work_record_form_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,27 +47,14 @@ def render
end

h.tag :div, class: "row" do
h.tag :div, class: "col" do
if current_user&.authorized_to?(:twitter, shareable: true)
h.tag :div, class: "form-check" do
h.tag :label, class: "form-check-label" do
h.html f.check_box(:share_to_twitter, class: "form-check-input", checked: current_user.share_record_to_twitter?)
h.tag :i, class: "fab fa-twitter u-text-twitter"
end
end
end
end

h.tag :div, class: "col" do
h.tag :div, class: "col-12" do
h.tag :div, class: "text-center" do
h.html f.submit((f.object.persisted? ? t("verb.update") : t("verb.track")), {
class: "btn btn-primary",
data: {"forms--work-record-form-target": "submitButton"}
})
end
end

h.tag :div, class: "col"
end
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def create
private

def episode_record_form_params
params.required(:forms_episode_record_form).permit(:comment, :rating, :share_to_twitter, :watched_at)
params.required(:forms_episode_record_form).permit(:comment, :rating, :watched_at)
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def create

def work_record_form_params
params.require(:forms_work_record_form).permit(
:comment, :share_to_twitter,
:comment,
:rating_overall, :rating_animation, :rating_character, :rating_story, :rating_music,
:watched_at
)
Expand Down
3 changes: 0 additions & 3 deletions app/controllers/api/internal/episode_records_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ class EpisodeRecordsController < Api::Internal::ApplicationController
def create
episode = Episode.only_kept.find(params[:episode_id])
form = Forms::EpisodeRecordForm.new(user: current_user, episode: episode)
form.attributes = {
share_to_twitter: current_user.share_record_to_twitter?
}

if form.invalid?
return render(status: 400, json: {message: form.errors.full_messages.first})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@ def create
ActiveRecord::Base.transaction do
episodes.each do |episode|
form = Forms::EpisodeRecordForm.new(user: current_user, episode: episode)
form.attributes = {
share_to_twitter: false
}

if form.invalid?
return render json: form.errors.full_messages, status: :unprocessable_entity
Expand Down
4 changes: 2 additions & 2 deletions app/controllers/api/internal/records_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@ def update
private

def episode_record_form_params
params.required(:forms_episode_record_form).permit(:comment, :rating, :share_to_twitter, :watched_at)
params.required(:forms_episode_record_form).permit(:comment, :rating, :watched_at)
end

def work_record_form_params
params.required(:forms_work_record_form).permit(
:comment, :share_to_twitter,
:comment,
:rating_overall, :rating_animation, :rating_character, :rating_story, :rating_music,
:watched_at
)
Expand Down
6 changes: 2 additions & 4 deletions app/controllers/api/v1/me/records_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ def create
form.attributes = {
comment: @params.comment,
deprecated_rating: @params.rating,
rating: @params.rating_state,
share_to_twitter: @params.share_twitter
rating: @params.rating_state
}

if form.invalid?
Expand All @@ -38,8 +37,7 @@ def update
form.attributes = {
comment: @params.comment,
rating: @params.rating_state,
deprecated_rating: @params.rating,
share_to_twitter: @params.share_twitter
deprecated_rating: @params.rating
}

if form.invalid?
Expand Down
6 changes: 2 additions & 4 deletions app/controllers/api/v1/me/reviews_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ def create
rating_music: @params.rating_music_state,
rating_story: @params.rating_story_state,
rating_character: @params.rating_character_state,
rating_overall: @params.rating_overall_state,
share_to_twitter: @params.share_twitter
rating_overall: @params.rating_overall_state
}

if form.invalid?
Expand Down Expand Up @@ -47,8 +46,7 @@ def update
rating_character: @params.rating_character_state,
rating_music: @params.rating_music_state,
rating_overall: @params.rating_overall_state,
rating_story: @params.rating_story_state,
share_to_twitter: @params.share_twitter
rating_story: @params.rating_story_state
}

if form.invalid?
Expand Down
7 changes: 2 additions & 5 deletions app/controllers/callbacks_controller.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

class CallbacksController < Devise::OmniauthCallbacksController
before_action :authorize, only: %i[gumroad twitter]
before_action :authorize, only: %i[gumroad]

def facebook
auth = request.env["omniauth.auth"]
Expand Down Expand Up @@ -57,9 +57,6 @@ def facebook
def gumroad
end

def twitter
end

private

def authorize
Expand Down Expand Up @@ -113,7 +110,7 @@ def provider_attributes(auth)
uid: auth[:uid],
token: credentials[:token],
token_expires_at: (auth[:provider] == "facebook" ? credentials[:expires_at] : nil),
token_secret: (auth[:provider] == "twitter" ? credentials[:secret] : nil)
token_secret: nil
}
end

Expand Down
2 changes: 0 additions & 2 deletions app/controllers/fragment/records_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ def edit
@form.attributes = {
comment: episode_record.body,
rating: episode_record.rating_state,
share_to_twitter: current_user.share_record_to_twitter?,
watched_at: @record.watched_at
}
else
Expand All @@ -48,7 +47,6 @@ def edit
rating_character: work_record.rating_character_state,
rating_story: work_record.rating_story_state,
rating_music: work_record.rating_music_state,
share_to_twitter: current_user.share_record_to_twitter?,
watched_at: @record.watched_at
}
end
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/settings/options_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def update
private

def setting_params
params.require(:setting).permit(:hide_record_body, :hide_supporter_badge, :share_status_to_twitter)
params.require(:setting).permit(:hide_record_body, :hide_supporter_badge)
end
end
end

0 comments on commit e2fd428

Please sign in to comment.