Merge pull request #2043 from pixelfed/staging

Add modlog notifications
This commit is contained in:
daniel 2020-02-21 21:08:55 -07:00 committed by GitHub
commit b008e0a47b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 293 additions and 120 deletions

View file

@ -0,0 +1,66 @@
<?php
namespace App\Observers;
use App\Notification;
use App\ModLog;
use App\Services\ModLogService;
use Log;
class ModLogObserver
{
/**
* Handle the mod log "created" event.
*
* @param \App\ModLog $modLog
* @return void
*/
public function created(ModLog $modLog)
{
ModLogService::boot()->load($modLog)->fanout();
}
/**
* Handle the mod log "updated" event.
*
* @param \App\ModLog $modLog
* @return void
*/
public function updated(ModLog $modLog)
{
ModLogService::boot()->load($modLog)->fanout();
}
/**
* Handle the mod log "deleted" event.
*
* @param \App\ModLog $modLog
* @return void
*/
public function deleted(ModLog $modLog)
{
ModLogService::boot()->load($modLog)->unfanout();
}
/**
* Handle the mod log "restored" event.
*
* @param \App\ModLog $modLog
* @return void
*/
public function restored(ModLog $modLog)
{
ModLogService::boot()->load($modLog)->fanout();
}
/**
* Handle the mod log "force deleted" event.
*
* @param \App\ModLog $modLog
* @return void
*/
public function forceDeleted(ModLog $modLog)
{
ModLogService::boot()->load($modLog)->unfanout();
}
}

View file

@ -5,6 +5,7 @@ namespace App\Providers;
use App\Observers\{ use App\Observers\{
AvatarObserver, AvatarObserver,
NotificationObserver, NotificationObserver,
ModLogObserver,
StatusHashtagObserver, StatusHashtagObserver,
UserObserver, UserObserver,
UserFilterObserver, UserFilterObserver,
@ -12,6 +13,7 @@ use App\Observers\{
use App\{ use App\{
Avatar, Avatar,
Notification, Notification,
ModLog,
StatusHashtag, StatusHashtag,
User, User,
UserFilter UserFilter
@ -35,6 +37,7 @@ class AppServiceProvider extends ServiceProvider
Avatar::observe(AvatarObserver::class); Avatar::observe(AvatarObserver::class);
Notification::observe(NotificationObserver::class); Notification::observe(NotificationObserver::class);
ModLog::observe(ModLogObserver::class);
StatusHashtag::observe(StatusHashtagObserver::class); StatusHashtag::observe(StatusHashtagObserver::class);
User::observe(UserObserver::class); User::observe(UserObserver::class);
UserFilter::observe(UserFilterObserver::class); UserFilter::observe(UserFilterObserver::class);

View file

@ -2,7 +2,9 @@
namespace App\Services; namespace App\Services;
use Auth;
use App\ModLog; use App\ModLog;
use App\Notification;
use App\User; use App\User;
class ModLogService { class ModLogService {
@ -95,4 +97,46 @@ class ModLogService {
return; return;
} }
} }
public function load($modLog)
{
$this->log = $modLog;
return $this;
}
public function fanout()
{
$log = $this->log;
$msg = "{$log->user_username} commented on a modlog";
$rendered = "<span class='font-weight-bold'>{$log->user_username}</span> commented on a <a href='/i/admin/users/modlogs/{$log->user_id}}' class='font-weight-bold text-decoration-none'>modlog</a>";
$item_id = $log->id;
$item_type = 'App\ModLog';
$action = 'admin.user.modlog.comment';
$admins = User::whereNull('status')
->whereNotIn('id', [$log->user_id])
->whereIsAdmin(true)
->pluck('profile_id')
->toArray();
foreach($admins as $user) {
$n = new Notification;
$n->profile_id = $user;
$n->actor_id = $log->admin->profile_id;
$n->item_id = $item_id;
$n->item_type = $item_type;
$n->action = $action;
$n->message = $msg;
$n->rendered = $rendered;
$n->save();
}
}
public function unfanout()
{
Notification::whereItemType('App\ModLog')
->whereItemId($this->log->id)
->delete();
}
} }

View file

@ -13,7 +13,8 @@ class NotificationTransformer extends Fractal\TransformerAbstract
protected $defaultIncludes = [ protected $defaultIncludes = [
'account', 'account',
'status', 'status',
'relationship' 'relationship',
'modlog'
]; ];
public function transform(Notification $notification) public function transform(Notification $notification)
@ -54,6 +55,7 @@ class NotificationTransformer extends Fractal\TransformerAbstract
'share' => 'share', 'share' => 'share',
'like' => 'favourite', 'like' => 'favourite',
'comment' => 'comment', 'comment' => 'comment',
'admin.user.modlog.comment' => 'modlog'
]; ];
return $verbs[$verb]; return $verbs[$verb];
} }
@ -62,4 +64,25 @@ class NotificationTransformer extends Fractal\TransformerAbstract
{ {
return $this->item($notification->actor, new RelationshipTransformer()); return $this->item($notification->actor, new RelationshipTransformer());
} }
public function includeModlog(Notification $notification)
{
$n = $notification;
if($n->item_id && $n->item_type == 'App\ModLog') {
$ml = $n->item;
if(!empty($ml)) {
$res = $this->item($ml, function($ml) {
return [
'id' => $ml->object_uid,
'url' => url('/i/admin/users/modlogs/' . $ml->object_uid)
];
});
return $res;
} else {
return null;
}
} else {
return null;
}
}
} }

