mirror of
https://koodu.h-i.works/projects/thebadspace
synced 2025-05-06 14:41:02 -05:00
Seperated silence and block counts
Actions taken against and instance of have been separted into their respective buckets so they can be display properly rather than simply grouped together and mislabled. This gives a better sense of the severity of response per instance.
This commit is contained in:
parent
3a3a7e9817
commit
6e84a3cf0b
@ -37,7 +37,7 @@ class FrontIndexController extends Controller
|
|||||||
$raw = DB::select("SELECT * FROM searchlocations(?)", [$terms]);
|
$raw = DB::select("SELECT * FROM searchlocations(?)", [$terms]);
|
||||||
$results = [];
|
$results = [];
|
||||||
foreach ($raw as $item) {
|
foreach ($raw as $item) {
|
||||||
if ($item->block_count > 2) {
|
if (($item->block_count + $item->silence_count) > 2) {
|
||||||
array_push($results, $item);
|
array_push($results, $item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -46,6 +46,7 @@ class FrontIndexController extends Controller
|
|||||||
$count = count($locations);
|
$count = count($locations);
|
||||||
$recent = Location::where("active", true)
|
$recent = Location::where("active", true)
|
||||||
->where('block_count', '>', 2)
|
->where('block_count', '>', 2)
|
||||||
|
->where('silence_count', '>', 2)
|
||||||
->limit(10)->orderByDesc('updated_at')->get();
|
->limit(10)->orderByDesc('updated_at')->get();
|
||||||
|
|
||||||
return view('front.index', [
|
return view('front.index', [
|
||||||
@ -68,6 +69,7 @@ class FrontIndexController extends Controller
|
|||||||
public function location(string $uuid = "1")
|
public function location(string $uuid = "1")
|
||||||
{
|
{
|
||||||
$location = Location::where("uuid", $uuid)->first();
|
$location = Location::where("uuid", $uuid)->first();
|
||||||
|
$sources = Source::where("active", true)->get();
|
||||||
$name = "NO LOCATION FOUND";
|
$name = "NO LOCATION FOUND";
|
||||||
if ($location) {
|
if ($location) {
|
||||||
$name = $location->name;
|
$name = $location->name;
|
||||||
@ -75,6 +77,8 @@ class FrontIndexController extends Controller
|
|||||||
return view('front.location', [
|
return view('front.location', [
|
||||||
'title' => str_replace(".", " ", $name),
|
'title' => str_replace(".", " ", $name),
|
||||||
'location' => $location,
|
'location' => $location,
|
||||||
|
'actions' => $location->block_count + $location->silence_count,
|
||||||
|
'sources_count' => count($sources),
|
||||||
'images' => json_decode($location->images),
|
'images' => json_decode($location->images),
|
||||||
'updated' => $location->updated_at->format('Y M d'),
|
'updated' => $location->updated_at->format('Y M d'),
|
||||||
]);
|
]);
|
||||||
|
@ -72,14 +72,26 @@ class LocationController extends Controller
|
|||||||
$index = array_search($item['domain'], array_column($unified, 'url'));
|
$index = array_search($item['domain'], array_column($unified, 'url'));
|
||||||
if ($index) {
|
if ($index) {
|
||||||
//if there is a match, update the count
|
//if there is a match, update the count
|
||||||
++$unified[$index]['count'];
|
if ($item['severity'] == "suspend" || $item['severity'] == "defederate") {
|
||||||
|
++$unified[$index]['block_count'];
|
||||||
} else {
|
} else {
|
||||||
|
++$unified[$index]['silence_count'];
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$silence = 0;
|
||||||
|
$suspend = 0;
|
||||||
|
if ($item['severity'] == "suspend" || $item['severity'] == "defederate") {
|
||||||
|
++$silence;
|
||||||
|
} else {
|
||||||
|
++$suspend;
|
||||||
|
}
|
||||||
array_push($unified, [
|
array_push($unified, [
|
||||||
'name' => $item['domain'],
|
'name' => $item['domain'],
|
||||||
'url' => $item['domain'],
|
'url' => $item['domain'],
|
||||||
'rating' => $item['severity'],
|
'rating' => $item['severity'],
|
||||||
'comment' => $item['comment'],
|
'comment' => $item['comment'],
|
||||||
'count' => 1,
|
'block_count' => $suspend,
|
||||||
|
'silence_count' => $silence,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -91,14 +103,26 @@ class LocationController extends Controller
|
|||||||
$index = array_search($item[0], array_column($unified, 'url'));
|
$index = array_search($item[0], array_column($unified, 'url'));
|
||||||
if ($index) {
|
if ($index) {
|
||||||
//if there is a match, update the count
|
//if there is a match, update the count
|
||||||
++$unified[$index]['count'];
|
if ($item[1] == "suspend" || $item['severity'] == "defederate") {
|
||||||
|
++$unified[$index]['block_count'];
|
||||||
} else {
|
} else {
|
||||||
|
++$unified[$index]['silence_count'];
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$silence = 0;
|
||||||
|
$suspend = 0;
|
||||||
|
if ($item[1] == "suspend" || $item[1] == "defederate") {
|
||||||
|
++$silence;
|
||||||
|
} else {
|
||||||
|
++$suspend;
|
||||||
|
}
|
||||||
array_push($unified, [
|
array_push($unified, [
|
||||||
'name' => $item[0],
|
'name' => $item[0],
|
||||||
'url' => $item[0],
|
'url' => $item[0],
|
||||||
'rating' => $item[1],
|
'rating' => $item[1],
|
||||||
'comment' => $item[2],
|
'comment' => $item[2],
|
||||||
'count' => 1,
|
'block_count' => $suspend,
|
||||||
|
'silence_count' => $silence,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -137,7 +161,8 @@ class LocationController extends Controller
|
|||||||
++$duplicates;
|
++$duplicates;
|
||||||
//update block count for existing item
|
//update block count for existing item
|
||||||
|
|
||||||
$location->block_count = $item['count'];
|
$location->block_count = $item['block_count'];
|
||||||
|
$location->silence_count = $item['silence_count'];
|
||||||
|
|
||||||
//replace null with empty array
|
//replace null with empty array
|
||||||
if ($location->images == null) {
|
if ($location->images == null) {
|
||||||
@ -159,7 +184,8 @@ class LocationController extends Controller
|
|||||||
'added_by' => 1,
|
'added_by' => 1,
|
||||||
'tags' => 'poor moderation, hate speech',
|
'tags' => 'poor moderation, hate speech',
|
||||||
'images' => json_encode($images),
|
'images' => json_encode($images),
|
||||||
'block_count' => $item['count'],
|
'block_count' => $item['block_count'],
|
||||||
|
'silence_count' => $item['silence_count'],
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,7 @@ section[role="listings"] div[role="paginate"] span {
|
|||||||
|
|
||||||
a.list-link {
|
a.list-link {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: 30px 50px 300px;
|
grid-template-columns: 30px 50px 30px 50px 300px;
|
||||||
width: 80%;
|
width: 80%;
|
||||||
height: 45px;
|
height: 45px;
|
||||||
}
|
}
|
||||||
|
@ -32,11 +32,9 @@
|
|||||||
@foreach($recent as $location)
|
@foreach($recent as $location)
|
||||||
<a class="list-link" role="listitem" href="/location/{{$location->uuid}}">
|
<a class="list-link" role="listitem" href="/location/{{$location->uuid}}">
|
||||||
<span>{{$location->block_count}}</span>
|
<span>{{$location->block_count}}</span>
|
||||||
@if($location->rating == 'silence')
|
|
||||||
<img class="menu-icon" src="/assets/images/global/status-silence.svg" title="silenced" />
|
|
||||||
@else
|
|
||||||
<img class="menu-icon" src="/assets/images/global/status-suspend.svg" title="suspended" />
|
<img class="menu-icon" src="/assets/images/global/status-suspend.svg" title="suspended" />
|
||||||
@endif
|
<span>{{$location->silence_count}}</span>
|
||||||
|
<img class="menu-icon" src="/assets/images/global/status-silence.svg" title="silenced" />
|
||||||
<label>{{$location->name}}</label>
|
<label>{{$location->name}}</label>
|
||||||
</a>
|
</a>
|
||||||
@endforeach
|
@endforeach
|
||||||
|
@ -17,16 +17,14 @@
|
|||||||
@endforeach
|
@endforeach
|
||||||
@endif
|
@endif
|
||||||
<br />
|
<br />
|
||||||
@if($location->rating == 'silence')
|
<strong>Total Actions:</strong> {{$actions}}/{{$sources_count}}<br />
|
||||||
<img class="rating-icon" src="/assets/images/global/status-silence.svg" title="silenced" />
|
|
||||||
<strong>Silenced Count: {{$location->block_count}}</strong>
|
|
||||||
@else
|
|
||||||
<img class="rating-icon" src="/assets/images/global/status-suspend.svg" title="suspended" />
|
<img class="rating-icon" src="/assets/images/global/status-suspend.svg" title="suspended" />
|
||||||
<strong>Suspended Count: {{$location->block_count}}</strong>
|
<strong>Suspended: {{$location->block_count}}</strong>
|
||||||
|
|
||||||
@endif
|
<img class="rating-icon" src="/assets/images/global/status-silence.svg" title="silenced" />
|
||||||
<br />
|
<strong>Silenced: {{$location->silence_count}}</strong>
|
||||||
This count reflects the number of times this instance has been suspended or silenced be two or more <a href="/about#how">Current Sources</a>
|
<br /><br />
|
||||||
|
Total Actions represent the number of actions, silences or suspensions, that have been taken against an instance by <a href="/about#how">Current Sources</a>
|
||||||
|
|
||||||
<br />UPDATED : {{$updated}}
|
<br />UPDATED : {{$updated}}
|
||||||
</article>
|
</article>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user