Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
39955494a4 |
+2
-19
@@ -558,8 +558,8 @@ func (database *Database) CreateOrJoinChannel(
|
||||
// ErrInviteOnlyChannel when the channel is +i and the
|
||||
// session has no invite, ErrBadChannelKey when suppliedKey
|
||||
// is not the +k key, or ErrChannelIsFull when the channel
|
||||
// has its +l number of members. It returns nil when none
|
||||
// applies.
|
||||
// has at least its +l number of members. It returns nil
|
||||
// when none applies.
|
||||
func checkJoinRestrictions(
|
||||
ctx context.Context,
|
||||
transaction *sql.Tx,
|
||||
@@ -2304,23 +2304,6 @@ func (database *Database) HasChannelInvite(
|
||||
return count > 0, nil
|
||||
}
|
||||
|
||||
// ClearChannelInvite removes a session's invite to a
|
||||
// channel (called after successful JOIN).
|
||||
func (database *Database) ClearChannelInvite(
|
||||
ctx context.Context,
|
||||
channelID, sessionID int64,
|
||||
) error {
|
||||
_, err := database.conn.ExecContext(ctx,
|
||||
`DELETE FROM channel_invites
|
||||
WHERE channel_id = ? AND session_id = ?`,
|
||||
channelID, sessionID)
|
||||
if err != nil {
|
||||
return fmt.Errorf("clear invite: %w", err)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// --- Tier 2: Secret (+s) ---
|
||||
|
||||
// IsChannelSecret checks if a channel has +s mode.
|
||||
|
||||
@@ -1342,17 +1342,6 @@ func TestChannelInviteCRUD(t *testing.T) {
|
||||
if !has {
|
||||
t.Fatal("should have invite")
|
||||
}
|
||||
|
||||
// Clear invite.
|
||||
err = database.ClearChannelInvite(ctx, chID, sid)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
has, _ = database.HasChannelInvite(ctx, chID, sid)
|
||||
if has {
|
||||
t.Fatal("invite should be cleared")
|
||||
}
|
||||
}
|
||||
|
||||
func TestChannelSecret(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user