Feature conversations muting (#3017)

* Add <ostatus:conversation /> tag to Atom input/output

Only uses ref attribute (not href) because href would be
the alternate link that's always included also.

Creates new conversation for every non-reply status. Carries
over conversation for every reply. Keeps remote URIs verbatim,
generates local URIs on the fly like the rest of them.

* Conversation muting - prevents notifications that reference a conversation
(including replies, favourites, reblogs) from being created. API endpoints
/api/v1/statuses/:id/mute and /api/v1/statuses/:id/unmute

Currently no way to tell when a status/conversation is muted, so the web UI
only has a "disable notifications" button, doesn't work as a toggle

* Display "Dismiss notifications" on all statuses in notifications column, not just own

* Add "muted" as a boolean attribute on statuses JSON

For now always false on contained reblogs, since it's only relevant for
statuses returned from the notifications endpoint, which are not nested

Remove "Disable notifications" from detailed status view, since it's
only relevant in the notifications column

* Up max class length

* Remove pending test for conversation mute

* Add tests, clean up

* Rename to "mute conversation" and "unmute conversation"

* Raise validation error when trying to mute/unmute status without conversation
pull/17/head
Eugen Rochko 2017-05-15 03:04:13 +02:00 committed by GitHub
parent a588358f41
commit d0dd9eb5b5
52 changed files with 422 additions and 27 deletions

View File

@ -1,10 +1,11 @@
# frozen_string_literal: true # frozen_string_literal: true
class Api::V1::StatusesController < ApiController class Api::V1::StatusesController < ApiController
before_action :authorize_if_got_token, except: [:create, :destroy, :reblog, :unreblog, :favourite, :unfavourite] before_action :authorize_if_got_token, except: [:create, :destroy, :reblog, :unreblog, :favourite, :unfavourite, :mute, :unmute]
before_action -> { doorkeeper_authorize! :write }, only: [:create, :destroy, :reblog, :unreblog, :favourite, :unfavourite] before_action -> { doorkeeper_authorize! :write }, only: [:create, :destroy, :reblog, :unreblog, :favourite, :unfavourite, :mute, :unmute]
before_action :require_user!, except: [:show, :context, :card, :reblogged_by, :favourited_by] before_action :require_user!, except: [:show, :context, :card, :reblogged_by, :favourited_by]
before_action :set_status, only: [:show, :context, :card, :reblogged_by, :favourited_by] before_action :set_status, only: [:show, :context, :card, :reblogged_by, :favourited_by, :mute, :unmute]
before_action :set_conversation, only: [:mute, :unmute]
respond_to :json respond_to :json
@ -105,6 +106,22 @@ class Api::V1::StatusesController < ApiController
render :show render :show
end end
def mute
current_account.mute_conversation!(@conversation)
@mutes_map = { @conversation.id => true }
render :show
end
def unmute
current_account.unmute_conversation!(@conversation)
@mutes_map = { @conversation.id => false }
render :show
end
private private
def set_status def set_status
@ -112,6 +129,11 @@ class Api::V1::StatusesController < ApiController
raise ActiveRecord::RecordNotFound unless @status.permitted?(current_account) raise ActiveRecord::RecordNotFound unless @status.permitted?(current_account)
end end
def set_conversation
@conversation = @status.conversation
raise Mastodon::ValidationError if @conversation.nil?
end
def status_params def status_params
params.permit(:status, :in_reply_to_id, :sensitive, :spoiler_text, :visibility, media_ids: []) params.permit(:status, :in_reply_to_id, :sensitive, :spoiler_text, :visibility, media_ids: [])
end end

View File

@ -93,11 +93,14 @@ class ApiController < ApplicationController
if current_account.nil? if current_account.nil?
@reblogs_map = {} @reblogs_map = {}
@favourites_map = {} @favourites_map = {}
@mutes_map = {}
return return
end end
status_ids = statuses.compact.flat_map { |s| [s.id, s.reblog_of_id] }.uniq status_ids = statuses.compact.flat_map { |s| [s.id, s.reblog_of_id] }.uniq
@reblogs_map = Status.reblogs_map(status_ids, current_account) conversation_ids = statuses.compact.map(&:conversation_id).compact.uniq
@favourites_map = Status.favourites_map(status_ids, current_account) @reblogs_map = Status.reblogs_map(status_ids, current_account)
@favourites_map = Status.favourites_map(status_ids, current_account)
@mutes_map = Status.mutes_map(conversation_ids, current_account)
end end
end end

View File

@ -15,6 +15,14 @@ export const CONTEXT_FETCH_REQUEST = 'CONTEXT_FETCH_REQUEST';
export const CONTEXT_FETCH_SUCCESS = 'CONTEXT_FETCH_SUCCESS'; export const CONTEXT_FETCH_SUCCESS = 'CONTEXT_FETCH_SUCCESS';
export const CONTEXT_FETCH_FAIL = 'CONTEXT_FETCH_FAIL'; export const CONTEXT_FETCH_FAIL = 'CONTEXT_FETCH_FAIL';
export const STATUS_MUTE_REQUEST = 'STATUS_MUTE_REQUEST';
export const STATUS_MUTE_SUCCESS = 'STATUS_MUTE_SUCCESS';
export const STATUS_MUTE_FAIL = 'STATUS_MUTE_FAIL';
export const STATUS_UNMUTE_REQUEST = 'STATUS_UNMUTE_REQUEST';
export const STATUS_UNMUTE_SUCCESS = 'STATUS_UNMUTE_SUCCESS';
export const STATUS_UNMUTE_FAIL = 'STATUS_UNMUTE_FAIL';
export function fetchStatusRequest(id, skipLoading) { export function fetchStatusRequest(id, skipLoading) {
return { return {
type: STATUS_FETCH_REQUEST, type: STATUS_FETCH_REQUEST,
@ -139,3 +147,71 @@ export function fetchContextFail(id, error) {
skipAlert: true skipAlert: true
}; };
}; };
export function muteStatus(id) {
return (dispatch, getState) => {
dispatch(muteStatusRequest(id));
api(getState).post(`/api/v1/statuses/${id}/mute`).then(response => {
dispatch(muteStatusSuccess(id));
}).catch(error => {
dispatch(muteStatusFail(id, error));
});
};
};
export function muteStatusRequest(id) {
return {
type: STATUS_MUTE_REQUEST,
id
};
};
export function muteStatusSuccess(id) {
return {
type: STATUS_MUTE_SUCCESS,
id
};
};
export function muteStatusFail(id, error) {
return {
type: STATUS_MUTE_FAIL,
id,
error
};
};
export function unmuteStatus(id) {
return (dispatch, getState) => {
dispatch(unmuteStatusRequest(id));
api(getState).post(`/api/v1/statuses/${id}/unmute`).then(response => {
dispatch(unmuteStatusSuccess(id));
}).catch(error => {
dispatch(unmuteStatusFail(id, error));
});
};
};
export function unmuteStatusRequest(id) {
return {
type: STATUS_UNMUTE_REQUEST,
id
};
};
export function unmuteStatusSuccess(id) {
return {
type: STATUS_UNMUTE_SUCCESS,
id
};
};
export function unmuteStatusFail(id, error) {
return {
type: STATUS_UNMUTE_FAIL,
id,
error
};
};

View File

@ -16,7 +16,9 @@ const messages = defineMessages({
cannot_reblog: { id: 'status.cannot_reblog', defaultMessage: 'This post cannot be boosted' }, cannot_reblog: { id: 'status.cannot_reblog', defaultMessage: 'This post cannot be boosted' },
favourite: { id: 'status.favourite', defaultMessage: 'Favourite' }, favourite: { id: 'status.favourite', defaultMessage: 'Favourite' },
open: { id: 'status.open', defaultMessage: 'Expand this status' }, open: { id: 'status.open', defaultMessage: 'Expand this status' },
report: { id: 'status.report', defaultMessage: 'Report @{name}' } report: { id: 'status.report', defaultMessage: 'Report @{name}' },
muteConversation: { id: 'status.mute_conversation', defaultMessage: 'Mute conversation' },
unmuteConversation: { id: 'status.unmute_conversation', defaultMessage: 'Unmute conversation' },
}); });
class StatusActionBar extends React.PureComponent { class StatusActionBar extends React.PureComponent {
@ -35,7 +37,9 @@ class StatusActionBar extends React.PureComponent {
onMute: PropTypes.func, onMute: PropTypes.func,
onBlock: PropTypes.func, onBlock: PropTypes.func,
onReport: PropTypes.func, onReport: PropTypes.func,
onMuteConversation: PropTypes.func,
me: PropTypes.number.isRequired, me: PropTypes.number.isRequired,
withDismiss: PropTypes.bool,
intl: PropTypes.object.isRequired intl: PropTypes.object.isRequired
}; };
@ -76,9 +80,14 @@ class StatusActionBar extends React.PureComponent {
this.context.router.push('/report'); this.context.router.push('/report');
} }
handleConversationMuteClick = () => {
this.props.onMuteConversation(this.props.status);
}
render () { render () {
const { status, me, intl } = this.props; const { status, me, intl, withDismiss } = this.props;
const reblogDisabled = status.get('visibility') === 'private' || status.get('visibility') === 'direct'; const reblogDisabled = status.get('visibility') === 'private' || status.get('visibility') === 'direct';
const mutingConversation = status.get('muted');
let menu = []; let menu = [];
let reblogIcon = 'retweet'; let reblogIcon = 'retweet';
@ -88,6 +97,11 @@ class StatusActionBar extends React.PureComponent {
menu.push({ text: intl.formatMessage(messages.open), action: this.handleOpen }); menu.push({ text: intl.formatMessage(messages.open), action: this.handleOpen });
menu.push(null); menu.push(null);
if (withDismiss) {
menu.push({ text: intl.formatMessage(mutingConversation ? messages.unmuteConversation : messages.muteConversation), action: this.handleConversationMuteClick });
menu.push(null);
}
if (status.getIn(['account', 'id']) === me) { if (status.getIn(['account', 'id']) === me) {
menu.push({ text: intl.formatMessage(messages.delete), action: this.handleDeleteClick }); menu.push({ text: intl.formatMessage(messages.delete), action: this.handleDeleteClick });
} else { } else {

View File

@ -16,7 +16,7 @@ import {
blockAccount, blockAccount,
muteAccount muteAccount
} from '../actions/accounts'; } from '../actions/accounts';
import { deleteStatus } from '../actions/statuses'; import { muteStatus, unmuteStatus, deleteStatus } from '../actions/statuses';
import { initReport } from '../actions/reports'; import { initReport } from '../actions/reports';
import { openModal } from '../actions/modal'; import { openModal } from '../actions/modal';
import { createSelector } from 'reselect' import { createSelector } from 'reselect'
@ -113,6 +113,14 @@ const mapDispatchToProps = (dispatch, { intl }) => ({
})); }));
}, },
onMuteConversation (status) {
if (status.get('muted')) {
dispatch(unmuteStatus(status.get('id')));
} else {
dispatch(muteStatus(status.get('id')));
}
},
}); });
export default injectIntl(connect(makeMapStateToProps, mapDispatchToProps)(Status)); export default injectIntl(connect(makeMapStateToProps, mapDispatchToProps)(Status));

