eslint —fix

This commit is contained in:
taehoon 2019-07-10 20:59:10 -04:00
parent 9712e324e5
commit b2dbf01a72
3 changed files with 423 additions and 191 deletions

View file

@ -1,85 +1,166 @@
<template> <template>
<div> <div>
<Popper <Popper
trigger="click" trigger="click"
@hide='showDropDown = false' append-to-body
append-to-body :options="{
:options="{ placement: 'bottom-end',
placement: 'bottom-end', modifiers: {
modifiers: { arrow: { enabled: true },
arrow: { enabled: true }, offset: { offset: '0, 5px' },
offset: { offset: '0, 5px' }, }
} }"
}"> @hide="showDropDown = false"
<div class="popper-wrapper"> >
<div class="dropdown-menu"> <div class="popper-wrapper">
<span v-if='user.is_local'> <div class="dropdown-menu">
<button class="dropdown-item" @click='toggleRight("admin")'> <span v-if="user.is_local">
{{ $t(!!user.rights.admin ? 'user_card.admin_menu.revoke_admin' : 'user_card.admin_menu.grant_admin') }} <button
class="dropdown-item"
@click="toggleRight(&quot;admin&quot;)"
>
{{ $t(!!user.rights.admin ? 'user_card.admin_menu.revoke_admin' : 'user_card.admin_menu.grant_admin') }}
</button>
<button
class="dropdown-item"
@click="toggleRight(&quot;moderator&quot;)"
>
{{ $t(!!user.rights.moderator ? 'user_card.admin_menu.revoke_moderator' : 'user_card.admin_menu.grant_moderator') }}
</button>
<div
role="separator"
class="dropdown-divider"
/>
</span>
<button
class="dropdown-item"
@click="toggleActivationStatus()"
>
{{ $t(!!user.deactivated ? 'user_card.admin_menu.activate_account' : 'user_card.admin_menu.deactivate_account') }}
</button> </button>
<button class="dropdown-item" @click='toggleRight("moderator")'> <button
{{ $t(!!user.rights.moderator ? 'user_card.admin_menu.revoke_moderator' : 'user_card.admin_menu.grant_moderator') }} class="dropdown-item"
@click="deleteUserDialog(true)"
>
{{ $t('user_card.admin_menu.delete_account') }}
</button> </button>
<div role="separator" class="dropdown-divider"></div> <div
</span> v-if="hasTagPolicy"
<button class="dropdown-item" @click='toggleActivationStatus()'> role="separator"
{{ $t(!!user.deactivated ? 'user_card.admin_menu.activate_account' : 'user_card.admin_menu.deactivate_account') }} class="dropdown-divider"
</button> />
<button class="dropdown-item" @click='deleteUserDialog(true)'> <span v-if="hasTagPolicy">
{{ $t('user_card.admin_menu.delete_account') }} <button
</button> class="dropdown-item"
<div role="separator" class="dropdown-divider" v-if='hasTagPolicy'></div> @click="toggleTag(tags.FORCE_NSFW)"
<span v-if='hasTagPolicy'> >
<button class="dropdown-item" @click='toggleTag(tags.FORCE_NSFW)'> {{ $t('user_card.admin_menu.force_nsfw') }}
{{ $t('user_card.admin_menu.force_nsfw') }} <span
<span class="menu-checkbox" v-bind:class="{ 'menu-checkbox-checked': hasTag(tags.FORCE_NSFW) }"></span> class="menu-checkbox"
</button> :class="{ 'menu-checkbox-checked': hasTag(tags.FORCE_NSFW) }"
<button class="dropdown-item" @click='toggleTag(tags.STRIP_MEDIA)'> />
{{ $t('user_card.admin_menu.strip_media') }} </button>
<span class="menu-checkbox" v-bind:class="{ 'menu-checkbox-checked': hasTag(tags.STRIP_MEDIA) }"></span> <button
</button> class="dropdown-item"
<button class="dropdown-item" @click='toggleTag(tags.FORCE_UNLISTED)'> @click="toggleTag(tags.STRIP_MEDIA)"
{{ $t('user_card.admin_menu.force_unlisted') }} >
<span class="menu-checkbox" v-bind:class="{ 'menu-checkbox-checked': hasTag(tags.FORCE_UNLISTED) }"></span> {{ $t('user_card.admin_menu.strip_media') }}
</button> <span
<button class="dropdown-item" @click='toggleTag(tags.SANDBOX)'> class="menu-checkbox"
{{ $t('user_card.admin_menu.sandbox') }} :class="{ 'menu-checkbox-checked': hasTag(tags.STRIP_MEDIA) }"
<span class="menu-checkbox" v-bind:class="{ 'menu-checkbox-checked': hasTag(tags.SANDBOX) }"></span> />
</button> </button>
<button class="dropdown-item" v-if='user.is_local' @click='toggleTag(tags.DISABLE_REMOTE_SUBSCRIPTION)'> <button
{{ $t('user_card.admin_menu.disable_remote_subscription') }} class="dropdown-item"
<span class="menu-checkbox" v-bind:class="{ 'menu-checkbox-checked': hasTag(tags.DISABLE_REMOTE_SUBSCRIPTION) }"></span> @click="toggleTag(tags.FORCE_UNLISTED)"
</button> >
<button class="dropdown-item" v-if='user.is_local' @click='toggleTag(tags.DISABLE_ANY_SUBSCRIPTION)'> {{ $t('user_card.admin_menu.force_unlisted') }}
{{ $t('user_card.admin_menu.disable_any_subscription') }} <span
<span class="menu-checkbox" v-bind:class="{ 'menu-checkbox-checked': hasTag(tags.DISABLE_ANY_SUBSCRIPTION) }"></span> class="menu-checkbox"
</button> :class="{ 'menu-checkbox-checked': hasTag(tags.FORCE_UNLISTED) }"
<button class="dropdown-item" v-if='user.is_local' @click='toggleTag(tags.QUARANTINE)'> />
{{ $t('user_card.admin_menu.quarantine') }} </button>
<span class="menu-checkbox" v-bind:class="{ 'menu-checkbox-checked': hasTag(tags.QUARANTINE) }"></span> <button
</button> class="dropdown-item"
</span> @click="toggleTag(tags.SANDBOX)"
>
{{ $t('user_card.admin_menu.sandbox') }}
<span
class="menu-checkbox"
:class="{ 'menu-checkbox-checked': hasTag(tags.SANDBOX) }"
/>
</button>
<button
v-if="user.is_local"
class="dropdown-item"
@click="toggleTag(tags.DISABLE_REMOTE_SUBSCRIPTION)"
>
{{ $t('user_card.admin_menu.disable_remote_subscription') }}
<span
class="menu-checkbox"
:class="{ 'menu-checkbox-checked': hasTag(tags.DISABLE_REMOTE_SUBSCRIPTION) }"
/>
</button>
<button
v-if="user.is_local"
class="dropdown-item"
@click="toggleTag(tags.DISABLE_ANY_SUBSCRIPTION)"
>
{{ $t('user_card.admin_menu.disable_any_subscription') }}
<span
class="menu-checkbox"
:class="{ 'menu-checkbox-checked': hasTag(tags.DISABLE_ANY_SUBSCRIPTION) }"
/>
</button>
<button
v-if="user.is_local"
class="dropdown-item"
@click="toggleTag(tags.QUARANTINE)"
>
{{ $t('user_card.admin_menu.quarantine') }}
<span
class="menu-checkbox"
:class="{ 'menu-checkbox-checked': hasTag(tags.QUARANTINE) }"
/>
</button>
</span>
</div>
</div> </div>
</div> <button
<button slot="reference" class="btn btn-default btn-block" v-bind:class="{ pressed: showDropDown }" @click='toggleMenu'> slot="reference"
{{ $t('user_card.admin_menu.moderation') }} class="btn btn-default btn-block"
</button> :class="{ pressed: showDropDown }"
</Popper> @click="toggleMenu"
<portal to="modal"> >
<DialogModal v-if="showDeleteUserDialog" :onCancel='deleteUserDialog.bind(this, false)'> {{ $t('user_card.admin_menu.moderation') }}
<template slot="header">{{ $t('user_card.admin_menu.delete_user') }}</template> </button>
<p>{{ $t('user_card.admin_menu.delete_user_confirmation') }}</p> </Popper>
<template slot="footer"> <portal to="modal">
<button class="btn btn-default" @click='deleteUserDialog(false)'> <DialogModal
{{ $t('general.cancel') }} v-if="showDeleteUserDialog"
</button> :on-cancel="deleteUserDialog.bind(this, false)"
<button class="btn btn-default danger" @click='deleteUser()'> >
<template slot="header">
{{ $t('user_card.admin_menu.delete_user') }} {{ $t('user_card.admin_menu.delete_user') }}
</button> </template>
</template> <p>{{ $t('user_card.admin_menu.delete_user_confirmation') }}</p>
</DialogModal> <template slot="footer">
</portal> <button
</div> class="btn btn-default"
@click="deleteUserDialog(false)"
>
{{ $t('general.cancel') }}
</button>
<button
class="btn btn-default danger"
@click="deleteUser()"
>
{{ $t('user_card.admin_menu.delete_user') }}
</button>
</template>
</DialogModal>
</portal>
</div>
</template> </template>
<script src="./moderation_tools.js"></script> <script src="./moderation_tools.js"></script>

