1
0
Fork 1
mirror of https://github.com/pixelfed/pixelfed.git synced 2024-12-26 01:36:43 +00:00

Merge pull request #665 from pixelfed/frontend-ui-refactor

Frontend ui refactor
This commit is contained in:
daniel 2018-12-23 19:10:40 -07:00 committed by GitHub
commit f6b5cce405
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 81 additions and 6 deletions

View file

@ -19,7 +19,7 @@ class Status extends Model
*/ */
protected $dates = ['deleted_at']; protected $dates = ['deleted_at'];
protected $fillable = ['profile_id', 'visibility', 'in_reply_to_id', 'reblog_of_id']; protected $fillable = ['profile_id', 'visibility', 'in_reply_to_id', 'reblog_of_id', 'type'];
const STATUS_TYPES = [ const STATUS_TYPES = [
'text', 'text',
@ -90,13 +90,13 @@ class Status extends Model
public function url() public function url()
{ {
if($this->url) { if($this->uri) {
return $this->url; return $this->uri;
} }
$id = $this->id; $id = $this->id;
$username = $this->profile->username; $username = $this->profile->username;
$path = config('app.url')."/p/{$username}/{$id}"; $path = url(config('app.url')."/p/{$username}/{$id}");
return url($path); return $path;
} }
public function permalink($suffix = '/activity') public function permalink($suffix = '/activity')

View file

@ -14,7 +14,7 @@ class CreateStoriesTable extends Migration
public function up() public function up()
{ {
Schema::create('stories', function (Blueprint $table) { Schema::create('stories', function (Blueprint $table) {
$table->increments('bigIncrements'); $table->bigIncrements('id');
$table->bigInteger('profile_id')->unsigned(); $table->bigInteger('profile_id')->unsigned();
$table->timestamp('published_at')->nullable(); $table->timestamp('published_at')->nullable();
$table->timestamp('expires_at')->nullable(); $table->timestamp('expires_at')->nullable();

View file

@ -0,0 +1,75 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddAccountStatusToProfilesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
// Drop old columns, fix stories
if(Schema::hasColumn('profiles', 'hub_url')) {
Schema::table('profiles', function (Blueprint $table) {
$table->dropColumn('verify_token');
$table->dropColumn('secret');
$table->dropColumn('salmon_url');
$table->dropColumn('hub_url');
});
}
if(Schema::hasColumn('stories', 'bigIncrements')) {
Schema::table('stories', function (Blueprint $table) {
$table->dropColumn('bigIncrements');
});
Schema::table('stories', function (Blueprint $table) {
$table->bigIncrements('id')->first();
});
}
// Add account status to profile and user tables
Schema::table('profiles', function (Blueprint $table) {
$table->string('status')->nullable()->index()->after('username');
});
Schema::table('users', function (Blueprint $table) {
$table->string('status')->nullable()->index()->after('email');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('profiles', function (Blueprint $table) {
$table->string('verify_token')->nullable();
$table->string('secret')->nullable();
$table->string('salmon_url')->nullable();
$table->string('hub_url')->nullable();
});
Schema::table('stories', function (Blueprint $table) {
$table->dropColumn('id');
});
Schema::table('stories', function (Blueprint $table) {
$table->bigIncrements('bigIncrements')->first();
});
Schema::table('profiles', function (Blueprint $table) {
$table->dropColumn('status');
});
Schema::table('users', function (Blueprint $table) {
$table->dropColumn('status');
});
}
}