View File

@ -32,7 +32,7 @@ class Notification extends ImmutablePureComponent {
} }
renderMention (notification) { renderMention (notification) {
return <StatusContainer id={notification.get('status')} />; return <StatusContainer id={notification.get('status')} withDismiss />;
} }
renderFavourite (notification, link) { renderFavourite (notification, link) {
@ -45,7 +45,7 @@ class Notification extends ImmutablePureComponent {
<FormattedMessage id='notification.favourite' defaultMessage='{name} favourited your status' values={{ name: link }} /> <FormattedMessage id='notification.favourite' defaultMessage='{name} favourited your status' values={{ name: link }} />
</div> </div>
<StatusContainer id={notification.get('status')} account={notification.get('account')} muted={true} /> <StatusContainer id={notification.get('status')} account={notification.get('account')} muted={true} withDismiss />
</div> </div>
); );
} }
@ -60,7 +60,7 @@ class Notification extends ImmutablePureComponent {
<FormattedMessage id='notification.reblog' defaultMessage='{name} boosted your status' values={{ name: link }} /> <FormattedMessage id='notification.reblog' defaultMessage='{name} boosted your status' values={{ name: link }} />
</div> </div>
<StatusContainer id={notification.get('status')} account={notification.get('account')} muted={true} /> <StatusContainer id={notification.get('status')} account={notification.get('account')} muted={true} withDismiss />
</div> </div>
); );
} }

View File

