mirror of
https://github.com/friendica/friendica
synced 2025-04-19 08:30:11 +00:00
Merge remote-tracking branch 'upstream/develop' into logging
This commit is contained in:
commit
a497bd3a3d
36 changed files with 1144 additions and 754 deletions
|
@ -23,6 +23,7 @@ namespace Friendica\Module\Api\Mastodon;
|
|||
|
||||
use Friendica\Core\System;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Module\BaseApi;
|
||||
use Friendica\Network\HTTPException;
|
||||
|
||||
|
@ -34,7 +35,6 @@ class FollowRequests extends BaseApi
|
|||
/**
|
||||
* @param array $parameters
|
||||
* @throws HTTPException\BadRequestException
|
||||
* @throws HTTPException\ForbiddenException
|
||||
* @throws HTTPException\InternalServerErrorException
|
||||
* @throws HTTPException\NotFoundException
|
||||
* @throws HTTPException\UnauthorizedException
|
||||
|
@ -48,25 +48,28 @@ class FollowRequests extends BaseApi
|
|||
self::checkAllowedScope(self::SCOPE_FOLLOW);
|
||||
$uid = self::getCurrentUserID();
|
||||
|
||||
$introduction = DI::intro()->selectFirst(['id' => $parameters['id'], 'uid' => $uid]);
|
||||
$introduction = DI::intro()->selectOneById($parameters['id'], $uid);
|
||||
|
||||
$contactId = $introduction->{'contact-id'};
|
||||
$contactId = $introduction->cid;
|
||||
|
||||
switch ($parameters['action']) {
|
||||
case 'authorize':
|
||||
$introduction->confirm();
|
||||
|
||||
Contact\Introduction::confirm($introduction);
|
||||
$relationship = DI::mstdnRelationship()->createFromContactId($contactId, $uid);
|
||||
|
||||
DI::intro()->delete($introduction);
|
||||
break;
|
||||
case 'ignore':
|
||||
$introduction->ignore();
|
||||
|
||||
$relationship = DI::mstdnRelationship()->createFromContactId($contactId, $uid);
|
||||
|
||||
DI::intro()->save($introduction);
|
||||
break;
|
||||
case 'reject':
|
||||
$introduction->discard();
|
||||
|
||||
Contact\Introduction::discard($introduction);
|
||||
$relationship = DI::mstdnRelationship()->createFromContactId($contactId, $uid);
|
||||
|
||||
DI::intro()->delete($introduction);
|
||||
break;
|
||||
default:
|
||||
throw new HTTPException\BadRequestException('Unexpected action parameter, expecting "authorize", "ignore" or "reject"');
|
||||
|
@ -92,13 +95,7 @@ class FollowRequests extends BaseApi
|
|||
'limit' => 40, // Maximum number of results to return. Defaults to 40. Paginate using the HTTP Link header.
|
||||
]);
|
||||
|
||||
$introductions = DI::intro()->selectByBoundaries(
|
||||
['`uid` = ? AND NOT `ignore`', $uid],
|
||||
['order' => ['id' => 'DESC']],
|
||||
$request['min_id'],
|
||||
$request['max_id'],
|
||||
$request['limit']
|
||||
);
|
||||
$introductions = DI::intro()->selectForUser($uid, $request['min_id'], $request['max_id'], $request['limit']);
|
||||
|
||||
$return = [];
|
||||
|
||||
|
|
|
@ -133,7 +133,7 @@ class Delegation extends BaseModule
|
|||
$params = ['distinct' => true, 'expression' => 'convid'];
|
||||
$notifications += DBA::count('mail', ['uid' => $identity['uid'], 'seen' => false], $params);
|
||||
|
||||
$notifications += DBA::count('intro', ['blocked' => false, 'ignore' => false, 'uid' => $identity['uid']]);
|
||||
$notifications += DI::intro()->countActiveForUser($identity['uid']);
|
||||
|
||||
$identities[$key]['notifications'] = $notifications;
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ namespace Friendica\Module;
|
|||
|
||||
use Friendica\BaseModule;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\Contact;
|
||||
|
||||
/**
|
||||
* Process follow request confirmations
|
||||
|
@ -21,12 +22,11 @@ class FollowConfirm extends BaseModule
|
|||
$duplex = intval($_POST['duplex'] ?? 0);
|
||||
$hidden = intval($_POST['hidden'] ?? 0);
|
||||
|
||||
$intro = DI::intro()->selectFirst(['id' => $intro_id, 'uid' => local_user()]);
|
||||
$intro = DI::intro()->selectOneById($intro_id, local_user());
|
||||
|
||||
$cid = $intro->{'contact-id'};
|
||||
Contact\Introduction::confirm($intro, $duplex, $hidden);
|
||||
DI::intro()->delete($intro);
|
||||
|
||||
$intro->confirm($duplex, $hidden);
|
||||
|
||||
DI::baseUrl()->redirect('contact/' . intval($cid));
|
||||
DI::baseUrl()->redirect('contact/' . $intro->cid);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@ namespace Friendica\Module\Notifications;
|
|||
use Friendica\BaseModule;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Module\Security\Login;
|
||||
use Friendica\Network\HTTPException;
|
||||
|
||||
|
@ -50,14 +51,16 @@ class Notification extends BaseModule
|
|||
$request_id = $parameters['id'] ?? false;
|
||||
|
||||
if ($request_id) {
|
||||
$intro = DI::intro()->selectFirst(['id' => $request_id, 'uid' => local_user()]);
|
||||
$intro = DI::intro()->selectOneById($request_id, local_user());
|
||||
|
||||
switch ($_POST['submit']) {
|
||||
case DI::l10n()->t('Discard'):
|
||||
$intro->discard();
|
||||
Contact\Introduction::discard($intro);
|
||||
DI::intro()->delete($intro);
|
||||
break;
|
||||
case DI::l10n()->t('Ignore'):
|
||||
$intro->ignore();
|
||||
DI::intro()->save($intro);
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -5,8 +5,8 @@ namespace Friendica\Module;
|
|||
use Friendica\Core\Hook;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\Item;
|
||||
use Friendica\Model\Group;
|
||||
use Friendica\Model\Item;
|
||||
use Friendica\Model\Post;
|
||||
use Friendica\Network\HTTPException;
|
||||
|
||||
|
@ -32,6 +32,10 @@ class PermissionTooltip extends \Friendica\BaseModule
|
|||
} else {
|
||||
$fields = ['uid', 'allow_cid', 'allow_gid', 'deny_cid', 'deny_gid'];
|
||||
$model = DBA::selectFirst($type, $fields, $condition);
|
||||
$model['allow_cid'] = DI::aclFormatter()->expand($model['allow_cid']);
|
||||
$model['allow_gid'] = DI::aclFormatter()->expand($model['allow_gid']);
|
||||
$model['deny_cid'] = DI::aclFormatter()->expand($model['deny_cid']);
|
||||
$model['deny_gid'] = DI::aclFormatter()->expand($model['deny_gid']);
|
||||
}
|
||||
|
||||
if (!DBA::isResult($model)) {
|
||||
|
|
|
@ -132,6 +132,8 @@ class Index extends BaseSettings
|
|||
notice(DI::l10n()->t('Profile couldn\'t be updated.'));
|
||||
return;
|
||||
}
|
||||
|
||||
DI::baseUrl()->redirect('settings/profile');
|
||||
}
|
||||
|
||||
public static function content(array $parameters = [])
|
||||
|
|
|
@ -92,6 +92,8 @@ class Crop extends BaseSettings
|
|||
$Image->scaleDown(300);
|
||||
}
|
||||
|
||||
$condition = ['resource-id' => $resource_id, 'uid' => local_user(), 'contact-id' => 0];
|
||||
|
||||
$r = Photo::store(
|
||||
$Image,
|
||||
local_user(),
|
||||
|
@ -105,7 +107,7 @@ class Crop extends BaseSettings
|
|||
if ($r === false) {
|
||||
notice(DI::l10n()->t('Image size reduction [%s] failed.', '300'));
|
||||
} else {
|
||||
Photo::update(['profile' => true], ['id' => $r['id']]);
|
||||
Photo::update(['profile' => true], array_merge($condition, ['scale' => 4]));
|
||||
}
|
||||
|
||||
$Image->scaleDown(80);
|
||||
|
@ -123,7 +125,7 @@ class Crop extends BaseSettings
|
|||
if ($r === false) {
|
||||
notice(DI::l10n()->t('Image size reduction [%s] failed.', '80'));
|
||||
} else {
|
||||
Photo::update(['profile' => true], ['id' => $r['id']]);
|
||||
Photo::update(['profile' => true], array_merge($condition, ['scale' => 5]));
|
||||
}
|
||||
|
||||
$Image->scaleDown(48);
|
||||
|
@ -141,7 +143,7 @@ class Crop extends BaseSettings
|
|||
if ($r === false) {
|
||||
notice(DI::l10n()->t('Image size reduction [%s] failed.', '48'));
|
||||
} else {
|
||||
Photo::update(['profile' => true], ['id' => $r['id']]);
|
||||
Photo::update(['profile' => true], array_merge($condition, ['scale' => 6]));
|
||||
}
|
||||
|
||||
Contact::updateSelfFromUserID(local_user(), true);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue