mirror of
https://github.com/glitch-soc/mastodon.git
synced 2025-02-23 11:03:50 -05:00
Add muting_notifications? and a notifications argument to mute!
This commit is contained in:
parent
90a0176b0b
commit
dac67960e0
@ -70,8 +70,8 @@ module AccountInteractions
|
||||
block_relationships.find_or_create_by!(target_account: other_account)
|
||||
end
|
||||
|
||||
def mute!(other_account)
|
||||
mute_relationships.find_or_create_by!(target_account: other_account)
|
||||
def mute!(other_account, notifications: true)
|
||||
mute_relationships.create_with(hide_notifications: notifications).find_or_create_by!(target_account: other_account)
|
||||
end
|
||||
|
||||
def mute_conversation!(conversation)
|
||||
@ -127,6 +127,10 @@ module AccountInteractions
|
||||
conversation_mutes.where(conversation: conversation).exists?
|
||||
end
|
||||
|
||||
def muting_notifications?(other_account)
|
||||
mute_relationships.where(target_account: other_account, hide_notifications: true).exists?
|
||||
end
|
||||
|
||||
def requested?(other_account)
|
||||
follow_requests.where(target_account: other_account).exists?
|
||||
end
|
||||
|
@ -3,11 +3,12 @@
|
||||
#
|
||||
# Table name: mutes
|
||||
#
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# account_id :integer not null
|
||||
# id :integer not null, primary key
|
||||
# target_account_id :integer not null
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# account_id :integer not null
|
||||
# id :integer not null, primary key
|
||||
# target_account_id :integer not null
|
||||
# hide_notifications :boolean default(FALSE), not null
|
||||
#
|
||||
|
||||
class Mute < ApplicationRecord
|
||||
|
@ -200,6 +200,7 @@ ActiveRecord::Schema.define(version: 20171010025614) do
|
||||
t.datetime "updated_at", null: false
|
||||
t.bigint "account_id", null: false
|
||||
t.bigint "target_account_id", null: false
|
||||
t.boolean "hide_notifications", default: false, null: false
|
||||
t.index ["account_id", "target_account_id"], name: "index_mutes_on_account_id_and_target_account_id", unique: true
|
||||
end
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user