Skip to content

Commit

Permalink
Change: Not require follow to add list
Browse files Browse the repository at this point in the history
  • Loading branch information
atsu1125 committed Sep 5, 2022
1 parent 4100baa commit 9fba65a
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 13 deletions.
2 changes: 0 additions & 2 deletions app/javascript/flavours/glitch/actions/lists.js
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,6 @@ export const fetchListSuggestions = q => (dispatch, getState) => {
q,
resolve: false,
limit: 4,
following: true,
};

api(getState).get('/api/v1/accounts/search', { params }).then(({ data }) => {
Expand Down Expand Up @@ -369,4 +368,3 @@ export const addToListAdder = listId => (dispatch, getState) => {
export const removeFromListAdder = listId => (dispatch, getState) => {
dispatch(removeFromList(listId, getState().getIn(['listAdder', 'accountId'])));
};

Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,6 @@ class Header extends ImmutablePureComponent {
}

menu.push({ text: intl.formatMessage(account.getIn(['relationship', 'endorsed']) ? messages.unendorse : messages.endorse), action: this.props.onEndorseToggle });
menu.push({ text: intl.formatMessage(messages.add_or_remove_from_list), action: this.props.onAddToList });
menu.push(null);
}

Expand All @@ -229,6 +228,7 @@ class Header extends ImmutablePureComponent {
}

menu.push({ text: intl.formatMessage(messages.report, { name: account.get('username') }), action: this.props.onReport });
menu.push({ text: intl.formatMessage(messages.add_or_remove_from_list), action: this.props.onAddToList });
}

if (account.get('acct') !== account.get('username')) {
Expand Down Expand Up @@ -318,7 +318,7 @@ class Header extends ImmutablePureComponent {
{fields.map((pair, i) => (
<dl key={i}>
<dt dangerouslySetInnerHTML={{ __html: pair.get('name_emojified') }} title={pair.get('name')} />

<dd className={pair.get('verified_at') && 'verified'} title={pair.get('value_plain')}>
{pair.get('verified_at') && <span title={intl.formatMessage(messages.linkVerifiedOn, { date: intl.formatDate(pair.get('verified_at'), dateFormatOptions) })}><Icon id='check' className='verified__mark' /></span>} <span dangerouslySetInnerHTML={{ __html: pair.get('value_emojified') }} className='translate' />
</dd>
Expand Down
2 changes: 0 additions & 2 deletions app/javascript/mastodon/actions/lists.js
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,6 @@ export const fetchListSuggestions = q => (dispatch, getState) => {
q,
resolve: false,
limit: 4,
following: true,
};

api(getState).get('/api/v1/accounts/search', { params }).then(({ data }) => {
Expand Down Expand Up @@ -369,4 +368,3 @@ export const addToListAdder = listId => (dispatch, getState) => {
export const removeFromListAdder = listId => (dispatch, getState) => {
dispatch(removeFromList(listId, getState().getIn(['listAdder', 'accountId'])));
};

Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,6 @@ class Header extends ImmutablePureComponent {
}

menu.push({ text: intl.formatMessage(account.getIn(['relationship', 'endorsed']) ? messages.unendorse : messages.endorse), action: this.props.onEndorseToggle });
menu.push({ text: intl.formatMessage(messages.add_or_remove_from_list), action: this.props.onAddToList });
menu.push(null);
}

Expand All @@ -226,6 +225,7 @@ class Header extends ImmutablePureComponent {
}

menu.push({ text: intl.formatMessage(messages.report, { name: account.get('username') }), action: this.props.onReport });
menu.push({ text: intl.formatMessage(messages.add_or_remove_from_list), action: this.props.onAddToList });
}

if (account.get('acct') !== account.get('username')) {
Expand Down
6 changes: 0 additions & 6 deletions app/models/list_account.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,9 @@
class ListAccount < ApplicationRecord
belongs_to :list
belongs_to :account
belongs_to :follow, optional: true

validates :account_id, uniqueness: { scope: :list_id }

before_validation :set_follow

private

def set_follow
self.follow = Follow.find_by!(account_id: list.account_id, target_account_id: account.id) unless list.account_id == account.id
end
end

0 comments on commit 9fba65a

Please sign in to comment.