mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-29 17:53:16 +00:00
Merge pull request #1300 from pixelfed/frontend-ui-refactor
Frontend ui refactor
This commit is contained in:
commit
a9728265ec
4 changed files with 42 additions and 4 deletions
|
@ -9,8 +9,7 @@ use App\{
|
||||||
Profile,
|
Profile,
|
||||||
UserFilter
|
UserFilter
|
||||||
};
|
};
|
||||||
use Auth;
|
use Auth, Cache, Redis;
|
||||||
use Cache;
|
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use App\Services\SuggestionService;
|
use App\Services\SuggestionService;
|
||||||
|
|
||||||
|
@ -71,6 +70,13 @@ class ApiController extends BaseApiController
|
||||||
->pluck('filterable_id')->toArray();
|
->pluck('filterable_id')->toArray();
|
||||||
$following = array_merge($following, $filters);
|
$following = array_merge($following, $filters);
|
||||||
|
|
||||||
|
$key = config('cache.prefix').':api:local:exp:rec:'.$id;
|
||||||
|
$ttl = (int) Redis::ttl($key);
|
||||||
|
|
||||||
|
if($request->filled('refresh') == true && (290 > $ttl) == true) {
|
||||||
|
Cache::forget('api:local:exp:rec:'.$id);
|
||||||
|
}
|
||||||
|
|
||||||
$res = Cache::remember('api:local:exp:rec:'.$id, now()->addMinutes(5), function() use($id, $following, $ids) {
|
$res = Cache::remember('api:local:exp:rec:'.$id, now()->addMinutes(5), function() use($id, $following, $ids) {
|
||||||
return Profile::select(
|
return Profile::select(
|
||||||
'id',
|
'id',
|
||||||
|
|
BIN
public/js/timeline.js
vendored
BIN
public/js/timeline.js
vendored
Binary file not shown.
Binary file not shown.
|
@ -274,7 +274,7 @@
|
||||||
<div v-show="showSuggestions == true && suggestions.length && config.ab && config.ab.rec == true" class="mb-4">
|
<div v-show="showSuggestions == true && suggestions.length && config.ab && config.ab.rec == true" class="mb-4">
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="card-header bg-white d-flex align-items-center justify-content-between">
|
<div class="card-header bg-white d-flex align-items-center justify-content-between">
|
||||||
<div></div>
|
<a class="small text-muted cursor-pointer" href="#" @click.prevent="refreshSuggestions" ref="suggestionRefresh"><i class="fas fa-sync-alt"></i></a>
|
||||||
<div class="small text-dark text-uppercase font-weight-bold">Suggestions</div>
|
<div class="small text-dark text-uppercase font-weight-bold">Suggestions</div>
|
||||||
<div class="small text-muted cursor-pointer" v-on:click="hideSuggestions"><i class="fas fa-times"></i></div>
|
<div class="small text-muted cursor-pointer" v-on:click="hideSuggestions"><i class="fas fa-times"></i></div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -1067,7 +1067,6 @@
|
||||||
if(this.config.ab.rec == false) {
|
if(this.config.ab.rec == false) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
axios.get('/api/local/exp/rec')
|
axios.get('/api/local/exp/rec')
|
||||||
.then(res => {
|
.then(res => {
|
||||||
this.suggestions = res.data;
|
this.suggestions = res.data;
|
||||||
|
@ -1123,6 +1122,39 @@
|
||||||
$('textarea[name="comment"]').focus();
|
$('textarea[name="comment"]').focus();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
refreshSuggestions() {
|
||||||
|
let el = event.target.parentNode;
|
||||||
|
if(el.classList.contains('disabled') == true) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
axios.get('/api/local/exp/rec', {
|
||||||
|
params: {
|
||||||
|
refresh: true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.then(res => {
|
||||||
|
this.suggestions = res.data;
|
||||||
|
|
||||||
|
if (el.classList) {
|
||||||
|
el.classList.add('disabled');
|
||||||
|
el.classList.add('text-light');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
el.className += ' ' + 'disabled text-light';
|
||||||
|
}
|
||||||
|
setTimeout(function() {
|
||||||
|
el.setAttribute('href', '#');
|
||||||
|
if (el.classList) {
|
||||||
|
el.classList.remove('disabled');
|
||||||
|
el.classList.remove('text-light');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
el.className = el.className.replace(new RegExp('(^|\\b)' + className.split(' ').join('|') + '(\\b|$)', 'gi'), 'disabled text-light');
|
||||||
|
}
|
||||||
|
}, 10000);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Reference in a new issue