diff options
-rw-r--r-- | actions/all.php | 86 | ||||
-rw-r--r-- | classes/Profile.php | 8 | ||||
-rw-r--r-- | classes/statusnet.ini | 10 | ||||
-rw-r--r-- | db/08to09.sql | 12 | ||||
-rw-r--r-- | db/08to09_pg.sql | 7 | ||||
-rw-r--r-- | db/statusnet.sql | 11 | ||||
-rw-r--r-- | db/statusnet_pg.sql | 62 | ||||
-rw-r--r-- | js/util.js | 5 | ||||
-rw-r--r-- | lib/noticelist.php | 21 | ||||
-rw-r--r-- | lib/router.php | 2 | ||||
-rw-r--r-- | plugins/Repeat/Forward.php (renamed from classes/Forward.php) | 0 | ||||
-rw-r--r-- | plugins/Repeat/forward.php (renamed from actions/forward.php) | 0 | ||||
-rw-r--r-- | plugins/Repeat/forwardform.php (renamed from lib/forwardform.php) | 0 | ||||
-rw-r--r-- | plugins/Repeat/inboxnoticelist.php | 85 | ||||
-rw-r--r-- | theme/base/css/display.css | 4 |
15 files changed, 112 insertions, 201 deletions
diff --git a/actions/all.php b/actions/all.php index 2c96298fa..452803d8a 100644 --- a/actions/all.php +++ b/actions/all.php @@ -144,7 +144,7 @@ class AllAction extends ProfileAction function showContent() { - $nl = new InboxNoticeList($this->notice, $this->user, $this); + $nl = new NoticeList($this->notice, $this); $cnt = $nl->show(); @@ -168,87 +168,3 @@ class AllAction extends ProfileAction } } } - -class InboxNoticeList extends NoticeList -{ - var $owner = null; - - function __construct($notice, $owner, $out=null) - { - parent::__construct($notice, $out); - $this->owner = $owner; - } - - function newListItem($notice) - { - return new InboxNoticeListItem($notice, $this->owner, $this->out); - } -} - -class InboxNoticeListItem extends NoticeListItem -{ - var $owner = null; - var $ib = null; - - function __construct($notice, $owner, $out=null) - { - parent::__construct($notice, $out); - $this->owner = $owner; - - $this->ib = Notice_inbox::pkeyGet(array('user_id' => $owner->id, - 'notice_id' => $notice->id)); - } - - function showAuthor() - { - parent::showAuthor(); - if ($this->ib->source == NOTICE_INBOX_SOURCE_FORWARD) { - $this->out->element('span', 'forward', _('Fwd')); - } - } - - function showEnd() - { - if ($this->ib->source == NOTICE_INBOX_SOURCE_FORWARD) { - - $forward = new Forward(); - - // FIXME: scary join! - - $forward->query('SELECT profile_id '. - 'FROM forward JOIN subscription ON forward.profile_id = subscription.subscribed '. - 'WHERE subscription.subscriber = ' . $this->owner->id . ' '. - 'AND forward.notice_id = ' . $this->notice->id . ' '. - 'ORDER BY forward.created '); - - $n = 0; - - $firstForwarder = null; - - while ($forward->fetch()) { - if (empty($firstForwarder)) { - $firstForwarder = Profile::staticGet('id', $forward->profile_id); - } - $n++; - } - - $forward->free(); - unset($forward); - - $this->out->elementStart('span', 'forwards'); - - $link = XMLStringer::estring('a', array('href' => $firstForwarder->profileurl), - $firstForwarder->nickname); - - if ($n == 1) { - $this->out->raw(sprintf(_('Forwarded by %s'), $link)); - } else { - // XXX: use that cool ngettext thing - $this->out->raw(sprintf(_('Forwarded by %s and %d other(s)'), $link, $n - 1)); - } - - $this->out->elementEnd('span'); - } - parent::showEnd(); - } -} diff --git a/classes/Profile.php b/classes/Profile.php index 4c14f62a0..4b2e09006 100644 --- a/classes/Profile.php +++ b/classes/Profile.php @@ -716,12 +716,4 @@ class Profile extends Memcached_DataObject } return $result; } - - function hasForwarded($notice_id) - { - $forward = Forward::pkeyGet(array('profile_id' => $this->id, - 'notice_id' => $notice_id)); - - return (!empty($forward)); - } } diff --git a/classes/statusnet.ini b/classes/statusnet.ini index a5126795b..835faeb0b 100644 --- a/classes/statusnet.ini +++ b/classes/statusnet.ini @@ -1,4 +1,3 @@ - [avatar] profile_id = 129 original = 17 @@ -196,15 +195,6 @@ id = K service = K uri = U -[forward] -profile_id = 129 -notice_id = 129 -created = 142 - -[forward__keys] -profile_id = K -notice_id = K - [group_alias] alias = 130 group_id = 129 diff --git a/db/08to09.sql b/db/08to09.sql index a945416ea..64640f4ce 100644 --- a/db/08to09.sql +++ b/db/08to09.sql @@ -82,15 +82,3 @@ create table login_token ( constraint primary key (user_id) ) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin; - -create table forward ( - - profile_id integer not null comment 'profile who forwarded the notice' references profile (id), - notice_id integer not null comment 'notice they forwarded' references notice (id), - - created datetime not null comment 'date this record was created', - - constraint primary key (profile_id, notice_id) - -) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin; - diff --git a/db/08to09_pg.sql b/db/08to09_pg.sql index 4f8281bc3..1df8c249b 100644 --- a/db/08to09_pg.sql +++ b/db/08to09_pg.sql @@ -80,10 +80,3 @@ ALTER TABLE profile ADD COLUMN lon decimal(10,7) /*comment 'longitude'*/; ALTER TABLE profile ADD COLUMN location_id integer /* comment 'location id if possible'*/; ALTER TABLE profile ADD COLUMN location_ns integer /* comment 'namespace for location'*/; -CREATE TABLE forward ( - profile_id integer not null /*comment 'profile who forwarded the notice'*/ references profile (id), - notice_id integer not null /*comment 'notice they forwarded'*/ references notice (id), - created timestamp not null /*comment 'date this record was created'*/ DEFAULT CURRENT_TIMESTAMP, - PRIMARY KEY (profile_id, notice_id) -); - diff --git a/db/statusnet.sql b/db/statusnet.sql index b500b81f2..18abcdfdb 100644 --- a/db/statusnet.sql +++ b/db/statusnet.sql @@ -585,14 +585,3 @@ create table login_token ( constraint primary key (user_id) ) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin; -create table forward ( - - profile_id integer not null comment 'profile who forwarded the notice' references profile (id), - notice_id integer not null comment 'notice they forwarded' references notice (id), - - created datetime not null comment 'date this record was created', - - constraint primary key (profile_id, notice_id) - -) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin; - diff --git a/db/statusnet_pg.sql b/db/statusnet_pg.sql index 6bcc27885..c37fa81de 100644 --- a/db/statusnet_pg.sql +++ b/db/statusnet_pg.sql @@ -64,7 +64,7 @@ create table "user" ( emailnotifyfav integer default 1 /* comment 'Notify by email of favorites' */, emailnotifynudge integer default 1 /* comment 'Notify by email of nudges' */, emailnotifymsg integer default 1 /* comment 'Notify by email of direct messages' */, - emailnotifyattn integer default 1 /* command 'Notify by email of @-replies' */, + emailnotifyattn integer default 1 /* command 'Notify by email of @-replies' */, emailmicroid integer default 1 /* comment 'whether to publish email microid' */, language varchar(50) /* comment 'preferred language' */, timezone varchar(50) /* comment 'timezone' */, @@ -82,7 +82,7 @@ create table "user" ( uri varchar(255) unique /* comment 'universally unique identifier, usually a tag URI' */, autosubscribe integer default 0 /* comment 'automatically subscribe to users who subscribe to us' */, urlshorteningservice varchar(50) default 'ur1.ca' /* comment 'service to use for auto-shortening URLs' */, - inboxed integer default 0 /* comment 'has an inbox been created for this user?' */, + inboxed integer default 0 /* comment 'has an inbox been created for this user?' */, design_id integer /* comment 'id of a design' */references design(id), viewdesigns integer default 1 /* comment 'whether to view user-provided designs'*/, created timestamp not null default CURRENT_TIMESTAMP /* comment 'date this record was created' */, @@ -298,7 +298,7 @@ create table foreign_user ( nickname varchar(255) /* comment 'nickname on foreign service' */, created timestamp not null default CURRENT_TIMESTAMP /* comment 'date this record was created' */, modified timestamp /* comment 'date this record was modified' */, - + primary key (id, service) ); @@ -308,7 +308,7 @@ create table foreign_link ( service int not null /* comment 'foreign key to service' */ references foreign_service (id), credentials varchar(255) /* comment 'authc credentials, typically a password' */, noticesync int not null default 1 /* comment 'notice synchronisation, bit 1 = sync outgoing, bit 2 = sync incoming, bit 3 = filter local replies' */, - friendsync int not null default 2 /* comment 'friend synchronisation, bit 1 = sync outgoing, bit 2 = sync incoming */, + friendsync int not null default 2 /* comment 'friend synchronisation, bit 1 = sync outgoing, bit 2 = sync incoming */, profilesync int not null default 1 /* comment 'profile synchronization, bit 1 = sync outgoing, bit 2 = sync incoming' */, last_noticesync timestamp default null /* comment 'last time notices were imported' */, last_friendsync timestamp default null /* comment 'last time friends were imported' */, @@ -324,7 +324,7 @@ create table foreign_subscription ( subscriber int not null /* comment 'subscriber on foreign service' */ , subscribed int not null /* comment 'subscribed user' */ , created timestamp not null default CURRENT_TIMESTAMP /* comment 'date this record was created' */, - + primary key (service, subscriber, subscribed) ); create index foreign_subscription_subscriber_idx on foreign_subscription using btree(subscriber); @@ -354,7 +354,7 @@ create table message ( created timestamp not null default CURRENT_TIMESTAMP /* comment 'date this record was created' */, modified timestamp /* comment 'date this record was modified' */, source varchar(32) /* comment 'source of comment, like "web", "im", or "clientname"' */ - + ); create index message_from_idx on message using btree(from_profile); create index message_to_idx on message using btree(to_profile); @@ -409,7 +409,6 @@ create table user_group ( mini_logo varchar(255) /* comment 'mini logo' */, design_id integer /*comment 'id of a design' */ references design(id), - created timestamp not null default CURRENT_TIMESTAMP /* comment 'date this record was created' */, modified timestamp /* comment 'date this record was modified' */ @@ -447,16 +446,15 @@ create table group_inbox ( ); create index group_inbox_created_idx on group_inbox using btree(created); - /*attachments and URLs stuff */ create sequence file_seq; create table file ( id bigint default nextval('file_seq') primary key /* comment 'unique identifier' */, - url varchar(255) unique, - mimetype varchar(50), - size integer, - title varchar(255), - date integer, + url varchar(255) unique, + mimetype varchar(50), + size integer, + title varchar(255), + date integer, protected integer, filename text /* comment 'if a local file, name of the file' */, modified timestamp default CURRENT_TIMESTAMP /* comment 'date this record was modified'*/ @@ -467,38 +465,38 @@ create table file_oembed ( file_id bigint default nextval('file_oembed_seq') primary key /* comment 'unique identifier' */, version varchar(20), type varchar(20), - mimetype varchar(50), + mimetype varchar(50), provider varchar(50), provider_url varchar(255), width integer, height integer, html text, title varchar(255), - author_name varchar(50), - author_url varchar(255), - url varchar(255) + author_name varchar(50), + author_url varchar(255), + url varchar(255) ); create sequence file_redirection_seq; create table file_redirection ( - url varchar(255) primary key, - file_id bigint, - redirections integer, + url varchar(255) primary key, + file_id bigint, + redirections integer, httpcode integer ); create sequence file_thumbnail_seq; create table file_thumbnail ( - file_id bigint primary key, - url varchar(255) unique, - width integer, - height integer + file_id bigint primary key, + url varchar(255) unique, + width integer, + height integer ); create sequence file_to_post_seq; create table file_to_post ( - file_id bigint, - post_id bigint, + file_id bigint, + post_id bigint, primary key (file_id, post_id) ); @@ -527,7 +525,7 @@ create table session ( id varchar(32) primary key /* comment 'session ID'*/, session_data text /* comment 'session data'*/, created timestamp not null DEFAULT CURRENT_TIMESTAMP /* comment 'date this record was created'*/, - modified integer DEFAULT extract(epoch from CURRENT_TIMESTAMP) /* comment 'date this record was modified'*/ + modified integer DEFAULT extract(epoch from CURRENT_TIMESTAMP) /* comment 'date this record was modified'*/ ); create index session_modified_idx on session (modified); @@ -543,7 +541,6 @@ create table deleted_notice ( CREATE index deleted_notice_profile_id_idx on deleted_notice (profile_id); - /* Textsearch stuff */ create index textsearch_idx on profile using gist(textsearch); @@ -551,7 +548,6 @@ create index noticecontent_idx on notice using gist(to_tsvector('english',conten create trigger textsearchupdate before insert or update on profile for each row execute procedure tsvector_update_trigger(textsearch, 'pg_catalog.english', nickname, fullname, location, bio, homepage); - create table config ( section varchar(32) /* comment 'configuration section'*/, @@ -582,8 +578,6 @@ create table location_namespace ( ); - - create table login_token ( user_id integer not null /* comment 'user owning this token'*/ references "user" (id), token char(32) not null /* comment 'token useable for logging in'*/, @@ -593,9 +587,3 @@ create table login_token ( primary key (user_id) ); -CREATE TABLE forward ( - profile_id integer not null /*comment 'profile who forwarded the notice'*/ references profile (id), - notice_id integer not null /*comment 'notice they forwarded'*/ references notice (id), - created timestamp not null /*comment 'date this record was created'*/ DEFAULT CURRENT_TIMESTAMP, - PRIMARY KEY (profile_id, notice_id) -); diff --git a/js/util.js b/js/util.js index 71514324b..336cd8cfe 100644 --- a/js/util.js +++ b/js/util.js @@ -315,10 +315,6 @@ var SN = { // StatusNet $('.form_disfavor').each(function() { SN.U.FormXHR($(this)); }); }, - NoticeForward: function() { - $('.form_forward').each(function() { SN.U.FormXHR($(this)); }); - }, - NoticeAttachments: function() { $('.notice a.attachment').each(function() { SN.U.NoticeWithAttachment($(this).closest('.notice')); @@ -452,7 +448,6 @@ var SN = { // StatusNet Notices: function() { if ($('body.user_in').length > 0) { SN.U.NoticeFavor(); - SN.U.NoticeForward(); SN.U.NoticeReply(); } diff --git a/lib/noticelist.php b/lib/noticelist.php index d6ffc9ca9..21cec528f 100644 --- a/lib/noticelist.php +++ b/lib/noticelist.php @@ -212,7 +212,6 @@ class NoticeListItem extends Widget $this->out->elementStart('div', 'notice-options'); $this->showFaveForm(); $this->showReplyLink(); - $this->showForwardForm(); $this->showDeleteLink(); $this->out->elementEnd('div'); } @@ -532,26 +531,6 @@ class NoticeListItem extends Widget } /** - * show the form to forward a notice - * - * @return void - */ - - function showForwardForm() - { - $user = common_current_user(); - if ($user && $user->id != $this->notice->profile_id) { - $profile = $user->getProfile(); - if ($profile->hasForwarded($this->notice->id)) { - $this->out->text(_('Forwarded')); - } else { - $ff = new ForwardForm($this->out, $this->notice); - $ff->show(); - } - } - } - - /** * if the user is the author, let them delete the notice * * @return void diff --git a/lib/router.php b/lib/router.php index 398135a3e..37525319f 100644 --- a/lib/router.php +++ b/lib/router.php @@ -99,7 +99,7 @@ class Router 'groupblock', 'groupunblock', 'sandbox', 'unsandbox', 'silence', 'unsilence', - 'deleteuser', 'forward'); + 'deleteuser'); foreach ($main as $a) { $m->connect('main/'.$a, array('action' => $a)); diff --git a/classes/Forward.php b/plugins/Repeat/Forward.php index 09b2d6a4e..09b2d6a4e 100644 --- a/classes/Forward.php +++ b/plugins/Repeat/Forward.php diff --git a/actions/forward.php b/plugins/Repeat/forward.php index 194833fe0..194833fe0 100644 --- a/actions/forward.php +++ b/plugins/Repeat/forward.php diff --git a/lib/forwardform.php b/plugins/Repeat/forwardform.php index 2052856ae..2052856ae 100644 --- a/lib/forwardform.php +++ b/plugins/Repeat/forwardform.php diff --git a/plugins/Repeat/inboxnoticelist.php b/plugins/Repeat/inboxnoticelist.php new file mode 100644 index 000000000..809fbe8af --- /dev/null +++ b/plugins/Repeat/inboxnoticelist.php @@ -0,0 +1,85 @@ +<?php + +class InboxNoticeList extends NoticeList +{ + var $owner = null; + + function __construct($notice, $owner, $out=null) + { + parent::__construct($notice, $out); + $this->owner = $owner; + } + + function newListItem($notice) + { + return new InboxNoticeListItem($notice, $this->owner, $this->out); + } +} + +class InboxNoticeListItem extends NoticeListItem +{ + var $owner = null; + var $ib = null; + + function __construct($notice, $owner, $out=null) + { + parent::__construct($notice, $out); + $this->owner = $owner; + + $this->ib = Notice_inbox::pkeyGet(array('user_id' => $owner->id, + 'notice_id' => $notice->id)); + } + + function showAuthor() + { + parent::showAuthor(); + if ($this->ib->source == NOTICE_INBOX_SOURCE_FORWARD) { + $this->out->element('span', 'forward', _('Fwd')); + } + } + + function showEnd() + { + if ($this->ib->source == NOTICE_INBOX_SOURCE_FORWARD) { + + $forward = new Forward(); + + // FIXME: scary join! + + $forward->query('SELECT profile_id '. + 'FROM forward JOIN subscription ON forward.profile_id = subscription.subscribed '. + 'WHERE subscription.subscriber = ' . $this->owner->id . ' '. + 'AND forward.notice_id = ' . $this->notice->id . ' '. + 'ORDER BY forward.created '); + + $n = 0; + + $firstForwarder = null; + + while ($forward->fetch()) { + if (empty($firstForwarder)) { + $firstForwarder = Profile::staticGet('id', $forward->profile_id); + } + $n++; + } + + $forward->free(); + unset($forward); + + $this->out->elementStart('span', 'forwards'); + + $link = XMLStringer::estring('a', array('href' => $firstForwarder->profileurl), + $firstForwarder->nickname); + + if ($n == 1) { + $this->out->raw(sprintf(_('Forwarded by %s'), $link)); + } else { + // XXX: use that cool ngettext thing + $this->out->raw(sprintf(_('Forwarded by %s and %d other(s)'), $link, $n - 1)); + } + + $this->out->elementEnd('span'); + } + parent::showEnd(); + } +} diff --git a/theme/base/css/display.css b/theme/base/css/display.css index e9dca8d02..d3b9d7cdc 100644 --- a/theme/base/css/display.css +++ b/theme/base/css/display.css @@ -1003,13 +1003,11 @@ float:left; } .notice-options .notice_delete, .notice-options .notice_reply, -.notice-options .form_forward, .notice-options .form_favor, .notice-options .form_disfavor { float:left; margin-left:20%; } -.notice-options .form_forward, .notice-options .form_favor, .notice-options .form_disfavor { margin-left:0; @@ -1035,12 +1033,10 @@ border-radius:0; -moz-border-radius:0; -webkit-border-radius:0; } -.notice-options .form_forward legend, .notice-options .form_favor legend, .notice-options .form_disfavor legend { display:none; } -.notice-options .form_forward fieldset, .notice-options .form_favor fieldset, .notice-options .form_disfavor fieldset { border:0; |