Closed PeterTheOne closed 4 years ago
The tests fail in the same way as #27 does.
This is working great here!
I've integrated my changes even deeper and replaced some old code (based on Queries) that only sometimes worked and that is also used for other properties like Carbon copy
and Status
.
It should now also work for SMW 3.0.2
, see: https://github.com/SemanticMediaWiki/SemanticTasks/issues/15#issuecomment-557545642
Unit tests now cover different SMW version but most tests are only very basic.
@krabina Please check once more that I didn't break anything: https://github.com/SemanticMediaWiki/SemanticTasks/archive/bugfix-new-page.zip
with the link above, the same thing happens in SMW 3.0.2 (works in 3.1)
[XduqLlWWIeY4l7avEiSnAgAAAAA] /index.php?title=Test1&action=submit Error from line 81 of ../extensions/SemanticTasks/src/SemanticTasksMailer.php: Call to undefined method SMW\MediaWiki\MwCollaboratorFactory::newEditInfo()
Backtrace:
#0 ../extensions/SemanticTasks/src/SemanticTasksMailer.php(72): ST\SemanticTasksMailer::getAssignedUserFromParserOutput(WikiPage, Revision, User)
#1 ../extensions/SemanticTasks/SemanticTasks.php(79): ST\SemanticTasksMailer::mailAssigneesUpdatedTask(ST\Assignees, WikiPage, User, WikitextContent, string, integer, NULL, NULL, integer, Revision)
#2 ../includes/Hooks.php(177): SemanticTasks::{closure}(WikiPage, User, WikitextContent, string, integer, NULL, NULL, integer, Revision, Status, boolean, integer)
#3 ../includes/Hooks.php(205): Hooks::callHook(string, array, array, NULL)
#4 /../includes/page/WikiPage.php(1977): Hooks::run(string, array)
#5 [internal function]: WikiPage->{closure}(Wikimedia\Rdbms\DatabaseMysqli, string)
#6 ../includes/libs/rdbms/database/Database.php(3664): call_user_func_array(Closure, array)
#7 ../includes/deferred/AtomicSectionUpdate.php(35): Wikimedia\Rdbms\Database->doAtomicSection(string, Closure)
#8 ../includes/deferred/DeferredUpdates.php(259): AtomicSectionUpdate->doUpdate()
#9 ../includes/deferred/DeferredUpdates.php(210): DeferredUpdates::runUpdate(AtomicSectionUpdate, Wikimedia\Rdbms\LBFactorySimple, string, integer)
#10 ../includes/deferred/DeferredUpdates.php(127): DeferredUpdates::execute(array, string, integer)
#11 ../includes/MediaWiki.php(606): DeferredUpdates::doUpdates(string, integer)
#12 ../includes/MediaWiki.php(575): MediaWiki::preOutputCommit(RequestContext, Closure)
#13 ../includes/MediaWiki.php(877): MediaWiki->doPreOutputCommit(Closure)
#14 ../includes/MediaWiki.php(524): MediaWiki->main()
#15 ../index.php(42): MediaWiki->run()
#16 {main}
@krabina Strange because newEditInfo
is still wrapped in a version_compare
call.. I'll try this locally with SMW 3.0.2 .
I tried with SMW 3.0.2 and made another small change because I got an error, but it was not related to newEditInfo
oderwise it worked for me.
I'll merge this, please report if there are still errors. You can try by pulling from master.
Thank you. This now works in 3.1 and 3.0.2! Thank you!
A difference exists, though compared to before. When I creat a new page, 2 E-Mails are sent: one with a new task, one with the assigned task: "Zugewiesene Aufgabe: Test3", "Neue Aufgabe: Test3":
I used the following assignments: [[Assigned to::Benutzer:Krabina]] [[Assigned to::Benutzer:Admin]]
So this can be correct behaviour as I was using User:Admin for creation of the page. So one E-Mail was probably sent to User:Krabina, the other one to User:Admin.
However, this is working fine for me now and I suggest to make a relase...
WIP, don't merge yet.This PR is made in reference to: #15
This PR builds on #27 , so that one should me merged first or I'll need to extract the code.I've written a function
SemanticTasksMailer->getAssignedUserFromParserOutput()
that gets the assigned users fromParserOutput
instead of aQuery
. This function could totally replaceAssignees->getAssignees()
, for now I just use it ifgetAssignees()
does not return any assignees (for example on new page creation). Seems to work, pushed it here to have it tested.