@ -12,7 +12,7 @@ const messages = defineMessages({
reblog: { id: 'status.reblog', defaultMessage: 'Boost' }, reblog: { id: 'status.reblog', defaultMessage: 'Boost' },
cannot_reblog: { id: 'status.cannot_reblog', defaultMessage: 'This post cannot be boosted' }, cannot_reblog: { id: 'status.cannot_reblog', defaultMessage: 'This post cannot be boosted' },
favourite: { id: 'status.favourite', defaultMessage: 'Favourite' }, favourite: { id: 'status.favourite', defaultMessage: 'Favourite' },
report: { id: 'status.report', defaultMessage: 'Report @{name}' } report: { id: 'status.report', defaultMessage: 'Report @{name}' },
}); });
class ActionBar extends React.PureComponent { class ActionBar extends React.PureComponent {

View File

@ -171,8 +171,24 @@ class Status extends ImmutablePureComponent {
<div className='scrollable detailed-status__wrapper'> <div className='scrollable detailed-status__wrapper'>
{ancestors} {ancestors}
<DetailedStatus status={status} autoPlayGif={autoPlayGif} me={me} onOpenVideo={this.handleOpenVideo} onOpenMedia={this.handleOpenMedia} /> <DetailedStatus
<ActionBar status={status} me={me} onReply={this.handleReplyClick} onFavourite={this.handleFavouriteClick} onReblog={this.handleReblogClick} onDelete={this.handleDeleteClick} onMention={this.handleMentionClick} onReport={this.handleReport} /> status={status}
autoPlayGif={autoPlayGif}
me={me}
onOpenVideo={this.handleOpenVideo}
onOpenMedia={this.handleOpenMedia}
/>
<ActionBar
status={status}
me={me}
onReply={this.handleReplyClick}
onFavourite={this.handleFavouriteClick}
onReblog={this.handleReblogClick}
onDelete={this.handleDeleteClick}
onMention={this.handleMentionClick}
onReport={this.handleReport}
/>
{descendants} {descendants}
</div> </div>

View File

@ -142,6 +142,7 @@
"status.load_more": "حمّل المزيد", "status.load_more": "حمّل المزيد",
"status.media_hidden": "الصورة مستترة", "status.media_hidden": "الصورة مستترة",
"status.mention": "أذكُر @{name}", "status.mention": "أذكُر @{name}",
"status.mute_conversation": "Mute conversation",
"status.open": "وسع هذه المشاركة", "status.open": "وسع هذه المشاركة",
"status.reblog": "رَقِّي", "status.reblog": "رَقِّي",
"status.reblogged_by": "{name} رقى", "status.reblogged_by": "{name} رقى",
@ -152,6 +153,7 @@
"status.sensitive_warning": "محتوى حساس", "status.sensitive_warning": "محتوى حساس",
"status.show_less": "إعرض أقلّ", "status.show_less": "إعرض أقلّ",
"status.show_more": "أظهر المزيد", "status.show_more": "أظهر المزيد",
"status.unmute_conversation": "Unmute conversation",
"tabs_bar.compose": "تحرير", "tabs_bar.compose": "تحرير",
"tabs_bar.federated_timeline": "الموحَّد", "tabs_bar.federated_timeline": "الموحَّد",
"tabs_bar.home": "الرئيسية", "tabs_bar.home": "الرئيسية",

View File

@ -142,6 +142,7 @@
"status.load_more": "Load more", "status.load_more": "Load more",
"status.media_hidden": "Media hidden", "status.media_hidden": "Media hidden",
"status.mention": "Споменаване", "status.mention": "Споменаване",
"status.mute_conversation": "Mute conversation",
"status.open": "Expand this status", "status.open": "Expand this status",
"status.reblog": "Споделяне", "status.reblog": "Споделяне",
"status.reblogged_by": "{name} сподели", "status.reblogged_by": "{name} сподели",
@ -152,6 +153,7 @@
"status.sensitive_warning": "Деликатно съдържание", "status.sensitive_warning": "Деликатно съдържание",
"status.show_less": "Show less", "status.show_less": "Show less",
"status.show_more": "Show more", "status.show_more": "Show more",
"status.unmute_conversation": "Unmute conversation",
"tabs_bar.compose": "Съставяне", "tabs_bar.compose": "Съставяне",
"tabs_bar.federated_timeline": "Federated", "tabs_bar.federated_timeline": "Federated",
"tabs_bar.home": "Начало", "tabs_bar.home": "Начало",

View File

@ -142,6 +142,7 @@
"status.load_more": "Weitere laden", "status.load_more": "Weitere laden",
"status.media_hidden": "Medien versteckt", "status.media_hidden": "Medien versteckt",
"status.mention": "Erwähnen", "status.mention": "Erwähnen",
"status.mute_conversation": "Mute conversation",
"status.open": "Öffnen", "status.open": "Öffnen",
"status.reblog": "Teilen", "status.reblog": "Teilen",
"status.reblogged_by": "{name} teilte", "status.reblogged_by": "{name} teilte",
@ -152,6 +153,7 @@
"status.sensitive_warning": "Heikle Inhalte", "status.sensitive_warning": "Heikle Inhalte",
"status.show_less": "Weniger anzeigen", "status.show_less": "Weniger anzeigen",
"status.show_more": "Mehr anzeigen", "status.show_more": "Mehr anzeigen",
"status.unmute_conversation": "Unmute conversation",
"tabs_bar.compose": "Schreiben", "tabs_bar.compose": "Schreiben",
"tabs_bar.federated_timeline": "Föderation", "tabs_bar.federated_timeline": "Föderation",
"tabs_bar.home": "Home", "tabs_bar.home": "Home",

View File

@ -144,6 +144,14 @@
{ {
"defaultMessage": "Report @{name}", "defaultMessage": "Report @{name}",
"id": "status.report" "id": "status.report"
},
{
"defaultMessage": "Mute conversation",
"id": "status.mute_conversation"
},
{
"defaultMessage": "Unmute conversation",
"id": "status.unmute_conversation"
} }
], ],
"path": "app/javascript/mastodon/components/status_action_bar.json" "path": "app/javascript/mastodon/components/status_action_bar.json"
@ -184,10 +192,6 @@
"defaultMessage": "Expand video", "defaultMessage": "Expand video",
"id": "video_player.expand" "id": "video_player.expand"
}, },
{
"defaultMessage": "Video could not be played",
"id": "video_player.video_error"
},
{ {
"defaultMessage": "Sensitive content", "defaultMessage": "Sensitive content",
"id": "status.sensitive_warning" "id": "status.sensitive_warning"
@ -199,6 +203,10 @@
{ {
"defaultMessage": "Media hidden", "defaultMessage": "Media hidden",
"id": "status.media_hidden" "id": "status.media_hidden"
},
{
"defaultMessage": "Video could not be played",
"id": "video_player.video_error"
} }
], ],
"path": "app/javascript/mastodon/components/video_player.json" "path": "app/javascript/mastodon/components/video_player.json"

View File

@ -142,6 +142,7 @@
"status.load_more": "Load more", "status.load_more": "Load more",
"status.media_hidden": "Media hidden", "status.media_hidden": "Media hidden",
"status.mention": "Mention @{name}", "status.mention": "Mention @{name}",
"status.mute_conversation": "Mute conversation",
"status.open": "Expand this status", "status.open": "Expand this status",
"status.reblog": "Boost", "status.reblog": "Boost",
"status.reblogged_by": "{name} boosted", "status.reblogged_by": "{name} boosted",
@ -152,6 +153,7 @@
"status.sensitive_warning": "Sensitive content", "status.sensitive_warning": "Sensitive content",
"status.show_less": "Show less", "status.show_less": "Show less",
"status.show_more": "Show more", "status.show_more": "Show more",
"status.unmute_conversation": "Unmute conversation",
"tabs_bar.compose": "Compose", "tabs_bar.compose": "Compose",
"tabs_bar.federated_timeline": "Federated", "tabs_bar.federated_timeline": "Federated",
"tabs_bar.home": "Home", "tabs_bar.home": "Home",

View File

@ -142,6 +142,7 @@
"status.load_more": "Load more", "status.load_more": "Load more",
"status.media_hidden": "Media hidden", "status.media_hidden": "Media hidden",
"status.mention": "Mencii @{name}", "status.mention": "Mencii @{name}",
"status.mute_conversation": "Mute conversation",
"status.open": "Expand this status", "status.open": "Expand this status",
"status.reblog": "Diskonigi", "status.reblog": "Diskonigi",
"status.reblogged_by": "{name} diskonigita", "status.reblogged_by": "{name} diskonigita",
@ -152,6 +153,7 @@
"status.sensitive_warning": "Tikla enhavo", "status.sensitive_warning": "Tikla enhavo",
"status.show_less": "Show less", "status.show_less": "Show less",
"status.show_more": "Show more", "status.show_more": "Show more",
"status.unmute_conversation": "Unmute conversation",
"tabs_bar.compose": "Ekskribi", "tabs_bar.compose": "Ekskribi",
"tabs_bar.federated_timeline": "Federated", "tabs_bar.federated_timeline": "Federated",
"tabs_bar.home": "Hejmo", "tabs_bar.home": "Hejmo",

View File

@ -142,6 +142,7 @@
"status.load_more": "Load more", "status.load_more": "Load more",
"status.media_hidden": "Media hidden", "status.media_hidden": "Media hidden",
"status.mention": "Mencionar", "status.mention": "Mencionar",
"status.mute_conversation": "Mute conversation",
"status.open": "Expandir estado", "status.open": "Expandir estado",
"status.reblog": "Retoot", "status.reblog": "Retoot",
"status.reblogged_by": "Retooteado por {name}", "status.reblogged_by": "Retooteado por {name}",
@ -152,6 +153,7 @@
"status.sensitive_warning": "Contenido sensible", "status.sensitive_warning": "Contenido sensible",
"status.show_less": "Mostrar menos", "status.show_less": "Mostrar menos",
"status.show_more": "Mostrar más", "status.show_more": "Mostrar más",
"status.unmute_conversation": "Unmute conversation",
"tabs_bar.compose": "Redactar", "tabs_bar.compose": "Redactar",
"tabs_bar.federated_timeline": "Federated", "tabs_bar.federated_timeline": "Federated",
"tabs_bar.home": "Inicio", "tabs_bar.home": "Inicio",

View File

