Skip to content

Commit

Permalink
Merge branch 'master' into glitch-soc/merge-upstream
Browse files Browse the repository at this point in the history
Conflicts:
- app/javascript/packs/public.js
- app/models/user.rb
- config/settings.yml
- db/schema.rb

Moved public.js changes to settings.js.
  • Loading branch information
ClearlyClaire committed Dec 9, 2018
2 parents e3682c9 + 81bda7d commit e7f1bfd
Show file tree
Hide file tree
Showing 47 changed files with 751 additions and 43 deletions.
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,7 @@ GEM
rspec-core (~> 3.0, >= 3.0.0)
sidekiq (>= 2.4.0)
rspec-support (3.8.0)
rubocop (0.61.0)
rubocop (0.61.1)
jaro_winkler (~> 1.5.1)
parallel (~> 1.10)
parser (>= 2.5, != 2.5.1.1)
Expand Down
44 changes: 44 additions & 0 deletions app/controllers/admin/tags_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# frozen_string_literal: true

module Admin
class TagsController < BaseController
before_action :set_tags, only: :index
before_action :set_tag, except: :index
before_action :set_filter_params

def index
authorize :tag, :index?
end

def hide
authorize @tag, :hide?
@tag.account_tag_stat.update!(hidden: true)
redirect_to admin_tags_path(@filter_params)
end

def unhide
authorize @tag, :unhide?
@tag.account_tag_stat.update!(hidden: true)
redirect_to admin_tags_path(@filter_params)
end

private

def set_tags
@tags = Tag.discoverable
@tags.merge!(Tag.hidden) if filter_params[:hidden]
end

def set_tag
@tag = Tag.find(params[:id])
end

def set_filter_params
@filter_params = filter_params.to_hash.symbolize_keys
end

def filter_params
params.permit(:hidden)
end
end
end
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, fields_attributes: [:name, :value])
params.permit(:display_name, :note, :avatar, :header, :locked, :bot, :discoverable, fields_attributes: [:name, :value])
end

def user_settings_params
Expand Down
48 changes: 48 additions & 0 deletions app/controllers/directories_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# frozen_string_literal: true

class DirectoriesController < ApplicationController
layout 'public'

before_action :set_instance_presenter
before_action :set_tag, only: :show
before_action :set_tags
before_action :set_accounts

def index
render :index
end

def show
render :index
end

private

def set_tag
@tag = Tag.discoverable.find_by!(name: params[:id].downcase)
end

def set_tags
@tags = Tag.discoverable.limit(30)
end

def set_accounts
@accounts = Account.searchable.discoverable.page(params[:page]).per(50).tap do |query|
query.merge!(Account.tagged_with(@tag.id)) if @tag

if popular_requested?
query.merge!(Account.popular)
else
query.merge!(Account.by_recent_status)
end
end
end

def set_instance_presenter
@instance_presenter = InstancePresenter.new
end

def popular_requested?
request.path.ends_with?('/popular')
end
end
1 change: 1 addition & 0 deletions app/controllers/settings/preferences_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ def user_settings_params
:setting_system_font_ui,
:setting_noindex,
:setting_hide_network,
:setting_aggregate_reblogs,
notification_emails: %i(follow follow_request reblog favourite mention digest report),
interactions: %i(must_be_follower must_be_following)
)
Expand Down
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, fields_attributes: [:name, :value])
params.require(:account).permit(:display_name, :note, :avatar, :header, :locked, :bot, :discoverable, fields_attributes: [:name, :value])
end

def set_account
Expand Down
3 changes: 2 additions & 1 deletion app/helpers/admin/filter_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ 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
FILTERS = ACCOUNT_FILTERS + REPORT_FILTERS + INVITE_FILTER + CUSTOM_EMOJI_FILTERS + TAGS_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
8 changes: 6 additions & 2 deletions app/javascript/core/settings.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
// This file will be loaded on settings pages, regardless of theme.

import escapeTextContentForBrowser from 'escape-html';
const { delegate } = require('rails-ujs');
import emojify from '../mastodon/features/emoji/emoji';

delegate(document, '#account_display_name', 'input', ({ target }) => {
const name = document.querySelector('.card .display-name strong');

if (name) {
name.innerHTML = emojify(target.value);
if (target.value) {
name.innerHTML = emojify(escapeTextContentForBrowser(target.value));
} else {
name.textContent = document.querySelector('#default_account_display_name').textContent;
}
}
});

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

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

.account-role {
Expand Down
3 changes: 2 additions & 1 deletion app/javascript/styles/mastodon/components.scss
Original file line number Diff line number Diff line change
Expand Up @@ -876,7 +876,8 @@
}
}

.status__relative-time {
.status__relative-time,
.notification__relative_time {
color: $dark-text-color;
float: right;
font-size: 14px;
Expand Down
168 changes: 168 additions & 0 deletions app/javascript/styles/mastodon/widgets.scss
Original file line number Diff line number Diff line change
Expand Up @@ -240,3 +240,171 @@
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;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;

.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;
}
}
}
Loading

0 comments on commit e7f1bfd

Please sign in to comment.