diff options
author | Zach Copley <zach@status.net> | 2010-11-09 23:16:17 +0000 |
---|---|---|
committer | Zach Copley <zach@status.net> | 2010-11-09 23:16:17 +0000 |
commit | 5b94d9e86b91707a47b143482775acad8fcf9e78 (patch) | |
tree | 99401bab6fc3295d8578a47b8d2b6d542ca70f90 /actions | |
parent | 17ae690d5937b9a9ac3c7cd8a37d461960ce4964 (diff) | |
parent | a988e2e97b4b790f3cbd9f755ebf61bf321e16f9 (diff) |
Merge branch '0.9.x' into facebook-upgrade
Diffstat (limited to 'actions')
-rw-r--r-- | actions/apifriendshipsexists.php | 2 | ||||
-rw-r--r-- | actions/apioauthauthorize.php | 2 | ||||
-rw-r--r-- | actions/apistatusesupdate.php | 4 | ||||
-rw-r--r-- | actions/emailsettings.php | 173 | ||||
-rw-r--r-- | actions/oembed.php | 6 | ||||
-rw-r--r-- | actions/showgroup.php | 7 | ||||
-rw-r--r-- | actions/shownotice.php | 32 |
7 files changed, 124 insertions, 102 deletions
diff --git a/actions/apifriendshipsexists.php b/actions/apifriendshipsexists.php index c8766633b..43b1daf4f 100644 --- a/actions/apifriendshipsexists.php +++ b/actions/apifriendshipsexists.php @@ -85,7 +85,7 @@ class ApiFriendshipsExistsAction extends ApiPrivateAuthAction if (empty($this->profile_a) || empty($this->profile_b)) { $this->clientError( // TRANS: Client error displayed when supplying invalid parameters to an API call checking if a friendship exists. - _('Two valid IDs or screen_names must be supplied.'), + _('Two valid IDs or nick names must be supplied.'), 400, $this->format ); diff --git a/actions/apioauthauthorize.php b/actions/apioauthauthorize.php index b2c0de719..d76ae060f 100644 --- a/actions/apioauthauthorize.php +++ b/actions/apioauthauthorize.php @@ -421,7 +421,7 @@ class ApiOauthAuthorizeAction extends Action if ($this->app->name == 'anonymous') { // Special message for the anonymous app and consumer. // TRANS: User notification of external application requesting account access. - // TRANS: %3$s is the access type requested, %4$s is the StatusNet sitename. + // TRANS: %3$s is the access type requested (read-write or read-only), %4$s is the StatusNet sitename. $msg = _('An application would like the ability ' . 'to <strong>%3$s</strong> your %4$s account data. ' . 'You should only give access to your %4$s account ' . diff --git a/actions/apistatusesupdate.php b/actions/apistatusesupdate.php index 666ed9fa3..1a3b54900 100644 --- a/actions/apistatusesupdate.php +++ b/actions/apistatusesupdate.php @@ -55,7 +55,7 @@ Yes @param status (Required) The URL-encoded text of the status update. - @param source (Optional) The source of the status. + @param source (Optional) The source application name, if using HTTP authentication or an anonymous OAuth consumer. @param in_reply_to_status_id (Optional) The ID of an existing status that the update is in reply to. @param lat (Optional) The latitude the status refers to. @param long (Optional) The longitude the status refers to. @@ -67,7 +67,7 @@ @subsection usagenotes Usage notes @li The URL pattern is relative to the @ref apiroot. - @li If the @e source parameter is not supplied the source of the status will default to 'api'. + @li If the @e source parameter is not supplied the source of the status will default to 'api'. When authenticated via a registered OAuth application, the application's registered name and URL will always override the source parameter. @li The XML response uses <a href="http://georss.org/Main_Page">GeoRSS</a> to encode the latitude and longitude (see example response below <georss:point>). @li Data uploaded via the @e media parameter should be multipart/form-data encoded. diff --git a/actions/emailsettings.php b/actions/emailsettings.php index 9c250fc8a..5a816e5c0 100644 --- a/actions/emailsettings.php +++ b/actions/emailsettings.php @@ -178,51 +178,55 @@ class EmailsettingsAction extends AccountSettingsAction $this->element('legend', null, _('Email preferences')); $this->elementStart('ul', 'form_data'); - $this->elementStart('li'); - $this->checkbox('emailnotifysub', - // TRANS: Checkbox label in e-mail preferences form. - _('Send me notices of new subscriptions through email.'), - $user->emailnotifysub); - $this->elementEnd('li'); - $this->elementStart('li'); - $this->checkbox('emailnotifyfav', - // TRANS: Checkbox label in e-mail preferences form. - _('Send me email when someone '. - 'adds my notice as a favorite.'), - $user->emailnotifyfav); - $this->elementEnd('li'); - $this->elementStart('li'); - $this->checkbox('emailnotifymsg', - // TRANS: Checkbox label in e-mail preferences form. - _('Send me email when someone sends me a private message.'), - $user->emailnotifymsg); - $this->elementEnd('li'); - $this->elementStart('li'); - $this->checkbox('emailnotifyattn', - // TRANS: Checkbox label in e-mail preferences form. - _('Send me email when someone sends me an "@-reply".'), - $user->emailnotifyattn); - $this->elementEnd('li'); - $this->elementStart('li'); - $this->checkbox('emailnotifynudge', - // TRANS: Checkbox label in e-mail preferences form. - _('Allow friends to nudge me and send me an email.'), - $user->emailnotifynudge); - $this->elementEnd('li'); - if (common_config('emailpost', 'enabled')) { - $this->elementStart('li'); - $this->checkbox('emailpost', - // TRANS: Checkbox label in e-mail preferences form. - _('I want to post notices by email.'), - $user->emailpost); - $this->elementEnd('li'); - } - $this->elementStart('li'); - $this->checkbox('emailmicroid', - // TRANS: Checkbox label in e-mail preferences form. - _('Publish a MicroID for my email address.'), - $user->emailmicroid); - $this->elementEnd('li'); + + if (Event::handle('StartEmailFormData', array($this))) { + $this->elementStart('li'); + $this->checkbox('emailnotifysub', + // TRANS: Checkbox label in e-mail preferences form. + _('Send me notices of new subscriptions through email.'), + $user->emailnotifysub); + $this->elementEnd('li'); + $this->elementStart('li'); + $this->checkbox('emailnotifyfav', + // TRANS: Checkbox label in e-mail preferences form. + _('Send me email when someone '. + 'adds my notice as a favorite.'), + $user->emailnotifyfav); + $this->elementEnd('li'); + $this->elementStart('li'); + $this->checkbox('emailnotifymsg', + // TRANS: Checkbox label in e-mail preferences form. + _('Send me email when someone sends me a private message.'), + $user->emailnotifymsg); + $this->elementEnd('li'); + $this->elementStart('li'); + $this->checkbox('emailnotifyattn', + // TRANS: Checkbox label in e-mail preferences form. + _('Send me email when someone sends me an "@-reply".'), + $user->emailnotifyattn); + $this->elementEnd('li'); + $this->elementStart('li'); + $this->checkbox('emailnotifynudge', + // TRANS: Checkbox label in e-mail preferences form. + _('Allow friends to nudge me and send me an email.'), + $user->emailnotifynudge); + $this->elementEnd('li'); + if (common_config('emailpost', 'enabled')) { + $this->elementStart('li'); + $this->checkbox('emailpost', + // TRANS: Checkbox label in e-mail preferences form. + _('I want to post notices by email.'), + $user->emailpost); + $this->elementEnd('li'); + } + $this->elementStart('li'); + $this->checkbox('emailmicroid', + // TRANS: Checkbox label in e-mail preferences form. + _('Publish a MicroID for my email address.'), + $user->emailmicroid); + $this->elementEnd('li'); + Event::handle('EndEmailFormData', array($this)); + } $this->elementEnd('ul'); // TRANS: Button label to save e-mail preferences. $this->submit('save', _m('BUTTON','Save')); @@ -299,43 +303,48 @@ class EmailsettingsAction extends AccountSettingsAction function savePreferences() { - $emailnotifysub = $this->boolean('emailnotifysub'); - $emailnotifyfav = $this->boolean('emailnotifyfav'); - $emailnotifymsg = $this->boolean('emailnotifymsg'); - $emailnotifynudge = $this->boolean('emailnotifynudge'); - $emailnotifyattn = $this->boolean('emailnotifyattn'); - $emailmicroid = $this->boolean('emailmicroid'); - $emailpost = $this->boolean('emailpost'); - - $user = common_current_user(); - - assert(!is_null($user)); // should already be checked - - $user->query('BEGIN'); - - $original = clone($user); - - $user->emailnotifysub = $emailnotifysub; - $user->emailnotifyfav = $emailnotifyfav; - $user->emailnotifymsg = $emailnotifymsg; - $user->emailnotifynudge = $emailnotifynudge; - $user->emailnotifyattn = $emailnotifyattn; - $user->emailmicroid = $emailmicroid; - $user->emailpost = $emailpost; - - $result = $user->update($original); - - if ($result === false) { - common_log_db_error($user, 'UPDATE', __FILE__); - // TRANS: Server error thrown on database error updating e-mail preferences. - $this->serverError(_('Couldn\'t update user.')); - return; - } - - $user->query('COMMIT'); - - // TRANS: Confirmation message for successful e-mail preferences save. - $this->showForm(_('Email preferences saved.'), true); + $user = common_current_user(); + + if (Event::handle('StartEmailSaveForm', array($this, &$user))) { + + $emailnotifysub = $this->boolean('emailnotifysub'); + $emailnotifyfav = $this->boolean('emailnotifyfav'); + $emailnotifymsg = $this->boolean('emailnotifymsg'); + $emailnotifynudge = $this->boolean('emailnotifynudge'); + $emailnotifyattn = $this->boolean('emailnotifyattn'); + $emailmicroid = $this->boolean('emailmicroid'); + $emailpost = $this->boolean('emailpost'); + + assert(!is_null($user)); // should already be checked + + $user->query('BEGIN'); + + $original = clone($user); + + $user->emailnotifysub = $emailnotifysub; + $user->emailnotifyfav = $emailnotifyfav; + $user->emailnotifymsg = $emailnotifymsg; + $user->emailnotifynudge = $emailnotifynudge; + $user->emailnotifyattn = $emailnotifyattn; + $user->emailmicroid = $emailmicroid; + $user->emailpost = $emailpost; + + $result = $user->update($original); + + if ($result === false) { + common_log_db_error($user, 'UPDATE', __FILE__); + // TRANS: Server error thrown on database error updating e-mail preferences. + $this->serverError(_('Couldn\'t update user.')); + return; + } + + $user->query('COMMIT'); + + Event::handle('EndEmailSaveForm', array($this)); + + // TRANS: Confirmation message for successful e-mail preferences save. + $this->showForm(_('Email preferences saved.'), true); + } } /** diff --git a/actions/oembed.php b/actions/oembed.php index e25e4cb25..da3aa0c71 100644 --- a/actions/oembed.php +++ b/actions/oembed.php @@ -79,11 +79,7 @@ class OembedAction extends Action if (empty($profile)) { $this->serverError(_('Notice has no profile.'), 500); } - if (!empty($profile->fullname)) { - $authorname = $profile->fullname . ' (' . $profile->nickname . ')'; - } else { - $authorname = $profile->nickname; - } + $authorname = $profile->getFancyName(); $oembed['title'] = sprintf(_('%1$s\'s status on %2$s'), $authorname, common_exact_date($notice->created)); diff --git a/actions/showgroup.php b/actions/showgroup.php index c87282844..f38cd420a 100644 --- a/actions/showgroup.php +++ b/actions/showgroup.php @@ -68,12 +68,7 @@ class ShowgroupAction extends GroupDesignAction */ function title() { - if (!empty($this->group->fullname)) { - // @todo FIXME: Needs proper i18n. Maybe use a generic method for this? - $base = $this->group->fullname . ' (' . $this->group->nickname . ')'; - } else { - $base = $this->group->nickname; - } + $base = $this->group->getFancyName(); if ($this->page == 1) { // TRANS: Page title for first group page. %s is a group name. diff --git a/actions/shownotice.php b/actions/shownotice.php index 5fc863486..b7e61a137 100644 --- a/actions/shownotice.php +++ b/actions/shownotice.php @@ -167,11 +167,7 @@ class ShownoticeAction extends OwnerDesignAction function title() { - if (!empty($this->profile->fullname)) { - $base = $this->profile->fullname . ' (' . $this->profile->nickname . ')'; - } else { - $base = $this->profile->nickname; - } + $base = $this->profile->getFancyName(); return sprintf(_('%1$s\'s status on %2$s'), $base, @@ -335,6 +331,32 @@ class SingleNoticeItem extends DoFollowListItem $this->showEnd(); } + /** + * show the avatar of the notice's author + * + * We use the larger size for single notice page. + * + * @return void + */ + + function showAvatar() + { + $avatar_size = AVATAR_PROFILE_SIZE; + + $avatar = $this->profile->getAvatar($avatar_size); + + $this->out->element('img', array('src' => ($avatar) ? + $avatar->displayUrl() : + Avatar::defaultImage($avatar_size), + 'class' => 'avatar photo', + 'width' => $avatar_size, + 'height' => $avatar_size, + 'alt' => + ($this->profile->fullname) ? + $this->profile->fullname : + $this->profile->nickname)); + } + function showNoticeAttachments() { $al = new AttachmentList($this->notice, $this->out); $al->show(); |