Group Spam System

part of the ArsDigita Community System by Sarah Ahmed

The Big Picture

This system is designed to handle group level spamming. The site-wide administrator or the group-level administrator can set the group spam policy to be "open", "closed", or "wait". For open spam policy, any member of the group can spam other members/administrators of the group. For "wait" spam policy, spam generated by group members needs to be approved by the group administrator first. For "closed" spam policy, only the group administrators are allowed to spam the group. For any spam policy, spams sent from group admin pages are immediately approved.

Under the Hood

Data Model

This system consists of three tables. The group_spam_history table holds the spamming log for this group. This log is used both for displaying the group/personal email history and as a queue to send approved but unsent emails.

create table group_spam_history (
	spam_id			integer primary key,
	group_id		references user_groups not null,
	sender_id		references users(user_id) not null,
	sender_ip_address	varchar(50) not null,
	from_address		varchar(100),
	subject			varchar(200),
 	body			clob,
	send_to			varchar (50) default 'members' check (send_to in ('members','administrators')), 
	creation_date		date not null,
	-- approved_p matters only for spam policy='wait'
	-- approved_p = 't' indicates administrator approved the mail 
	-- approved_p = 'f' indicates administrator disapproved the mail, so it won't be listed for approval again
	-- approved_p = null indicates the mail is not approved/disapproved by the administrator yet 
	approved_p		char(1) default null check (approved_p is null or approved_p in ('t','f')),
	send_date		date,
	-- this holds the number of intended recipients
	n_receivers_intended	integer default 0,
	-- we'll increment this after every successful email
	n_receivers_actual	integer default 0
);

The group_member_email_preferences table retains email preferences of members that belong to a particular group.

create table group_member_email_preferences (
	group_id		references user_groups not null,
	user_id			references users not null ,
	dont_spam_me_p		char (1) default 'f' check(dont_spam_me_p in ('t','f')),
	primary key (group_id, user_id)  
);
The user_user_bozo_filter table contains information to implement a personalized "bozo filter". Any user ( origin_user_id) can restrain any emails from some other user ( target_user_id ). This table is not specific to a group.
create table user_user_bozo_filter ( origin_user_id references users not null, target_user_id references users not null, primary key (origin_user_id, target_user_id) );

Legal Transactions

From the group administration pages, the administrator can

From the user pages, a group member can


ahmeds@mit.edu