@ -142,6 +142,7 @@
"status.load_more": "بیشتر نشان بده", "status.load_more": "بیشتر نشان بده",
"status.media_hidden": "تصویر پنهان شده", "status.media_hidden": "تصویر پنهان شده",
"status.mention": "نام‌بردن از @{name}", "status.mention": "نام‌بردن از @{name}",
"status.mute_conversation": "Mute conversation",
"status.open": "این نوشته را باز کن", "status.open": "این نوشته را باز کن",
"status.reblog": "بازبوقیدن", "status.reblog": "بازبوقیدن",
"status.reblogged_by": "{name} بازبوقید", "status.reblogged_by": "{name} بازبوقید",
@ -152,6 +153,7 @@
"status.sensitive_warning": "محتوای حساس", "status.sensitive_warning": "محتوای حساس",
"status.show_less": "نهفتن", "status.show_less": "نهفتن",
"status.show_more": "نمایش", "status.show_more": "نمایش",
"status.unmute_conversation": "Unmute conversation",
"tabs_bar.compose": "بنویسید", "tabs_bar.compose": "بنویسید",
"tabs_bar.federated_timeline": "همگانی", "tabs_bar.federated_timeline": "همگانی",
"tabs_bar.home": "خانه", "tabs_bar.home": "خانه",

View File

@ -142,6 +142,7 @@
"status.load_more": "Load more", "status.load_more": "Load more",
"status.media_hidden": "Media hidden", "status.media_hidden": "Media hidden",
"status.mention": "Mainitse @{name}", "status.mention": "Mainitse @{name}",
"status.mute_conversation": "Mute conversation",
"status.open": "Expand this status", "status.open": "Expand this status",
"status.reblog": "Buustaa", "status.reblog": "Buustaa",
"status.reblogged_by": "{name} buustasi", "status.reblogged_by": "{name} buustasi",
@ -152,6 +153,7 @@
"status.sensitive_warning": "Arkaluontoista sisältöä", "status.sensitive_warning": "Arkaluontoista sisältöä",
"status.show_less": "Show less", "status.show_less": "Show less",
"status.show_more": "Show more", "status.show_more": "Show more",
"status.unmute_conversation": "Unmute conversation",
"tabs_bar.compose": "Luo", "tabs_bar.compose": "Luo",
"tabs_bar.federated_timeline": "Federated", "tabs_bar.federated_timeline": "Federated",
"tabs_bar.home": "Koti", "tabs_bar.home": "Koti",

View File

@ -142,6 +142,7 @@
"status.load_more": "Charger plus", "status.load_more": "Charger plus",
"status.media_hidden": "Média caché", "status.media_hidden": "Média caché",
"status.mention": "Mentionner", "status.mention": "Mentionner",
"status.mute_conversation": "Mute conversation",
"status.open": "Déplier ce statut", "status.open": "Déplier ce statut",
"status.reblog": "Partager", "status.reblog": "Partager",
"status.reblogged_by": "{name} a partagé :", "status.reblogged_by": "{name} a partagé :",
@ -152,6 +153,7 @@
"status.sensitive_warning": "Contenu délicat", "status.sensitive_warning": "Contenu délicat",
"status.show_less": "Replier", "status.show_less": "Replier",
"status.show_more": "Déplier", "status.show_more": "Déplier",
"status.unmute_conversation": "Unmute conversation",
"tabs_bar.compose": "Composer", "tabs_bar.compose": "Composer",
"tabs_bar.federated_timeline": "Fil public global", "tabs_bar.federated_timeline": "Fil public global",
"tabs_bar.home": "Accueil", "tabs_bar.home": "Accueil",

View File

@ -142,6 +142,7 @@
"status.load_more": "עוד", "status.load_more": "עוד",
"status.media_hidden": "מדיה מוסתרת", "status.media_hidden": "מדיה מוסתרת",
"status.mention": "פניה אל @{name}", "status.mention": "פניה אל @{name}",
"status.mute_conversation": "Mute conversation",
"status.open": "הרחבת הודעה", "status.open": "הרחבת הודעה",
"status.reblog": "הדהוד", "status.reblog": "הדהוד",
"status.reblogged_by": "הודהד על ידי {name}", "status.reblogged_by": "הודהד על ידי {name}",
@ -152,6 +153,7 @@
"status.sensitive_warning": "תוכן רגיש", "status.sensitive_warning": "תוכן רגיש",
"status.show_less": "הראה פחות", "status.show_less": "הראה פחות",
"status.show_more": "הראה יותר", "status.show_more": "הראה יותר",
"status.unmute_conversation": "Unmute conversation",
"tabs_bar.compose": "חיבור", "tabs_bar.compose": "חיבור",
"tabs_bar.federated_timeline": "ציר זמן בין-קהילתי", "tabs_bar.federated_timeline": "ציר זמן בין-קהילתי",
"tabs_bar.home": "בבית", "tabs_bar.home": "בבית",

View File

@ -142,6 +142,7 @@
"status.load_more": "Učitaj više", "status.load_more": "Učitaj više",
"status.media_hidden": "Sakriven media sadržaj", "status.media_hidden": "Sakriven media sadržaj",
"status.mention": "Spomeni @{name}", "status.mention": "Spomeni @{name}",
"status.mute_conversation": "Mute conversation",
"status.open": "Proširi ovaj status", "status.open": "Proširi ovaj status",
"status.reblog": "Podigni", "status.reblog": "Podigni",
"status.reblogged_by": "{name} je podigao", "status.reblogged_by": "{name} je podigao",
@ -152,6 +153,7 @@
"status.sensitive_warning": "Osjetljiv sadržaj", "status.sensitive_warning": "Osjetljiv sadržaj",
"status.show_less": "Pokaži manje", "status.show_less": "Pokaži manje",
"status.show_more": "Pokaži više", "status.show_more": "Pokaži više",
"status.unmute_conversation": "Unmute conversation",
"tabs_bar.compose": "Sastavi", "tabs_bar.compose": "Sastavi",
"tabs_bar.federated_timeline": "Federalni", "tabs_bar.federated_timeline": "Federalni",
"tabs_bar.home": "Dom", "tabs_bar.home": "Dom",

View File

@ -142,6 +142,7 @@
"status.load_more": "Load more", "status.load_more": "Load more",
"status.media_hidden": "Media hidden", "status.media_hidden": "Media hidden",
"status.mention": "Említés", "status.mention": "Említés",
"status.mute_conversation": "Mute conversation",
"status.open": "Expand this status", "status.open": "Expand this status",
"status.reblog": "Reblog", "status.reblog": "Reblog",
"status.reblogged_by": "{name} reblogolta", "status.reblogged_by": "{name} reblogolta",
@ -152,6 +153,7 @@
"status.sensitive_warning": "Érzékeny tartalom", "status.sensitive_warning": "Érzékeny tartalom",
"status.show_less": "Show less", "status.show_less": "Show less",
"status.show_more": "Show more", "status.show_more": "Show more",
"status.unmute_conversation": "Unmute conversation",
"tabs_bar.compose": "Összeállítás", "tabs_bar.compose": "Összeállítás",
"tabs_bar.federated_timeline": "Federated", "tabs_bar.federated_timeline": "Federated",
"tabs_bar.home": "Kezdőlap", "tabs_bar.home": "Kezdőlap",

View File

@ -142,6 +142,7 @@
"status.load_more": "Tampilkan semua", "status.load_more": "Tampilkan semua",
"status.media_hidden": "Media disembunyikan", "status.media_hidden": "Media disembunyikan",
"status.mention": "Balasan @{name}", "status.mention": "Balasan @{name}",
"status.mute_conversation": "Mute conversation",
"status.open": "Tampilkan status ini", "status.open": "Tampilkan status ini",
"status.reblog": "Boost", "status.reblog": "Boost",
"status.reblogged_by": "di-boost {name}", "status.reblogged_by": "di-boost {name}",
@ -152,6 +153,7 @@
"status.sensitive_warning": "Konten sensitif", "status.sensitive_warning": "Konten sensitif",
"status.show_less": "Tampilkan lebih sedikit", "status.show_less": "Tampilkan lebih sedikit",
"status.show_more": "Tampilkan semua", "status.show_more": "Tampilkan semua",
"status.unmute_conversation": "Unmute conversation",
"tabs_bar.compose": "Tulis", "tabs_bar.compose": "Tulis",
"tabs_bar.federated_timeline": "Gabungan", "tabs_bar.federated_timeline": "Gabungan",
"tabs_bar.home": "Beranda", "tabs_bar.home": "Beranda",

