fix interaction buttons on public pages
parent
2a41140dc7
commit
8a7605e502
|
@ -9,18 +9,10 @@ class RemoteFollowController < ApplicationController
|
||||||
before_action :set_body_classes
|
before_action :set_body_classes
|
||||||
|
|
||||||
def new
|
def new
|
||||||
@remote_follow = RemoteFollow.new(session_params)
|
raise Mastodon::NotPermittedError unless user_signed_in?
|
||||||
end
|
|
||||||
|
|
||||||
def create
|
FollowService.new.call(current_account, @account)
|
||||||
@remote_follow = RemoteFollow.new(resource_params)
|
redirect_to TagManager.instance.url_for(@account)
|
||||||
|
|
||||||
if @remote_follow.valid?
|
|
||||||
session[:remote_follow] = @remote_follow.acct
|
|
||||||
redirect_to @remote_follow.subscribe_address_for(@account)
|
|
||||||
else
|
|
||||||
render :new
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
|
@ -5,24 +5,34 @@ class RemoteInteractionController < ApplicationController
|
||||||
|
|
||||||
layout 'modal'
|
layout 'modal'
|
||||||
|
|
||||||
before_action :set_interaction_type
|
|
||||||
before_action :set_status
|
|
||||||
before_action :set_body_classes
|
before_action :set_body_classes
|
||||||
before_action :set_pack
|
before_action :set_pack
|
||||||
|
before_action :set_status
|
||||||
|
|
||||||
def new
|
def new
|
||||||
@remote_follow = RemoteFollow.new(session_params)
|
raise Mastodon::NotPermittedError unless user_signed_in?
|
||||||
end
|
|
||||||
|
|
||||||
def create
|
case params[:type]
|
||||||
@remote_follow = RemoteFollow.new(resource_params)
|
when 'reblog'
|
||||||
|
if current_account.statuses.where(reblog: @status).exists?
|
||||||
if @remote_follow.valid?
|
status = current_account.statuses.find_by(reblog: @status)
|
||||||
session[:remote_follow] = @remote_follow.acct
|
RemoveStatusService.new.call(status)
|
||||||
redirect_to @remote_follow.interact_address_for(@status)
|
else
|
||||||
else
|
ReblogService.new.call(current_account, @status)
|
||||||
render :new
|
end
|
||||||
|
when 'favourite'
|
||||||
|
if Favourite.where(account: current_account, status: @status).exists?
|
||||||
|
UnfavouriteService.new.call(current_account, @status)
|
||||||
|
else
|
||||||
|
FavouriteService.new.call(current_account, @status)
|
||||||
|
end
|
||||||
|
when 'follow'
|
||||||
|
FollowService.new.call(current_account, @status.account)
|
||||||
|
when 'unfollow'
|
||||||
|
UnfollowService.new.call(current_account, @status.account)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
redirect_to TagManager.instance.url_for(@status)
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
@ -51,8 +61,4 @@ class RemoteInteractionController < ApplicationController
|
||||||
def set_pack
|
def set_pack
|
||||||
use_pack 'modal'
|
use_pack 'modal'
|
||||||
end
|
end
|
||||||
|
|
||||||
def set_interaction_type
|
|
||||||
@interaction_type = %w(reply reblog favourite).include?(params[:type]) ? params[:type] : 'reply'
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -605,6 +605,15 @@
|
||||||
.detailed-status__link {
|
.detailed-status__link {
|
||||||
color: inherit;
|
color: inherit;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.detailed-status__star-icon {
|
||||||
|
color: $gold-star;
|
||||||
|
}
|
||||||
|
|
||||||
|
.detailed-status__boost-icon {
|
||||||
|
color: $red-bookmark;
|
||||||
}
|
}
|
||||||
|
|
||||||
.detailed-status__favorites,
|
.detailed-status__favorites,
|
||||||
|
|
|
@ -67,13 +67,13 @@
|
||||||
= fa_icon('lock')
|
= fa_icon('lock')
|
||||||
- elsif user_signed_in? && !@account.user_hides_stats?
|
- elsif user_signed_in? && !@account.user_hides_stats?
|
||||||
·
|
·
|
||||||
= link_to remote_interaction_path(status, type: :reblog), class: 'modal-button detailed-status__link', title: number_to_human(status.reblogs_count, strip_insignificant_zeros: true) do
|
= link_to remote_interaction_path(status, type: :reblog), class: "detailed-status__link #{user_signed_in? && @account.statuses.where(reblog: status).exists? ? 'detailed-status__boost-icon' : nil}", title: number_to_human(status.reblogs_count, strip_insignificant_zeros: true) do
|
||||||
= fa_icon('repeat')
|
= fa_icon('repeat')
|
||||||
= " "
|
= " "
|
||||||
|
|
||||||
- if user_signed_in? && !@account.user_hides_stats?
|
- if user_signed_in? && !@account.user_hides_stats?
|
||||||
·
|
·
|
||||||
= link_to remote_interaction_path(status, type: :favourite), class: 'modal-button detailed-status__link', title: number_to_human(status.favourites_count, strip_insignificant_zeros: true) do
|
= link_to remote_interaction_path(status, type: :favourite), class: "detailed-status__link #{user_signed_in? && Favourite.where(account: @account, status: status).exists? ? 'detailed-status__star-icon' : nil}", title: number_to_human(status.favourites_count, strip_insignificant_zeros: true) do
|
||||||
= fa_icon('star')
|
= fa_icon('star')
|
||||||
= " "
|
= " "
|
||||||
|
|
||||||
|
|
|
@ -53,12 +53,12 @@
|
||||||
- else
|
- else
|
||||||
= fa_icon 'reply-all fw'
|
= fa_icon 'reply-all fw'
|
||||||
.status__action-bar__counter__label= obscured_counter status.replies_count
|
.status__action-bar__counter__label= obscured_counter status.replies_count
|
||||||
= link_to remote_interaction_path(status, type: :reblog), class: 'status__action-bar-button icon-button modal-button', style: 'font-size: 18px; width: 23.1429px; height: 23.1429px; line-height: 23.15px;' do
|
= link_to remote_interaction_path(status, type: :reblog), class: 'status__action-bar-button icon-button', style: 'font-size: 18px; width: 23.1429px; height: 23.1429px; line-height: 23.15px;' do
|
||||||
- if status.public_visibility? || status.unlisted_visibility?
|
- if status.public_visibility? || status.unlisted_visibility?
|
||||||
= fa_icon 'repeat fw'
|
= fa_icon 'repeat fw'
|
||||||
- elsif status.private_visibility?
|
- elsif status.private_visibility?
|
||||||
= fa_icon 'lock fw'
|
= fa_icon 'lock fw'
|
||||||
- else
|
- else
|
||||||
= fa_icon 'envelope fw'
|
= fa_icon 'envelope fw'
|
||||||
= link_to remote_interaction_path(status, type: :favourite), class: 'status__action-bar-button icon-button modal-button', style: 'font-size: 18px; width: 23.1429px; height: 23.1429px; line-height: 23.15px;' do
|
= link_to remote_interaction_path(status, type: :favourite), class: 'status__action-bar-button icon-button', style: 'font-size: 18px; width: 23.1429px; height: 23.1429px; line-height: 23.15px;' do
|
||||||
= fa_icon 'star fw'
|
= fa_icon 'star fw'
|
||||||
|
|
Loading…
Reference in New Issue