Merge pull request #12294 from annando/tag-warnings

Fix warning 'Undefined array key "name"'
This commit is contained in:
Hypolite Petovan 2022-11-29 19:36:51 -05:00 committed by GitHub
commit 6c2f42ed03
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 4 additions and 6 deletions

View file

@ -65,9 +65,8 @@ class FollowedTags extends BaseApi
$saved_searches = DBA::select('search', ['id', 'term'], $condition); $saved_searches = DBA::select('search', ['id', 'term'], $condition);
while ($saved_search = DBA::fetch($saved_searches)) { while ($saved_search = DBA::fetch($saved_searches)) {
self::setBoundaries($saved_search['id']); self::setBoundaries($saved_search['id']);
$tag = ['name' => ltrim($saved_search['term'], '#')];
$hashtag = new \Friendica\Object\Api\Mastodon\Tag($this->baseUrl, $tag, [], true); $hashtag = new \Friendica\Object\Api\Mastodon\Tag($this->baseUrl, ['name' => ltrim($saved_search['term'], '#')], [], true);
$return[] = $hashtag->toArray(); $return[] = $hashtag->toArray();
} }

View file

@ -45,9 +45,8 @@ class Tags extends BaseApi
$tag = ltrim($this->parameters['hashtag'], '#'); $tag = ltrim($this->parameters['hashtag'], '#');
$following = DBA::exists('search', ['uid' => $uid, 'term' => '#' . $tag]); $following = DBA::exists('search', ['uid' => $uid, 'term' => '#' . $tag]);
$term = ['term' => $tag];
$hashtag = new \Friendica\Object\Api\Mastodon\Tag($this->baseUrl, $term, [], $following); $hashtag = new \Friendica\Object\Api\Mastodon\Tag($this->baseUrl, ['name' => $tag], [], $following);
System::jsonExit($hashtag->toArray()); System::jsonExit($hashtag->toArray());
} }
} }

View file

@ -45,7 +45,7 @@ class Follow extends BaseApi
DBA::insert('search', $fields); DBA::insert('search', $fields);
} }
$hashtag = new \Friendica\Object\Api\Mastodon\Tag($this->baseUrl, $fields, [], true); $hashtag = new \Friendica\Object\Api\Mastodon\Tag($this->baseUrl, ['name' => ltrim($this->parameters['hashtag'])], [], true);
System::jsonExit($hashtag->toArray()); System::jsonExit($hashtag->toArray());
} }
} }

View file

@ -44,7 +44,7 @@ class Unfollow extends BaseApi
DBA::delete('search', $term); DBA::delete('search', $term);
$hashtag = new \Friendica\Object\Api\Mastodon\Tag($this->baseUrl, $term, [], false); $hashtag = new \Friendica\Object\Api\Mastodon\Tag($this->baseUrl, ['name' => ltrim($this->parameters['hashtag'])], [], false);
System::jsonExit($hashtag->toArray()); System::jsonExit($hashtag->toArray());
} }
} }