View File

@ -142,6 +142,7 @@
"status.load_more": "Kargar pluse", "status.load_more": "Kargar pluse",
"status.media_hidden": "Kontenajo celita", "status.media_hidden": "Kontenajo celita",
"status.mention": "Mencionar @{name}", "status.mention": "Mencionar @{name}",
"status.mute_conversation": "Mute conversation",
"status.open": "Detaligar ca mesajo", "status.open": "Detaligar ca mesajo",
"status.reblog": "Repetar", "status.reblog": "Repetar",
"status.reblogged_by": "{name} repetita", "status.reblogged_by": "{name} repetita",
@ -152,6 +153,7 @@
"status.sensitive_warning": "Trubliva kontenajo", "status.sensitive_warning": "Trubliva kontenajo",
"status.show_less": "Montrar mine", "status.show_less": "Montrar mine",
"status.show_more": "Montrar plue", "status.show_more": "Montrar plue",
"status.unmute_conversation": "Unmute conversation",
"tabs_bar.compose": "Kompozar", "tabs_bar.compose": "Kompozar",
"tabs_bar.federated_timeline": "Federata", "tabs_bar.federated_timeline": "Federata",
"tabs_bar.home": "Hemo", "tabs_bar.home": "Hemo",

View File

@ -142,6 +142,7 @@
"status.load_more": "Mostra di più", "status.load_more": "Mostra di più",
"status.media_hidden": "Allegato nascosto", "status.media_hidden": "Allegato nascosto",
"status.mention": "Nomina @{name}", "status.mention": "Nomina @{name}",
"status.mute_conversation": "Mute conversation",
"status.open": "Espandi questo post", "status.open": "Espandi questo post",
"status.reblog": "Condividi", "status.reblog": "Condividi",
"status.reblogged_by": "{name} ha condiviso", "status.reblogged_by": "{name} ha condiviso",
@ -152,6 +153,7 @@
"status.sensitive_warning": "Materiale sensibile", "status.sensitive_warning": "Materiale sensibile",
"status.show_less": "Mostra meno", "status.show_less": "Mostra meno",
"status.show_more": "Mostra di più", "status.show_more": "Mostra di più",
"status.unmute_conversation": "Unmute conversation",
"tabs_bar.compose": "Scrivi", "tabs_bar.compose": "Scrivi",
"tabs_bar.federated_timeline": "Federazione", "tabs_bar.federated_timeline": "Federazione",
"tabs_bar.home": "Home", "tabs_bar.home": "Home",

View File

@ -142,6 +142,7 @@
"status.load_more": "もっと見る", "status.load_more": "もっと見る",
"status.media_hidden": "非表示のメデイア", "status.media_hidden": "非表示のメデイア",
"status.mention": "返信", "status.mention": "返信",
"status.mute_conversation": "Mute conversation",
"status.open": "詳細を表示", "status.open": "詳細を表示",
"status.reblog": "ブースト", "status.reblog": "ブースト",
"status.reblogged_by": "{name} さんにブーストされました", "status.reblogged_by": "{name} さんにブーストされました",
@ -152,6 +153,7 @@
"status.sensitive_warning": "閲覧注意", "status.sensitive_warning": "閲覧注意",
"status.show_less": "隠す", "status.show_less": "隠す",
"status.show_more": "もっと見る", "status.show_more": "もっと見る",
"status.unmute_conversation": "Unmute conversation",
"tabs_bar.compose": "投稿", "tabs_bar.compose": "投稿",
"tabs_bar.federated_timeline": "連合", "tabs_bar.federated_timeline": "連合",
"tabs_bar.home": "ホーム", "tabs_bar.home": "ホーム",

View File

@ -140,6 +140,7 @@
"status.load_more": "Meer laden", "status.load_more": "Meer laden",
"status.media_hidden": "Media verborgen", "status.media_hidden": "Media verborgen",
"status.mention": "Vermeld @{name}", "status.mention": "Vermeld @{name}",
"status.mute_conversation": "Mute conversation",
"status.open": "Toot volledig tonen", "status.open": "Toot volledig tonen",
"status.reblog": "Boost", "status.reblog": "Boost",
"status.reblogged_by": "{name} boostte", "status.reblogged_by": "{name} boostte",
@ -150,6 +151,7 @@
"status.sensitive_warning": "Gevoelige inhoud", "status.sensitive_warning": "Gevoelige inhoud",
"status.show_less": "Minder tonen", "status.show_less": "Minder tonen",
"status.show_more": "Meer tonen", "status.show_more": "Meer tonen",
"status.unmute_conversation": "Unmute conversation",
"tabs_bar.compose": "Schrijven", "tabs_bar.compose": "Schrijven",
"tabs_bar.federated_timeline": "Globaal", "tabs_bar.federated_timeline": "Globaal",
"tabs_bar.home": "Jouw tijdlijn", "tabs_bar.home": "Jouw tijdlijn",

View File

@ -142,6 +142,7 @@
"status.load_more": "Last mer", "status.load_more": "Last mer",
"status.media_hidden": "Media skjult", "status.media_hidden": "Media skjult",
"status.mention": "Nevn @{name}", "status.mention": "Nevn @{name}",
"status.mute_conversation": "Mute conversation",
"status.open": "Utvid denne statusen", "status.open": "Utvid denne statusen",
"status.reblog": "Fremhev", "status.reblog": "Fremhev",
"status.reblogged_by": "Fremhevd av {name}", "status.reblogged_by": "Fremhevd av {name}",
@ -152,6 +153,7 @@
"status.sensitive_warning": "Følsomt innhold", "status.sensitive_warning": "Følsomt innhold",
"status.show_less": "Vis mindre", "status.show_less": "Vis mindre",
"status.show_more": "Vis mer", "status.show_more": "Vis mer",
"status.unmute_conversation": "Unmute conversation",
"tabs_bar.compose": "Komponer", "tabs_bar.compose": "Komponer",
"tabs_bar.federated_timeline": "Felles", "tabs_bar.federated_timeline": "Felles",
"tabs_bar.home": "Hjem", "tabs_bar.home": "Hjem",

View File

@ -142,6 +142,7 @@
"status.load_more": "Cargar mai", "status.load_more": "Cargar mai",
"status.media_hidden": "Mèdia rescondut", "status.media_hidden": "Mèdia rescondut",
"status.mention": "Mencionar", "status.mention": "Mencionar",
"status.mute_conversation": "Mute conversation",
"status.open": "Desplegar aqueste estatut", "status.open": "Desplegar aqueste estatut",
"status.reblog": "Partejar", "status.reblog": "Partejar",
"status.reblogged_by": "{name} a partejat :", "status.reblogged_by": "{name} a partejat :",
@ -152,6 +153,7 @@
"status.sensitive_warning": "Contengut embarrassant", "status.sensitive_warning": "Contengut embarrassant",
"status.show_less": "Tornar plegar", "status.show_less": "Tornar plegar",
"status.show_more": "Desplegar", "status.show_more": "Desplegar",
"status.unmute_conversation": "Unmute conversation",
"tabs_bar.compose": "Compausar", "tabs_bar.compose": "Compausar",
"tabs_bar.federated_timeline": "Fil public global", "tabs_bar.federated_timeline": "Fil public global",
"tabs_bar.home": "Acuèlh", "tabs_bar.home": "Acuèlh",

View File

