Skip to content

Commit

Permalink
Revert "Add profile directory (mastodon#9427)"
Browse files Browse the repository at this point in the history
This reverts commit ee52130.
  • Loading branch information
pluralcafe-docker committed Dec 11, 2018
1 parent ee52130 commit 1c0b247
Show file tree
Hide file tree
Showing 31 changed files with 7 additions and 578 deletions.
44 changes: 0 additions & 44 deletions app/controllers/admin/tags_controller.rb

This file was deleted.

2 changes: 1 addition & 1 deletion app/controllers/api/v1/accounts/credentials_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def update
private

def account_params
params.permit(:display_name, :note, :avatar, :header, :locked, :bot, :discoverable, fields_attributes: [:name, :value])
params.permit(:display_name, :note, :avatar, :header, :locked, :bot, fields_attributes: [:name, :value])
end

def user_settings_params
Expand Down
48 changes: 0 additions & 48 deletions app/controllers/directories_controller.rb

This file was deleted.

2 changes: 1 addition & 1 deletion app/controllers/settings/profiles_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def update
private

def account_params
params.require(:account).permit(:display_name, :note, :avatar, :header, :locked, :bot, :discoverable, fields_attributes: [:name, :value])
params.require(:account).permit(:display_name, :note, :avatar, :header, :locked, :bot, fields_attributes: [:name, :value])
end

def set_account
Expand Down
3 changes: 1 addition & 2 deletions app/helpers/admin/filter_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@ module Admin::FilterHelper
REPORT_FILTERS = %i(resolved account_id target_account_id).freeze
INVITE_FILTER = %i(available expired).freeze
CUSTOM_EMOJI_FILTERS = %i(local remote by_domain shortcode).freeze
TAGS_FILTERS = %i(hidden).freeze

FILTERS = ACCOUNT_FILTERS + REPORT_FILTERS + INVITE_FILTER + CUSTOM_EMOJI_FILTERS + TAGS_FILTERS
FILTERS = ACCOUNT_FILTERS + REPORT_FILTERS + INVITE_FILTER + CUSTOM_EMOJI_FILTERS

def filter_link_to(text, link_to_params, link_class_params = link_to_params)
new_url = filtered_url_for(link_to_params)
Expand Down
5 changes: 0 additions & 5 deletions app/javascript/styles/mastodon/accounts.scss
Original file line number Diff line number Diff line change
Expand Up @@ -189,11 +189,6 @@
&--under-tabs {
border-radius: 0 0 4px 4px;
}

&--flexible {
box-sizing: border-box;
min-height: 100%;
}
}

.account-role {
Expand Down
165 changes: 0 additions & 165 deletions app/javascript/styles/mastodon/widgets.scss
Original file line number Diff line number Diff line change
Expand Up @@ -240,168 +240,3 @@
border-radius: 0;
}
}

.page-header {
background: lighten($ui-base-color, 8%);
box-shadow: 0 0 15px rgba($base-shadow-color, 0.2);
border-radius: 4px;
padding: 60px 15px;
text-align: center;
margin: 10px 0;

h1 {
color: $primary-text-color;
font-size: 36px;
line-height: 1.1;
font-weight: 700;
margin-bottom: 10px;
}

p {
font-size: 15px;
color: $darker-text-color;
}
}

.directory {
background: $ui-base-color;
border-radius: 0 0 4px 4px;
box-shadow: 0 0 15px rgba($base-shadow-color, 0.2);

&__tag {
box-sizing: border-box;
margin-bottom: 10px;

a {
display: flex;
align-items: center;
justify-content: space-between;
background: $ui-base-color;
border-radius: 4px;
padding: 15px;
text-decoration: none;
color: inherit;
box-shadow: 0 0 15px rgba($base-shadow-color, 0.2);

&:hover,
&:active,
&:focus {
background: lighten($ui-base-color, 8%);
}
}

&.active a {
background: $ui-highlight-color;
cursor: default;
}

h4 {
flex: 1 1 auto;
font-size: 18px;
font-weight: 700;
color: $primary-text-color;

.fa {
color: $darker-text-color;
}

small {
display: block;
font-weight: 400;
font-size: 15px;
margin-top: 8px;
color: $darker-text-color;
}
}

&.active h4 {
&,
.fa,
small {
color: $primary-text-color;
}
}

.avatar-stack {
flex: 0 0 auto;
width: (36px + 4px) * 3;
}

&.active .avatar-stack .account__avatar {
border-color: $ui-highlight-color;
}
}
}