208
package-lock.json generated
View file

@ -820,10 +820,20 @@
"resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-1.1.3.tgz", "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-1.1.3.tgz",
"integrity": "sha512-shAmDyaQC4H92APFoIaVDHCx5bStIocgvbwQyxPRrbUY20V1EYTbSDchWbuwlMG3V17cprZhA6+78JfB+3DTPw==" "integrity": "sha512-shAmDyaQC4H92APFoIaVDHCx5bStIocgvbwQyxPRrbUY20V1EYTbSDchWbuwlMG3V17cprZhA6+78JfB+3DTPw=="
}, },
"@nuxt/opencollective": {
"version": "0.3.0",
"resolved": "https://registry.npmjs.org/@nuxt/opencollective/-/opencollective-0.3.0.tgz",
"integrity": "sha512-Vf09BxCdj1iT2IRqVwX5snaY2WCTkvM0O4cWWSO1ThCFuc4if0Q/nNwAgCxRU0FeYHJ7DdyMUNSdswCLKlVqeg==",
"requires": {
"chalk": "^2.4.2",
"consola": "^2.10.1",
"node-fetch": "^2.6.0"
}
},
"@trevoreyre/autocomplete-vue": { "@trevoreyre/autocomplete-vue": {
"version": "2.0.3", "version": "2.1.0",
"resolved": "https://registry.npmjs.org/@trevoreyre/autocomplete-vue/-/autocomplete-vue-2.0.3.tgz", "resolved": "https://registry.npmjs.org/@trevoreyre/autocomplete-vue/-/autocomplete-vue-2.1.0.tgz",
"integrity": "sha512-8P0aaNQ7FV56QinQo08OdT9WJtVaaC/elNqM0Mg/ich6kbxO2Y0NQtAP//jQM9Z6j1NXq/UVI1o+Xl97nSGt0g==" "integrity": "sha512-N3qShgDwNgoHsvQ1X4iF2aKJ8vhGMz+xzmQbKCALu1PY4M827l5r62vcE7Gp/CyVeYumeFwC5OfVJyozDfkjLg=="
}, },
"@types/events": { "@types/events": {
"version": "3.0.0", "version": "3.0.0",
@ -1372,9 +1382,9 @@
"integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=" "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg="
}, },
"aws4": { "aws4": {
"version": "1.9.0", "version": "1.9.1",
"resolved": "https://registry.npmjs.org/aws4/-/aws4-1.9.0.tgz", "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.9.1.tgz",
"integrity": "sha512-Uvq6hVe90D0B2WEnUqtdgY1bATGz3mw33nH9Y+dmA+w5DHvUmBgkr5rM/KCHpCsiFNRUfokW/szpPPgMK2hm4A==" "integrity": "sha512-wMHVg2EOHaMRxbzgFJ9gtjOOCrI80OHLG14rxi28XwOW8ux6IiEbRCGGGqCtdAIg4FQCbW20k9RsT4y3gJlFug=="
}, },
"axios": { "axios": {
"version": "0.18.1", "version": "0.18.1",
@ -1636,37 +1646,20 @@
"integrity": "sha1-aN/1++YMUes3cl6p4+0xDcwed24=" "integrity": "sha1-aN/1++YMUes3cl6p4+0xDcwed24="
}, },
"bootstrap": { "bootstrap": {
"version": "4.4.0", "version": "4.4.1",
"resolved": "https://registry.npmjs.org/bootstrap/-/bootstrap-4.4.0.tgz", "resolved": "https://registry.npmjs.org/bootstrap/-/bootstrap-4.4.1.tgz",
"integrity": "sha512-dqCYJNs/Fxa3IVQ+v/lC694POCThUjZsA4wwqs8l+yk67B6ww2Ki++WaM6CVGe5+tArBBrknzjjh01/NT5rLjA==" "integrity": "sha512-tbx5cHubwE6e2ZG7nqM3g/FZ5PQEDMWmMGNrCUBVRPHXTJaH7CBDdsLeu3eCh3B1tzAxTnAbtmrzvWEvT2NNEA=="
}, },
"bootstrap-vue": { "bootstrap-vue": {
"version": "2.1.0", "version": "2.4.1",
"resolved": "https://registry.npmjs.org/bootstrap-vue/-/bootstrap-vue-2.1.0.tgz", "resolved": "https://registry.npmjs.org/bootstrap-vue/-/bootstrap-vue-2.4.1.tgz",
"integrity": "sha512-dftb5fc42x7QLv814nN+3Cx8MMuCB+xrGQjOmSXH81ET0+yo7KYb4lUN3/pOnf+8Tkv8oaawZ1OOth5/AZfktg==", "integrity": "sha512-EMSCcBPhrd+zjbTp8cmVUPn/5jYE+SQbbvQR1PpthujYyxxltSEsBFXF/XNfKouPdvRy8rVgc/KgThQ+YouRZA==",
"requires": { "requires": {
"@nuxt/opencollective": "^0.3.0", "@nuxt/opencollective": "^0.3.0",
"bootstrap": ">=4.3.1 <5.0.0", "bootstrap": ">=4.4.1 <5.0.0",
"popper.js": "^1.16.0", "popper.js": "^1.16.1",
"portal-vue": "^2.1.6", "portal-vue": "^2.1.7",
"vue-functional-data-merge": "^3.1.0" "vue-functional-data-merge": "^3.1.0"
},
"dependencies": {
"@nuxt/opencollective": {
"version": "0.3.0",
"resolved": "https://registry.npmjs.org/@nuxt/opencollective/-/opencollective-0.3.0.tgz",
"integrity": "sha512-Vf09BxCdj1iT2IRqVwX5snaY2WCTkvM0O4cWWSO1ThCFuc4if0Q/nNwAgCxRU0FeYHJ7DdyMUNSdswCLKlVqeg==",
"requires": {
"chalk": "^2.4.2",
"consola": "^2.10.1",
"node-fetch": "^2.6.0"
}
},
"node-fetch": {
"version": "2.6.0",
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.0.tgz",
"integrity": "sha512-8dG4H5ujfvFiqDmVu9fQ5bOHUC15JMjMY/Zumv26oOvvVJjM67KF8koCWIabKQ1GJIa9r2mMZscBq/TbdOcmNA=="
}
} }
}, },
"brace-expansion": { "brace-expansion": {
@ -1906,7 +1899,7 @@
}, },
"camelcase-keys": { "camelcase-keys": {
"version": "2.1.0", "version": "2.1.0",
"resolved": "http://registry.npmjs.org/camelcase-keys/-/camelcase-keys-2.1.0.tgz", "resolved": "https://registry.npmjs.org/camelcase-keys/-/camelcase-keys-2.1.0.tgz",
"integrity": "sha1-MIvur/3ygRkFHvodkyITyRuPkuc=", "integrity": "sha1-MIvur/3ygRkFHvodkyITyRuPkuc=",
"requires": { "requires": {
"camelcase": "^2.0.0", "camelcase": "^2.0.0",
@ -2222,9 +2215,9 @@
"integrity": "sha512-e54B99q/OUoH64zYYRf3HBP5z24G38h5D3qXu23JGRoigpX5Ss4r9ZnDk3g0Z8uQC2x2lPaJ+UlWBc1ZWBWdLg==" "integrity": "sha512-e54B99q/OUoH64zYYRf3HBP5z24G38h5D3qXu23JGRoigpX5Ss4r9ZnDk3g0Z8uQC2x2lPaJ+UlWBc1ZWBWdLg=="
}, },
"consola": { "consola": {
"version": "2.11.0", "version": "2.11.3",
"resolved": "https://registry.npmjs.org/consola/-/consola-2.11.0.tgz", "resolved": "https://registry.npmjs.org/consola/-/consola-2.11.3.tgz",
"integrity": "sha512-2bcAqHastlPSCvZ+ur8bgHInGAWvUnysWz3h3xRX+/XZoCY7avolJJnVXOPGoVoyCcg1b231XixonoArmgxaoA==" "integrity": "sha512-aoW0YIIAmeftGR8GSpw6CGQluNdkWMWh3yEFjH/hmynTYnMtibXszii3lxCXmk8YxJtI3FAK5aTiquA5VH68Gw=="
}, },
"console-browserify": { "console-browserify": {
"version": "1.2.0", "version": "1.2.0",
@ -4187,7 +4180,7 @@
}, },
"string-width": { "string-width": {
"version": "1.0.2", "version": "1.0.2",
"resolved": "http://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz",
"integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=",
"requires": { "requires": {
"code-point-at": "^1.0.0", "code-point-at": "^1.0.0",
@ -4349,12 +4342,12 @@
} }
}, },
"globule": { "globule": {
"version": "1.2.1", "version": "1.3.1",
"resolved": "https://registry.npmjs.org/globule/-/globule-1.2.1.tgz", "resolved": "https://registry.npmjs.org/globule/-/globule-1.3.1.tgz",
"integrity": "sha512-g7QtgWF4uYSL5/dn71WxubOrS7JVGCnFPEnoeChJmBnyR9Mw8nGoEwOgJL/RC2Te0WhbsEUCejfH8SZNJ+adYQ==", "integrity": "sha512-OVyWOHgw29yosRHCHo7NncwR1hW5ew0W/UrvtwvjefVJeQ26q4/8r8FmPsSF1hJ93IgWkyv16pCTz6WblMzm/g==",
"requires": { "requires": {
"glob": "~7.1.1", "glob": "~7.1.1",
"lodash": "~4.17.10", "lodash": "~4.17.12",
"minimatch": "~3.0.2" "minimatch": "~3.0.2"
} }
}, },
@ -4504,9 +4497,9 @@
"integrity": "sha512-kssjab8CvdXfcXMXVcvsXum4Hwdq9XGtRD3TteMEvEbq0LXyiNQr6AprqKqfeaDXze7SxWvRxdpwE6ku7ikLkg==" "integrity": "sha512-kssjab8CvdXfcXMXVcvsXum4Hwdq9XGtRD3TteMEvEbq0LXyiNQr6AprqKqfeaDXze7SxWvRxdpwE6ku7ikLkg=="
}, },
"howler": { "howler": {
"version": "2.1.2", "version": "2.1.3",
"resolved": "https://registry.npmjs.org/howler/-/howler-2.1.2.tgz", "resolved": "https://registry.npmjs.org/howler/-/howler-2.1.3.tgz",
"integrity": "sha512-oKrTFaVXsDRoB/jik7cEpWKTj7VieoiuzMYJ7E/EU5ayvmpRhumCv3YQ3823zi9VTJkSWAhbryHnlZAionGAJg==" "integrity": "sha512-PSGbOi1EYgw80C5UQbxtJM7TmzD+giJunIMBYyH3RVzHZx2fZLYBoes0SpVVHi/SFa1GoNtgXj/j6I7NOKYBxQ=="
}, },
"hpack.js": { "hpack.js": {
"version": "2.1.6", "version": "2.1.6",
@ -4951,12 +4944,9 @@
"integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=" "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI="
}, },
"is-finite": { "is-finite": {
"version": "1.0.2", "version": "1.1.0",
"resolved": "https://registry.npmjs.org/is-finite/-/is-finite-1.0.2.tgz", "resolved": "https://registry.npmjs.org/is-finite/-/is-finite-1.1.0.tgz",
"integrity": "sha1-zGZ3aVYCvlUO8R6LSqYwU0K20Ko=", "integrity": "sha512-cdyMtqX/BOqqNBBiKlIVkytNHm49MtMlYyn1zxzvJKWmFMlGzm+ry5BBfYyeY9YmNKbRSo/o7OX9w9ale0wg3w=="
"requires": {
"number-is-nan": "^1.0.0"
}
}, },
"is-fullwidth-code-point": { "is-fullwidth-code-point": {
"version": "2.0.0", "version": "2.0.0",
@ -5103,9 +5093,9 @@
"integrity": "sha512-36+AdBzCL+y6qjw5Tx7HgzeGCzC81MDDgaUP8ld2zhx58HdqXGoBd+tHdrBMiyjGQs0Hxs/MLZTu/eHNJJuWPw==" "integrity": "sha512-36+AdBzCL+y6qjw5Tx7HgzeGCzC81MDDgaUP8ld2zhx58HdqXGoBd+tHdrBMiyjGQs0Hxs/MLZTu/eHNJJuWPw=="
}, },
"js-base64": { "js-base64": {
"version": "2.5.1", "version": "2.5.2",
"resolved": "https://registry.npmjs.org/js-base64/-/js-base64-2.5.1.tgz", "resolved": "https://registry.npmjs.org/js-base64/-/js-base64-2.5.2.tgz",
"integrity": "sha512-M7kLczedRMYX4L8Mdh4MzyAMM9O5osx+4FcOQuTvr3A9F2D9S5JXheN0ewNbrvK2UatkTRhL5ejGmGSjNMiZuw==" "integrity": "sha512-Vg8czh0Q7sFBSUMWWArX/miJeBWYBPpdU/3M/DKSaekLMqrqVPaedp+5mZhie/r0lgrcaYBfwXatEew6gwgiQQ=="
}, },
"js-levenshtein": { "js-levenshtein": {
"version": "1.1.6", "version": "1.1.6",
@ -5271,7 +5261,7 @@
}, },
"load-json-file": { "load-json-file": {
"version": "1.1.0", "version": "1.1.0",
"resolved": "http://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz", "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz",
"integrity": "sha1-lWkFcI1YtLq0wiYbBPWfMcmTdMA=", "integrity": "sha1-lWkFcI1YtLq0wiYbBPWfMcmTdMA=",
"requires": { "requires": {
"graceful-fs": "^4.1.2", "graceful-fs": "^4.1.2",
@ -5291,7 +5281,7 @@
}, },
"pify": { "pify": {
"version": "2.3.0", "version": "2.3.0",
"resolved": "http://registry.npmjs.org/pify/-/pify-2.3.0.tgz", "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz",
"integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=" "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw="
} }
} }
@ -5554,7 +5544,7 @@
}, },
"meow": { "meow": {
"version": "3.7.0", "version": "3.7.0",
"resolved": "http://registry.npmjs.org/meow/-/meow-3.7.0.tgz", "resolved": "https://registry.npmjs.org/meow/-/meow-3.7.0.tgz",
"integrity": "sha1-cstmi0JSKCkKu/qFaJJYcwioAfs=", "integrity": "sha1-cstmi0JSKCkKu/qFaJJYcwioAfs=",
"requires": { "requires": {
"camelcase-keys": "^2.0.0", "camelcase-keys": "^2.0.0",
@ -5789,6 +5779,11 @@
"lower-case": "^1.1.1" "lower-case": "^1.1.1"
} }
}, },
"node-fetch": {
"version": "2.6.0",
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.0.tgz",
"integrity": "sha512-8dG4H5ujfvFiqDmVu9fQ5bOHUC15JMjMY/Zumv26oOvvVJjM67KF8koCWIabKQ1GJIa9r2mMZscBq/TbdOcmNA=="
},
"node-forge": { "node-forge": {
"version": "0.9.0", "version": "0.9.0",
"resolved": "https://registry.npmjs.org/node-forge/-/node-forge-0.9.0.tgz", "resolved": "https://registry.npmjs.org/node-forge/-/node-forge-0.9.0.tgz",
@ -5815,7 +5810,7 @@
"dependencies": { "dependencies": {
"semver": { "semver": {
"version": "5.3.0", "version": "5.3.0",
"resolved": "http://registry.npmjs.org/semver/-/semver-5.3.0.tgz", "resolved": "https://registry.npmjs.org/semver/-/semver-5.3.0.tgz",
"integrity": "sha1-myzl094C0XxgEq0yaqa00M9U+U8=" "integrity": "sha1-myzl094C0XxgEq0yaqa00M9U+U8="
} }
} }
@ -5878,9 +5873,9 @@
} }
}, },
"node-sass": { "node-sass": {
"version": "4.13.0", "version": "4.13.1",
"resolved": "https://registry.npmjs.org/node-sass/-/node-sass-4.13.0.tgz", "resolved": "https://registry.npmjs.org/node-sass/-/node-sass-4.13.1.tgz",
"integrity": "sha512-W1XBrvoJ1dy7VsvTAS5q1V45lREbTlZQqFbiHb3R3OTTCma0XBtuG6xZ6Z4506nR4lmHPTqVRwxT6KgtWC97CA==", "integrity": "sha512-TTWFx+ZhyDx1Biiez2nB0L3YrCZ/8oHagaDalbuBSlqXgUPsdkUSzJsVxeDO9LtPB49+Fh3WQl3slABo6AotNw==",
"requires": { "requires": {
"async-foreach": "^0.1.3", "async-foreach": "^0.1.3",
"chalk": "^1.1.1", "chalk": "^1.1.1",
@ -5908,7 +5903,7 @@
}, },
"chalk": { "chalk": {
"version": "1.1.3", "version": "1.1.3",
"resolved": "http://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz",
"integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=",
"requires": { "requires": {
"ansi-styles": "^2.2.1", "ansi-styles": "^2.2.1",
@ -5938,7 +5933,7 @@
}, },
"supports-color": { "supports-color": {
"version": "2.0.0", "version": "2.0.0",
"resolved": "http://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz",
"integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=" "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc="
}, },
"yallist": { "yallist": {
@ -6186,7 +6181,7 @@
}, },
"os-homedir": { "os-homedir": {
"version": "1.0.2", "version": "1.0.2",
"resolved": "http://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz",
"integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=" "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M="
}, },
"os-locale": { "os-locale": {
@ -6431,14 +6426,14 @@
} }
}, },
"popper.js": { "popper.js": {
"version": "1.16.0", "version": "1.16.1",
"resolved": "https://registry.npmjs.org/popper.js/-/popper.js-1.16.0.tgz", "resolved": "https://registry.npmjs.org/popper.js/-/popper.js-1.16.1.tgz",
"integrity": "sha512-+G+EkOPoE5S/zChTpmBSSDYmhXJ5PsW8eMhH8cP/CQHMFPBG/kC9Y5IIw6qNYgdJ+/COf0ddY2li28iHaZRSjw==" "integrity": "sha512-Wb4p1J4zyFTbM+u6WuO4XstYx4Ky9Cewe4DWrel7B0w6VVICvPwdOpotjzcf6eD8TsckVnIMNONQyPIUFOUbCQ=="
}, },
"portal-vue": { "portal-vue": {
"version": "2.1.6", "version": "2.1.7",
"resolved": "https://registry.npmjs.org/portal-vue/-/portal-vue-2.1.6.tgz", "resolved": "https://registry.npmjs.org/portal-vue/-/portal-vue-2.1.7.tgz",
"integrity": "sha512-lvCF85D4e8whd0nN32D8FqKwwkk7nYUI3Ku8UAEx4Z1reomu75dv5evRUTZNaj1EalxxWNXiNl0EHRq36fG8WA==" "integrity": "sha512-+yCno2oB3xA7irTt0EU5Ezw22L2J51uKAacE/6hMPMoO/mx3h4rXFkkBkT4GFsMDv/vEe8TNKC3ujJJ0PTwb6g=="
}, },
"portfinder": { "portfinder": {
"version": "1.0.25", "version": "1.0.25",
@ -7102,9 +7097,9 @@
"integrity": "sha1-8FKijacOYYkX7wqKw0wa5aaChrM=" "integrity": "sha1-8FKijacOYYkX7wqKw0wa5aaChrM="
}, },
"psl": { "psl": {
"version": "1.4.0", "version": "1.7.0",
"resolved": "https://registry.npmjs.org/psl/-/psl-1.4.0.tgz", "resolved": "https://registry.npmjs.org/psl/-/psl-1.7.0.tgz",
"integrity": "sha512-HZzqCGPecFLyoRj5HLfuDSKYTJkAfB5thKBIkRHtGjWwY7p1dAyveIbXIq4tO0KYfDF2tHqPUgY9SDnGm00uFw==" "integrity": "sha512-5NsSEDv8zY70ScRnOTn7bK7eanl2MvFrOrS/R6x+dBt5g1ghnj9Zv90kO8GwT8gxcu2ANyFprnFYB85IogIJOQ=="
}, },
"public-encrypt": { "public-encrypt": {
"version": "4.0.3", "version": "4.0.3",
@ -7279,7 +7274,7 @@
}, },
"pify": { "pify": {
"version": "2.3.0", "version": "2.3.0",
"resolved": "http://registry.npmjs.org/pify/-/pify-2.3.0.tgz", "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz",
"integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=" "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw="
} }
} }
@ -7474,9 +7469,9 @@
"integrity": "sha1-3mMSg3P8v3w8z6TeWkgMRaZ5WOs=" "integrity": "sha1-3mMSg3P8v3w8z6TeWkgMRaZ5WOs="
}, },
"request": { "request": {
"version": "2.88.0", "version": "2.88.2",
"resolved": "https://registry.npmjs.org/request/-/request-2.88.0.tgz", "resolved": "https://registry.npmjs.org/request/-/request-2.88.2.tgz",
"integrity": "sha512-NAqBSrijGLZdM0WZNsInLJpkJokL72XYjUpnB0iwsRgxh7dB6COrHnTBNwN0E+lHDAJzu7kLAkDeY08z2/A0hg==", "integrity": "sha512-MsvtOrfG9ZcrOwAW+Qi+F6HbD0CWXEh9ou77uOb7FM2WPhwT7smM833PzanhJLsgXjN89Ir6V2PczXNnMpwKhw==",
"requires": { "requires": {
"aws-sign2": "~0.7.0", "aws-sign2": "~0.7.0",
"aws4": "^1.8.0", "aws4": "^1.8.0",
@ -7485,7 +7480,7 @@
"extend": "~3.0.2", "extend": "~3.0.2",
"forever-agent": "~0.6.1", "forever-agent": "~0.6.1",
"form-data": "~2.3.2", "form-data": "~2.3.2",
"har-validator": "~5.1.0", "har-validator": "~5.1.3",
"http-signature": "~1.2.0", "http-signature": "~1.2.0",
"is-typedarray": "~1.0.0", "is-typedarray": "~1.0.0",
"isstream": "~0.1.2", "isstream": "~0.1.2",
@ -7495,7 +7490,7 @@
"performance-now": "^2.1.0", "performance-now": "^2.1.0",
"qs": "~6.5.2", "qs": "~6.5.2",
"safe-buffer": "^5.1.2", "safe-buffer": "^5.1.2",
"tough-cookie": "~2.4.3", "tough-cookie": "~2.5.0",
"tunnel-agent": "^0.6.0", "tunnel-agent": "^0.6.0",
"uuid": "^3.3.2" "uuid": "^3.3.2"
}, },
@ -7682,9 +7677,9 @@
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
}, },
"sass": { "sass": {
"version": "1.23.7", "version": "1.25.0",
"resolved": "https://registry.npmjs.org/sass/-/sass-1.23.7.tgz", "resolved": "https://registry.npmjs.org/sass/-/sass-1.25.0.tgz",
"integrity": "sha512-cYgc0fanwIpi0rXisGxl+/wadVQ/HX3RhpdRcjLdj2o2ye/sxUTpAxIhbmJy3PLQgRFbf6Pn8Jsrta2vdXcoOQ==", "integrity": "sha512-uQMjye0Y70SEDGO56n0j91tauqS9E1BmpKHtiYNQScXDHeaE9uHwNEqQNFf4Bes/3DHMNinB6u79JsG10XWNyw==",
"dev": true, "dev": true,
"requires": { "requires": {
"chokidar": ">=2.0.0 <4.0.0" "chokidar": ">=2.0.0 <4.0.0"
@ -7744,7 +7739,7 @@
}, },
"os-locale": { "os-locale": {
"version": "1.4.0", "version": "1.4.0",
"resolved": "http://registry.npmjs.org/os-locale/-/os-locale-1.4.0.tgz", "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-1.4.0.tgz",
"integrity": "sha1-IPnxeuKe00XoveWDsT0gCYA8FNk=", "integrity": "sha1-IPnxeuKe00XoveWDsT0gCYA8FNk=",
"requires": { "requires": {
"lcid": "^1.0.0" "lcid": "^1.0.0"
@ -7757,7 +7752,7 @@
}, },
"string-width": { "string-width": {
"version": "1.0.2", "version": "1.0.2",
"resolved": "http://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz",
"integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=",
"requires": { "requires": {
"code-point-at": "^1.0.0", "code-point-at": "^1.0.0",
@ -7860,7 +7855,7 @@
"dependencies": { "dependencies": {
"source-map": { "source-map": {
"version": "0.4.4", "version": "0.4.4",
"resolved": "http://registry.npmjs.org/source-map/-/source-map-0.4.4.tgz", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.4.4.tgz",
"integrity": "sha1-66T12pwNyZneaAMti092FzZSA2s=", "integrity": "sha1-66T12pwNyZneaAMti092FzZSA2s=",
"requires": { "requires": {
"amdefine": ">=0.0.4" "amdefine": ">=0.0.4"
@ -8816,13 +8811,25 @@
"integrity": "sha512-yaOH/Pk/VEhBWWTlhI+qXxDFXlejDGcQipMlyxda9nthulaxLZUNcUqFxokp0vcYnvteJln5FNQDRrxj3YcbVw==" "integrity": "sha512-yaOH/Pk/VEhBWWTlhI+qXxDFXlejDGcQipMlyxda9nthulaxLZUNcUqFxokp0vcYnvteJln5FNQDRrxj3YcbVw=="
}, },
"tough-cookie": { "tough-cookie": {
"version": "2.4.3", "version": "2.5.0",
"resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.4.3.tgz", "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.5.0.tgz",
"integrity": "sha512-Q5srk/4vDM54WJsJio3XNn6K2sCG+CQ8G5Wz6bZhRZoAe/+TxjWB/GlFAnYEbkYVlON9FMk/fE3h2RLpPXo4lQ==", "integrity": "sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g==",
"requires": { "requires": {
"psl": "^1.1.24", "psl": "^1.1.28",
"punycode": "^1.4.1" "punycode": "^2.1.1"
},
"dependencies": {
"punycode": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz",
"integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A=="
} }
}
},
"tributejs": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/tributejs/-/tributejs-4.1.1.tgz",
"integrity": "sha512-jc+PcaiNzMjCn2LAQb3i4ic94EsSfLW8Jlk1sK2cb6hLcZFalU9ThcF8rxuKkTUKv1GIvTwN8XseLzCXLxB4lw=="
}, },
"trim-newlines": { "trim-newlines": {
"version": "1.0.0", "version": "1.0.0",
@ -9149,9 +9156,9 @@
"integrity": "sha512-2ham8XPWTONajOR0ohOKOHXkm3+gaBmGut3SRuu75xLd/RRaY6vqgh8NBYYk7+RW3u5AtzPQZG8F10LHkl0lAQ==" "integrity": "sha512-2ham8XPWTONajOR0ohOKOHXkm3+gaBmGut3SRuu75xLd/RRaY6vqgh8NBYYk7+RW3u5AtzPQZG8F10LHkl0lAQ=="
}, },
"vue": { "vue": {
"version": "2.6.10", "version": "2.6.11",
"resolved": "https://registry.npmjs.org/vue/-/vue-2.6.10.tgz", "resolved": "https://registry.npmjs.org/vue/-/vue-2.6.11.tgz",
"integrity": "sha512-ImThpeNU9HbdZL3utgMCq0oiMzAkt1mcgy3/E6zWC/G6AaQoeuFdsl9nDhTDU3X1R6FK7nsIUuRACVcjI+A2GQ==" "integrity": "sha512-VfPwgcGABbGAue9+sfrD4PuwFar7gPb1yl1UK1MwXoQPAw0BKSqWfoYCT/ThFrdEVWoI51dBuyCoiNU9bZDZxQ=="
}, },
"vue-carousel": { "vue-carousel": {
"version": "0.18.0", "version": "0.18.0",
@ -9234,9 +9241,9 @@
} }
}, },
"vue-template-compiler": { "vue-template-compiler": {
"version": "2.6.10", "version": "2.6.11",
"resolved": "https://registry.npmjs.org/vue-template-compiler/-/vue-template-compiler-2.6.10.tgz", "resolved": "https://registry.npmjs.org/vue-template-compiler/-/vue-template-compiler-2.6.11.tgz",
"integrity": "sha512-jVZkw4/I/HT5ZMvRnhv78okGusqe0+qH2A0Em0Cp8aq78+NK9TII263CDVz2QXZsIT+yyV/gZc/j/vlwa+Epyg==", "integrity": "sha512-KIq15bvQDrcCjpGjrAhx4mUlyyHfdmTaoNfeoATHLAiWB+MU3cx4lOzMwrnUh9cCxy0Lt1T11hAFY6TQgroUAA==",
"dev": true, "dev": true,
"requires": { "requires": {
"de-indent": "^1.0.2", "de-indent": "^1.0.2",
@ -9256,6 +9263,11 @@
"date-fns": "^1.29.0" "date-fns": "^1.29.0"
} }
}, },
"vue-tribute": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/vue-tribute/-/vue-tribute-1.0.4.tgz",
"integrity": "sha512-wkvmBxpXWdWCHsyiTMObRenRwbsYqe30avvM7sD4gocEY8eYKGT4J17Z8RMUwrTNckUmwsZXvBzA/q8wh/eBeA=="
},
"watchpack": { "watchpack": {
"version": "1.6.0", "version": "1.6.0",
"resolved": "https://registry.npmjs.org/watchpack/-/watchpack-1.6.0.tgz", "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-1.6.0.tgz",
@ -9813,9 +9825,9 @@
} }
}, },
"zuck.js": { "zuck.js": {
"version": "1.5.4", "version": "1.5.6",
"resolved": "https://registry.npmjs.org/zuck.js/-/zuck.js-1.5.4.tgz", "resolved": "https://registry.npmjs.org/zuck.js/-/zuck.js-1.5.6.tgz",
"integrity": "sha512-vCNaP+mLHzslUJrIj3FakFfno9wKWJatlTKYCW7EjxN4xkodfEIcm5QrE+J9UdPSTn9TTaXrDRgaJZeG3Er7HA==" "integrity": "sha512-/nzdLWt8qTsw+qin90vUTQ4hVmzARYn1esiDXY8oBUXJ2PFdZms0qDn6JVFkIgZp5rLBrDcsZUum3o6pneI3YQ=="
} }
} }
} }

View file

@ -12,31 +12,32 @@
}, },
"devDependencies": { "devDependencies": {
"axios": "^0.18.1", "axios": "^0.18.1",
"bootstrap": ">=4.4.0", "bootstrap": "^4.4.1",
"cross-env": "^5.2.1", "cross-env": "^5.2.1",
"jquery": "^3.4.1", "jquery": "^3.4.1",
"lodash": ">=4.17.13", "lodash": ">=4.17.13",
"popper.js": "^1.16.0", "popper.js": "^1.16.1",
"resolve-url-loader": "^2.3.2", "resolve-url-loader": "^2.3.2",
"sass": "^1.23.7", "sass": "^1.25.0",
"sass-loader": "^7.3.1", "sass-loader": "^7.3.1",
"vue": "^2.6.10", "vue": "^2.6.11",
"vue-masonry-css": "^1.0.3", "vue-masonry-css": "^1.0.3",
"vue-template-compiler": "^2.6.10" "vue-template-compiler": "^2.6.11"
}, },
"dependencies": { "dependencies": {
"@trevoreyre/autocomplete-vue": "^2.0.3", "@trevoreyre/autocomplete-vue": "^2.1.0",
"bootstrap-vue": "^2.1.0", "bootstrap-vue": "^2.4.1",
"filesize": "^3.6.1", "filesize": "^3.6.1",
"howler": "^2.1.2", "howler": "^2.1.3",
"infinite-scroll": "^3.0.6", "infinite-scroll": "^3.0.6",
"laravel-echo": "^1.6.1", "laravel-echo": "^1.6.1",
"laravel-mix": "^4.1.4", "laravel-mix": "^4.1.4",
"node-sass": "^4.13.0", "node-sass": "^4.13.1",
"promise-polyfill": "8.1.0", "promise-polyfill": "8.1.0",
"quill": "^1.3.7", "quill": "^1.3.7",
"readmore-js": "^2.2.1", "readmore-js": "^2.2.1",
"sweetalert": "^2.1.2", "sweetalert": "^2.1.2",
"tributejs": "^4.1.1",
"twitter-text": "^2.0.5", "twitter-text": "^2.0.5",
"vue-carousel": "^0.18.0", "vue-carousel": "^0.18.0",
"vue-content-loader": "^0.2.2", "vue-content-loader": "^0.2.2",
@ -44,7 +45,8 @@
"vue-infinite-loading": "^2.4.4", "vue-infinite-loading": "^2.4.4",
"vue-loading-overlay": "^3.2.0", "vue-loading-overlay": "^3.2.0",
"vue-timeago": "^5.1.2", "vue-timeago": "^5.1.2",
"zuck.js": "^1.5.4" "vue-tribute": "^1.0.4",
"zuck.js": "^1.5.6"
}, },
"collective": { "collective": {
"type": "opencollective", "type": "opencollective",

BIN
public/css/app.css vendored

Binary file not shown.

BIN
public/css/appdark.css vendored

Binary file not shown.

BIN
public/css/landing.css vendored

Binary file not shown.

Binary file not shown.

BIN
public/js/compose.js vendored

Binary file not shown.

BIN
public/js/profile.js vendored

Binary file not shown.

BIN
public/js/status.js vendored

Binary file not shown.

BIN
public/js/timeline.js vendored

Binary file not shown.

BIN
public/js/vendor.js vendored

Binary file not shown.

Binary file not shown.

View file

@ -4,7 +4,7 @@
<div class="card notification-card shadow-none border"> <div class="card notification-card shadow-none border">
<div class="card-header bg-white"> <div class="card-header bg-white">
<p class="mb-0 d-flex align-items-center justify-content-between"> <p class="mb-0 d-flex align-items-center justify-content-between">
<span><i class="far fa-bell fa-lg text-white"></i></span> <span data-toggle="tooltip" data-placement="bottom"><i class="fas fa-redo fa-lg text-white"></i></span>
<span class="small text-dark text-uppercase font-weight-bold">Alerts</span> <span class="small text-dark text-uppercase font-weight-bold">Alerts</span>
<a class="text-decoration-none text-muted" href="/account/activity"><i class="fas fa-inbox fa-lg"></i></a> <a class="text-decoration-none text-muted" href="/account/activity"><i class="fas fa-inbox fa-lg"></i></a>
</p> </p>
@ -43,6 +43,11 @@
<a :href="n.account.url" class="font-weight-bold text-dark word-break" :title="n.account.username">{{truncate(n.account.username)}}</a> shared your <a class="font-weight-bold" v-bind:href="n.status.reblog.url">post</a>. <a :href="n.account.url" class="font-weight-bold text-dark word-break" :title="n.account.username">{{truncate(n.account.username)}}</a> shared your <a class="font-weight-bold" v-bind:href="n.status.reblog.url">post</a>.
</p> </p>
</div> </div>
<div v-else-if="n.type == 'modlog'">
<p class="my-0">
<a :href="n.account.url" class="font-weight-bold text-dark word-break" :title="n.account.username">{{truncate(n.account.username)}}</a> updated a <a class="font-weight-bold" v-bind:href="n.modlog.url">modlog</a>.
</p>
</div>
</div> </div>
<div class="small text-muted font-weight-bold" :title="n.created_at">{{timeAgo(n.created_at)}}</div> <div class="small text-muted font-weight-bold" :title="n.created_at">{{timeAgo(n.created_at)}}</div>
</div> </div>
@ -193,6 +198,32 @@
} }
}); });
}, interval); }, interval);
},
refreshNotifications() {
let self = this;
axios.get('/api/pixelfed/v1/notifications')
.then(res => {
let data = res.data.filter(n => {
if(n.type == 'share' || self.notificationMaxId >= n.id) {
return false;
}
return true;
});
if(data.length > 0) {
let ids = data.map(n => n.id);
let max = Math.max(ids);
if(max <= self.notificationMaxId) {
return;
} else {
self.notificationMaxId = max;
self.notifications = data;
let beep = new Audio('/static/beep.mp3');
beep.volume = 0.7;
beep.play();
}
}
});
} }
} }
} }

View file

@ -675,9 +675,9 @@ export default {
}, },
fetchData() { fetchData() {
let self = this;
axios.get('/api/v2/profile/'+this.statusUsername+'/status/'+this.statusId) axios.get('/api/v2/profile/'+this.statusUsername+'/status/'+this.statusId)
.then(response => { .then(response => {
let self = this;
self.status = response.data.status; self.status = response.data.status;
self.user = response.data.user; self.user = response.data.user;
window._sharedData.curUser = self.user; window._sharedData.curUser = self.user;
@ -696,15 +696,7 @@ export default {
this.loaded = true; this.loaded = true;
$('head title').text(this.status.account.username + ' posted a photo: ' + this.status.favourites_count + ' likes'); $('head title').text(this.status.account.username + ' posted a photo: ' + this.status.favourites_count + ' likes');
}).catch(error => { }).catch(error => {
if(!error.response) { swal('Oops!', 'An error occured, please try refreshing the page.', 'error');
} else {
switch(error.response.status) {
case 401:
break;
default:
break;
}
}
}); });
}, },