fedibird-fe/app/models/status.rb

657 lines
22 KiB
Ruby
Raw Normal View History

# frozen_string_literal: true
# == Schema Information
#
# Table name: statuses
#
# id :bigint(8) not null, primary key
# uri :string
# text :text default(""), not null
# created_at :datetime not null
# updated_at :datetime not null
# in_reply_to_id :bigint(8)
# reblog_of_id :bigint(8)
# url :string
# sensitive :boolean default(FALSE), not null
# visibility :integer default("public"), not null
# spoiler_text :text default(""), not null
# reply :boolean default(FALSE), not null
# language :string
# conversation_id :bigint(8)
# local :boolean
# account_id :bigint(8) not null
# application_id :bigint(8)
# in_reply_to_account_id :bigint(8)
# poll_id :bigint(8)
2020-06-15 22:56:38 +00:00
# deleted_at :datetime
2021-07-12 07:39:07 +00:00
# quote_id :bigint(8)
# expired_at :datetime
2022-08-23 05:14:23 +00:00
# searchability :integer
#
2016-08-17 15:56:23 +00:00
class Status < ApplicationRecord
before_destroy :unlink_from_conversations
include Discard::Model
include Paginable
2016-11-30 14:57:56 +00:00
include Cacheable
include StatusThreadingConcern
include RateLimitable
Add feature circle Squashed commit of the following: commit 7b2ba61c4841e23081552fb79270e4e430dd1fe0 Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Sep 5 16:03:52 2020 +0900 Add the ability to change to a new circle by replying to a circle commit 7013a228c65c7bd147885de458b50095f3c24334 Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Sep 5 16:10:57 2020 +0900 fixup! add-limited-visibility-icon-to-status commit 679aa8a7f9bef42ee5d0b326d9ae4925a1999939 Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Sep 5 15:12:53 2020 +0900 Fix 14666 commit b3addd8220d8bb3512ff345b32ca83c714dadd2a Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Sep 5 11:44:12 2020 +0900 Add Japanese translation for circle commit b7f4b773a0cd554084d5ad6a5923adb06b3acfc4 Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Sep 5 11:40:12 2020 +0900 Squashed commit of the following: commit b85a4685b27c49462288aba5f38723b91e936c4a Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Sep 5 10:50:03 2020 +0900 Changed to remove restrictions on privacy options and allow users to switch circles when replying commit 0a8c0140c73d7c5333e4f8017964adb5061a7cf1 Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Sep 5 09:33:07 2020 +0900 Change limited visibility icon commit b64adf19788d828249408454ec6afa9beb3d4872 Author: noellabo <noel.yoshiba@gmail.com> Date: Mon Aug 31 06:50:56 2020 +0900 Fix a change to limited-visibility-bearcaps replies commit ed361405b5e38857a2f42b0515a599ddcdd412cf Author: noellabo <noel.yoshiba@gmail.com> Date: Thu Aug 27 15:53:18 2020 +0900 Fix composer text when change visibility commit 4da3adddb6ffde43070d743e34c5b56e06579b30 Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Aug 22 22:34:23 2020 +0900 Fix wrong circle_id when changing visibility commit 752d7fc2a3c9e34fab9993d767f83c6eae7ba55a Author: noellabo <noel.yoshiba@gmail.com> Date: Sun Aug 9 13:12:51 2020 +0900 Add circle reply and redraft commit 5978bc04a24695edce6717bda89dcf6f861ef2c4 Author: noellabo <noel.yoshiba@gmail.com> Date: Mon Jul 27 01:07:52 2020 +0900 Fix remove unused props commit 7970f69676c24b4aa9385fee8b1635c46ba52fcd Author: noellabo <noel.yoshiba@gmail.com> Date: Sun Jul 26 21:17:07 2020 +0900 Separate circle choice from privacy commit 36f6a684c0b0c895d4d0f1b9d09b05c91b104666 Author: noellabo <noel.yoshiba@gmail.com> Date: Thu Jul 23 10:54:25 2020 +0900 Add UI for posting to circles commit 7ef48003c1407275663dd603b124d292db2aa93a Author: noellabo <noel.yoshiba@gmail.com> Date: Fri Jul 24 12:55:10 2020 +0900 Fix silent mention by circle commit 7a1caed49333c3d3241301afb77639cdf1cabdc0 Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Sep 5 11:38:10 2020 +0900 Squashed commit of the following: commit dca71fab86c830932ca760b7d8b3f89cc25c453e Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Sep 5 09:31:26 2020 +0900 Revert "Add focus setting when opening the circle column" This reverts commit 3a93ac99312a13b68b7edc2b81313fb0ffb7bcdc. commit 0a1bc8307bb699c7eb3024072ce14a440df1fc87 Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Sep 5 09:31:11 2020 +0900 Change limited visibility icon commit 9784f8b562f6592e9d9190ca29d2b2e870006d10 Author: noellabo <noel.yoshiba@gmail.com> Date: Thu Aug 13 21:52:07 2020 +0900 Add focus setting when opening the circle column commit a84f680c167fab9276550850c60f9108d251144e Author: noellabo <noel.yoshiba@gmail.com> Date: Thu Aug 13 15:55:27 2020 +0900 Fix message commit e3f11c4adac57b6e6a15c981ed6f4721a1634212 Author: noellabo <noel.yoshiba@gmail.com> Date: Mon Jul 27 01:01:23 2020 +0900 Fix light-theme commit d7d96eda5b86d3e3f654ce79888e7cf5aa535db5 Author: noellabo <noel.yoshiba@gmail.com> Date: Sun Jul 26 21:50:56 2020 +0900 Fix circles loading in share page and followers search commit 10b821f7b8c0a87cea3df51f09deeadc2cb40b32 Author: noellabo <noel.yoshiba@gmail.com> Date: Fri Jul 24 14:08:00 2020 +0900 Refactor list items commit e020072915572ce409039ccf799d08f8d8b5b393 Author: noellabo <noel.yoshiba@gmail.com> Date: Thu Jul 23 20:15:38 2020 +0900 Fixed a bug that circle name change is not reflected in the list commit 735bc41161b4c09a8dafe2c0064096b3ca79f2a0 Author: noellabo <noel.yoshiba@gmail.com> Date: Wed Jul 22 08:49:47 2020 +0900 Add UI for managing circle members commit d7c3145b8fa84be0631bf7f41bb229f3e6d03ff1 Author: noellabo <noel.yoshiba@gmail.com> Date: Wed Jul 22 07:34:52 2020 +0900 Add the followers option to AccountSearchSercive commit 65e2b0c4299b72ede440b50089c1bd6afa6c9c05 Author: noellabo <noel.yoshiba@gmail.com> Date: Wed Jul 22 07:05:56 2020 +0900 Add CircleSerializer commit a639e1803abf5590068846dbe98bc5edfaa2ad82 Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Sep 5 11:37:30 2020 +0900 Squashed commit of the following: commit 9cb3fb9d980e3ee066083076f508c5ab1447176a Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Sep 5 07:15:19 2020 +0900 Move the link to the mention list to the menu commit b32dd87b43f4e09b8e2c437f1fb5d3ebd6221215 Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Sep 5 00:56:12 2020 +0900 Change limited visibility icon commit 8db0d024119d1c2cef8de849f2501496a166a2dd Author: noellabo <noel.yoshiba@gmail.com> Date: Tue Sep 1 01:42:13 2020 +0900 Fix to disallow getting the list of mentions in limited replies commit 490a9d65a59a3dd0d86e81f6780e879dc4313dff Author: noellabo <noel.yoshiba@gmail.com> Date: Fri Jul 24 11:36:24 2020 +0900 Add column to list mentioned accounts of limited status commit 62a423ac2729c16f26fafe111f257bc373218df2 Author: noellabo <noel.yoshiba@gmail.com> Date: Thu Jul 23 13:30:17 2020 +0900 Fix visibility compatibility more commit a5cfa54b259054f41e89037f299fa928a2361818 Author: noellabo <noel.yoshiba@gmail.com> Date: Mon Jul 20 05:39:49 2020 +0900 Fix visibility compatibility commit 7900ca5650c77565b86ddc594a221dfa3b5321b4 Author: noellabo <noel.yoshiba@gmail.com> Date: Mon Jul 20 02:01:27 2020 +0900 Add limited visibility icon to status commit 66b83965ef068e9ee8c940249c68bcbde15731fe Author: Eugen Rochko <eugen@zeonfederated.com> Date: Wed Aug 26 03:16:47 2020 +0200 Add conversation-based forwarding for limited visibility statuses through bearcaps commit 561abc65e0ace89318b3952047025b8d98515fbb Author: Eugen Rochko <eugen@zeonfederated.com> Date: Sun Jul 19 02:05:16 2020 +0200 Add REST API for managing and posting to circles Circles are the conceptual opposite of lists. A list is a subdivision of your follows, a circle is a subdivision of your followers. Posting to a circle means making content available to only some of your followers. Circles have been internally supported in Mastodon for the purposes of federation since #8950, this adds the REST API necessary for making use of them in Mastodon itsef.
2020-09-05 07:33:17 +00:00
include Redisable
rate_limit by: :account, family: :statuses
self.discard_column = :deleted_at
# If `override_timestamps` is set at creation time, Snowflake ID creation
# will be based on current time instead of `created_at`
2022-08-27 10:57:05 +00:00
attr_accessor :override_timestamps, :circle, :expires_at, :expires_action
Add feature circle Squashed commit of the following: commit 7b2ba61c4841e23081552fb79270e4e430dd1fe0 Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Sep 5 16:03:52 2020 +0900 Add the ability to change to a new circle by replying to a circle commit 7013a228c65c7bd147885de458b50095f3c24334 Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Sep 5 16:10:57 2020 +0900 fixup! add-limited-visibility-icon-to-status commit 679aa8a7f9bef42ee5d0b326d9ae4925a1999939 Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Sep 5 15:12:53 2020 +0900 Fix 14666 commit b3addd8220d8bb3512ff345b32ca83c714dadd2a Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Sep 5 11:44:12 2020 +0900 Add Japanese translation for circle commit b7f4b773a0cd554084d5ad6a5923adb06b3acfc4 Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Sep 5 11:40:12 2020 +0900 Squashed commit of the following: commit b85a4685b27c49462288aba5f38723b91e936c4a Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Sep 5 10:50:03 2020 +0900 Changed to remove restrictions on privacy options and allow users to switch circles when replying commit 0a8c0140c73d7c5333e4f8017964adb5061a7cf1 Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Sep 5 09:33:07 2020 +0900 Change limited visibility icon commit b64adf19788d828249408454ec6afa9beb3d4872 Author: noellabo <noel.yoshiba@gmail.com> Date: Mon Aug 31 06:50:56 2020 +0900 Fix a change to limited-visibility-bearcaps replies commit ed361405b5e38857a2f42b0515a599ddcdd412cf Author: noellabo <noel.yoshiba@gmail.com> Date: Thu Aug 27 15:53:18 2020 +0900 Fix composer text when change visibility commit 4da3adddb6ffde43070d743e34c5b56e06579b30 Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Aug 22 22:34:23 2020 +0900 Fix wrong circle_id when changing visibility commit 752d7fc2a3c9e34fab9993d767f83c6eae7ba55a Author: noellabo <noel.yoshiba@gmail.com> Date: Sun Aug 9 13:12:51 2020 +0900 Add circle reply and redraft commit 5978bc04a24695edce6717bda89dcf6f861ef2c4 Author: noellabo <noel.yoshiba@gmail.com> Date: Mon Jul 27 01:07:52 2020 +0900 Fix remove unused props commit 7970f69676c24b4aa9385fee8b1635c46ba52fcd Author: noellabo <noel.yoshiba@gmail.com> Date: Sun Jul 26 21:17:07 2020 +0900 Separate circle choice from privacy commit 36f6a684c0b0c895d4d0f1b9d09b05c91b104666 Author: noellabo <noel.yoshiba@gmail.com> Date: Thu Jul 23 10:54:25 2020 +0900 Add UI for posting to circles commit 7ef48003c1407275663dd603b124d292db2aa93a Author: noellabo <noel.yoshiba@gmail.com> Date: Fri Jul 24 12:55:10 2020 +0900 Fix silent mention by circle commit 7a1caed49333c3d3241301afb77639cdf1cabdc0 Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Sep 5 11:38:10 2020 +0900 Squashed commit of the following: commit dca71fab86c830932ca760b7d8b3f89cc25c453e Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Sep 5 09:31:26 2020 +0900 Revert "Add focus setting when opening the circle column" This reverts commit 3a93ac99312a13b68b7edc2b81313fb0ffb7bcdc. commit 0a1bc8307bb699c7eb3024072ce14a440df1fc87 Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Sep 5 09:31:11 2020 +0900 Change limited visibility icon commit 9784f8b562f6592e9d9190ca29d2b2e870006d10 Author: noellabo <noel.yoshiba@gmail.com> Date: Thu Aug 13 21:52:07 2020 +0900 Add focus setting when opening the circle column commit a84f680c167fab9276550850c60f9108d251144e Author: noellabo <noel.yoshiba@gmail.com> Date: Thu Aug 13 15:55:27 2020 +0900 Fix message commit e3f11c4adac57b6e6a15c981ed6f4721a1634212 Author: noellabo <noel.yoshiba@gmail.com> Date: Mon Jul 27 01:01:23 2020 +0900 Fix light-theme commit d7d96eda5b86d3e3f654ce79888e7cf5aa535db5 Author: noellabo <noel.yoshiba@gmail.com> Date: Sun Jul 26 21:50:56 2020 +0900 Fix circles loading in share page and followers search commit 10b821f7b8c0a87cea3df51f09deeadc2cb40b32 Author: noellabo <noel.yoshiba@gmail.com> Date: Fri Jul 24 14:08:00 2020 +0900 Refactor list items commit e020072915572ce409039ccf799d08f8d8b5b393 Author: noellabo <noel.yoshiba@gmail.com> Date: Thu Jul 23 20:15:38 2020 +0900 Fixed a bug that circle name change is not reflected in the list commit 735bc41161b4c09a8dafe2c0064096b3ca79f2a0 Author: noellabo <noel.yoshiba@gmail.com> Date: Wed Jul 22 08:49:47 2020 +0900 Add UI for managing circle members commit d7c3145b8fa84be0631bf7f41bb229f3e6d03ff1 Author: noellabo <noel.yoshiba@gmail.com> Date: Wed Jul 22 07:34:52 2020 +0900 Add the followers option to AccountSearchSercive commit 65e2b0c4299b72ede440b50089c1bd6afa6c9c05 Author: noellabo <noel.yoshiba@gmail.com> Date: Wed Jul 22 07:05:56 2020 +0900 Add CircleSerializer commit a639e1803abf5590068846dbe98bc5edfaa2ad82 Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Sep 5 11:37:30 2020 +0900 Squashed commit of the following: commit 9cb3fb9d980e3ee066083076f508c5ab1447176a Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Sep 5 07:15:19 2020 +0900 Move the link to the mention list to the menu commit b32dd87b43f4e09b8e2c437f1fb5d3ebd6221215 Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Sep 5 00:56:12 2020 +0900 Change limited visibility icon commit 8db0d024119d1c2cef8de849f2501496a166a2dd Author: noellabo <noel.yoshiba@gmail.com> Date: Tue Sep 1 01:42:13 2020 +0900 Fix to disallow getting the list of mentions in limited replies commit 490a9d65a59a3dd0d86e81f6780e879dc4313dff Author: noellabo <noel.yoshiba@gmail.com> Date: Fri Jul 24 11:36:24 2020 +0900 Add column to list mentioned accounts of limited status commit 62a423ac2729c16f26fafe111f257bc373218df2 Author: noellabo <noel.yoshiba@gmail.com> Date: Thu Jul 23 13:30:17 2020 +0900 Fix visibility compatibility more commit a5cfa54b259054f41e89037f299fa928a2361818 Author: noellabo <noel.yoshiba@gmail.com> Date: Mon Jul 20 05:39:49 2020 +0900 Fix visibility compatibility commit 7900ca5650c77565b86ddc594a221dfa3b5321b4 Author: noellabo <noel.yoshiba@gmail.com> Date: Mon Jul 20 02:01:27 2020 +0900 Add limited visibility icon to status commit 66b83965ef068e9ee8c940249c68bcbde15731fe Author: Eugen Rochko <eugen@zeonfederated.com> Date: Wed Aug 26 03:16:47 2020 +0200 Add conversation-based forwarding for limited visibility statuses through bearcaps commit 561abc65e0ace89318b3952047025b8d98515fbb Author: Eugen Rochko <eugen@zeonfederated.com> Date: Sun Jul 19 02:05:16 2020 +0200 Add REST API for managing and posting to circles Circles are the conceptual opposite of lists. A list is a subdivision of your follows, a circle is a subdivision of your followers. Posting to a circle means making content available to only some of your followers. Circles have been internally supported in Mastodon for the purposes of federation since #8950, this adds the REST API necessary for making use of them in Mastodon itsef.
2020-09-05 07:33:17 +00:00
2021-07-12 07:39:07 +00:00
update_index('statuses', :proper)
2021-02-10 00:06:37 +00:00
enum visibility: [:public, :unlisted, :private, :direct, :limited, :mutual], _suffix: :visibility
2022-08-23 05:14:23 +00:00
enum searchability: [:public, :unlisted, :private, :direct, :limited, :mutual], _suffix: :searchability
belongs_to :application, class_name: 'Doorkeeper::Application', optional: true
belongs_to :account, inverse_of: :statuses
belongs_to :in_reply_to_account, foreign_key: 'in_reply_to_account_id', class_name: 'Account', optional: true
Add feature circle Squashed commit of the following: commit 7b2ba61c4841e23081552fb79270e4e430dd1fe0 Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Sep 5 16:03:52 2020 +0900 Add the ability to change to a new circle by replying to a circle commit 7013a228c65c7bd147885de458b50095f3c24334 Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Sep 5 16:10:57 2020 +0900 fixup! add-limited-visibility-icon-to-status commit 679aa8a7f9bef42ee5d0b326d9ae4925a1999939 Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Sep 5 15:12:53 2020 +0900 Fix 14666 commit b3addd8220d8bb3512ff345b32ca83c714dadd2a Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Sep 5 11:44:12 2020 +0900 Add Japanese translation for circle commit b7f4b773a0cd554084d5ad6a5923adb06b3acfc4 Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Sep 5 11:40:12 2020 +0900 Squashed commit of the following: commit b85a4685b27c49462288aba5f38723b91e936c4a Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Sep 5 10:50:03 2020 +0900 Changed to remove restrictions on privacy options and allow users to switch circles when replying commit 0a8c0140c73d7c5333e4f8017964adb5061a7cf1 Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Sep 5 09:33:07 2020 +0900 Change limited visibility icon commit b64adf19788d828249408454ec6afa9beb3d4872 Author: noellabo <noel.yoshiba@gmail.com> Date: Mon Aug 31 06:50:56 2020 +0900 Fix a change to limited-visibility-bearcaps replies commit ed361405b5e38857a2f42b0515a599ddcdd412cf Author: noellabo <noel.yoshiba@gmail.com> Date: Thu Aug 27 15:53:18 2020 +0900 Fix composer text when change visibility commit 4da3adddb6ffde43070d743e34c5b56e06579b30 Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Aug 22 22:34:23 2020 +0900 Fix wrong circle_id when changing visibility commit 752d7fc2a3c9e34fab9993d767f83c6eae7ba55a Author: noellabo <noel.yoshiba@gmail.com> Date: Sun Aug 9 13:12:51 2020 +0900 Add circle reply and redraft commit 5978bc04a24695edce6717bda89dcf6f861ef2c4 Author: noellabo <noel.yoshiba@gmail.com> Date: Mon Jul 27 01:07:52 2020 +0900 Fix remove unused props commit 7970f69676c24b4aa9385fee8b1635c46ba52fcd Author: noellabo <noel.yoshiba@gmail.com> Date: Sun Jul 26 21:17:07 2020 +0900 Separate circle choice from privacy commit 36f6a684c0b0c895d4d0f1b9d09b05c91b104666 Author: noellabo <noel.yoshiba@gmail.com> Date: Thu Jul 23 10:54:25 2020 +0900 Add UI for posting to circles commit 7ef48003c1407275663dd603b124d292db2aa93a Author: noellabo <noel.yoshiba@gmail.com> Date: Fri Jul 24 12:55:10 2020 +0900 Fix silent mention by circle commit 7a1caed49333c3d3241301afb77639cdf1cabdc0 Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Sep 5 11:38:10 2020 +0900 Squashed commit of the following: commit dca71fab86c830932ca760b7d8b3f89cc25c453e Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Sep 5 09:31:26 2020 +0900 Revert "Add focus setting when opening the circle column" This reverts commit 3a93ac99312a13b68b7edc2b81313fb0ffb7bcdc. commit 0a1bc8307bb699c7eb3024072ce14a440df1fc87 Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Sep 5 09:31:11 2020 +0900 Change limited visibility icon commit 9784f8b562f6592e9d9190ca29d2b2e870006d10 Author: noellabo <noel.yoshiba@gmail.com> Date: Thu Aug 13 21:52:07 2020 +0900 Add focus setting when opening the circle column commit a84f680c167fab9276550850c60f9108d251144e Author: noellabo <noel.yoshiba@gmail.com> Date: Thu Aug 13 15:55:27 2020 +0900 Fix message commit e3f11c4adac57b6e6a15c981ed6f4721a1634212 Author: noellabo <noel.yoshiba@gmail.com> Date: Mon Jul 27 01:01:23 2020 +0900 Fix light-theme commit d7d96eda5b86d3e3f654ce79888e7cf5aa535db5 Author: noellabo <noel.yoshiba@gmail.com> Date: Sun Jul 26 21:50:56 2020 +0900 Fix circles loading in share page and followers search commit 10b821f7b8c0a87cea3df51f09deeadc2cb40b32 Author: noellabo <noel.yoshiba@gmail.com> Date: Fri Jul 24 14:08:00 2020 +0900 Refactor list items commit e020072915572ce409039ccf799d08f8d8b5b393 Author: noellabo <noel.yoshiba@gmail.com> Date: Thu Jul 23 20:15:38 2020 +0900 Fixed a bug that circle name change is not reflected in the list commit 735bc41161b4c09a8dafe2c0064096b3ca79f2a0 Author: noellabo <noel.yoshiba@gmail.com> Date: Wed Jul 22 08:49:47 2020 +0900 Add UI for managing circle members commit d7c3145b8fa84be0631bf7f41bb229f3e6d03ff1 Author: noellabo <noel.yoshiba@gmail.com> Date: Wed Jul 22 07:34:52 2020 +0900 Add the followers option to AccountSearchSercive commit 65e2b0c4299b72ede440b50089c1bd6afa6c9c05 Author: noellabo <noel.yoshiba@gmail.com> Date: Wed Jul 22 07:05:56 2020 +0900 Add CircleSerializer commit a639e1803abf5590068846dbe98bc5edfaa2ad82 Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Sep 5 11:37:30 2020 +0900 Squashed commit of the following: commit 9cb3fb9d980e3ee066083076f508c5ab1447176a Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Sep 5 07:15:19 2020 +0900 Move the link to the mention list to the menu commit b32dd87b43f4e09b8e2c437f1fb5d3ebd6221215 Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Sep 5 00:56:12 2020 +0900 Change limited visibility icon commit 8db0d024119d1c2cef8de849f2501496a166a2dd Author: noellabo <noel.yoshiba@gmail.com> Date: Tue Sep 1 01:42:13 2020 +0900 Fix to disallow getting the list of mentions in limited replies commit 490a9d65a59a3dd0d86e81f6780e879dc4313dff Author: noellabo <noel.yoshiba@gmail.com> Date: Fri Jul 24 11:36:24 2020 +0900 Add column to list mentioned accounts of limited status commit 62a423ac2729c16f26fafe111f257bc373218df2 Author: noellabo <noel.yoshiba@gmail.com> Date: Thu Jul 23 13:30:17 2020 +0900 Fix visibility compatibility more commit a5cfa54b259054f41e89037f299fa928a2361818 Author: noellabo <noel.yoshiba@gmail.com> Date: Mon Jul 20 05:39:49 2020 +0900 Fix visibility compatibility commit 7900ca5650c77565b86ddc594a221dfa3b5321b4 Author: noellabo <noel.yoshiba@gmail.com> Date: Mon Jul 20 02:01:27 2020 +0900 Add limited visibility icon to status commit 66b83965ef068e9ee8c940249c68bcbde15731fe Author: Eugen Rochko <eugen@zeonfederated.com> Date: Wed Aug 26 03:16:47 2020 +0200 Add conversation-based forwarding for limited visibility statuses through bearcaps commit 561abc65e0ace89318b3952047025b8d98515fbb Author: Eugen Rochko <eugen@zeonfederated.com> Date: Sun Jul 19 02:05:16 2020 +0200 Add REST API for managing and posting to circles Circles are the conceptual opposite of lists. A list is a subdivision of your follows, a circle is a subdivision of your followers. Posting to a circle means making content available to only some of your followers. Circles have been internally supported in Mastodon for the purposes of federation since #8950, this adds the REST API necessary for making use of them in Mastodon itsef.
2020-09-05 07:33:17 +00:00
belongs_to :conversation, optional: true, inverse_of: :statuses
belongs_to :preloadable_poll, class_name: 'Poll', foreign_key: 'poll_id', optional: true
2016-02-22 15:00:20 +00:00
Add feature circle Squashed commit of the following: commit 7b2ba61c4841e23081552fb79270e4e430dd1fe0 Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Sep 5 16:03:52 2020 +0900 Add the ability to change to a new circle by replying to a circle commit 7013a228c65c7bd147885de458b50095f3c24334 Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Sep 5 16:10:57 2020 +0900 fixup! add-limited-visibility-icon-to-status commit 679aa8a7f9bef42ee5d0b326d9ae4925a1999939 Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Sep 5 15:12:53 2020 +0900 Fix 14666 commit b3addd8220d8bb3512ff345b32ca83c714dadd2a Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Sep 5 11:44:12 2020 +0900 Add Japanese translation for circle commit b7f4b773a0cd554084d5ad6a5923adb06b3acfc4 Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Sep 5 11:40:12 2020 +0900 Squashed commit of the following: commit b85a4685b27c49462288aba5f38723b91e936c4a Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Sep 5 10:50:03 2020 +0900 Changed to remove restrictions on privacy options and allow users to switch circles when replying commit 0a8c0140c73d7c5333e4f8017964adb5061a7cf1 Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Sep 5 09:33:07 2020 +0900 Change limited visibility icon commit b64adf19788d828249408454ec6afa9beb3d4872 Author: noellabo <noel.yoshiba@gmail.com> Date: Mon Aug 31 06:50:56 2020 +0900 Fix a change to limited-visibility-bearcaps replies commit ed361405b5e38857a2f42b0515a599ddcdd412cf Author: noellabo <noel.yoshiba@gmail.com> Date: Thu Aug 27 15:53:18 2020 +0900 Fix composer text when change visibility commit 4da3adddb6ffde43070d743e34c5b56e06579b30 Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Aug 22 22:34:23 2020 +0900 Fix wrong circle_id when changing visibility commit 752d7fc2a3c9e34fab9993d767f83c6eae7ba55a Author: noellabo <noel.yoshiba@gmail.com> Date: Sun Aug 9 13:12:51 2020 +0900 Add circle reply and redraft commit 5978bc04a24695edce6717bda89dcf6f861ef2c4 Author: noellabo <noel.yoshiba@gmail.com> Date: Mon Jul 27 01:07:52 2020 +0900 Fix remove unused props commit 7970f69676c24b4aa9385fee8b1635c46ba52fcd Author: noellabo <noel.yoshiba@gmail.com> Date: Sun Jul 26 21:17:07 2020 +0900 Separate circle choice from privacy commit 36f6a684c0b0c895d4d0f1b9d09b05c91b104666 Author: noellabo <noel.yoshiba@gmail.com> Date: Thu Jul 23 10:54:25 2020 +0900 Add UI for posting to circles commit 7ef48003c1407275663dd603b124d292db2aa93a Author: noellabo <noel.yoshiba@gmail.com> Date: Fri Jul 24 12:55:10 2020 +0900 Fix silent mention by circle commit 7a1caed49333c3d3241301afb77639cdf1cabdc0 Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Sep 5 11:38:10 2020 +0900 Squashed commit of the following: commit dca71fab86c830932ca760b7d8b3f89cc25c453e Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Sep 5 09:31:26 2020 +0900 Revert "Add focus setting when opening the circle column" This reverts commit 3a93ac99312a13b68b7edc2b81313fb0ffb7bcdc. commit 0a1bc8307bb699c7eb3024072ce14a440df1fc87 Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Sep 5 09:31:11 2020 +0900 Change limited visibility icon commit 9784f8b562f6592e9d9190ca29d2b2e870006d10 Author: noellabo <noel.yoshiba@gmail.com> Date: Thu Aug 13 21:52:07 2020 +0900 Add focus setting when opening the circle column commit a84f680c167fab9276550850c60f9108d251144e Author: noellabo <noel.yoshiba@gmail.com> Date: Thu Aug 13 15:55:27 2020 +0900 Fix message commit e3f11c4adac57b6e6a15c981ed6f4721a1634212 Author: noellabo <noel.yoshiba@gmail.com> Date: Mon Jul 27 01:01:23 2020 +0900 Fix light-theme commit d7d96eda5b86d3e3f654ce79888e7cf5aa535db5 Author: noellabo <noel.yoshiba@gmail.com> Date: Sun Jul 26 21:50:56 2020 +0900 Fix circles loading in share page and followers search commit 10b821f7b8c0a87cea3df51f09deeadc2cb40b32 Author: noellabo <noel.yoshiba@gmail.com> Date: Fri Jul 24 14:08:00 2020 +0900 Refactor list items commit e020072915572ce409039ccf799d08f8d8b5b393 Author: noellabo <noel.yoshiba@gmail.com> Date: Thu Jul 23 20:15:38 2020 +0900 Fixed a bug that circle name change is not reflected in the list commit 735bc41161b4c09a8dafe2c0064096b3ca79f2a0 Author: noellabo <noel.yoshiba@gmail.com> Date: Wed Jul 22 08:49:47 2020 +0900 Add UI for managing circle members commit d7c3145b8fa84be0631bf7f41bb229f3e6d03ff1 Author: noellabo <noel.yoshiba@gmail.com> Date: Wed Jul 22 07:34:52 2020 +0900 Add the followers option to AccountSearchSercive commit 65e2b0c4299b72ede440b50089c1bd6afa6c9c05 Author: noellabo <noel.yoshiba@gmail.com> Date: Wed Jul 22 07:05:56 2020 +0900 Add CircleSerializer commit a639e1803abf5590068846dbe98bc5edfaa2ad82 Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Sep 5 11:37:30 2020 +0900 Squashed commit of the following: commit 9cb3fb9d980e3ee066083076f508c5ab1447176a Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Sep 5 07:15:19 2020 +0900 Move the link to the mention list to the menu commit b32dd87b43f4e09b8e2c437f1fb5d3ebd6221215 Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Sep 5 00:56:12 2020 +0900 Change limited visibility icon commit 8db0d024119d1c2cef8de849f2501496a166a2dd Author: noellabo <noel.yoshiba@gmail.com> Date: Tue Sep 1 01:42:13 2020 +0900 Fix to disallow getting the list of mentions in limited replies commit 490a9d65a59a3dd0d86e81f6780e879dc4313dff Author: noellabo <noel.yoshiba@gmail.com> Date: Fri Jul 24 11:36:24 2020 +0900 Add column to list mentioned accounts of limited status commit 62a423ac2729c16f26fafe111f257bc373218df2 Author: noellabo <noel.yoshiba@gmail.com> Date: Thu Jul 23 13:30:17 2020 +0900 Fix visibility compatibility more commit a5cfa54b259054f41e89037f299fa928a2361818 Author: noellabo <noel.yoshiba@gmail.com> Date: Mon Jul 20 05:39:49 2020 +0900 Fix visibility compatibility commit 7900ca5650c77565b86ddc594a221dfa3b5321b4 Author: noellabo <noel.yoshiba@gmail.com> Date: Mon Jul 20 02:01:27 2020 +0900 Add limited visibility icon to status commit 66b83965ef068e9ee8c940249c68bcbde15731fe Author: Eugen Rochko <eugen@zeonfederated.com> Date: Wed Aug 26 03:16:47 2020 +0200 Add conversation-based forwarding for limited visibility statuses through bearcaps commit 561abc65e0ace89318b3952047025b8d98515fbb Author: Eugen Rochko <eugen@zeonfederated.com> Date: Sun Jul 19 02:05:16 2020 +0200 Add REST API for managing and posting to circles Circles are the conceptual opposite of lists. A list is a subdivision of your follows, a circle is a subdivision of your followers. Posting to a circle means making content available to only some of your followers. Circles have been internally supported in Mastodon for the purposes of federation since #8950, this adds the REST API necessary for making use of them in Mastodon itsef.
2020-09-05 07:33:17 +00:00
has_one :owned_conversation, class_name: 'Conversation', foreign_key: 'parent_status_id', inverse_of: :parent_status
belongs_to :thread, foreign_key: 'in_reply_to_id', class_name: 'Status', inverse_of: :replies, optional: true
belongs_to :reblog, foreign_key: 'reblog_of_id', class_name: 'Status', inverse_of: :reblogs, optional: true
2019-09-29 04:41:03 +00:00
belongs_to :quote, foreign_key: 'quote_id', class_name: 'Status', inverse_of: :quoted, optional: true
has_many :favourites, inverse_of: :status, dependent: :destroy
has_many :bookmarks, inverse_of: :status, dependent: :destroy
2021-05-19 05:58:27 +00:00
has_many :emoji_reactions, inverse_of: :status, dependent: :destroy
2016-03-16 09:46:15 +00:00
has_many :reblogs, foreign_key: 'reblog_of_id', class_name: 'Status', inverse_of: :reblog, dependent: :destroy
has_many :replies, foreign_key: 'in_reply_to_id', class_name: 'Status', inverse_of: :thread
has_many :mentions, dependent: :destroy, inverse_of: :status
has_many :active_mentions, -> { active }, class_name: 'Mention', inverse_of: :status
has_many :media_attachments, dependent: :nullify
2019-09-29 04:41:03 +00:00
has_many :quoted, foreign_key: 'quote_id', class_name: 'Status', inverse_of: :quote, dependent: :nullify
Add feature circle Squashed commit of the following: commit 7b2ba61c4841e23081552fb79270e4e430dd1fe0 Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Sep 5 16:03:52 2020 +0900 Add the ability to change to a new circle by replying to a circle commit 7013a228c65c7bd147885de458b50095f3c24334 Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Sep 5 16:10:57 2020 +0900 fixup! add-limited-visibility-icon-to-status commit 679aa8a7f9bef42ee5d0b326d9ae4925a1999939 Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Sep 5 15:12:53 2020 +0900 Fix 14666 commit b3addd8220d8bb3512ff345b32ca83c714dadd2a Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Sep 5 11:44:12 2020 +0900 Add Japanese translation for circle commit b7f4b773a0cd554084d5ad6a5923adb06b3acfc4 Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Sep 5 11:40:12 2020 +0900 Squashed commit of the following: commit b85a4685b27c49462288aba5f38723b91e936c4a Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Sep 5 10:50:03 2020 +0900 Changed to remove restrictions on privacy options and allow users to switch circles when replying commit 0a8c0140c73d7c5333e4f8017964adb5061a7cf1 Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Sep 5 09:33:07 2020 +0900 Change limited visibility icon commit b64adf19788d828249408454ec6afa9beb3d4872 Author: noellabo <noel.yoshiba@gmail.com> Date: Mon Aug 31 06:50:56 2020 +0900 Fix a change to limited-visibility-bearcaps replies commit ed361405b5e38857a2f42b0515a599ddcdd412cf Author: noellabo <noel.yoshiba@gmail.com> Date: Thu Aug 27 15:53:18 2020 +0900 Fix composer text when change visibility commit 4da3adddb6ffde43070d743e34c5b56e06579b30 Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Aug 22 22:34:23 2020 +0900 Fix wrong circle_id when changing visibility commit 752d7fc2a3c9e34fab9993d767f83c6eae7ba55a Author: noellabo <noel.yoshiba@gmail.com> Date: Sun Aug 9 13:12:51 2020 +0900 Add circle reply and redraft commit 5978bc04a24695edce6717bda89dcf6f861ef2c4 Author: noellabo <noel.yoshiba@gmail.com> Date: Mon Jul 27 01:07:52 2020 +0900 Fix remove unused props commit 7970f69676c24b4aa9385fee8b1635c46ba52fcd Author: noellabo <noel.yoshiba@gmail.com> Date: Sun Jul 26 21:17:07 2020 +0900 Separate circle choice from privacy commit 36f6a684c0b0c895d4d0f1b9d09b05c91b104666 Author: noellabo <noel.yoshiba@gmail.com> Date: Thu Jul 23 10:54:25 2020 +0900 Add UI for posting to circles commit 7ef48003c1407275663dd603b124d292db2aa93a Author: noellabo <noel.yoshiba@gmail.com> Date: Fri Jul 24 12:55:10 2020 +0900 Fix silent mention by circle commit 7a1caed49333c3d3241301afb77639cdf1cabdc0 Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Sep 5 11:38:10 2020 +0900 Squashed commit of the following: commit dca71fab86c830932ca760b7d8b3f89cc25c453e Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Sep 5 09:31:26 2020 +0900 Revert "Add focus setting when opening the circle column" This reverts commit 3a93ac99312a13b68b7edc2b81313fb0ffb7bcdc. commit 0a1bc8307bb699c7eb3024072ce14a440df1fc87 Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Sep 5 09:31:11 2020 +0900 Change limited visibility icon commit 9784f8b562f6592e9d9190ca29d2b2e870006d10 Author: noellabo <noel.yoshiba@gmail.com> Date: Thu Aug 13 21:52:07 2020 +0900 Add focus setting when opening the circle column commit a84f680c167fab9276550850c60f9108d251144e Author: noellabo <noel.yoshiba@gmail.com> Date: Thu Aug 13 15:55:27 2020 +0900 Fix message commit e3f11c4adac57b6e6a15c981ed6f4721a1634212 Author: noellabo <noel.yoshiba@gmail.com> Date: Mon Jul 27 01:01:23 2020 +0900 Fix light-theme commit d7d96eda5b86d3e3f654ce79888e7cf5aa535db5 Author: noellabo <noel.yoshiba@gmail.com> Date: Sun Jul 26 21:50:56 2020 +0900 Fix circles loading in share page and followers search commit 10b821f7b8c0a87cea3df51f09deeadc2cb40b32 Author: noellabo <noel.yoshiba@gmail.com> Date: Fri Jul 24 14:08:00 2020 +0900 Refactor list items commit e020072915572ce409039ccf799d08f8d8b5b393 Author: noellabo <noel.yoshiba@gmail.com> Date: Thu Jul 23 20:15:38 2020 +0900 Fixed a bug that circle name change is not reflected in the list commit 735bc41161b4c09a8dafe2c0064096b3ca79f2a0 Author: noellabo <noel.yoshiba@gmail.com> Date: Wed Jul 22 08:49:47 2020 +0900 Add UI for managing circle members commit d7c3145b8fa84be0631bf7f41bb229f3e6d03ff1 Author: noellabo <noel.yoshiba@gmail.com> Date: Wed Jul 22 07:34:52 2020 +0900 Add the followers option to AccountSearchSercive commit 65e2b0c4299b72ede440b50089c1bd6afa6c9c05 Author: noellabo <noel.yoshiba@gmail.com> Date: Wed Jul 22 07:05:56 2020 +0900 Add CircleSerializer commit a639e1803abf5590068846dbe98bc5edfaa2ad82 Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Sep 5 11:37:30 2020 +0900 Squashed commit of the following: commit 9cb3fb9d980e3ee066083076f508c5ab1447176a Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Sep 5 07:15:19 2020 +0900 Move the link to the mention list to the menu commit b32dd87b43f4e09b8e2c437f1fb5d3ebd6221215 Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Sep 5 00:56:12 2020 +0900 Change limited visibility icon commit 8db0d024119d1c2cef8de849f2501496a166a2dd Author: noellabo <noel.yoshiba@gmail.com> Date: Tue Sep 1 01:42:13 2020 +0900 Fix to disallow getting the list of mentions in limited replies commit 490a9d65a59a3dd0d86e81f6780e879dc4313dff Author: noellabo <noel.yoshiba@gmail.com> Date: Fri Jul 24 11:36:24 2020 +0900 Add column to list mentioned accounts of limited status commit 62a423ac2729c16f26fafe111f257bc373218df2 Author: noellabo <noel.yoshiba@gmail.com> Date: Thu Jul 23 13:30:17 2020 +0900 Fix visibility compatibility more commit a5cfa54b259054f41e89037f299fa928a2361818 Author: noellabo <noel.yoshiba@gmail.com> Date: Mon Jul 20 05:39:49 2020 +0900 Fix visibility compatibility commit 7900ca5650c77565b86ddc594a221dfa3b5321b4 Author: noellabo <noel.yoshiba@gmail.com> Date: Mon Jul 20 02:01:27 2020 +0900 Add limited visibility icon to status commit 66b83965ef068e9ee8c940249c68bcbde15731fe Author: Eugen Rochko <eugen@zeonfederated.com> Date: Wed Aug 26 03:16:47 2020 +0200 Add conversation-based forwarding for limited visibility statuses through bearcaps commit 561abc65e0ace89318b3952047025b8d98515fbb Author: Eugen Rochko <eugen@zeonfederated.com> Date: Sun Jul 19 02:05:16 2020 +0200 Add REST API for managing and posting to circles Circles are the conceptual opposite of lists. A list is a subdivision of your follows, a circle is a subdivision of your followers. Posting to a circle means making content available to only some of your followers. Circles have been internally supported in Mastodon for the purposes of federation since #8950, this adds the REST API necessary for making use of them in Mastodon itsef.
2020-09-05 07:33:17 +00:00
has_many :capability_tokens, class_name: 'StatusCapabilityToken', inverse_of: :status, dependent: :destroy
2016-11-05 14:20:05 +00:00
has_and_belongs_to_many :tags
has_and_belongs_to_many :preview_cards
2022-03-17 14:25:16 +00:00
has_many :reference_relationships, class_name: 'StatusReference', foreign_key: :status_id, dependent: :destroy
has_many :references, through: :reference_relationships, source: :target_status
has_many :referred_by_relationships, class_name: 'StatusReference', foreign_key: :target_status_id, dependent: :destroy
has_many :referred_by, through: :referred_by_relationships, source: :status
2022-08-27 10:57:05 +00:00
has_one :notification, as: :activity, dependent: :destroy
has_one :status_stat, inverse_of: :status
has_one :poll, inverse_of: :status, dependent: :destroy
2021-07-16 06:38:50 +00:00
has_one :status_expire, inverse_of: :status
validates :uri, uniqueness: true, presence: true, unless: :local?
validates :text, presence: true, unless: -> { with_media? || reblog? }
validates_with StatusLengthValidator
validates_with DisallowedHashtagsValidator
validates :reblog, uniqueness: { scope: :account }, if: :reblog?
validates :visibility, exclusion: { in: %w(direct) }, if: :reblog?
validates :quote_visibility, inclusion: { in: %w(public unlisted) }, if: :quote?
2020-06-15 22:56:38 +00:00
validates_with ExpiresValidator, on: :create, if: :local?
accepts_nested_attributes_for :poll
2020-06-15 22:56:38 +00:00
default_scope { recent.kept.not_expired }
scope :recent, -> { reorder(id: :desc) }
scope :remote, -> { where(local: false).where.not(uri: nil) }
scope :local, -> { where(local: true).or(where(uri: nil)) }
2020-06-15 22:56:38 +00:00
2021-07-16 06:38:50 +00:00
scope :not_expired, -> { where(expired_at: nil) }
scope :include_expired, -> { unscoped.recent.kept }
scope :with_accounts, ->(ids) { where(id: ids).includes(:account) }
scope :without_replies, -> { where('statuses.reply = FALSE OR statuses.in_reply_to_account_id = statuses.account_id') }
scope :without_reblogs, -> { where('statuses.reblog_of_id IS NULL') }
scope :with_public_visibility, -> { where(visibility: :public) }
scope :tagged_with, ->(tag_ids) { joins(:statuses_tags).where(statuses_tags: { tag_id: tag_ids }) }
scope :in_chosen_languages, ->(account) { where(language: nil).or where(language: account.chosen_languages) }
2020-07-12 13:00:23 +00:00
scope :mentioned_with, ->(account) { joins(:mentions).where(mentions: { account_id: account }) }
scope :excluding_silenced_accounts, -> { left_outer_joins(:account).where(accounts: { silenced_at: nil }) }
scope :including_silenced_accounts, -> { left_outer_joins(:account).where.not(accounts: { silenced_at: nil }) }
scope :not_excluded_by_account, ->(account) { where.not(account_id: account.excluded_from_timeline_account_ids) }
scope :not_domain_blocked_by_account, ->(account) { account.excluded_from_timeline_domains.blank? ? left_outer_joins(:account) : left_outer_joins(:account).where('accounts.domain IS NULL OR accounts.domain NOT IN (?)', account.excluded_from_timeline_domains) }
scope :tagged_with_all, ->(tag_ids) {
Array(tag_ids).reduce(self) do |result, id|
result.joins("INNER JOIN statuses_tags t#{id} ON t#{id}.status_id = statuses.id AND t#{id}.tag_id = #{id}")
end
}
scope :tagged_with_none, ->(tag_ids) {
Array(tag_ids).reduce(self) do |result, id|
result.joins("LEFT OUTER JOIN statuses_tags t#{id} ON t#{id}.status_id = statuses.id AND t#{id}.tag_id = #{id}")
.where("t#{id}.tag_id IS NULL")
end
}
2022-08-23 05:14:23 +00:00
scope :unset_searchability, -> { where(searchability: nil, reblog_of_id: nil) }
cache_associated :application,
:media_attachments,
:conversation,
:status_stat,
2021-07-16 06:38:50 +00:00
:status_expire,
:tags,
:preview_cards,
:preloadable_poll,
2022-03-17 14:25:16 +00:00
references: { account: :account_stat },
account: [:account_stat, :user],
active_mentions: { account: :account_stat },
reblog: [
:application,
:tags,
:preview_cards,
:media_attachments,
:conversation,
:status_stat,
2021-07-16 06:38:50 +00:00
:status_expire,
:preloadable_poll,
2022-03-17 14:25:16 +00:00
references: { account: :account_stat },
account: [:account_stat, :user],
active_mentions: { account: :account_stat },
],
thread: { account: :account_stat }
delegate :domain, to: :account, prefix: true
REAL_TIME_WINDOW = 6.hours
def searchable_by(preloaded = nil)
ids = []
ids << account_id if local?
if preloaded.nil?
ids += mentions.where(account: Account.local, silent: false).pluck(:account_id)
ids += favourites.where(account: Account.local).pluck(:account_id)
ids += reblogs.where(account: Account.local).pluck(:account_id)
ids += bookmarks.where(account: Account.local).pluck(:account_id)
2021-05-19 05:58:27 +00:00
ids += emoji_reactions.where(account: Account.local).pluck(:account_id)
2022-03-17 14:25:16 +00:00
ids += referred_by_statuses.where(account: Account.local).pluck(:account_id)
else
ids += preloaded.mentions[id] || []
ids += preloaded.favourites[id] || []
ids += preloaded.reblogs[id] || []
ids += preloaded.bookmarks[id] || []
2021-05-19 05:58:27 +00:00
ids += preloaded.emoji_reactions[id] || []
2022-03-17 14:25:16 +00:00
ids += preloaded.status_references[id] || []
end
ids.uniq
end
2022-08-23 05:14:23 +00:00
def compute_searchability
searchability || Status.searchabilities.invert.fetch([Account.searchabilities[account.searchability], Status.visibilities[visibility] || 0].max, nil) || 'direct'
end
def reply?
!in_reply_to_id.nil? || attributes['reply']
end
def local?
attributes['local'] || uri.nil?
end
def in_reply_to_local_account?
reply? && thread&.account&.local?
end
def reblog?
2016-09-29 19:28:21 +00:00
!reblog_of_id.nil?
end
2019-09-29 04:41:03 +00:00
def quote?
!quote_id.nil? && quote
end
2022-04-14 07:20:16 +00:00
def emoji_reaction?
status_stat&.emoji_reactions_cache.present?
end
def quote_visibility
quote&.visibility
end
2020-07-12 13:00:23 +00:00
def mentioning?(source_account_id)
source_account_id = source_account_id.id if source_account_id.is_a?(Account)
2020-10-06 12:04:40 +00:00
mentions.where(account_id: source_account_id).exists?
2020-07-12 13:00:23 +00:00
end
def within_realtime_window?
created_at >= REAL_TIME_WINDOW.ago
end
2016-02-22 17:10:30 +00:00
def verb
if destroyed?
:delete
else
reblog? ? :share : :post
end
2016-02-22 17:10:30 +00:00
end
def object_type
reply? ? :comment : :note
2016-02-22 17:10:30 +00:00
end
def proper
reblog? ? reblog : self
end
2016-02-22 17:10:30 +00:00
def content
proper.text
end
def target
2016-09-29 19:28:21 +00:00
reblog
2016-02-22 17:10:30 +00:00
end
def preview_card
preview_cards.first
end
def hidden?
!distributable?
end
def distributable?
public_visibility? || unlisted_visibility?
end
2022-03-17 14:25:16 +00:00
def public_safety?
distributable? && (!with_media? || non_sensitive_with_media?) && !account.silenced? && !account.suspended?
end
Add feature circle Squashed commit of the following: commit 7b2ba61c4841e23081552fb79270e4e430dd1fe0 Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Sep 5 16:03:52 2020 +0900 Add the ability to change to a new circle by replying to a circle commit 7013a228c65c7bd147885de458b50095f3c24334 Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Sep 5 16:10:57 2020 +0900 fixup! add-limited-visibility-icon-to-status commit 679aa8a7f9bef42ee5d0b326d9ae4925a1999939 Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Sep 5 15:12:53 2020 +0900 Fix 14666 commit b3addd8220d8bb3512ff345b32ca83c714dadd2a Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Sep 5 11:44:12 2020 +0900 Add Japanese translation for circle commit b7f4b773a0cd554084d5ad6a5923adb06b3acfc4 Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Sep 5 11:40:12 2020 +0900 Squashed commit of the following: commit b85a4685b27c49462288aba5f38723b91e936c4a Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Sep 5 10:50:03 2020 +0900 Changed to remove restrictions on privacy options and allow users to switch circles when replying commit 0a8c0140c73d7c5333e4f8017964adb5061a7cf1 Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Sep 5 09:33:07 2020 +0900 Change limited visibility icon commit b64adf19788d828249408454ec6afa9beb3d4872 Author: noellabo <noel.yoshiba@gmail.com> Date: Mon Aug 31 06:50:56 2020 +0900 Fix a change to limited-visibility-bearcaps replies commit ed361405b5e38857a2f42b0515a599ddcdd412cf Author: noellabo <noel.yoshiba@gmail.com> Date: Thu Aug 27 15:53:18 2020 +0900 Fix composer text when change visibility commit 4da3adddb6ffde43070d743e34c5b56e06579b30 Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Aug 22 22:34:23 2020 +0900 Fix wrong circle_id when changing visibility commit 752d7fc2a3c9e34fab9993d767f83c6eae7ba55a Author: noellabo <noel.yoshiba@gmail.com> Date: Sun Aug 9 13:12:51 2020 +0900 Add circle reply and redraft commit 5978bc04a24695edce6717bda89dcf6f861ef2c4 Author: noellabo <noel.yoshiba@gmail.com> Date: Mon Jul 27 01:07:52 2020 +0900 Fix remove unused props commit 7970f69676c24b4aa9385fee8b1635c46ba52fcd Author: noellabo <noel.yoshiba@gmail.com> Date: Sun Jul 26 21:17:07 2020 +0900 Separate circle choice from privacy commit 36f6a684c0b0c895d4d0f1b9d09b05c91b104666 Author: noellabo <noel.yoshiba@gmail.com> Date: Thu Jul 23 10:54:25 2020 +0900 Add UI for posting to circles commit 7ef48003c1407275663dd603b124d292db2aa93a Author: noellabo <noel.yoshiba@gmail.com> Date: Fri Jul 24 12:55:10 2020 +0900 Fix silent mention by circle commit 7a1caed49333c3d3241301afb77639cdf1cabdc0 Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Sep 5 11:38:10 2020 +0900 Squashed commit of the following: commit dca71fab86c830932ca760b7d8b3f89cc25c453e Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Sep 5 09:31:26 2020 +0900 Revert "Add focus setting when opening the circle column" This reverts commit 3a93ac99312a13b68b7edc2b81313fb0ffb7bcdc. commit 0a1bc8307bb699c7eb3024072ce14a440df1fc87 Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Sep 5 09:31:11 2020 +0900 Change limited visibility icon commit 9784f8b562f6592e9d9190ca29d2b2e870006d10 Author: noellabo <noel.yoshiba@gmail.com> Date: Thu Aug 13 21:52:07 2020 +0900 Add focus setting when opening the circle column commit a84f680c167fab9276550850c60f9108d251144e Author: noellabo <noel.yoshiba@gmail.com> Date: Thu Aug 13 15:55:27 2020 +0900 Fix message commit e3f11c4adac57b6e6a15c981ed6f4721a1634212 Author: noellabo <noel.yoshiba@gmail.com> Date: Mon Jul 27 01:01:23 2020 +0900 Fix light-theme commit d7d96eda5b86d3e3f654ce79888e7cf5aa535db5 Author: noellabo <noel.yoshiba@gmail.com> Date: Sun Jul 26 21:50:56 2020 +0900 Fix circles loading in share page and followers search commit 10b821f7b8c0a87cea3df51f09deeadc2cb40b32 Author: noellabo <noel.yoshiba@gmail.com> Date: Fri Jul 24 14:08:00 2020 +0900 Refactor list items commit e020072915572ce409039ccf799d08f8d8b5b393 Author: noellabo <noel.yoshiba@gmail.com> Date: Thu Jul 23 20:15:38 2020 +0900 Fixed a bug that circle name change is not reflected in the list commit 735bc41161b4c09a8dafe2c0064096b3ca79f2a0 Author: noellabo <noel.yoshiba@gmail.com> Date: Wed Jul 22 08:49:47 2020 +0900 Add UI for managing circle members commit d7c3145b8fa84be0631bf7f41bb229f3e6d03ff1 Author: noellabo <noel.yoshiba@gmail.com> Date: Wed Jul 22 07:34:52 2020 +0900 Add the followers option to AccountSearchSercive commit 65e2b0c4299b72ede440b50089c1bd6afa6c9c05 Author: noellabo <noel.yoshiba@gmail.com> Date: Wed Jul 22 07:05:56 2020 +0900 Add CircleSerializer commit a639e1803abf5590068846dbe98bc5edfaa2ad82 Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Sep 5 11:37:30 2020 +0900 Squashed commit of the following: commit 9cb3fb9d980e3ee066083076f508c5ab1447176a Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Sep 5 07:15:19 2020 +0900 Move the link to the mention list to the menu commit b32dd87b43f4e09b8e2c437f1fb5d3ebd6221215 Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Sep 5 00:56:12 2020 +0900 Change limited visibility icon commit 8db0d024119d1c2cef8de849f2501496a166a2dd Author: noellabo <noel.yoshiba@gmail.com> Date: Tue Sep 1 01:42:13 2020 +0900 Fix to disallow getting the list of mentions in limited replies commit 490a9d65a59a3dd0d86e81f6780e879dc4313dff Author: noellabo <noel.yoshiba@gmail.com> Date: Fri Jul 24 11:36:24 2020 +0900 Add column to list mentioned accounts of limited status commit 62a423ac2729c16f26fafe111f257bc373218df2 Author: noellabo <noel.yoshiba@gmail.com> Date: Thu Jul 23 13:30:17 2020 +0900 Fix visibility compatibility more commit a5cfa54b259054f41e89037f299fa928a2361818 Author: noellabo <noel.yoshiba@gmail.com> Date: Mon Jul 20 05:39:49 2020 +0900 Fix visibility compatibility commit 7900ca5650c77565b86ddc594a221dfa3b5321b4 Author: noellabo <noel.yoshiba@gmail.com> Date: Mon Jul 20 02:01:27 2020 +0900 Add limited visibility icon to status commit 66b83965ef068e9ee8c940249c68bcbde15731fe Author: Eugen Rochko <eugen@zeonfederated.com> Date: Wed Aug 26 03:16:47 2020 +0200 Add conversation-based forwarding for limited visibility statuses through bearcaps commit 561abc65e0ace89318b3952047025b8d98515fbb Author: Eugen Rochko <eugen@zeonfederated.com> Date: Sun Jul 19 02:05:16 2020 +0200 Add REST API for managing and posting to circles Circles are the conceptual opposite of lists. A list is a subdivision of your follows, a circle is a subdivision of your followers. Posting to a circle means making content available to only some of your followers. Circles have been internally supported in Mastodon for the purposes of federation since #8950, this adds the REST API necessary for making use of them in Mastodon itsef.
2020-09-05 07:33:17 +00:00
def sign?
distributable? || limited_visibility?
end
def with_media?
media_attachments.any?
end
2021-07-16 06:38:50 +00:00
def expired?
!expired_at.nil?
end
def expires?
2021-07-16 06:38:50 +00:00
status_expire.present?
end
def expiry
expires? && status_expire&.expires_mark? && status_expire&.expires_at || expired_at
end
def non_sensitive_with_media?
!sensitive? && with_media?
end
def reported?
@reported ||= Report.where(target_account: account).unresolved.where('? = ANY(status_ids)', id).exists?
end
def emojis
return @emojis if defined?(@emojis)
fields = [spoiler_text, text]
fields += preloadable_poll.options unless preloadable_poll.nil?
2019-09-29 04:41:03 +00:00
@emojis = CustomEmoji.from_text(fields.join(' '), account.domain) + (quote? ? CustomEmoji.from_text([quote.spoiler_text, quote.text].join(' '), quote.account.domain) : [])
end
2019-08-30 08:02:41 +00:00
def index_text
@index_text ||= [spoiler_text, Formatter.instance.plaintext(self)].concat(media_attachments.map(&:description)).concat(preloadable_poll ? preloadable_poll.options : []).concat(quote? ? ["QT: [#{quote.url || ActivityPub::TagManager.instance.url_for(quote)}]"] : []).filter(&:present?).join("\n\n")
2019-08-30 08:02:41 +00:00
end
def replies_count
status_stat&.replies_count || 0
end
def reblogs_count
status_stat&.reblogs_count || 0
end
def favourites_count
status_stat&.favourites_count || 0
end
2021-12-13 12:30:47 +00:00
def emoji_reactions_count
status_stat&.emoji_reactions_count || 0
end
2022-03-17 14:25:16 +00:00
def status_references_count
status_stat&.status_references_count || 0
end
def status_referred_by_count
status_stat&.status_referred_by_count || 0
end
2022-08-27 10:57:05 +00:00
def account_ids(recursive: true)
ids = (Oj.load(status_stat&.emoji_reactions_cache || '', mode: :strict) || []).flat_map { |emoji_reaction| emoji_reaction['account_ids'] }
ids << account_id.to_s
if recursive
ids.concat(quote.account_ids(recursive: false)) unless quote.nil?
ids.concat(reblog.account_ids(recursive: false)) unless reblog.nil?
ids.concat(reblog.quote.account_ids(recursive: false)) unless reblog&.quote.nil?
end
ids.uniq
end
2021-06-28 22:15:41 +00:00
def grouped_emoji_reactions(account = nil)
(Oj.load(status_stat&.emoji_reactions_cache || '', mode: :strict) || []).tap do |emoji_reactions|
if account.present?
emoji_reactions.each do |emoji_reaction|
emoji_reaction['me'] = emoji_reaction['account_ids'].include?(account.id.to_s)
emoji_reaction['account_ids'] -= account.excluded_from_timeline_account_ids.map(&:to_s)
emoji_reaction['count'] = emoji_reaction['account_ids'].size
2021-06-28 22:15:41 +00:00
end
2021-05-19 05:58:27 +00:00
end
end
2021-06-28 22:15:41 +00:00
end
def generate_grouped_emoji_reactions
records = emoji_reactions.group(:name).order(Arel.sql('MIN(created_at) ASC')).select('name, min(custom_emoji_id) as custom_emoji_id, count(*) as count, array_agg(account_id::text order by created_at) as account_ids').limit(EmojiReactionValidator::LIMIT)
Oj.dump(ActiveModelSerializers::SerializableResource.new(records, each_serializer: REST::GroupedEmojiReactionSerializer, scope: nil, scope_name: :current_user))
2021-06-28 22:15:41 +00:00
end
def refresh_grouped_emoji_reactions!
generate_grouped_emoji_reactions.tap do |emoji_reactions_cache|
2021-12-13 12:30:47 +00:00
update_status_stat!(emoji_reactions_count: emoji_reactions.count, emoji_reactions_cache: emoji_reactions_cache)
2021-06-28 22:15:41 +00:00
end
2021-05-19 05:58:27 +00:00
end
2022-03-17 14:25:16 +00:00
def referred_by_statuses(account)
statuses = referred_by.includes(:account).to_a
account_ids = statuses.map(&:account_id).uniq
account_relations = Status.relations_map_for_account(account, account_ids)
status_relations = Status.relations_map_for_status(account, statuses)
statuses.reject! { |status| StatusFilter.new(status, account, account_relations, status_relations).filtered? }
statuses.sort!.reverse!
end
def increment_count!(key)
update_status_stat!(key => public_send(key) + 1)
end
def decrement_count!(key)
update_status_stat!(key => [public_send(key) - 1, 0].max)
end
after_create_commit :increment_counter_caches
after_destroy_commit :decrement_counter_caches
after_create_commit :store_uri, if: :local?
after_create_commit :update_statistics, if: :local?
2021-07-16 06:38:50 +00:00
after_create_commit :set_status_expire, if: -> { expires_at.present? }
after_update :update_status_expire, if: -> { expires_at.present? }
around_create Mastodon::Snowflake::Callbacks
Add feature circle Squashed commit of the following: commit 7b2ba61c4841e23081552fb79270e4e430dd1fe0 Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Sep 5 16:03:52 2020 +0900 Add the ability to change to a new circle by replying to a circle commit 7013a228c65c7bd147885de458b50095f3c24334 Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Sep 5 16:10:57 2020 +0900 fixup! add-limited-visibility-icon-to-status commit 679aa8a7f9bef42ee5d0b326d9ae4925a1999939 Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Sep 5 15:12:53 2020 +0900 Fix 14666 commit b3addd8220d8bb3512ff345b32ca83c714dadd2a Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Sep 5 11:44:12 2020 +0900 Add Japanese translation for circle commit b7f4b773a0cd554084d5ad6a5923adb06b3acfc4 Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Sep 5 11:40:12 2020 +0900 Squashed commit of the following: commit b85a4685b27c49462288aba5f38723b91e936c4a Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Sep 5 10:50:03 2020 +0900 Changed to remove restrictions on privacy options and allow users to switch circles when replying commit 0a8c0140c73d7c5333e4f8017964adb5061a7cf1 Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Sep 5 09:33:07 2020 +0900 Change limited visibility icon commit b64adf19788d828249408454ec6afa9beb3d4872 Author: noellabo <noel.yoshiba@gmail.com> Date: Mon Aug 31 06:50:56 2020 +0900 Fix a change to limited-visibility-bearcaps replies commit ed361405b5e38857a2f42b0515a599ddcdd412cf Author: noellabo <noel.yoshiba@gmail.com> Date: Thu Aug 27 15:53:18 2020 +0900 Fix composer text when change visibility commit 4da3adddb6ffde43070d743e34c5b56e06579b30 Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Aug 22 22:34:23 2020 +0900 Fix wrong circle_id when changing visibility commit 752d7fc2a3c9e34fab9993d767f83c6eae7ba55a Author: noellabo <noel.yoshiba@gmail.com> Date: Sun Aug 9 13:12:51 2020 +0900 Add circle reply and redraft commit 5978bc04a24695edce6717bda89dcf6f861ef2c4 Author: noellabo <noel.yoshiba@gmail.com> Date: Mon Jul 27 01:07:52 2020 +0900 Fix remove unused props commit 7970f69676c24b4aa9385fee8b1635c46ba52fcd Author: noellabo <noel.yoshiba@gmail.com> Date: Sun Jul 26 21:17:07 2020 +0900 Separate circle choice from privacy commit 36f6a684c0b0c895d4d0f1b9d09b05c91b104666 Author: noellabo <noel.yoshiba@gmail.com> Date: Thu Jul 23 10:54:25 2020 +0900 Add UI for posting to circles commit 7ef48003c1407275663dd603b124d292db2aa93a Author: noellabo <noel.yoshiba@gmail.com> Date: Fri Jul 24 12:55:10 2020 +0900 Fix silent mention by circle commit 7a1caed49333c3d3241301afb77639cdf1cabdc0 Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Sep 5 11:38:10 2020 +0900 Squashed commit of the following: commit dca71fab86c830932ca760b7d8b3f89cc25c453e Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Sep 5 09:31:26 2020 +0900 Revert "Add focus setting when opening the circle column" This reverts commit 3a93ac99312a13b68b7edc2b81313fb0ffb7bcdc. commit 0a1bc8307bb699c7eb3024072ce14a440df1fc87 Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Sep 5 09:31:11 2020 +0900 Change limited visibility icon commit 9784f8b562f6592e9d9190ca29d2b2e870006d10 Author: noellabo <noel.yoshiba@gmail.com> Date: Thu Aug 13 21:52:07 2020 +0900 Add focus setting when opening the circle column commit a84f680c167fab9276550850c60f9108d251144e Author: noellabo <noel.yoshiba@gmail.com> Date: Thu Aug 13 15:55:27 2020 +0900 Fix message commit e3f11c4adac57b6e6a15c981ed6f4721a1634212 Author: noellabo <noel.yoshiba@gmail.com> Date: Mon Jul 27 01:01:23 2020 +0900 Fix light-theme commit d7d96eda5b86d3e3f654ce79888e7cf5aa535db5 Author: noellabo <noel.yoshiba@gmail.com> Date: Sun Jul 26 21:50:56 2020 +0900 Fix circles loading in share page and followers search commit 10b821f7b8c0a87cea3df51f09deeadc2cb40b32 Author: noellabo <noel.yoshiba@gmail.com> Date: Fri Jul 24 14:08:00 2020 +0900 Refactor list items commit e020072915572ce409039ccf799d08f8d8b5b393 Author: noellabo <noel.yoshiba@gmail.com> Date: Thu Jul 23 20:15:38 2020 +0900 Fixed a bug that circle name change is not reflected in the list commit 735bc41161b4c09a8dafe2c0064096b3ca79f2a0 Author: noellabo <noel.yoshiba@gmail.com> Date: Wed Jul 22 08:49:47 2020 +0900 Add UI for managing circle members commit d7c3145b8fa84be0631bf7f41bb229f3e6d03ff1 Author: noellabo <noel.yoshiba@gmail.com> Date: Wed Jul 22 07:34:52 2020 +0900 Add the followers option to AccountSearchSercive commit 65e2b0c4299b72ede440b50089c1bd6afa6c9c05 Author: noellabo <noel.yoshiba@gmail.com> Date: Wed Jul 22 07:05:56 2020 +0900 Add CircleSerializer commit a639e1803abf5590068846dbe98bc5edfaa2ad82 Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Sep 5 11:37:30 2020 +0900 Squashed commit of the following: commit 9cb3fb9d980e3ee066083076f508c5ab1447176a Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Sep 5 07:15:19 2020 +0900 Move the link to the mention list to the menu commit b32dd87b43f4e09b8e2c437f1fb5d3ebd6221215 Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Sep 5 00:56:12 2020 +0900 Change limited visibility icon commit 8db0d024119d1c2cef8de849f2501496a166a2dd Author: noellabo <noel.yoshiba@gmail.com> Date: Tue Sep 1 01:42:13 2020 +0900 Fix to disallow getting the list of mentions in limited replies commit 490a9d65a59a3dd0d86e81f6780e879dc4313dff Author: noellabo <noel.yoshiba@gmail.com> Date: Fri Jul 24 11:36:24 2020 +0900 Add column to list mentioned accounts of limited status commit 62a423ac2729c16f26fafe111f257bc373218df2 Author: noellabo <noel.yoshiba@gmail.com> Date: Thu Jul 23 13:30:17 2020 +0900 Fix visibility compatibility more commit a5cfa54b259054f41e89037f299fa928a2361818 Author: noellabo <noel.yoshiba@gmail.com> Date: Mon Jul 20 05:39:49 2020 +0900 Fix visibility compatibility commit 7900ca5650c77565b86ddc594a221dfa3b5321b4 Author: noellabo <noel.yoshiba@gmail.com> Date: Mon Jul 20 02:01:27 2020 +0900 Add limited visibility icon to status commit 66b83965ef068e9ee8c940249c68bcbde15731fe Author: Eugen Rochko <eugen@zeonfederated.com> Date: Wed Aug 26 03:16:47 2020 +0200 Add conversation-based forwarding for limited visibility statuses through bearcaps commit 561abc65e0ace89318b3952047025b8d98515fbb Author: Eugen Rochko <eugen@zeonfederated.com> Date: Sun Jul 19 02:05:16 2020 +0200 Add REST API for managing and posting to circles Circles are the conceptual opposite of lists. A list is a subdivision of your follows, a circle is a subdivision of your followers. Posting to a circle means making content available to only some of your followers. Circles have been internally supported in Mastodon for the purposes of federation since #8950, this adds the REST API necessary for making use of them in Mastodon itsef.
2020-09-05 07:33:17 +00:00
before_validation :prepare_contents, on: :create, if: :local?
before_validation :set_reblog, on: :create
before_validation :set_visibility, on: :create
2022-08-23 05:14:23 +00:00
before_validation :set_searchability, on: :create
Add feature circle Squashed commit of the following: commit 7b2ba61c4841e23081552fb79270e4e430dd1fe0 Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Sep 5 16:03:52 2020 +0900 Add the ability to change to a new circle by replying to a circle commit 7013a228c65c7bd147885de458b50095f3c24334 Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Sep 5 16:10:57 2020 +0900 fixup! add-limited-visibility-icon-to-status commit 679aa8a7f9bef42ee5d0b326d9ae4925a1999939 Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Sep 5 15:12:53 2020 +0900 Fix 14666 commit b3addd8220d8bb3512ff345b32ca83c714dadd2a Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Sep 5 11:44:12 2020 +0900 Add Japanese translation for circle commit b7f4b773a0cd554084d5ad6a5923adb06b3acfc4 Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Sep 5 11:40:12 2020 +0900 Squashed commit of the following: commit b85a4685b27c49462288aba5f38723b91e936c4a Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Sep 5 10:50:03 2020 +0900 Changed to remove restrictions on privacy options and allow users to switch circles when replying commit 0a8c0140c73d7c5333e4f8017964adb5061a7cf1 Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Sep 5 09:33:07 2020 +0900 Change limited visibility icon commit b64adf19788d828249408454ec6afa9beb3d4872 Author: noellabo <noel.yoshiba@gmail.com> Date: Mon Aug 31 06:50:56 2020 +0900 Fix a change to limited-visibility-bearcaps replies commit ed361405b5e38857a2f42b0515a599ddcdd412cf Author: noellabo <noel.yoshiba@gmail.com> Date: Thu Aug 27 15:53:18 2020 +0900 Fix composer text when change visibility commit 4da3adddb6ffde43070d743e34c5b56e06579b30 Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Aug 22 22:34:23 2020 +0900 Fix wrong circle_id when changing visibility commit 752d7fc2a3c9e34fab9993d767f83c6eae7ba55a Author: noellabo <noel.yoshiba@gmail.com> Date: Sun Aug 9 13:12:51 2020 +0900 Add circle reply and redraft commit 5978bc04a24695edce6717bda89dcf6f861ef2c4 Author: noellabo <noel.yoshiba@gmail.com> Date: Mon Jul 27 01:07:52 2020 +0900 Fix remove unused props commit 7970f69676c24b4aa9385fee8b1635c46ba52fcd Author: noellabo <noel.yoshiba@gmail.com> Date: Sun Jul 26 21:17:07 2020 +0900 Separate circle choice from privacy commit 36f6a684c0b0c895d4d0f1b9d09b05c91b104666 Author: noellabo <noel.yoshiba@gmail.com> Date: Thu Jul 23 10:54:25 2020 +0900 Add UI for posting to circles commit 7ef48003c1407275663dd603b124d292db2aa93a Author: noellabo <noel.yoshiba@gmail.com> Date: Fri Jul 24 12:55:10 2020 +0900 Fix silent mention by circle commit 7a1caed49333c3d3241301afb77639cdf1cabdc0 Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Sep 5 11:38:10 2020 +0900 Squashed commit of the following: commit dca71fab86c830932ca760b7d8b3f89cc25c453e Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Sep 5 09:31:26 2020 +0900 Revert "Add focus setting when opening the circle column" This reverts commit 3a93ac99312a13b68b7edc2b81313fb0ffb7bcdc. commit 0a1bc8307bb699c7eb3024072ce14a440df1fc87 Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Sep 5 09:31:11 2020 +0900 Change limited visibility icon commit 9784f8b562f6592e9d9190ca29d2b2e870006d10 Author: noellabo <noel.yoshiba@gmail.com> Date: Thu Aug 13 21:52:07 2020 +0900 Add focus setting when opening the circle column commit a84f680c167fab9276550850c60f9108d251144e Author: noellabo <noel.yoshiba@gmail.com> Date: Thu Aug 13 15:55:27 2020 +0900 Fix message commit e3f11c4adac57b6e6a15c981ed6f4721a1634212 Author: noellabo <noel.yoshiba@gmail.com> Date: Mon Jul 27 01:01:23 2020 +0900 Fix light-theme commit d7d96eda5b86d3e3f654ce79888e7cf5aa535db5 Author: noellabo <noel.yoshiba@gmail.com> Date: Sun Jul 26 21:50:56 2020 +0900 Fix circles loading in share page and followers search commit 10b821f7b8c0a87cea3df51f09deeadc2cb40b32 Author: noellabo <noel.yoshiba@gmail.com> Date: Fri Jul 24 14:08:00 2020 +0900 Refactor list items commit e020072915572ce409039ccf799d08f8d8b5b393 Author: noellabo <noel.yoshiba@gmail.com> Date: Thu Jul 23 20:15:38 2020 +0900 Fixed a bug that circle name change is not reflected in the list commit 735bc41161b4c09a8dafe2c0064096b3ca79f2a0 Author: noellabo <noel.yoshiba@gmail.com> Date: Wed Jul 22 08:49:47 2020 +0900 Add UI for managing circle members commit d7c3145b8fa84be0631bf7f41bb229f3e6d03ff1 Author: noellabo <noel.yoshiba@gmail.com> Date: Wed Jul 22 07:34:52 2020 +0900 Add the followers option to AccountSearchSercive commit 65e2b0c4299b72ede440b50089c1bd6afa6c9c05 Author: noellabo <noel.yoshiba@gmail.com> Date: Wed Jul 22 07:05:56 2020 +0900 Add CircleSerializer commit a639e1803abf5590068846dbe98bc5edfaa2ad82 Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Sep 5 11:37:30 2020 +0900 Squashed commit of the following: commit 9cb3fb9d980e3ee066083076f508c5ab1447176a Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Sep 5 07:15:19 2020 +0900 Move the link to the mention list to the menu commit b32dd87b43f4e09b8e2c437f1fb5d3ebd6221215 Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Sep 5 00:56:12 2020 +0900 Change limited visibility icon commit 8db0d024119d1c2cef8de849f2501496a166a2dd Author: noellabo <noel.yoshiba@gmail.com> Date: Tue Sep 1 01:42:13 2020 +0900 Fix to disallow getting the list of mentions in limited replies commit 490a9d65a59a3dd0d86e81f6780e879dc4313dff Author: noellabo <noel.yoshiba@gmail.com> Date: Fri Jul 24 11:36:24 2020 +0900 Add column to list mentioned accounts of limited status commit 62a423ac2729c16f26fafe111f257bc373218df2 Author: noellabo <noel.yoshiba@gmail.com> Date: Thu Jul 23 13:30:17 2020 +0900 Fix visibility compatibility more commit a5cfa54b259054f41e89037f299fa928a2361818 Author: noellabo <noel.yoshiba@gmail.com> Date: Mon Jul 20 05:39:49 2020 +0900 Fix visibility compatibility commit 7900ca5650c77565b86ddc594a221dfa3b5321b4 Author: noellabo <noel.yoshiba@gmail.com> Date: Mon Jul 20 02:01:27 2020 +0900 Add limited visibility icon to status commit 66b83965ef068e9ee8c940249c68bcbde15731fe Author: Eugen Rochko <eugen@zeonfederated.com> Date: Wed Aug 26 03:16:47 2020 +0200 Add conversation-based forwarding for limited visibility statuses through bearcaps commit 561abc65e0ace89318b3952047025b8d98515fbb Author: Eugen Rochko <eugen@zeonfederated.com> Date: Sun Jul 19 02:05:16 2020 +0200 Add REST API for managing and posting to circles Circles are the conceptual opposite of lists. A list is a subdivision of your follows, a circle is a subdivision of your followers. Posting to a circle means making content available to only some of your followers. Circles have been internally supported in Mastodon for the purposes of federation since #8950, this adds the REST API necessary for making use of them in Mastodon itsef.
2020-09-05 07:33:17 +00:00
before_validation :set_conversation, on: :create
before_validation :set_local, on: :create
after_create :set_poll_id
Add feature circle Squashed commit of the following: commit 7b2ba61c4841e23081552fb79270e4e430dd1fe0 Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Sep 5 16:03:52 2020 +0900 Add the ability to change to a new circle by replying to a circle commit 7013a228c65c7bd147885de458b50095f3c24334 Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Sep 5 16:10:57 2020 +0900 fixup! add-limited-visibility-icon-to-status commit 679aa8a7f9bef42ee5d0b326d9ae4925a1999939 Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Sep 5 15:12:53 2020 +0900 Fix 14666 commit b3addd8220d8bb3512ff345b32ca83c714dadd2a Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Sep 5 11:44:12 2020 +0900 Add Japanese translation for circle commit b7f4b773a0cd554084d5ad6a5923adb06b3acfc4 Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Sep 5 11:40:12 2020 +0900 Squashed commit of the following: commit b85a4685b27c49462288aba5f38723b91e936c4a Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Sep 5 10:50:03 2020 +0900 Changed to remove restrictions on privacy options and allow users to switch circles when replying commit 0a8c0140c73d7c5333e4f8017964adb5061a7cf1 Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Sep 5 09:33:07 2020 +0900 Change limited visibility icon commit b64adf19788d828249408454ec6afa9beb3d4872 Author: noellabo <noel.yoshiba@gmail.com> Date: Mon Aug 31 06:50:56 2020 +0900 Fix a change to limited-visibility-bearcaps replies commit ed361405b5e38857a2f42b0515a599ddcdd412cf Author: noellabo <noel.yoshiba@gmail.com> Date: Thu Aug 27 15:53:18 2020 +0900 Fix composer text when change visibility commit 4da3adddb6ffde43070d743e34c5b56e06579b30 Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Aug 22 22:34:23 2020 +0900 Fix wrong circle_id when changing visibility commit 752d7fc2a3c9e34fab9993d767f83c6eae7ba55a Author: noellabo <noel.yoshiba@gmail.com> Date: Sun Aug 9 13:12:51 2020 +0900 Add circle reply and redraft commit 5978bc04a24695edce6717bda89dcf6f861ef2c4 Author: noellabo <noel.yoshiba@gmail.com> Date: Mon Jul 27 01:07:52 2020 +0900 Fix remove unused props commit 7970f69676c24b4aa9385fee8b1635c46ba52fcd Author: noellabo <noel.yoshiba@gmail.com> Date: Sun Jul 26 21:17:07 2020 +0900 Separate circle choice from privacy commit 36f6a684c0b0c895d4d0f1b9d09b05c91b104666 Author: noellabo <noel.yoshiba@gmail.com> Date: Thu Jul 23 10:54:25 2020 +0900 Add UI for posting to circles commit 7ef48003c1407275663dd603b124d292db2aa93a Author: noellabo <noel.yoshiba@gmail.com> Date: Fri Jul 24 12:55:10 2020 +0900 Fix silent mention by circle commit 7a1caed49333c3d3241301afb77639cdf1cabdc0 Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Sep 5 11:38:10 2020 +0900 Squashed commit of the following: commit dca71fab86c830932ca760b7d8b3f89cc25c453e Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Sep 5 09:31:26 2020 +0900 Revert "Add focus setting when opening the circle column" This reverts commit 3a93ac99312a13b68b7edc2b81313fb0ffb7bcdc. commit 0a1bc8307bb699c7eb3024072ce14a440df1fc87 Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Sep 5 09:31:11 2020 +0900 Change limited visibility icon commit 9784f8b562f6592e9d9190ca29d2b2e870006d10 Author: noellabo <noel.yoshiba@gmail.com> Date: Thu Aug 13 21:52:07 2020 +0900 Add focus setting when opening the circle column commit a84f680c167fab9276550850c60f9108d251144e Author: noellabo <noel.yoshiba@gmail.com> Date: Thu Aug 13 15:55:27 2020 +0900 Fix message commit e3f11c4adac57b6e6a15c981ed6f4721a1634212 Author: noellabo <noel.yoshiba@gmail.com> Date: Mon Jul 27 01:01:23 2020 +0900 Fix light-theme commit d7d96eda5b86d3e3f654ce79888e7cf5aa535db5 Author: noellabo <noel.yoshiba@gmail.com> Date: Sun Jul 26 21:50:56 2020 +0900 Fix circles loading in share page and followers search commit 10b821f7b8c0a87cea3df51f09deeadc2cb40b32 Author: noellabo <noel.yoshiba@gmail.com> Date: Fri Jul 24 14:08:00 2020 +0900 Refactor list items commit e020072915572ce409039ccf799d08f8d8b5b393 Author: noellabo <noel.yoshiba@gmail.com> Date: Thu Jul 23 20:15:38 2020 +0900 Fixed a bug that circle name change is not reflected in the list commit 735bc41161b4c09a8dafe2c0064096b3ca79f2a0 Author: noellabo <noel.yoshiba@gmail.com> Date: Wed Jul 22 08:49:47 2020 +0900 Add UI for managing circle members commit d7c3145b8fa84be0631bf7f41bb229f3e6d03ff1 Author: noellabo <noel.yoshiba@gmail.com> Date: Wed Jul 22 07:34:52 2020 +0900 Add the followers option to AccountSearchSercive commit 65e2b0c4299b72ede440b50089c1bd6afa6c9c05 Author: noellabo <noel.yoshiba@gmail.com> Date: Wed Jul 22 07:05:56 2020 +0900 Add CircleSerializer commit a639e1803abf5590068846dbe98bc5edfaa2ad82 Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Sep 5 11:37:30 2020 +0900 Squashed commit of the following: commit 9cb3fb9d980e3ee066083076f508c5ab1447176a Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Sep 5 07:15:19 2020 +0900 Move the link to the mention list to the menu commit b32dd87b43f4e09b8e2c437f1fb5d3ebd6221215 Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Sep 5 00:56:12 2020 +0900 Change limited visibility icon commit 8db0d024119d1c2cef8de849f2501496a166a2dd Author: noellabo <noel.yoshiba@gmail.com> Date: Tue Sep 1 01:42:13 2020 +0900 Fix to disallow getting the list of mentions in limited replies commit 490a9d65a59a3dd0d86e81f6780e879dc4313dff Author: noellabo <noel.yoshiba@gmail.com> Date: Fri Jul 24 11:36:24 2020 +0900 Add column to list mentioned accounts of limited status commit 62a423ac2729c16f26fafe111f257bc373218df2 Author: noellabo <noel.yoshiba@gmail.com> Date: Thu Jul 23 13:30:17 2020 +0900 Fix visibility compatibility more commit a5cfa54b259054f41e89037f299fa928a2361818 Author: noellabo <noel.yoshiba@gmail.com> Date: Mon Jul 20 05:39:49 2020 +0900 Fix visibility compatibility commit 7900ca5650c77565b86ddc594a221dfa3b5321b4 Author: noellabo <noel.yoshiba@gmail.com> Date: Mon Jul 20 02:01:27 2020 +0900 Add limited visibility icon to status commit 66b83965ef068e9ee8c940249c68bcbde15731fe Author: Eugen Rochko <eugen@zeonfederated.com> Date: Wed Aug 26 03:16:47 2020 +0200 Add conversation-based forwarding for limited visibility statuses through bearcaps commit 561abc65e0ace89318b3952047025b8d98515fbb Author: Eugen Rochko <eugen@zeonfederated.com> Date: Sun Jul 19 02:05:16 2020 +0200 Add REST API for managing and posting to circles Circles are the conceptual opposite of lists. A list is a subdivision of your follows, a circle is a subdivision of your followers. Posting to a circle means making content available to only some of your followers. Circles have been internally supported in Mastodon for the purposes of federation since #8950, this adds the REST API necessary for making use of them in Mastodon itsef.
2020-09-05 07:33:17 +00:00
after_create :set_circle
2016-11-05 14:20:05 +00:00
class << self
def selectable_visibilities
visibilities.keys - %w(direct limited)
end
2022-08-23 05:14:23 +00:00
def selectable_searchabilities
searchabilities.keys - %w(unlisted limited mutual)
end
2016-11-05 14:20:05 +00:00
def favourites_map(status_ids, account_id)
Favourite.select('status_id').where(status_id: status_ids).where(account_id: account_id).each_with_object({}) { |f, h| h[f.status_id] = true }
2016-11-05 14:20:05 +00:00
end
def bookmarks_map(status_ids, account_id)
Bookmark.select('status_id').where(status_id: status_ids).where(account_id: account_id).map { |f| [f.status_id, true] }.to_h
end
2021-05-19 05:58:27 +00:00
def emoji_reactions_map(status_ids, account_id)
EmojiReaction.select('status_id').where(status_id: status_ids).where(account_id: account_id).map { |f| [f.status_id, true] }.to_h
end
2016-11-05 14:20:05 +00:00
def reblogs_map(status_ids, account_id)
unscoped.select('reblog_of_id').where(reblog_of_id: status_ids).where(account_id: account_id).each_with_object({}) { |s, h| h[s.reblog_of_id] = true }
2016-11-05 14:20:05 +00:00
end
def mutes_map(conversation_ids, account_id)
ConversationMute.select('conversation_id').where(conversation_id: conversation_ids).where(account_id: account_id).each_with_object({}) { |m, h| h[m.conversation_id] = true }
end
def pins_map(status_ids, account_id)
StatusPin.select('status_id').where(status_id: status_ids).where(account_id: account_id).each_with_object({}) { |p, h| h[p.status_id] = true }
end
2022-03-17 14:25:16 +00:00
def relations_map_for_account(account, account_ids)
return {} if account.nil?
2022-08-27 10:57:05 +00:00
2022-03-17 14:25:16 +00:00
presenter = AccountRelationshipsPresenter.new(account_ids, account)
{
blocking: presenter.blocking,
blocked_by: presenter.blocked_by,
muting: presenter.muting,
following: presenter.following,
subscribing: presenter.subscribing,
domain_blocking_by_domain: presenter.domain_blocking,
}
end
2022-08-27 10:57:05 +00:00
2022-03-17 14:25:16 +00:00
def relations_map_for_status(account, statuses)
return {} if account.nil?
2022-08-27 10:57:05 +00:00
2022-03-17 14:25:16 +00:00
presenter = StatusRelationshipsPresenter.new(statuses, account)
{
reblogs_map: presenter.reblogs_map,
favourites_map: presenter.favourites_map,
bookmarks_map: presenter.bookmarks_map,
emoji_reactions_map: presenter.emoji_reactions_map,
mutes_map: presenter.mutes_map,
pins_map: presenter.pins_map,
}
end
def reload_stale_associations!(cached_items)
account_ids = []
cached_items.each do |item|
account_ids << item.account_id
account_ids << item.reblog.account_id if item.reblog?
end
account_ids.uniq!
return if account_ids.empty?
accounts = Account.where(id: account_ids).includes(:account_stat, :user).index_by(&:id)
cached_items.each do |item|
item.account = accounts[item.account_id]
item.reblog.account = accounts[item.reblog.account_id] if item.reblog?
end
end
2022-03-17 14:25:16 +00:00
def permitted_statuses_from_ids(ids, account)
statuses = Status.with_accounts(ids).to_a
account_ids = statuses.map(&:account_id).uniq
account_relations = relations_map_for_account(account, account_ids)
status_relations = relations_map_for_status(account, statuses)
2022-08-27 10:57:05 +00:00
2022-03-17 14:25:16 +00:00
statuses.reject! { |status| StatusFilter.new(status, account, account_relations, status_relations).filtered? }
statuses
end
2022-08-27 10:57:05 +00:00
2016-12-26 18:13:56 +00:00
def permitted_for(target_account, account)
visibility = [:public, :unlisted]
if account.nil?
where(visibility: visibility)
elsif target_account.blocking?(account) || (account.domain.present? && target_account.domain_blocking?(account.domain)) # get rid of blocked peeps
none
elsif account.id == target_account.id # author can see own stuff
all
else
# followers can see followers-only stuff, but also things they are mentioned in.
# non-followers can see everything that isn't private/direct, but can see stuff they are mentioned in.
visibility.push(:private) if account.following?(target_account)
scope = left_outer_joins(:reblog)
scope.where(visibility: visibility)
.or(scope.where(id: account.mentions.select(:status_id)))
.merge(scope.where(reblog_of_id: nil).or(scope.where.not(reblogs_statuses: { account_id: account.excluded_from_timeline_account_ids })))
2016-12-26 18:13:56 +00:00
end
end
def from_text(text)
return [] if text.blank?
text.scan(FetchLinkCardService::URL_PATTERN).map(&:first).uniq.filter_map do |url|
2022-08-27 10:57:05 +00:00
status =
if TagManager.instance.local_url?(url)
ActivityPub::TagManager.instance.uri_to_resource(url, Status)
else
EntityCache.instance.status(url)
end
status&.distributable? ? status : nil
end
end
2016-09-08 19:23:29 +00:00
end
def status_stat
super || build_status_stat
end
private
2021-07-16 06:38:50 +00:00
def set_status_expire
create_status_expire(expires_at: expires_at, action: expires_action)
end
def update_status_expire
status_expire&.update(expires_at: expires_at, action: expires_action) || set_status_expire
end
def update_status_stat!(attrs)
return if marked_for_destruction? || destroyed?
status_stat.update(attrs)
end
def store_uri
update_column(:uri, ActivityPub::TagManager.instance.uri_for(self)) if uri.nil?
end
def prepare_contents
text&.strip!
spoiler_text&.strip!
end
def set_reblog
self.reblog = reblog.reblog if reblog? && reblog.reblog?
end
def set_poll_id
update_column(:poll_id, poll.id) unless poll.nil?
end
def set_visibility
self.visibility = reblog.visibility if reblog? && visibility.nil?
self.visibility = (account.locked? ? :private : :public) if visibility.nil?
self.sensitive = false if sensitive.nil?
end
2022-08-23 05:14:23 +00:00
def set_searchability
return if searchability.nil?
self.searchability = [Status.searchabilities[searchability], Status.visibilities[visibility]].max
end
def set_conversation
self.thread = thread.reblog if thread&.reblog?
self.reply = !(in_reply_to_id.nil? && thread.nil?) unless reply
if reply? && !thread.nil?
self.in_reply_to_account_id = carried_over_reply_to_account_id
end
Add feature circle Squashed commit of the following: commit 7b2ba61c4841e23081552fb79270e4e430dd1fe0 Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Sep 5 16:03:52 2020 +0900 Add the ability to change to a new circle by replying to a circle commit 7013a228c65c7bd147885de458b50095f3c24334 Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Sep 5 16:10:57 2020 +0900 fixup! add-limited-visibility-icon-to-status commit 679aa8a7f9bef42ee5d0b326d9ae4925a1999939 Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Sep 5 15:12:53 2020 +0900 Fix 14666 commit b3addd8220d8bb3512ff345b32ca83c714dadd2a Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Sep 5 11:44:12 2020 +0900 Add Japanese translation for circle commit b7f4b773a0cd554084d5ad6a5923adb06b3acfc4 Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Sep 5 11:40:12 2020 +0900 Squashed commit of the following: commit b85a4685b27c49462288aba5f38723b91e936c4a Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Sep 5 10:50:03 2020 +0900 Changed to remove restrictions on privacy options and allow users to switch circles when replying commit 0a8c0140c73d7c5333e4f8017964adb5061a7cf1 Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Sep 5 09:33:07 2020 +0900 Change limited visibility icon commit b64adf19788d828249408454ec6afa9beb3d4872 Author: noellabo <noel.yoshiba@gmail.com> Date: Mon Aug 31 06:50:56 2020 +0900 Fix a change to limited-visibility-bearcaps replies commit ed361405b5e38857a2f42b0515a599ddcdd412cf Author: noellabo <noel.yoshiba@gmail.com> Date: Thu Aug 27 15:53:18 2020 +0900 Fix composer text when change visibility commit 4da3adddb6ffde43070d743e34c5b56e06579b30 Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Aug 22 22:34:23 2020 +0900 Fix wrong circle_id when changing visibility commit 752d7fc2a3c9e34fab9993d767f83c6eae7ba55a Author: noellabo <noel.yoshiba@gmail.com> Date: Sun Aug 9 13:12:51 2020 +0900 Add circle reply and redraft commit 5978bc04a24695edce6717bda89dcf6f861ef2c4 Author: noellabo <noel.yoshiba@gmail.com> Date: Mon Jul 27 01:07:52 2020 +0900 Fix remove unused props commit 7970f69676c24b4aa9385fee8b1635c46ba52fcd Author: noellabo <noel.yoshiba@gmail.com> Date: Sun Jul 26 21:17:07 2020 +0900 Separate circle choice from privacy commit 36f6a684c0b0c895d4d0f1b9d09b05c91b104666 Author: noellabo <noel.yoshiba@gmail.com> Date: Thu Jul 23 10:54:25 2020 +0900 Add UI for posting to circles commit 7ef48003c1407275663dd603b124d292db2aa93a Author: noellabo <noel.yoshiba@gmail.com> Date: Fri Jul 24 12:55:10 2020 +0900 Fix silent mention by circle commit 7a1caed49333c3d3241301afb77639cdf1cabdc0 Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Sep 5 11:38:10 2020 +0900 Squashed commit of the following: commit dca71fab86c830932ca760b7d8b3f89cc25c453e Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Sep 5 09:31:26 2020 +0900 Revert "Add focus setting when opening the circle column" This reverts commit 3a93ac99312a13b68b7edc2b81313fb0ffb7bcdc. commit 0a1bc8307bb699c7eb3024072ce14a440df1fc87 Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Sep 5 09:31:11 2020 +0900 Change limited visibility icon commit 9784f8b562f6592e9d9190ca29d2b2e870006d10 Author: noellabo <noel.yoshiba@gmail.com> Date: Thu Aug 13 21:52:07 2020 +0900 Add focus setting when opening the circle column commit a84f680c167fab9276550850c60f9108d251144e Author: noellabo <noel.yoshiba@gmail.com> Date: Thu Aug 13 15:55:27 2020 +0900 Fix message commit e3f11c4adac57b6e6a15c981ed6f4721a1634212 Author: noellabo <noel.yoshiba@gmail.com> Date: Mon Jul 27 01:01:23 2020 +0900 Fix light-theme commit d7d96eda5b86d3e3f654ce79888e7cf5aa535db5 Author: noellabo <noel.yoshiba@gmail.com> Date: Sun Jul 26 21:50:56 2020 +0900 Fix circles loading in share page and followers search commit 10b821f7b8c0a87cea3df51f09deeadc2cb40b32 Author: noellabo <noel.yoshiba@gmail.com> Date: Fri Jul 24 14:08:00 2020 +0900 Refactor list items commit e020072915572ce409039ccf799d08f8d8b5b393 Author: noellabo <noel.yoshiba@gmail.com> Date: Thu Jul 23 20:15:38 2020 +0900 Fixed a bug that circle name change is not reflected in the list commit 735bc41161b4c09a8dafe2c0064096b3ca79f2a0 Author: noellabo <noel.yoshiba@gmail.com> Date: Wed Jul 22 08:49:47 2020 +0900 Add UI for managing circle members commit d7c3145b8fa84be0631bf7f41bb229f3e6d03ff1 Author: noellabo <noel.yoshiba@gmail.com> Date: Wed Jul 22 07:34:52 2020 +0900 Add the followers option to AccountSearchSercive commit 65e2b0c4299b72ede440b50089c1bd6afa6c9c05 Author: noellabo <noel.yoshiba@gmail.com> Date: Wed Jul 22 07:05:56 2020 +0900 Add CircleSerializer commit a639e1803abf5590068846dbe98bc5edfaa2ad82 Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Sep 5 11:37:30 2020 +0900 Squashed commit of the following: commit 9cb3fb9d980e3ee066083076f508c5ab1447176a Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Sep 5 07:15:19 2020 +0900 Move the link to the mention list to the menu commit b32dd87b43f4e09b8e2c437f1fb5d3ebd6221215 Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Sep 5 00:56:12 2020 +0900 Change limited visibility icon commit 8db0d024119d1c2cef8de849f2501496a166a2dd Author: noellabo <noel.yoshiba@gmail.com> Date: Tue Sep 1 01:42:13 2020 +0900 Fix to disallow getting the list of mentions in limited replies commit 490a9d65a59a3dd0d86e81f6780e879dc4313dff Author: noellabo <noel.yoshiba@gmail.com> Date: Fri Jul 24 11:36:24 2020 +0900 Add column to list mentioned accounts of limited status commit 62a423ac2729c16f26fafe111f257bc373218df2 Author: noellabo <noel.yoshiba@gmail.com> Date: Thu Jul 23 13:30:17 2020 +0900 Fix visibility compatibility more commit a5cfa54b259054f41e89037f299fa928a2361818 Author: noellabo <noel.yoshiba@gmail.com> Date: Mon Jul 20 05:39:49 2020 +0900 Fix visibility compatibility commit 7900ca5650c77565b86ddc594a221dfa3b5321b4 Author: noellabo <noel.yoshiba@gmail.com> Date: Mon Jul 20 02:01:27 2020 +0900 Add limited visibility icon to status commit 66b83965ef068e9ee8c940249c68bcbde15731fe Author: Eugen Rochko <eugen@zeonfederated.com> Date: Wed Aug 26 03:16:47 2020 +0200 Add conversation-based forwarding for limited visibility statuses through bearcaps commit 561abc65e0ace89318b3952047025b8d98515fbb Author: Eugen Rochko <eugen@zeonfederated.com> Date: Sun Jul 19 02:05:16 2020 +0200 Add REST API for managing and posting to circles Circles are the conceptual opposite of lists. A list is a subdivision of your follows, a circle is a subdivision of your followers. Posting to a circle means making content available to only some of your followers. Circles have been internally supported in Mastodon for the purposes of federation since #8950, this adds the REST API necessary for making use of them in Mastodon itsef.
2020-09-05 07:33:17 +00:00
if conversation_id.nil?
if reply? && !thread.nil? && circle.nil?
self.conversation_id = thread.conversation_id
else
build_owned_conversation
end
end
end
def set_circle
redis.setex(circle_id_key, 3.days.seconds, circle.id) if circle.present?
end
def circle_id_key
"statuses/#{id}/circle_id"
end
def carried_over_reply_to_account_id
if thread.account_id == account_id && thread.reply?
thread.in_reply_to_account_id
else
thread.account_id
end
end
def set_local
self.local = account.local?
end
def update_statistics
return unless distributable?
ActivityTracker.increment('activity:statuses:local')
end
def increment_counter_caches
return if direct_visibility?
account&.increment_count!(:statuses_count)
reblog&.increment_count!(:reblogs_count) if reblog?
thread&.increment_count!(:replies_count) if in_reply_to_id.present? && distributable?
end
def decrement_counter_caches
return if direct_visibility?
account&.decrement_count!(:statuses_count)
reblog&.decrement_count!(:reblogs_count) if reblog?
thread&.decrement_count!(:replies_count) if in_reply_to_id.present? && distributable?
end
def unlink_from_conversations
return unless direct_visibility?
mentioned_accounts = (association(:mentions).loaded? ? mentions : mentions.includes(:account)).map(&:account)
inbox_owners = mentioned_accounts.select(&:local?) + (account.local? ? [account] : [])
inbox_owners.each do |inbox_owner|
AccountConversation.remove_status(inbox_owner, self)
end
end
2016-02-20 21:53:20 +00:00
end