Plugin wallabag: minor improvements

- hide the wallabag icon for logged out users
  - set API V2 as default parameter
  - fix URL encoding issue with special chars

Fixes 
This commit is contained in:
ArthurHoaro 2020-10-24 16:25:06 +02:00
parent 820cae27cf
commit 358cb20bcb
2 changed files with 32 additions and 8 deletions

View file

@ -49,14 +49,15 @@ class PluginWallabagTest extends \Shaarli\TestCase
$conf = new ConfigManager('');
$conf->set('plugins.WALLABAG_URL', 'value');
$str = 'http://randomstr.com/test';
$data = array(
$data = [
'title' => $str,
'links' => array(
array(
'links' => [
[
'url' => $str,
)
)
);
]
],
'_LOGGEDIN_' => true,
];
$data = hook_wallabag_render_linklist($data, $conf);
$link = $data['links'][0];
@ -69,4 +70,26 @@ class PluginWallabagTest extends \Shaarli\TestCase
$this->assertNotFalse(strpos($link['link_plugin'][0], urlencode($str)));
$this->assertNotFalse(strpos($link['link_plugin'][0], $conf->get('plugins.WALLABAG_URL')));
}
/**
* Test render_linklist hook while logged out: no change.
*/
public function testWallabagLinklistLoggedOut(): void
{
$conf = new ConfigManager('');
$str = 'http://randomstr.com/test';
$data = [
'title' => $str,
'links' => [
[
'url' => $str,
]
],
'_LOGGEDIN_' => false,
];
$result = hook_wallabag_render_linklist($data, $conf);
static::assertSame($data, $result);
}
}