Class: ShareVisibility

Inherits:
ApplicationRecord show all
Defined in:
app/models/share_visibility.rb

Overview

Copyright © 2010-2011, Diaspora Inc. This file is

licensed under the Affero General Public License version 3 or later.  See
the COPYRIGHT file.

Class Method Summary collapse

Class Method Details

.batch_import(user_ids, share) ⇒ void

Note:

performs a bulk insert in mySQL; performs linear insertions in postgres

This method returns an undefined value.

Perform a batch import, given a set of users and a shareable

Parameters:

  • user_ids (Array<Integer>)

    Recipients

  • share (Shareable)

26
27
28
29
30
31
32
33
# File 'app/models/share_visibility.rb', line 26

def self.batch_import(user_ids, share)
  return false if share.public?

  user_ids -= ShareVisibility.for_shareable(share).where(user_id: user_ids).pluck(:user_id)
  return false if user_ids.empty?

  create_visilities(user_ids, share)
end