New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Account standing section #2573

Merged
merged 54 commits into from Mar 9, 2018

Conversation

3 participants
@LiquidPL
Contributor

LiquidPL commented Feb 27, 2018

Resolves #2384.

Currently waiting for a response on the original issue about the restrict notice, otherwise it's done.

@LiquidPL LiquidPL changed the title from Infringements log to Account standing section Feb 27, 2018

public function scopeBans($query)
{
return $query->where('ban_status', '>', 0)->orderBy('timestamp', 'desc');
}
public function scopeExtended($query)

This comment has been minimized.

@nanaya

nanaya Mar 1, 2018

Collaborator

more like scopeRecent

public function scopeDefault($query)
{
return $query
->extended()

This comment has been minimized.

@nanaya

nanaya Mar 1, 2018

Collaborator

not needed (see below)

@@ -130,6 +131,22 @@ public function includeUserAchievements(User $user)
);
}
public function includeRecentInfringements(User $user)
{
$banHistories = $user->banHistories();

This comment has been minimized.

@nanaya

nanaya Mar 1, 2018

Collaborator
$... = ...->recent();

if (!priv_check ...) {
  $...->default();
}
@@ -130,6 +131,22 @@ public function includeUserAchievements(User $user)
);
}
public function includeRecentInfringements(User $user)

This comment has been minimized.

@nanaya

nanaya Mar 1, 2018

Collaborator

should match the model name (includeRecentBanHistory).

