Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…network into statusnet-1.0.1
  • Loading branch information
Serrio committed Mar 23, 2016
2 parents c560e50 + f60ce92 commit 7e1ad71
Show file tree
Hide file tree
Showing 35 changed files with 603 additions and 196 deletions.
2 changes: 1 addition & 1 deletion README.md
@@ -1,4 +1,4 @@
rainbowdash-network
===================

Repository for the source code of Rainbow Dash Network, a StatusNet instance for bronies.
Repository for the source code of Rainbow Dash Network, a StatusNet instance for anyone but bronies.
7 changes: 7 additions & 0 deletions actions/avatarsettings.php
Expand Up @@ -362,6 +362,13 @@ function uploadAvatar()

$imagefile = new ImageFile(null, $temp_file_name);
}

if ($imagefile->width * $imagefile->height > 3000*3000) { // guesstimated sane limit
$imagefile->unlink();

$this->showForm(_('File is too big for our servers to process. (Maximum image dimensions should be 9000000 square pixels, or around 3000x3000.)'));
return;
}

$cur = common_current_user();
$type = $imagefile->preferredType();
Expand Down
2 changes: 1 addition & 1 deletion actions/conversation.php
Expand Up @@ -125,7 +125,7 @@ function showContent()
{
$user = common_current_user();

if (!empty($user) && $user->conversationTree()) {
if (empty($user) || $user->conversationTree()) {
$nl = new ConversationTree($this->notices, $this);
} else {
$nl = new FullThreadedNoticeList($this->notices, $this, $this->userProfile);
Expand Down
4 changes: 2 additions & 2 deletions actions/newnotice.php
Expand Up @@ -140,7 +140,7 @@ function saveNewNotice()
$this->clientError(_('No content!'));
return;
}

/* Nobody ever uses these dumb things and it just confuses people. -Red
$inter = new CommandInterpreter();
$cmd = $inter->handle_command($user, $content);
Expand All @@ -152,7 +152,7 @@ function saveNewNotice()
$cmd->execute(new WebChannel($this));
}
return;
}
}*/

$content_shortened = $user->shortenLinks($content);
if (Notice::contentTooLong($content_shortened)) {
Expand Down
12 changes: 6 additions & 6 deletions actions/oldschoolsettings.php
Expand Up @@ -109,8 +109,8 @@ function handlePost()
$osp->created = common_sql_now();
}

$osp->stream_mode_only = $this->boolean('stream_mode_only');
$osp->conversation_tree = $this->boolean('conversation_tree');
$osp->stream_mode_only = !$this->boolean('stream_mode_only');
$osp->conversation_tree = !$this->boolean('conversation_tree');
$osp->stream_nicknames = $this->boolean('stream_nicknames');
$osp->modified = common_sql_now();

Expand Down Expand Up @@ -158,12 +158,12 @@ function formData()
$this->elementStart('fieldset');
$this->elementStart('ul', 'form_data');
$this->elementStart('li');
$this->checkbox('stream_mode_only', _('Only stream mode (no conversations) in timelines'),
$this->user->streamModeOnly());
$this->checkbox('stream_mode_only', _('Show conversations in timelines'),
!$this->user->streamModeOnly());
$this->elementEnd('li');
$this->elementStart('li');
$this->checkbox('conversation_tree', _('Show conversation page as hierarchical trees'),
$this->user->conversationTree());
$this->checkbox('conversation_tree', _('Show conversation page as flat listing'),
!$this->user->conversationTree());
$this->elementEnd('li');
$this->elementStart('li');
$this->checkbox('stream_nicknames', _('Show nicknames (not full names) in timelines'),
Expand Down
21 changes: 15 additions & 6 deletions actions/profilesettings.php
Expand Up @@ -202,14 +202,13 @@ function showContent()
false,
(empty($user->subscribe_policy)) ? User::SUBSCRIBE_POLICY_OPEN : $user->subscribe_policy);
$this->elementEnd('li');
}/* removing private non-group notices
}
$this->elementStart('li');
$this->checkbox('private_stream',
$this->checkbox('ignore_rules',
// TRANS: Checkbox label in profile settings.
_('Make updates visible only to my followers'),
($this->arg('private_stream')) ?
$this->boolean('private_stream') : $user->private_stream);
$this->elementEnd('li');*/
_('Ignore site rules'),
false);
$this->elementEnd('li');
$this->elementEnd('ul');
// TRANS: Button to save input in profile settings.
$this->submit('save', _m('BUTTON','Save'));
Expand All @@ -236,6 +235,16 @@ function handlePost()
'Try again, please.'));
return;
}

