Allow title for new comments to come from the URL
Closed, ResolvedPublic

Description

Author: md5

Description:
Modifies prepolution of edit form to recognize a "preloadtitle" parameter for new sections

The attached patch enables the use of a "preloadtitle" URL parameter to pre-populate the comment title when section=new is passed. This allows for simple creation of comments on a centralized page where the comment title is defaulted to the name of the page hosting the link. This would be useful on Wiktionary for the new feedback functionality we have been experimenting with over the last week or so, among other things. The patch was created today from SVN trunk.


Version: unspecified
Severity: enhancement

attachment EditPage.php-preloadtitle.diff ignored as obsolete

Details

Reference
bz13100
bzimport added a subscriber: Unknown Object (MLST).
bzimport set Reference to bz13100.
bzimport created this task.Feb 22 2008, 3:59 AM

md5 wrote:

After some discussion on English Wiktionary's Beer Parlour, it may make more sense for this to apply to more than just new sections. If that were the case, it would probably make more sense for it to be called "preloadsummary" instead of "preloadtitle". The patch would be more complicated for that case since the interaction with the preloaded section comments would need to be worked out in the case of editing an existing section.

conrad.irwin wrote:

I assumed that preload itself doesn't work for editing already existing sections, wouldn't that overwrite the contents that should be there? I think that the "preloadtitle" is an adequate name for the feature - as that is what it would be used for. This would be very useful for creating RfV/RfD (add to page) links as well.

ran.arigur wrote:

I assumed that preload itself doesn't work for editing already existing
sections [...]

Correct. preloadsummary, however, might be useful more generally; it could
perhaps be appended to the default summary. (I can't say that I care much one
way or the other. This simply came up because my temporary JavaScript solution
doesn't check to make sure it's on a section=new page, so would support
preloadtitle on any page. If people don't like that, we can stick with
preloadtitle.)

md5 wrote:

Has anyone had a chance to look at this patch? I'd be happy to make any changes necessary to get it into SVN.

Patch applied as posted in r31329

ran.arigur wrote:

Thanks! :-)

md5 wrote:

Replacement for previous patch...

The previous patch just went live and did not work correctly. The value of $this->summary was being wiped out after being set (in the initialiseForm() method).

This revised patch reverses the earlier patch and does the check for "preloadtitle" inside of initialiseForm() instead of inside importFormData(). It adds a global import of $wgRequest in initialiseForm() because the request parameters are not available in that method otherwise.

I have tested this patch in a local MediaWiki installation, unlike the previous patch (*hanging head in shame*).

Attached: EditPage.php-preloadtitle.diff

I fixed this issue in r31419. The line in initialiseForm() blanking $this->summary was completely useless as $this->summary is blank by default anyway.

alexsm333 wrote:

Would it be possible to make "preloadtitle" work on section=0?

That's another case when summary is blank, so it would be nice to have the option to pre-populate it from URL.

Add Comment