From 034d78e3e4ac94037393bd6f718858e65edeec66 Mon Sep 17 00:00:00 2001 From: Benjamin Neff Date: Tue, 2 Jul 2019 01:50:36 +0200 Subject: [PATCH] Remove commentable functionality from photos This is not (and as far as I know, was never) used. If we want to make standalone photos commentable, we can always add it back, but it would also need to change federation for it to work, because comments support only posts there. But for now it makes the code cleaner and easier to remove it. --- app/models/photo.rb | 1 - .../20190701234716_photos_remove_comment_count.rb | 14 ++++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 db/migrate/20190701234716_photos_remove_comment_count.rb diff --git a/app/models/photo.rb b/app/models/photo.rb index 75d7f83a8..5552aefed 100644 --- a/app/models/photo.rb +++ b/app/models/photo.rb @@ -6,7 +6,6 @@ class Photo < ApplicationRecord include Diaspora::Federated::Base - include Diaspora::Commentable include Diaspora::Shareable # NOTE API V1 to be extracted diff --git a/db/migrate/20190701234716_photos_remove_comment_count.rb b/db/migrate/20190701234716_photos_remove_comment_count.rb new file mode 100644 index 000000000..4d6330960 --- /dev/null +++ b/db/migrate/20190701234716_photos_remove_comment_count.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +class PhotosRemoveCommentCount < ActiveRecord::Migration[5.1] + class Comment < ApplicationRecord + end + + def change + remove_column :photos, :comments_count, :integer + + reversible do |change| + change.up { Comment.where(commentable_type: "Photo").delete_all } + end + end +end