if ($this->boolean('ignore_rules')) {
$user = common_current_user();
$notice = Notice::saveNew($user->id,
'WEE-WOO WEE-WOO I\'M A BIG BAD IMPORTANT USER WHO DON\'T NEED NO RULES #banmepls',
'ban me pls');

$this->showForm(_('WEE-WOO WEE-WOO I\'M A BIG BAD IMPORTANT USER WHO DON\'T NEED NO RULES'));
return;
}

if (Event::handle('StartProfileSaveForm', array($this))) {

Expand Down
2 changes: 1 addition & 1 deletion actions/public.php
Expand Up @@ -92,7 +92,7 @@ function prepare($args)

$user = common_current_user();

if (!empty($user) && $user->streamModeOnly()) {
if (empty($user) || $user->streamModeOnly()) {
$stream = new PublicNoticeStream($this->userProfile, $this->images);
} else {
$stream = new ThreadingPublicNoticeStream($this->userProfile, $this->images);
Expand Down
25 changes: 19 additions & 6 deletions actions/showstream.php
Expand Up @@ -105,12 +105,6 @@ function title()
}
}

function showNoticeForm()
{
$notice_form = new NoticeForm($this, array('content' => "@{$this->profile->nickname} "));
$notice_form->show();
}

function handle($args)
{
// Looks like we're good; start output
Expand Down Expand Up @@ -220,6 +214,16 @@ function extraHead()
'href' => $rsd));
}

function showBlockedListMessage()
{
// TRANS: First sentence of empty list message for a timeline. $1%s is a user nickname.
$message = sprintf(_('This is the timeline for %1$s, but you have blocked %1$s, so their notices will not show up for you.'), $this->user->nickname) . ' ';

$this->elementStart('div', 'guide');
$this->raw(common_markup_to_html($message));
$this->elementEnd('div');
}

function showEmptyListMessage()
{
// TRANS: First sentence of empty list message for a timeline. $1%s is a user nickname.
Expand Down Expand Up @@ -249,6 +253,14 @@ function showEmptyListMessage()

function showNotices()
{
if (common_logged_in()) {
$u = common_current_user();
if ($u->hasBlocked($this->user)) {
$this->showBlockedListMessage();
return;
}
}

$pnl = null;
if (Event::handle('ShowStreamNoticeList', array($this->notice, $this, &$pnl))) {
$pnl = new ProfileNoticeList($this->notice, $this);
Expand Down Expand Up @@ -309,6 +321,7 @@ function noticeFormOptions()

if (empty($cur) || $cur->id != $this->profile->id) {
$options['to_profile'] = $this->profile;
$options['content'] = "@{$this->profile->nickname} ";
}

return $options;
Expand Down
32 changes: 24 additions & 8 deletions classes/Notice.php
Expand Up @@ -1039,14 +1039,15 @@ function whoGets($groups=null, $recipients=null)
$originalProfile = $original->getProfile();
}
}
foreach ($ni as $id => $source) {
$user = User::staticGet('id', $id);
if (empty($user) || $user->hasBlocked($profile) ||
($originalProfile && $user->hasBlocked($originalProfile))) {
unset($ni[$id]);
}
}
}

foreach ($ni as $id => $source) {
$user = User::staticGet('id', $id);
if (empty($user) || $user->hasBlocked($profile) ||
($originalProfile && $user->hasBlocked($originalProfile))) {
unset($ni[$id]);
}
}

// Give plugins a chance to filter out...
Event::handle('EndNoticeWhoGets', array($this, &$ni));
Expand Down Expand Up @@ -1320,7 +1321,7 @@ function saveReplies()
$original = $this->getOriginal();
if (!empty($original)) { // that'd be weird
$author = $original->getProfile();
if (!empty($author)) {
if (!empty($author) && !$author->hasBlocked($sender)) {
$this->saveReply($author->id);
$replied[$author->id] = 1;
self::blow('reply:stream:%d', $author->id);
Expand Down Expand Up @@ -2404,6 +2405,21 @@ protected function _inScope($profile)
} else {
$scope = self::defaultScope();
}

// If user has blocked this notice's owner, hide it regardless

if ($profile && $profile->hasBlocked($this->getProfile())) {
return false;
}


if (!empty($this->repeat_of)) {
$original = Notice::staticGet('id', $this->repeat_of);
if (!empty($original)) { // could have been deleted
if ($profile && $profile->hasBlocked($original->getProfile()))
return false;
}
}

// If there's no scope, anyone (even anon) is in scope.

Expand Down
4 changes: 3 additions & 1 deletion classes/Profile_role.php
Expand Up @@ -66,6 +66,7 @@ function pkeyGet($kv)
const OWNER = 'owner';
const MODERATOR = 'moderator';
const ADMINISTRATOR = 'administrator';
const DEVELOPER = 'developer';
const SANDBOXED = 'sandboxed';
const SILENCED = 'silenced';
const DELETED = 'deleted'; // Pending final deletion of notices...
Expand All @@ -76,14 +77,15 @@ public static function isValid($role)
$known = array(self::OWNER,
self::MODERATOR,
self::ADMINISTRATOR,
self::DEVELOPER,
self::SANDBOXED,
self::SILENCED);
return in_array($role, $known);
}

public static function isSettable($role)
{
$allowedRoles = array('administrator', 'moderator');
$allowedRoles = array('administrator', 'moderator', 'developer');
return self::isValid($role) && in_array($role, $allowedRoles);
}
}
4 changes: 2 additions & 2 deletions classes/User.php
Expand Up @@ -1190,7 +1190,7 @@ function streamModeOnly()
}
}