@ -142,6 +142,7 @@
"status.load_more": "Załaduj więcej", "status.load_more": "Załaduj więcej",
"status.media_hidden": "Zawartość multimedialna ukryta", "status.media_hidden": "Zawartość multimedialna ukryta",
"status.mention": "Wspomnij o @{name}", "status.mention": "Wspomnij o @{name}",
"status.mute_conversation": "Mute conversation",
"status.open": "Rozszerz ten status", "status.open": "Rozszerz ten status",
"status.reblog": "Podbij", "status.reblog": "Podbij",
"status.reblogged_by": "{name} podbił", "status.reblogged_by": "{name} podbił",
@ -152,6 +153,7 @@
"status.sensitive_warning": "Wrażliwa zawartość", "status.sensitive_warning": "Wrażliwa zawartość",
"status.show_less": "Pokaż mniej", "status.show_less": "Pokaż mniej",
"status.show_more": "Pokaż więcej", "status.show_more": "Pokaż więcej",
"status.unmute_conversation": "Unmute conversation",
"tabs_bar.compose": "Napisz", "tabs_bar.compose": "Napisz",
"tabs_bar.federated_timeline": "Globalne", "tabs_bar.federated_timeline": "Globalne",
"tabs_bar.home": "Strona główna", "tabs_bar.home": "Strona główna",

View File

@ -142,6 +142,7 @@
"status.load_more": "Carregar mais", "status.load_more": "Carregar mais",
"status.media_hidden": "Media escondida", "status.media_hidden": "Media escondida",
"status.mention": "Mencionar @{name}", "status.mention": "Mencionar @{name}",
"status.mute_conversation": "Mute conversation",
"status.open": "Expandir", "status.open": "Expandir",
"status.reblog": "Partilhar", "status.reblog": "Partilhar",
"status.reblogged_by": "{name} partilhou", "status.reblogged_by": "{name} partilhou",
@ -152,6 +153,7 @@
"status.sensitive_warning": "Conteúdo sensível", "status.sensitive_warning": "Conteúdo sensível",
"status.show_less": "Mostrar menos", "status.show_less": "Mostrar menos",
"status.show_more": "Mostrar mais", "status.show_more": "Mostrar mais",
"status.unmute_conversation": "Unmute conversation",
"tabs_bar.compose": "Criar", "tabs_bar.compose": "Criar",
"tabs_bar.federated_timeline": "Global", "tabs_bar.federated_timeline": "Global",
"tabs_bar.home": "Home", "tabs_bar.home": "Home",

View File

@ -142,6 +142,7 @@
"status.load_more": "Carregar mais", "status.load_more": "Carregar mais",
"status.media_hidden": "Media escondida", "status.media_hidden": "Media escondida",
"status.mention": "Mencionar @{name}", "status.mention": "Mencionar @{name}",
"status.mute_conversation": "Mute conversation",
"status.open": "Expandir", "status.open": "Expandir",
"status.reblog": "Partilhar", "status.reblog": "Partilhar",
"status.reblogged_by": "{name} partilhou", "status.reblogged_by": "{name} partilhou",
@ -152,6 +153,7 @@
"status.sensitive_warning": "Conteúdo sensível", "status.sensitive_warning": "Conteúdo sensível",
"status.show_less": "Mostrar menos", "status.show_less": "Mostrar menos",
"status.show_more": "Mostrar mais", "status.show_more": "Mostrar mais",
"status.unmute_conversation": "Unmute conversation",
"tabs_bar.compose": "Criar", "tabs_bar.compose": "Criar",
"tabs_bar.federated_timeline": "Global", "tabs_bar.federated_timeline": "Global",
"tabs_bar.home": "Home", "tabs_bar.home": "Home",

View File

@ -142,6 +142,7 @@
"status.load_more": "Показать еще", "status.load_more": "Показать еще",
"status.media_hidden": "Медиаконтент скрыт", "status.media_hidden": "Медиаконтент скрыт",
"status.mention": "Упомянуть @{name}", "status.mention": "Упомянуть @{name}",
"status.mute_conversation": "Mute conversation",
"status.open": "Развернуть статус", "status.open": "Развернуть статус",
"status.reblog": "Продвинуть", "status.reblog": "Продвинуть",
"status.reblogged_by": "{name} продвинул(а)", "status.reblogged_by": "{name} продвинул(а)",
@ -152,6 +153,7 @@
"status.sensitive_warning": "Чувствительный контент", "status.sensitive_warning": "Чувствительный контент",
"status.show_less": "Свернуть", "status.show_less": "Свернуть",
"status.show_more": "Развернуть", "status.show_more": "Развернуть",
"status.unmute_conversation": "Unmute conversation",
"tabs_bar.compose": "Написать", "tabs_bar.compose": "Написать",
"tabs_bar.federated_timeline": "Глобальная", "tabs_bar.federated_timeline": "Глобальная",
"tabs_bar.home": "Главная", "tabs_bar.home": "Главная",

View File

@ -142,6 +142,7 @@
"status.load_more": "Daha fazla", "status.load_more": "Daha fazla",
"status.media_hidden": "Gizli görsel", "status.media_hidden": "Gizli görsel",
"status.mention": "Bahset @{name}", "status.mention": "Bahset @{name}",
"status.mute_conversation": "Mute conversation",
"status.open": "Bu gönderiyi genişlet", "status.open": "Bu gönderiyi genişlet",
"status.reblog": "Boost'la", "status.reblog": "Boost'la",
"status.reblogged_by": "{name} boost etti", "status.reblogged_by": "{name} boost etti",
@ -152,6 +153,7 @@
"status.sensitive_warning": "Hassas içerik", "status.sensitive_warning": "Hassas içerik",
"status.show_less": "Daha azı", "status.show_less": "Daha azı",
"status.show_more": "Daha fazlası", "status.show_more": "Daha fazlası",
"status.unmute_conversation": "Unmute conversation",
"tabs_bar.compose": "Oluştur", "tabs_bar.compose": "Oluştur",
"tabs_bar.federated_timeline": "Federe", "tabs_bar.federated_timeline": "Federe",
"tabs_bar.home": "Ana sayfa", "tabs_bar.home": "Ana sayfa",

View File

@ -142,6 +142,7 @@
"status.load_more": "Завантажити більше", "status.load_more": "Завантажити більше",
"status.media_hidden": "Медіаконтент приховано", "status.media_hidden": "Медіаконтент приховано",
"status.mention": "Згадати", "status.mention": "Згадати",
"status.mute_conversation": "Mute conversation",
"status.open": "Розгорнути допис", "status.open": "Розгорнути допис",
"status.reblog": "Передмухнути", "status.reblog": "Передмухнути",
"status.reblogged_by": "{name} передмухнув(-ла)", "status.reblogged_by": "{name} передмухнув(-ла)",
@ -152,6 +153,7 @@
"status.sensitive_warning": "Непристойний зміст", "status.sensitive_warning": "Непристойний зміст",
"status.show_less": "Згорнути", "status.show_less": "Згорнути",
"status.show_more": "Розгорнути", "status.show_more": "Розгорнути",
"status.unmute_conversation": "Unmute conversation",
"tabs_bar.compose": "Написати", "tabs_bar.compose": "Написати",
"tabs_bar.federated_timeline": "Глобальна", "tabs_bar.federated_timeline": "Глобальна",
"tabs_bar.home": "Головна", "tabs_bar.home": "Головна",

View File

@ -142,6 +142,7 @@
"status.load_more": "加载更多", "status.load_more": "加载更多",
"status.media_hidden": "隐藏媒体内容", "status.media_hidden": "隐藏媒体内容",
"status.mention": "提及 @{name}", "status.mention": "提及 @{name}",
"status.mute_conversation": "Mute conversation",
"status.open": "展开嘟文", "status.open": "展开嘟文",
"status.reblog": "转嘟", "status.reblog": "转嘟",
"status.reblogged_by": "{name} 转嘟", "status.reblogged_by": "{name} 转嘟",
@ -152,6 +153,7 @@
"status.sensitive_warning": "敏感内容", "status.sensitive_warning": "敏感内容",
"status.show_less": "减少显示", "status.show_less": "减少显示",
"status.show_more": "显示更多", "status.show_more": "显示更多",
"status.unmute_conversation": "Unmute conversation",
"tabs_bar.compose": "撰写", "tabs_bar.compose": "撰写",
"tabs_bar.federated_timeline": "跨站", "tabs_bar.federated_timeline": "跨站",
"tabs_bar.home": "主页", "tabs_bar.home": "主页",

