Merge branch 'feature/show-group-in-status-component' into 'develop'
Show group in status component See merge request gab/social/gab-social!23
This commit is contained in:
commit
2b6d7fd328
@ -88,6 +88,7 @@ class Status extends ImmutablePureComponent {
|
|||||||
updateScrollBottom: PropTypes.func,
|
updateScrollBottom: PropTypes.func,
|
||||||
cacheMediaWidth: PropTypes.func,
|
cacheMediaWidth: PropTypes.func,
|
||||||
cachedMediaWidth: PropTypes.number,
|
cachedMediaWidth: PropTypes.number,
|
||||||
|
group: ImmutablePropTypes.map,
|
||||||
};
|
};
|
||||||
|
|
||||||
// Avoid checking props that are functions (and whose equality will always
|
// Avoid checking props that are functions (and whose equality will always
|
||||||
@ -257,7 +258,7 @@ class Status extends ImmutablePureComponent {
|
|||||||
let media = null;
|
let media = null;
|
||||||
let statusAvatar, prepend, rebloggedByText, reblogContent;
|
let statusAvatar, prepend, rebloggedByText, reblogContent;
|
||||||
|
|
||||||
const { intl, hidden, featured, otherAccounts, unread, showThread } = this.props;
|
const { intl, hidden, featured, otherAccounts, unread, showThread, group } = this.props;
|
||||||
|
|
||||||
let { status, account, ...other } = this.props;
|
let { status, account, ...other } = this.props;
|
||||||
|
|
||||||
@ -426,6 +427,12 @@ class Status extends ImmutablePureComponent {
|
|||||||
</NavLink>
|
</NavLink>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{!group && status.get('group') && (
|
||||||
|
<div className='status__meta'>
|
||||||
|
Posted in <NavLink to={`/groups/${status.getIn(['group', 'id'])}`}>{status.getIn(['group', 'title'])}</NavLink>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
<StatusContent
|
<StatusContent
|
||||||
status={status}
|
status={status}
|
||||||
reblogContent={reblogContent}
|
reblogContent={reblogContent}
|
||||||
|
@ -173,13 +173,13 @@ class StatusActionBar extends ImmutablePureComponent {
|
|||||||
handleGroupRemoveAccount = () => {
|
handleGroupRemoveAccount = () => {
|
||||||
const { status } = this.props;
|
const { status } = this.props;
|
||||||
|
|
||||||
this.props.onGroupRemoveAccount(status.get('group_id'), status.getIn(['account', 'id']));
|
this.props.onGroupRemoveAccount(status.getIn(['group', 'id']), status.getIn(['account', 'id']));
|
||||||
}
|
}
|
||||||
|
|
||||||
handleGroupRemovePost = () => {
|
handleGroupRemovePost = () => {
|
||||||
const { status } = this.props;
|
const { status } = this.props;
|
||||||
|
|
||||||
this.props.onGroupRemoveStatus(status.get('group_id'), status.get('id'));
|
this.props.onGroupRemoveStatus(status.getIn(['group', 'id']), status.get('id'));
|
||||||
}
|
}
|
||||||
|
|
||||||
_makeMenu = (publicStatus) => {
|
_makeMenu = (publicStatus) => {
|
||||||
|
@ -25,6 +25,7 @@ export default class StatusList extends ImmutablePureComponent {
|
|||||||
timelineId: PropTypes.string,
|
timelineId: PropTypes.string,
|
||||||
queuedItemSize: PropTypes.number,
|
queuedItemSize: PropTypes.number,
|
||||||
onDequeueTimeline: PropTypes.func,
|
onDequeueTimeline: PropTypes.func,
|
||||||
|
group: ImmutablePropTypes.map,
|
||||||
withGroupAdmin: PropTypes.bool,
|
withGroupAdmin: PropTypes.bool,
|
||||||
onScrollToTop: PropTypes.func,
|
onScrollToTop: PropTypes.func,
|
||||||
onScroll: PropTypes.func,
|
onScroll: PropTypes.func,
|
||||||
@ -85,7 +86,7 @@ export default class StatusList extends ImmutablePureComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
render () {
|
render () {
|
||||||
const { statusIds, featuredStatusIds, onLoadMore, timelineId, totalQueuedItemsCount, isLoading, isPartial, withGroupAdmin, ...other } = this.props;
|
const { statusIds, featuredStatusIds, onLoadMore, timelineId, totalQueuedItemsCount, isLoading, isPartial, withGroupAdmin, group, ...other } = this.props;
|
||||||
|
|
||||||
if (isPartial) {
|
if (isPartial) {
|
||||||
return (
|
return (
|
||||||
@ -115,6 +116,7 @@ export default class StatusList extends ImmutablePureComponent {
|
|||||||
onMoveUp={this.handleMoveUp}
|
onMoveUp={this.handleMoveUp}
|
||||||
onMoveDown={this.handleMoveDown}
|
onMoveDown={this.handleMoveDown}
|
||||||
contextType={timelineId}
|
contextType={timelineId}
|
||||||
|
group={group}
|
||||||
withGroupAdmin={withGroupAdmin}
|
withGroupAdmin={withGroupAdmin}
|
||||||
showThread
|
showThread
|
||||||
/>
|
/>
|
||||||
|
@ -94,6 +94,7 @@ class GroupTimeline extends React.PureComponent {
|
|||||||
scrollKey={`group_timeline-${columnId}`}
|
scrollKey={`group_timeline-${columnId}`}
|
||||||
timelineId={`group:${id}`}
|
timelineId={`group:${id}`}
|
||||||
onLoadMore={this.handleLoadMore}
|
onLoadMore={this.handleLoadMore}
|
||||||
|
group={group}
|
||||||
withGroupAdmin={relationships && relationships.get('admin')}
|
withGroupAdmin={relationships && relationships.get('admin')}
|
||||||
emptyMessage={<FormattedMessage id='empty_column.group' defaultMessage='There is nothing in this group yet. When members of this group post new statuses, they will appear here.' />}
|
emptyMessage={<FormattedMessage id='empty_column.group' defaultMessage='There is nothing in this group yet. When members of this group post new statuses, they will appear here.' />}
|
||||||
/>
|
/>
|
||||||
|
@ -565,6 +565,21 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&__meta {
|
||||||
|
font-size: 14px;
|
||||||
|
color: $gab-secondary-text;
|
||||||
|
|
||||||
|
a {
|
||||||
|
color: $gab-brand-default;
|
||||||
|
font-weight: bold;
|
||||||
|
text-decoration: none;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.notification-favourite {
|
.notification-favourite {
|
||||||
|
@ -104,6 +104,7 @@ class Status < ApplicationRecord
|
|||||||
|
|
||||||
cache_associated :application,
|
cache_associated :application,
|
||||||
:media_attachments,
|
:media_attachments,
|
||||||
|
:group,
|
||||||
:conversation,
|
:conversation,
|
||||||
:status_stat,
|
:status_stat,
|
||||||
:tags,
|
:tags,
|
||||||
|
@ -4,7 +4,7 @@ class REST::StatusSerializer < ActiveModel::Serializer
|
|||||||
attributes :id, :created_at, :in_reply_to_id, :in_reply_to_account_id,
|
attributes :id, :created_at, :in_reply_to_id, :in_reply_to_account_id,
|
||||||
:sensitive, :spoiler_text, :visibility, :language,
|
:sensitive, :spoiler_text, :visibility, :language,
|
||||||
:uri, :url, :replies_count, :reblogs_count,
|
:uri, :url, :replies_count, :reblogs_count,
|
||||||
:favourites_count, :group_id
|
:favourites_count
|
||||||
|
|
||||||
attribute :favourited, if: :current_user?
|
attribute :favourited, if: :current_user?
|
||||||
attribute :reblogged, if: :current_user?
|
attribute :reblogged, if: :current_user?
|
||||||
@ -17,6 +17,7 @@ class REST::StatusSerializer < ActiveModel::Serializer
|
|||||||
belongs_to :reblog, serializer: REST::StatusSerializer
|
belongs_to :reblog, serializer: REST::StatusSerializer
|
||||||
belongs_to :application, if: :show_application?
|
belongs_to :application, if: :show_application?
|
||||||
belongs_to :account, serializer: REST::AccountSerializer
|
belongs_to :account, serializer: REST::AccountSerializer
|
||||||
|
belongs_to :group, serializer: REST::GroupSerializer
|
||||||
|
|
||||||
has_many :media_attachments, serializer: REST::MediaAttachmentSerializer
|
has_many :media_attachments, serializer: REST::MediaAttachmentSerializer
|
||||||
has_many :ordered_mentions, key: :mentions
|
has_many :ordered_mentions, key: :mentions
|
||||||
|
Loading…
x
Reference in New Issue
Block a user