1
0
Fork 0

Merge pull request #2133 from pixelfed/staging

Add custom content warnings for remote posts
This commit is contained in:
daniel 2020-04-20 22:28:14 -06:00 committed by GitHub
commit bc12ebd0a9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 15 additions and 7 deletions

View File

@ -2,6 +2,7 @@
## [Unreleased](https://github.com/pixelfed/pixelfed/compare/v0.10.9...dev)
### Added
- Custom content warnings for remote posts ([6afc61a4](https://github.com/pixelfed/pixelfed/commit/6afc61a4))
### Updated
- Updated PostComponent, fix remote urls ([42716ccc](https://github.com/pixelfed/pixelfed/commit/42716ccc))

View File

@ -552,6 +552,7 @@ class PublicApiController extends Controller
'reblogs_count',
'scope',
'local',
'cw_summary',
'created_at',
'updated_at'
)->whereProfileId($profile->id)

View File

@ -327,6 +327,8 @@ class Helpers {
$status->is_nsfw = $cw;
$status->scope = $scope;
$status->visibility = $scope;
$status->cw_summary = $cw == true && isset($res['summary']) ?
Purify::clean(strip_tags($res['summary'])) : null;
$status->save();
if($reply_to == null) {
self::importNoteAttachment($res, $status);
@ -404,7 +406,8 @@ class Helpers {
if(empty($username)) {
return;
}
$remoteUsername = "@{$username}@{$domain}";
$remoteUsername = $username;
$webfinger = "@{$username}@{$domain}";
abort_if(!self::validateUrl($res['inbox']), 400);
abort_if(!self::validateUrl($res['id']), 400);
@ -422,6 +425,8 @@ class Helpers {
$profile->remote_url = strtolower($res['id']);
$profile->public_key = $res['publicKey']['publicKeyPem'];
$profile->key_id = $res['publicKey']['id'];
$profile->webfinger = strtolower(Purify::clean($webfinger));
$profile->last_fetched_at = now();
$profile->save();
if($runJobs == true) {
// RemoteFollowImportRecent::dispatch($res, $profile);

2
public/js/rempro.js vendored

File diff suppressed because one or more lines are too long

View File

@ -22,7 +22,7 @@
"/js/profile-directory.js": "/js/profile-directory.js?id=7160b00d9beda164f1bc",
"/js/quill.js": "/js/quill.js?id=9b15ab0ae830e7293390",
"/js/rempos.js": "/js/rempos.js?id=8dafb37fda5c7977b9af",
"/js/rempro.js": "/js/rempro.js?id=96ea5f27974ab2c52586",
"/js/rempro.js": "/js/rempro.js?id=1cef29f9c7b39704a86a",
"/js/search.js": "/js/search.js?id=b19e1df082a4baa25bb8",
"/js/status.js": "/js/status.js?id=05b227c197bc00d64851",
"/js/story-compose.js": "/js/story-compose.js?id=86751d072969424c6e30",

View File

@ -73,16 +73,16 @@
<div v-if="status.sensitive == true">
<details class="details-animated" @click="status.sensitive = false;">
<summary>
<p class="mb-0 lead font-weight-bold">CW / NSFW / Hidden Media</p>
<p class="mb-0 lead font-weight-bold">{{status.spoiler_text ? status.spoiler_text : 'CW / NSFW / Hidden Media'}}</p>
<p class="font-weight-light">(click to show)</p>
</summary>
<a :href="status.url">
<a :href="remotePostUrl(status)">
<img v-once :src="status.thumb" class="w-100 h-100">
</a>
</details>
</div>
<div v-else>
<a :href="status.url">
<a :href="remotePostUrl(status)">
<img v-once :src="status.thumb" class="w-100 h-100">
</a>
<button v-if="status.cw == true && status.sensitive == false" class="btn btn-block btn-primary font-weight-bold rounded-0" @click="status.sensitive = true;">Hide Media</button>
@ -241,7 +241,8 @@
type: status.pf_type,
url: status.url,
sensitive: status.sensitive,
cw: status.sensitive
cw: status.sensitive,
spoiler_text: status.spoiler_text
}
});
let ids = data.map(status => status.id);