Merge branch 'dev' into release

This commit is contained in:
nobody 2022-03-17 17:08:34 -07:00
commit 73c1e57619
7 changed files with 812 additions and 785 deletions

View file

@ -201,7 +201,7 @@ class Import extends Controller
logger('import step 2');
if (array_key_exists('channel', $data)) {
if ($data['photo']) {
if (isset($data['photo']) && $data['photo']) {
import_channel_photo(base64url_decode($data['photo']['data']), $data['photo']['type'], $account_id, $channel['channel_id']);
}

View file

@ -16,7 +16,7 @@ class Cover_photo
$o = '';
if (App::$module == 'channel' && $_REQUEST['mid']) {
if (App::$module === 'channel' && $_REQUEST['mid']) {
return '';
}
@ -83,19 +83,18 @@ class Cover_photo
$subtitle = '';
}
$c = Channel::get_cover_photo($channel_id, 'html');
$c = Channel::get_cover_photo($channel_id, 'array');
if ($c) {
$c = str_replace('src=', 'data-src=', $c);
$photo_html = (($style) ? str_replace('alt=', ' style="' . $style . '" alt=', $c) : $c);
$o = replace_macros(Theme::get_template('cover_photo_widget.tpl'), array(
'$photo_html' => $photo_html,
$o = replace_macros(Theme::get_template('cover_photo_widget.tpl'), [
'$photo' => $c,
'$style' => $style,
'$alt' => t('cover photo'),
'$title' => $title,
'$subtitle' => $subtitle,
'$hovertitle' => t('Click to show more'),
'$hide_cover' => $hide_cover
));
]);
}
return $o;
}

View file

@ -1452,7 +1452,7 @@ function sync_files($channel, $files)
if (! $f) {
continue;
}
$is_profile_photo = false;
$fetch_url = $f['fetch_url'];
$oldbase = dirname($fetch_url);
@ -1660,6 +1660,7 @@ function sync_files($channel, $files)
logger('attachment store failed', LOGGER_NORMAL, LOG_ERR);
}
if ($f['photo']) {
$is_profile_photo = false;
foreach ($f['photo'] as $p) {
unset($p['id']);
$p['aid'] = $channel['channel_account_id'];
@ -1674,6 +1675,7 @@ function sync_files($channel, $files)
// for any other photo which previously held it.
if ($p['photo_usage'] == PHOTO_PROFILE) {
$is_profile_photo = true;
$e = q(
"update photo set photo_usage = %d where photo_usage = %d
and resource_id != '%s' and uid = %d ",
@ -1748,6 +1750,7 @@ function sync_files($channel, $files)
}
}
if (!isset($p['display_path'])) {
$p['display_path'] = '';
}
@ -1779,6 +1782,15 @@ function sync_files($channel, $files)
}
}
if ($is_profile_photo) {
// set this or the next channel refresh will wipe out the profile photo with one that's fetched remotely
// and lacks the file context; as we probably didn't receive an xchan record in the sync packet
q("update xchan set xchan_photo_date = '%s' where xchan_hash = '%s'",
dbesc(datetime_convert()),
dbesc($channel['channel_hash'])
);
}
Run::Summon([ 'Thumbnail' , $att['hash'] ]);
if ($f['item']) {

View file

@ -516,6 +516,7 @@ function post_activity_item($arr, $allow_code = false, $deliver = true) {
}
$post = item_store($arr,$allow_code,$deliver);
$post_id = 0;
if($post['success']) {
$post_id = $post['item_id'];
@ -529,14 +530,13 @@ function post_activity_item($arr, $allow_code = false, $deliver = true) {
* * \e array - the item returned from item_store()
*/
Hook::call('post_local_end', $ret['activity']);
sync_an_item($channel ? $channel['channel_id'] : $arr['uid'], $post_id);
}
if($post_id && $deliver) {
Run::Summon([ 'Notifier','activity',$post_id ]);
}
$ret['success'] = true;
return $ret;
}

File diff suppressed because it is too large Load diff

View file

@ -1,2 +1,2 @@
<?php
define ( 'STD_VERSION', '22.03.15' );
define ( 'STD_VERSION', '22.03.18' );

View file

@ -16,7 +16,7 @@
}
$('#cover-photo').removeClass('d-none');
cover_height = Math.ceil($(window).width()/1.77777778);
cover_height = calc_height();
$('#cover-photo').css('height', cover_height + 'px');
datasrc2src('#cover-photo > img');
@ -52,7 +52,7 @@
});
$(window).resize(function () {
cover_height = Math.ceil($(window).width()/1.77777778)
cover_height = calc_height();
$('#cover-photo').css('height', cover_height + 'px');
if($(window).width() < 755) {
$('#cover-photo').remove();
@ -63,6 +63,11 @@
});
function calc_height() {
if (! ({{$photo.height}} && {{$photo.height}} )) return Math.ceil($(window).width()/1.77777778);
return Math.ceil( $(window).width() / ( {{$photo.width}} / {{$photo.height}}));
}
function slideUpCover() {
if(coverSlid) {
return;
@ -95,7 +100,7 @@
</script>
<div class="d-none" id="cover-photo" title="{{$hovertitle}}">
{{$photo_html}}
<img class="zrl" width="{{$photo.width}}" height="{{$photo.height}}" data-src="{{$photo.url}}" alt="{{$alt}}" style="{{$style}}" >;
<div id="cover-photo-caption">
<h1>{{$title}}</h1>
<h3>{{$subtitle}}</h3>