.avatar-stack {
display: flex;
justify-content: flex-end;

.account__avatar {
flex: 0 0 auto;
width: 36px;
height: 36px;
border-radius: 50%;
position: relative;
margin-left: -10px;
border: 2px solid $ui-base-color;

&:nth-child(1) {
z-index: 1;
}

&:nth-child(2) {
z-index: 2;
}

&:nth-child(3) {
z-index: 3;
}
}
}

.accounts-table {
width: 100%;

.account {
padding: 0;
border: 0;
}

thead th {
text-align: center;
text-transform: uppercase;
color: $darker-text-color;
font-weight: 700;
padding: 10px;

&:first-child {
text-align: left;
}
}

tbody td {
padding: 15px 0;
vertical-align: middle;
border-bottom: 1px solid lighten($ui-base-color, 8%);
}

tbody tr:last-child td {
border-bottom: 0;
}

&__count {
width: 120px;
text-align: center;
font-size: 15px;
font-weight: 500;
color: $primary-text-color;

small {
display: block;
color: $darker-text-color;
font-weight: 400;
font-size: 14px;
}
}
}
40 changes: 0 additions & 40 deletions app/models/account.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,11 @@
# featured_collection_url :string
# fields :jsonb
# actor_type :string
# discoverable :boolean
#

class Account < ApplicationRecord
USERNAME_RE = /[a-z0-9_]+([a-z0-9_\.-]+[a-z0-9_]+)?/i
MENTION_RE = /(?<=^|[^\/[:word:]])@((#{USERNAME_RE})(?:@[a-z0-9\.\-]+[a-z0-9]+)?)/i
MIN_FOLLOWERS_DISCOVERY = 10

include AccountAssociations
include AccountAvatar
Expand Down Expand Up @@ -95,10 +93,6 @@ class Account < ApplicationRecord
scope :matches_display_name, ->(value) { where(arel_table[:display_name].matches("#{value}%")) }
scope :matches_domain, ->(value) { where(arel_table[:domain].matches("%#{value}%")) }
scope :searchable, -> { where(suspended: false).where(moved_to_account_id: nil) }
scope :discoverable, -> { where(silenced: false).where(discoverable: true).joins(:account_stat).where(AccountStat.arel_table[:followers_count].gteq(MIN_FOLLOWERS_DISCOVERY)) }
scope :tagged_with, ->(tag) { joins(:accounts_tags).where(accounts_tags: { tag_id: tag }) }
scope :popular, -> { order('account_stats.followers_count desc') }
scope :by_recent_status, -> { order('(case when account_stats.last_status_at is null then 1 else 0 end) asc, account_stats.last_status_at desc') }

delegate :email,
:unconfirmed_email,
Expand Down Expand Up @@ -184,40 +178,6 @@ def keypair
@keypair ||= OpenSSL::PKey::RSA.new(private_key || public_key)
end

def tags_as_strings=(tag_names)
tag_names.map! { |name| name.mb_chars.downcase }
tag_names.uniq!(&:to_s)

# Existing hashtags
hashtags_map = Tag.where(name: tag_names).each_with_object({}) { |tag, h| h[tag.name] = tag }

# Initialize not yet existing hashtags
tag_names.each do |name|
next if hashtags_map.key?(name)
hashtags_map[name.downcase] = Tag.new(name: name)
end

# Remove hashtags that are to be deleted
tags.each do |tag|
if hashtags_map.key?(tag.name)
hashtags_map.delete(tag.name)
else
transaction do
tags.delete(tag)
tag.decrement_count!(:accounts_count)
end
end
end

# Add hashtags that were so far missing
hashtags_map.each_value do |tag|
transaction do
tags << tag
tag.increment_count!(:accounts_count)
end
end
end

def fields
(self[:fields] || []).map { |f| Field.new(self, f) }
end
Expand Down
Loading

0 comments on commit 1c0b247

Please sign in to comment.