Any person claiming to be aggrieved by a practice made unlawful under this chapter or under chapter one hundred and fifty-one C, or by any other unlawful practice within the jurisdiction of the commission, may, at the expiration of ninety days after the filing of a complaint with the commission, or sooner if a commissioner assents in writing, but not later than three years after the alleged unlawful practice occurred, bring a civil action for damages or injunctive relief or both in the superior or probate court for the county in which the alleged unlawful practice occurred or in the housing court within whose district the alleged unlawful practice occurred if the unlawful practice involves residential housing. The petitioner shall notify the commission of the filing of the action, and any complaint before the commission shall then be dismissed without prejudice, and the petitioner shall be barred from subsequently bringing a complaint on the same matter before the commission. Any person claiming to be aggrieved by an unlawful practice relative to housing under this chapter, but who has not filed a complaint pursuant to section five, may commence a civil action in the superior or probate court for the county in which the alleged unlawful practice occurred or in the housing court within whose district the alleged unlawful practice occurred; provided, however, that such action shall not be commenced later than one year after the alleged unlawful practice has occurred. An aggrieved person may also seek temporary injunctive relief in the superior, housing or probate court within such county at any time to prevent irreparable injury during the pendency of or prior to the filing of a complaint with the commission.