return [
'description' => $bh->reason,
'type' => $bh->ban_status,
'timestamp' => $bh->timestamp->toIso8601String(),

This comment has been minimized.

@nanaya

nanaya Mar 1, 2018

Collaborator

json_time

className: 'page-extra__title page-extra__title--small'
osu.trans 'users.show.extra.account_standing.recent_infringements.title'

div className: "#{bn}__table-scroll-container",

This comment has been minimized.

@nanaya

nanaya Mar 1, 2018

Collaborator

missing its block. Or more like it should be its own block.

This comment has been minimized.

@LiquidPL

LiquidPL Mar 2, 2018

Contributor

just this or entire table?

This comment has been minimized.

@nanaya

nanaya Mar 2, 2018

Collaborator

The alert thing above can probably be part of page-extra. And this one is a new block.

username: osu.link laroute.route('users.show', user: event.banner.id), event.banner.username


remaining: (event) ->

This comment has been minimized.

@nanaya

nanaya Mar 1, 2018

Collaborator

can probably be done using timeago.

.profile-extra-account-standing {
@_top: profile-extra-account-standing;

&__box {

This comment has been minimized.

@nanaya

nanaya Mar 1, 2018

Collaborator

all this box crap is confusing. The padding thing isn't helping either. Just use for the ones styled with that stadium-shaped thingy with negative margin (+make sure the column has enough padding).

else if event.type == 'note'
''
else
moment(event.timestamp).add(event.length, 'seconds').from(event.timestamp, true)

This comment has been minimized.

@nanaya

nanaya Mar 1, 2018

Collaborator

more like moment.duration(...).humanize()

className: "#{bn}__table-cell #{bn}__table-cell--date"
div
className: "#{bn}__box #{bn}__box--small"
time className: "timeago", dateTime: event.timestamp

This comment has been minimized.

@nanaya

nanaya Mar 1, 2018

Collaborator

missing content so the tooltip doesn't work.

@LiquidPL LiquidPL force-pushed the LiquidPL:infringements-log branch from 5894ff5 to 333279b Mar 2, 2018

@nanaya

Should be all unless I missed something else.


render: ->
latest = _.first @props.user.recent_ban_history
bans = _.partition @props.user.recent_ban_history, (d) -> d.type != 'note'

This comment has been minimized.

@nanaya

nanaya Mar 2, 2018

Collaborator

apparently they should be in single table in chronological order, not split 💃

className: 'page-extra__title page-extra__title--small'
osu.trans 'users.show.extra.account_standing.recent_infringements.title'

div className: "#{bn}__table-scroll-container",

This comment has been minimized.

@nanaya

nanaya Mar 2, 2018

Collaborator

The alert thing above can probably be part of page-extra. And this one is a new block.

public function user()
{
return $this->belongsTo(User::class, 'user_id', 'user_id');
}
public function banner()

This comment has been minimized.

@nanaya

nanaya Mar 2, 2018

Collaborator

after long discussion, this should be called actor instead.

@@ -20,6 +20,8 @@
namespace App\Models;
use Carbon\Carbon;
class UserBanHistory extends Model

This comment has been minimized.

@nanaya

nanaya Mar 2, 2018

Collaborator

UserAccountHistory instead~ (rename the ones in class as well including the relation)

@@ -28,18 +30,49 @@ class UserBanHistory extends Model
protected $dates = ['timestamp'];
public $timestamps = false;
const BAN_STATUSES = [

This comment has been minimized.

@nanaya

nanaya Mar 2, 2018

Collaborator

cover 0 as well? And call it type.

This comment has been minimized.

@LiquidPL

LiquidPL Mar 2, 2018

Contributor

what is 0 used for then? note?

This comment has been minimized.

@nanaya

nanaya Mar 7, 2018

Collaborator

just call it that for now

flex-direction: row;
align-items: center;

height: 20px;

This comment has been minimized.

@nanaya

nanaya Mar 2, 2018

Collaborator

Add 2px padding top/bottom instead (and remove the flex display). Make border-radius something like 2*side-padding so it stays stadium-shaped. Also for __alert.

@@ -84,6 +84,7 @@ class ProfilePage.Main extends React.PureComponent
$(@pages).sortable
cursor: 'move'
handle: '.js-profile-page-extra--sortable-handle'
items: '.js-sortable--page:not([data-page-id="account_standing"])'

This comment has been minimized.

@nanaya

nanaya Mar 2, 2018

Collaborator

add isSortablePage function and check that in the function/loop instead (also for tabs).

@@ -127,6 +129,12 @@ class ProfilePage.Main extends React.PureComponent
render: =>
withMePage = @state.userPage.initialRaw.trim() != '' || @props.withEdit

profileOrder =

This comment has been minimized.

@nanaya

nanaya Mar 2, 2018

Collaborator

creating clone in all cases and then adding account_standing as needed should be fine.

profileOrder = ....slice()
profileOrder.push('...') if ...
&__table-cell {
padding-bottom: 7px;

&--length :not(.@{_top}__box--restriction) {

This comment has been minimized.

@nanaya

nanaya Mar 2, 2018

Collaborator

Not used.

font-size: 14px;
}

&__table-body {

This comment has been minimized.

@nanaya

nanaya Mar 2, 2018

Collaborator

can be removed because there's only one table.

LiquidPL added some commits Mar 2, 2018

overflow-x: auto;

&__action {
height: 20px;

This comment has been minimized.

@nanaya

nanaya Mar 7, 2018

Collaborator

Doesn't quite align and should be just removed.

margin-left: -10px;
padding: 2px 10px;

line-height: 1em;

This comment has been minimized.

@nanaya

nanaya Mar 7, 2018

Collaborator

Remove this as well.

}

&__table-cell {
padding-bottom: 7px;

This comment has been minimized.

@nanaya

nanaya Mar 7, 2018

Collaborator

can use padding left and right (and negative margin for the table itself).

font-weight: 900;
text-transform: uppercase;

padding-bottom: 10px;

This comment has been minimized.

@nanaya

nanaya Mar 7, 2018

Collaborator

same with table-cell (or maybe just merge the element and add modifier as needed)

@@ -0,0 +1,24 @@
<?php

This comment has been minimized.

@nanaya

nanaya Mar 7, 2018

Collaborator

can use a file rename

'description' => $h->reason,
'type' => $h->type,
'timestamp' => json_time($h->timestamp),
'end_time' => json_time($h->endTime()),

This comment has been minimized.

@nanaya

nanaya Mar 7, 2018

Collaborator

(same as last time) not needed?

@@ -128,6 +128,8 @@ OSU_RUNNING_COST=
# BEATMAPSET_USER_WEEKLY_HYPE=3
# BEATMAPSET_USER_DAILY_NOMINATIONS=10

# BAN_PERSIST_DAYS=14

This comment has been minimized.

@nanaya

nanaya Mar 7, 2018

Collaborator

account history persist days

public function endTime()
{
return $this->timestamp->addSeconds($this->period);
}
public function getTypeAttribute()
{
$value = $this->ban_status;

This comment has been minimized.

@nanaya

nanaya Mar 7, 2018

Collaborator
return static::TYPES[$this->ban_status] ?? null;
dangerouslySetInnerHTML:
__html: osu.trans 'users.show.extra.account_standing.remaining_silence',
username: @props.user.username
duration: osu.timeago moment(latest.timestamp).add(latest.length, 'seconds').format()

This comment has been minimized.

@nanaya

nanaya Mar 7, 2018

Collaborator

this and the check are pretty much same moment object.

__html: osu.trans 'users.show.extra.account_standing.bad_standing',
username: @props.user.username

if latest? && moment(latest.end_time).isAfter(moment.now())

This comment has been minimized.

@nanaya

nanaya Mar 7, 2018

Collaborator

moment.now() is already the default for isAfter.

LiquidPL added some commits Mar 7, 2018

@nanaya

nanaya approved these changes Mar 9, 2018

nanaya added some commits Mar 9, 2018

@nanaya nanaya merged commit 4772e4d into ppy:master Mar 9, 2018

2 checks passed

continuous-integration/styleci/pr The StyleCI analysis has passed
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment