#286 Cannot use underscore (`_`) in nickname and `No matches for action "showfavorites" with arguments "nickname=senookenmoney "`

Aperto
aperto 2 anni fa da senooken · 4 commenti
senooken commented 2 anni fa

GS v2.0.0beta0. I tried creating new account (senooken_money) for my topic sub account.

I could input senooken_money in registering nickname form and succeeded registering. But underscore (_) was removed from nickname. And I have following error when I show home.

2022-06-28 06:21:48 LOG_DEBUG: [social.senooken.jp:781394.dc884a39 GET /api/statuses/show/287939.atom] Starting DB queue manager.
2022-06-28 06:21:48 LOG_DEBUG: [social.senooken.jp:781394.dc884a39 GET /api/statuses/show/287939.atom] DBQueueManager: Checking for notices...
2022-06-28 06:21:52 LOG_DEBUG: [social.senooken.jp:781394.f08c1d72 GET /senooken] action.php - Server error '500' on 'showstream': No matches for action "showfavorites" with arguments "nickname=senookenmoney "
2022-06-28 06:21:52 LOG_ERR: [social.senooken.jp:781394.f08c1d72 GET /senooken] Handled serverError (500) but cannot output into desired format (NULL): 'No matches for action "showfavorites" with arguments "nickname=senookenmoney "'
2022-06-28 06:21:52 LOG_ERR: [social.senooken.jp:781394.f08c1d72 GET /senooken] ServerErrorAction: 500 No matches for action "showfavorites" with arguments "nickname=senookenmoney "

It seems nickname is not enough length due to removing underscore. Trailing space is not required. In my DB table user.nickname has no trailing space.

