Skip to content

Commit 0cf5bd1

Browse files
committed
NotificationGroupValue to use rawurlencode on a group link
1 parent 2e82722 commit 0cf5bd1

File tree

5 files changed

+15
-16
lines changed

5 files changed

+15
-16
lines changed

docs/01-workflow.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,12 @@
44
![image](https://cloud.githubusercontent.com/assets/1245473/16138621/cd46a8ba-343f-11e6-870f-9ddb92f29d07.png)
55

66
To receive notifications, a user has to enable the specific Semantic MediaWiki
7-
related notification [preferences][pref].
8-
9-
An agent (the user that initiated a change) is generally excluded from receiving notifications
10-
about his own actions.
7+
related notification [preferences][pref] with an agent (the user that initiated a change) being
8+
generally excluded from receiving notifications about his own actions.
119

1210
## Workflow
1311

14-
![image](https://cloud.githubusercontent.com/assets/1245473/16158621/45c766c0-34be-11e6-97fc-e22d87df9441.png)
12+
![image](https://cloud.githubusercontent.com/assets/1245473/18805668/7cb694a0-8214-11e6-952d-e84e98fa6899.png)
1513

1614
### Monitor value changes
1715

i18n/en.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
]
66
},
77
"smw-notifications-desc": "A Semantic MediaWiki extension that notifies about changes to structured data using the Echo(Notifications) extension.",
8-
"smw-notifications-enity-specification-change-group": "entity specification change group",
8+
"smw-notifications-entity-specification-change-group": "entity specification change group",
99

1010
"echo-category-title-smw-value-change": "Entity value change (SMW)",
1111
"echo-pref-tooltip-smw-value-change": "Notify me when a change to a selected entity (property, category) value in Semantic MediaWiki occurs.",

i18n/qqq.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@
55
"Kghbln"
66
]
77
},
8-
"smw-scribunto-desc": "{{desc|name=Semantic Scribunto|url=https://www.mediawiki.org/wiki/Extension:Semantic_Scribunto}}"
8+
"smw-notifications-desc": "{{desc|name=Semantic Notifications|url=https://www.mediawiki.org/wiki/Extension:Semantic_Notifications}}",
9+
"smw-notifications-entity-specification-change-group": "Canonical name of the specification group"
910
}

src/DataValues/NotificationGroupValue.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
*/
2323
class NotificationGroupValue extends StringValue {
2424

25-
const SPECIAL_GROUP = 'smw-notifications-enity-specification-change-group';
25+
const SPECIAL_GROUP = 'smw-notifications-entity-specification-change-group';
2626

2727
/**
2828
* Get name in a possible localized representation
@@ -50,15 +50,15 @@ protected function parseUserValue( $value ) {
5050
}
5151

5252
if ( !$this->isKnownNotificationsGroup( $inputValue ) ) {
53-
$this->addErrorMsg( array( 'smw-notifications-datavalue-invalid-group', $inputValue ) );
53+
$this->addErrorMsg( array( 'smw-notifications-datavalue-invalid-group', $inputValue ), Message::PARSE );
5454
$this->m_dataitem = new DIBlob( 'ERROR' );
5555
return;
5656
}
5757

5858
// If it has no contextPage it is most likely linked from a Special page
5959
// such as Special:SearchByProperty or Special:Ask
6060
if ( $this->getContextPage() !== null && !$this->hasUserContext() ) {
61-
$this->addErrorMsg( array( 'smw-notifications-datavalue-restricted-to-user', $inputValue ) );
61+
$this->addErrorMsg( array( 'smw-notifications-datavalue-restricted-to-user', $inputValue ), Message::PARSE );
6262
$this->m_dataitem = new DIBlob( 'ERROR' );
6363
return;
6464
}
@@ -92,7 +92,7 @@ public function getShortWikiText( $linker = null ) {
9292
$text = SpecialPage::getTitleFor( 'SearchByProperty' )->getPrefixedText();
9393

9494
// This is a bit heavy handed ...
95-
return '[[' . $text . '/' . SMW_NOTIFICATIONS_TO_GROUP . '/' . urlencode( $this->m_caption ) . '|' . $this->m_caption . ']]';
95+
return '[[' . $text . '/' . SMW_NOTIFICATIONS_TO_GROUP . '/' . rawurlencode( $this->m_caption ) . '|' . $this->m_caption . ']]';
9696
}
9797

9898
/**

tests/phpunit/Unit/DataValues/NotificationGroupValueTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -157,26 +157,26 @@ public function testSetUserValueWithValidUserContextAndNotNullLinker() {
157157
DIWikiPage::newFromText( __METHOD__, NS_USER )
158158
);
159159

160-
$instance->setUserValue( 'Foo' );
160+
$instance->setUserValue( 'Foo bar' );
161161
$instance->setCaption( false );
162162

163163
$this->assertContains(
164-
SMW_NOTIFICATIONS_TO_GROUP . '/' . 'Foo',
164+
SMW_NOTIFICATIONS_TO_GROUP . '/' . 'Foo%20bar',
165165
$instance->getShortWikiText( '' )
166166
);
167167

168168
$this->assertContains(
169-
SMW_NOTIFICATIONS_TO_GROUP . '/' . 'Foo',
169+
SMW_NOTIFICATIONS_TO_GROUP . '/' . 'Foo%20bar',
170170
$instance->getLongWikiText( '' )
171171
);
172172

173173
$this->assertContains(
174-
'value=Foo',
174+
'value=Foo+bar',
175175
$instance->getShortHTMLText( '' )
176176
);
177177

178178
$this->assertContains(
179-
'value=Foo',
179+
'value=Foo+bar',
180180
$instance->getLongHTMLText( '' )
181181
);
182182
}

0 commit comments

Comments
 (0)