Index: trunk/phase3/docs/hooks.txt |
— | — | @@ -665,6 +665,11 @@ |
666 | 666 | $subject: subject of the mail |
667 | 667 | $text: text of the mail |
668 | 668 | |
| 669 | +'EmailUserPermissionsErrors': to retrieve permissions errors for emailing a user. |
| 670 | +$user: The user who is trying to email another user. |
| 671 | +$editToken: The user's edit token. |
| 672 | +&$hookErr: Out-param for the error. Passed as the parameters to OutputPage::showErrorPage. |
| 673 | + |
669 | 674 | 'FetchChangesList': When fetching the ChangesList derivative for a particular user |
670 | 675 | &$user: User the list is being fetched for |
671 | 676 | &$skin: Skin object to be used with the list |
Index: trunk/extensions/LiquidThreads/classes/LqtView.php |
— | — | @@ -259,8 +259,12 @@ |
260 | 260 | can temporarily use a random scratch title. It's fine if the title changes |
261 | 261 | throughout the edit cycle, since the article doesn't exist yet anyways. |
262 | 262 | */ |
| 263 | + |
| 264 | + // Stuff that might break the save |
| 265 | + $valid_subject = true; |
| 266 | + $failed_rename = false; |
263 | 267 | |
264 | | - $valid_summary = true; |
| 268 | + $subject = $this->request->getVal( 'lqt_subject_field', '' ); |
265 | 269 | |
266 | 270 | if ( $edit_type == 'summarize' && $edit_applies_to->summary() ) { |
267 | 271 | $article = $edit_applies_to->summary(); |
— | — | @@ -268,11 +272,9 @@ |
269 | 273 | $t = $this->newSummaryTitle( $edit_applies_to ); |
270 | 274 | $article = new Article( $t ); |
271 | 275 | } elseif ( $thread == null ) { |
272 | | - $subject = $this->request->getVal( 'lqt_subject_field', '' ); |
273 | | - |
274 | 276 | if ( is_null( Title::makeTitleSafe( NS_LQT_THREAD, $subject ) ) ) { |
275 | 277 | // Dodgy title |
276 | | - $valid_summary = false; |
| 278 | + $valid_subject = false; |
277 | 279 | $t = $this->scratchTitle(); |
278 | 280 | } else { |
279 | 281 | if ( $edit_type == 'new' ) { |
— | — | @@ -288,13 +290,27 @@ |
289 | 291 | |
290 | 292 | $e = new EditPage( $article ); |
291 | 293 | |
292 | | - if (!$valid_summary && $subject) { |
| 294 | + |
| 295 | + // Find errors. |
| 296 | + if (!$valid_subject && $subject) { |
293 | 297 | $e->editFormPageTop .= |
294 | 298 | Xml::tags( 'div', array( 'class' => 'error' ), |
295 | 299 | wfMsgExt( 'lqt_invalid_subject', 'parse' ) ); |
296 | 300 | } |
297 | 301 | |
298 | | - if (!$valid_summary) { |
| 302 | + if ( $subject != $thread->subjectWithoutIncrement() && |
| 303 | + !$this->user->isAllowed( 'move' ) ) { |
| 304 | + $e->editFormPageTop .= |
| 305 | + Xml::tags( 'div', array( 'class' => 'error' ), |
| 306 | + wfMsgExt( 'lqt_subject_change_forbidden', 'parse' ) ); |
| 307 | + $failed_rename = true; |
| 308 | + |
| 309 | + // Reset the subject |
| 310 | + global $wgRequest; |
| 311 | + $wgRequest->setVal( 'lqt_subject_field', $thread->subjectWithoutIncrement() ); |
| 312 | + } |
| 313 | + |
| 314 | + if ( !$valid_subject || $failed_rename ) { |
299 | 315 | // Dirty hack to prevent saving from going ahead |
300 | 316 | global $wgRequest; |
301 | 317 | $wgRequest->setVal( 'wpPreview', true ); |
Index: trunk/extensions/LiquidThreads/Lqt.i18n.php |
— | — | @@ -29,6 +29,7 @@ |
30 | 30 | * Contain invalid characters, such as []{}<>, |
31 | 31 | * Be too long, or |
32 | 32 | * Conflict with interwiki prefixes or namespace names.', |
| 33 | + 'lqt_subject_change_forbidden' => 'You are not allowed to change the subject for this thread because you cannot move pages.', |
33 | 34 | 'lqt_in_response_to' => 'In reply to $1 by $2, above:', |
34 | 35 | 'lqt_edited_notice' => 'Edited', |
35 | 36 | 'lqt_reply' => 'Reply', |