MCPcopy Create free account
hub / github.com/gogs/gogs / Unfollow

Method Unfollow

internal/database/users.go:651–663  ·  view source on GitHub ↗

Unfollow removes the mark the user to follow the other user.

(ctx context.Context, userID, followID int64)

Source from the content-addressed store, hash-verified

649
650// Unfollow removes the mark the user to follow the other user.
651func (s *UsersStore) Unfollow(ctx context.Context, userID, followID int64) error {
652 if userID == followID {
653 return nil
654 }
655
656 return s.db.WithContext(ctx).Transaction(func(tx *gorm.DB) error {
657 err := tx.Where("user_id = ? AND follow_id = ?", userID, followID).Delete(&Follow{}).Error
658 if err != nil {
659 return errors.Wrap(err, "delete")
660 }
661 return s.recountFollows(tx, userID, followID)
662 })
663}
664
665// IsFollowing returns true if the user is following the other user.
666func (s *UsersStore) IsFollowing(ctx context.Context, userID, followID int64) bool {

Callers 4

usersIsFollowingFunction · 0.80
usersUnfollowFunction · 0.80
ActionFunction · 0.80
UnfollowFunction · 0.80

Calls 3

recountFollowsMethod · 0.95
DeleteMethod · 0.80
WhereMethod · 0.80

Tested by 2

usersIsFollowingFunction · 0.64
usersUnfollowFunction · 0.64