In actions/register.php -> lib/profile/nichname.php, underscore is removed.

    public static function normalize($str, $checkuse=false)
    {
        if (mb_strlen($str) > self::MAX_LEN) {
            // Display forms must also fit!
            throw new NicknameTooLongException();
        }

        // We should also have UTF-8 normalization (å to a etc.)
        $str = trim($str);
        $str = str_replace('_', '', $str);
        $str = mb_strtolower($str);

Twitter and Mastodon allow underscore for nickname. I think GS also should allow underscore for nickname.

GS v2.0.0beta0. I tried creating new account (senooken_money) for my topic sub account. I could input `senooken_money` in registering nickname form and succeeded registering. But underscore (`_`) was removed from nickname. And I have following error when I show home. ``` 2022-06-28 06:21:48 LOG_DEBUG: [social.senooken.jp:781394.dc884a39 GET /api/statuses/show/287939.atom] Starting DB queue manager. 2022-06-28 06:21:48 LOG_DEBUG: [social.senooken.jp:781394.dc884a39 GET /api/statuses/show/287939.atom] DBQueueManager: Checking for notices... 2022-06-28 06:21:52 LOG_DEBUG: [social.senooken.jp:781394.f08c1d72 GET /senooken] action.php - Server error '500' on 'showstream': No matches for action "showfavorites" with arguments "nickname=senookenmoney " 2022-06-28 06:21:52 LOG_ERR: [social.senooken.jp:781394.f08c1d72 GET /senooken] Handled serverError (500) but cannot output into desired format (NULL): 'No matches for action "showfavorites" with arguments "nickname=senookenmoney "' 2022-06-28 06:21:52 LOG_ERR: [social.senooken.jp:781394.f08c1d72 GET /senooken] ServerErrorAction: 500 No matches for action "showfavorites" with arguments "nickname=senookenmoney " ``` It seems nickname is not enough length due to removing underscore. Trailing space is not required. In my DB table `user.nickname` has no trailing space. In `actions/register.php` -> `lib/profile/nichname.php`, underscore is removed. ``` public static function normalize($str, $checkuse=false) { if (mb_strlen($str) > self::MAX_LEN) { // Display forms must also fit! throw new NicknameTooLongException(); } // We should also have UTF-8 normalization (å to a etc.) $str = trim($str); $str = str_replace('_', '', $str); $str = mb_strtolower($str); ``` Twitter and Mastodon allow underscore for nickname. I think GS also should allow underscore for nickname.
senooken commented 2 anni fa
Autore

ServerErrorAction: 500 No matches for action "showfavorites" with arguments "nickname=senookenmoney "

This error was due to config.php. In my config.php, there is $config['site']['profile'] = 'singleuser';. I registered new my topic sub account by invite function. If I change from singleuser to community, error is cleared.

This error was occured FavoriteModule::onEndPersonalGroupNav->common_local_url->Route::build->URLMapper::generate, missing key in $reverse_dynamics.

The key is added FavoriteModule::onRouterInitialized. But this function has condition.

   public function onRouterInitialized(URLMapper $m)
    {
        // Web UI actions
        $m->connect(
            'main/favor',
            ['action' => 'favor']
        );
        $m->connect(
            'main/disfavor',
            ['action' => 'disfavor']
        );

        if (common_config('singleuser', 'enabled')) { // HERE. this block should be removed
            $nickname = User::singleUserNickname();

            $m->connect(
                'favorites',
                [
                    'action'   => 'showfavorites',
                    'nickname' => $nickname,
                ]
            );
            $m->connect(
                'favoritesrss',
                [
                    'action'   => 'favoritesrss',
                    'nickname' => $nickname,
                ]
            );
        } else {
            $m->connect(
                'favoritedrss',
                ['action' => 'favoritedrss']
            );
            $m->connect(
                'favorited/',
                ['action' => 'favorited']
            );
            $m->connect(
                'favorited',
                ['action' => 'favorited']
            );

            $m->connect(
                ':nickname/favorites',
                ['action' => 'showfavorites'],
                ['nickname' => Nickname::DISPLAY_FMT]
            );
            $m->connect(
                ':nickname/favorites/rss',
                ['action' => 'favoritesrss'],
                ['nickname' => Nickname::DISPLAY_FMT]
            );
        }

I think this condition should be removed. singleuser condition is redundant. Because singleuser is site config, and an user can invite new user during singleuser. else block is OK even during singleuser.

These are some same condition blocks (favorites, bookmarks...). How do you think?

`ServerErrorAction: 500 No matches for action "showfavorites" with arguments "nickname=senookenmoney "` This error was due to `config.php`. In my `config.php`, there is `$config['site']['profile'] = 'singleuser';`. I registered new my topic sub account by invite function. If I change from `singleuser` to `community`, error is cleared. This error was occured FavoriteModule::onEndPersonalGroupNav->common_local_url->Route::build->URLMapper::generate, missing key in $reverse_dynamics. The key is added FavoriteModule::onRouterInitialized. But this function has condition. ``` public function onRouterInitialized(URLMapper $m) { // Web UI actions $m->connect( 'main/favor', ['action' => 'favor'] ); $m->connect( 'main/disfavor', ['action' => 'disfavor'] ); if (common_config('singleuser', 'enabled')) { // HERE. this block should be removed $nickname = User::singleUserNickname(); $m->connect( 'favorites', [ 'action' => 'showfavorites', 'nickname' => $nickname, ] ); $m->connect( 'favoritesrss', [ 'action' => 'favoritesrss', 'nickname' => $nickname, ] ); } else { $m->connect( 'favoritedrss', ['action' => 'favoritedrss'] ); $m->connect( 'favorited/', ['action' => 'favorited'] ); $m->connect( 'favorited', ['action' => 'favorited'] ); $m->connect( ':nickname/favorites', ['action' => 'showfavorites'], ['nickname' => Nickname::DISPLAY_FMT] ); $m->connect( ':nickname/favorites/rss', ['action' => 'favoritesrss'], ['nickname' => Nickname::DISPLAY_FMT] ); } ``` I think this condition should be removed. `singleuser` condition is redundant. Because `singleuser` is site config, and an user can invite new user during `singleuser`. `else` block is OK even during `singleuser`. These are some same condition blocks (favorites, bookmarks...). How do you think?
senooken commented 2 anni fa
Autore

If GS allows underscore in nickname, following patch is required. And I think we need some message fix.

diff --git a/lib/profile/nickname.php b/lib/profile/nickname.php
index 194c829164..e1247efb4a 100644
--- a/lib/profile/nickname.php
+++ b/lib/profile/nickname.php
@@ -72,7 +72,7 @@ class Nickname
      *
      * This, INPUT_FMT and DISPLAY_FMT should not be enclosed in []s.
      */
-    const CANONICAL_FMT = '[0-9a-z]{1,64}';
+    const CANONICAL_FMT = '[0-9a-z_]{1,64}';
 
     /**
      * Maximum number of characters in a canonical-form nickname.
@@ -136,7 +136,6 @@ class Nickname
 
         // We should also have UTF-8 normalization (å to a etc.)
         $str = trim($str);
-        $str = str_replace('_', '', $str);
         $str = mb_strtolower($str);

If it is OK, I will investigate target fixing messages and create PR with previous my comment (removing singleuser condition).

I will be waiting your reply.

If GS allows underscore in nickname, following patch is required. And I think we need some message fix. ``` diff --git a/lib/profile/nickname.php b/lib/profile/nickname.php index 194c829164..e1247efb4a 100644 --- a/lib/profile/nickname.php +++ b/lib/profile/nickname.php @@ -72,7 +72,7 @@ class Nickname * * This, INPUT_FMT and DISPLAY_FMT should not be enclosed in []s. */ - const CANONICAL_FMT = '[0-9a-z]{1,64}'; + const CANONICAL_FMT = '[0-9a-z_]{1,64}'; /** * Maximum number of characters in a canonical-form nickname. @@ -136,7 +136,6 @@ class Nickname // We should also have UTF-8 normalization (å to a etc.) $str = trim($str); - $str = str_replace('_', '', $str); $str = mb_strtolower($str); ``` If it is OK, I will investigate target fixing messages and create PR with previous my comment (removing `singleuser` condition). I will be waiting your reply.
Diogo Cordeiro commented 2 anni fa
Proprietario

This nickname bug was fixed in v3, I'll bring the fix down to v2. The singleuser matter should be discussed in IRC.

This nickname bug was fixed in v3, I'll bring the fix down to v2. The singleuser matter should be discussed in IRC.
senooken commented 2 anni fa
Autore

@diogo Thanks for reply.

I think singleuser matter is not important. But underscore in nickname is very important. I think we can close if underscore is fixed (applying v3 fix to v2).

@diogo Thanks for reply. I think singleuser matter is not important. But underscore in nickname is very important. I think we can close if underscore is fixed (applying v3 fix to v2).
Sign in to join this conversation.
Nessuna milestone
Nessun assegnatario
2 Partecipanti
Caricamento...
Annulla
Salva
Non ci sono ancora contenuti.