View File

@ -142,6 +142,7 @@
"status.load_more": "載入更多", "status.load_more": "載入更多",
"status.media_hidden": "隱藏媒體內容", "status.media_hidden": "隱藏媒體內容",
"status.mention": "提及 @{name}", "status.mention": "提及 @{name}",
"status.mute_conversation": "Mute conversation",
"status.open": "展開文章", "status.open": "展開文章",
"status.reblog": "轉推", "status.reblog": "轉推",
"status.reblogged_by": "{name} 轉推", "status.reblogged_by": "{name} 轉推",
@ -152,6 +153,7 @@
"status.sensitive_warning": "敏感內容", "status.sensitive_warning": "敏感內容",
"status.show_less": "減少顯示", "status.show_less": "減少顯示",
"status.show_more": "顯示更多", "status.show_more": "顯示更多",
"status.unmute_conversation": "Unmute conversation",
"tabs_bar.compose": "撰寫", "tabs_bar.compose": "撰寫",
"tabs_bar.federated_timeline": "跨站", "tabs_bar.federated_timeline": "跨站",
"tabs_bar.home": "主頁", "tabs_bar.home": "主頁",

View File

@ -10,7 +10,9 @@ import {
} from '../actions/interactions'; } from '../actions/interactions';
import { import {
STATUS_FETCH_SUCCESS, STATUS_FETCH_SUCCESS,
CONTEXT_FETCH_SUCCESS CONTEXT_FETCH_SUCCESS,
STATUS_MUTE_SUCCESS,
STATUS_UNMUTE_SUCCESS
} from '../actions/statuses'; } from '../actions/statuses';
import { import {
TIMELINE_REFRESH_SUCCESS, TIMELINE_REFRESH_SUCCESS,
@ -103,6 +105,10 @@ export default function statuses(state = initialState, action) {
return state.setIn([action.status.get('id'), 'reblogged'], true); return state.setIn([action.status.get('id'), 'reblogged'], true);
case REBLOG_FAIL: case REBLOG_FAIL:
return state.setIn([action.status.get('id'), 'reblogged'], false); return state.setIn([action.status.get('id'), 'reblogged'], false);
case STATUS_MUTE_SUCCESS:
return state.setIn([action.id, 'muted'], true);
case STATUS_UNMUTE_SUCCESS:
return state.setIn([action.id, 'muted'], false);
case TIMELINE_REFRESH_SUCCESS: case TIMELINE_REFRESH_SUCCESS:
case TIMELINE_EXPAND_SUCCESS: case TIMELINE_EXPAND_SUCCESS:
case ACCOUNT_TIMELINE_FETCH_SUCCESS: case ACCOUNT_TIMELINE_FETCH_SUCCESS:

View File

@ -84,6 +84,7 @@ class Account < ApplicationRecord
# Mute relationships # Mute relationships
has_many :mute_relationships, class_name: 'Mute', foreign_key: 'account_id', dependent: :destroy has_many :mute_relationships, class_name: 'Mute', foreign_key: 'account_id', dependent: :destroy
has_many :muting, -> { order('mutes.id desc') }, through: :mute_relationships, source: :target_account has_many :muting, -> { order('mutes.id desc') }, through: :mute_relationships, source: :target_account
has_many :conversation_mutes
# Media # Media
has_many :media_attachments, dependent: :destroy has_many :media_attachments, dependent: :destroy
@ -130,6 +131,10 @@ class Account < ApplicationRecord
mute_relationships.find_or_create_by!(target_account: other_account) mute_relationships.find_or_create_by!(target_account: other_account)
end end
def mute_conversation!(conversation)
conversation_mutes.find_or_create_by!(conversation: conversation)
end
def unfollow!(other_account) def unfollow!(other_account)
follow = active_relationships.find_by(target_account: other_account) follow = active_relationships.find_by(target_account: other_account)
follow&.destroy follow&.destroy
@ -145,6 +150,11 @@ class Account < ApplicationRecord
mute&.destroy mute&.destroy
end end
def unmute_conversation!(conversation)
mute = conversation_mutes.find_by(conversation: conversation)
mute&.destroy!
end
def following?(other_account) def following?(other_account)
following.include?(other_account) following.include?(other_account)
end end
@ -157,6 +167,10 @@ class Account < ApplicationRecord
muting.include?(other_account) muting.include?(other_account)
end end
def muting_conversation?(conversation)
conversation_mutes.where(conversation: conversation).exists?
end
def requested?(other_account) def requested?(other_account)
follow_requests.where(target_account: other_account).exists? follow_requests.where(target_account: other_account).exists?
end end

View File

@ -10,7 +10,7 @@
# #
class Conversation < ApplicationRecord class Conversation < ApplicationRecord
validates :uri, uniqueness: true validates :uri, uniqueness: true, if: :uri
has_many :statuses has_many :statuses

View File

@ -0,0 +1,14 @@
# frozen_string_literal: true
# == Schema Information
#
# Table name: conversation_mutes
#
# id :integer not null, primary key
# account_id :integer not null
# conversation_id :integer not null
#
class ConversationMute < ApplicationRecord
belongs_to :account, required: true
belongs_to :conversation, required: true
end

View File

@ -181,6 +181,10 @@ class Status < ApplicationRecord
select('reblog_of_id').where(reblog_of_id: status_ids).where(account_id: account_id).map { |s| [s.reblog_of_id, true] }.to_h select('reblog_of_id').where(reblog_of_id: status_ids).where(account_id: account_id).map { |s| [s.reblog_of_id, true] }.to_h
end end
def mutes_map(conversation_ids, account_id)
ConversationMute.select('conversation_id').where(conversation_id: conversation_ids).where(account_id: account_id).map { |m| [m.conversation_id, true] }.to_h
end
def reload_stale_associations!(cached_items) def reload_stale_associations!(cached_items)
account_ids = [] account_ids = []

View File

@ -43,10 +43,19 @@ class NotifyService < BaseService
blocked ||= (@notification.from_account.silenced? && !@recipient.following?(@notification.from_account)) # Hellban blocked ||= (@notification.from_account.silenced? && !@recipient.following?(@notification.from_account)) # Hellban
blocked ||= (@recipient.user.settings.interactions['must_be_follower'] && !@notification.from_account.following?(@recipient)) # Options blocked ||= (@recipient.user.settings.interactions['must_be_follower'] && !@notification.from_account.following?(@recipient)) # Options
blocked ||= (@recipient.user.settings.interactions['must_be_following'] && !@recipient.following?(@notification.from_account)) # Options blocked ||= (@recipient.user.settings.interactions['must_be_following'] && !@recipient.following?(@notification.from_account)) # Options
blocked ||= conversation_muted?
blocked ||= send("blocked_#{@notification.type}?") # Type-dependent filters blocked ||= send("blocked_#{@notification.type}?") # Type-dependent filters
blocked blocked
end end
def conversation_muted?
if @notification.target_status
@recipient.muting_conversation?(@notification.target_status.conversation)
else
false
end
end
def create_notification def create_notification
@notification.save! @notification.save!
return unless @notification.browserable? return unless @notification.browserable?

View File

@ -2,12 +2,14 @@ object @status
extends 'api/v1/statuses/_show' extends 'api/v1/statuses/_show'
node(:favourited, if: proc { !current_account.nil? }) { |status| defined?(@favourites_map) ? @favourites_map[status.id] : current_account.favourited?(status) } node(:favourited, if: proc { !current_account.nil? }) { |status| defined?(@favourites_map) ? @favourites_map[status.id] : current_account.favourited?(status) }
node(:reblogged, if: proc { !current_account.nil? }) { |status| defined?(@reblogs_map) ? @reblogs_map[status.id] : current_account.reblogged?(status) } node(:reblogged, if: proc { !current_account.nil? }) { |status| defined?(@reblogs_map) ? @reblogs_map[status.id] : current_account.reblogged?(status) }
node(:muted, if: proc { !current_account.nil? }) { |status| defined?(@mutes_map) ? @mutes_map[status.conversation_id] : current_account.muting_conversation?(status.conversation) }
child reblog: :reblog do child reblog: :reblog do
extends 'api/v1/statuses/_show' extends 'api/v1/statuses/_show'
node(:favourited, if: proc { !current_account.nil? }) { |status| defined?(@favourites_map) ? @favourites_map[status.id] : current_account.favourited?(status) } node(:favourited, if: proc { !current_account.nil? }) { |status| defined?(@favourites_map) ? @favourites_map[status.id] : current_account.favourited?(status) }
node(:reblogged, if: proc { !current_account.nil? }) { |status| defined?(@reblogs_map) ? @reblogs_map[status.id] : current_account.reblogged?(status) } node(:reblogged, if: proc { !current_account.nil? }) { |status| defined?(@reblogs_map) ? @reblogs_map[status.id] : current_account.reblogged?(status) }
node(:muted, if: proc { !current_account.nil? }) { false }
end end

View File

@ -131,6 +131,8 @@ Rails.application.routes.draw do
post :unreblog post :unreblog
post :favourite post :favourite
post :unfavourite post :unfavourite
post :mute
post :unmute
end end
end end

View File

@ -7,6 +7,5 @@ class CreateMutes < ActiveRecord::Migration[5.0]
end end
add_index :mutes, [:account_id, :target_account_id], unique: true add_index :mutes, [:account_id, :target_account_id], unique: true
end end
end end

View File

@ -0,0 +1,10 @@
class CreateConversationMutes < ActiveRecord::Migration[5.0]
def change
create_table :conversation_mutes do |t|
t.integer :account_id, null: false
t.bigint :conversation_id, null: false
end
add_index :conversation_mutes, [:account_id, :conversation_id], unique: true
end
end

View File

@ -10,7 +10,7 @@
# #
# It's strongly recommended that you check this file into your version control system. # It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20170507141759) do ActiveRecord::Schema.define(version: 20170508230434) do
# These are extensions that must be enabled in order to support this database # These are extensions that must be enabled in order to support this database
enable_extension "plpgsql" enable_extension "plpgsql"
@ -62,6 +62,12 @@ ActiveRecord::Schema.define(version: 20170507141759) do
t.index ["account_id", "target_account_id"], name: "index_blocks_on_account_id_and_target_account_id", unique: true, using: :btree t.index ["account_id", "target_account_id"], name: "index_blocks_on_account_id_and_target_account_id", unique: true, using: :btree
end end
create_table "conversation_mutes", force: :cascade do |t|
t.integer "account_id", null: false
t.bigint "conversation_id", null: false
t.index ["account_id", "conversation_id"], name: "index_conversation_mutes_on_account_id_and_conversation_id", unique: true, using: :btree
end
create_table "conversations", id: :bigserial, force: :cascade do |t| create_table "conversations", id: :bigserial, force: :cascade do |t|
t.string "uri" t.string "uri"
t.datetime "created_at", null: false t.datetime "created_at", null: false

View File

@ -183,6 +183,39 @@ RSpec.describe Api::V1::StatusesController, type: :controller do
expect(user.account.favourited?(status)).to be false expect(user.account.favourited?(status)).to be false
end end
end end
describe 'POST #mute' do
let(:status) { Fabricate(:status, account: user.account) }
before do
post :mute, params: { id: status.id }
end
it 'returns http success' do
expect(response).to have_http_status(:success)
end
it 'creates a conversation mute' do
expect(ConversationMute.find_by(account: user.account, conversation_id: status.conversation_id)).to_not be_nil
end
end
describe 'POST #unmute' do
let(:status) { Fabricate(:status, account: user.account) }
before do
post :mute, params: { id: status.id }
post :unmute, params: { id: status.id }
end
it 'returns http success' do
expect(response).to have_http_status(:success)
end
it 'destroys the conversation mute' do
expect(ConversationMute.find_by(account: user.account, conversation_id: status.conversation_id)).to be_nil
end
end
end end
context 'without an oauth token' do context 'without an oauth token' do

View File

@ -0,0 +1,2 @@
Fabricator(:conversation_mute) do
end

View File

@ -0,0 +1,5 @@
require 'rails_helper'
RSpec.describe ConversationMute, type: :model do
end

View File

@ -196,6 +196,54 @@ RSpec.describe Status, type: :model do
pending pending
end end
describe '.mutes_map' do
let(:status) { Fabricate(:status) }
let(:account) { Fabricate(:account) }
subject { Status.mutes_map([status.conversation.id], account) }
it 'returns a hash' do
expect(subject).to be_a Hash
end
it 'contains true value' do
account.mute_conversation!(status.conversation)
expect(subject[status.conversation.id]).to be true
end
end
describe '.favourites_map' do
let(:status) { Fabricate(:status) }
let(:account) { Fabricate(:account) }
subject { Status.favourites_map([status], account) }
it 'returns a hash' do
expect(subject).to be_a Hash
end
it 'contains true value' do
Fabricate(:favourite, status: status, account: account)
expect(subject[status.id]).to be true
end
end
describe '.reblogs_map' do
let(:status) { Fabricate(:status) }
let(:account) { Fabricate(:account) }
subject { Status.reblogs_map([status], account) }
it 'returns a hash' do
expect(subject).to be_a Hash
end
it 'contains true value' do
Fabricate(:status, account: account, reblog: status)
expect(subject[status.id]).to be true
end
end
describe '.local_only' do describe '.local_only' do
it 'returns only statuses from local accounts' do it 'returns only statuses from local accounts' do
local_account = Fabricate(:account, domain: nil) local_account = Fabricate(:account, domain: nil)

View File

@ -7,10 +7,50 @@ RSpec.describe NotifyService do
let(:user) { Fabricate(:user) } let(:user) { Fabricate(:user) }
let(:recipient) { user.account } let(:recipient) { user.account }
let(:activity) { Fabricate(:follow, target_account: recipient) } let(:sender) { Fabricate(:account) }
let(:activity) { Fabricate(:follow, account: sender, target_account: recipient) }
it { is_expected.to change(Notification, :count).by(1) } it { is_expected.to change(Notification, :count).by(1) }
it 'does not notify when sender is blocked' do
recipient.block!(sender)
is_expected.to_not change(Notification, :count)
end
it 'does not notify when sender is silenced and not followed' do
sender.update(silenced: true)
is_expected.to_not change(Notification, :count)
end
it 'does not notify when recipient is suspended' do
recipient.update(suspended: true)
is_expected.to_not change(Notification, :count)
end
context do
let(:asshole) { Fabricate(:account, username: 'asshole') }
let(:reply_to) { Fabricate(:status, account: asshole) }
let(:activity) { Fabricate(:mention, account: recipient, status: Fabricate(:status, account: sender, thread: reply_to)) }
it 'does not notify when conversation is muted' do
recipient.mute_conversation!(activity.status.conversation)
is_expected.to_not change(Notification, :count)
end
it 'does not notify when it is a reply to a blocked user' do
recipient.block!(asshole)
is_expected.to_not change(Notification, :count)
end
end
context do
let(:sender) { recipient }
it 'does not notify when recipient is the sender' do
is_expected.to_not change(Notification, :count)
end
end
describe 'email' do describe 'email' do
before do before do
ActionMailer::Base.deliveries.clear ActionMailer::Base.deliveries.clear