return false;
return true;
}

function conversationTree()
Expand All @@ -1202,7 +1202,7 @@ function conversationTree()
}
}

return false;
return true;
}

function streamNicknames()
Expand Down
39 changes: 38 additions & 1 deletion doc-src/faq
Expand Up @@ -48,6 +48,9 @@ Drops down to a list of everything you follow: groups, lists, searches, and tags
<span style="font-family: FontAwesome;font-size: 16px">&#xf112;</span> **Replies**
A list of replies by other users made to notices you've posted. Handy for keeping up with responses if your personal timeline is busy.

<span style="font-family: FontAwesome;font-size: 16px">&#xf004;</span> **Favorites**
A list of notices you have favorited.

<span style="font-family: FontAwesome;font-size: 16px">&#xf0e0;</span> **Private inbox**
Your inbox, where you can receive and send private messages with people you have mutually subscribed to, as well as site staff.

Expand All @@ -57,7 +60,41 @@ Allows you to adjust various settings that affect how you use the site. This is
<span style="font-family: FontAwesome;font-size: 16px">&#xf011;</span> **Logout**
Logs you out of the site.

### I don't like this whole "threaded replies" thing. How do I change it? ###
### What are these @, #, !, @# things? ###

Those represent the various methods of interacting through notices on the site. Use each one by typing it as you see it elsewhere.
There is no hard limit on how many of each of these may be used in a single notice.

**@mentions**
References another user on the site. Often seen at the front of a notice when replying to another user. (When creating replies, it is
recommended to use the Reply button by each notice instead of manually inputting a username.) Notices containing a mention show up in the
referenced user's Replies page. Clicking on one will open the referenced user's profile.

**#tags**
Often used as a method of categorization or description of a notice. These are used to link together notices with common topics, or
in some cases as a warning (such as the #<span style="color: red">NSFW</span> tag). Clicking on one will open a page containing other
notices with the same tag.

**!groups**
A more structured method of categorization than tags. Groups require the user to be a member before posts can be sent to one. In addition,
posts sent to groups can be marked as "private", meaning they are only visible to other members of any group tagged in the notice.
Notices containing a group tag show up in the referenced group's timeline. (Note that they also show up on all other timelines where
such a notice would otherwise show up, including the public timeline.) Notices from all groups you are a member of will show up in your
Personal timeline. Clicking on a group tag will open the referenced group's page.

Note that as of December 2013, the preferred method of posting to a group is to use the "To:" dropdown selector to select the group
to post to. This is the only way to post a private notice to a non-private group. Use of group tags is still supported, however, and
is currently the only method of posting a notice to more than one group, or "grandfathering" a conversation into a group by tagging
it in a reply.

**@#lists**
References multiple users on the site. Lists are created by tagging other users on their profile pages (tags they've added themselves are
not considered; tagging yourself is a method of adding yourself to one of your own lists, among other things). It is possible to subscribe
to another user's list, which will cause posts from all users listed to appear on your Personal timeline. Notices containing a list tag
appear in the Replies timelines of every user in the list. Clicking on a list tag will open the list's timeline, showing notices from
all users in the list.

### I prefer posts in a more linear, Twitter-esque format. How do I change it? ###

If you'd like notices to be displayed in a more linear fashion (where replies show up as their own posts, rather than being attached to the original posts),
the [Old-school settings page](%%action.oldschoolsettings%%) allows you to toggle that behavior. You can also switch conversation pages from a
Expand Down

0 comments on commit 7e1ad71

Please sign in to comment.