View file

@ -1,5 +1,8 @@
<template> <template>
<button :disabled="progress || disabled" @click="onClick"> <button
:disabled="progress || disabled"
@click="onClick"
>
<template v-if="progress && $slots.progress"> <template v-if="progress && $slots.progress">
<slot name="progress" /> <slot name="progress" />
</template> </template>

View file

@ -1,131 +1,279 @@
<template> <template>
<div class="user-card" :class="classes" :style="style"> <div
<div class="panel-heading"> class="user-card"
<div class='user-info'> :class="classes"
<div class='container'> :style="style"
<router-link :to="userProfileLink(user)"> >
<UserAvatar :betterShadow="betterShadow" :user="user"/> <div class="panel-heading">
</router-link> <div class="user-info">
<div class="user-summary"> <div class="container">
<div class="top-line"> <router-link :to="userProfileLink(user)">
<div :title="user.name" class='user-name' v-if="user.name_html" v-html="user.name_html"></div> <UserAvatar
<div :title="user.name" class='user-name' v-else>{{user.name}}</div> :better-shadow="betterShadow"
<router-link :to="{ name: 'user-settings' }" v-if="!isOtherUser"> :user="user"
<i class="button-icon icon-wrench usersettings" :title="$t('tool_tip.user_settings')"></i> />
</router-link> </router-link>
<a :href="user.statusnet_profile_url" target="_blank" v-if="isOtherUser && !user.is_local"> <div class="user-summary">
<i class="icon-link-ext usersettings"></i> <div class="top-line">
</a> <!-- eslint-disable vue/no-v-html -->
</div> <div
v-if="user.name_html"
:title="user.name"
class="user-name"
v-html="user.name_html"
/>
<!-- eslint-enabled vue/no-v-html -->
<div
v-else
:title="user.name"
class="user-name"
>
{{ user.name }}
</div>
<router-link
v-if="!isOtherUser"
:to="{ name: 'user-settings' }"
>
<i
class="button-icon icon-wrench usersettings"
:title="$t('tool_tip.user_settings')"
/>
</router-link>
<a
v-if="isOtherUser && !user.is_local"
:href="user.statusnet_profile_url"
target="_blank"
>
<i class="icon-link-ext usersettings" />
</a>
</div>
<div class="bottom-line"> <div class="bottom-line">
<router-link class="user-screen-name" :to="userProfileLink(user)">@{{user.screen_name}}</router-link> <router-link
<span class="alert staff" v-if="!hideBio && !!visibleRole">{{visibleRole}}</span> class="user-screen-name"
<span v-if="user.locked"><i class="icon icon-lock"></i></span> :to="userProfileLink(user)"
<span v-if="!hideUserStatsLocal && !hideBio" class="dailyAvg">{{dailyAvg}} {{ $t('user_card.per_day') }}</span> >
@{{ user.screen_name }}
</router-link>
<span
v-if="!hideBio && !!visibleRole"
class="alert staff"
>{{ visibleRole }}</span>
<span v-if="user.locked"><i class="icon icon-lock" /></span>
<span
v-if="!hideUserStatsLocal && !hideBio"
class="dailyAvg"
>{{ dailyAvg }} {{ $t('user_card.per_day') }}</span>
</div>
</div> </div>
</div> </div>
</div> <div class="user-meta">
<div class="user-meta"> <div
<div v-if="user.follows_you && loggedIn && isOtherUser" class="following"> v-if="user.follows_you && loggedIn && isOtherUser"
{{ $t('user_card.follows_you') }} class="following"
>
{{ $t('user_card.follows_you') }}
</div>
<div
v-if="isOtherUser && (loggedIn || !switcher)"
class="highlighter"
>
<!-- id's need to be unique, otherwise vue confuses which user-card checkbox belongs to -->
<input
v-if="userHighlightType !== 'disabled'"
:id="'userHighlightColorTx'+user.id"
v-model="userHighlightColor"
class="userHighlightText"
type="text"
>
<input
v-if="userHighlightType !== 'disabled'"
:id="'userHighlightColor'+user.id"
v-model="userHighlightColor"
class="userHighlightCl"
type="color"
>
<label
for="style-switcher"
class="userHighlightSel select"
>
<select
:id="'userHighlightSel'+user.id"
v-model="userHighlightType"
class="userHighlightSel"
>
<option value="disabled">No highlight</option>
<option value="solid">Solid bg</option>
<option value="striped">Striped bg</option>
<option value="side">Side stripe</option>
</select>
<i class="icon-down-open" />
</label>
</div>
</div> </div>
<div class="highlighter" v-if="isOtherUser && (loggedIn || !switcher)"> <div
<!-- id's need to be unique, otherwise vue confuses which user-card checkbox belongs to --> v-if="loggedIn && isOtherUser"
<input class="userHighlightText" type="text" :id="'userHighlightColorTx'+user.id" v-if="userHighlightType !== 'disabled'" v-model="userHighlightColor"/> class="user-interactions"
<input class="userHighlightCl" type="color" :id="'userHighlightColor'+user.id" v-if="userHighlightType !== 'disabled'" v-model="userHighlightColor"/> >
<label for="style-switcher" class='userHighlightSel select'> <div v-if="!user.following">
<select class="userHighlightSel" :id="'userHighlightSel'+user.id" v-model="userHighlightType"> <button
<option value="disabled">No highlight</option> class="btn btn-default btn-block"
<option value="solid">Solid bg</option> :disabled="followRequestInProgress"
<option value="striped">Striped bg</option> :title="followRequestSent ? $t('user_card.follow_again') : ''"
<option value="side">Side stripe</option> @click="followUser"
</select> >
<i class="icon-down-open"/> <template v-if="followRequestInProgress">
</label> {{ $t('user_card.follow_progress') }}
</div> </template>
</div> <template v-else-if="followRequestSent">
<div v-if="loggedIn && isOtherUser" class="user-interactions"> {{ $t('user_card.follow_sent') }}
<div v-if="!user.following"> </template>
<button @click="followUser" class="btn btn-default btn-block" :disabled="followRequestInProgress" :title="followRequestSent ? $t('user_card.follow_again') : ''"> <template v-else>
<template v-if="followRequestInProgress"> {{ $t('user_card.follow') }}
</template>
</button>
</div>
<div v-else-if="followRequestInProgress">
<button
class="btn btn-default btn-block pressed"
disabled
:title="$t('user_card.follow_unfollow')"
@click="unfollowUser"
>
{{ $t('user_card.follow_progress') }} {{ $t('user_card.follow_progress') }}
</template> </button>
<template v-else-if="followRequestSent"> </div>
{{ $t('user_card.follow_sent') }} <div
</template> v-else
<template v-else> class="btn-group"
{{ $t('user_card.follow') }} >
</template> <button
</button> class="btn btn-default pressed"
</div> :title="$t('user_card.follow_unfollow')"
<div v-else-if="followRequestInProgress"> @click="unfollowUser"
<button @click="unfollowUser" class="btn btn-default btn-block pressed" disabled :title="$t('user_card.follow_unfollow')"> >
{{ $t('user_card.follow_progress') }} {{ $t('user_card.following') }}
</button> </button>
</div> <ProgressButton
<div class="btn-group" v-else> v-if="!user.subscribed"
<button @click="unfollowUser" class="btn btn-default pressed" :title="$t('user_card.follow_unfollow')"> class="btn btn-default"
{{ $t('user_card.following') }} :click="subscribeUser"
</button> :title="$t('user_card.subscribe')"
<ProgressButton class="btn btn-default" :click="subscribeUser" :title="$t('user_card.subscribe')" v-if="!user.subscribed"> >
<i class="icon-bell-alt" /> <i class="icon-bell-alt" />
</ProgressButton> </ProgressButton>
<ProgressButton class="btn btn-default pressed" :click="unsubscribeUser" :title="$t('user_card.unsubscribe')" v-else> <ProgressButton
<i class="icon-bell-alt" /> v-else
</ProgressButton> class="btn btn-default pressed"
</div> :click="unsubscribeUser"
:title="$t('user_card.unsubscribe')"
>
<i class="icon-bell-alt" />
</ProgressButton>
</div>
<div> <div>
<button @click="unmuteUser" class="btn btn-default btn-block pressed" v-if="user.muted"> <button
{{ $t('user_card.muted') }} v-if="user.muted"
</button> class="btn btn-default btn-block pressed"
<button @click="muteUser" class="btn btn-default btn-block" v-else> @click="unmuteUser"
{{ $t('user_card.mute') }} >
</button> {{ $t('user_card.muted') }}
</div> </button>
<button
v-else
class="btn btn-default btn-block"
@click="muteUser"
>
{{ $t('user_card.mute') }}
</button>
</div>
<div> <div>
<button @click="unblockUser" class="btn btn-default btn-block pressed" v-if="user.statusnet_blocking"> <button
{{ $t('user_card.blocked') }} v-if="user.statusnet_blocking"
</button> class="btn btn-default btn-block pressed"
<button @click="blockUser" class="btn btn-default btn-block" v-else> @click="unblockUser"
{{ $t('user_card.block') }} >
</button> {{ $t('user_card.blocked') }}
</div> </button>
<button
v-else
class="btn btn-default btn-block"
@click="blockUser"
>
{{ $t('user_card.block') }}
</button>
</div>
<div> <div>
<button @click="reportUser" class="btn btn-default btn-block"> <button
{{ $t('user_card.report') }} class="btn btn-default btn-block"
</button> @click="reportUser"
</div> >
{{ $t('user_card.report') }}
</button>
</div>
<ModerationTools :user='user' v-if='loggedIn.role === "admin"' /> <ModerationTools
</div> v-if="loggedIn.role === &quot;admin&quot;"
<div class="user-interactions" v-if="!loggedIn && user.is_local"> :user="user"
<RemoteFollow :user="user" /> />
</div>
<div
v-if="!loggedIn && user.is_local"
class="user-interactions"
>
<RemoteFollow :user="user" />
</div>
</div> </div>
</div> </div>
</div> <div
<div class="panel-body" v-if="!hideBio"> v-if="!hideBio"
<div v-if="!hideUserStatsLocal && switcher" class="user-counts"> class="panel-body"
<div class="user-count" v-on:click.prevent="setProfileView('statuses')"> >
<h5>{{ $t('user_card.statuses') }}</h5> <div
<span>{{user.statuses_count}} <br></span> v-if="!hideUserStatsLocal && switcher"
</div> class="user-counts"
<div class="user-count" v-on:click.prevent="setProfileView('friends')"> >
<h5>{{ $t('user_card.followees') }}</h5> <div
<span>{{user.friends_count}}</span> class="user-count"
</div> @click.prevent="setProfileView('statuses')"
<div class="user-count" v-on:click.prevent="setProfileView('followers')"> >
<h5>{{ $t('user_card.followers') }}</h5> <h5>{{ $t('user_card.statuses') }}</h5>
<span>{{user.followers_count}}</span> <span>{{ user.statuses_count }} <br></span>
</div>
<div
class="user-count"
@click.prevent="setProfileView('friends')"
>
<h5>{{ $t('user_card.followees') }}</h5>
<span>{{ user.friends_count }}</span>
</div>
<div
class="user-count"
@click.prevent="setProfileView('followers')"
>
<h5>{{ $t('user_card.followers') }}</h5>
<span>{{ user.followers_count }}</span>
</div>
</div> </div>
<!-- eslint-disable vue/no-v-html -->
<p
v-if="!hideBio && user.description_html"
class="user-card-bio"
@click.prevent="linkClicked"
v-html="user.description_html"
/>
<!-- eslint-enabled vue/no-v-html -->
<p
v-else-if="!hideBio"
class="user-card-bio"
>
{{ user.description }}
</p>
</div> </div>
<p @click.prevent="linkClicked" v-if="!hideBio && user.description_html" class="user-card-bio" v-html="user.description_html"></p>
<p v-else-if="!hideBio" class="user-card-bio">{{ user.description }}</p>
</div> </div>
</div>
</template> </template>
<script src="./user_card.js"></script> <script src="./user_card.js"></script>